react-semaphor 0.1.560 → 0.1.561

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 (107) hide show
  1. package/dist/analytics-protocol/index.js +353 -349
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{analytics-base-schemas-CHLxsPfX.js → analytics-base-schemas-CB3oFAXk.js} +199 -171
  7. package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-DiVHY3Hw.js} +27 -28
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Da41xfUd.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-DDsIWJYT.js} +108 -108
  12. package/dist/chunks/{context-BgPDzLHZ.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-Dz-enUNR.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-CgvTLndW.js} +161 -162
  16. package/dist/chunks/{dashboard-controls-Bi7fyG-4.js → dashboard-controls-B4vfSzTF.js} +881 -945
  17. package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-DwjZcxj-.js} +6112 -6146
  20. package/dist/chunks/{filter-reach-copy-BF4w4kI2.js → filter-reach-copy-bijwf_-b.js} +1250 -1392
  21. package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-DtHidOPV.js → index-ClwbY3BL.js} +197 -198
  24. package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-BSiGEXVC.js} +255 -248
  30. package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-Bsh376zO.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C2YUIwKG.js} +14 -14
  36. package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-B5EAsgQF.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-8jqfI7hI.js} +12 -12
  40. package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-E2XWyibu.js} +30253 -31076
  42. package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-C29EUzDp.js} +7 -7
  43. package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-ByxH4M7t.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-CQtXUVMy.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-wbR-NVzq.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-CXTneCA4.js → validators-BtaCFIEB.js} +37 -37
  51. package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2400 -1856
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +257 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  63. package/dist/types/index.js +50 -51
  64. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  65. package/dist/types/lib/stores/editor-store.d.ts +9 -1
  66. package/dist/types/lib/stores/table-actions.d.ts +0 -2
  67. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +10 -0
  68. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  69. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  70. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  71. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  72. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  73. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  74. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  75. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  76. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  77. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  78. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  79. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  80. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  81. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  82. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  83. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  84. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  85. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  86. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  87. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +539 -22
  88. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  89. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  90. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +1 -8
  91. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  92. package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
  93. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  94. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  95. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  96. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  97. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
  98. package/dist/types/shared/format-utils/raw-temporal.d.ts +16 -0
  99. package/package.json +2 -2
  100. package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
  101. package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
  102. package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
  103. package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
  104. package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
  105. package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
  106. package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
  107. package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
@@ -1,27 +1,25 @@
1
- import { am as xn, an as Sn, ao as Dn, ap as Tt, aq as wn, ar as Tn, x as On, as as Mn, at as Pn, au as kn, av as Ot, aw as An, ax as Nn, ay as Rn, az as ve, aA as _n, aB as En, aC as Vn, b as Kn, aD as Ln, v as Bn, A as qn, aE as $n, aF as zn } from "./resolve-dashboard-input-context-CAMiWvyR.js";
2
- import { dH as Mt, aT as le, a as z, dO as Pt, aV as Un, dP as jn, dQ as ke, dR as Gn, dS as Wn, O as Ae, dT as Hn, dU as Yn, P as Jn, dV as T, aw as Qn, dW as kt, dX as Ne, dY as Zn, dZ as Xn, d_ as it, d$ as ei, e0 as rt, e1 as ti, e2 as ni, U as At, e3 as Nt, e4 as Rt, v as _t, e5 as at, a0 as U, e6 as Re, dj as ot, dl as _e, dg as st, e7 as lt, dK as ii, bp as Ee, e8 as ri, e9 as ai, ea as oi, dd as Q, bs as ct, eb as si, a6 as Et, a7 as Vt, d as li, ec as j, bu as ci, ed as ui, bv as di, aE as Kt, ee as fi, ef as mi, eg as pi, eh as gi, c as Lt, dJ as yi, ei as hi, ej as bi, dr as Se, ek as vi, el as Fe, cl as Bt, em as ut, en as Fi, bV as Ci, co as dt, cn as Ii, eo as xi, d4 as Si, d6 as Di } from "./global-date-filter-utils-D8365uPH.js";
3
- import { aj as qt, f as wi, e as Ti, ag as $t, aA as Oi, v as Mi, b0 as zt, aY as De, aW as L, aZ as Pi, b2 as ki } from "./validators-CXTneCA4.js";
4
- import "./matrix-operation-contract-WPv4R-H_.js";
5
- import { r as Ai, C as Ni } from "./metric-comparison-ljMKYZKa.js";
6
- import { t as ft } from "./analytics-base-schemas-CHLxsPfX.js";
1
+ import { am as Cn, an as In, ao as xn, ap as Dt, aq as Sn, ar as Dn, as as Tn, at as wn, au as Mn, av as Tt, aw as On, ax as Pn, ay as Nn, az as ve, aA as kn, aB as An, aC as _n, g as Rn, aD as En, C as Vn, G as Kn, aE as Ln, aF as Bn } from "./resolve-dashboard-input-context-q_iiNXE1.js";
2
+ import { eb as wt, bh as ce, ej as qn, ek as $n, el as Un, em as zn, R as z, en as Mt, bj as jn, eo as Gn, ep as Pe, ao as Ne, eq as Wn, bl as Hn, er as Qn, es as Yn, M as ke, et as Jn, eu as Xn, S as Zn, ev as er, N as tr, ew as w, aX as nr, ex as Ot, ey as H, ez as rr, eA as ir, eB as tt, eC as ar, eD as nt, eE as or, eF as L, eG as sr, Z as Pt, eH as Nt, eI as kt, v as At, eJ as rt, a5 as j, eK as Ae, eL as it, eM as _e, ef as at, eN as ot, ee as cr, bV as Re, eO as lr, eP as ur, eQ as dr, eR as X, bY as st, eS as fr, ab as _t, ac as Rt, d as mr, b_ as pr, eT as gr, b$ as yr, b3 as Et, eU as hr, eV as br, eW as vr, eX as Fr, b as Vt, ed as Cr, eY as Ir, eZ as xr, e_ as Se, e$ as Sr, f0 as Fe, cR as Kt, f1 as ct, f2 as Dr, cp as Tr, cU as lt, cT as wr, f3 as Mr, dB as Or, dD as Pr, bm as Nr, dG as kr, ad as ut } from "./global-date-filter-utils-BXgCpvQM.js";
3
+ import { aj as Lt, f as Ar, e as _r, ag as Bt, aA as Rr, v as Er, a$ as qt, aY as De, aW as B, aZ as Vr, b0 as Kr } from "./validators-BtaCFIEB.js";
4
+ import "./matrix-operation-contract-BSiGEXVC.js";
5
+ import { r as Lr, C as Br } from "./metric-comparison-95aC0uEO.js";
6
+ import { t as dt } from "./analytics-base-schemas-CB3oFAXk.js";
7
7
  import "zod";
8
- import { d as G, i as N, ao as Ri, ap as _i, o as Ei, k as Vi, g as we, h as Ki, J as P, R as Li, v as Bi, e as qi, r as $i, O as zi, Z as Ui } from "./temporal-input-presentation-uvNK_tM0.js";
9
- import { w as ji } from "./pivot-result-contract-expectations-Bl5suy4-.js";
8
+ import { b as G, i as A, aI as qr, aJ as $r, m as Ur, h as zr, d as Te, e as jr, Q as P, ae as Gr, am as Wr, c as Hr, ag as Qr, W as Yr, w as Jr, a4 as Xr } from "./temporal-input-presentation-B77JsAzU.js";
10
9
  import "../value-format-preferences/index.js";
11
- import { L as Gi, w as me } from "./table-settings-Imz0FgWi.js";
12
- import { g as Wi } from "./_commonjsHelpers-DimLPMtv.js";
13
- import { f as Hi, b as Yi } from "./raw-temporal-presentation-BHm7s-hz.js";
10
+ import { y as Zr, z as me } from "./bookmark-state-BusLpkb7.js";
11
+ import { g as ei } from "./_commonjsHelpers-DimLPMtv.js";
14
12
  import "./index-CJW5BdWT.js";
15
13
  import "./index-CuHybtft.js";
16
- import { r as Ji } from "./source-entity-resolution-dUG5VWRm.js";
17
- import { R as Qi } from "./matrix-analytical-definition-CM18W8w6.js";
18
- import { r as Ut } from "./applied-constraints-DU-wndZ7.js";
19
- const Do = 15, Zi = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, Xi = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, er = /\bwhere\b/i;
20
- function tr(e) {
21
- return e != null && e.trim() ? Zi.test(e) || Xi.test(e) : !1;
22
- }
23
- function wo(e) {
24
- return !(e != null && e.trim()) || tr(e) ? null : er.test(e) ? {
14
+ import { r as ti } from "./source-entity-resolution-BXI3nQ5Z.js";
15
+ import { R as ni } from "./matrix-analytical-definition-pU51-JmY.js";
16
+ import { r as $t } from "./applied-constraints-DU-wndZ7.js";
17
+ const Fo = 15, ri = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, ii = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, ai = /\bwhere\b/i;
18
+ function oi(e) {
19
+ return e != null && e.trim() ? ri.test(e) || ii.test(e) : !1;
20
+ }
21
+ function Co(e) {
22
+ return !(e != null && e.trim()) || oi(e) ? null : ai.test(e) ? {
25
23
  helper: "{{ filters | and }}",
26
24
  description: "For queries with an existing WHERE clause."
27
25
  } : {
@@ -29,7 +27,7 @@ function wo(e) {
29
27
  description: "For queries without a WHERE clause."
30
28
  };
31
29
  }
32
- function nr(e, t) {
30
+ function si(e, t) {
33
31
  if (!(typeof e != "number" || typeof t != "number"))
34
32
  return e === t ? t : void 0;
35
33
  }
@@ -61,12 +59,12 @@ function E(e, t) {
61
59
  suffix: n.suffix,
62
60
  negativeInParentheses: n.negativeStyle === "parentheses"
63
61
  };
64
- if (N(n))
62
+ if (A(n))
65
63
  return {
66
64
  type: n.type,
67
65
  locale: n.locale,
68
66
  currency: n.type === "currency" ? n.currency : void 0,
69
- decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : nr(
67
+ decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : si(
70
68
  n.minimumFractionDigits,
71
69
  n.maximumFractionDigits
72
70
  ),
@@ -83,7 +81,7 @@ function E(e, t) {
83
81
  };
84
82
  }
85
83
  }
86
- function jt(e, t) {
84
+ function Ut(e, t) {
87
85
  const n = G(e, t);
88
86
  return (n == null ? void 0 : n.type) === "duration" ? {
89
87
  style: "duration",
@@ -97,10 +95,10 @@ function jt(e, t) {
97
95
  prefix: n.prefix,
98
96
  suffix: n.suffix,
99
97
  negativeStyle: n.negativeStyle
100
- } : !n || !N(n) ? void 0 : {
98
+ } : !n || !A(n) ? void 0 : {
101
99
  style: n.type === "currency" ? "currency" : n.type === "percent" ? "percent" : n.type === "scientific" ? "scientific" : "decimal",
102
100
  currency: n.type === "currency" && n.currency || (t != null && t.preserveOmittedProperties ? void 0 : "USD"),
103
- locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Ri),
101
+ locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : qr),
104
102
  minimumFractionDigits: n.minimumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 0),
105
103
  maximumFractionDigits: n.maximumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 2),
106
104
  useGrouping: typeof n.useGrouping == "boolean" ? n.useGrouping : !0,
@@ -113,60 +111,60 @@ function jt(e, t) {
113
111
  suffix: n.suffix
114
112
  };
115
113
  }
116
- const mt = [10, 20, 50, 100, 500, 1e3], ir = 50;
117
- function rr(e) {
118
- return e && e > 0 ? e : ir;
114
+ const ft = [10, 20, 50, 100, 500, 1e3], ci = 50;
115
+ function li(e) {
116
+ return e && e > 0 ? e : ci;
119
117
  }
120
- function To(e) {
121
- const t = rr(e), n = [...mt];
122
- return mt.includes(
118
+ function Io(e) {
119
+ const t = li(e), n = [...ft];
120
+ return ft.includes(
123
121
  t
124
- ) || (n.push(t), n.sort((i, r) => i - r)), n;
122
+ ) || (n.push(t), n.sort((r, i) => r - i)), n;
125
123
  }
126
- function Oo(e) {
124
+ function xo(e) {
127
125
  var t, n;
128
- return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Mt(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
126
+ return !!((e.type === "table" || e.type === "detailTable") && e.sql && !wt(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
129
127
  }
130
- function ar(e, t) {
131
- var i, r, a, o;
128
+ function ui(e, t) {
129
+ var r, i, a, o;
132
130
  if (t === "table-print")
133
131
  return "disabled";
134
- if ((r = (i = e.preferences) == null ? void 0 : i.tablePrefs) != null && r.forceClientPagination)
132
+ if ((i = (r = e.preferences) == null ? void 0 : r.tablePrefs) != null && i.forceClientPagination)
135
133
  return "client";
136
- const n = Mt(e.config);
137
- return e.sql && !n ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : n && xn(e) ? "server" : "client";
134
+ const n = wt(e.config);
135
+ return e.sql && !n ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : n && Cn(e) ? "server" : "client";
138
136
  }
139
- const Gt = Object.freeze({}), Mo = {
137
+ const zt = Object.freeze({}), So = {
140
138
  access: "session-only",
141
139
  printMode: !1,
142
140
  baseline: null,
143
141
  applied: null,
144
142
  appliedBookmark: null,
145
- tableSettings: Gt,
143
+ tableSettings: zt,
146
144
  notices: [],
147
145
  isFavorite: !1,
148
146
  fetchedAt: 0
149
147
  };
150
- function Po(e) {
148
+ function Do(e) {
151
149
  return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
152
150
  }
153
- function or(e) {
154
- return e.isDashboardEditing ? Gt : e.viewer.tableSettings;
151
+ function di(e) {
152
+ return e.isDashboardEditing ? zt : e.viewer.tableSettings;
155
153
  }
156
- function sr(e, t) {
157
- return or(e)[t];
154
+ function fi(e, t) {
155
+ return di(e)[t];
158
156
  }
159
- function ko(e, t, n) {
160
- if (!(n.isEditorPreview || e.isDashboardEditing) && Gi(e.dashboard, t))
161
- return { settings: sr(e, t) };
157
+ function To(e, t, n) {
158
+ if (!(n.isEditorPreview || e.isDashboardEditing) && Zr(e.dashboard, t))
159
+ return { settings: fi(e, t) };
162
160
  }
163
- function lr(e) {
161
+ function mi(e) {
164
162
  var t;
165
- return Sn({
163
+ return In({
166
164
  card: e.card,
167
- paginationMode: ar(e.card) === "server" ? "server" : "client",
165
+ paginationMode: ui(e.card) === "server" ? "server" : "client",
168
166
  result: {
169
- keys: e.keys ?? Dn(e.records),
167
+ keys: e.keys ?? xn(e.records),
170
168
  rows: e.records,
171
169
  columns: e.resultColumns,
172
170
  columnKeyMap: e.columnKeyMap,
@@ -176,26 +174,26 @@ function lr(e) {
176
174
  projection: "export"
177
175
  });
178
176
  }
179
- function cr(e) {
177
+ function pi(e) {
180
178
  if (e)
181
179
  return E(
182
180
  G(e, { preserveOmittedProperties: !0 }),
183
181
  { preserveOmittedProperties: !0 }
184
182
  );
185
183
  }
186
- function ur(e) {
184
+ function gi(e) {
187
185
  if (e.type === "percent") {
188
- const { multiplyBy: t, percentValueMode: n, ...i } = e, r = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
189
- if (r || t === void 0)
190
- return ft(
191
- le({ ...i, ...r ? { percentValueMode: r } : {} }, { preserveOmittedProperties: !0 })
186
+ const { multiplyBy: t, percentValueMode: n, ...r } = e, i = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
187
+ if (i || t === void 0)
188
+ return dt(
189
+ ce({ ...r, ...i ? { percentValueMode: i } : {} }, { preserveOmittedProperties: !0 })
192
190
  );
193
191
  }
194
- return ft(
195
- le(e, { preserveOmittedProperties: !0 })
192
+ return dt(
193
+ ce(e, { preserveOmittedProperties: !0 })
196
194
  );
197
195
  }
198
- const pe = cr, Ao = ur, dr = () => ({
196
+ const pe = pi, wo = gi, yi = () => ({
199
197
  urlTemplate: "{value}",
200
198
  // Default: use cell value as-is
201
199
  labelType: "value",
@@ -204,14 +202,14 @@ const pe = cr, Ao = ur, dr = () => ({
204
202
  labelColumn: "",
205
203
  openInNewTab: !0
206
204
  // Default: open in new tab (current behavior)
207
- }), Ve = () => ({
205
+ }), Ee = () => ({
208
206
  type: "none",
209
207
  inheritMetricFormat: !0,
210
208
  textAlign: "left",
211
- width: 150,
212
- // Default width in pixels
213
- minWidth: 50,
214
- maxWidth: 500,
209
+ // The table's one width rule (card appearance P2-21).
210
+ width: Un,
211
+ minWidth: $n,
212
+ maxWidth: qn,
215
213
  textOverflow: "ellipsis",
216
214
  textWrap: "default",
217
215
  numberFormat: {
@@ -233,12 +231,12 @@ const pe = cr, Ao = ur, dr = () => ({
233
231
  sourceTimezone: "auto"
234
232
  // Default to auto (use explicit timezone if present, otherwise assume UTC)
235
233
  },
236
- linkFormat: dr()
234
+ linkFormat: yi()
237
235
  });
238
- function No(e, t, n, i) {
236
+ function Mo(e, t, n, r) {
239
237
  return t && t !== "auto" ? t : n;
240
238
  }
241
- const Ro = (e) => !e || e === "auto" ? "local time" : {
239
+ const Oo = (e) => !e || e === "auto" ? "local time" : {
242
240
  "America/New_York": "Eastern Time",
243
241
  "America/Chicago": "Central Time",
244
242
  "America/Denver": "Mountain Time",
@@ -249,15 +247,15 @@ const Ro = (e) => !e || e === "auto" ? "local time" : {
249
247
  "Asia/Shanghai": "China Time",
250
248
  UTC: "UTC"
251
249
  }[e] || e;
252
- function Wt(e, t) {
253
- const n = typeof e.decimalPlaces == "number", i = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : n ? e.decimalPlaces : t.min, r = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : n ? e.decimalPlaces : t.max;
250
+ function jt(e, t) {
251
+ const n = typeof e.decimalPlaces == "number", r = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : n ? e.decimalPlaces : t.min, i = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : n ? e.decimalPlaces : t.max;
254
252
  return {
255
- minimumFractionDigits: i,
256
- maximumFractionDigits: Math.max(i, r)
253
+ minimumFractionDigits: r,
254
+ maximumFractionDigits: Math.max(r, i)
257
255
  };
258
256
  }
259
- function ce(e, t) {
260
- const n = Wt(e, t), i = typeof e.suffix == "string" && e.suffix.length > 0;
257
+ function le(e, t) {
258
+ const n = jt(e, t), r = typeof e.suffix == "string" && e.suffix.length > 0;
261
259
  return {
262
260
  style: "decimal",
263
261
  locale: e.locale,
@@ -266,7 +264,7 @@ function ce(e, t) {
266
264
  maximumFractionDigits: n.maximumFractionDigits,
267
265
  useGrouping: e.useGrouping,
268
266
  // Preserve legacy behavior: explicit custom suffix should not trigger compacting.
269
- useSuffix: !!(e.useSuffix && !i),
267
+ useSuffix: !!(e.useSuffix && !r),
270
268
  prefix: e.prefix,
271
269
  suffix: e.suffix,
272
270
  negativeInParentheses: e.negativeInParentheses,
@@ -274,48 +272,48 @@ function ce(e, t) {
274
272
  percentValueMode: e.percentValueMode
275
273
  };
276
274
  }
277
- function Ke(e, t = "auto", n = {}) {
278
- if (t === "auto" && (t = yr(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
279
- const r = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, a = Number(e) * r, o = _i(a, n.signDisplay), s = Ke(o.value === a ? e : -Number(e), t, { ...n, signDisplay: void 0 });
275
+ function Ve(e, t = "auto", n = {}) {
276
+ if (t === "auto" && (t = Ci(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
277
+ const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, a = Number(e) * i, o = $r(a, n.signDisplay), s = Ve(o.value === a ? e : -Number(e), t, { ...n, signDisplay: void 0 });
280
278
  if (!o.plus) return s;
281
279
  const l = n.prefix ?? "";
282
280
  return l && s.startsWith(l) ? `${l}+${s.slice(l.length)}` : `+${s}`;
283
281
  }
284
282
  switch (t) {
285
283
  case "number":
286
- return Ht(e, n);
284
+ return Gt(e, n);
287
285
  case "currency":
288
- return Yt(e, n);
286
+ return Wt(e, n);
289
287
  case "percent":
290
- return fr(e, n);
288
+ return hi(e, n);
291
289
  case "date":
292
- return mr(e, n);
290
+ return bi(e, n);
293
291
  case "scientific":
294
- return pr(e, n);
292
+ return vi(e, n);
295
293
  case "duration":
296
- return gr(e, n);
294
+ return Fi(e, n);
297
295
  default:
298
296
  return String(e);
299
297
  }
300
298
  }
301
- function Ht(e, t = {}) {
302
- return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${we(
299
+ function Gt(e, t = {}) {
300
+ return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${Te(
303
301
  Math.abs(e),
304
- ce(t, {
302
+ le(t, {
305
303
  min: 0,
306
304
  max: 0
307
305
  })
308
- )}` : we(
306
+ )}` : Te(
309
307
  e,
310
- ce(t, {
308
+ le(t, {
311
309
  min: 0,
312
310
  max: 0
313
311
  })
314
312
  );
315
313
  }
316
- function Yt(e, t = {}) {
317
- return Ki(e, {
318
- ...ce(t, {
314
+ function Wt(e, t = {}) {
315
+ return jr(e, {
316
+ ...le(t, {
319
317
  min: 2,
320
318
  max: 2
321
319
  }),
@@ -323,9 +321,9 @@ function Yt(e, t = {}) {
323
321
  currency: t.currency || "USD"
324
322
  });
325
323
  }
326
- function fr(e, t = {}) {
327
- const n = Wt(t, { min: 1, max: 1 }), r = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * r;
328
- return we(a, {
324
+ function hi(e, t = {}) {
325
+ const n = jt(t, { min: 1, max: 1 }), i = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * i;
326
+ return Te(a, {
329
327
  locale: t.locale,
330
328
  minimumFractionDigits: n.minimumFractionDigits,
331
329
  maximumFractionDigits: n.maximumFractionDigits,
@@ -336,25 +334,25 @@ function fr(e, t = {}) {
336
334
  useSuffix: !1
337
335
  });
338
336
  }
339
- function mr(e, t = {}) {
337
+ function bi(e, t = {}) {
340
338
  const { locale: n = "en-US" } = t;
341
339
  try {
342
- const i = new Date(e);
343
- return isNaN(i.getTime()) ? String(e) : new Intl.DateTimeFormat(n, {
340
+ const r = new Date(e);
341
+ return isNaN(r.getTime()) ? String(e) : new Intl.DateTimeFormat(n, {
344
342
  dateStyle: "short"
345
- }).format(i);
343
+ }).format(r);
346
344
  } catch {
347
345
  return String(e);
348
346
  }
349
347
  }
350
- function pr(e, t = {}) {
351
- return Vi(
348
+ function vi(e, t = {}) {
349
+ return zr(
352
350
  e,
353
- ce(t, { min: 2, max: 2 })
351
+ le(t, { min: 2, max: 2 })
354
352
  );
355
353
  }
356
- function gr(e, t = {}) {
357
- return Ei(e, {
354
+ function Fi(e, t = {}) {
355
+ return Ur(e, {
358
356
  inputUnit: t.durationInputUnit,
359
357
  outputStyle: t.durationDisplayStyle,
360
358
  largestUnit: t.durationLargestUnit,
@@ -365,55 +363,55 @@ function gr(e, t = {}) {
365
363
  negativeInParentheses: t.negativeInParentheses
366
364
  });
367
365
  }
368
- function yr(e, t) {
366
+ function Ci(e, t) {
369
367
  return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
370
368
  }
371
- function _o(e, t = {}) {
372
- return (n) => Ke(n, e, t);
369
+ function Po(e, t = {}) {
370
+ return (n) => Ve(n, e, t);
373
371
  }
374
- function hr({
372
+ function Ii({
375
373
  number: e,
376
374
  decimalPlaces: t = 0,
377
375
  useSuffix: n = !1,
378
- customSuffix: i = "",
379
- currency: r = "",
376
+ customSuffix: r = "",
377
+ currency: i = "",
380
378
  locale: a = "en-US"
381
379
  }) {
382
- if (r) {
383
- const o = Yt(e, {
384
- currency: r,
380
+ if (i) {
381
+ const o = Wt(e, {
382
+ currency: i,
385
383
  decimalPlaces: t,
386
384
  locale: a,
387
- useSuffix: n && !i
385
+ useSuffix: n && !r
388
386
  });
389
- return n && i ? `${o}${i}` : o;
387
+ return n && r ? `${o}${r}` : o;
390
388
  }
391
- return Ht(e, {
389
+ return Gt(e, {
392
390
  decimalPlaces: t,
393
- useSuffix: n && !i,
394
- suffix: i,
391
+ useSuffix: n && !r,
392
+ suffix: r,
395
393
  locale: a
396
394
  });
397
395
  }
398
- var br = function e(t, n) {
396
+ var xi = function e(t, n) {
399
397
  if (t === n) return !0;
400
398
  if (t && n && typeof t == "object" && typeof n == "object") {
401
399
  if (t.constructor !== n.constructor) return !1;
402
- var i, r, a;
400
+ var r, i, a;
403
401
  if (Array.isArray(t)) {
404
- if (i = t.length, i != n.length) return !1;
405
- for (r = i; r-- !== 0; )
406
- if (!e(t[r], n[r])) return !1;
402
+ if (r = t.length, r != n.length) return !1;
403
+ for (i = r; i-- !== 0; )
404
+ if (!e(t[i], n[i])) return !1;
407
405
  return !0;
408
406
  }
409
407
  if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
410
408
  if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
411
409
  if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
412
- if (a = Object.keys(t), i = a.length, i !== Object.keys(n).length) return !1;
413
- for (r = i; r-- !== 0; )
414
- if (!Object.prototype.hasOwnProperty.call(n, a[r])) return !1;
415
- for (r = i; r-- !== 0; ) {
416
- var o = a[r];
410
+ if (a = Object.keys(t), r = a.length, r !== Object.keys(n).length) return !1;
411
+ for (i = r; i-- !== 0; )
412
+ if (!Object.prototype.hasOwnProperty.call(n, a[i])) return !1;
413
+ for (i = r; i-- !== 0; ) {
414
+ var o = a[i];
417
415
  if (!(o === "_owner" && t.$$typeof) && !e(t[o], n[o]))
418
416
  return !1;
419
417
  }
@@ -421,55 +419,34 @@ var br = function e(t, n) {
421
419
  }
422
420
  return t !== t && n !== n;
423
421
  };
424
- const ue = /* @__PURE__ */ Wi(br);
425
- function vr(e) {
426
- if (typeof e == "number")
427
- return Number.isFinite(e);
428
- if (typeof e != "string")
429
- return !1;
430
- const t = e.trim().replace(/,/g, "");
431
- return t !== "" && Number.isFinite(Number(t));
432
- }
433
- function Fr(e) {
434
- if (!(e != null && e.length))
435
- return [];
436
- const t = /* @__PURE__ */ new Set();
437
- return e.forEach((n) => {
438
- Object.keys(n).forEach((i) => t.add(i));
439
- }), [...t];
440
- }
441
- function Cr(e) {
442
- return Fr(e).filter(
443
- (n) => e == null ? void 0 : e.some((i) => vr(i[n]))
444
- );
445
- }
446
- function Le(e, t) {
422
+ const ue = /* @__PURE__ */ ei(xi);
423
+ function Ke(e, t) {
447
424
  var n;
448
425
  if (t.id)
449
426
  return (n = e.sql) != null && n.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
450
427
  }
451
- function Jt(e) {
428
+ function Ht(e) {
452
429
  const t = e.context.preferences;
453
430
  if (!t)
454
431
  return e.authoredFormat;
455
- const n = Le(e.card, e.metric);
432
+ const n = Ke(e.card, e.metric);
456
433
  return P(
457
434
  e.authoredFormat,
458
435
  t,
459
436
  n ? e.context.resolveBoundCurrency(n) : void 0
460
437
  );
461
438
  }
462
- function Ir(e) {
463
- const t = z(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? wn(
439
+ function Si(e) {
440
+ const t = z(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? Sn(
464
441
  { dataType: "number", format: void 0 },
465
442
  t
466
- ) : void 0, i = n == null ? void 0 : n.authoredFormat, r = N(i) ? Jt({
443
+ ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = A(r) ? Ht({
467
444
  card: e.card,
468
445
  metric: {
469
446
  id: e.columnKey
470
447
  },
471
448
  context: e.context,
472
- authoredFormat: i
449
+ authoredFormat: r
473
450
  }) : void 0;
474
451
  return {
475
452
  id: e.columnKey,
@@ -478,45 +455,45 @@ function Ir(e) {
478
455
  alias: e.columnKey,
479
456
  dataType: "number",
480
457
  role: "metric",
481
- format: r
458
+ format: i
482
459
  };
483
460
  }
484
- function Eo(e) {
461
+ function No(e) {
485
462
  const t = new Set(
486
- Cr(e.records)
463
+ zn(e.records)
487
464
  ), n = new Set(
488
465
  e.renderedMetricKeys || e.resultKeys
489
- ), i = z(e.card);
466
+ ), r = z(e.card);
490
467
  return e.resultKeys.filter(
491
- (r) => {
468
+ (i) => {
492
469
  var a;
493
- return n.has(r) && (t.has(r) || ((a = i[r]) == null ? void 0 : a.type) === "number");
470
+ return n.has(i) && (t.has(i) || ((a = r[i]) == null ? void 0 : a.type) === "number");
494
471
  }
495
472
  );
496
473
  }
497
- function Vo(e) {
474
+ function ko(e) {
498
475
  var a, o;
499
476
  const { card: t, context: n } = e;
500
- if (!(n != null && n.preferences) || !Pt(t.type))
477
+ if (!(n != null && n.preferences) || !Mt(t.type))
501
478
  return t;
502
- const i = n.preferences, r = (a = t.sql) != null && a.trim() ? e.resultMetricKeys.map(
503
- (s) => Ir({
479
+ const r = n.preferences, i = (a = t.sql) != null && a.trim() ? e.resultMetricKeys.map(
480
+ (s) => Si({
504
481
  card: t,
505
482
  columnKey: s,
506
483
  context: n
507
484
  })
508
485
  ) : (((o = t.config) == null ? void 0 : o.metricColumns) || []).map((s) => {
509
- const l = Tt(t, s), c = l.authoredFormat;
510
- if (!N(c))
486
+ const l = Dt(t, s), c = l.authoredFormat;
487
+ if (!A(c))
511
488
  return s;
512
- const u = Le(t, s), d = u ? n.resolveBoundCurrency(u) : void 0;
489
+ const u = Ke(t, s), d = u ? n.resolveBoundCurrency(u) : void 0;
513
490
  return l.source === "inferred" && !d ? s : {
514
491
  ...s,
515
492
  format: l.source === "inferred" ? P(
516
493
  c,
517
- i,
494
+ r,
518
495
  d
519
- ) : Jt({
496
+ ) : Ht({
520
497
  card: t,
521
498
  metric: s,
522
499
  context: n,
@@ -528,23 +505,23 @@ function Vo(e) {
528
505
  ...t,
529
506
  config: {
530
507
  ...t.config || {},
531
- metricColumns: r
508
+ metricColumns: i
532
509
  }
533
510
  };
534
511
  }
535
512
  function ge(e) {
536
513
  var l;
537
- const { card: t, context: n, formatOptions: i } = e, r = n == null ? void 0 : n.preferences;
538
- if (!t || !r || !Pt(t.type))
539
- return i;
540
- if (!i) {
514
+ const { card: t, context: n, formatOptions: r } = e, i = n == null ? void 0 : n.preferences;
515
+ if (!t || !i || !Mt(t.type))
516
+ return r;
517
+ if (!r) {
541
518
  const c = e.metrics.filter(
542
519
  (d) => !!d
543
520
  ), u = c.some(
544
- (d) => N(d.format)
521
+ (d) => A(d.format)
545
522
  );
546
- return c.length < 2 || !u ? i : E(
547
- P({ type: "number" }, r),
523
+ return c.length < 2 || !u ? r : E(
524
+ P({ type: "number" }, i),
548
525
  { preserveOmittedProperties: !0 }
549
526
  );
550
527
  }
@@ -552,36 +529,36 @@ function ge(e) {
552
529
  const c = e.metrics.filter(
553
530
  (d) => !!d
554
531
  ), u = c.filter(
555
- (d) => N(d.format)
532
+ (d) => A(d.format)
556
533
  );
557
534
  if (u.length === 0)
558
- return i;
535
+ return r;
559
536
  if (u.length !== c.length)
560
537
  return E(
561
- P({ type: "number" }, r),
538
+ P({ type: "number" }, i),
562
539
  { preserveOmittedProperties: !0 }
563
540
  );
564
541
  }
565
- const a = le(i, {
542
+ const a = ce(r, {
566
543
  preserveOmittedProperties: !0
567
544
  });
568
- if (!N(a))
569
- return i;
545
+ if (!A(a))
546
+ return r;
570
547
  const o = e.metrics.flatMap((c) => {
571
548
  if (!c)
572
549
  return [];
573
- const u = Le(t, c);
550
+ const u = Ke(t, c);
574
551
  return [
575
552
  P(
576
553
  a,
577
- r,
554
+ i,
578
555
  u ? n.resolveBoundCurrency(u) : void 0
579
556
  )
580
557
  ];
581
558
  });
582
559
  if (o.length === 0)
583
560
  return E(
584
- P(a, r),
561
+ P(a, i),
585
562
  { preserveOmittedProperties: !0 }
586
563
  );
587
564
  const [s] = o;
@@ -592,7 +569,7 @@ function ge(e) {
592
569
  type: "number",
593
570
  currency: void 0
594
571
  },
595
- r
572
+ i
596
573
  );
597
574
  return E(c, {
598
575
  preserveOmittedProperties: !0
@@ -602,82 +579,42 @@ function ge(e) {
602
579
  preserveOmittedProperties: !0
603
580
  });
604
581
  }
605
- const xr = /* @__PURE__ */ new Set([
606
- "horizontalBar",
607
- "tornado",
608
- "pyramid",
609
- "range"
610
- ]), Sr = /* @__PURE__ */ new Set([
611
- "tornado",
612
- "pyramid",
613
- "range"
614
- ]), Dr = /* @__PURE__ */ new Set([
615
- "tornado",
616
- "pyramid",
617
- "range"
618
- ]);
619
- function wr(e) {
620
- const { chartType: t, resultKeys: n, config: i } = e, r = 1 + (i != null && i.enableGrouping && (i.groupKey || n[1]) ? 1 : 0), a = n.slice(r), o = (i == null ? void 0 : i.xMetricKey) ?? a[0], s = (i == null ? void 0 : i.yMetricKey) ?? a[1] ?? a[0], l = t === "bubble" ? (i == null ? void 0 : i.radiusMetricKey) ?? a[2] ?? a[1] ?? a[0] : void 0, c = new Set(n);
621
- return [o, s, l].filter((u) => !!u).filter((u) => c.has(u));
622
- }
623
- function Ko(e) {
624
- const { chartType: t, resultKeys: n, preferences: i } = e;
625
- return t === "scatter" || t === "bubble" ? [
626
- ...new Set(
627
- wr({
628
- chartType: t,
629
- resultKeys: n,
630
- config: i == null ? void 0 : i.bubbleScatterConfig
631
- })
632
- )
633
- ] : Dr.has(t || "") ? n.slice(2) : n.length === 1 ? [n[0]] : n.slice(1);
634
- }
635
- function te(e, t) {
636
- var n;
637
- return ((n = t == null ? void 0 : t.chartOptions) == null ? void 0 : n.indexAxis) === "y" || xr.has(e || "") ? "x" : "y";
638
- }
639
- function Lo(e, t) {
640
- return te(e, t) === "x";
641
- }
642
- function Tr(e, t) {
643
- return te(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (Sr.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
644
- }
645
- function Te(e) {
582
+ function we(e) {
646
583
  return e ? Object.entries(e).some(([t, n]) => n == null || n === "" ? !1 : t === "type" ? n !== "auto" : !0) : !1;
647
584
  }
648
585
  function Qt(e) {
649
586
  if (e)
650
587
  return e.alias || e.label || e.name;
651
588
  }
652
- function Oe(e, t) {
653
- var i;
654
- return (((i = e == null ? void 0 : e.config) == null ? void 0 : i.metricColumns) || []).find((r) => {
655
- const a = Qt(r);
656
- return t.metricId && r.id === t.metricId || t.metricAlias && a === t.metricAlias || t.metricAlias && r.alias === t.metricAlias || t.columnId && a === t.columnId || t.columnId && r.alias === t.columnId || t.columnId && r.label === t.columnId || t.columnId && r.name === t.columnId;
589
+ function Me(e, t) {
590
+ var r;
591
+ return (((r = e == null ? void 0 : e.config) == null ? void 0 : r.metricColumns) || []).find((i) => {
592
+ const a = Qt(i);
593
+ return t.metricId && i.id === t.metricId || t.metricAlias && a === t.metricAlias || t.metricAlias && i.alias === t.metricAlias || t.columnId && a === t.columnId || t.columnId && i.alias === t.columnId || t.columnId && i.label === t.columnId || t.columnId && i.name === t.columnId;
657
594
  });
658
595
  }
659
596
  function ne(e, t) {
660
- var i, r;
661
- const n = Un(e, t);
662
- if (!(n && ((r = (i = e == null ? void 0 : e.config) == null ? void 0 : i.groupByColumns) != null && r.includes(n)) && !jn(n)))
597
+ var r, i;
598
+ const n = jn(e, t);
599
+ if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !Gn(n)))
663
600
  return n;
664
601
  }
665
- function Or(e) {
666
- return !!e && !(e != null && e.format) && qt(e == null ? void 0 : e.dataType) === "number";
602
+ function Di(e) {
603
+ return !!e && !(e != null && e.format) && Lt(e == null ? void 0 : e.dataType) === "number";
667
604
  }
668
- const Mr = {
605
+ const Ti = {
669
606
  style: "decimal"
670
607
  };
671
- function Zt(e) {
608
+ function Yt(e) {
672
609
  if (!e)
673
610
  return;
674
- const t = Ve();
611
+ const t = Ee();
675
612
  return {
676
613
  ...t,
677
614
  ...e,
678
615
  inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
679
616
  numberFormat: {
680
- ...Mr,
617
+ ...Ti,
681
618
  ...e.numberFormat
682
619
  },
683
620
  dateFormat: {
@@ -690,46 +627,46 @@ function Zt(e) {
690
627
  }
691
628
  };
692
629
  }
693
- function Bo(e) {
630
+ function Ao(e) {
694
631
  return Object.fromEntries(
695
632
  Object.entries(e || {}).map(([t, n]) => [
696
633
  t,
697
- Zt(n)
634
+ Yt(n)
698
635
  ])
699
636
  );
700
637
  }
701
- function re(e) {
638
+ function ie(e) {
702
639
  return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
703
640
  }
704
- function Xt(e, t, n) {
705
- if (!re(n))
641
+ function Jt(e, t, n) {
642
+ if (!ie(n))
706
643
  return n;
707
- const i = re(e) ? e : {}, r = re(t) ? t : {}, a = {};
644
+ const r = ie(e) ? e : {}, i = ie(t) ? t : {}, a = {};
708
645
  for (const o of Object.keys(n)) {
709
646
  const s = n[o];
710
647
  if (s === void 0)
711
648
  continue;
712
649
  const l = Object.prototype.hasOwnProperty.call(
713
- i,
650
+ r,
714
651
  o
715
- ), c = r[o];
652
+ ), c = i[o];
716
653
  if (l && ue(s, c)) {
717
- a[o] = i[o];
654
+ a[o] = r[o];
718
655
  continue;
719
656
  }
720
657
  if (!l && ue(s, c))
721
658
  continue;
722
- const u = Xt(
723
- i[o],
659
+ const u = Jt(
660
+ r[o],
724
661
  c,
725
662
  s
726
663
  );
727
- re(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
664
+ ie(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
728
665
  }
729
666
  return a;
730
667
  }
731
- function qo(e) {
732
- let t = Xt(
668
+ function _o(e) {
669
+ let t = Jt(
733
670
  e.persisted,
734
671
  e.baseline,
735
672
  e.next
@@ -737,11 +674,11 @@ function qo(e) {
737
674
  if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
738
675
  const n = e.next.dateFormat.customFormat;
739
676
  if (!(n != null && n.trim()))
740
- throw new Li(
677
+ throw new Gr(
741
678
  "invalid_raw_temporal_format",
742
679
  "Custom table date formatting requires a non-empty pattern."
743
680
  );
744
- Bi({
681
+ Wr({
745
682
  dialect: "date_fns",
746
683
  pattern: n,
747
684
  valueKind: e.rawTemporalValueKind
@@ -767,16 +704,16 @@ function qo(e) {
767
704
  type: "date"
768
705
  } : t;
769
706
  }
770
- function Pr(e, t) {
771
- const n = e || Ve(), i = !t;
707
+ function wi(e, t) {
708
+ const n = e || Ee(), r = !t;
772
709
  return {
773
710
  ...n,
774
711
  type: "number",
775
712
  textAlign: n.type === "none" ? "right" : n.textAlign,
776
713
  numberFormat: {
777
714
  style: "decimal",
778
- minimumFractionDigits: i ? n.numberFormat.minimumFractionDigits : void 0,
779
- maximumFractionDigits: i ? n.numberFormat.maximumFractionDigits : void 0,
715
+ minimumFractionDigits: r ? n.numberFormat.minimumFractionDigits : void 0,
716
+ maximumFractionDigits: r ? n.numberFormat.maximumFractionDigits : void 0,
780
717
  useGrouping: n.numberFormat.useGrouping
781
718
  }
782
719
  };
@@ -785,123 +722,123 @@ function Ce(e) {
785
722
  if (e)
786
723
  return e.trim().toLowerCase();
787
724
  }
788
- const en = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
789
- function kr(e) {
725
+ const Xt = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
726
+ function Mi(e) {
790
727
  const t = e == null ? void 0 : e.trim();
791
- return t ? t.replace(en, "").trim() || t : void 0;
728
+ return t ? t.replace(Xt, "").trim() || t : void 0;
792
729
  }
793
- function Ar(e) {
730
+ function Oi(e) {
794
731
  const t = e == null ? void 0 : e.trim();
795
- return t ? en.test(t) : !1;
732
+ return t ? Xt.test(t) : !1;
796
733
  }
797
- function Nr(e, t) {
734
+ function Pi(e, t) {
798
735
  return t.metricAlias ? e.find(
799
- (n) => Ai(n) === t.metricAlias
736
+ (n) => Lr(n) === t.metricAlias
800
737
  ) : t.metricId ? e.find((n) => n.id === t.metricId) : void 0;
801
738
  }
802
- function Rr(e) {
739
+ function Ni(e) {
803
740
  var b;
804
741
  const {
805
742
  card: t,
806
743
  metricId: n,
807
- metricAlias: i,
808
- datasetIndex: r,
744
+ metricAlias: r,
745
+ datasetIndex: i,
809
746
  datasetLabel: a,
810
747
  metricKey: o
811
748
  } = e, s = ((b = t == null ? void 0 : t.config) == null ? void 0 : b.metricColumns) || [];
812
- if (i || n)
813
- return Nr(s, {
814
- metricAlias: i,
749
+ if (r || n)
750
+ return Pi(s, {
751
+ metricAlias: r,
815
752
  metricId: n
816
753
  });
817
754
  const l = [o, a], c = l.some(
818
- (m) => Ar(m)
755
+ (p) => Oi(p)
819
756
  ), u = l.filter(
820
- (m) => !!m
757
+ (p) => !!p
821
758
  );
822
- for (const m of u) {
823
- const v = Oe(t, {
824
- columnId: m,
825
- metricAlias: m
759
+ for (const p of u) {
760
+ const v = Me(t, {
761
+ columnId: p,
762
+ metricAlias: p
826
763
  });
827
764
  if (v)
828
765
  return v;
829
766
  }
830
- const d = u.map((m) => Ce(m)).filter((m) => !!m), f = u.map((m) => kr(m)).filter((m) => !!m);
831
- for (const m of f) {
832
- const v = Oe(t, {
833
- columnId: m,
834
- metricAlias: m
767
+ const d = u.map((p) => Ce(p)).filter((p) => !!p), f = u.map((p) => Mi(p)).filter((p) => !!p);
768
+ for (const p of f) {
769
+ const v = Me(t, {
770
+ columnId: p,
771
+ metricAlias: p
835
772
  });
836
773
  if (v)
837
774
  return v;
838
775
  }
839
776
  if (s.length === 1)
840
777
  return s[0];
841
- if (!c && typeof r == "number" && r >= 0 && r < s.length)
842
- return s[r];
843
- const p = f.map((m) => Ce(m)).filter((m) => !!m), g = [
778
+ if (!c && typeof i == "number" && i >= 0 && i < s.length)
779
+ return s[i];
780
+ const m = f.map((p) => Ce(p)).filter((p) => !!p), g = [
844
781
  ...d,
845
- ...p
782
+ ...m
846
783
  ];
847
784
  if (g.length !== 0)
848
- return s.find((m) => {
785
+ return s.find((p) => {
849
786
  const v = [
850
- m.alias,
851
- m.label,
852
- m.name,
853
- Qt(m)
787
+ p.alias,
788
+ p.label,
789
+ p.name,
790
+ Qt(p)
854
791
  ].map((x) => Ce(x)).filter((x) => !!x);
855
792
  return g.some(
856
793
  (x) => v.includes(x)
857
794
  );
858
795
  });
859
796
  }
860
- function _r(e) {
797
+ function ki(e) {
861
798
  const t = G(e == null ? void 0 : e.format);
862
799
  return E(t);
863
800
  }
864
- function pt(e, t) {
801
+ function mt(e, t) {
865
802
  if (t)
866
- return Oe(e, {
803
+ return Me(e, {
867
804
  columnId: t,
868
805
  metricAlias: t
869
806
  });
870
807
  }
871
- function gt(e) {
872
- const t = le(e);
808
+ function pt(e) {
809
+ const t = ce(e);
873
810
  if (t)
874
811
  return JSON.stringify(t);
875
812
  }
876
- function Er(e, t) {
877
- const n = gt(e), i = gt(t);
878
- return !!(n && i && n === i);
813
+ function Ai(e, t) {
814
+ const n = pt(e), r = pt(t);
815
+ return !!(n && r && n === r);
879
816
  }
880
- function Vr(e) {
817
+ function _i(e) {
881
818
  if (e.length === 0)
882
819
  return;
883
820
  const t = e.map(
884
- (o) => _r(o)
821
+ (o) => ki(o)
885
822
  );
886
823
  if (!t.every(
887
- (o) => Te(o)
824
+ (o) => we(o)
888
825
  ))
889
826
  return;
890
- const i = t, [r] = i;
891
- return i.every(
892
- (o) => Er(r, o)
893
- ) ? r : void 0;
827
+ const r = t, [i] = r;
828
+ return r.every(
829
+ (o) => Ai(i, o)
830
+ ) ? i : void 0;
894
831
  }
895
832
  function ye(e) {
896
- if (Te(e.overrideFormatOptions))
833
+ if (we(e.overrideFormatOptions))
897
834
  return {
898
835
  formatOptions: e.overrideFormatOptions || void 0,
899
836
  source: "override"
900
837
  };
901
- const t = Vr(
838
+ const t = _i(
902
839
  e.metrics || []
903
840
  );
904
- return Te(t) ? {
841
+ return we(t) ? {
905
842
  formatOptions: t,
906
843
  source: "metric"
907
844
  } : {
@@ -909,37 +846,37 @@ function ye(e) {
909
846
  source: "auto"
910
847
  };
911
848
  }
912
- function tn(e) {
849
+ function Zt(e) {
913
850
  var l, c, u;
914
- const { card: t, chartType: n, axis: i, preferences: r } = e, a = ((l = t == null ? void 0 : t.config) == null ? void 0 : l.metricColumns) || [], o = (r == null ? void 0 : r.datasetOptions) || [];
851
+ const { card: t, chartType: n, axis: r, preferences: i } = e, a = ((l = t == null ? void 0 : t.config) == null ? void 0 : l.metricColumns) || [], o = (i == null ? void 0 : i.datasetOptions) || [];
915
852
  if (!a.length)
916
853
  return [];
917
854
  if (n === "combo")
918
- return i === "x" ? [] : a.filter((d, f) => {
919
- const p = o.find((b) => b.idx === f);
920
- return ((p == null ? void 0 : p.yAxisId) === "y2" ? "y2" : "y") === i;
855
+ return r === "x" ? [] : a.filter((d, f) => {
856
+ const m = o.find((b) => b.idx === f);
857
+ return ((m == null ? void 0 : m.yAxisId) === "y2" ? "y2" : "y") === r;
921
858
  });
922
859
  if (n === "bubble" || n === "scatter") {
923
- if (i === "y2")
860
+ if (r === "y2")
924
861
  return [];
925
- const d = pt(
862
+ const d = mt(
926
863
  t,
927
- (c = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : c.xMetricKey
928
- ) || a[0], f = pt(
864
+ (c = i == null ? void 0 : i.bubbleScatterConfig) == null ? void 0 : c.xMetricKey
865
+ ) || a[0], f = mt(
929
866
  t,
930
- (u = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : u.yMetricKey
867
+ (u = i == null ? void 0 : i.bubbleScatterConfig) == null ? void 0 : u.yMetricKey
931
868
  ) || a[1] || a[0];
932
- return i === "x" ? d ? [d] : [] : f ? [f] : [];
869
+ return r === "x" ? d ? [d] : [] : f ? [f] : [];
933
870
  }
934
- const s = te(n, r);
935
- return n === "radar" ? i === "y" ? a : [] : i !== s ? [] : a;
871
+ const s = Ne(n, i);
872
+ return n === "radar" ? r === "y" ? a : [] : r !== s ? [] : a;
936
873
  }
937
- function Be(e) {
938
- const { card: t, chartType: n, axis: i, preferences: r, axisConfig: a } = e, o = tn({
874
+ function Le(e) {
875
+ const { card: t, chartType: n, axis: r, preferences: i, axisConfig: a } = e, o = Zt({
939
876
  card: t,
940
877
  chartType: n,
941
- axis: i,
942
- preferences: r
878
+ axis: r,
879
+ preferences: i
943
880
  }), s = ye({
944
881
  overrideFormatOptions: pe(a == null ? void 0 : a.valueFormat),
945
882
  metrics: o
@@ -954,29 +891,29 @@ function Be(e) {
954
891
  })
955
892
  };
956
893
  }
957
- function Kr(e) {
958
- const { preferences: t, metric: n } = e, i = t == null ? void 0 : t.tooltipConfig, r = ye({
959
- overrideFormatOptions: pe(i == null ? void 0 : i.valueFormat),
894
+ function Ri(e) {
895
+ const { preferences: t, metric: n } = e, r = t == null ? void 0 : t.tooltipConfig, i = ye({
896
+ overrideFormatOptions: pe(r == null ? void 0 : r.valueFormat),
960
897
  metrics: n ? [n] : []
961
898
  });
962
899
  return {
963
- ...r,
900
+ ...i,
964
901
  formatOptions: ge({
965
902
  card: e.card,
966
903
  metrics: e.metric ? [e.metric] : [],
967
- formatOptions: r.formatOptions,
904
+ formatOptions: i.formatOptions,
968
905
  context: e.numericPresentation
969
906
  })
970
907
  };
971
908
  }
972
- function qe(e, t, n) {
973
- return t === te(n, e) ? Tr(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
909
+ function Be(e, t, n) {
910
+ return t === Ne(n, e) ? Wn(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
974
911
  }
975
- function $e(e) {
912
+ function qe(e) {
976
913
  const { chartType: t, preferences: n } = e;
977
- return t === "bubble" || t === "scatter" ? "y" : te(t, n);
914
+ return t === "bubble" || t === "scatter" ? "y" : Ne(t, n);
978
915
  }
979
- function nn(e) {
916
+ function en(e) {
980
917
  switch (e) {
981
918
  case "pie":
982
919
  case "doughnut":
@@ -989,36 +926,36 @@ function nn(e) {
989
926
  return !0;
990
927
  }
991
928
  }
992
- function $o(e) {
993
- const { card: t, chartType: n, preferences: i, metric: r } = e, a = Kr({
929
+ function Ro(e) {
930
+ const { card: t, chartType: n, preferences: r, metric: i } = e, a = Ri({
994
931
  card: t,
995
- preferences: i,
996
- metric: r,
932
+ preferences: r,
933
+ metric: i,
997
934
  numericPresentation: e.numericPresentation
998
935
  });
999
936
  if (a.source === "override")
1000
937
  return a;
1001
- const o = e.axis || $e({ chartType: n, preferences: i }), s = Be({
938
+ const o = e.axis || qe({ chartType: n, preferences: r }), s = Le({
1002
939
  card: t,
1003
940
  chartType: n,
1004
941
  axis: o,
1005
- preferences: i,
1006
- axisConfig: qe(i, o, n),
942
+ preferences: r,
943
+ axisConfig: Be(r, o, n),
1007
944
  numericPresentation: e.numericPresentation
1008
945
  });
1009
946
  return s.source === "override" ? s : a;
1010
947
  }
1011
- function zo(e) {
1012
- const { card: t, chartType: n, preferences: i, dataLabelsConfig: r } = e, a = n || (t == null ? void 0 : t.type), o = $e({
948
+ function Eo(e) {
949
+ const { card: t, chartType: n, preferences: r, dataLabelsConfig: i } = e, a = n || (t == null ? void 0 : t.type), o = qe({
1013
950
  chartType: a,
1014
- preferences: i
1015
- }), s = tn({
951
+ preferences: r
952
+ }), s = Zt({
1016
953
  card: t,
1017
954
  chartType: a,
1018
955
  axis: o,
1019
- preferences: i
956
+ preferences: r
1020
957
  }), l = ye({
1021
- overrideFormatOptions: pe(r == null ? void 0 : r.valueFormat),
958
+ overrideFormatOptions: pe(i == null ? void 0 : i.valueFormat),
1022
959
  metrics: s
1023
960
  }), c = {
1024
961
  ...l,
@@ -1029,15 +966,15 @@ function zo(e) {
1029
966
  context: e.numericPresentation
1030
967
  })
1031
968
  };
1032
- if (c.source === "override" || !nn(a))
969
+ if (c.source === "override" || !en(a))
1033
970
  return c;
1034
- const u = Be({
971
+ const u = Le({
1035
972
  card: t,
1036
973
  chartType: a,
1037
974
  axis: o,
1038
- preferences: i,
1039
- axisConfig: qe(
1040
- i,
975
+ preferences: r,
976
+ axisConfig: Be(
977
+ r,
1041
978
  o,
1042
979
  a
1043
980
  ),
@@ -1045,31 +982,31 @@ function zo(e) {
1045
982
  });
1046
983
  return u.source === "override" ? u : c;
1047
984
  }
1048
- function Lr(e) {
1049
- const { preferences: t, dataLabelsConfig: n, metric: i } = e, r = ye({
985
+ function Ei(e) {
986
+ const { preferences: t, dataLabelsConfig: n, metric: r } = e, i = ye({
1050
987
  overrideFormatOptions: pe(n == null ? void 0 : n.valueFormat),
1051
- metrics: i ? [i] : []
988
+ metrics: r ? [r] : []
1052
989
  });
1053
990
  return {
1054
- ...r,
991
+ ...i,
1055
992
  formatOptions: ge({
1056
993
  card: e.card,
1057
994
  metrics: e.metric ? [e.metric] : [],
1058
- formatOptions: r.formatOptions,
995
+ formatOptions: i.formatOptions,
1059
996
  context: e.numericPresentation
1060
997
  })
1061
998
  };
1062
999
  }
1063
- function Uo(e) {
1000
+ function Vo(e) {
1064
1001
  var o, s;
1065
- const t = Rr({
1002
+ const t = Ni({
1066
1003
  card: e.card,
1067
1004
  metricId: e.metricId,
1068
1005
  metricAlias: e.metricAlias,
1069
1006
  datasetIndex: e.datasetIndex,
1070
1007
  datasetLabel: e.datasetLabel,
1071
1008
  metricKey: e.metricKey
1072
- }), n = Lr({
1009
+ }), n = Ei({
1073
1010
  card: e.card,
1074
1011
  preferences: e.preferences,
1075
1012
  dataLabelsConfig: e.dataLabelsConfig,
@@ -1078,52 +1015,52 @@ function Uo(e) {
1078
1015
  });
1079
1016
  if (n.source === "override")
1080
1017
  return n;
1081
- const i = (o = e.card) == null ? void 0 : o.type;
1082
- if (!nn(i))
1018
+ const r = (o = e.card) == null ? void 0 : o.type;
1019
+ if (!en(r))
1083
1020
  return n;
1084
- let r = $e({
1085
- chartType: i,
1021
+ let i = qe({
1022
+ chartType: r,
1086
1023
  preferences: e.preferences
1087
1024
  });
1088
- if (i === "combo" && typeof e.datasetIndex == "number") {
1025
+ if (r === "combo" && typeof e.datasetIndex == "number") {
1089
1026
  const c = (((s = e.preferences) == null ? void 0 : s.datasetOptions) || []).find(
1090
1027
  (u) => u.idx === e.datasetIndex
1091
1028
  );
1092
- r = (c == null ? void 0 : c.yAxisId) === "y2" ? "y2" : "y";
1029
+ i = (c == null ? void 0 : c.yAxisId) === "y2" ? "y2" : "y";
1093
1030
  }
1094
- const a = Be({
1031
+ const a = Le({
1095
1032
  card: e.card,
1096
- chartType: i,
1097
- axis: r,
1033
+ chartType: r,
1034
+ axis: i,
1098
1035
  preferences: e.preferences,
1099
- axisConfig: qe(
1036
+ axisConfig: Be(
1100
1037
  e.preferences,
1101
- r,
1102
- i
1038
+ i,
1039
+ r
1103
1040
  ),
1104
1041
  numericPresentation: e.numericPresentation
1105
1042
  });
1106
1043
  return a.source === "override" ? a : n;
1107
1044
  }
1108
- function jo(e) {
1045
+ function Ko(e) {
1109
1046
  return (e == null ? void 0 : e.rawValue) === !0;
1110
1047
  }
1111
- function Br(e) {
1048
+ function Vi(e) {
1112
1049
  const t = e == null ? void 0 : e.numberFormat;
1113
1050
  if (!t)
1114
1051
  return;
1115
1052
  if (t.style === "duration")
1116
- return E(ke(t), {
1053
+ return E(Pe(t), {
1117
1054
  preserveOmittedProperties: !0
1118
1055
  });
1119
- const n = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", i = t.minimumFractionDigits, r = t.maximumFractionDigits;
1056
+ const n = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", r = t.minimumFractionDigits, i = t.maximumFractionDigits;
1120
1057
  return {
1121
1058
  type: n,
1122
1059
  currency: n === "currency" ? t.currency : void 0,
1123
1060
  locale: t.locale,
1124
- decimalPlaces: i === r ? r : void 0,
1125
- minimumFractionDigits: i,
1126
- maximumFractionDigits: r,
1061
+ decimalPlaces: r === i ? i : void 0,
1062
+ minimumFractionDigits: r,
1063
+ maximumFractionDigits: i,
1127
1064
  useGrouping: t.useGrouping,
1128
1065
  percentValueMode: n === "percent" ? t.percentValueMode : void 0,
1129
1066
  multiplyBy: t.scale,
@@ -1133,14 +1070,14 @@ function Br(e) {
1133
1070
  suffix: t.suffix
1134
1071
  };
1135
1072
  }
1136
- function qr(e, t, n = !1) {
1137
- const i = n ? { preserveOmittedProperties: !0 } : void 0, r = G(e == null ? void 0 : e.format, i), a = jt(
1138
- r,
1139
- i
1073
+ function Ki(e, t, n = !1) {
1074
+ const r = n ? { preserveOmittedProperties: !0 } : void 0, i = G(e == null ? void 0 : e.format, r), a = Ut(
1075
+ i,
1076
+ r
1140
1077
  );
1141
1078
  if (!a)
1142
1079
  return;
1143
- const o = t || Ve(), s = n ? void 0 : o.numberFormat, l = o.type && o.type !== "none";
1080
+ const o = t || Ee(), s = n ? void 0 : o.numberFormat, l = o.type && o.type !== "none";
1144
1081
  return {
1145
1082
  ...o,
1146
1083
  type: l ? o.type : "number",
@@ -1154,13 +1091,13 @@ function qr(e, t, n = !1) {
1154
1091
  }
1155
1092
  };
1156
1093
  }
1157
- function rn(e) {
1094
+ function tn(e) {
1158
1095
  var D;
1159
1096
  const {
1160
1097
  card: t,
1161
1098
  columnId: n,
1162
- persistedSettings: i,
1163
- resolvedSettings: r,
1099
+ persistedSettings: r,
1100
+ resolvedSettings: i,
1164
1101
  fallbackSettings: a,
1165
1102
  metricId: o,
1166
1103
  metricAlias: s,
@@ -1169,12 +1106,12 @@ function rn(e) {
1169
1106
  columnKeyMap: u,
1170
1107
  valueFormatPreferences: d,
1171
1108
  boundCurrency: f,
1172
- preserveOmittedProperties: p
1173
- } = e, g = i ?? z(t)[n], b = !((D = t == null ? void 0 : t.sql) != null && D.trim()) || Tn(g), m = b ? d : null, v = b ? f : void 0, x = r ?? Zt(g);
1109
+ preserveOmittedProperties: m
1110
+ } = e, g = r ?? z(t)[n], b = !((D = t == null ? void 0 : t.sql) != null && D.trim()) || Dn(g), p = b ? d : null, v = b ? f : void 0, x = i ?? Yt(g);
1174
1111
  if (x && x.inheritMetricFormat !== !0)
1175
- return yt(
1112
+ return gt(
1176
1113
  x,
1177
- m,
1114
+ p,
1178
1115
  v
1179
1116
  );
1180
1117
  const h = ne(t, {
@@ -1184,39 +1121,39 @@ function rn(e) {
1184
1121
  columnKeyMap: u,
1185
1122
  fieldId: l,
1186
1123
  fieldRole: c
1187
- }), y = qr(
1124
+ }), y = Ki(
1188
1125
  h,
1189
1126
  x || a,
1190
- p ?? !!d
1191
- ), C = !y && m && Or(h) ? Pr(
1127
+ m ?? !!d
1128
+ ), C = !y && p && Di(h) ? wi(
1192
1129
  x || a,
1193
1130
  v
1194
1131
  ) : void 0;
1195
- return yt(
1132
+ return gt(
1196
1133
  y || C || x || a,
1197
- m,
1134
+ p,
1198
1135
  v
1199
1136
  );
1200
1137
  }
1201
- function yt(e, t, n) {
1138
+ function gt(e, t, n) {
1202
1139
  if (!e || e.type !== "number" || !t)
1203
1140
  return e;
1204
- const i = e.numberFormat, r = i ? ke(i, {
1141
+ const r = e.numberFormat, i = r ? Pe(r, {
1205
1142
  preserveOmittedProperties: !0
1206
1143
  }) : { type: "number" };
1207
- if (!r || !N(r))
1144
+ if (!i || !A(i))
1208
1145
  return e;
1209
1146
  const a = P(
1210
- r,
1147
+ i,
1211
1148
  t,
1212
1149
  n
1213
- ), o = jt(a, {
1150
+ ), o = Ut(a, {
1214
1151
  preserveOmittedProperties: !0
1215
1152
  });
1216
1153
  return o ? {
1217
1154
  ...e,
1218
1155
  numberFormat: {
1219
- ...i,
1156
+ ...r,
1220
1157
  ...o
1221
1158
  }
1222
1159
  } : e;
@@ -1224,17 +1161,17 @@ function yt(e, t, n) {
1224
1161
  function de(e) {
1225
1162
  if (!e.valueFormatPreferences)
1226
1163
  return;
1227
- const t = rn(e);
1164
+ const t = tn(e);
1228
1165
  if (!t || t.type !== "number")
1229
1166
  return;
1230
- const n = ke(t.numberFormat, {
1167
+ const n = Pe(t.numberFormat, {
1231
1168
  preserveOmittedProperties: !0
1232
1169
  });
1233
- if (!(!n || !qi(n)))
1170
+ if (!(!n || !Hr(n)))
1234
1171
  return n;
1235
1172
  }
1236
- function $r(e) {
1237
- var i, r;
1173
+ function Li(e) {
1174
+ var r, i;
1238
1175
  if (!e.presentation.preferences)
1239
1176
  return;
1240
1177
  const t = ne(e.card, {
@@ -1254,7 +1191,7 @@ function $r(e) {
1254
1191
  columnKeyMap: e.columnKeyMap,
1255
1192
  metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
1256
1193
  valueFormatPreferences: e.presentation.preferences
1257
- }), o = On(e.comparisonPrecision) ?? (N(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1194
+ }), o = Hn(e.comparisonPrecision) ?? (A(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1258
1195
  return e.comparisonValueKind === "percent_change" ? {
1259
1196
  type: "percent",
1260
1197
  locale: e.presentation.preferences.locale,
@@ -1269,10 +1206,10 @@ function $r(e) {
1269
1206
  suffix: "×"
1270
1207
  };
1271
1208
  }
1272
- const n = Mn({
1209
+ const n = Tn({
1273
1210
  card: e.card,
1274
1211
  columnKey: e.columnId,
1275
- metricId: e.metricId ?? (t && !((r = (i = e.card.config) == null ? void 0 : i.groupByColumns) != null && r.includes(t)) ? t.id : void 0)
1212
+ metricId: e.metricId ?? (t && !((i = (r = e.card.config) == null ? void 0 : r.groupByColumns) != null && i.includes(t)) ? t.id : void 0)
1276
1213
  });
1277
1214
  return de({
1278
1215
  card: e.card,
@@ -1287,12 +1224,12 @@ function $r(e) {
1287
1224
  boundCurrency: n ? e.presentation.resolveBoundCurrency(n) : void 0
1288
1225
  });
1289
1226
  }
1290
- function zr(e) {
1227
+ function Bi(e) {
1291
1228
  var s, l, c, u, d;
1292
1229
  if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
1293
- const f = e.target, p = Pn(e.card, e.matrixCatalog).find(
1230
+ const f = e.target, m = wn(e.card, e.matrixCatalog).find(
1294
1231
  (b) => b.measureId === f.measureId
1295
- ), g = p == null ? void 0 : p.canonical;
1232
+ ), g = m == null ? void 0 : m.canonical;
1296
1233
  return g && (g.type === "number" || g.type === "currency") ? P(
1297
1234
  g,
1298
1235
  e.valueFormatPreferences,
@@ -1302,86 +1239,86 @@ function zr(e) {
1302
1239
  if (e.target.kind === "matrix_measure")
1303
1240
  return;
1304
1241
  if (e.card.type === "kpi") {
1305
- const f = e.target.kind === "metric" ? e.target.metricId : void 0, p = f ? ((l = (s = e.card.config) == null ? void 0 : s.metricColumns) == null ? void 0 : l.findIndex(
1306
- (m) => m.id === f
1307
- )) ?? -1 : 0;
1308
- if (p < 0)
1242
+ const f = e.target.kind === "metric" ? e.target.metricId : void 0;
1243
+ if (f && !((l = (s = e.card.config) == null ? void 0 : s.metricColumns) != null && l.some(
1244
+ (b) => b.id === f
1245
+ )))
1309
1246
  return;
1310
- const g = kn(e.card, {
1311
- metricIndex: p,
1247
+ const m = Mn(e.card, {
1248
+ ...f ? { column: { kind: "field", fieldId: f } } : {},
1312
1249
  resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
1313
- }), b = g.authoredFormat;
1314
- return g.currencyBindable && b && N(b) ? P(
1315
- b,
1250
+ }), g = m.authoredFormat;
1251
+ return m.currencyBindable && g && A(g) ? P(
1252
+ g,
1316
1253
  e.valueFormatPreferences,
1317
1254
  e.boundCurrency
1318
1255
  ) : void 0;
1319
1256
  }
1320
- if (!((c = e.card.sql) != null && c.trim()) && !Gn(e.card.type) && e.target.kind === "metric") {
1321
- const f = e.target.metricId, p = (d = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : d.find(
1322
- (m) => m.id === f
1257
+ if (!((c = e.card.sql) != null && c.trim()) && !Qn(e.card.type) && e.target.kind === "metric") {
1258
+ const f = e.target.metricId, m = (d = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : d.find(
1259
+ (p) => p.id === f
1323
1260
  );
1324
- if (!p)
1261
+ if (!m)
1325
1262
  return;
1326
- const g = Tt(
1263
+ const g = Dt(
1327
1264
  e.card,
1328
- p
1265
+ m
1329
1266
  ), b = g.authoredFormat;
1330
- return g.currencyBindable && b && N(b) ? P(
1267
+ return g.currencyBindable && b && A(b) ? P(
1331
1268
  b,
1332
1269
  e.valueFormatPreferences,
1333
1270
  e.boundCurrency
1334
1271
  ) : void 0;
1335
1272
  }
1336
- const n = z(e.card), i = e.target.kind === "metric" ? e.target.metricId : void 0, r = e.target.kind === "column" ? [e.target.columnKey] : [
1273
+ const n = z(e.card), r = e.target.kind === "metric" ? e.target.metricId : void 0, i = e.target.kind === "column" ? [e.target.columnKey] : [
1337
1274
  ...e.resultColumnKeys || [],
1338
1275
  ...Object.keys(n),
1339
1276
  e.target.metricId
1340
- ], a = e.target.kind === "column" ? e.target.columnKey : r.find(
1277
+ ], a = e.target.kind === "column" ? e.target.columnKey : i.find(
1341
1278
  (f) => {
1342
- var p;
1343
- return ((p = ne(e.card, {
1279
+ var m;
1280
+ return ((m = ne(e.card, {
1344
1281
  columnId: f
1345
- })) == null ? void 0 : p.id) === i;
1282
+ })) == null ? void 0 : m.id) === r;
1346
1283
  }
1347
- ) || i, o = de({
1284
+ ) || r, o = de({
1348
1285
  card: e.card,
1349
1286
  columnId: a,
1350
- metricId: i,
1287
+ metricId: r,
1351
1288
  persistedSettings: n[a],
1352
1289
  valueFormatPreferences: e.valueFormatPreferences,
1353
1290
  boundCurrency: e.boundCurrency
1354
1291
  });
1355
- return N(o) ? o : void 0;
1292
+ return A(o) ? o : void 0;
1356
1293
  }
1357
- function Go(e) {
1358
- var n, i;
1294
+ function Lo(e) {
1295
+ var n, r;
1359
1296
  const t = e.persistedSettings ?? z(e.card)[e.columnId];
1360
1297
  if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((n = e.resolvedSettings) == null ? void 0 : n.inheritMetricFormat) === !0) {
1361
- const r = G(
1362
- (i = ne(e.card, {
1298
+ const i = G(
1299
+ (r = ne(e.card, {
1363
1300
  columnId: e.columnId,
1364
1301
  metricId: e.metricId,
1365
1302
  metricAlias: e.metricAlias,
1366
1303
  columnKeyMap: e.columnKeyMap
1367
- })) == null ? void 0 : i.format,
1304
+ })) == null ? void 0 : r.format,
1368
1305
  { preserveOmittedProperties: !0 }
1369
1306
  );
1370
- if ((r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "duration")
1371
- return E(r, {
1307
+ if ((i == null ? void 0 : i.type) === "date" || (i == null ? void 0 : i.type) === "duration")
1308
+ return E(i, {
1372
1309
  preserveOmittedProperties: !0
1373
1310
  });
1374
1311
  }
1375
- return Br(
1376
- rn({
1312
+ return Vi(
1313
+ tn({
1377
1314
  ...e,
1378
1315
  persistedSettings: t
1379
1316
  })
1380
1317
  );
1381
1318
  }
1382
- function Wo(e) {
1383
- const { value: t, formatOptions: n, preferences: i } = e;
1384
- return n != null && n.type && n.type !== "auto" ? Ke(t, n.type, n) : hr({
1319
+ function Bo(e) {
1320
+ const { value: t, formatOptions: n, preferences: r } = e;
1321
+ return n != null && n.type && n.type !== "auto" ? Ve(t, n.type, n) : Ii({
1385
1322
  number: t,
1386
1323
  decimalPlaces: 0,
1387
1324
  useSuffix: !1,
@@ -1390,18 +1327,18 @@ function Wo(e) {
1390
1327
  currency: ""
1391
1328
  });
1392
1329
  }
1393
- function Ur(e) {
1394
- return Wn({
1330
+ function qi(e) {
1331
+ return Yn({
1395
1332
  ...e,
1396
- activation: Ae({
1333
+ activation: ke({
1397
1334
  card: e.card,
1398
1335
  cardConfig: e.cardConfig
1399
1336
  })
1400
1337
  });
1401
1338
  }
1402
- function Ho(e) {
1403
- return Hn({
1404
- activation: Ae({
1339
+ function qo(e) {
1340
+ return Jn({
1341
+ activation: ke({
1405
1342
  card: e.card,
1406
1343
  cardConfig: e.cardConfig
1407
1344
  }),
@@ -1409,8 +1346,8 @@ function Ho(e) {
1409
1346
  expectedResultOwner: e.expectedResultOwner
1410
1347
  });
1411
1348
  }
1412
- function jr(e) {
1413
- const t = Ot(e.card, e.effectiveCardConfig), n = lr({
1349
+ function $i(e) {
1350
+ const t = Tt(e.card, e.effectiveCardConfig), n = mi({
1414
1351
  card: t,
1415
1352
  records: e.rows,
1416
1353
  keys: e.rows.length === 0 ? e.resultKeys : void 0,
@@ -1429,55 +1366,55 @@ function jr(e) {
1429
1366
  includeHeaders: e.file.includeHeaders,
1430
1367
  columnSettings: z(e.card),
1431
1368
  visibleColumns: [...n.visibleKeys],
1432
- columnLabels: Object.fromEntries(n.visibleKeys.map((i) => [i, n.labels[i] ?? i]))
1369
+ columnLabels: Object.fromEntries(n.visibleKeys.map((r) => [r, n.labels[r] ?? r]))
1433
1370
  }
1434
1371
  };
1435
1372
  }
1436
- function Gr(e) {
1373
+ function Ui(e) {
1437
1374
  var n;
1438
1375
  const t = (n = e.preferences) == null ? void 0 : n.comparisonPresentation;
1439
1376
  return {
1440
- ...Ni,
1377
+ ...Br,
1441
1378
  ...t,
1442
1379
  ...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
1443
1380
  ...t != null && t.colors ? { colors: { ...t.colors } } : {}
1444
1381
  };
1445
1382
  }
1446
- function Wr(e) {
1447
- const t = Ot(e.card, e.effectiveCardConfig), { cardId: n, ...i } = e.requestPayloadBase, r = e.formatOptions.visibleColumns ?? [], a = [
1448
- ...r,
1383
+ function zi(e) {
1384
+ const t = Tt(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], a = [
1385
+ ...i,
1449
1386
  ...Object.keys(e.formatOptions.columnSettings ?? {})
1450
- ], o = An(
1387
+ ], o = On(
1451
1388
  e.card,
1452
- r,
1389
+ i,
1453
1390
  e.effectiveCardConfig
1454
- ), s = Nn(
1391
+ ), s = Pn(
1455
1392
  e.card,
1456
1393
  e.effectiveCardConfig,
1457
1394
  o
1458
- ), l = Rn(
1395
+ ), l = Nn(
1459
1396
  t,
1460
1397
  a
1461
1398
  ), c = new Set(
1462
1399
  l.eligibleTargets.map(ve)
1463
- ), u = (h) => c.has(ve(h)) ? En({
1464
- bindings: i.controlBindings,
1400
+ ), u = (h) => c.has(ve(h)) ? An({
1401
+ bindings: r.controlBindings,
1465
1402
  controls: [
1466
- ...i.controlDefinitions ?? [],
1467
- ...i.cardControlDefinitions ?? []
1403
+ ...r.controlDefinitions ?? [],
1404
+ ...r.cardControlDefinitions ?? []
1468
1405
  ],
1469
- values: i.controlValues,
1406
+ values: r.controlValues,
1470
1407
  target: h,
1471
1408
  knownTargets: l.knownTargets,
1472
1409
  eligibleTargets: l.eligibleTargets
1473
- }).currency : void 0, d = _n({
1410
+ }).currency : void 0, d = kn({
1474
1411
  card: e.card,
1475
1412
  comparisonMetadata: e.comparisonMetadata,
1476
1413
  columnKeyMap: e.columnKeyMap
1477
- }), f = Ae({
1414
+ }), f = ke({
1478
1415
  card: e.card,
1479
1416
  cardConfig: e.effectiveCardConfig
1480
- }), p = Ur({
1417
+ }), m = qi({
1481
1418
  card: e.card,
1482
1419
  cardConfig: e.effectiveCardConfig,
1483
1420
  columns: e.resultColumns,
@@ -1489,8 +1426,8 @@ function Wr(e) {
1489
1426
  `${h.role}:${h.id}`,
1490
1427
  h
1491
1428
  ])
1492
- ), m = /* @__PURE__ */ new Map();
1493
- if (e.card.type === "detailTable" && i.resultOwner === "config") {
1429
+ ), p = /* @__PURE__ */ new Map();
1430
+ if (e.card.type === "detailTable" && r.resultOwner === "config") {
1494
1431
  const h = e.resultColumns || [];
1495
1432
  if (h.filter(
1496
1433
  (y) => y.rawTemporal
@@ -1499,9 +1436,9 @@ function Wr(e) {
1499
1436
  throw new Error(
1500
1437
  "Canonical raw temporal export requires an authoritative columnKeyMap."
1501
1438
  );
1502
- const y = Hi({
1439
+ const y = Xn({
1503
1440
  cardType: e.card.type,
1504
- resultOwner: i.resultOwner,
1441
+ resultOwner: r.resultOwner,
1505
1442
  effectiveCardConfig: e.effectiveCardConfig,
1506
1443
  result: {
1507
1444
  records: [],
@@ -1513,18 +1450,18 @@ function Wr(e) {
1513
1450
  });
1514
1451
  if (y.kind === "invalid") throw y.error;
1515
1452
  if (y.kind === "loaded_empty" || y.kind === "loaded_valid")
1516
- for (const [C, O] of y.presentation.byColumnKey)
1517
- m.set(C, O.format);
1453
+ for (const [C, M] of y.presentation.byColumnKey)
1454
+ p.set(C, M.format);
1518
1455
  }
1519
- } else if (i.resultOwner === "freeform" && i.sql.trim() && !i.python.trim())
1456
+ } else if (r.resultOwner === "freeform" && r.sql.trim() && !r.python.trim())
1520
1457
  for (const [h, F] of Object.entries(
1521
1458
  z(e.card)
1522
1459
  )) {
1523
1460
  if (F.type !== "date") continue;
1524
- const y = Yi(F.dateFormat);
1525
- y && m.set(
1461
+ const y = Zn(F.dateFormat);
1462
+ y && p.set(
1526
1463
  h,
1527
- $i({
1464
+ Qr({
1528
1465
  format: y,
1529
1466
  preferences: e.reportContext.valueFormat,
1530
1467
  calendar: e.reportContext.calendar
@@ -1534,65 +1471,65 @@ function Wr(e) {
1534
1471
  const v = [
1535
1472
  ...new Set(a)
1536
1473
  ].flatMap((h) => {
1537
- var q, $, _;
1538
- if (p.byColumnKey.has(h) || m.has(h))
1474
+ var $, U, R;
1475
+ if (m.byColumnKey.has(h) || p.has(h))
1539
1476
  return [];
1540
1477
  const F = d.columnPresentationOwners.get(h), y = {
1541
- ...Yn(t, h, {
1478
+ ...er(t, h, {
1542
1479
  columnKeyMap: e.columnKeyMap,
1543
1480
  resultColumns: e.resultColumns
1544
1481
  }),
1545
1482
  ...F ? { metricId: F.metricId, metricAlias: F.metricAlias } : {}
1546
- }, C = (q = t.sql) != null && q.trim() ? void 0 : ne(t, y), O = C ? { kind: "metric", metricId: C.id } : { kind: "column", columnKey: h }, D = c.has(
1547
- ve(O)
1548
- ), k = u(O), B = z(t)[h], W = {
1483
+ }, C = ($ = t.sql) != null && $.trim() ? void 0 : ne(t, y), M = C ? { kind: "metric", metricId: C.id } : { kind: "column", columnKey: h }, D = c.has(
1484
+ ve(M)
1485
+ ), N = u(M), q = z(t)[h], W = {
1549
1486
  dashboardId: e.dashboardId,
1550
1487
  cardId: t.id
1551
- }, R = { kind: "column", columnKey: h }, M = C && (!B || B.inheritMetricFormat === !0) ? G(C.format, {
1488
+ }, _ = { kind: "column", columnKey: h }, O = C && (!q || q.inheritMetricFormat === !0) ? G(C.format, {
1552
1489
  preserveOmittedProperties: !0
1553
1490
  }) : void 0;
1554
- if ((M == null ? void 0 : M.type) === "date")
1491
+ if ((O == null ? void 0 : O.type) === "date")
1555
1492
  return [
1556
1493
  {
1557
1494
  scope: W,
1558
- target: R,
1495
+ target: _,
1559
1496
  format: {
1560
1497
  type: "date",
1561
- locale: M.locale ?? e.reportContext.valueFormat.locale,
1562
- ...M.pattern ? { pattern: M.pattern } : {},
1563
- ...M.timezone ? { timezone: M.timezone } : {},
1564
- ...M.sourceTimezone ? { sourceTimezone: M.sourceTimezone } : {}
1498
+ locale: O.locale ?? e.reportContext.valueFormat.locale,
1499
+ ...O.pattern ? { pattern: O.pattern } : {},
1500
+ ...O.timezone ? { timezone: O.timezone } : {},
1501
+ ...O.sourceTimezone ? { sourceTimezone: O.sourceTimezone } : {}
1565
1502
  }
1566
1503
  }
1567
1504
  ];
1568
- const w = (F ? $r({
1505
+ const T = (F ? Li({
1569
1506
  card: t,
1570
1507
  columnId: h,
1571
1508
  columnKeyMap: e.columnKeyMap,
1572
- persistedSettings: B,
1509
+ persistedSettings: q,
1573
1510
  metricId: F.metricId,
1574
1511
  metricAlias: F.metricAlias,
1575
1512
  comparisonValueKind: F.kind,
1576
- comparisonPrecision: (_ = ($ = t.preferences) == null ? void 0 : $.comparisonPresentation) == null ? void 0 : _.precision,
1513
+ comparisonPrecision: (R = (U = t.preferences) == null ? void 0 : U.comparisonPresentation) == null ? void 0 : R.precision,
1577
1514
  presentation: {
1578
1515
  preferences: e.reportContext.valueFormat,
1579
1516
  resolveBoundCurrency: u
1580
1517
  }
1581
- }) : void 0) ?? (D ? zr({
1518
+ }) : void 0) ?? (D ? Bi({
1582
1519
  card: t,
1583
- target: O,
1520
+ target: M,
1584
1521
  resultColumnKeys: a,
1585
1522
  valueFormatPreferences: e.reportContext.valueFormat,
1586
- boundCurrency: k
1523
+ boundCurrency: N
1587
1524
  }) : void 0) ?? de({
1588
1525
  card: t,
1589
1526
  ...y,
1590
- persistedSettings: B,
1527
+ persistedSettings: q,
1591
1528
  valueFormatPreferences: e.reportContext.valueFormat
1592
- }), J = (w == null ? void 0 : w.type) === "duration" ? w : w ? P(
1593
- w,
1529
+ }), J = (T == null ? void 0 : T.type) === "duration" ? T : T ? P(
1530
+ T,
1594
1531
  e.reportContext.valueFormat,
1595
- k
1532
+ N
1596
1533
  ) : P(
1597
1534
  {
1598
1535
  type: "number",
@@ -1602,11 +1539,11 @@ function Wr(e) {
1602
1539
  e.reportContext.valueFormat
1603
1540
  );
1604
1541
  return [
1605
- J.type === "duration" ? { scope: W, target: R, format: J } : { scope: W, target: R, format: J }
1542
+ J.type === "duration" ? { scope: W, target: _, format: J } : { scope: W, target: _, format: J }
1606
1543
  ];
1607
1544
  });
1608
1545
  v.push(
1609
- ...[...p.byColumnKey.values()].map((h) => {
1546
+ ...[...m.byColumnKey.values()].map((h) => {
1610
1547
  const F = b.get(
1611
1548
  `${h.role ?? "groupby"}:${h.fieldId}`
1612
1549
  );
@@ -1620,7 +1557,7 @@ function Wr(e) {
1620
1557
  cardId: e.card.id
1621
1558
  },
1622
1559
  target: { kind: "column", columnKey: h.columnKey },
1623
- format: Jn(
1560
+ format: tr(
1624
1561
  F,
1625
1562
  {
1626
1563
  dateStyle: e.reportContext.valueFormat.dateStyle,
@@ -1631,13 +1568,13 @@ function Wr(e) {
1631
1568
  };
1632
1569
  })
1633
1570
  ), v.push(
1634
- ...[...m].map(([h, F]) => ({
1571
+ ...[...p].map(([h, F]) => ({
1635
1572
  scope: { dashboardId: e.dashboardId, cardId: e.card.id },
1636
1573
  target: { kind: "column", columnKey: h },
1637
1574
  format: F
1638
1575
  }))
1639
1576
  );
1640
- const x = zi({
1577
+ const x = Yr({
1641
1578
  reportContext: e.reportContext,
1642
1579
  resolvedFormats: v
1643
1580
  });
@@ -1645,82 +1582,82 @@ function Wr(e) {
1645
1582
  formatOptions: {
1646
1583
  ...e.formatOptions,
1647
1584
  ...o ? { tableTotalsLabelColumnKey: o } : {},
1648
- comparisonPresentation: Gr(e.card),
1585
+ comparisonPresentation: Ui(e.card),
1649
1586
  presentationExecutionSnapshot: x
1650
1587
  },
1651
1588
  ...s ? { tableTotalsRequest: s } : {}
1652
1589
  };
1653
1590
  }
1654
- function Hr(e) {
1655
- const t = Kn(
1591
+ function ji(e) {
1592
+ const t = Rn(
1656
1593
  e.card,
1657
1594
  e.requestPayloadBase
1658
- ), { cardId: n, ...i } = t.requestPayloadBase, r = Wr(e);
1595
+ ), { cardId: n, ...r } = t.requestPayloadBase, i = zi(e);
1659
1596
  return {
1660
1597
  type: "card",
1661
1598
  dashboardId: e.dashboardId,
1662
1599
  cardId: e.card.id,
1663
1600
  title: e.title,
1664
1601
  connection_id: t.connectionId,
1665
- ...i,
1666
- ...r.tableTotalsRequest ? { tableTotalsRequest: r.tableTotalsRequest } : {},
1602
+ ...r,
1603
+ ...i.tableTotalsRequest ? { tableTotalsRequest: i.tableTotalsRequest } : {},
1667
1604
  totalRows: e.totalRows,
1668
1605
  format: e.format,
1669
- formatOptions: r.formatOptions
1606
+ formatOptions: i.formatOptions
1670
1607
  };
1671
1608
  }
1672
- function Yo(e) {
1609
+ function $o(e) {
1673
1610
  const { card: t, result: n } = e;
1674
1611
  if (t.type !== "table" && t.type !== "detailTable")
1675
1612
  return { status: "refused", reason: "not_a_table" };
1676
- const i = n.modelFormats ? ji(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1677
- if (Vn({ card: t, comparisonMetadata: n.comparisonMetadata }))
1613
+ const r = n.modelFormats ? Jr(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1614
+ if (_n({ card: t, comparisonMetadata: n.comparisonMetadata }))
1678
1615
  return { status: "refused", reason: "comparison_metadata_missing" };
1679
- const r = jr({
1616
+ const i = $i({
1680
1617
  card: t,
1681
- effectiveCardConfig: i,
1618
+ effectiveCardConfig: r,
1682
1619
  rows: e.rows,
1683
1620
  resultKeys: n.resultColumns.map((a) => a.key),
1684
1621
  result: n,
1685
1622
  reportContext: e.reportContext,
1686
1623
  file: e.file
1687
1624
  });
1688
- return r ? {
1625
+ return i ? {
1689
1626
  status: "ready",
1690
- request: Hr({
1627
+ request: ji({
1691
1628
  card: t,
1692
1629
  dashboardId: e.dashboardId,
1693
1630
  title: e.title,
1694
1631
  reportContext: e.reportContext,
1695
1632
  totalRows: n.totalRows,
1696
1633
  format: e.file.format,
1697
- formatOptions: r.formatOptions,
1634
+ formatOptions: i.formatOptions,
1698
1635
  comparisonMetadata: n.comparisonMetadata,
1699
1636
  requestPayloadBase: e.query,
1700
1637
  resultColumns: [...n.resultColumns],
1701
1638
  columnKeyMap: n.columnKeyMap,
1702
- effectiveCardConfig: i
1639
+ effectiveCardConfig: r
1703
1640
  })
1704
1641
  } : { status: "refused", reason: "columns_unresolved" };
1705
1642
  }
1706
- function Yr(e, t, n) {
1707
- if (wi(
1708
- Ti(t),
1643
+ function Gi(e, t, n) {
1644
+ if (Ar(
1645
+ _r(t),
1709
1646
  e.aggregateOrigin
1710
1647
  ))
1711
1648
  return { aggregate: void 0, aggregateOrigin: void 0 };
1712
- const i = n === "selection" && e.role === "metric" ? t.aggregate : void 0;
1649
+ const r = n === "selection" && e.role === "metric" ? t.aggregate : void 0;
1713
1650
  return {
1714
- aggregate: e.aggregate ?? i,
1715
- aggregateOrigin: e.aggregate ? e.aggregateOrigin : i ? t.aggregateOrigin : void 0
1651
+ aggregate: e.aggregate ?? r,
1652
+ aggregateOrigin: e.aggregate ? e.aggregateOrigin : r ? t.aggregateOrigin : void 0
1716
1653
  };
1717
1654
  }
1718
- function Jr(e, t, n) {
1719
- var i, r, a, o, s, l;
1655
+ function Wi(e, t, n) {
1656
+ var r, i, a, o, s, l;
1720
1657
  if (n === "domain")
1721
1658
  return {
1722
- filters: (i = t.parameters) == null ? void 0 : i.filters,
1723
- windowTransform: (r = e.parameters) == null ? void 0 : r.windowTransform
1659
+ filters: (r = t.parameters) == null ? void 0 : r.filters,
1660
+ windowTransform: (i = e.parameters) == null ? void 0 : i.windowTransform
1724
1661
  };
1725
1662
  if (!(!e.parameters && !t.parameters))
1726
1663
  return {
@@ -1728,8 +1665,8 @@ function Jr(e, t, n) {
1728
1665
  windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((l = t.parameters) == null ? void 0 : l.windowTransform)
1729
1666
  };
1730
1667
  }
1731
- function Jo(e, t, n) {
1732
- const i = e;
1668
+ function Uo(e, t, n) {
1669
+ const r = e;
1733
1670
  return {
1734
1671
  id: e.id,
1735
1672
  role: e.role,
@@ -1737,22 +1674,22 @@ function Jo(e, t, n) {
1737
1674
  // range bounds). They do not identify or redefine the catalog calculation.
1738
1675
  ...n === "selection" && e.alias ? { alias: e.alias } : {},
1739
1676
  granularity: e.granularity ?? t.granularity,
1740
- ...Yr(e, t, n),
1677
+ ...Gi(e, t, n),
1741
1678
  ...e.role === "metric" ? {
1742
- aliasTemplate: i.aliasTemplate,
1743
- valueAliases: i.valueAliases,
1744
- comparison: i.comparison,
1745
- comparisonPolarity: i.comparisonPolarity,
1746
- parameters: Jr(
1747
- i,
1679
+ aliasTemplate: r.aliasTemplate,
1680
+ valueAliases: r.valueAliases,
1681
+ comparison: r.comparison,
1682
+ comparisonPolarity: r.comparisonPolarity,
1683
+ parameters: Wi(
1684
+ r,
1748
1685
  t,
1749
1686
  "domain"
1750
1687
  )
1751
1688
  } : {},
1752
- ...Qr(e)
1689
+ ...Hi(e)
1753
1690
  };
1754
1691
  }
1755
- function Qr(e) {
1692
+ function Hi(e) {
1756
1693
  const t = {
1757
1694
  ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
1758
1695
  ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
@@ -1772,37 +1709,37 @@ function Qr(e) {
1772
1709
  return t;
1773
1710
  }
1774
1711
  }
1775
- const Zr = "table";
1776
- function Qo({ preferences: e, ...t }) {
1712
+ const Qi = "table";
1713
+ function zo({ preferences: e, ...t }) {
1777
1714
  return {
1778
1715
  ...t,
1779
- type: Zr,
1716
+ type: Qi,
1780
1717
  preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
1781
1718
  sql: "",
1782
1719
  data: []
1783
1720
  };
1784
1721
  }
1785
- function Xr(e, t) {
1786
- const n = e.sheets ?? [], i = n.findIndex((o) => o.id === t.sheetId), r = n[i];
1787
- if (!r)
1788
- throw new T("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
1789
- if (Qn(r))
1790
- throw new T(
1722
+ function Yi(e, t) {
1723
+ const n = e.sheets ?? [], r = n.findIndex((o) => o.id === t.sheetId), i = n[r];
1724
+ if (!i)
1725
+ throw new w("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
1726
+ if (nr(i))
1727
+ throw new w(
1791
1728
  "sheet_not_a_grid",
1792
1729
  "This sheet is a document: it has no grid to arrange.",
1793
1730
  "Arrange a grid sheet; Document sheets are laid out in the editor."
1794
1731
  );
1795
- const a = kt(r, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1732
+ const a = Ot(i, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1796
1733
  return {
1797
- dashboard: { ...e, sheets: n.map((o, s) => s === i ? a : o) },
1798
- clauses: [Ne.arranged(r.title || "the dashboard", t.keepOrder === !0, !(r.frames ?? []).length)]
1734
+ dashboard: { ...e, sheets: n.map((o, s) => s === r ? a : o) },
1735
+ clauses: [H.arranged(i.title || "the dashboard", t.keepOrder === !0, !(i.frames ?? []).length)]
1799
1736
  };
1800
1737
  }
1801
- function ea(e) {
1738
+ function Ji(e) {
1802
1739
  return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
1803
1740
  }
1804
- function H(...e) {
1805
- return Zn(e.flatMap((t) => t || []));
1741
+ function Q(...e) {
1742
+ return rr(e.flatMap((t) => t || []));
1806
1743
  }
1807
1744
  function Z(e, t) {
1808
1745
  return {
@@ -1810,13 +1747,13 @@ function Z(e, t) {
1810
1747
  fieldScope: t
1811
1748
  };
1812
1749
  }
1813
- function ze(e) {
1750
+ function $e(e) {
1814
1751
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => Z(t, "sheet"));
1815
1752
  }
1816
- function an(e) {
1753
+ function nn(e) {
1817
1754
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => Z(t, "sheet"));
1818
1755
  }
1819
- function ta(e) {
1756
+ function Xi(e) {
1820
1757
  return e ? [
1821
1758
  ...(e.calculatedFields || []).filter(
1822
1759
  (t) => t.fieldScope === "dashboard"
@@ -1824,33 +1761,33 @@ function ta(e) {
1824
1761
  ...(e.frames || []).flatMap((t) => t.calculatedFields || [])
1825
1762
  ].map((t) => Z(t, "dashboard")) : [];
1826
1763
  }
1827
- function na(e) {
1764
+ function Zi(e) {
1828
1765
  if (e !== void 0)
1829
- return H(
1766
+ return Q(
1830
1767
  e.map((t) => Z(t, "dashboard"))
1831
1768
  );
1832
1769
  }
1833
- function Zo(e) {
1834
- var i;
1835
- const t = [], n = (e.sheets || []).map((r) => {
1770
+ function jo(e) {
1771
+ var r;
1772
+ const t = [], n = (e.sheets || []).map((i) => {
1836
1773
  var a;
1837
- return t.push(...ta(r)), {
1838
- ...r,
1839
- calculatedFields: H(
1840
- ze(r),
1841
- an(r)
1774
+ return t.push(...Xi(i)), {
1775
+ ...i,
1776
+ calculatedFields: Q(
1777
+ $e(i),
1778
+ nn(i)
1842
1779
  ),
1843
- frames: (a = r.frames) == null ? void 0 : a.map(
1780
+ frames: (a = i.frames) == null ? void 0 : a.map(
1844
1781
  (o) => o.calculatedFields === void 0 ? o : { ...o, calculatedFields: void 0 }
1845
1782
  )
1846
1783
  };
1847
1784
  });
1848
1785
  return {
1849
1786
  ...e,
1850
- calculatedFields: na(
1851
- H(
1852
- (i = e.calculatedFields) == null ? void 0 : i.map(
1853
- (r) => Z(r, "dashboard")
1787
+ calculatedFields: Zi(
1788
+ Q(
1789
+ (r = e.calculatedFields) == null ? void 0 : r.map(
1790
+ (i) => Z(i, "dashboard")
1854
1791
  ),
1855
1792
  t
1856
1793
  )
@@ -1858,127 +1795,131 @@ function Zo(e) {
1858
1795
  sheets: n
1859
1796
  };
1860
1797
  }
1861
- function ht(e, t) {
1862
- var r;
1863
- if (!((r = e == null ? void 0 : e.frames) != null && r.length))
1798
+ function yt(e, t) {
1799
+ var i;
1800
+ if (!((i = e == null ? void 0 : e.frames) != null && i.length))
1864
1801
  return [];
1865
- const n = t ? e.frames.find((a) => a.id === t) : void 0, i = e.frames.filter(
1802
+ const n = t ? e.frames.find((a) => a.id === t) : void 0, r = e.frames.filter(
1866
1803
  (a) => !t || a.id !== t
1867
1804
  );
1868
- return H(
1805
+ return Q(
1869
1806
  n == null ? void 0 : n.calculatedFields,
1870
- ...i.map((a) => a.calculatedFields)
1807
+ ...r.map((a) => a.calculatedFields)
1871
1808
  );
1872
1809
  }
1873
- function Xo(e, t) {
1874
- return e ? ze(e) : [];
1810
+ function Go(e, t) {
1811
+ return e ? $e(e) : [];
1875
1812
  }
1876
- function es(e, t) {
1813
+ function Wo(e, t) {
1877
1814
  if (!e)
1878
1815
  return [];
1879
- const n = ze(e), i = an(e), r = H(
1816
+ const n = $e(e), r = nn(e), i = Q(
1880
1817
  n,
1881
- i
1818
+ r
1882
1819
  );
1883
- return ea(e) ? r.length === 0 ? [] : i.length === 0 ? r : H(
1884
- r,
1885
- ht(e, t)
1886
- ) : ht(e, t);
1820
+ return Ji(e) ? i.length === 0 ? [] : r.length === 0 ? i : Q(
1821
+ i,
1822
+ yt(e, t)
1823
+ ) : yt(e, t);
1887
1824
  }
1888
- function ia(e) {
1825
+ function ea(e) {
1889
1826
  if (e !== void 0)
1890
- return H(
1827
+ return Q(
1891
1828
  e.map((t) => Z(t, "sheet"))
1892
1829
  );
1893
1830
  }
1894
- function ts(e) {
1895
- const { field: t, sheetFields: n = [], dashboardFields: i = [] } = e, r = (s) => s.find(
1896
- (l) => Xn(l, t, {
1831
+ function Ho(e) {
1832
+ const { field: t, sheetFields: n = [], dashboardFields: r = [] } = e, i = (s) => s.find(
1833
+ (l) => ir(l, t, {
1897
1834
  allowComparableFallback: !0
1898
1835
  })
1899
1836
  );
1900
1837
  if (t.fieldScope === "sheet")
1901
- return { scope: "sheet", matchedField: r(n) };
1838
+ return { scope: "sheet", matchedField: i(n) };
1902
1839
  if (t.fieldScope === "dashboard")
1903
- return { scope: "dashboard", matchedField: r(i) };
1904
- const a = r(n);
1840
+ return { scope: "dashboard", matchedField: i(r) };
1841
+ const a = i(n);
1905
1842
  if (a)
1906
1843
  return { scope: "sheet", matchedField: a };
1907
- const o = r(i);
1844
+ const o = i(r);
1908
1845
  return o ? { scope: "dashboard", matchedField: o } : { scope: "card" };
1909
1846
  }
1910
- function ra(e, t) {
1847
+ function ta(e, t) {
1911
1848
  var x, h, F;
1912
- const n = (e.sheets ?? []).findIndex((y) => y.id === t.sheetId), i = (x = e.sheets) == null ? void 0 : x[n];
1913
- if (!(i != null && i.frames))
1914
- throw new T("sheet_not_found", `No sheet ${t.sheetId} with frames on this dashboard.`);
1915
- const { frame: r } = t, a = i.frames.findIndex((y) => y.id === r.id);
1849
+ const n = (e.sheets ?? []).findIndex((y) => y.id === t.sheetId), r = (x = e.sheets) == null ? void 0 : x[n];
1850
+ if (!(r != null && r.frames))
1851
+ throw new w("sheet_not_found", `No sheet ${t.sheetId} with frames on this dashboard.`);
1852
+ const { frame: i } = t, a = r.frames.findIndex((y) => y.id === i.id);
1916
1853
  if (a === -1)
1917
- throw new T("frame_not_found", `No frame ${r.id} on sheet ${t.sheetId}.`);
1918
- const o = i.frames[a], s = it(i), l = (y) => y.calculatedFields === void 0 ? y : { ...y, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
1919
- const y = c.map((C) => C.id === r.id ? r : C);
1920
- return y.some((C) => C.id === r.id) ? y : [r, ...y];
1921
- })() : [r], d = new Map(u.map((y) => [y.id, y])), f = kt(i, { kind: "frame_updated", frame: r, resizeForNewKind: t.resizeLayouts });
1922
- let p = /* @__PURE__ */ new Set();
1923
- const g = ei.produce(e, (y) => {
1854
+ throw new w("frame_not_found", `No frame ${i.id} on sheet ${t.sheetId}.`);
1855
+ const o = r.frames[a], s = tt(r), l = (y) => y.calculatedFields === void 0 ? y : { ...y, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
1856
+ const y = c.map((C) => C.id === i.id ? i : C);
1857
+ return y.some((C) => C.id === i.id) ? y : [i, ...y];
1858
+ })() : [i], d = new Map(u.map((y) => [y.id, y])), f = Ot(r, { kind: "frame_updated", frame: i, resizeForNewKind: t.resizeLayouts });
1859
+ let m = /* @__PURE__ */ new Set();
1860
+ const g = ar.produce(e, (y) => {
1924
1861
  const C = y.sheets[n];
1925
- f.layouts !== i.layouts && (C.layouts = rt(f.layouts)), f.customizedBreakpoints !== i.customizedBreakpoints && (C.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (C.calculatedFields = ia(t.sheetCalculatedFields)), C.frames = C.frames.map((D) => {
1926
- const k = d.get(D.id);
1927
- return k ? rt(l(k)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
1862
+ f.layouts !== r.layouts && (C.layouts = nt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (C.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (C.calculatedFields = ea(t.sheetCalculatedFields)), C.frames = C.frames.map((D) => {
1863
+ const N = d.get(D.id);
1864
+ return N ? nt(l(N)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
1928
1865
  });
1929
- const O = it(C);
1930
- p = new Set([...s].filter((D) => !O.has(D))), ti(y, p), t.dashboardCalculatedFields && (y.calculatedFields = t.dashboardCalculatedFields);
1931
- }), b = g.sheets[n].frames.find((y) => y.id === r.id), m = [
1932
- ...p.size ? [{ kind: "cards_removed", cardIds: [...p] }] : [],
1866
+ const M = tt(C);
1867
+ m = new Set([...s].filter((D) => !M.has(D))), or(y, m), t.dashboardCalculatedFields && (y.calculatedFields = t.dashboardCalculatedFields);
1868
+ }), b = g.sheets[n].frames.find((y) => y.id === i.id), p = [
1869
+ ...m.size ? [{ kind: "cards_removed", cardIds: [...m] }] : [],
1933
1870
  { kind: "frame_committed", sheetId: t.sheetId, before: o, after: b }
1934
- ], v = ((h = r.cards) == null ? void 0 : h.find((y) => y.id === r.activeCardId)) ?? ((F = r.cards) == null ? void 0 : F[0]);
1935
- return { dashboard: g, runtimeEffects: m, clauses: [Ne.committed(v == null ? void 0 : v.title)] };
1871
+ ], v = ((h = i.cards) == null ? void 0 : h.find((y) => y.id === i.activeCardId)) ?? ((F = i.cards) == null ? void 0 : F[0]);
1872
+ return { dashboard: g, runtimeEffects: p, clauses: [H.committed(v == null ? void 0 : v.title)] };
1873
+ }
1874
+ function na(e, t) {
1875
+ const n = { ...e }, r = [];
1876
+ return t.title !== void 0 && t.title !== e.title && (n.title = t.title, r.push(H.plain("dashboard", `renames the dashboard to ${L(t.title)}`))), t.description === null && e.description ? (delete n.description, r.push(H.plain("dashboard", "removes the dashboard's description"))) : typeof t.description == "string" && t.description !== e.description && (n.description = t.description, r.push(H.plain("dashboard", "changes the dashboard's description"))), { dashboard: n, clauses: r.length ? r : [H.plain("dashboard", "changes nothing on the dashboard")] };
1936
1877
  }
1937
- function aa(e, t, n) {
1878
+ function ra(e, t, n) {
1938
1879
  var a;
1939
1880
  if (!e || !t || t.customFilterPreferences) return;
1940
- const i = t.defaultDateFilter;
1941
- return (t.dateSelectionMode === "day" ? ri(i) : t.dateSelectionMode === "months" && (ai(i) || oi(i) && i.unit === "month" && (i.mode === "previous" || i.mode === "this" && !i.toDate && !i.boundary))) && ((a = Q(t, n)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
1881
+ const r = t.defaultDateFilter;
1882
+ return (t.dateSelectionMode === "day" ? lr(r) : t.dateSelectionMode === "months" && (ur(r) || dr(r) && r.unit === "month" && (r.mode === "previous" || r.mode === "this" && !r.toDate && !r.boundary))) && ((a = X(t, n)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
1942
1883
  }
1943
- function ns(e) {
1944
- const t = e.createId ?? _t, n = t(), i = Ln({
1884
+ function Qo(e) {
1885
+ const t = e.createId ?? At, n = t(), r = En({
1945
1886
  field: e.field,
1946
1887
  dataSource: e.dataSource,
1947
1888
  connectionId: e.connectionId,
1948
1889
  connectionType: e.connectionType,
1949
1890
  filterId: t()
1950
1891
  });
1951
- return oa({
1952
- filter: e.label ? { ...i, title: e.label } : i,
1892
+ return ia({
1893
+ filter: e.label ? { ...r, title: e.label } : r,
1953
1894
  label: e.label || e.field.label || e.field.name,
1954
1895
  scope: e.scope,
1955
1896
  existingInputs: e.existingInputs,
1956
1897
  createId: () => n
1957
1898
  });
1958
1899
  }
1959
- function oa(e) {
1960
- const t = e.createId ?? _t, n = e.label || e.filter.title || e.filter.column || e.filter.id, i = ni(n, [
1900
+ function ia(e) {
1901
+ const t = e.createId ?? At, n = e.label || e.filter.title || e.filter.column || e.filter.id, r = sr(n, [
1961
1902
  ...e.existingInputs
1962
- ]), r = {
1963
- ...At(e.filter),
1964
- variableName: i
1903
+ ]), i = {
1904
+ ...Pt(e.filter),
1905
+ variableName: r
1965
1906
  };
1966
1907
  return {
1967
1908
  id: t(),
1968
1909
  kind: "filter",
1969
1910
  label: n,
1970
- variableName: i,
1911
+ variableName: r,
1971
1912
  requiredAtExecution: !1,
1972
1913
  scope: e.scope,
1973
1914
  runtimeScope: "shared",
1974
- presentation: Rt(r),
1975
- filter: r,
1976
- exports: Nt(r)
1915
+ presentation: kt(i),
1916
+ filter: i,
1917
+ exports: Nt(i)
1977
1918
  };
1978
1919
  }
1979
- function sa(e, t, n, i = { calendar: null }) {
1980
- var We, He, Ye, Je, Qe, Ze, Xe, et;
1981
- const r = U(e), a = r.findFilterInput(t), o = (S, I) => ({
1920
+ function aa(e, t, n, r = { calendar: null }) {
1921
+ var je, Ge, We, He, Qe, Ye, Je, Xe;
1922
+ const i = j(e), a = i.findFilterInput(t), o = (S, I) => ({
1982
1923
  ok: !1,
1983
1924
  issues: [
1984
1925
  {
@@ -2004,206 +1945,206 @@ function sa(e, t, n, i = { calendar: null }) {
2004
1945
  if (a.origin !== "embeddedInput")
2005
1946
  return o("This filter can not be edited here.");
2006
1947
  const s = a.input, l = s.filter;
2007
- if (((We = n.mapping) == null ? void 0 : We.kind) === "save") {
1948
+ if (((je = n.mapping) == null ? void 0 : je.kind) === "save") {
2008
1949
  if (!n.mapping.draft.acceptance.ok)
2009
1950
  return { ok: !1, issues: n.mapping.draft.acceptance.issues };
2010
1951
  if (n.mapping.draft.inputId !== s.id)
2011
1952
  return o("The card mapping was prepared for another filter.");
2012
1953
  }
2013
- const c = n.definition ? At(n.definition) : l;
2014
- if (c.kind === "global-date" && n.scope && !la(n.scope))
1954
+ const c = n.definition ? Pt(n.definition) : l;
1955
+ if (c.kind === "global-date" && n.scope && !oa(n.scope))
2015
1956
  return o("The Global Date filter applies to regular tabs only.");
2016
- const u = (He = i.calendar) == null ? void 0 : He.tz, d = n.definition !== void 0, f = n.forceSelection !== void 0 || d ? aa(
1957
+ const u = (Ge = r.calendar) == null ? void 0 : Ge.tz, d = n.definition !== void 0, f = n.forceSelection !== void 0 || d ? ra(
2017
1958
  n.forceSelection ?? s.forceSelection,
2018
1959
  c,
2019
1960
  u
2020
- ) : s.forceSelection ? !0 : void 0, p = (Array.isArray(e.inputs) ? e.inputs : []).filter((S) => S.id !== s.id), g = n.variableName !== void 0 ? ii(n.variableName, [
2021
- ...p,
2022
- ...r.inputs.filter((S) => S.input.id !== s.id).map((S) => S.input)
2023
- ]) : s.variableName, b = d && (l.title || l.column) !== (c.title || c.column), m = n.label ?? (b ? c.title || c.column || c.id : void 0), v = d && l.hide !== c.hide, x = d && l.toolbarWidth !== c.toolbarWidth, h = (S) => {
2024
- var tt, nt;
1961
+ ) : s.forceSelection ? !0 : void 0, m = (Array.isArray(e.inputs) ? e.inputs : []).filter((S) => S.id !== s.id), g = n.variableName !== void 0 ? cr(n.variableName, [
1962
+ ...m,
1963
+ ...i.inputs.filter((S) => S.input.id !== s.id).map((S) => S.input)
1964
+ ]) : s.variableName, b = d && (l.title || l.column) !== (c.title || c.column), p = n.label ?? (b ? c.title || c.column || c.id : void 0), v = d && l.hide !== c.hide, x = d && l.toolbarWidth !== c.toolbarWidth, h = (S) => {
1965
+ var Ze, et;
2025
1966
  const I = { ...S };
2026
- if (m !== void 0 && (I.label = m), n.variableName !== void 0 && (I.variableName = g), n.scope && (I.scope = n.scope), v || x) {
2027
- const be = Rt(c);
1967
+ if (p !== void 0 && (I.label = p), n.variableName !== void 0 && (I.variableName = g), n.scope && (I.scope = n.scope), v || x) {
1968
+ const be = kt(c);
2028
1969
  I.presentation = { ...S.presentation }, v && (I.presentation.placement = be.placement), x && (be.widthPx === void 0 ? delete I.presentation.widthPx : I.presentation.widthPx = be.widthPx);
2029
1970
  }
2030
- return (n.forceSelection !== void 0 || d) && (f ? I.forceSelection = f : delete I.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? I.requiredAtExecution = !0 : delete I.requiredAtExecution), Ie(I, "optionSource", n.optionSource), Ie(I, "optionDependencies", n.optionDependencies), Ie(I, "optionPopulation", n.optionPopulation), ((tt = n.mapping) == null ? void 0 : tt.kind) === "save" && n.mapping.draft.acceptance.ok ? I.application = n.mapping.draft.acceptance.application : ((nt = n.mapping) == null ? void 0 : nt.kind) === "remove" && delete I.application, I;
1971
+ return (n.forceSelection !== void 0 || d) && (f ? I.forceSelection = f : delete I.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? I.requiredAtExecution = !0 : delete I.requiredAtExecution), Ie(I, "optionSource", n.optionSource), Ie(I, "optionDependencies", n.optionDependencies), Ie(I, "optionPopulation", n.optionPopulation), ((Ze = n.mapping) == null ? void 0 : Ze.kind) === "save" && n.mapping.draft.acceptance.ok ? I.application = n.mapping.draft.acceptance.application : ((et = n.mapping) == null ? void 0 : et.kind) === "remove" && delete I.application, I;
2031
1972
  }, F = n.label !== void 0 && n.label !== s.label && n.label !== c.title ? n.label : void 0, y = d || n.variableName !== void 0 || F !== void 0, C = (S) => ({
2032
1973
  ...S,
2033
1974
  ...n.variableName !== void 0 ? { variableName: g } : {},
2034
1975
  ...F !== void 0 ? { title: F } : {}
2035
- }), O = Array.isArray(e.inputs) ? [...e.inputs] : [], D = O.findIndex((S) => S.id === s.id), k = O[D];
2036
- if (D < 0 || (k == null ? void 0 : k.kind) !== "filter" || !k.filter)
1976
+ }), M = Array.isArray(e.inputs) ? [...e.inputs] : [], D = M.findIndex((S) => S.id === s.id), N = M[D];
1977
+ if (D < 0 || (N == null ? void 0 : N.kind) !== "filter" || !N.filter)
2037
1978
  return o("This filter can not be edited here.");
2038
- const B = h(
1979
+ const q = h(
2039
1980
  y ? {
2040
- ...k,
1981
+ ...N,
2041
1982
  filter: C(c)
2042
- } : k
1983
+ } : N
2043
1984
  );
2044
- d && (B.exports = Nt(c)), O[D] = B;
2045
- const W = Ee({
2046
- inputs: [B],
1985
+ d && (q.exports = Nt(c)), M[D] = q;
1986
+ const W = Re({
1987
+ inputs: [q],
2047
1988
  dashboardFilters: []
2048
1989
  });
2049
1990
  if (!W.ok)
2050
1991
  return o(
2051
- ((Ye = W.issues[0]) == null ? void 0 : Ye.message) ?? "These settings could not be saved.",
1992
+ ((We = W.issues[0]) == null ? void 0 : We.message) ?? "These settings could not be saved.",
2052
1993
  W.issues[0]
2053
1994
  );
2054
- let R = { ...e, inputs: O };
2055
- const M = U(R), w = M.findFilterInput({ filterId: c.id });
2056
- if (!w)
1995
+ let _ = { ...e, inputs: M };
1996
+ const O = j(_), T = O.findFilterInput({ filterId: c.id });
1997
+ if (!T)
2057
1998
  return o(
2058
- ((Je = M.issues[0]) == null ? void 0 : Je.message) ?? "These settings could not be saved."
1999
+ ((He = O.issues[0]) == null ? void 0 : He.message) ?? "These settings could not be saved."
2059
2000
  );
2060
- const J = n.variableName !== void 0 || n.scope !== void 0 ? ca(R, w.input) : void 0;
2001
+ const J = n.variableName !== void 0 || n.scope !== void 0 ? sa(_, T.input) : void 0;
2061
2002
  if (J)
2062
2003
  return o(
2063
2004
  `Another filter on the same cards is already named "${J}". Choose another name.`
2064
2005
  );
2065
- const q = [], $ = {
2066
- id: w.input.id,
2067
- runtimeScope: w.input.runtimeScope
2006
+ const $ = [], U = {
2007
+ id: T.input.id,
2008
+ runtimeScope: T.input.runtimeScope
2068
2009
  };
2069
- let _ = {
2070
- defaultInputValues: R.defaultInputValues,
2010
+ let R = {
2011
+ defaultInputValues: _.defaultInputValues,
2071
2012
  dashboardInputValues: {}
2072
2013
  };
2073
- const In = ((Qe = n.values) == null ? void 0 : Qe.target) ?? {}, A = fa(
2014
+ const Fn = ((Qe = n.values) == null ? void 0 : Qe.target) ?? {}, k = ua(
2074
2015
  l,
2075
2016
  c,
2076
2017
  {
2077
- defaultValueChanged: (Ze = n.values) == null ? void 0 : Ze.defaultChanged,
2078
- selectionIdentityChanged: (Xe = n.values) == null ? void 0 : Xe.selectionIdentityChanged,
2079
- ...((et = n.values) == null ? void 0 : et.defaultComparisonSelection) !== void 0 ? {
2018
+ defaultValueChanged: (Ye = n.values) == null ? void 0 : Ye.defaultChanged,
2019
+ selectionIdentityChanged: (Je = n.values) == null ? void 0 : Je.selectionIdentityChanged,
2020
+ ...((Xe = n.values) == null ? void 0 : Xe.defaultComparisonSelection) !== void 0 ? {
2080
2021
  defaultComparisonChanged: !0,
2081
2022
  defaultComparisonSelection: n.values.defaultComparisonSelection ?? void 0
2082
2023
  } : {}
2083
2024
  },
2084
- In,
2085
- i.calendar ?? void 0
2025
+ Fn,
2026
+ r.calendar ?? void 0
2086
2027
  );
2087
- if (A.defaultValueChanged || A.selectionIdentityChanged || A.defaultComparisonChanged) {
2088
- const S = on({
2089
- state: { ..._, dashboardInputValues: {} },
2090
- input: $,
2091
- settings: A
2028
+ if (k.defaultValueChanged || k.selectionIdentityChanged || k.defaultComparisonChanged) {
2029
+ const S = rn({
2030
+ state: { ...R, dashboardInputValues: {} },
2031
+ input: U,
2032
+ settings: k
2092
2033
  });
2093
- _ = { ..._, defaultInputValues: S.defaultInputValues }, A.selectionIdentityChanged && q.push({
2034
+ R = { ...R, defaultInputValues: S.defaultInputValues }, k.selectionIdentityChanged && $.push({
2094
2035
  kind: "clear",
2095
- inputId: $.id,
2096
- target: A.target
2097
- }), A.defaultValueChanged && q.push({
2036
+ inputId: U.id,
2037
+ target: k.target
2038
+ }), k.defaultValueChanged && $.push({
2098
2039
  kind: "resetToDefault",
2099
- inputId: $.id,
2100
- target: A.target,
2101
- ...A.defaultFilterValue ? { filterValue: A.defaultFilterValue } : {}
2102
- }), A.defaultComparisonChanged && q.push({
2040
+ inputId: U.id,
2041
+ target: k.target,
2042
+ ...k.defaultFilterValue ? { filterValue: k.defaultFilterValue } : {}
2043
+ }), k.defaultComparisonChanged && $.push({
2103
2044
  kind: "setDefaultComparison",
2104
- inputId: $.id,
2105
- target: A.target
2045
+ inputId: U.id,
2046
+ target: k.target
2106
2047
  });
2107
2048
  }
2108
- if (n.scope && w.input.runtimeScope !== "shared") {
2109
- const S = ua(
2110
- R,
2049
+ if (n.scope && T.input.runtimeScope !== "shared") {
2050
+ const S = ca(
2051
+ _,
2111
2052
  s,
2112
- w.input,
2113
- _.defaultInputValues
2053
+ T.input,
2054
+ R.defaultInputValues
2114
2055
  );
2115
- _ = {
2116
- ..._,
2056
+ R = {
2057
+ ...R,
2117
2058
  defaultInputValues: S.defaultInputValues
2118
- }, q.push(
2059
+ }, $.push(
2119
2060
  ...S.dropped.map((I) => ({
2120
2061
  kind: "dropTargetSlot",
2121
- inputId: $.id,
2062
+ inputId: U.id,
2122
2063
  target: I
2123
2064
  }))
2124
2065
  );
2125
2066
  }
2126
- return R = da(R, _), {
2067
+ return _ = la(_, R), {
2127
2068
  ok: !0,
2128
- dashboard: R,
2129
- inputId: w.input.id,
2130
- valueEffects: q
2069
+ dashboard: _,
2070
+ inputId: T.input.id,
2071
+ valueEffects: $
2131
2072
  };
2132
2073
  }
2133
- function is(e) {
2134
- let t = at({
2074
+ function Yo(e) {
2075
+ let t = rt({
2135
2076
  dashboard: e.before,
2136
2077
  runtimeValues: e.dashboardInputValues,
2137
2078
  calendar: e.calendar
2138
2079
  });
2139
- const n = U(e.after), i = (r) => {
2080
+ const n = j(e.after), r = (i) => {
2140
2081
  var a;
2141
- return (a = n.findFilterInput({ inputId: r })) == null ? void 0 : a.input;
2082
+ return (a = n.findFilterInput({ inputId: i })) == null ? void 0 : a.input;
2142
2083
  };
2143
- for (const r of e.effects)
2144
- switch (r.kind) {
2084
+ for (const i of e.effects)
2085
+ switch (i.kind) {
2145
2086
  case "resetToDefault":
2146
2087
  case "clear":
2147
2088
  case "setDefaultComparison": {
2148
- const a = i(r.inputId);
2089
+ const a = r(i.inputId);
2149
2090
  if (!a) break;
2150
- t = on({
2091
+ t = rn({
2151
2092
  state: { dashboardInputValues: t },
2152
2093
  input: a,
2153
2094
  settings: {
2154
- target: r.target,
2155
- defaultValueChanged: r.kind === "resetToDefault",
2156
- defaultFilterValue: r.kind === "resetToDefault" ? r.filterValue : void 0,
2157
- selectionIdentityChanged: r.kind === "clear",
2158
- defaultComparisonChanged: r.kind === "setDefaultComparison"
2095
+ target: i.target,
2096
+ defaultValueChanged: i.kind === "resetToDefault",
2097
+ defaultFilterValue: i.kind === "resetToDefault" ? i.filterValue : void 0,
2098
+ selectionIdentityChanged: i.kind === "clear",
2099
+ defaultComparisonChanged: i.kind === "setDefaultComparison"
2159
2100
  }
2160
2101
  }).dashboardInputValues;
2161
2102
  break;
2162
2103
  }
2163
2104
  case "dropTargetSlot": {
2164
- const a = i(r.inputId);
2105
+ const a = r(i.inputId);
2165
2106
  if (!a) break;
2166
- t = Re(
2107
+ t = Ae(
2167
2108
  t,
2168
2109
  a,
2169
- r.target
2110
+ i.target
2170
2111
  );
2171
2112
  break;
2172
2113
  }
2173
2114
  }
2174
- return at({
2115
+ return rt({
2175
2116
  dashboard: e.after,
2176
2117
  runtimeValues: t,
2177
2118
  calendar: e.calendar
2178
2119
  });
2179
2120
  }
2180
- function la(e) {
2121
+ function oa(e) {
2181
2122
  var t;
2182
2123
  return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
2183
2124
  }
2184
2125
  function Ie(e, t, n) {
2185
2126
  n !== void 0 && (n === null ? delete e[t] : e[t] = n);
2186
2127
  }
2187
- function ca(e, t) {
2128
+ function sa(e, t) {
2188
2129
  const n = [
2189
- ...U(e).inputs.map((r) => r.input),
2130
+ ...j(e).inputs.map((i) => i.input),
2190
2131
  ...(Array.isArray(e.inputs) ? e.inputs : []).filter(
2191
- (r) => r.kind === "control"
2132
+ (i) => i.kind === "control"
2192
2133
  )
2193
2134
  ].filter(
2194
- (r) => r.id !== t.id && r.variableName === t.variableName
2135
+ (i) => i.id !== t.id && i.variableName === t.variableName
2195
2136
  );
2196
2137
  if (!n.length) return;
2197
- const i = ct(e, t);
2138
+ const r = st(e, t);
2198
2139
  return n.some(
2199
- (r) => [...ct(e, r)].some(
2200
- (a) => i.has(a)
2140
+ (i) => [...st(e, i)].some(
2141
+ (a) => r.has(a)
2201
2142
  )
2202
2143
  ) ? t.variableName : void 0;
2203
2144
  }
2204
- function ua(e, t, n, i) {
2145
+ function ca(e, t, n, r) {
2205
2146
  var u, d;
2206
- const r = [], a = Et(e), o = (f) => bt(t, f, a), s = (f) => bt(n, f, a), l = [];
2147
+ const i = [], a = _t(e), o = (f) => ht(t, f, a), s = (f) => ht(n, f, a), l = [];
2207
2148
  if (n.runtimeScope === "perSheet")
2208
2149
  for (const f of a.values())
2209
2150
  l.push({ sheetId: f.sheetId, sheetKind: f.sheetKind });
@@ -2216,65 +2157,65 @@ function ua(e, t, n, i) {
2216
2157
  });
2217
2158
  else if (n.runtimeScope === "perDocumentSection")
2218
2159
  for (const f of e.sheets ?? [])
2219
- for (const p of ((d = f.document) == null ? void 0 : d.sections) ?? [])
2160
+ for (const m of ((d = f.document) == null ? void 0 : d.sections) ?? [])
2220
2161
  l.push({
2221
2162
  sheetId: f.id,
2222
- sectionId: p.id,
2163
+ sectionId: m.id,
2223
2164
  sheetKind: "document"
2224
2165
  });
2225
- let c = i;
2166
+ let c = r;
2226
2167
  for (const f of l) {
2227
2168
  if (s(f)) continue;
2228
- const p = !!(c && _e(c, n, f));
2229
- if (p && (c = Re(c, n, f)), p || o(f)) {
2169
+ const m = !!(c && _e(c, n, f));
2170
+ if (m && (c = Ae(c, n, f)), m || o(f)) {
2230
2171
  const { sheetKind: g, ...b } = f;
2231
- r.push(b);
2172
+ i.push(b);
2232
2173
  }
2233
2174
  }
2234
- return { defaultInputValues: c, dropped: r };
2175
+ return { defaultInputValues: c, dropped: i };
2235
2176
  }
2236
- function bt(e, t, n) {
2177
+ function ht(e, t, n) {
2237
2178
  if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
2238
- const i = n.get(t.sheetId);
2239
- return i ? Vt(e, i) : !1;
2179
+ const r = n.get(t.sheetId);
2180
+ return r ? Rt(e, r) : !1;
2240
2181
  }
2241
- return li(e, t);
2182
+ return mr(e, t);
2242
2183
  }
2243
- function da(e, t) {
2184
+ function la(e, t) {
2244
2185
  const n = { ...e };
2245
2186
  return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? n.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete n.defaultInputValues, n;
2246
2187
  }
2247
- function fa(e, t, n, i, r) {
2248
- const a = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || si(e, t);
2188
+ function ua(e, t, n, r, i) {
2189
+ const a = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || fr(e, t);
2249
2190
  return {
2250
2191
  ...n,
2251
- target: (n == null ? void 0 : n.target) ?? i,
2192
+ target: (n == null ? void 0 : n.target) ?? r,
2252
2193
  defaultValueChanged: a,
2253
- defaultFilterValue: a ? Q(t, r) : void 0
2194
+ defaultFilterValue: a ? X(t, i) : void 0
2254
2195
  };
2255
2196
  }
2256
- function on(e) {
2197
+ function rn(e) {
2257
2198
  const { settings: t } = e;
2258
2199
  if (!t) return e.state;
2259
2200
  const n = e.input;
2260
- let i = e.state.dashboardInputValues, r = e.state.defaultInputValues;
2261
- if (t.selectionIdentityChanged && (i = ot(
2262
- i,
2201
+ let r = e.state.dashboardInputValues, i = e.state.defaultInputValues;
2202
+ if (t.selectionIdentityChanged && (r = it(
2203
+ r,
2263
2204
  n,
2264
2205
  t.target,
2265
2206
  { status: "cleared" }
2266
2207
  )), t.defaultValueChanged) {
2267
2208
  const a = _e(
2268
- r,
2209
+ i,
2269
2210
  n,
2270
2211
  t.target
2271
2212
  );
2272
- let o = Re(
2273
- r || {},
2213
+ let o = Ae(
2214
+ i || {},
2274
2215
  n,
2275
2216
  t.target
2276
2217
  );
2277
- t.defaultFilterValue ? o = st(
2218
+ t.defaultFilterValue ? o = at(
2278
2219
  o,
2279
2220
  n,
2280
2221
  t.target,
@@ -2286,13 +2227,13 @@ function on(e) {
2286
2227
  },
2287
2228
  ...a != null && a.comparisonSelection ? { comparisonSelection: a.comparisonSelection } : {}
2288
2229
  }
2289
- ) : a != null && a.comparisonSelection && (o = st(
2230
+ ) : a != null && a.comparisonSelection && (o = at(
2290
2231
  o,
2291
2232
  n,
2292
2233
  t.target,
2293
2234
  { comparisonSelection: a.comparisonSelection }
2294
- )), r = Object.keys(o).length ? o : void 0, i = ot(
2295
- i,
2235
+ )), i = Object.keys(o).length ? o : void 0, r = it(
2236
+ r,
2296
2237
  n,
2297
2238
  t.target,
2298
2239
  t.defaultFilterValue ? {
@@ -2304,75 +2245,75 @@ function on(e) {
2304
2245
  } : { status: "cleared" }
2305
2246
  );
2306
2247
  }
2307
- return t.defaultComparisonChanged && (r = lt(
2308
- r || {},
2248
+ return t.defaultComparisonChanged && (i = ot(
2249
+ i || {},
2309
2250
  n,
2310
2251
  t.target,
2311
2252
  t.defaultComparisonSelection
2312
- ), Object.keys(r).length || (r = void 0), i = lt(
2313
- i,
2253
+ ), Object.keys(i).length || (i = void 0), r = ot(
2254
+ r,
2314
2255
  n,
2315
2256
  t.target,
2316
2257
  void 0
2317
2258
  )), {
2318
2259
  ...e.state,
2319
- dashboardInputValues: i,
2320
- defaultInputValues: r
2260
+ dashboardInputValues: r,
2261
+ defaultInputValues: i
2321
2262
  };
2322
2263
  }
2323
2264
  const Y = (e) => Array.isArray(e.inputs) ? e.inputs : [];
2324
2265
  function he(e, t) {
2325
- const n = Y(e).find((i) => i.id === t);
2266
+ const n = Y(e).find((r) => r.id === t);
2326
2267
  if (!n || n.kind !== "filter")
2327
- throw new T("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
2268
+ throw new w("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
2328
2269
  return n;
2329
2270
  }
2330
- function sn(e, t) {
2271
+ function an(e, t) {
2331
2272
  var n;
2332
- return (n = me(e).find((i) => i.cardId === t)) == null ? void 0 : n.card.title;
2273
+ return (n = me(e).find((r) => r.cardId === t)) == null ? void 0 : n.card.title;
2333
2274
  }
2334
- function ma(e, t, n) {
2335
- const i = U(e), r = i.findFilterInput({ inputId: t });
2336
- return r ? i.reachedCards({ inputId: t }).filter(
2275
+ function da(e, t, n) {
2276
+ const r = j(e), i = r.findFilterInput({ inputId: t });
2277
+ return i ? r.reachedCards({ inputId: t }).filter(
2337
2278
  (a) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
2338
- Bn(r.input, a.card, n).reach
2279
+ Vn(i.input, a.card, n).reach
2339
2280
  )
2340
2281
  ).length : 0;
2341
2282
  }
2342
- function pa(e, t) {
2343
- const n = U(e), i = n.findFilterInput({ inputId: t });
2344
- return i ? n.reachedCards({ inputId: t }).filter((r) => qn(i.input, r.card) === "relationship").length : 0;
2283
+ function fa(e, t) {
2284
+ const n = j(e), r = n.findFilterInput({ inputId: t });
2285
+ return r ? n.reachedCards({ inputId: t }).filter((i) => Kn(r.input, i.card) === "relationship").length : 0;
2345
2286
  }
2346
- function ln(e, t) {
2287
+ function on(e, t) {
2347
2288
  if (t.scope.kind === "allSheets") return "every sheet";
2348
2289
  if (t.scope.kind !== "sheets") return "its cards";
2349
- const n = [...Et(e).values()].filter((i) => Vt(t, i));
2350
- return Kt(n.map((i) => {
2351
- var r, a;
2352
- return ((a = (r = e.sheets) == null ? void 0 : r.find((o) => o.id === i.sheetId)) == null ? void 0 : a.title) ?? i.sheetId;
2290
+ const n = [..._t(e).values()].filter((r) => Rt(t, r));
2291
+ return Et(n.map((r) => {
2292
+ var i, a;
2293
+ return ((a = (i = e.sheets) == null ? void 0 : i.find((o) => o.id === r.sheetId)) == null ? void 0 : a.title) ?? r.sheetId;
2353
2294
  }));
2354
2295
  }
2355
- const cn = (e) => {
2296
+ const sn = (e) => {
2356
2297
  var t;
2357
2298
  return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
2358
2299
  };
2359
- function un(e) {
2360
- var t, n, i;
2300
+ function cn(e) {
2301
+ var t, n, r;
2361
2302
  if ((n = (t = e.filter) == null ? void 0 : t.defaultValues) != null && n.length) return `default ${e.filter.defaultValues.join(", ")}`;
2362
- if ((i = e.filter) != null && i.defaultDateFilter) return "a default period";
2303
+ if ((r = e.filter) != null && r.defaultDateFilter) return "a default period";
2363
2304
  }
2364
- function ie(e) {
2365
- return Ne.plain("filter", e);
2366
- }
2367
- function ga(e, t) {
2368
- const { input: n } = t, i = Y(e);
2369
- if (i.some((l) => l.id === n.id))
2370
- throw new T("filter_id_taken", `A filter with id ${n.id} is already on this dashboard.`);
2371
- if (U(e).findFilterInput({ filterId: n.filter.id }))
2372
- throw new T("filter_id_taken", `A filter definition with id ${n.filter.id} is already on this dashboard.`);
2373
- const r = { ...e, inputs: [...i, n] }, a = ma(r, n.id), o = pa(r, n.id), s = [cn(n), un(n)].filter(Boolean).join(", ");
2305
+ function re(e) {
2306
+ return H.plain("filter", e);
2307
+ }
2308
+ function ma(e, t) {
2309
+ const { input: n } = t, r = Y(e);
2310
+ if (r.some((l) => l.id === n.id))
2311
+ throw new w("filter_id_taken", `A filter with id ${n.id} is already on this dashboard.`);
2312
+ if (j(e).findFilterInput({ filterId: n.filter.id }))
2313
+ throw new w("filter_id_taken", `A filter definition with id ${n.filter.id} is already on this dashboard.`);
2314
+ const i = { ...e, inputs: [...r, n] }, a = da(i, n.id), o = fa(i, n.id), s = [sn(n), cn(n)].filter(Boolean).join(", ");
2374
2315
  return {
2375
- dashboard: r,
2316
+ dashboard: i,
2376
2317
  created: [
2377
2318
  {
2378
2319
  kind: "filter",
@@ -2382,89 +2323,89 @@ function ga(e, t) {
2382
2323
  }
2383
2324
  ],
2384
2325
  clauses: [
2385
- ie(
2386
- `adds the filter ${j(n.label)} (${s}) to ${ln(r, n)}; it filters ${a} card${a === 1 ? "" : "s"}${o ? ` and may filter ${o} more through the domain's relationships` : ""}`
2326
+ re(
2327
+ `adds the filter ${L(n.label)} (${s}) to ${on(i, n)}; it filters ${a} card${a === 1 ? "" : "s"}${o ? ` and may filter ${o} more through the domain's relationships` : ""}`
2387
2328
  )
2388
2329
  ]
2389
2330
  };
2390
2331
  }
2391
- function ya(e, t, n) {
2392
- const i = sa(e, { inputId: t.filterId }, t.settings, {
2332
+ function pa(e, t, n) {
2333
+ const r = aa(e, { inputId: t.filterId }, t.settings, {
2393
2334
  calendar: n.calendar
2394
2335
  });
2395
- if (!i.ok) {
2396
- const [o] = i.issues;
2397
- throw new T(
2336
+ if (!r.ok) {
2337
+ const [o] = r.issues;
2338
+ throw new w(
2398
2339
  (o == null ? void 0 : o.code) === "inputNotFound" ? "filter_not_found" : "filter_invalid",
2399
2340
  (o == null ? void 0 : o.message) ?? "These filter settings could not be saved.",
2400
2341
  (o == null ? void 0 : o.code) === "inputNotFound" ? "Read the outline again and use its filter ids." : "Change the filter settings and propose again.",
2401
- { issues: i.issues }
2342
+ { issues: r.issues }
2402
2343
  );
2403
2344
  }
2404
- const r = Y(e).find((o) => o.id === i.inputId), a = Y(i.dashboard).find((o) => o.id === i.inputId);
2345
+ const i = Y(e).find((o) => o.id === r.inputId), a = Y(r.dashboard).find((o) => o.id === r.inputId);
2405
2346
  return {
2406
- dashboard: i.dashboard,
2407
- runtimeEffects: [{ kind: "filter_value", effects: i.valueEffects }],
2408
- clauses: [ie(`changes the filter ${j((r == null ? void 0 : r.label) ?? a.label)}: ${ha(i.dashboard, r, a)}`)]
2347
+ dashboard: r.dashboard,
2348
+ runtimeEffects: [{ kind: "filter_value", effects: r.valueEffects }],
2349
+ clauses: [re(`changes the filter ${L((i == null ? void 0 : i.label) ?? a.label)}: ${ga(r.dashboard, i, a)}`)]
2409
2350
  };
2410
2351
  }
2411
- function ha(e, t, n) {
2352
+ function ga(e, t, n) {
2412
2353
  var o, s, l, c, u, d;
2413
2354
  if (!t) return "updates its settings";
2414
- const i = [];
2415
- t.label !== n.label && i.push(`renames it ${j(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = n.filter) == null ? void 0 : s.type) ?? "multiple") && i.push(`makes it ${cn(n)}`);
2416
- const r = JSON.stringify([((l = t.filter) == null ? void 0 : l.defaultValues) ?? null, ((c = t.filter) == null ? void 0 : c.defaultDateFilter) ?? null]), a = JSON.stringify([((u = n.filter) == null ? void 0 : u.defaultValues) ?? null, ((d = n.filter) == null ? void 0 : d.defaultDateFilter) ?? null]);
2417
- if (r !== a) {
2418
- const f = un(n);
2419
- i.push(f ? `sets its ${f.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2355
+ const r = [];
2356
+ t.label !== n.label && r.push(`renames it ${L(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = n.filter) == null ? void 0 : s.type) ?? "multiple") && r.push(`makes it ${sn(n)}`);
2357
+ const i = JSON.stringify([((l = t.filter) == null ? void 0 : l.defaultValues) ?? null, ((c = t.filter) == null ? void 0 : c.defaultDateFilter) ?? null]), a = JSON.stringify([((u = n.filter) == null ? void 0 : u.defaultValues) ?? null, ((d = n.filter) == null ? void 0 : d.defaultDateFilter) ?? null]);
2358
+ if (i !== a) {
2359
+ const f = cn(n);
2360
+ r.push(f ? `sets its ${f.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2420
2361
  }
2421
- return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && i.push(`applies it to ${ln(e, n)}`), i.length ? Kt(i) : "keeps its settings";
2362
+ return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${on(e, n)}`), r.length ? Et(r) : "keeps its settings";
2422
2363
  }
2423
- function ba(e, t) {
2364
+ function ya(e, t) {
2424
2365
  const n = he(e, t);
2425
2366
  return {
2426
2367
  dashboard: {
2427
2368
  ...e,
2428
- inputs: Y(e).filter((r) => r.id !== t),
2429
- defaultInputValues: ui(e.defaultInputValues, t)
2369
+ inputs: Y(e).filter((i) => i.id !== t),
2370
+ defaultInputValues: gr(e.defaultInputValues, t)
2430
2371
  },
2431
2372
  runtimeEffects: [{ kind: "input_removed", inputId: t }],
2432
- clauses: [ie(`removes the filter ${j(n.label)}`)]
2373
+ clauses: [re(`removes the filter ${L(n.label)}`)]
2433
2374
  };
2434
2375
  }
2435
- function va(e, t, n) {
2376
+ function ha(e, t, n) {
2436
2377
  var o;
2437
2378
  if (!me(e).some((s) => s.cardId === n))
2438
- throw new T("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
2439
- const i = di(t.scope, n);
2440
- if (!i)
2441
- throw new T(
2379
+ throw new w("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
2380
+ const r = yr(t.scope, n);
2381
+ if (!r)
2382
+ throw new w(
2442
2383
  "filter_invalid",
2443
2384
  "This filter applies to Document sections, so it can't leave out one card.",
2444
2385
  "Change it in the editor."
2445
2386
  );
2446
- const r = { ...t, scope: i }, a = Ee({ inputs: [r], dashboardFilters: [] });
2387
+ const i = { ...t, scope: r }, a = Re({ inputs: [i], dashboardFilters: [] });
2447
2388
  if (!a.ok)
2448
- throw new T("filter_invalid", ((o = a.issues[0]) == null ? void 0 : o.message) ?? "This filter could not be saved.", "Change it in the editor.");
2389
+ throw new w("filter_invalid", ((o = a.issues[0]) == null ? void 0 : o.message) ?? "This filter could not be saved.", "Change it in the editor.");
2449
2390
  return {
2450
2391
  ...e,
2451
- inputs: Y(e).map((s) => s.id === t.id ? r : s)
2392
+ inputs: Y(e).map((s) => s.id === t.id ? i : s)
2452
2393
  };
2453
2394
  }
2454
- function dn(e, t, n, i, r) {
2395
+ function ln(e, t, n, r, i) {
2455
2396
  var u, d;
2456
2397
  const a = he(e, t);
2457
2398
  if (!me(e).some((f) => f.cardId === n))
2458
- throw new T("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
2399
+ throw new w("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
2459
2400
  const o = [...((u = a.application) == null ? void 0 : u.cards) ?? []], s = o.findIndex((f) => f.cardId === n);
2460
- s >= 0 ? o[s] = i : o.push(i);
2401
+ s >= 0 ? o[s] = r : o.push(r);
2461
2402
  const l = {
2462
2403
  ...a,
2463
- ...r ? { scope: r } : {},
2404
+ ...i ? { scope: i } : {},
2464
2405
  application: { ...a.application ?? { kind: "cardMappings" }, cards: o }
2465
- }, c = Ee({ inputs: [l], dashboardFilters: [] });
2406
+ }, c = Re({ inputs: [l], dashboardFilters: [] });
2466
2407
  if (!c.ok)
2467
- throw new T(
2408
+ throw new w(
2468
2409
  "filter_invalid",
2469
2410
  ((d = c.issues[0]) == null ? void 0 : d.message) ?? "This filter mapping could not be saved.",
2470
2411
  "Change the mapping and propose again."
@@ -2474,7 +2415,7 @@ function dn(e, t, n, i, r) {
2474
2415
  inputs: Y(e).map((f) => f.id === t ? l : f)
2475
2416
  };
2476
2417
  }
2477
- function Fa(e) {
2418
+ function ba(e) {
2478
2419
  switch (e.kind) {
2479
2420
  case "field":
2480
2421
  return `by ${e.field.name}`;
@@ -2484,80 +2425,83 @@ function Fa(e) {
2484
2425
  return String(e.kind);
2485
2426
  }
2486
2427
  }
2487
- function Ca(e, t) {
2488
- const n = he(e, t.filterId), i = { ...t.binding, kind: "bound", cardId: t.cardId }, r = ci(n.scope, t.cardId), a = r !== n.scope;
2428
+ function va(e, t) {
2429
+ const n = he(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = pr(n.scope, t.cardId), a = i !== n.scope;
2489
2430
  return {
2490
- dashboard: dn(e, t.filterId, t.cardId, i, a ? r : void 0),
2431
+ dashboard: ln(e, t.filterId, t.cardId, r, a ? i : void 0),
2491
2432
  clauses: [
2492
- ie(
2493
- `makes ${j(n.label)} filter ${j(sn(e, t.cardId))} ${Fa(i.target)}${a ? ", which it used to leave out" : ""}`
2433
+ re(
2434
+ `makes ${L(n.label)} filter ${L(an(e, t.cardId))} ${ba(r.target)}${a ? ", which it used to leave out" : ""}`
2494
2435
  )
2495
2436
  ]
2496
2437
  };
2497
2438
  }
2498
- function Ia(e, t) {
2499
- var r;
2439
+ function Fa(e, t) {
2440
+ var i;
2500
2441
  const n = he(e, t.filterId);
2501
2442
  return {
2502
- dashboard: ((r = n.filter) == null ? void 0 : r.kind) === "global-date" ? va(e, n, t.cardId) : dn(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2503
- clauses: [ie(`stops ${j(n.label)} from filtering ${j(sn(e, t.cardId))}`)]
2443
+ dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? ha(e, n, t.cardId) : ln(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2444
+ clauses: [re(`stops ${L(n.label)} from filtering ${L(an(e, t.cardId))}`)]
2504
2445
  };
2505
2446
  }
2506
- function rs(e, t, n) {
2507
- let i = e;
2508
- const r = [], a = [], o = [];
2509
- for (const [s, l] of t.entries()) {
2510
- let c;
2447
+ function Jo(e, t, n) {
2448
+ let r = e;
2449
+ const i = [], a = [], o = [];
2450
+ let s = !1;
2451
+ for (const [l, c] of t.entries()) {
2452
+ let u;
2511
2453
  try {
2512
- c = xa(i, l, n);
2513
- } catch (u) {
2514
- if (!(u instanceof T)) throw u;
2454
+ u = Ca(r, c, n);
2455
+ } catch (d) {
2456
+ if (!(d instanceof w)) throw d;
2515
2457
  return {
2516
2458
  ok: !1,
2517
2459
  failedAt: {
2518
- index: s,
2519
- op: l.op,
2520
- code: u.code,
2521
- message: u.message,
2522
- ...u.fix ? { fix: u.fix } : {},
2523
- ...u.details ? { details: u.details } : {}
2460
+ index: l,
2461
+ op: c.op,
2462
+ code: d.code,
2463
+ message: d.message,
2464
+ ...d.fix ? { fix: d.fix } : {},
2465
+ ...d.details ? { details: d.details } : {}
2524
2466
  }
2525
2467
  };
2526
2468
  }
2527
- i = c.dashboard, r.push(...c.created ?? []), a.push(...c.runtimeEffects ?? []), o.push({ index: s, changeIndex: l.changeIndex, clauses: c.clauses });
2469
+ r = u.dashboard, i.push(...u.created ?? []), a.push(...u.runtimeEffects ?? []), o.push({ index: l, changeIndex: c.changeIndex, clauses: u.clauses }), s || (s = u.detached === !0);
2528
2470
  }
2529
- return { ok: !0, dashboard: i, created: r, descriptions: Sa(o), runtimeEffects: a };
2471
+ return { ok: !0, dashboard: r, created: i, descriptions: Ia(o), runtimeEffects: a, detaches: s };
2530
2472
  }
2531
- function xa(e, t, n) {
2473
+ function Ca(e, t, n) {
2532
2474
  switch (t.op) {
2533
2475
  case "card.add":
2534
- return pi(e, t);
2476
+ return vr(e, t);
2535
2477
  case "card.remove":
2536
- return mi(e, t.cardId);
2478
+ return br(e, t.cardId);
2537
2479
  case "card.update":
2538
- return fi(e, t.cardId, t.update);
2480
+ return hr(e, t.cardId, t.update);
2539
2481
  case "layout.arrange":
2540
- return Xr(e, t);
2482
+ return Yi(e, t);
2541
2483
  case "frame.commit":
2542
- return ra(e, t.commit);
2484
+ return ta(e, t.commit);
2543
2485
  case "filter.add":
2544
- return ga(e, t);
2486
+ return ma(e, t);
2545
2487
  case "filter.update":
2546
- return ya(e, t, n);
2488
+ return pa(e, t, n);
2547
2489
  case "filter.remove":
2548
- return ba(e, t.filterId);
2490
+ return ya(e, t.filterId);
2549
2491
  case "filter.bind":
2550
- return Ca(e, t);
2492
+ return va(e, t);
2551
2493
  case "filter.exclude":
2552
- return Ia(e, t);
2494
+ return Fa(e, t);
2495
+ case "dashboard.update":
2496
+ return na(e, t);
2553
2497
  }
2554
2498
  }
2555
- function Sa(e) {
2499
+ function Ia(e) {
2556
2500
  const t = [];
2557
2501
  for (const n of e) {
2558
- const i = n.changeIndex === void 0 ? void 0 : t.find((r) => r.changeIndex === n.changeIndex);
2559
- if (i) {
2560
- i.operations.push(n.index), i.clauses.push(...n.clauses);
2502
+ const r = n.changeIndex === void 0 ? void 0 : t.find((i) => i.changeIndex === n.changeIndex);
2503
+ if (r) {
2504
+ r.operations.push(n.index), r.clauses.push(...n.clauses);
2561
2505
  continue;
2562
2506
  }
2563
2507
  t.push({
@@ -2567,23 +2511,23 @@ function Sa(e) {
2567
2511
  clauses: [...n.clauses]
2568
2512
  });
2569
2513
  }
2570
- return t.map(({ clauses: n, ...i }) => ({
2571
- ...i,
2572
- sentence: gi(Da(n))
2514
+ return t.map(({ clauses: n, ...r }) => ({
2515
+ ...r,
2516
+ sentence: Fr(xa(n))
2573
2517
  }));
2574
2518
  }
2575
- function Da(e) {
2519
+ function xa(e) {
2576
2520
  let t = !1;
2577
2521
  return e.filter((n) => n.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
2578
2522
  }
2579
- function vt(e) {
2523
+ function bt(e) {
2580
2524
  return Object.fromEntries(
2581
2525
  Object.entries(e).filter(
2582
2526
  (t) => typeof t[1] == "string" && t[1].length > 0
2583
2527
  )
2584
2528
  );
2585
2529
  }
2586
- function ee(e) {
2530
+ function te(e) {
2587
2531
  return e.kind === "semantic" ? [
2588
2532
  e.kind,
2589
2533
  e.domainId,
@@ -2598,18 +2542,18 @@ function ee(e) {
2598
2542
  e.tableName
2599
2543
  ].join(":");
2600
2544
  }
2601
- function wa(e, t) {
2545
+ function Sa(e, t) {
2602
2546
  if (e.kind === "semantic")
2603
2547
  return {
2604
2548
  status: "ready",
2605
- request: vt({
2549
+ request: bt({
2606
2550
  connection_id: e.connectionId,
2607
2551
  domain_id: e.domainId,
2608
- dataset_id: Oi(e),
2552
+ dataset_id: Rr(e),
2609
2553
  dataset_name: e.datasetName
2610
2554
  })
2611
2555
  };
2612
- const n = Ji({
2556
+ const n = ti({
2613
2557
  source: e,
2614
2558
  capabilities: t
2615
2559
  });
@@ -2621,7 +2565,7 @@ function wa(e, t) {
2621
2565
  message: `Source is missing required field-metadata coordinates: ${n.missing.join(", ")}.`
2622
2566
  } : {
2623
2567
  status: "ready",
2624
- request: vt({
2568
+ request: bt({
2625
2569
  connection_id: e.connectionId,
2626
2570
  datamodel_id: "",
2627
2571
  database_name: n.coordinates.databaseName,
@@ -2630,14 +2574,14 @@ function wa(e, t) {
2630
2574
  })
2631
2575
  };
2632
2576
  }
2633
- function as(e, t = /* @__PURE__ */ new Map()) {
2577
+ function Xo(e, t = /* @__PURE__ */ new Map()) {
2634
2578
  const n = /* @__PURE__ */ new Map();
2635
- for (const { card: i } of e) {
2636
- const r = Lt(i), a = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((o) => o.source) : [];
2579
+ for (const { card: r } of e) {
2580
+ const i = Vt(r), a = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((o) => o.source) : [];
2637
2581
  for (const o of a) {
2638
- const s = ee(o);
2582
+ const s = te(o);
2639
2583
  if (!n.has(s)) {
2640
- const l = wa(
2584
+ const l = Sa(
2641
2585
  o,
2642
2586
  o.connectionId ? t.get(o.connectionId) : void 0
2643
2587
  );
@@ -2651,14 +2595,14 @@ function as(e, t = /* @__PURE__ */ new Map()) {
2651
2595
  }
2652
2596
  return Array.from(n.values());
2653
2597
  }
2654
- function Ta(e, t) {
2598
+ function Da(e, t) {
2655
2599
  if (e.kind !== "semantic" || !e.connectionId) return;
2656
- const n = (t.qualifiedEntityName || "").split(".").map((r) => r.trim()).filter(Boolean), i = n.at(-1);
2657
- if (i)
2600
+ const n = (t.qualifiedEntityName || "").split(".").map((i) => i.trim()).filter(Boolean), r = n.at(-1);
2601
+ if (r)
2658
2602
  return {
2659
2603
  kind: "physical",
2660
2604
  connectionId: e.connectionId,
2661
- tableName: i,
2605
+ tableName: r,
2662
2606
  ...n.length > 1 ? { schemaName: n.at(-2) } : {},
2663
2607
  ...n.length > 2 ? { databaseName: n.at(-3) } : {}
2664
2608
  };
@@ -2667,44 +2611,44 @@ function oe(e, t) {
2667
2611
  let n = e.get(t);
2668
2612
  return n || (n = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, n)), n;
2669
2613
  }
2670
- function fn(e, t) {
2614
+ function un(e, t) {
2671
2615
  e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
2672
2616
  }
2673
- function Me(e, t, n) {
2674
- for (const i of t) {
2675
- const r = i == null ? void 0 : i.trim();
2676
- if (!r) continue;
2677
- const a = $t(r), o = e.fields.get(a);
2617
+ function Oe(e, t, n) {
2618
+ for (const r of t) {
2619
+ const i = r == null ? void 0 : r.trim();
2620
+ if (!i) continue;
2621
+ const a = Bt(i), o = e.fields.get(a);
2678
2622
  o === void 0 ? e.fields.set(a, n) : o !== n && e.fieldConflicts.add(a);
2679
2623
  }
2680
2624
  }
2681
- function mn(e, t) {
2682
- t.sourceLabel && fn(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
2683
- for (const [n, i] of t.fields)
2684
- Me(e, [n], i);
2625
+ function dn(e, t) {
2626
+ t.sourceLabel && un(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
2627
+ for (const [n, r] of t.fields)
2628
+ Oe(e, [n], r);
2685
2629
  for (const n of t.fieldConflicts ?? [])
2686
2630
  e.fieldConflicts.add(n);
2687
2631
  }
2688
- function pn(e) {
2632
+ function fn(e) {
2689
2633
  return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
2690
2634
  }
2691
- function os(e, t) {
2692
- var i, r;
2635
+ function Zo(e, t) {
2636
+ var r, i;
2693
2637
  const n = /* @__PURE__ */ new Map();
2694
2638
  for (const [a, o] of e) {
2695
2639
  if (o.status !== "ready") continue;
2696
- const s = t == null ? void 0 : t.get(a), l = s ? pn(s) : void 0;
2640
+ const s = t == null ? void 0 : t.get(a), l = s ? fn(s) : void 0;
2697
2641
  for (const c of o.columns) {
2698
- const u = (i = c.column_name) == null ? void 0 : i.trim(), d = (r = c.label) == null ? void 0 : r.trim(), f = s ? Ta(s, c) : void 0;
2699
- f && l && fn(
2700
- oe(n, ee(f)),
2642
+ const u = (r = c.column_name) == null ? void 0 : r.trim(), d = (i = c.label) == null ? void 0 : i.trim(), f = s ? Da(s, c) : void 0;
2643
+ f && l && un(
2644
+ oe(n, te(f)),
2701
2645
  l
2702
- ), !(!u || !d || d === u) && (Me(
2646
+ ), !(!u || !d || d === u) && (Oe(
2703
2647
  oe(n, a),
2704
2648
  [u, c.sourceField],
2705
2649
  d
2706
- ), f && Me(
2707
- oe(n, ee(f)),
2650
+ ), f && Oe(
2651
+ oe(n, te(f)),
2708
2652
  [c.sourceField, u],
2709
2653
  d
2710
2654
  ));
@@ -2712,84 +2656,84 @@ function os(e, t) {
2712
2656
  }
2713
2657
  return n;
2714
2658
  }
2715
- function ss(...e) {
2659
+ function es(...e) {
2716
2660
  const t = /* @__PURE__ */ new Map();
2717
2661
  for (const n of e)
2718
- for (const [i, r] of n ?? [])
2719
- mn(oe(t, i), r);
2662
+ for (const [r, i] of n ?? [])
2663
+ dn(oe(t, r), i);
2720
2664
  return t;
2721
2665
  }
2722
2666
  function Ue(e) {
2723
2667
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
2724
2668
  }
2725
- function Oa(e) {
2669
+ function Ta(e) {
2726
2670
  return e.split(":").slice(2).filter(Boolean).join(".");
2727
2671
  }
2728
- function gn(e, t) {
2729
- const n = ee(t), i = e.get(n);
2730
- if (t.kind !== "physical") return i;
2731
- const r = `physical:${t.connectionId}:`, a = Ue(t), o = {
2672
+ function mn(e, t) {
2673
+ const n = te(t), r = e.get(n);
2674
+ if (t.kind !== "physical") return r;
2675
+ const i = `physical:${t.connectionId}:`, a = Ue(t), o = {
2732
2676
  fields: /* @__PURE__ */ new Map(),
2733
2677
  fieldConflicts: /* @__PURE__ */ new Set()
2734
2678
  };
2735
2679
  let s = !1;
2736
2680
  for (const [l, c] of e)
2737
- l.startsWith(r) && (l !== n && !Qi(a, Oa(l)) || (mn(o, c), s = !0));
2681
+ l.startsWith(i) && (l !== n && !ni(a, Ta(l)) || (dn(o, c), s = !0));
2738
2682
  return s ? o : void 0;
2739
2683
  }
2740
- function Ma(e, t) {
2741
- var r;
2684
+ function wa(e, t) {
2685
+ var i;
2742
2686
  if (!e) return;
2743
- const n = $t(t.name), i = gn(e, t.source);
2744
- return i && !((r = i.fieldConflicts) != null && r.has(n)) ? i.fields.get(n) : void 0;
2687
+ const n = Bt(t.name), r = mn(e, t.source);
2688
+ return r && !((i = r.fieldConflicts) != null && i.has(n)) ? r.fields.get(n) : void 0;
2745
2689
  }
2746
- function Pa(e, t) {
2690
+ function Ma(e, t) {
2747
2691
  if (t.kind === "semantic")
2748
- return pn(t) || t.datasetId || "Dataset";
2749
- const n = e ? gn(e, t) : void 0;
2692
+ return fn(t) || t.datasetId || "Dataset";
2693
+ const n = e ? mn(e, t) : void 0;
2750
2694
  return n != null && n.sourceLabel && !n.sourceLabelConflict ? n.sourceLabel : Ue(t);
2751
2695
  }
2752
- function ls(e, t) {
2753
- const n = Ma(e, t);
2696
+ function ts(e, t) {
2697
+ const n = wa(e, t);
2754
2698
  return {
2755
2699
  name: t.name,
2756
2700
  ...n ? { label: n } : {},
2757
- entityName: Pa(e, t.source),
2701
+ entityName: Ma(e, t.source),
2758
2702
  ...t.source.kind === "physical" ? { qualifiedEntityName: Ue(t.source) } : {},
2759
2703
  dataType: t.dataType
2760
2704
  };
2761
2705
  }
2762
- function ka(e, t) {
2763
- var r, a;
2764
- const n = (r = t.column_name) == null ? void 0 : r.trim(), i = qt(t.data_type);
2765
- if (!(!n || i === "unknown"))
2706
+ function Oa(e, t) {
2707
+ var i, a;
2708
+ const n = (i = t.column_name) == null ? void 0 : i.trim(), r = Lt(t.data_type);
2709
+ if (!(!n || r === "unknown"))
2766
2710
  return {
2767
2711
  kind: "field",
2768
2712
  field: {
2769
2713
  name: n,
2770
2714
  source: { ...e },
2771
- dataType: i,
2715
+ dataType: r,
2772
2716
  ...(a = t.sourceField) != null && a.trim() ? { sourceField: t.sourceField.trim() } : {}
2773
2717
  }
2774
2718
  };
2775
2719
  }
2776
- function cs(e) {
2720
+ function ns(e) {
2777
2721
  const t = {};
2778
2722
  for (const { card: n } of e.cards) {
2779
- const i = Lt(n), r = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((s) => s.source) : [];
2780
- if (!r.length) continue;
2723
+ const r = Vt(n), i = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((s) => s.source) : [];
2724
+ if (!i.length) continue;
2781
2725
  const a = [];
2782
2726
  let o;
2783
- for (const s of r) {
2727
+ for (const s of i) {
2784
2728
  const l = e.metadataBySourceKey.get(
2785
- ee(s)
2729
+ te(s)
2786
2730
  );
2787
2731
  if (!l || l.status === "unavailable") {
2788
2732
  o = (l == null ? void 0 : l.status) === "unavailable" ? l.message : "Field metadata is not available yet.";
2789
2733
  break;
2790
2734
  }
2791
2735
  for (const c of l.columns) {
2792
- const u = ka(s, c);
2736
+ const u = Oa(s, c);
2793
2737
  u && a.push(u);
2794
2738
  }
2795
2739
  }
@@ -2797,111 +2741,111 @@ function cs(e) {
2797
2741
  }
2798
2742
  return t;
2799
2743
  }
2800
- function us(e) {
2801
- const { dashboard: t, target: n, calendar: i } = e, r = hn(n), a = yn(t, n, i);
2744
+ function rs(e) {
2745
+ const { dashboard: t, target: n, calendar: r } = e, i = gn(n), a = pn(t, n, r);
2802
2746
  return {
2803
2747
  value: a,
2804
- mode: $n(
2805
- zn(a == null ? void 0 : a.operation) ? a.operation : r.operation
2748
+ mode: Ln(
2749
+ Bn(a == null ? void 0 : a.operation) ? a.operation : i.operation
2806
2750
  )
2807
2751
  };
2808
2752
  }
2809
- function yn(e, t, n) {
2810
- var i;
2753
+ function pn(e, t, n) {
2754
+ var r;
2811
2755
  switch (t.kind) {
2812
2756
  case "dashboardInput": {
2813
- const r = hi({
2757
+ const i = Ir({
2814
2758
  dashboard: e,
2815
2759
  input: t.input,
2816
2760
  target: t.scope,
2817
2761
  calendar: n
2818
2762
  });
2819
- return (r == null ? void 0 : r.status) === "set" && r.value.kind === "filter" ? r.value.filterValue : void 0;
2763
+ return (i == null ? void 0 : i.status) === "set" && i.value.kind === "filter" ? i.value.filterValue : void 0;
2820
2764
  }
2821
2765
  case "dashboardFilter": {
2822
- const r = (i = e.defaultFilterValues) == null ? void 0 : i.find(
2766
+ const i = (r = e.defaultFilterValues) == null ? void 0 : r.find(
2823
2767
  (a) => a.filterId === t.filter.id
2824
2768
  );
2825
- return r ? yi({
2769
+ return i ? Cr({
2826
2770
  filterDefinitions: [t.filter],
2827
- filterValues: [r]
2828
- })[0] : Q(t.filter, n);
2771
+ filterValues: [i]
2772
+ })[0] : X(t.filter, n);
2829
2773
  }
2830
2774
  case "definition":
2831
- return Q(t.filter, n);
2775
+ return X(t.filter, n);
2832
2776
  }
2833
2777
  }
2834
- function hn(e) {
2778
+ function gn(e) {
2835
2779
  return e.kind === "dashboardInput" ? e.input.filter : e.filter;
2836
2780
  }
2837
- function ds(e) {
2781
+ function is(e) {
2838
2782
  var a;
2839
- const { dashboard: t, filter: n, input: i, scope: r } = e;
2840
- return i && (t.inputs || []).some((o) => o.id === i.id) ? { kind: "dashboardInput", input: i, scope: r } : ((a = U(t).findFilterInput({ filterId: n.id })) == null ? void 0 : a.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
2783
+ const { dashboard: t, filter: n, input: r, scope: i } = e;
2784
+ return r && (t.inputs || []).some((o) => o.id === r.id) ? { kind: "dashboardInput", input: r, scope: i } : ((a = j(t).findFilterInput({ filterId: n.id })) == null ? void 0 : a.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
2841
2785
  }
2842
- function fs(e) {
2843
- const { dashboard: t, target: n, calendar: i } = e, r = hn(n), a = bi(r), o = Aa(t, n);
2786
+ function as(e) {
2787
+ const { dashboard: t, target: n, calendar: r } = e, i = gn(n), a = xr(i), o = Pa(t, n);
2844
2788
  if (!o) return a;
2845
2789
  if (o === "cleared")
2846
2790
  return {
2847
- operation: r.operation,
2791
+ operation: i.operation,
2848
2792
  defaultValues: void 0,
2849
2793
  defaultDateFilter: void 0
2850
2794
  };
2851
- const s = yn(t, n, i);
2852
- if (!s || Na(s, Q(r, i)))
2795
+ const s = pn(t, n, r);
2796
+ if (!s || Na(s, X(i, r)))
2853
2797
  return a;
2854
2798
  if (s.valueType === "date") {
2855
- const l = Mi(
2799
+ const l = Er(
2856
2800
  "relativeMeta" in s ? s.relativeMeta : void 0
2857
- ) ?? Ra(r, s, i);
2801
+ ) ?? ka(i, s, r);
2858
2802
  return l ? {
2859
2803
  operation: s.operation,
2860
- defaultValues: r.defaultValues,
2804
+ defaultValues: i.defaultValues,
2861
2805
  defaultDateFilter: l
2862
2806
  } : a;
2863
2807
  }
2864
2808
  return {
2865
2809
  operation: s.operation,
2866
2810
  defaultValues: s.values,
2867
- defaultDateFilter: r.defaultDateFilter
2811
+ defaultDateFilter: i.defaultDateFilter
2868
2812
  };
2869
2813
  }
2870
- function Aa(e, t) {
2814
+ function Pa(e, t) {
2871
2815
  var n;
2872
2816
  if (t.kind === "dashboardInput") {
2873
- const i = _e(
2817
+ const r = _e(
2874
2818
  e.defaultInputValues,
2875
2819
  t.input,
2876
2820
  t.scope
2877
2821
  );
2878
- return (i == null ? void 0 : i.status) === "set" || (i == null ? void 0 : i.status) === "cleared" ? i.status : void 0;
2822
+ return (r == null ? void 0 : r.status) === "set" || (r == null ? void 0 : r.status) === "cleared" ? r.status : void 0;
2879
2823
  }
2880
2824
  if (t.kind === "dashboardFilter")
2881
2825
  return (n = e.defaultFilterValues) != null && n.some(
2882
- (i) => i.filterId === t.filter.id
2826
+ (r) => r.filterId === t.filter.id
2883
2827
  ) ? "set" : void 0;
2884
2828
  }
2885
2829
  function Na(e, t) {
2886
- return !!(t && e.operation === t.operation && Se(Ft(e), Ft(t)) && Se(
2830
+ return !!(t && e.operation === t.operation && Se(vt(e), vt(t)) && Se(
2887
2831
  "relativeMeta" in e ? e.relativeMeta : void 0,
2888
2832
  "relativeMeta" in t ? t.relativeMeta : void 0
2889
2833
  ));
2890
2834
  }
2891
- function Ft(e) {
2835
+ function vt(e) {
2892
2836
  return e.values.map(
2893
2837
  (t) => t instanceof Date ? t.getTime() : t
2894
2838
  );
2895
2839
  }
2896
- function Ra(e, t, n) {
2897
- const i = vi(n == null ? void 0 : n.tz), r = Fe(t.values[0], i);
2898
- if (!r) return;
2840
+ function ka(e, t, n) {
2841
+ const r = Sr(n == null ? void 0 : n.tz), i = Fe(t.values[0], r);
2842
+ if (!i) return;
2899
2843
  const [a, o, s] = new Intl.DateTimeFormat("en-CA", {
2900
- timeZone: i,
2844
+ timeZone: r,
2901
2845
  year: "numeric",
2902
2846
  month: "2-digit",
2903
2847
  day: "2-digit"
2904
- }).format(r).split("-").map(Number), l = [
2848
+ }).format(i).split("-").map(Number), l = [
2905
2849
  {
2906
2850
  mode: "fixed",
2907
2851
  unit: "day",
@@ -2911,30 +2855,30 @@ function Ra(e, t, n) {
2911
2855
  ], c = t.values.map(
2912
2856
  (u) => {
2913
2857
  var d;
2914
- return (d = Fe(u, i)) == null ? void 0 : d.getTime();
2858
+ return (d = Fe(u, r)) == null ? void 0 : d.getTime();
2915
2859
  }
2916
2860
  );
2917
2861
  return l.find((u) => {
2918
- const d = Q(
2862
+ const d = X(
2919
2863
  { ...e, defaultDateFilter: u },
2920
2864
  n
2921
2865
  );
2922
2866
  return (d == null ? void 0 : d.operation) === t.operation && Se(
2923
2867
  d.values.map(
2924
2868
  (f) => {
2925
- var p;
2926
- return (p = Fe(f, i)) == null ? void 0 : p.getTime();
2869
+ var m;
2870
+ return (m = Fe(f, r)) == null ? void 0 : m.getTime();
2927
2871
  }
2928
2872
  ),
2929
2873
  c
2930
2874
  );
2931
2875
  });
2932
2876
  }
2933
- function _a(e) {
2877
+ function Aa(e) {
2934
2878
  const t = G(e.format);
2935
2879
  if ((t == null ? void 0 : t.type) === "temporal_bucket") {
2936
2880
  if (!e.granularity) return {};
2937
- const n = Ui(
2881
+ const n = Xr(
2938
2882
  t,
2939
2883
  e.granularity
2940
2884
  );
@@ -2951,34 +2895,34 @@ function _a(e) {
2951
2895
  ...t ? { format: t } : {}
2952
2896
  };
2953
2897
  }
2954
- function Ea(e, t) {
2955
- var r, a;
2956
- const n = ((r = e.nativeDataType) == null ? void 0 : r.trim()) || ((a = e.native_data_type) == null ? void 0 : a.trim());
2898
+ function _a(e, t) {
2899
+ var i, a;
2900
+ const n = ((i = e.nativeDataType) == null ? void 0 : i.trim()) || ((a = e.native_data_type) == null ? void 0 : a.trim());
2957
2901
  return n || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
2958
2902
  }
2959
- function bn(e) {
2903
+ function yn(e) {
2960
2904
  const t = (e.label ?? "").trim();
2961
2905
  return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
2962
2906
  }
2963
- function je(e) {
2964
- return bn(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
2907
+ function ze(e) {
2908
+ return yn(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
2965
2909
  }
2966
- function Ct(e) {
2967
- return je(e).toLowerCase().trim();
2910
+ function Ft(e) {
2911
+ return ze(e).toLowerCase().trim();
2968
2912
  }
2969
- function Va(e, t) {
2970
- return Ct(e).localeCompare(Ct(t), void 0, {
2913
+ function Ra(e, t) {
2914
+ return Ft(e).localeCompare(Ft(t), void 0, {
2971
2915
  numeric: !0,
2972
2916
  sensitivity: "base"
2973
2917
  });
2974
2918
  }
2975
- function X(e) {
2919
+ function ee(e) {
2976
2920
  return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
2977
2921
  }
2978
- function ms(e, t) {
2979
- const n = X(t);
2922
+ function os(e, t) {
2923
+ const n = ee(t);
2980
2924
  return n ? [
2981
- je(e),
2925
+ ze(e),
2982
2926
  e.label,
2983
2927
  e.name,
2984
2928
  e.description,
@@ -2987,38 +2931,38 @@ function ms(e, t) {
2987
2931
  e.entityName && e.name ? `${e.entityName}.${e.name}` : "",
2988
2932
  e.dataType
2989
2933
  ].some(
2990
- (r) => !!r && X(r).includes(n)
2934
+ (i) => !!i && ee(i).includes(n)
2991
2935
  ) : !0;
2992
2936
  }
2993
- function It(e, t) {
2994
- const n = X(t);
2937
+ function Ct(e, t) {
2938
+ const n = ee(t);
2995
2939
  if (!n) return 0;
2996
- const i = X(je(e));
2997
- return i.startsWith(n) ? 0 : i.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(X).some((a) => a.includes(n)) ? 2 : 3;
2940
+ const r = ee(ze(e));
2941
+ return r.startsWith(n) ? 0 : r.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(ee).some((a) => a.includes(n)) ? 2 : 3;
2998
2942
  }
2999
- function ps(e, t, n) {
3000
- return It(e, n) - It(t, n) || Va(e, t);
2943
+ function ss(e, t, n) {
2944
+ return Ct(e, n) - Ct(t, n) || Ra(e, t);
3001
2945
  }
3002
- function Ka(e, t) {
2946
+ function Ea(e, t) {
3003
2947
  var a;
3004
- const n = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, i = n || e.name, r = ut(
2948
+ const n = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, r = n || e.name, i = ct(
3005
2949
  e.type === "dataset" && n ? { ...e, name: n } : e
3006
2950
  );
3007
2951
  return {
3008
2952
  entityId: e.id || e.name,
3009
2953
  entityType: e.type,
3010
- entityName: i,
2954
+ entityName: r,
3011
2955
  label: e.label,
3012
2956
  description: e.description,
3013
- qualifiedEntityName: r,
2957
+ qualifiedEntityName: i,
3014
2958
  columns: t.map((o) => {
3015
- var p;
3016
- const s = e.type === "dataset" ? o.entityName || i : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? ut({ ...e, name: s }) : r), c = Ea(
2959
+ var m;
2960
+ const s = e.type === "dataset" ? o.entityName || r : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? ct({ ...e, name: s }) : i), c = _a(
3017
2961
  o,
3018
2962
  e.type === "dataset" ? "semantic" : "physical"
3019
- ), u = (p = o.label) != null && p.trim() ? o.label : void 0, d = u ? void 0 : Fi(o.column_name);
2963
+ ), u = (m = o.label) != null && m.trim() ? o.label : void 0, d = u ? void 0 : Dr(o.column_name);
3020
2964
  return {
3021
- id: Ci(s, o.column_name),
2965
+ id: Tr(s, o.column_name),
3022
2966
  name: o.column_name,
3023
2967
  qualifiedFieldName: o.qualifiedFieldName || o.column_name,
3024
2968
  dataType: o.data_type,
@@ -3042,23 +2986,23 @@ function Ka(e, t) {
3042
2986
  aggregateOrigin: o.aggregateOrigin,
3043
2987
  labelOrigin: o.labelOrigin,
3044
2988
  formatOrigin: o.formatOrigin,
3045
- ..._a(o),
2989
+ ...Aa(o),
3046
2990
  aggregate: o.aggregate
3047
2991
  };
3048
2992
  })
3049
2993
  };
3050
2994
  }
3051
- function La(e) {
2995
+ function Va(e) {
3052
2996
  return e.map((t) => ({
3053
2997
  ...t,
3054
- id: Bt({ ...t }),
2998
+ id: Kt({ ...t }),
3055
2999
  fieldScope: "domain"
3056
3000
  }));
3057
3001
  }
3058
- function Ba(e) {
3002
+ function Ka(e) {
3059
3003
  return e.flatMap(
3060
3004
  (t) => t.columns.map((n) => {
3061
- const i = bn(n) ? n.label : void 0, r = i ? void 0 : n.derivedLabel ?? xi(n.name), a = i ?? r ?? n.name;
3005
+ const r = yn(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? Mr(n.name), a = r ?? i ?? n.name;
3062
3006
  return {
3063
3007
  ...n,
3064
3008
  id: n.id || `${t.entityId}-${n.name}`,
@@ -3067,7 +3011,7 @@ function Ba(e) {
3067
3011
  dataType: n.dataType,
3068
3012
  qualifiedEntityName: n.qualifiedEntityName || t.qualifiedEntityName,
3069
3013
  label: a,
3070
- ...r !== void 0 ? { derivedLabel: r } : {},
3014
+ ...i !== void 0 ? { derivedLabel: i } : {},
3071
3015
  description: n.description,
3072
3016
  entityId: n.entityId || t.entityId,
3073
3017
  entityName: n.entityName || t.entityName,
@@ -3076,56 +3020,56 @@ function Ba(e) {
3076
3020
  })
3077
3021
  );
3078
3022
  }
3079
- function gs(e) {
3080
- const t = e.map((i) => Ka(i.target, i.columns || [])).filter((i) => {
3081
- var r;
3082
- return ((r = i == null ? void 0 : i.columns) == null ? void 0 : r.length) > 0;
3083
- }), n = La(e.flatMap((i) => i.calculatedFields || []));
3023
+ function cs(e) {
3024
+ const t = e.map((r) => Ea(r.target, r.columns || [])).filter((r) => {
3025
+ var i;
3026
+ return ((i = r == null ? void 0 : r.columns) == null ? void 0 : i.length) > 0;
3027
+ }), n = Va(e.flatMap((r) => r.calculatedFields || []));
3084
3028
  if (n.length > 0) {
3085
- const i = /* @__PURE__ */ new Map();
3086
- n.forEach((r) => {
3087
- const a = Bt(r);
3088
- i.has(a) || i.set(a, r);
3029
+ const r = /* @__PURE__ */ new Map();
3030
+ n.forEach((i) => {
3031
+ const a = Kt(i);
3032
+ r.has(a) || r.set(a, i);
3089
3033
  }), t.unshift({
3090
- entityId: Ii,
3034
+ entityId: wr,
3091
3035
  entityType: "dataset",
3092
- entityName: dt,
3036
+ entityName: lt,
3093
3037
  label: "Calculated Fields",
3094
3038
  description: "Domain-level calculated metrics and dimensions",
3095
- qualifiedEntityName: dt,
3096
- columns: Array.from(i.values())
3039
+ qualifiedEntityName: lt,
3040
+ columns: Array.from(r.values())
3097
3041
  });
3098
3042
  }
3099
- return { columnGroups: t, columns: Ba(t) };
3043
+ return { columnGroups: t, columns: Ka(t) };
3100
3044
  }
3101
- function qa(e, t) {
3102
- var r;
3103
- const n = (r = t.columnKeyMap) == null ? void 0 : r.byRole;
3045
+ function La(e, t) {
3046
+ var i;
3047
+ const n = (i = t.columnKeyMap) == null ? void 0 : i.byRole;
3104
3048
  if (!n) return;
3105
- const i = Object.values(n).flatMap((a) => {
3049
+ const r = Object.values(n).flatMap((a) => {
3106
3050
  const o = a == null ? void 0 : a[e];
3107
3051
  return o ? [o] : [];
3108
3052
  });
3109
- if (i.length === 1)
3110
- return i[0].outputKey ?? i[0].rawKey;
3053
+ if (r.length === 1)
3054
+ return r[0].outputKey ?? r[0].rawKey;
3111
3055
  }
3112
- function $a(e, t) {
3113
- var i;
3114
- const n = (i = t.resultColumns) == null ? void 0 : i.find((r) => {
3115
- const a = r.pivotIdentity;
3056
+ function Ba(e, t) {
3057
+ var r;
3058
+ const n = (r = t.resultColumns) == null ? void 0 : r.find((i) => {
3059
+ const a = i.pivotIdentity;
3116
3060
  return (a == null ? void 0 : a.metricId) === e.metricId && a.members.length === e.members.length && a.members.every(
3117
3061
  (o, s) => o.fieldId === e.members[s].fieldId && o.value === e.members[s].value
3118
3062
  );
3119
3063
  });
3120
3064
  return n == null ? void 0 : n.key;
3121
3065
  }
3122
- function xt(e, t) {
3066
+ function It(e, t) {
3123
3067
  var n;
3124
3068
  switch (e.kind) {
3125
3069
  case "field":
3126
- return qa(e.fieldId, t);
3070
+ return La(e.fieldId, t);
3127
3071
  case "pivot":
3128
- return $a(e, t);
3072
+ return Ba(e, t);
3129
3073
  case "result":
3130
3074
  return !t.keys || t.keys.includes(e.key) ? e.key : void 0;
3131
3075
  case "sqlKpiValue":
@@ -3136,74 +3080,74 @@ function xt(e, t) {
3136
3080
  return;
3137
3081
  }
3138
3082
  }
3139
- function ys(e, t) {
3083
+ function ls(e, t) {
3140
3084
  return e.flatMap((n) => {
3141
3085
  var s, l;
3142
- const i = xt(n.condition.column, t);
3143
- if (i === void 0) return [];
3144
- const r = (s = n.target.columns) == null ? void 0 : s.flatMap((c) => {
3145
- const u = xt(c, t);
3086
+ const r = It(n.condition.column, t);
3087
+ if (r === void 0) return [];
3088
+ const i = (s = n.target.columns) == null ? void 0 : s.flatMap((c) => {
3089
+ const u = It(c, t);
3146
3090
  return u === void 0 ? [] : [u];
3147
3091
  });
3148
- if ((l = n.target.columns) != null && l.length && !(r != null && r.length)) return [];
3092
+ if ((l = n.target.columns) != null && l.length && !(i != null && i.length)) return [];
3149
3093
  const { columns: a, ...o } = n.target;
3150
3094
  return [
3151
3095
  {
3152
3096
  ...n,
3153
- condition: { ...n.condition, column: i },
3154
- target: r ? { ...o, columns: r } : o
3097
+ condition: { ...n.condition, column: r },
3098
+ target: i ? { ...o, columns: i } : o
3155
3099
  }
3156
3100
  ];
3157
3101
  });
3158
3102
  }
3159
- function hs(e, t, n) {
3103
+ function us(e, t, n) {
3160
3104
  var o, s, l, c, u;
3161
- const i = Si(e);
3162
- if (i.includes("matrixMeasure"))
3105
+ const r = Or(e);
3106
+ if (r.includes("matrixMeasure"))
3163
3107
  return (s = (o = e.config) == null ? void 0 : o.matrix) != null && s.spec.measures.some((d) => d.id === t) ? { kind: "matrixMeasure", measureId: t } : void 0;
3164
- if (i.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
3165
- if (i.includes("result"))
3108
+ if (r.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
3109
+ if (r.includes("result"))
3166
3110
  return !n.keys || n.keys.includes(t) ? { kind: "result", key: t } : void 0;
3167
- const r = i.includes("pivot") ? (c = (l = n.resultColumns) == null ? void 0 : l.find((d) => d.key === t)) == null ? void 0 : c.pivotIdentity : void 0;
3168
- if (r)
3111
+ const i = r.includes("pivot") ? (c = (l = n.resultColumns) == null ? void 0 : l.find((d) => d.key === t)) == null ? void 0 : c.pivotIdentity : void 0;
3112
+ if (i)
3169
3113
  return {
3170
3114
  kind: "pivot",
3171
- metricId: r.metricId,
3172
- members: r.members.map((d) => ({ fieldId: d.fieldId, value: d.value }))
3115
+ metricId: i.metricId,
3116
+ members: i.members.map((d) => ({ fieldId: d.fieldId, value: d.value }))
3173
3117
  };
3174
- if (!i.includes("field")) return;
3118
+ if (!r.includes("field")) return;
3175
3119
  const a = Object.values(((u = n.columnKeyMap) == null ? void 0 : u.byRole) ?? {}).flatMap(
3176
3120
  (d) => Object.entries(d ?? {}).flatMap(
3177
- ([f, p]) => (p.outputKey ?? p.rawKey) === t ? [f] : []
3121
+ ([f, m]) => (m.outputKey ?? m.rawKey) === t ? [f] : []
3178
3122
  )
3179
3123
  );
3180
3124
  return a.length === 1 ? { kind: "field", fieldId: a[0] } : void 0;
3181
3125
  }
3182
3126
  function fe(e, t) {
3183
3127
  const n = (a) => {
3184
- if (L(a)) return a.value;
3185
- const o = typeof a == "string" ? Pi(a.trim()) ?? K(a) : K(a);
3128
+ if (B(a)) return a.value;
3129
+ const o = typeof a == "string" ? Vr(a.trim()) ?? K(a) : K(a);
3186
3130
  if (o === null) return null;
3187
3131
  try {
3188
- return ki(String(o));
3132
+ return Kr(String(o));
3189
3133
  } catch {
3190
3134
  return null;
3191
3135
  }
3192
- }, i = n(e), r = n(t);
3193
- return i === null || r === null ? null : zt(i, r);
3194
- }
3195
- function St(e, t, n) {
3196
- const i = za(e);
3197
- if (i === null) return null;
3198
- if (typeof i == "number" && typeof t == "number" && typeof n == "number") {
3199
- const g = ja(i, t, n);
3136
+ }, r = n(e), i = n(t);
3137
+ return r === null || i === null ? null : qt(r, i);
3138
+ }
3139
+ function xt(e, t, n) {
3140
+ const r = qa(e);
3141
+ if (r === null) return null;
3142
+ if (typeof r == "number" && typeof t == "number" && typeof n == "number") {
3143
+ const g = Ua(r, t, n);
3200
3144
  return { ratio: g, midpointComparison: Math.sign(g - 0.5) };
3201
3145
  }
3202
3146
  if ([t, n].some((g) => typeof g == "number" && !Number.isFinite(g))) return null;
3203
- const r = [i, t, n].map((g) => {
3204
- const b = typeof g == "number" ? De(String(g)) : g.value, [m, v = ""] = b.split(".");
3205
- return { coefficient: m + v, scale: v.length };
3206
- }), a = Math.max(...r.map((g) => g.scale)), [o, s, l] = r.map(
3147
+ const i = [r, t, n].map((g) => {
3148
+ const b = typeof g == "number" ? De(String(g)) : g.value, [p, v = ""] = b.split(".");
3149
+ return { coefficient: p + v, scale: v.length };
3150
+ }), a = Math.max(...i.map((g) => g.scale)), [o, s, l] = i.map(
3207
3151
  (g) => BigInt(g.coefficient) * 10n ** BigInt(a - g.scale)
3208
3152
  ), c = l - s, u = o - s;
3209
3153
  if (c <= 0n)
@@ -3214,13 +3158,13 @@ function St(e, t, n) {
3214
3158
  const d = u * 2n - c, f = d < 0n ? -1 : d > 0n ? 1 : 0;
3215
3159
  return { ratio: u <= 0n ? 0 : u >= c ? 1 : Number(u * 1000000000n / c) / 1e9, midpointComparison: f };
3216
3160
  }
3217
- function bs(e) {
3161
+ function ds(e) {
3218
3162
  return !!e && typeof e == "object" && !Array.isArray(e);
3219
3163
  }
3220
- function vs(e) {
3164
+ function fs(e) {
3221
3165
  return e.enabled !== !1;
3222
3166
  }
3223
- function Fs(e) {
3167
+ function ms(e) {
3224
3168
  return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
3225
3169
  }
3226
3170
  function K(e) {
@@ -3232,30 +3176,30 @@ function K(e) {
3232
3176
  }
3233
3177
  return null;
3234
3178
  }
3235
- function za(e) {
3236
- return L(e) ? e : K(e);
3179
+ function qa(e) {
3180
+ return B(e) ? e : K(e);
3237
3181
  }
3238
- function Cs(e) {
3182
+ function ps(e) {
3239
3183
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
3240
- for (const i of e)
3241
- L(i) ? n.add(i.value) : t.add(i);
3184
+ for (const r of e)
3185
+ B(r) ? n.add(r.value) : t.add(r);
3242
3186
  return {
3243
- has: (i) => L(i) ? n.has(i.value) : t.has(i)
3187
+ has: (r) => B(r) ? n.has(r.value) : t.has(r)
3244
3188
  };
3245
3189
  }
3246
- function Dt(e, t) {
3247
- return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : zt(
3190
+ function St(e, t) {
3191
+ return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : qt(
3248
3192
  typeof e == "number" ? De(String(e)) : e.value,
3249
3193
  typeof t == "number" ? De(String(t)) : t.value
3250
3194
  );
3251
3195
  }
3252
- function Ua(e) {
3196
+ function $a(e) {
3253
3197
  return e == null || e === "";
3254
3198
  }
3255
- function ja(e, t, n) {
3199
+ function Ua(e, t, n) {
3256
3200
  return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) ? 0 : n === t ? e >= n ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (n - t)));
3257
3201
  }
3258
- function Ga(e) {
3202
+ function za(e) {
3259
3203
  switch (e) {
3260
3204
  case "bold":
3261
3205
  return 700;
@@ -3269,28 +3213,28 @@ function Ga(e) {
3269
3213
  return;
3270
3214
  }
3271
3215
  }
3272
- function Wa(e) {
3273
- return e ? Fn({
3274
- fontWeight: Ga(e.fontWeight),
3216
+ function ja(e) {
3217
+ return e ? bn({
3218
+ fontWeight: za(e.fontWeight),
3275
3219
  fontStyle: e.italic ? "italic" : void 0,
3276
3220
  color: e.textColor,
3277
3221
  backgroundColor: e.backgroundColor,
3278
3222
  textDecoration: e.textDecoration
3279
3223
  }) : {};
3280
3224
  }
3281
- function vn(...e) {
3225
+ function hn(...e) {
3282
3226
  return Object.assign(
3283
3227
  {},
3284
- ...e.filter((t) => !!t).map(Fn)
3228
+ ...e.filter((t) => !!t).map(bn)
3285
3229
  );
3286
3230
  }
3287
- function Fn(e) {
3231
+ function bn(e) {
3288
3232
  return Object.fromEntries(
3289
3233
  Object.entries(e).filter(([, t]) => t !== void 0)
3290
3234
  );
3291
3235
  }
3292
- function Ha(e, t, n) {
3293
- if (L(e) || L(n)) {
3236
+ function Ga(e, t, n) {
3237
+ if (B(e) || B(n)) {
3294
3238
  const s = fe(e, n);
3295
3239
  if (s === null) return t === "neq";
3296
3240
  switch (t) {
@@ -3308,7 +3252,7 @@ function Ha(e, t, n) {
3308
3252
  return s <= 0;
3309
3253
  }
3310
3254
  }
3311
- const i = K(e), r = K(n), a = i ?? String(e ?? ""), o = r ?? String(n ?? "");
3255
+ const r = K(e), i = K(n), a = r ?? String(e ?? ""), o = i ?? String(n ?? "");
3312
3256
  switch (t) {
3313
3257
  case "eq":
3314
3258
  return a === o;
@@ -3324,34 +3268,34 @@ function Ha(e, t, n) {
3324
3268
  return a <= o;
3325
3269
  }
3326
3270
  }
3327
- function Ya(e, t, n, i) {
3271
+ function Wa(e, t, n, r) {
3328
3272
  var a;
3329
- const r = t[e.column];
3273
+ const i = t[e.column];
3330
3274
  switch (e.kind) {
3331
3275
  case "comparison":
3332
- return Ha(r, e.operator, e.value);
3276
+ return Ga(i, e.operator, e.value);
3333
3277
  case "between": {
3334
- if ([r, e.min, e.max].some(L)) {
3335
- const c = fe(r, e.min), u = fe(r, e.max);
3278
+ if ([i, e.min, e.max].some(B)) {
3279
+ const c = fe(i, e.min), u = fe(i, e.max);
3336
3280
  return c === null || u === null ? !1 : e.inclusive === !1 ? c > 0 && u < 0 : c >= 0 && u <= 0;
3337
3281
  }
3338
- const o = K(r), s = K(e.min), l = K(e.max);
3282
+ const o = K(i), s = K(e.min), l = K(e.max);
3339
3283
  return o === null || s === null || l === null ? !1 : e.inclusive === !1 ? o > s && o < l : o >= s && o <= l;
3340
3284
  }
3341
3285
  case "blank":
3342
- return Ua(r) === e.isBlank;
3286
+ return $a(i) === e.isBlank;
3343
3287
  case "contains": {
3344
- const o = L(r) ? r.value : String(r ?? ""), s = e.value, l = e.caseSensitive ? o : o.toLocaleLowerCase(), c = e.caseSensitive ? s : s.toLocaleLowerCase();
3288
+ const o = B(i) ? i.value : String(i ?? ""), s = e.value, l = e.caseSensitive ? o : o.toLocaleLowerCase(), c = e.caseSensitive ? s : s.toLocaleLowerCase();
3345
3289
  return e.exact ? l === c : l.includes(c);
3346
3290
  }
3347
3291
  case "topBottom":
3348
- return ((a = n.topBottom[i]) == null ? void 0 : a.has(r)) ?? !1;
3292
+ return ((a = n.topBottom[r]) == null ? void 0 : a.has(i)) ?? !1;
3349
3293
  case "colorScale":
3350
3294
  case "dataBar":
3351
- return !n.unavailableRuleIds.has(i);
3295
+ return !n.unavailableRuleIds.has(r);
3352
3296
  }
3353
3297
  }
3354
- function Ja(e, t) {
3298
+ function Ha(e, t) {
3355
3299
  var n;
3356
3300
  return !((n = e.target.tableParts) != null && n.length) || e.target.tableParts.includes(t);
3357
3301
  }
@@ -3359,25 +3303,25 @@ function Qa(e, t) {
3359
3303
  const n = e.target.columns;
3360
3304
  return e.target.level === "row" ? !(n != null && n.length) || n.includes(t) : n != null && n.length ? n.includes(t) : t === e.condition.column;
3361
3305
  }
3362
- function Za(e, t, n) {
3363
- var i, r;
3306
+ function Ya(e, t, n) {
3307
+ var r, i;
3364
3308
  if (e.condition.kind === "colorScale") {
3365
3309
  const a = n.numericRanges[e.id];
3366
3310
  if (!a) return {};
3367
- const o = t[e.condition.column], s = St(
3311
+ const o = t[e.condition.column], s = xt(
3368
3312
  o,
3369
3313
  a.min,
3370
3314
  a.max
3371
3315
  );
3372
3316
  if (!s)
3373
3317
  return {};
3374
- const l = a.mid, c = l !== void 0 && L(o) ? fe(o, l) : l === void 0 ? null : Math.sign(K(o) - l);
3318
+ const l = a.mid, c = l !== void 0 && B(o) ? fe(o, l) : l === void 0 ? null : Math.sign(K(o) - l);
3375
3319
  return { cellStyle: { backgroundColor: l !== void 0 && e.condition.colors.mid ? c < 0 ? e.condition.colors.min : c === 0 ? e.condition.colors.mid : e.condition.colors.max : s.midpointComparison < 0 ? e.condition.colors.min : e.condition.colors.max } };
3376
3320
  }
3377
3321
  if (e.condition.kind === "dataBar") {
3378
3322
  const a = n.numericRanges[e.id];
3379
3323
  if (!a) return {};
3380
- const o = e.condition.range === "auto" && Dt(a.min, 0) > 0 && Dt(a.max, 0) > 0 ? 0 : a.min, s = St(
3324
+ const o = e.condition.range === "auto" && St(a.min, 0) > 0 && St(a.max, 0) > 0 ? 0 : a.min, s = xt(
3381
3325
  t[e.condition.column],
3382
3326
  o,
3383
3327
  a.max
@@ -3392,130 +3336,57 @@ function Za(e, t, n) {
3392
3336
  } : {};
3393
3337
  }
3394
3338
  return {
3395
- cellStyle: vn(
3396
- Wa(e.style),
3397
- (i = e.style) != null && i.textColor ? { color: e.style.textColor } : void 0
3339
+ cellStyle: hn(
3340
+ ja(e.style),
3341
+ (r = e.style) != null && r.textColor ? { color: e.style.textColor } : void 0
3398
3342
  ),
3399
- overlay: (r = e.style) != null && r.icon ? {
3343
+ overlay: (i = e.style) != null && i.icon ? {
3400
3344
  kind: "icon",
3401
3345
  icon: e.style.icon
3402
3346
  } : void 0
3403
3347
  };
3404
3348
  }
3405
- function Xa(e) {
3349
+ function Ja(e) {
3406
3350
  const t = {
3407
3351
  matchedRuleIds: []
3408
3352
  };
3409
3353
  for (const n of e.rules) {
3410
- if (n.target.matrix !== void 0 || n.enabled === !1 || !Ja(n, e.tablePart) || !Qa(n, e.columnKey) || !Ya(n.condition, e.row, e.range, n.id))
3354
+ if (n.target.matrix !== void 0 || n.enabled === !1 || !Ha(n, e.tablePart) || !Qa(n, e.columnKey) || !Wa(n.condition, e.row, e.range, n.id))
3411
3355
  continue;
3412
- const i = Za(n, e.row, e.range), r = n.target.level === "row" ? "rowStyle" : "cellStyle";
3413
- t[r] = vn(
3414
- t[r],
3415
- i.cellStyle
3416
- ), i.overlay && (t.overlay = i.overlay), t.matchedRuleIds.push(n.id);
3356
+ const r = Ya(n, e.row, e.range), i = n.target.level === "row" ? "rowStyle" : "cellStyle";
3357
+ t[i] = hn(
3358
+ t[i],
3359
+ r.cellStyle
3360
+ ), r.overlay && (t.overlay = r.overlay), t.matchedRuleIds.push(n.id);
3417
3361
  }
3418
3362
  return t;
3419
3363
  }
3420
- function Pe(e) {
3421
- switch (e.kind) {
3422
- case "field":
3423
- return `field:${e.fieldId}`;
3424
- case "result":
3425
- return `result:${e.key}`;
3426
- case "sqlKpiValue":
3427
- return "sqlKpiValue";
3428
- case "matrixMeasure":
3429
- return `matrixMeasure:${e.measureId}`;
3430
- case "matrixLevel":
3431
- return `matrixLevel:${e.levelId}`;
3432
- case "pivot":
3433
- return `pivot:${JSON.stringify([e.metricId, e.members.map((t) => [t.fieldId, t.value])])}`;
3434
- }
3435
- }
3436
- function wt(e) {
3437
- if (e === "sqlKpiValue") return { kind: "sqlKpiValue" };
3438
- const t = e.indexOf(":");
3439
- if (t <= 0) return;
3440
- const n = e.slice(0, t), i = e.slice(t + 1);
3441
- if (i)
3442
- switch (n) {
3443
- case "field":
3444
- return { kind: "field", fieldId: i };
3445
- case "result":
3446
- return { kind: "result", key: i };
3447
- case "matrixMeasure":
3448
- return { kind: "matrixMeasure", measureId: i };
3449
- case "matrixLevel":
3450
- return { kind: "matrixLevel", levelId: i };
3451
- case "pivot":
3452
- try {
3453
- const [r, a] = JSON.parse(i);
3454
- return typeof r != "string" || !Array.isArray(a) ? void 0 : { kind: "pivot", metricId: r, members: a.map(([o, s]) => ({ fieldId: o, value: s })) };
3455
- } catch {
3456
- return;
3457
- }
3458
- default:
3459
- return;
3460
- }
3461
- }
3462
- function Ge(e, t) {
3463
- const { columns: n, ...i } = e.target;
3464
- return {
3465
- ...e,
3466
- condition: { ...e.condition, column: t(e.condition.column) },
3467
- target: n ? { ...i, columns: n.map(t) } : i
3468
- };
3469
- }
3470
- function Is(e) {
3471
- return e.map((t) => Ge(t, Pe));
3472
- }
3473
- function xs(e) {
3474
- return e.flatMap((t) => {
3475
- var s;
3476
- const n = wt(t.condition.column);
3477
- if (!n) return [];
3478
- const i = Ge(t, (l) => wt(l) ?? null), r = (s = i.target.columns) == null ? void 0 : s.filter((l) => l !== null), { columns: a, ...o } = i.target;
3479
- return [
3480
- {
3481
- ...i,
3482
- condition: { ...i.condition, column: n },
3483
- target: r ? { ...o, columns: r } : o
3484
- }
3485
- ];
3486
- });
3487
- }
3488
3364
  const ae = Object.freeze({}), xe = "value";
3489
- function eo() {
3365
+ function Xa() {
3490
3366
  return { numericRanges: {}, topBottom: {}, unavailableRuleIds: /* @__PURE__ */ new Set() };
3491
3367
  }
3492
- function to(e, t) {
3493
- var i, r, a, o;
3494
- if ((i = e.sql) != null && i.trim()) return { kind: "sqlKpiValue" };
3495
- const n = t ?? ((o = (a = (r = e.config) == null ? void 0 : r.metricColumns) == null ? void 0 : a[0]) == null ? void 0 : o.id);
3496
- return n ? { kind: "field", fieldId: n } : void 0;
3497
- }
3498
- function Ss(e, t, n) {
3499
- const i = Di(e);
3500
- if (!i.length) return ae;
3501
- const r = to(e, n);
3368
+ function gs(e, t) {
3369
+ var l;
3370
+ const n = Pr(e);
3371
+ if (!n.length) return ae;
3372
+ const r = (l = Nr(e)) == null ? void 0 : l.value;
3502
3373
  if (!r) return ae;
3503
- const a = (c) => Pe(c) === Pe(r), o = i.filter((c) => a(c.condition.column)).map((c) => Ge(c, (u) => a(u) ? xe : ""));
3504
- if (!o.length) return ae;
3505
- const s = Xa({
3506
- rules: o,
3374
+ const i = (c) => ut(c) === ut(r), a = n.filter((c) => i(c.condition.column)).map((c) => kr(c, (u) => i(u) ? xe : ""));
3375
+ if (!a.length) return ae;
3376
+ const o = Ja({
3377
+ rules: a,
3507
3378
  row: { [xe]: t },
3508
3379
  columnKey: xe,
3509
- range: eo(),
3380
+ range: Xa(),
3510
3381
  tablePart: "body"
3511
- }), l = { ...s.rowStyle, ...s.cellStyle };
3512
- return l.color || l.backgroundColor ? { ...l.color ? { color: l.color } : {}, ...l.backgroundColor ? { backgroundColor: l.backgroundColor } : {} } : ae;
3382
+ }), s = { ...o.rowStyle, ...o.cellStyle };
3383
+ return s.color || s.backgroundColor ? { ...s.color ? { color: s.color } : {}, ...s.backgroundColor ? { backgroundColor: s.backgroundColor } : {} } : ae;
3513
3384
  }
3514
- function Ds(e, t) {
3385
+ function ys(e, t) {
3515
3386
  const n = e.answers.relationshipIds;
3516
- return !n || !t ? !n && !t : n.length === t.length && n.every((i, r) => t[r] === i);
3387
+ return !n || !t ? !n && !t : n.length === t.length && n.every((r, i) => t[i] === r);
3517
3388
  }
3518
- const no = /* @__PURE__ */ new Set([
3389
+ const Za = /* @__PURE__ */ new Set([
3519
3390
  "dataset_not_reachable",
3520
3391
  "field_not_resolvable",
3521
3392
  "missing_metadata",
@@ -3527,15 +3398,15 @@ const no = /* @__PURE__ */ new Set([
3527
3398
  function V(e) {
3528
3399
  return !!e && typeof e == "object" && !Array.isArray(e);
3529
3400
  }
3530
- function io(e) {
3401
+ function eo(e) {
3531
3402
  if (V(e))
3532
3403
  switch (e.status) {
3533
3404
  case "applied": {
3534
- const t = Ut(e.route);
3405
+ const t = $t(e.route);
3535
3406
  return t ? { status: "applied", route: t } : void 0;
3536
3407
  }
3537
3408
  case "skipped":
3538
- return typeof e.reason == "string" && no.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
3409
+ return typeof e.reason == "string" && Za.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
3539
3410
  case "needsPath":
3540
3411
  return { status: "needsPath" };
3541
3412
  case "blocked":
@@ -3548,25 +3419,25 @@ function io(e) {
3548
3419
  return;
3549
3420
  }
3550
3421
  }
3551
- function Cn(e) {
3422
+ function vn(e) {
3552
3423
  if (e !== void 0)
3553
3424
  return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
3554
3425
  }
3555
- function ro(e) {
3426
+ function to(e) {
3556
3427
  if (!V(e)) return;
3557
- const t = Ut(e.route), n = e.target;
3558
- if (!(!t || !V(n) || n.kind !== "relationship" || !V(n.field) || typeof n.field.name != "string" || !V(n.field.source) || n.field.source.kind !== "semantic" || !Cn(n.relationshipIds)))
3428
+ const t = $t(e.route), n = e.target;
3429
+ if (!(!t || !V(n) || n.kind !== "relationship" || !V(n.field) || typeof n.field.name != "string" || !V(n.field.source) || n.field.source.kind !== "semantic" || !vn(n.relationshipIds)))
3559
3430
  return { route: t, target: n };
3560
3431
  }
3561
- function ws(e) {
3432
+ function hs(e) {
3562
3433
  if (!V(e) || !Array.isArray(e.previews)) return { previews: [] };
3563
3434
  const t = [];
3564
- for (const i of e.previews) {
3565
- if (!V(i) || typeof i.cardId != "string" || !i.cardId || !V(i.answers)) continue;
3566
- const r = Cn(i.answers.relationshipIds), a = io(i.outcome), o = Array.isArray(i.paths) ? i.paths.map(ro) : [];
3567
- r === null || !a || !o.every(Boolean) || a.status === "needsPath" && o.length < 2 || t.push({
3568
- cardId: i.cardId,
3569
- answers: r ? { relationshipIds: r } : {},
3435
+ for (const r of e.previews) {
3436
+ if (!V(r) || typeof r.cardId != "string" || !r.cardId || !V(r.answers)) continue;
3437
+ const i = vn(r.answers.relationshipIds), a = eo(r.outcome), o = Array.isArray(r.paths) ? r.paths.map(to) : [];
3438
+ i === null || !a || !o.every(Boolean) || a.status === "needsPath" && o.length < 2 || t.push({
3439
+ cardId: r.cardId,
3440
+ answers: i ? { relationshipIds: i } : {},
3570
3441
  outcome: a,
3571
3442
  paths: o
3572
3443
  });
@@ -3575,18 +3446,18 @@ function ws(e) {
3575
3446
  return { previews: t, ...n ? { manageRelationships: n } : {} };
3576
3447
  }
3577
3448
  const se = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
3578
- function ao(e) {
3449
+ function no(e) {
3579
3450
  return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
3580
3451
  }
3581
- function Ts(e) {
3452
+ function bs(e) {
3582
3453
  if (e.direction === "to_many") {
3583
3454
  const n = se(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
3584
- return `${e.base ? ao(se(e.base)) : "Rows"} with at least one matching ${n}`;
3455
+ return `${e.base ? no(se(e.base)) : "Rows"} with at least one matching ${n}`;
3585
3456
  }
3586
3457
  return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(se).join(", ")}`;
3587
3458
  }
3588
- const Os = "The relationship this card used changed; choose it again";
3589
- function Ms(e, t) {
3459
+ const vs = "The relationship this card used changed; choose it again";
3460
+ function Fs(e, t) {
3590
3461
  switch (e) {
3591
3462
  case "relationship_missing":
3592
3463
  return t ? `Not related to ${se(t)}` : "Not related to this card";
@@ -3604,135 +3475,122 @@ function Ms(e, t) {
3604
3475
  }
3605
3476
  }
3606
3477
  export {
3607
- Zo as $,
3608
- wt as A,
3609
- Ge as B,
3610
- Is as C,
3611
- Do as D,
3612
- xs as E,
3613
- to as F,
3614
- Ss as G,
3615
- Ds as H,
3616
- ws as I,
3617
- ao as J,
3618
- Ts as K,
3619
- Ms as L,
3620
- je as M,
3621
- Zr as N,
3622
- zr as O,
3623
- cr as P,
3624
- ur as Q,
3625
- Os as R,
3626
- pe as S,
3627
- Ao as T,
3628
- ts as U,
3629
- Xo as V,
3630
- H as W,
3631
- Mo as X,
3632
- ue as Y,
3633
- na as Z,
3634
- ia as _,
3635
- rs as a,
3636
- wa as a$,
3637
- is as a0,
3638
- sr as a1,
3639
- ar as a2,
3640
- or as a3,
3641
- Ho as a4,
3642
- Lo as a5,
3643
- Tr as a6,
3644
- Be as a7,
3645
- _o as a8,
3646
- zo as a9,
3647
- Fs as aA,
3648
- za as aB,
3649
- Dt as aC,
3650
- Cs as aD,
3651
- ko as aE,
3652
- Ur as aF,
3653
- rr as aG,
3654
- To as aH,
3655
- jt as aI,
3656
- dr as aJ,
3657
- Ve as aK,
3658
- No as aL,
3659
- Ro as aM,
3660
- de as aN,
3661
- ne as aO,
3662
- Oo as aP,
3663
- qo as aQ,
3664
- aa as aR,
3665
- ms as aS,
3666
- bn as aT,
3667
- ls as aU,
3668
- Pa as aV,
3669
- ee as aW,
3670
- Ue as aX,
3671
- as as aY,
3672
- cs as aZ,
3673
- os as a_,
3674
- jo as aa,
3675
- Uo as ab,
3676
- Ke as ac,
3677
- Rr as ad,
3678
- te as ae,
3679
- $o as af,
3680
- Go as ag,
3681
- hr as ah,
3682
- wr as ai,
3683
- Kr as aj,
3684
- Lr as ak,
3685
- Wo as al,
3686
- E as am,
3687
- Oe as an,
3688
- _r as ao,
3689
- Ko as ap,
3690
- Eo as aq,
3691
- Vo as ar,
3692
- Cr as as,
3693
- Fr as at,
3694
- Bo as au,
3695
- rn as av,
3696
- bs as aw,
3697
- vn as ax,
3698
- Wa as ay,
3699
- vs as az,
3700
- ns as b,
3701
- Ea as b0,
3702
- fs as b1,
3703
- ds as b2,
3704
- ss as b3,
3705
- Ma as b4,
3706
- es as b5,
3707
- ea as b6,
3708
- Nr as b7,
3709
- ps as b8,
3710
- It as b9,
3711
- _a as ba,
3712
- X as bb,
3713
- Po as bc,
3714
- Qo as c,
3715
- ka as d,
3716
- oa as e,
3717
- sa as f,
3718
- wo as g,
3719
- tr as h,
3720
- jr as i,
3721
- Wr as j,
3722
- Hr as k,
3723
- Yo as l,
3724
- Yr as m,
3725
- Jr as n,
3726
- Jo as o,
3727
- Qr as p,
3728
- Ka as q,
3729
- us as r,
3730
- La as s,
3731
- Ba as t,
3732
- gs as u,
3733
- xt as v,
3734
- ys as w,
3735
- hs as x,
3736
- Xa as y,
3737
- Pe as z
3478
+ Le as $,
3479
+ ys as A,
3480
+ hs as B,
3481
+ no as C,
3482
+ Fo as D,
3483
+ bs as E,
3484
+ Fs as F,
3485
+ ze as G,
3486
+ Bi as H,
3487
+ pi as I,
3488
+ gi as J,
3489
+ pe as K,
3490
+ wo as L,
3491
+ Ho as M,
3492
+ Qi as N,
3493
+ Go as O,
3494
+ Q as P,
3495
+ So as Q,
3496
+ vs as R,
3497
+ ue as S,
3498
+ Zi as T,
3499
+ ea as U,
3500
+ jo as V,
3501
+ Yo as W,
3502
+ fi as X,
3503
+ ui as Y,
3504
+ di as Z,
3505
+ qo as _,
3506
+ Jo as a,
3507
+ Do as a$,
3508
+ Po as a0,
3509
+ Eo as a1,
3510
+ Ko as a2,
3511
+ Vo as a3,
3512
+ Ve as a4,
3513
+ Ni as a5,
3514
+ Ro as a6,
3515
+ Lo as a7,
3516
+ Ii as a8,
3517
+ Ri as a9,
3518
+ de as aA,
3519
+ ne as aB,
3520
+ xo as aC,
3521
+ _o as aD,
3522
+ ra as aE,
3523
+ os as aF,
3524
+ yn as aG,
3525
+ ts as aH,
3526
+ Ma as aI,
3527
+ te as aJ,
3528
+ Ue as aK,
3529
+ Xo as aL,
3530
+ ns as aM,
3531
+ Zo as aN,
3532
+ Sa as aO,
3533
+ _a as aP,
3534
+ as as aQ,
3535
+ is as aR,
3536
+ es as aS,
3537
+ wa as aT,
3538
+ Wo as aU,
3539
+ Ji as aV,
3540
+ Pi as aW,
3541
+ ss as aX,
3542
+ Ct as aY,
3543
+ Aa as aZ,
3544
+ ee as a_,
3545
+ Ei as aa,
3546
+ Bo as ab,
3547
+ E as ac,
3548
+ Me as ad,
3549
+ ki as ae,
3550
+ No as af,
3551
+ ko as ag,
3552
+ Ao as ah,
3553
+ tn as ai,
3554
+ ds as aj,
3555
+ hn as ak,
3556
+ ja as al,
3557
+ fs as am,
3558
+ ms as an,
3559
+ qa as ao,
3560
+ St as ap,
3561
+ ps as aq,
3562
+ To as ar,
3563
+ qi as as,
3564
+ li as at,
3565
+ Io as au,
3566
+ Ut as av,
3567
+ yi as aw,
3568
+ Ee as ax,
3569
+ Mo as ay,
3570
+ Oo as az,
3571
+ Qo as b,
3572
+ zo as c,
3573
+ Oa as d,
3574
+ ia as e,
3575
+ aa as f,
3576
+ Co as g,
3577
+ oi as h,
3578
+ $i as i,
3579
+ zi as j,
3580
+ ji as k,
3581
+ $o as l,
3582
+ Gi as m,
3583
+ Wi as n,
3584
+ Uo as o,
3585
+ Hi as p,
3586
+ Ea as q,
3587
+ rs as r,
3588
+ Va as s,
3589
+ Ka as t,
3590
+ cs as u,
3591
+ It as v,
3592
+ ls as w,
3593
+ us as x,
3594
+ Ja as y,
3595
+ gs as z
3738
3596
  };