react-semaphor 0.1.561 → 0.1.562

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