react-semaphor 0.1.514 → 0.1.516

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 (228) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +226 -225
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +8 -8
  7. package/dist/chunks/{calculated-field-identity-BiTGmnST.cjs → calculated-field-identity-5bg9oHTw.cjs} +1 -1
  8. package/dist/chunks/{calculated-field-identity-DnRd4YIY.js → calculated-field-identity-DzJBs2J8.js} +4 -4
  9. package/dist/chunks/{card-config-utils-B2cDWQqB.js → card-config-utils-Cxnq2R6z.js} +14 -14
  10. package/dist/chunks/{card-config-utils-CMO4_zVs.cjs → card-config-utils-z86y6tSq.cjs} +1 -1
  11. package/dist/chunks/column-bands-CU0byntA.cjs +1 -0
  12. package/dist/chunks/column-bands-RdM-kjDe.js +47 -0
  13. package/dist/chunks/{dashboard-briefing-launcher-e3s3MuSs.js → dashboard-briefing-launcher-BCEHJ_eD.js} +15 -12
  14. package/dist/chunks/{dashboard-briefing-launcher-BzPD50QD.cjs → dashboard-briefing-launcher-CjZ4aE34.cjs} +2 -2
  15. package/dist/chunks/{dashboard-controls-DAOABnks.js → dashboard-controls-DFfit5KH.js} +12 -12
  16. package/dist/chunks/{dashboard-controls-DQBfOqmC.cjs → dashboard-controls-f9aJ70Zu.cjs} +1 -1
  17. package/dist/chunks/{dashboard-date-comparison-definition-D7Bl-YAl.js → dashboard-date-comparison-definition-BqNhECUr.js} +6 -6
  18. package/dist/chunks/{dashboard-date-comparison-definition-C_w-GO_5.cjs → dashboard-date-comparison-definition-Y6JZwpcr.cjs} +1 -1
  19. package/dist/chunks/{dashboard-json-S5Eq2GAg.js → dashboard-json-DVtcA02f.js} +7 -7
  20. package/dist/chunks/{dashboard-json-1jZycd5h.cjs → dashboard-json-deqQC-UR.cjs} +1 -1
  21. package/dist/chunks/edit-dashboard-visual-DK6lSC_p.cjs +172 -0
  22. package/dist/chunks/{edit-dashboard-visual-Bkm0ciHG.js → edit-dashboard-visual-lJ6rDH3w.js} +4553 -4542
  23. package/dist/chunks/{editor-action-buttons-Bvv16QA-.js → editor-action-buttons-Bnxxa439.js} +7 -7
  24. package/dist/chunks/{editor-action-buttons-B2NCSsDw.cjs → editor-action-buttons-CmDaQbPN.cjs} +1 -1
  25. package/dist/chunks/{field-aggregations-CzuQKtqx.js → field-aggregations-Dl2A3rbV.js} +461 -358
  26. package/dist/chunks/field-aggregations-pH_3kymD.cjs +1 -0
  27. package/dist/chunks/{field-dependencies-DIab72rQ.cjs → field-dependencies-EB485TdB.cjs} +1 -1
  28. package/dist/chunks/{field-dependencies-DXW4jtvJ.js → field-dependencies-v-lJNzC7.js} +1 -1
  29. package/dist/chunks/{index-nhUr9xBz.js → index-BVVl2JDK.js} +57955 -54696
  30. package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
  31. package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
  32. package/dist/chunks/index-DfqMtR9S.cjs +4 -0
  33. package/dist/chunks/index-UNKSfi7s.cjs +1434 -0
  34. package/dist/chunks/{index-CnGVjyF8.js → index-ylOpKRDu.js} +877 -849
  35. package/dist/chunks/{matrix-analytical-definition-Ct5Tu8np.cjs → matrix-analytical-definition-BWd159lN.cjs} +1 -1
  36. package/dist/chunks/{matrix-analytical-definition-BDAK2aEi.js → matrix-analytical-definition-BimC4XIV.js} +1 -1
  37. package/dist/chunks/{matrix-card-U4c72doZ.cjs → matrix-card-C2RjEYZ8.cjs} +1 -1
  38. package/dist/chunks/{matrix-card-DOIeTmjh.js → matrix-card-CIlz0Dnp.js} +2 -2
  39. package/dist/chunks/{matrix-control-sources-FjxGIbqk.cjs → matrix-control-sources-BvEJF7d3.cjs} +1 -1
  40. package/dist/chunks/{matrix-control-sources-BxKH2yu2.js → matrix-control-sources-KbZe1gj_.js} +51 -51
  41. package/dist/chunks/{matrix-definition-CBJW_4ii.cjs → matrix-definition-DanUT11P.cjs} +1 -1
  42. package/dist/chunks/{matrix-definition-I9rHB9zN.js → matrix-definition-E5gXXSTZ.js} +1 -1
  43. package/dist/chunks/matrix-formatter-BJTO8ky9.cjs +1 -0
  44. package/dist/chunks/matrix-formatter-CCXNRt3s.js +341 -0
  45. package/dist/chunks/{matrix-member-presentation-DO1VSqfh.js → matrix-member-presentation-Bw7-JCrr.js} +64 -64
  46. package/dist/chunks/matrix-member-presentation-DvXDEo0U.cjs +1 -0
  47. package/dist/chunks/{matrix-operation-contract-DoiWTUbT.cjs → matrix-operation-contract-0RxoU_M3.cjs} +1 -1
  48. package/dist/chunks/{matrix-operation-contract-D0HfzwZg.js → matrix-operation-contract-D32U2CSw.js} +19 -19
  49. package/dist/chunks/{metric-comparison-Dqc7_tnW.js → metric-comparison-BphoJ9bq.js} +1 -1
  50. package/dist/chunks/{metric-comparison-DBQ3EJTz.cjs → metric-comparison-CUmltzpz.cjs} +1 -1
  51. package/dist/chunks/pivot-header-presentation-BSZhB1g-.js +661 -0
  52. package/dist/chunks/pivot-header-presentation-EoUS5ze5.cjs +5 -0
  53. package/dist/chunks/{pivot-result-identity-8M-bZrw9.js → pivot-result-identity-BzUQiCEV.js} +4 -4
  54. package/dist/chunks/{pivot-result-identity-uTiylUNr.cjs → pivot-result-identity-gquWljbd.cjs} +1 -1
  55. package/dist/chunks/pivot-result-lifecycle-gl9cBfB-.cjs +1 -0
  56. package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-kRhiJkzg.js} +208 -149
  57. package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-BqOfk-xN.js} +471 -361
  58. package/dist/chunks/{raw-temporal-contract-CFLGwTiI.js → raw-temporal-contract-BQZIJ1fn.js} +1 -1
  59. package/dist/chunks/{raw-temporal-contract-DECbTuzA.cjs → raw-temporal-contract-CklMVG_1.cjs} +1 -1
  60. package/dist/chunks/raw-temporal-eJXecCyJ.cjs +1 -0
  61. package/dist/chunks/{report-preferences-dialog-B2fzQH1T.js → report-preferences-dialog-CHXPEl7v.js} +6 -6
  62. package/dist/chunks/{report-preferences-dialog-DcLkVqni.cjs → report-preferences-dialog-Cto0vDwI.cjs} +1 -1
  63. package/dist/chunks/{report-runtime-context-Cs65Mrxj.js → report-runtime-context-CxIoGyNM.js} +1 -1
  64. package/dist/chunks/{report-runtime-context-DzvHBPxl.cjs → report-runtime-context-CzSrCBsu.cjs} +1 -1
  65. package/dist/chunks/{selection-reducer-BIiQXbGM.js → selection-reducer-CvCBQbl2.js} +1 -1
  66. package/dist/chunks/{selection-reducer-CGKKsaPa.cjs → selection-reducer-Kl22OzIk.cjs} +1 -1
  67. package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-DwqGYx4V.js} +25 -31
  68. package/dist/chunks/semantic-format-mVI32OJH.cjs +1 -0
  69. package/dist/chunks/{source-entity-resolution-D7vnmDwm.js → source-entity-resolution-Bzefiive.js} +7 -7
  70. package/dist/chunks/{source-entity-resolution-CjbgnwyX.cjs → source-entity-resolution-R46X34SE.cjs} +1 -1
  71. package/dist/chunks/switch-DNbWXEOP.cjs +134 -0
  72. package/dist/chunks/{switch-QfKb0Iwe.js → switch-DNv-hVmt.js} +8260 -7659
  73. package/dist/chunks/{temporal-bucket-B9hMwemw.js → temporal-bucket-DlFuhCnT.js} +6 -6
  74. package/dist/chunks/{temporal-bucket-contract-IWDgyTMw.js → temporal-bucket-contract-DTLDRzgV.js} +1 -1
  75. package/dist/chunks/{temporal-bucket-contract-ZctiyXYk.cjs → temporal-bucket-contract-nTv6gvX5.cjs} +1 -1
  76. package/dist/chunks/{token-types-Dl0hcKBX.js → token-types-BC6RcUY8.js} +1 -1
  77. package/dist/chunks/{token-types-Ahh5u4iT.cjs → token-types-aWrzwonf.cjs} +1 -1
  78. package/dist/chunks/{update-policy-COjFudhl.cjs → update-policy-DRDLWe7Y.cjs} +1 -1
  79. package/dist/chunks/{update-policy-BeQqjupC.js → update-policy-DhAUtiC8.js} +2 -2
  80. package/dist/chunks/{validators-CkHsAvwB.js → validators-CsdOtZI6.js} +411 -397
  81. package/dist/chunks/validators-DFeDcdpA.cjs +1 -0
  82. package/dist/dashboard/index.cjs +1 -1
  83. package/dist/dashboard/index.js +1 -1
  84. package/dist/dashboard-authoring/index.cjs +3 -3
  85. package/dist/dashboard-authoring/index.js +233 -227
  86. package/dist/data-app-builder/index.cjs +1 -1
  87. package/dist/data-app-builder/index.js +3 -3
  88. package/dist/data-app-codegen/index.cjs +1 -1
  89. package/dist/data-app-codegen/index.js +2 -2
  90. package/dist/data-app-codegen-node/index.cjs +1 -1
  91. package/dist/data-app-codegen-node/index.js +3 -3
  92. package/dist/data-app-sdk/index.cjs +1 -1
  93. package/dist/data-app-sdk/index.js +5 -5
  94. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  95. package/dist/data-app-sdk-adapters/index.js +2 -2
  96. package/dist/data-app-sdk-validation/index.cjs +1 -1
  97. package/dist/data-app-sdk-validation/index.js +5 -5
  98. package/dist/format-utils/index.cjs +3 -3
  99. package/dist/format-utils/index.js +291 -397
  100. package/dist/index.cjs +1 -1
  101. package/dist/index.js +15 -15
  102. package/dist/pdf-table-layout/index.cjs +1 -0
  103. package/dist/pdf-table-layout/index.js +993 -0
  104. package/dist/report-runtime-context/index.cjs +1 -1
  105. package/dist/report-runtime-context/index.js +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/surfboard/index.cjs +1 -1
  108. package/dist/surfboard/index.js +2 -2
  109. package/dist/types/briefings/index.d.ts +1 -1
  110. package/dist/types/components/document-sheet/document-input-bar.d.ts +1 -3
  111. package/dist/types/components/document-sheet/document-insert-picker.d.ts +37 -0
  112. package/dist/types/components/document-sheet/document-kpi-section.d.ts +17 -0
  113. package/dist/types/components/document-sheet/document-matrix-layout-context.d.ts +10 -0
  114. package/dist/types/components/document-sheet/document-matrix-section.d.ts +27 -0
  115. package/dist/types/components/document-sheet/document-measure-layer.d.ts +45 -0
  116. package/dist/types/components/document-sheet/document-outline.d.ts +7 -1
  117. package/dist/types/components/document-sheet/document-page-navigation.d.ts +22 -0
  118. package/dist/types/components/document-sheet/document-page.d.ts +9 -5
  119. package/dist/types/components/document-sheet/document-panel/document-side-panel.d.ts +36 -0
  120. package/dist/types/components/document-sheet/document-panel/inputs-panel.d.ts +9 -0
  121. package/dist/types/components/document-sheet/document-panel/page-panel.d.ts +5 -0
  122. package/dist/types/components/document-sheet/document-panel/panel-controls.d.ts +14 -0
  123. package/dist/types/components/document-sheet/document-panel/region-panels.d.ts +11 -0
  124. package/dist/types/components/document-sheet/document-panel/section-panel.d.ts +25 -0
  125. package/dist/types/components/document-sheet/document-section-print-boundary.d.ts +9 -0
  126. package/dist/types/components/document-sheet/document-table-chrome.d.ts +22 -0
  127. package/dist/types/components/document-sheet/document-table-section.d.ts +3 -7
  128. package/dist/types/components/document-sheet/document-text-preview-context.d.ts +8 -0
  129. package/dist/types/components/document-sheet/use-first-fitting-variant.d.ts +18 -0
  130. package/dist/types/components/editor/editor-main/dashboard-variable-node.d.ts +12 -2
  131. package/dist/types/components/explorer/chart-configuration/matrix-authoring-controls.d.ts +7 -2
  132. package/dist/types/components/text-variables/variable-chip-plugin.d.ts +23 -0
  133. package/dist/types/components/text-variables/variable-chip.d.ts +18 -0
  134. package/dist/types/components/text-variables/variable-picker.d.ts +27 -0
  135. package/dist/types/components/visual/aggregated-table/utils/metric-format-resolver.d.ts +3 -3
  136. package/dist/types/components/visual/data-table/types/data-table.d.ts +4 -1
  137. package/dist/types/components/visual/pivot-table/utils/pivot-metric-formatting.d.ts +2 -2
  138. package/dist/types/components/visual/settings/table-presentation-settings.d.ts +27 -1
  139. package/dist/types/index.cjs +1 -1
  140. package/dist/types/index.js +5 -5
  141. package/dist/types/lib/dashboard-inputs/text-variable-options.d.ts +15 -0
  142. package/dist/types/lib/document/document-canvas-actions.d.ts +22 -0
  143. package/dist/types/lib/document/document-edits.d.ts +119 -0
  144. package/dist/types/lib/document/document-kpi-figure.d.ts +27 -0
  145. package/dist/types/lib/document/document-kpi-layout.d.ts +29 -0
  146. package/dist/types/lib/document/document-kpi-section-edits.d.ts +15 -0
  147. package/dist/types/lib/document/document-matrix-bands.d.ts +66 -0
  148. package/dist/types/lib/document/document-matrix-print.d.ts +11 -0
  149. package/dist/types/lib/document/document-pagination.d.ts +56 -3
  150. package/dist/types/lib/document/document-panel-target.d.ts +19 -0
  151. package/dist/types/lib/document/document-section-editor.d.ts +8 -7
  152. package/dist/types/lib/document/document-section-kinds.d.ts +49 -0
  153. package/dist/types/lib/document/document-section-query-options.d.ts +25 -0
  154. package/dist/types/lib/document/document-section-render-state.d.ts +26 -0
  155. package/dist/types/lib/document/document-section-utils.d.ts +11 -4
  156. package/dist/types/lib/document/document-table-dom.d.ts +4 -6
  157. package/dist/types/lib/document/document-table-pagination-model.d.ts +0 -5
  158. package/dist/types/lib/document/document-table-print-model.d.ts +4 -3
  159. package/dist/types/lib/document/document-table-style.d.ts +15 -4
  160. package/dist/types/lib/document/document-table-surface.d.ts +15 -0
  161. package/dist/types/lib/document/document-variables.d.ts +40 -6
  162. package/dist/types/lib/document/use-document-section-data.d.ts +39 -0
  163. package/dist/types/lib/document/use-measured-document-table-layout.d.ts +50 -0
  164. package/dist/types/lib/formatters/kpi-result-values.d.ts +20 -0
  165. package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
  166. package/dist/types/lib/hooks/query-context/use-dashboard-card-execution-snapshot.d.ts +8 -2
  167. package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +6 -0
  168. package/dist/types/lib/hooks/use-dashboard-kpi-actions.d.ts +1 -1
  169. package/dist/types/lib/hooks/use-document-section-editor.d.ts +2 -2
  170. package/dist/types/lib/hooks/use-document-section-session.d.ts +36 -0
  171. package/dist/types/lib/hooks/use-editor-preview.d.ts +17 -0
  172. package/dist/types/lib/hooks/use-is-editing-card.d.ts +7 -0
  173. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +2 -0
  174. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +2 -0
  175. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
  176. package/dist/types/lib/matrix-table/matrix-layout-read.d.ts +68 -0
  177. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +8 -1
  178. package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +4 -2
  179. package/dist/types/lib/query-context/card-execution.d.ts +30 -0
  180. package/dist/types/lib/query-context/document-section-card-query.d.ts +37 -0
  181. package/dist/types/lib/stores/dashboard-store.d.ts +12 -8
  182. package/dist/types/lib/stores/editor-store.d.ts +2 -0
  183. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
  184. package/dist/types/lib/text-variables/text-variable-types.d.ts +39 -0
  185. package/dist/types/lib/types/common-types.d.ts +34 -1
  186. package/dist/types/lib/utils/card-definition.d.ts +2 -0
  187. package/dist/types/lib/utils/card-utils.d.ts +13 -6
  188. package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
  189. package/dist/types/pdf-table-layout.d.ts +2 -0
  190. package/dist/types/shared/analytics-protocol/index.d.ts +1 -1
  191. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +45 -0
  192. package/dist/types/shared/analytics-protocol/matrix-member-presentation.d.ts +4 -0
  193. package/dist/types/shared/dashboard-authoring/document-section-cards.d.ts +56 -0
  194. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  195. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +36 -1
  196. package/dist/types/shared/format-utils/formatters/duration-formatter.d.ts +4 -1
  197. package/dist/types/shared/format-utils/formatters/index.d.ts +2 -2
  198. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -0
  199. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
  200. package/dist/types/shared/format-utils/index.d.ts +1 -0
  201. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +690 -1
  202. package/dist/types/shared/format-utils/matrix-print.d.ts +38 -0
  203. package/dist/types/shared/format-utils/pdf-table-layout/column-bands.d.ts +55 -0
  204. package/dist/types/shared/format-utils/pdf-table-layout/index.d.ts +6 -0
  205. package/dist/types/shared/format-utils/pdf-table-layout/page-size.d.ts +7 -0
  206. package/dist/types/shared/format-utils/pdf-table-layout/table-column-semantics.d.ts +106 -0
  207. package/dist/types/shared/format-utils/pdf-table-layout/table-column-widths.d.ts +13 -0
  208. package/dist/types/shared/format-utils/pdf-table-layout/table-page-geometry.d.ts +19 -0
  209. package/dist/types/shared/format-utils/pdf-table-layout/wide-table-layout.d.ts +46 -0
  210. package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
  211. package/dist/types/shared/format-utils/table-structure.d.ts +9 -0
  212. package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
  213. package/package.json +6 -1
  214. package/dist/chunks/edit-dashboard-visual-BwJ2Eljw.cjs +0 -172
  215. package/dist/chunks/field-aggregations-jSi77h9Z.cjs +0 -1
  216. package/dist/chunks/index-DhlVxvyI.cjs +0 -4
  217. package/dist/chunks/index-DrOFJOCq.cjs +0 -1424
  218. package/dist/chunks/index-F25jnH0p.cjs +0 -1
  219. package/dist/chunks/matrix-formatter-BLunke3R.js +0 -424
  220. package/dist/chunks/matrix-formatter-CveLJo6S.cjs +0 -1
  221. package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +0 -1
  222. package/dist/chunks/pivot-header-presentation-Cxz8-06f.cjs +0 -5
  223. package/dist/chunks/pivot-header-presentation-Dm9dUQsl.js +0 -415
  224. package/dist/chunks/pivot-result-lifecycle-BiERyXnS.cjs +0 -1
  225. package/dist/chunks/raw-temporal-BUeTpG76.cjs +0 -1
  226. package/dist/chunks/semantic-format-BzH69TRq.cjs +0 -1
  227. package/dist/chunks/switch--Re1K566.cjs +0 -134
  228. package/dist/chunks/validators-DVYAnnX0.cjs +0 -1
@@ -1,22 +1,119 @@
1
- import { A as me, a_ as A, u as O, l as ue, ak as Z, ah as ee } from "./validators-CkHsAvwB.js";
2
- import { G as fe, u as de } from "./matrix-operation-contract-D0HfzwZg.js";
3
- import { f as he, C as be } from "./metric-comparison-Dqc7_tnW.js";
1
+ import { A as he, a$ as A, u as w, l as be, al as oe, ai as ie } from "./validators-CsdOtZI6.js";
2
+ import { G as ge, u as ye } from "./matrix-operation-contract-D32U2CSw.js";
3
+ import { f as Ce, C as _e } from "./metric-comparison-BphoJ9bq.js";
4
4
  import { z as u } from "zod";
5
- import { m as ge } from "./source-entity-resolution-D7vnmDwm.js";
6
- import { r as ye } from "./field-dependencies-DXW4jtvJ.js";
7
- import { i as Ce, a as ve } from "./matrix-card-DOIeTmjh.js";
8
- import { v as $, a as _e, f as Ye } from "./temporal-bucket-B9hMwemw.js";
9
- import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as te } from "../value-format-preferences/index.js";
5
+ import { m as ve } from "./source-entity-resolution-Bzefiive.js";
6
+ import { r as Ye } from "./field-dependencies-v-lJNzC7.js";
7
+ import { i as Me, a as ke } from "./matrix-card-CIlz0Dnp.js";
8
+ import { v as $, i as Ie, f as Ee } from "./temporal-bucket-DlFuhCnT.js";
9
+ import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as se } from "../value-format-preferences/index.js";
10
+ const J = 8, z = 6, B = Object.freeze([]);
11
+ function Te(e) {
12
+ switch (e.type) {
13
+ case "table":
14
+ case "chart":
15
+ return e.card ? [e.card] : B;
16
+ case "kpi":
17
+ return Array.isArray(e.cards) ? e.cards : B;
18
+ default:
19
+ return B;
20
+ }
21
+ }
22
+ function ut(e, t) {
23
+ switch (e.type) {
24
+ case "table":
25
+ case "chart": {
26
+ if (!e.card) return e;
27
+ const n = t(e.card);
28
+ return n === e.card ? e : { ...e, card: n };
29
+ }
30
+ case "kpi": {
31
+ if (!Array.isArray(e.cards)) return e;
32
+ const n = e.cards.map(t);
33
+ return n.every((o, i) => o === e.cards[i]) ? e : { ...e, cards: n };
34
+ }
35
+ default:
36
+ return e;
37
+ }
38
+ }
39
+ function dt(e) {
40
+ var n;
41
+ const t = [];
42
+ for (const o of e.sheets || []) {
43
+ const i = o.id;
44
+ for (const r of o.cards || [])
45
+ t.push({ kind: "sheetCard", sheetId: i, cardId: r.id, card: r });
46
+ for (const r of o.frames || [])
47
+ for (const s of r.cards || [])
48
+ t.push({
49
+ kind: "frameCard",
50
+ sheetId: i,
51
+ frameId: r.id,
52
+ cardId: s.id,
53
+ card: s
54
+ });
55
+ for (const r of ((n = o.document) == null ? void 0 : n.sections) || [])
56
+ for (const s of Te(r))
57
+ t.push({
58
+ kind: "documentSectionCard",
59
+ sheetId: i,
60
+ sectionId: r.id,
61
+ cardId: s.id,
62
+ card: s
63
+ });
64
+ }
65
+ return t;
66
+ }
67
+ function F(e) {
68
+ return !!e && typeof e == "object" && !Array.isArray(e);
69
+ }
70
+ function ft(e) {
71
+ if (!F(e))
72
+ return [{ path: "", message: "must be an object." }];
73
+ const t = [];
74
+ e.title !== void 0 && typeof e.title != "string" && t.push({ path: "title", message: "must be a string." });
75
+ const n = e.cards;
76
+ if (!Array.isArray(n))
77
+ t.push({ path: "cards", message: "must be an array of KPI cards." });
78
+ else {
79
+ (n.length < 1 || n.length > J) && t.push({
80
+ path: "cards",
81
+ message: `must hold 1 to ${J} KPI cards.`
82
+ });
83
+ const i = /* @__PURE__ */ new Set();
84
+ n.forEach((r, s) => {
85
+ if (!F(r)) {
86
+ t.push({ path: `cards[${s}]`, message: "must be a card." });
87
+ return;
88
+ }
89
+ typeof r.id != "string" || !r.id ? t.push({
90
+ path: `cards[${s}].id`,
91
+ message: "must be a non-empty string."
92
+ }) : i.has(r.id) ? t.push({
93
+ path: `cards[${s}].id`,
94
+ message: `duplicates card id '${r.id}'.`
95
+ }) : i.add(r.id), r.type !== "kpi" && t.push({ path: `cards[${s}].type`, message: "must be 'kpi'." });
96
+ });
97
+ }
98
+ const o = e.kpi;
99
+ return F(o) ? (o.layout !== "tiles" && o.layout !== "lines" ? t.push({
100
+ path: "kpi.layout",
101
+ message: "must be 'tiles' or 'lines'."
102
+ }) : o.layout === "tiles" && Array.isArray(n) && n.length > z && t.push({
103
+ path: "kpi.layout",
104
+ message: `must be 'lines' for more than ${z} KPI cards.`
105
+ }), o.columns !== void 0 && o.columns !== 1 && o.columns !== 2 && t.push({ path: "kpi.columns", message: "must be 1 or 2." })) : t.push({ path: "kpi", message: "must be an object." }), t;
106
+ }
10
107
  const N = /* @__PURE__ */ new Set([
11
108
  "previous_period",
12
109
  "same_period_last_year",
13
110
  "start_vs_end",
14
111
  "target"
15
- ]), Me = /* @__PURE__ */ new Set([...N, "none", ""]);
112
+ ]), Ae = /* @__PURE__ */ new Set([...N, "none", ""]);
16
113
  function h(e) {
17
114
  return !!e && typeof e == "object" && !Array.isArray(e);
18
115
  }
19
- function ne(e) {
116
+ function re(e) {
20
117
  const t = h(e.preferences) ? e.preferences : void 0, n = t && h(t.kpiVisualOptions) ? t.kpiVisualOptions : void 0, o = t && h(t.tableVisualOptions) ? t.tableVisualOptions : void 0;
21
118
  return {
22
119
  preferences: t,
@@ -28,42 +125,42 @@ function ne(e) {
28
125
  tableComparisonPresent: !!o && "metricComparison" in o
29
126
  };
30
127
  }
31
- function J(e) {
128
+ function G(e) {
32
129
  const t = [], n = (o, i) => {
33
130
  if (Array.isArray(o)) {
34
- o.forEach((s, r) => n(s, `${i}[${r}]`));
131
+ o.forEach((s, a) => n(s, `${i}[${a}]`));
35
132
  return;
36
133
  }
37
134
  if (!h(o)) return;
38
- const a = o.config;
39
- if (h(a)) {
40
- const s = ne(o), r = !!(s.kpiComparisonPresent || s.tableComparisonPresent), m = a.metricColumns, p = Array.isArray(m) ? m.flatMap(
135
+ const r = o.config;
136
+ if (h(r)) {
137
+ const s = re(o), a = !!(s.kpiComparisonPresent || s.tableComparisonPresent), m = r.metricColumns, p = Array.isArray(m) ? m.flatMap(
41
138
  (l, c) => h(l) ? [{ index: c, metric: l }] : []
42
139
  ) : [];
43
- if ((p.some(({ metric: l }) => "comparisonType" in l) || r) && t.push({
140
+ if ((p.some(({ metric: l }) => "comparisonType" in l) || a) && t.push({
44
141
  path: i,
45
142
  card: o,
46
143
  metrics: p,
47
144
  malformedMetricIndexes: Array.isArray(m) ? m.flatMap(
48
145
  (l, c) => h(l) ? [] : [c]
49
146
  ) : [],
50
- malformedMetricColumns: "metricColumns" in a && !Array.isArray(m),
51
- hasLegacyPresentation: r
52
- }), "metricColumns" in a || r) return;
147
+ malformedMetricColumns: "metricColumns" in r && !Array.isArray(m),
148
+ hasLegacyPresentation: a
149
+ }), "metricColumns" in r || a) return;
53
150
  }
54
151
  Object.entries(o).forEach(
55
- ([s, r]) => n(r, i ? `${i}.${s}` : s)
152
+ ([s, a]) => n(a, i ? `${i}.${s}` : s)
56
153
  );
57
154
  };
58
155
  return n(e, "$"), t;
59
156
  }
60
- const oe = {
157
+ const ae = {
61
158
  difference: "difference",
62
159
  change: "percent_change",
63
160
  change_difference: "both",
64
161
  ratio: "ratio"
65
162
  };
66
- function U(e, t) {
163
+ function Q(e, t) {
67
164
  if (!e) return;
68
165
  const n = Object.fromEntries(
69
166
  t.flatMap(
@@ -72,7 +169,7 @@ function U(e, t) {
72
169
  );
73
170
  return Object.keys(n).length ? n : void 0;
74
171
  }
75
- function ke(e, t, n) {
172
+ function De(e, t, n) {
76
173
  if (e !== void 0) {
77
174
  if (!h(e)) {
78
175
  n.push({
@@ -102,36 +199,36 @@ function ke(e, t, n) {
102
199
  });
103
200
  }
104
201
  }
105
- function L(e, t) {
106
- const n = t === "kpi" ? e.calculationType : e.calculatedAs, o = t === "table" && n === void 0 ? "both" : oe[String(n)], i = h(e.formatOptions) ? e.formatOptions : void 0, a = h(e.conditionalLabels) ? e.conditionalLabels : void 0, s = h(
202
+ function R(e, t) {
203
+ const n = t === "kpi" ? e.calculationType : e.calculatedAs, o = t === "table" && n === void 0 ? "both" : ae[String(n)], i = h(e.formatOptions) ? e.formatOptions : void 0, r = h(e.conditionalLabels) ? e.conditionalLabels : void 0, s = h(
107
204
  t === "kpi" ? e.colorConfig : e.colors
108
- ) ? t === "kpi" ? e.colorConfig : e.colors : void 0, r = {};
109
- if (o && (r.displayMode = o), typeof (i == null ? void 0 : i.decimalPlaces) == "number" && (r.precision = i.decimalPlaces), t === "kpi") {
205
+ ) ? t === "kpi" ? e.colorConfig : e.colors : void 0, a = {};
206
+ if (o && (a.displayMode = o), typeof (i == null ? void 0 : i.decimalPlaces) == "number" && (a.precision = i.decimalPlaces), t === "kpi") {
110
207
  const l = e.showArrow !== !1, c = e.showColor !== !1;
111
- r.indicatorStyle = l ? c ? "arrow_badge" : "arrow" : c ? "badge" : "none", r.showColor = c, (e.position === "left" || e.position === "right" || e.position === "top") && (r.position = e.position), typeof e.conditionalLabel == "boolean" && (r.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (r.labelName = e.labelName);
112
- } else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (r.indicatorStyle = e.indicatorStyle);
113
- const m = a ? {
114
- ...U(a, ["increase", "decrease"]),
115
- ...typeof a.noChange == "string" ? { neutral: a.noChange } : typeof a.neutral == "string" ? { neutral: a.neutral } : {}
208
+ a.indicatorStyle = l ? c ? "arrow_badge" : "arrow" : c ? "badge" : "none", a.showColor = c, (e.position === "left" || e.position === "right" || e.position === "top") && (a.position = e.position), typeof e.conditionalLabel == "boolean" && (a.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (a.labelName = e.labelName);
209
+ } else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (a.indicatorStyle = e.indicatorStyle);
210
+ const m = r ? {
211
+ ...Q(r, ["increase", "decrease"]),
212
+ ...typeof r.noChange == "string" ? { neutral: r.noChange } : typeof r.neutral == "string" ? { neutral: r.neutral } : {}
116
213
  } : void 0;
117
- m && Object.keys(m).length && (r.conditionalLabels = m);
214
+ m && Object.keys(m).length && (a.conditionalLabels = m);
118
215
  const p = s ? {
119
- ...U(s, ["increase", "decrease"]),
216
+ ...Q(s, ["increase", "decrease"]),
120
217
  ...typeof s.noChange == "string" ? { neutral: s.noChange } : typeof s.neutral == "string" ? { neutral: s.neutral } : {}
121
218
  } : void 0;
122
- return p && Object.keys(p).length && (r.colors = p), r;
219
+ return p && Object.keys(p).length && (a.colors = p), a;
123
220
  }
124
- function G(e) {
125
- return { ...be, ...e };
221
+ function W(e) {
222
+ return { ..._e, ...e };
126
223
  }
127
- function z(e) {
224
+ function X(e) {
128
225
  return e.some(({ metric: t }) => t.comparisonType === "previous_period" || t.comparisonType === "same_period_last_year" || t.comparisonType === "target" ? !0 : h(t.comparison) && t.comparison.mode === "explicit");
129
226
  }
130
- function F(e) {
227
+ function L(e) {
131
228
  const t = e.card.config;
132
229
  return e.metrics.length === 2 && (t.groupByColumns === void 0 || Array.isArray(t.groupByColumns) && t.groupByColumns.length === 0);
133
230
  }
134
- function K(e, t, n, o) {
231
+ function Z(e, t, n, o) {
135
232
  const i = t === "kpi" ? [
136
233
  "enabled",
137
234
  "calculationType",
@@ -159,12 +256,12 @@ function K(e, t, n, o) {
159
256
  message: `Unknown legacy comparison presentation field "${l}" cannot be dropped automatically.`
160
257
  });
161
258
  });
162
- const a = t === "kpi" ? "calculationType" : "calculatedAs";
163
- e[a] !== void 0 && !oe[String(e[a])] && o.push({
259
+ const r = t === "kpi" ? "calculationType" : "calculatedAs";
260
+ e[r] !== void 0 && !ae[String(e[r])] && o.push({
164
261
  severity: "error",
165
262
  code: "invalid_legacy_comparison_presentation",
166
- path: `${n}.${a}`,
167
- message: `Legacy comparison ${a} is unsupported.`
263
+ path: `${n}.${r}`,
264
+ message: `Legacy comparison ${r} is unsupported.`
168
265
  }), t === "kpi" && e.position !== void 0 && !["left", "right", "top"].includes(String(e.position)) && o.push({
169
266
  severity: "error",
170
267
  code: "invalid_legacy_comparison_presentation",
@@ -189,8 +286,8 @@ function K(e, t, n, o) {
189
286
  });
190
287
  return;
191
288
  }
192
- Object.entries(e[l]).forEach(([b, f]) => {
193
- c.includes(b) ? typeof f != "string" && o.push({
289
+ Object.entries(e[l]).forEach(([b, d]) => {
290
+ c.includes(b) ? typeof d != "string" && o.push({
194
291
  severity: "error",
195
292
  code: "invalid_legacy_comparison_presentation",
196
293
  path: `${n}.${l}.${b}`,
@@ -217,9 +314,9 @@ function K(e, t, n, o) {
217
314
  code: "invalid_legacy_comparison_presentation",
218
315
  path: `${n}.indicatorStyle`,
219
316
  message: "Legacy comparison indicatorStyle is unsupported."
220
- }), ke(e.formatOptions, `${n}.formatOptions`, o);
221
- const m = L(e, t);
222
- he(m, n).errors.forEach((l) => {
317
+ }), De(e.formatOptions, `${n}.formatOptions`, o);
318
+ const m = R(e, t);
319
+ Ce(m, n).errors.forEach((l) => {
223
320
  o.push({
224
321
  severity: "error",
225
322
  code: "invalid_legacy_comparison_presentation",
@@ -228,15 +325,15 @@ function K(e, t, n, o) {
228
325
  });
229
326
  });
230
327
  }
231
- function Q(e) {
232
- const t = ne(e.card), n = t.kpiComparison ? L(t.kpiComparison, "kpi") : void 0, o = t.tableComparison ? L(t.tableComparison, "table") : void 0;
328
+ function ee(e) {
329
+ const t = re(e.card), n = t.kpiComparison ? R(t.kpiComparison, "kpi") : void 0, o = t.tableComparison ? R(t.tableComparison, "table") : void 0;
233
330
  return { namespaces: t, kpi: n, table: o, presentation: n || o };
234
331
  }
235
- function Ee(e) {
236
- const t = h(e.preferences) ? e.preferences : {}, n = h(t.kpiVisualOptions) ? t.kpiVisualOptions : {}, o = h(n.metricComparison) ? n.metricComparison : {}, i = h(t.tableVisualOptions) ? t.tableVisualOptions : {}, a = h(i.metricComparison) ? i.metricComparison : {};
237
- return n.lowerIsBetter === !0 || o.lowerIsBetter === !0 || a.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
332
+ function Ne(e) {
333
+ const t = h(e.preferences) ? e.preferences : {}, n = h(t.kpiVisualOptions) ? t.kpiVisualOptions : {}, o = h(n.metricComparison) ? n.metricComparison : {}, i = h(t.tableVisualOptions) ? t.tableVisualOptions : {}, r = h(i.metricComparison) ? i.metricComparison : {};
334
+ return n.lowerIsBetter === !0 || o.lowerIsBetter === !0 || r.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
238
335
  }
239
- function Ie(e) {
336
+ function Oe(e) {
240
337
  switch (e.comparisonType) {
241
338
  case "previous_period":
242
339
  return { mode: "explicit", spec: { kind: "previous_period" } };
@@ -251,7 +348,7 @@ function Ie(e) {
251
348
  return;
252
349
  }
253
350
  }
254
- function Te(e) {
351
+ function we(e) {
255
352
  const t = h(e.preferences) ? e.preferences : void 0;
256
353
  if (!t) return;
257
354
  const n = h(t.kpiVisualOptions) ? t.kpiVisualOptions : void 0;
@@ -259,13 +356,13 @@ function Te(e) {
259
356
  const o = h(t.tableVisualOptions) ? t.tableVisualOptions : void 0, i = o && h(o.metricComparison) ? o.metricComparison : void 0;
260
357
  i && delete i.lowerIsBetter;
261
358
  }
262
- function at(e) {
263
- const t = J(e);
359
+ function ht(e) {
360
+ const t = G(e);
264
361
  if (!t.length)
265
362
  return { document: e, changed: !1, changes: [], diagnostics: [] };
266
363
  const n = [];
267
364
  if (t.forEach((s) => {
268
- var r, m, p, l;
365
+ var a, m, p, l;
269
366
  if (s.malformedMetricColumns && n.push({
270
367
  severity: "error",
271
368
  code: "malformed_metric_columns",
@@ -280,43 +377,43 @@ function at(e) {
280
377
  });
281
378
  }), s.metrics.forEach(({ metric: c, index: b }) => {
282
379
  if (!("comparisonType" in c)) return;
283
- const f = `${s.path}.config.metricColumns[${b}]`, y = String(c.comparisonType || "");
380
+ const d = `${s.path}.config.metricColumns[${b}]`, y = String(c.comparisonType || "");
284
381
  "comparison" in c && n.push({
285
382
  severity: "error",
286
383
  code: "conflicting_comparison_contracts",
287
- path: f,
384
+ path: d,
288
385
  message: "Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."
289
386
  });
290
- const C = h(c.parameters) ? c.parameters : void 0, _ = C && h(C.windowTransform) ? C.windowTransform : void 0;
291
- N.has(y) && (_ == null ? void 0 : _.function) === "previous_period_delta" && n.push({
387
+ const C = h(c.parameters) ? c.parameters : void 0, v = C && h(C.windowTransform) ? C.windowTransform : void 0;
388
+ N.has(y) && (v == null ? void 0 : v.function) === "previous_period_delta" && n.push({
292
389
  severity: "error",
293
390
  code: "conflicting_comparison_window_transform",
294
- path: f,
391
+ path: d,
295
392
  message: "A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."
296
- }), Me.has(y) || n.push({
393
+ }), Ae.has(y) || n.push({
297
394
  severity: "error",
298
395
  code: "unsupported_comparison_type",
299
- path: `${f}.comparisonType`,
396
+ path: `${d}.comparisonType`,
300
397
  message: `Unsupported legacy metric comparison type "${y}".`
301
398
  }), c.comparisonType === "target" && (typeof c.targetValue != "number" || !Number.isFinite(c.targetValue)) && n.push({
302
399
  severity: "error",
303
400
  code: "invalid_target_value",
304
- path: `${f}.targetValue`,
401
+ path: `${d}.targetValue`,
305
402
  message: "Legacy target comparison requires a finite metric targetValue."
306
403
  }), c.comparisonType === "start_vs_end" && n.push({
307
404
  severity: "error",
308
405
  code: "unsupported_start_vs_end",
309
- path: `${f}.comparisonType`,
406
+ path: `${d}.comparisonType`,
310
407
  message: "start_vs_end is retired and cannot be migrated automatically."
311
408
  }), c.targetValue !== void 0 && c.comparisonType !== "target" && n.push({
312
409
  severity: "warning",
313
410
  code: "stray_target_value",
314
- path: `${f}.targetValue`,
411
+ path: `${d}.targetValue`,
315
412
  message: "Dead non-target targetValue will be removed without changing the baseline."
316
413
  });
317
414
  }), s.hasLegacyPresentation) {
318
- const { namespaces: c, kpi: b, table: f } = Q(s), y = [
319
- (r = c.kpiOptions) == null ? void 0 : r.lowerIsBetter,
415
+ const { namespaces: c, kpi: b, table: d } = ee(s), y = [
416
+ (a = c.kpiOptions) == null ? void 0 : a.lowerIsBetter,
320
417
  (m = c.kpiComparison) == null ? void 0 : m.lowerIsBetter,
321
418
  (p = c.tableComparison) == null ? void 0 : p.lowerIsBetter
322
419
  ].filter((C) => typeof C == "boolean");
@@ -345,22 +442,22 @@ function at(e) {
345
442
  code: "conflicting_comparison_presentation_contracts",
346
443
  path: `${s.path}.preferences.comparisonPresentation`,
347
444
  message: "Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."
348
- }), c.kpiComparison && typeof c.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (c.preferences || {}) && F(s) && n.push({
445
+ }), c.kpiComparison && typeof c.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (c.preferences || {}) && L(s) && n.push({
349
446
  severity: "error",
350
447
  code: "conflicting_comparison_presentation_contracts",
351
448
  path: `${s.path}.preferences.metricPairComparisonEnabled`,
352
449
  message: "Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."
353
- }), c.kpiComparison && K(
450
+ }), c.kpiComparison && Z(
354
451
  c.kpiComparison,
355
452
  "kpi",
356
453
  `${s.path}.preferences.kpiVisualOptions.metricComparison`,
357
454
  n
358
- ), c.tableComparison && K(
455
+ ), c.tableComparison && Z(
359
456
  c.tableComparison,
360
457
  "table",
361
458
  `${s.path}.preferences.tableVisualOptions.metricComparison`,
362
459
  n
363
- ), b && f && JSON.stringify(G(b)) !== JSON.stringify(G(f)) && n.push({
460
+ ), b && d && JSON.stringify(W(b)) !== JSON.stringify(W(d)) && n.push({
364
461
  severity: "error",
365
462
  code: "conflicting_legacy_presentation_namespaces",
366
463
  path: `${s.path}.preferences`,
@@ -369,36 +466,36 @@ function at(e) {
369
466
  }
370
467
  }), n.some((s) => s.severity === "error"))
371
468
  return { document: e, changed: !1, changes: [], diagnostics: n };
372
- const o = JSON.parse(JSON.stringify(e)), i = J(o), a = [];
469
+ const o = JSON.parse(JSON.stringify(e)), i = G(o), r = [];
373
470
  return i.forEach((s) => {
374
471
  var m;
375
- const r = Ee(s.card);
472
+ const a = Ne(s.card);
376
473
  if (s.metrics.forEach(({ metric: p, index: l }) => {
377
474
  if (!("comparisonType" in p)) return;
378
- const c = String(p.comparisonType || ""), b = `${s.path}.config.metricColumns[${l}]`, f = Ie(p), y = ["comparisonType"];
379
- delete p.comparisonType, "targetValue" in p && (delete p.targetValue, y.push("targetValue")), "comparisonDisplay" in p && (delete p.comparisonDisplay, y.push("comparisonDisplay")), f ? p.comparison = f : delete p.comparison, N.has(c) && (p.comparisonPolarity = r), a.push({
475
+ const c = String(p.comparisonType || ""), b = `${s.path}.config.metricColumns[${l}]`, d = Oe(p), y = ["comparisonType"];
476
+ delete p.comparisonType, "targetValue" in p && (delete p.targetValue, y.push("targetValue")), "comparisonDisplay" in p && (delete p.comparisonDisplay, y.push("comparisonDisplay")), d ? p.comparison = d : delete p.comparison, N.has(c) && (p.comparisonPolarity = a), r.push({
380
477
  kind: "metric",
381
478
  path: b,
382
479
  metricId: typeof p.id == "string" ? p.id : void 0,
383
480
  legacyType: c,
384
- comparison: f,
385
- comparisonPolarity: N.has(c) ? r : void 0,
481
+ comparison: d,
482
+ comparisonPolarity: N.has(c) ? a : void 0,
386
483
  removedFields: y
387
484
  });
388
- }), Te(s.card), s.hasLegacyPresentation) {
389
- const { namespaces: p, presentation: l } = Q(s), c = (m = p.kpiComparison) == null ? void 0 : m.enabled, b = {
485
+ }), we(s.card), s.hasLegacyPresentation) {
486
+ const { namespaces: p, presentation: l } = ee(s), c = (m = p.kpiComparison) == null ? void 0 : m.enabled, b = {
390
487
  ...l
391
488
  };
392
- typeof c == "boolean" && z(s.metrics) && (b.showComparison = c);
393
- const f = typeof c == "boolean" && F(s) ? c : void 0, y = typeof c == "boolean" && !z(s.metrics) && !F(s) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, C = p.preferences, _ = [];
489
+ typeof c == "boolean" && X(s.metrics) && (b.showComparison = c);
490
+ const d = typeof c == "boolean" && L(s) ? c : void 0, y = typeof c == "boolean" && !X(s.metrics) && !L(s) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, C = p.preferences, v = [];
394
491
  s.metrics.forEach(({ metric: D }) => {
395
- "comparisonPolarity" in D || (D.comparisonPolarity = r, typeof D.id == "string" && _.push(D.id));
396
- }), Object.keys(b).length && (C.comparisonPresentation = b), f !== void 0 && (C.metricPairComparisonEnabled = f), p.kpiOptions && delete p.kpiOptions.metricComparison, p.tableOptions && delete p.tableOptions.metricComparison, a.push({
492
+ "comparisonPolarity" in D || (D.comparisonPolarity = a, typeof D.id == "string" && v.push(D.id));
493
+ }), Object.keys(b).length && (C.comparisonPresentation = b), d !== void 0 && (C.metricPairComparisonEnabled = d), p.kpiOptions && delete p.kpiOptions.metricComparison, p.tableOptions && delete p.tableOptions.metricComparison, r.push({
397
494
  kind: "presentation",
398
495
  path: `${s.path}.preferences`,
399
496
  comparisonPresentation: Object.keys(b).length ? b : void 0,
400
- metricPairComparisonEnabled: f,
401
- comparisonPolarityMetricIds: _,
497
+ metricPairComparisonEnabled: d,
498
+ comparisonPolarityMetricIds: v,
402
499
  intentionallyDiscardedFields: y,
403
500
  removedFields: [
404
501
  ...p.kpiComparison ? ["kpiVisualOptions.metricComparison"] : [],
@@ -406,132 +503,132 @@ function at(e) {
406
503
  ]
407
504
  });
408
505
  }
409
- }), { document: o, changed: !0, changes: a, diagnostics: n };
506
+ }), { document: o, changed: !0, changes: r, diagnostics: n };
410
507
  }
411
- function d(e) {
508
+ function f(e) {
412
509
  return typeof e == "string" && e.trim().length > 0 ? e.trim() : null;
413
510
  }
414
- function ie(e) {
511
+ function ce(e) {
415
512
  return Array.from(new Set(e.filter((t) => !!t)));
416
513
  }
417
- function Ae(e) {
418
- const t = d(e.table), n = d(e.schema), o = d(e.catalog) || d(e.database);
419
- return t ? ie([
514
+ function $e(e) {
515
+ const t = f(e.table), n = f(e.schema), o = f(e.catalog) || f(e.database);
516
+ return t ? ce([
420
517
  t,
421
518
  n ? `${n}.${t}` : null,
422
519
  o ? `${o}.${t}` : null,
423
520
  o && n ? `${o}.${n}.${t}` : null
424
521
  ]) : [];
425
522
  }
426
- function W(e) {
427
- const t = d(e.table) || d(e.tableName);
428
- return ie([
429
- d(e.name),
430
- d(e.alias),
431
- ...Ae({
523
+ function te(e) {
524
+ const t = f(e.table) || f(e.tableName);
525
+ return ce([
526
+ f(e.name),
527
+ f(e.alias),
528
+ ...$e({
432
529
  table: t,
433
- schema: d(e.schema) || d(e.schemaName),
434
- catalog: d(e.catalog),
435
- database: d(e.database) || d(e.databaseName)
530
+ schema: f(e.schema) || f(e.schemaName),
531
+ catalog: f(e.catalog),
532
+ database: f(e.database) || f(e.databaseName)
436
533
  })
437
534
  ]);
438
535
  }
439
- function De(e, t) {
440
- const n = d(e.domainId), o = d(t.domainId);
536
+ function Pe(e, t) {
537
+ const n = f(e.domainId), o = f(t.domainId);
441
538
  if (n && o && n !== o)
442
539
  return !0;
443
540
  if (e.type === "dataset")
444
541
  return !1;
445
- const i = d(e.id), a = d(t.id);
446
- if (i && a && i !== a)
542
+ const i = f(e.id), r = f(t.id);
543
+ if (i && r && i !== r)
447
544
  return !0;
448
- const s = d(e.connectionId), r = d(t.connectionId);
449
- return !!(s && r && s !== r);
545
+ const s = f(e.connectionId), a = f(t.connectionId);
546
+ return !!(s && a && s !== a);
450
547
  }
451
- function x(e, t = !1) {
452
- return d(e.table) || d(e.tableName) || (e.type !== "dataset" || t ? d(e.name) : null);
548
+ function j(e, t = !1) {
549
+ return f(e.table) || f(e.tableName) || (e.type !== "dataset" || t ? f(e.name) : null);
453
550
  }
454
551
  function V(e) {
455
- return d(e.catalog) || d(e.database) || d(e.databaseName);
552
+ return f(e.catalog) || f(e.database) || f(e.databaseName);
456
553
  }
457
- function R(e) {
458
- return d(e.schema) || d(e.schemaName);
554
+ function x(e) {
555
+ return f(e.schema) || f(e.schemaName);
459
556
  }
460
- function w(e) {
557
+ function O(e) {
461
558
  return e.length === 1 ? e[0] : void 0;
462
559
  }
463
- function Ne(e, t) {
464
- const n = x(t, !0), o = V(t), i = R(t);
560
+ function Be(e, t) {
561
+ const n = j(t, !0), o = V(t), i = x(t);
465
562
  if (!(!n || !o && !i))
466
- return w(
467
- e.filter((a) => {
468
- const s = a;
469
- return !(x(s) !== n || o && V(s) !== o || i && R(s) !== i);
563
+ return O(
564
+ e.filter((r) => {
565
+ const s = r;
566
+ return !(j(s) !== n || o && V(s) !== o || i && x(s) !== i);
470
567
  })
471
568
  );
472
569
  }
473
- function E(e, t) {
570
+ function I(e, t) {
474
571
  if (!t || !(e != null && e.length))
475
572
  return;
476
573
  const n = e.filter(
477
- (r) => !De(r, t)
574
+ (a) => !Pe(a, t)
478
575
  );
479
576
  if (t.type === "dataset") {
480
- const r = d(t.id);
481
- if (r)
482
- return w(
577
+ const a = f(t.id);
578
+ if (a)
579
+ return O(
483
580
  n.filter(
484
- (p) => p.type === "dataset" && d(p.id) === r
581
+ (p) => p.type === "dataset" && f(p.id) === a
485
582
  )
486
583
  );
487
- if (d(t.domainId)) {
488
- const p = d(t.name);
489
- return w(
584
+ if (f(t.domainId)) {
585
+ const p = f(t.name);
586
+ return O(
490
587
  n.filter(
491
- (l) => l.type === "dataset" && d(l.name) === p
588
+ (l) => l.type === "dataset" && f(l.name) === p
492
589
  )
493
590
  );
494
591
  }
495
592
  }
496
593
  let o = [];
497
594
  if (t.type === "dataset") {
498
- const r = d(t.name);
595
+ const a = f(t.name);
499
596
  if (o = n.filter(
500
- (m) => m.type === "dataset" && d(m.name) === r
597
+ (m) => m.type === "dataset" && f(m.name) === a
501
598
  ), o.length === 1)
502
599
  return o[0];
503
600
  }
504
- if (!!(x(t, !0) && (V(t) || R(t))))
505
- return Ne(n, t);
601
+ if (!!(j(t, !0) && (V(t) || x(t))))
602
+ return Be(n, t);
506
603
  if (o.length > 1)
507
604
  return;
508
- const a = W(t);
509
- if (a.length === 0)
605
+ const r = te(t);
606
+ if (r.length === 0)
510
607
  return;
511
- const s = n.filter((r) => W(
512
- r
608
+ const s = n.filter((a) => te(
609
+ a
513
610
  ).some(
514
- (p) => a.includes(p)
611
+ (p) => r.includes(p)
515
612
  ));
516
- return w(s);
613
+ return O(s);
517
614
  }
518
- function B(e, t) {
519
- const n = E(e, t);
615
+ function S(e, t) {
616
+ const n = I(e, t);
520
617
  return n ? { ...t, ...n } : t;
521
618
  }
522
- function ct(e, t) {
619
+ function bt(e, t) {
523
620
  const n = t || [];
524
621
  return n.length === 0 ? e : {
525
622
  ...e,
526
- baseEntity: B(n, e.baseEntity),
623
+ baseEntity: S(n, e.baseEntity),
527
624
  joins: e.joins.map((o) => ({
528
625
  ...o,
529
- source: B(n, o.source),
530
- target: B(n, o.target)
626
+ source: S(n, o.source),
627
+ target: S(n, o.target)
531
628
  }))
532
629
  };
533
630
  }
534
- function lt(e, t) {
631
+ function gt(e, t) {
535
632
  if (!(e != null && e.joins.length))
536
633
  return [];
537
634
  const n = [
@@ -539,7 +636,7 @@ function lt(e, t) {
539
636
  ...e.joins.flatMap((i) => [i.source, i.target])
540
637
  ], o = [];
541
638
  return n.forEach((i) => {
542
- !E(t, i) && !E(o, i) && o.push(i);
639
+ !I(t, i) && !I(o, i) && o.push(i);
543
640
  }), o;
544
641
  }
545
642
  function M(e) {
@@ -548,14 +645,14 @@ function M(e) {
548
645
  function k(e) {
549
646
  return M(e) && typeof e.name == "string";
550
647
  }
551
- function H(e) {
648
+ function q(e) {
552
649
  return !M(e) || e.kind !== "semantic" && e.kind !== "physical" || (e.kind === "semantic" ? [e.datasetId, e.datasetName, e.connectionId] : [e.databaseName, e.schemaName]).some(
553
650
  (n) => n !== void 0 && typeof n != "string"
554
- ) ? !1 : me(
651
+ ) ? !1 : he(
555
652
  e
556
653
  );
557
654
  }
558
- function we(e) {
655
+ function Fe(e) {
559
656
  return [
560
657
  ...e.groupByColumns ?? [],
561
658
  ...e.metricColumns ?? [],
@@ -564,38 +661,38 @@ function we(e) {
564
661
  ...e.sortByColumns ?? []
565
662
  ];
566
663
  }
567
- function S(e) {
664
+ function U(e) {
568
665
  return e ? [
569
666
  ...(e.conditions ?? []).flatMap(
570
667
  (t) => t.field ? [t.field] : []
571
668
  ),
572
- ...(e.groups ?? []).flatMap(S)
669
+ ...(e.groups ?? []).flatMap(U)
573
670
  ] : [];
574
671
  }
575
- function se(e) {
672
+ function le(e) {
576
673
  var o, i;
577
- const t = "parameters" in e ? S((o = e.parameters) == null ? void 0 : o.filters) : [], n = ((i = e.calculatedFormula) == null ? void 0 : i.inputFields) ?? [];
674
+ const t = "parameters" in e ? U((o = e.parameters) == null ? void 0 : o.filters) : [], n = ((i = e.calculatedFormula) == null ? void 0 : i.inputFields) ?? [];
578
675
  return [
579
676
  ...t,
580
- ...n.flatMap((a) => se(a))
677
+ ...n.flatMap((r) => le(r))
581
678
  ];
582
679
  }
583
- function re(e) {
680
+ function pe(e) {
584
681
  const t = Array.isArray(e == null ? void 0 : e.selectedEntities) ? e.selectedEntities.filter(k) : [];
585
- return O(
682
+ return w(
586
683
  t.flatMap((n) => {
587
- const o = I(n, e);
684
+ const o = E(n, e);
588
685
  return o ? [o] : [];
589
686
  })
590
687
  );
591
688
  }
592
- function j(e, t) {
689
+ function H(e, t) {
593
690
  const n = t.filter(
594
691
  (o) => A(o, e)
595
692
  );
596
693
  return n.length === 1 ? n[0] : void 0;
597
694
  }
598
- function Oe(e, t) {
695
+ function Le(e, t) {
599
696
  if (t.kind === "semantic")
600
697
  return !!(e.entityId && e.entityId === t.datasetId || e.entityName && e.entityName === t.datasetName);
601
698
  const n = [
@@ -605,68 +702,68 @@ function Oe(e, t) {
605
702
  ].filter((o) => !!o).join(".");
606
703
  return !!(e.entityName === t.tableName || e.qualifiedEntityName && e.qualifiedEntityName === n);
607
704
  }
608
- function $e(e, t) {
705
+ function Se(e, t) {
609
706
  const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(k) : [], o = e.entityName || e.qualifiedEntityName;
610
707
  if (!o) return;
611
- const i = e.entityId ? E(n, {
708
+ const i = e.entityId ? I(n, {
612
709
  type: "dataset",
613
710
  id: e.entityId,
614
711
  name: o
615
712
  }) : void 0;
616
713
  if (i)
617
- return I(i, t);
618
- const a = E(n, {
714
+ return E(i, t);
715
+ const r = I(n, {
619
716
  type: (t == null ? void 0 : t.mode) === "semanticDomain" ? "dataset" : "table",
620
717
  name: (t == null ? void 0 : t.mode) === "semanticDomain" ? o : e.qualifiedEntityName || o
621
718
  });
622
- if (a && !((t == null ? void 0 : t.mode) === "semanticDomain" && e.entityId && ![
719
+ if (r && !((t == null ? void 0 : t.mode) === "semanticDomain" && e.entityId && ![
623
720
  e.entityName,
624
721
  e.qualifiedEntityName,
625
- a.name,
626
- a.type === "dataset" && "table" in a ? a.table : void 0
627
- ].filter((r) => !!r).includes(e.entityId)))
628
- return I(a, t);
629
- }
630
- function Pe(e, t, n) {
631
- var a, s, r;
632
- const o = !!(ue(e) || (s = (a = e.calculatedFormula) == null ? void 0 : a.inputFields) != null && s.length || (r = e.derivedField) != null && r.inputs && Object.keys(e.derivedField.inputs).length > 0);
722
+ r.name,
723
+ r.type === "dataset" && "table" in r ? r.table : void 0
724
+ ].filter((a) => !!a).includes(e.entityId)))
725
+ return E(r, t);
726
+ }
727
+ function Re(e, t, n) {
728
+ var r, s, a;
729
+ const o = !!(be(e) || (s = (r = e.calculatedFormula) == null ? void 0 : r.inputFields) != null && s.length || (a = e.derivedField) != null && a.inputs && Object.keys(e.derivedField.inputs).length > 0);
633
730
  if (e.source && !o) {
634
- const m = j(
731
+ const m = H(
635
732
  e.source,
636
733
  n
637
734
  );
638
735
  return m ? [m] : [];
639
736
  }
640
- const i = ye(e).datasets;
641
- return O(
737
+ const i = Ye(e).datasets;
738
+ return w(
642
739
  i.flatMap((m) => {
643
- const l = e.source && Oe(m, e.source) && j(e.source, n) || $e(m, t);
740
+ const l = e.source && Le(m, e.source) && H(e.source, n) || Se(m, t);
644
741
  return l ? [l] : [];
645
742
  })
646
743
  );
647
744
  }
648
- function Fe(e, t) {
649
- const n = re(t), o = we(e), i = S(e.filters), a = [
745
+ function je(e, t) {
746
+ const n = pe(t), o = Fe(e), i = U(e.filters), r = [
650
747
  ...i,
651
- ...[...o, ...i].flatMap(se)
748
+ ...[...o, ...i].flatMap(le)
652
749
  ];
653
- return O(
654
- [...o, ...a].flatMap(
655
- (s) => Pe(s, t, n)
750
+ return w(
751
+ [...o, ...r].flatMap(
752
+ (s) => Re(s, t, n)
656
753
  )
657
754
  );
658
755
  }
659
- function Be(e, t, n) {
756
+ function Ve(e, t, n) {
660
757
  var i;
661
- return H(e) ? !!!((i = t == null ? void 0 : t.selectedEntities) != null && i.length) || !n ? e : j(e, re(t)) : void 0;
758
+ return q(e) ? !!!((i = t == null ? void 0 : t.selectedEntities) != null && i.length) || !n ? e : H(e, pe(t)) : void 0;
662
759
  }
663
- function I(e, t) {
760
+ function E(e, t) {
664
761
  var p, l;
665
- const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(k) : void 0, o = E(n, e), i = o ? { ...e, ...o } : e, a = "domainId" in i && typeof i.domainId == "string" && !!i.domainId.trim();
666
- if ((t == null ? void 0 : t.mode) === "semanticDomain" && !a)
762
+ const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(k) : void 0, o = I(n, e), i = o ? { ...e, ...o } : e, r = "domainId" in i && typeof i.domainId == "string" && !!i.domainId.trim();
763
+ if ((t == null ? void 0 : t.mode) === "semanticDomain" && !r)
667
764
  return;
668
765
  if ((t == null ? void 0 : t.mode) !== "database" && i.type === "dataset") {
669
- const c = ge(
766
+ const c = ve(
670
767
  {
671
768
  entities: [i],
672
769
  semanticDomainId: t == null ? void 0 : t.semanticDomainId,
@@ -685,67 +782,67 @@ function I(e, t) {
685
782
  }
686
783
  if ((t == null ? void 0 : t.mode) === "semanticDomain")
687
784
  return;
688
- const s = i.connectionId || (t == null ? void 0 : t.connectionId), r = i.type === "dataset" && "table" in i && i.table ? i.table : i.name;
689
- if (!s || !r)
785
+ const s = i.connectionId || (t == null ? void 0 : t.connectionId), a = i.type === "dataset" && "table" in i && i.table ? i.table : i.name;
786
+ if (!s || !a)
690
787
  return;
691
788
  const m = {
692
789
  kind: "physical",
693
790
  connectionId: s,
694
791
  connectionType: i.connectionType || (t == null ? void 0 : t.connectionType),
695
- tableName: r,
792
+ tableName: a,
696
793
  databaseName: i.database || ((p = t == null ? void 0 : t.dbSelection) == null ? void 0 : p.database),
697
794
  schemaName: i.schema || ((l = t == null ? void 0 : t.dbSelection) == null ? void 0 : l.schema),
698
795
  dialect: i.dialect
699
796
  };
700
- return H(m) ? m : void 0;
797
+ return q(m) ? m : void 0;
701
798
  }
702
- function Le(e, t) {
703
- var r, m;
704
- const n = I(e, t);
799
+ function xe(e, t) {
800
+ var a, m;
801
+ const n = E(e, t);
705
802
  if (!n) return;
706
- const o = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, i = n.kind === "physical" ? n.tableName : o, a = e.connectionId || (t == null ? void 0 : t.connectionId), s = i && a ? {
707
- connectionId: a,
708
- databaseName: e.database || ((r = t == null ? void 0 : t.dbSelection) == null ? void 0 : r.database),
803
+ const o = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, i = n.kind === "physical" ? n.tableName : o, r = e.connectionId || (t == null ? void 0 : t.connectionId), s = i && r ? {
804
+ connectionId: r,
805
+ databaseName: e.database || ((a = t == null ? void 0 : t.dbSelection) == null ? void 0 : a.database),
709
806
  schemaName: e.schema || ((m = t == null ? void 0 : t.dbSelection) == null ? void 0 : m.schema),
710
807
  tableName: i
711
808
  } : void 0;
712
809
  return { source: n, ...s ? { executionTable: s } : {} };
713
810
  }
714
- function xe(e) {
811
+ function He(e) {
715
812
  const t = M(e.dataSource) ? e.dataSource : void 0;
716
813
  if (typeof e.sql == "string" && e.sql.trim()) {
717
- const r = [], m = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
814
+ const a = [], m = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
718
815
  for (const p of m) {
719
816
  if (!k(p)) continue;
720
- const l = Le(p, t);
721
- l && !r.some(
817
+ const l = xe(p, t);
818
+ l && !a.some(
722
819
  (c) => A(
723
820
  c.source,
724
821
  l.source
725
822
  )
726
- ) && r.push(l);
823
+ ) && a.push(l);
727
824
  }
728
825
  return {
729
826
  cardId: e.id,
730
827
  kind: "sql",
731
- pinnedCatalogSources: r
828
+ pinnedCatalogSources: a
732
829
  };
733
830
  }
734
831
  if (!M(e.config))
735
832
  return { cardId: e.id, kind: "unconfigured" };
736
- const n = e.config, o = [], i = Ce(e);
833
+ const n = e.config, o = [], i = Me(e);
737
834
  if (i.status === "invalid")
738
835
  return { cardId: e.id, kind: "unconfigured" };
739
- const a = i.status === "ready" ? i.config : void 0;
740
- if (e.type === "matrixTable" && !a)
836
+ const r = i.status === "ready" ? i.config : void 0;
837
+ if (e.type === "matrixTable" && !r)
741
838
  return { cardId: e.id, kind: "unconfigured" };
742
- a && o.push(
743
- ...ve(a.spec).filter(H)
839
+ r && o.push(
840
+ ...ke(r.spec).filter(q)
744
841
  );
745
- const s = (a == null ? void 0 : a.spec.joinPlan) ?? (M(n.joinPlan) ? n.joinPlan : void 0);
842
+ const s = (r == null ? void 0 : r.spec.joinPlan) ?? (M(n.joinPlan) ? n.joinPlan : void 0);
746
843
  if (s) {
747
- const r = Array.isArray(s.joins) ? s.joins : [], m = [s.baseEntity];
748
- for (const l of r)
844
+ const a = Array.isArray(s.joins) ? s.joins : [], m = [s.baseEntity];
845
+ for (const l of a)
749
846
  M(l) && m.push(l.source, l.target);
750
847
  let p = !1;
751
848
  for (const l of m) {
@@ -753,21 +850,21 @@ function xe(e) {
753
850
  p = !0;
754
851
  continue;
755
852
  }
756
- const c = I(l, t);
853
+ const c = E(l, t);
757
854
  c ? o.push(c) : p = !0;
758
855
  }
759
856
  p && (o.length = 0);
760
857
  } else if (e.type !== "matrixTable") {
761
- const r = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
762
- if (r.length === 1 && k(r[0])) {
763
- const p = I(
764
- r[0],
858
+ const a = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
859
+ if (a.length === 1 && k(a[0])) {
860
+ const p = E(
861
+ a[0],
765
862
  t
766
863
  );
767
864
  p && o.push(p);
768
865
  }
769
- o.push(...Fe(n, t));
770
- const m = Be(
866
+ o.push(...je(n, t));
867
+ const m = Ve(
771
868
  n.queryBaseSource,
772
869
  t,
773
870
  o.length > 0
@@ -777,65 +874,65 @@ function xe(e) {
777
874
  return {
778
875
  cardId: e.id,
779
876
  kind: "config",
780
- executableSources: O(o)
877
+ executableSources: w(o)
781
878
  };
782
879
  }
783
- function pt(e, t) {
880
+ function yt(e, t) {
784
881
  return (e.kind === "config" ? e.executableSources : e.kind === "sql" ? e.pinnedCatalogSources.map((o) => o.source) : []).some(
785
882
  (o) => A(o, t)
786
883
  );
787
884
  }
788
- function Ve(e, t) {
885
+ function qe(e, t) {
789
886
  if (e.kind === "config")
790
887
  return e.executableSources.find(
791
888
  (n) => A(n, t)
792
889
  );
793
890
  }
794
- function mt(e, t) {
891
+ function Ct(e, t) {
795
892
  var n;
796
- return (n = Re(e, t)) == null ? void 0 : n.source;
893
+ return (n = Ue(e, t)) == null ? void 0 : n.source;
797
894
  }
798
- function Re(e, t) {
895
+ function Ue(e, t) {
799
896
  if (e.kind === "sql")
800
897
  return e.pinnedCatalogSources.find(
801
898
  (n) => A(n.source, t)
802
899
  );
803
900
  }
804
- const ae = {
901
+ const me = {
805
902
  rowMembers: !0,
806
903
  columnMembers: !0,
807
904
  cells: !0
808
905
  };
809
- function je(e, t) {
906
+ function Ke(e, t) {
810
907
  return {
811
908
  enabled: t === "on",
812
909
  fields: e.type === "detailTable" ? { kind: "clickedCell" } : { kind: "wholeRow" },
813
910
  multipleSelection: !0,
814
911
  selectionCheckboxes: "auto",
815
- ...e.type === "matrixTable" ? { matrixSources: { ...ae } } : {},
912
+ ...e.type === "matrixTable" ? { matrixSources: { ...me } } : {},
816
913
  targets: { kind: "allSheets" },
817
914
  cardMappings: []
818
915
  };
819
916
  }
820
- const He = ["string", "number", "boolean", "date", "datetime"];
821
- function Se(e) {
917
+ const Je = ["string", "number", "boolean", "date", "datetime"];
918
+ function ze(e) {
822
919
  return (e.kind === "semantic" ? [e.datasetId, e.datasetName] : [
823
920
  e.tableName,
824
921
  [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".")
825
- ]).filter((t) => !!t).map((t) => ee(t));
922
+ ]).filter((t) => !!t).map((t) => ie(t));
826
923
  }
827
- function qe(e, t) {
924
+ function Ge(e, t) {
828
925
  if (t.kind !== "config" || e.expression || e.calculatedFormula) return;
829
- const n = Z(e.dataType);
830
- if (!He.includes(n)) return;
926
+ const n = oe(e.dataType);
927
+ if (!Je.includes(n)) return;
831
928
  let o;
832
929
  if (e.source)
833
- o = Ve(t, e.source);
930
+ o = qe(t, e.source);
834
931
  else {
835
- const i = [e.entityId, e.entityName, e.qualifiedEntityName].filter((s) => !!s).map((s) => ee(s)), a = t.executableSources.filter(
836
- (s) => Se(s).some((r) => i.includes(r))
932
+ const i = [e.entityId, e.entityName, e.qualifiedEntityName].filter((s) => !!s).map((s) => ie(s)), r = t.executableSources.filter(
933
+ (s) => ze(s).some((a) => i.includes(a))
837
934
  );
838
- a.length === 1 ? o = a[0] : !a.length && t.executableSources.length === 1 && (o = t.executableSources[0]);
935
+ r.length === 1 ? o = r[0] : !r.length && t.executableSources.length === 1 && (o = t.executableSources[0]);
839
936
  }
840
937
  if (!(!o || !e.name))
841
938
  return {
@@ -845,7 +942,7 @@ function qe(e, t) {
845
942
  ...e.sourceField && e.sourceField !== e.name ? { sourceField: e.sourceField } : {}
846
943
  };
847
944
  }
848
- function Je(e, t) {
945
+ function Qe(e, t) {
849
946
  const { matrixSources: n, ...o } = t, i = t.fields.kind === "chosenColumns" ? {
850
947
  kind: "chosenColumns",
851
948
  clickedFieldKeys: [...new Set(t.fields.clickedFieldKeys)]
@@ -853,62 +950,62 @@ function Je(e, t) {
853
950
  return {
854
951
  ...o,
855
952
  fields: i,
856
- ...e.type === "matrixTable" ? { matrixSources: n ?? { ...ae } } : {}
953
+ ...e.type === "matrixTable" ? { matrixSources: n ?? { ...me } } : {}
857
954
  };
858
955
  }
859
- function ut(e, t) {
956
+ function _t(e, t) {
860
957
  var c, b;
861
958
  if (e.clickToFilter)
862
- return Je(e, e.clickToFilter);
863
- const n = je(e, t), o = (((c = e.interactionConfig) == null ? void 0 : c.interactions) ?? []).filter(
864
- (f) => f.mode === "clickFilter"
959
+ return Qe(e, e.clickToFilter);
960
+ const n = Ke(e, t), o = (((c = e.interactionConfig) == null ? void 0 : c.interactions) ?? []).filter(
961
+ (d) => d.mode === "clickFilter"
865
962
  );
866
963
  if (!o.length) return n;
867
- const i = xe(e);
868
- let a = !1;
964
+ const i = He(e);
965
+ let r = !1;
869
966
  const s = [];
870
- for (const f of o) {
871
- if (((b = f.trigger) == null ? void 0 : b.type) !== "attribute") {
872
- a = !0;
967
+ for (const d of o) {
968
+ if (((b = d.trigger) == null ? void 0 : b.type) !== "attribute") {
969
+ r = !0;
873
970
  continue;
874
971
  }
875
- const y = qe(
876
- f.trigger.field,
972
+ const y = Ge(
973
+ d.trigger.field,
877
974
  i
878
975
  );
879
976
  if (!y) {
880
- a = !0;
977
+ r = !0;
881
978
  continue;
882
979
  }
883
- const C = de(y);
980
+ const C = ye(y);
884
981
  s.includes(C) || s.push(C);
885
982
  }
886
- const r = o.every(
887
- (f) => f.applyToCardIds !== void 0
983
+ const a = o.every(
984
+ (d) => d.applyToCardIds !== void 0
888
985
  ), m = [
889
- ...new Set(o.flatMap((f) => f.applyToCardIds ?? []))
986
+ ...new Set(o.flatMap((d) => d.applyToCardIds ?? []))
890
987
  ], p = o.filter(
891
- (f) => f.applyToCardIds === void 0
892
- ), l = r ? [] : [
893
- ...new Set(p.flatMap((f) => f.excludeCardIds ?? []))
988
+ (d) => d.applyToCardIds === void 0
989
+ ), l = a ? [] : [
990
+ ...new Set(p.flatMap((d) => d.excludeCardIds ?? []))
894
991
  ].filter(
895
- (f) => p.every((y) => {
992
+ (d) => p.every((y) => {
896
993
  var C;
897
- return (C = y.excludeCardIds) == null ? void 0 : C.includes(f);
994
+ return (C = y.excludeCardIds) == null ? void 0 : C.includes(d);
898
995
  })
899
996
  );
900
997
  return {
901
998
  ...n,
902
999
  enabled: !0,
903
- fields: a || !s.length ? { kind: "wholeRow" } : { kind: "chosenColumns", clickedFieldKeys: s },
904
- targets: r ? { kind: "cards", cardIds: m } : { kind: "allSheets" },
905
- cardMappings: l.map((f) => ({
1000
+ fields: r || !s.length ? { kind: "wholeRow" } : { kind: "chosenColumns", clickedFieldKeys: s },
1001
+ targets: a ? { kind: "cards", cardIds: m } : { kind: "allSheets" },
1002
+ cardMappings: l.map((d) => ({
906
1003
  kind: "excluded",
907
- cardId: f
1004
+ cardId: d
908
1005
  }))
909
1006
  };
910
1007
  }
911
- const ce = u.union([
1008
+ const ue = u.union([
912
1009
  u.object({
913
1010
  kind: u.literal("allSheets"),
914
1011
  sheetKinds: u.array(u.enum(["dashboard", "document"])).optional()
@@ -920,15 +1017,15 @@ const ce = u.union([
920
1017
  sheetId: u.string(),
921
1018
  sectionIds: u.array(u.string())
922
1019
  }).strict()
923
- ]), le = u.union([
1020
+ ]), de = u.union([
924
1021
  u.object({
925
1022
  kind: u.literal("bound"),
926
1023
  cardId: u.string().min(1),
927
1024
  clickedFieldKey: u.string().min(1),
928
- target: u.object({ kind: u.literal("field"), field: fe }).strict()
1025
+ target: u.object({ kind: u.literal("field"), field: ge }).strict()
929
1026
  }).strict(),
930
1027
  u.object({ kind: u.literal("excluded"), cardId: u.string().min(1) }).strict()
931
- ]), ft = u.object({
1028
+ ]), vt = u.object({
932
1029
  enabled: u.boolean(),
933
1030
  fields: u.union([
934
1031
  u.object({ kind: u.literal("wholeRow") }).strict(),
@@ -945,12 +1042,12 @@ const ce = u.union([
945
1042
  columnMembers: u.boolean(),
946
1043
  cells: u.boolean()
947
1044
  }).strict().optional(),
948
- targets: ce,
949
- cardMappings: u.array(le)
950
- }).strict(), dt = u.boolean(), ht = u.object({
951
- targets: ce.nullable().optional(),
952
- cardMappings: u.array(le).nullable().optional()
953
- }).strict(), Ue = [
1045
+ targets: ue,
1046
+ cardMappings: u.array(de)
1047
+ }).strict(), Yt = u.boolean(), Mt = u.object({
1048
+ targets: ue.nullable().optional(),
1049
+ cardMappings: u.array(de).nullable().optional()
1050
+ }).strict(), We = [
954
1051
  "bar",
955
1052
  "horizontalBar",
956
1053
  "line",
@@ -959,25 +1056,25 @@ const ce = u.union([
959
1056
  "combo",
960
1057
  "stackedBar",
961
1058
  "stackedLine"
962
- ], Ge = new Set(
963
- Ue
1059
+ ], Xe = new Set(
1060
+ We
964
1061
  );
965
- function ze(e) {
966
- return typeof e == "string" && Ge.has(e);
1062
+ function Ze(e) {
1063
+ return typeof e == "string" && Xe.has(e);
967
1064
  }
968
- function bt(e) {
969
- return e === "detailTable" || e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || ze(e);
1065
+ function kt(e) {
1066
+ return e === "detailTable" || e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || Ze(e);
970
1067
  }
971
- function X(e) {
1068
+ function ne(e) {
972
1069
  return !!(e != null && e.trim());
973
1070
  }
974
- function gt(e) {
975
- return X(e.sql) || X(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
1071
+ function It(e) {
1072
+ return ne(e.sql) || ne(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
976
1073
  }
977
1074
  const P = {
978
1075
  type: "temporal_bucket",
979
1076
  presentation: { mode: "auto" }
980
- }, v = {
1077
+ }, _ = {
981
1078
  value: "auto",
982
1079
  label: "Automatic",
983
1080
  format: P
@@ -1009,9 +1106,9 @@ function Y(e) {
1009
1106
  custom: !0
1010
1107
  };
1011
1108
  }
1012
- const q = {
1109
+ const K = {
1013
1110
  second: [
1014
- v,
1111
+ _,
1015
1112
  g("HH:mm:ss", "14:30:45 (HH:mm:ss)"),
1016
1113
  g(
1017
1114
  "YYYY-MM-DD HH:mm:ss",
@@ -1020,19 +1117,19 @@ const q = {
1020
1117
  Y("DD/MM/YYYY HH:mm:ss")
1021
1118
  ],
1022
1119
  minute: [
1023
- v,
1120
+ _,
1024
1121
  g("HH:mm", "14:30 (HH:mm)"),
1025
1122
  g("YYYY-MM-DD HH:mm", "2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),
1026
1123
  Y("DD/MM/YYYY HH:mm")
1027
1124
  ],
1028
1125
  hour: [
1029
- v,
1126
+ _,
1030
1127
  g("HH", "14 (HH)"),
1031
1128
  g("YYYY-MM-DD HH", "2024-01-15 14 (YYYY-MM-DD HH)"),
1032
1129
  Y("DD/MM/YYYY HH")
1033
1130
  ],
1034
1131
  day: [
1035
- v,
1132
+ _,
1036
1133
  g("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
1037
1134
  g("MM/DD/YYYY", "01/15/2024 (MM/DD/YYYY)"),
1038
1135
  g("DD/MM/YYYY", "15/01/2024 (DD/MM/YYYY)"),
@@ -1041,14 +1138,14 @@ const q = {
1041
1138
  Y("YYYY/MM/DD")
1042
1139
  ],
1043
1140
  week: [
1044
- v,
1141
+ _,
1045
1142
  T("week_of_short", "Week of Jan 15, 2024"),
1046
1143
  T("week_of_long", "Week of January 15, 2024"),
1047
1144
  g("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
1048
1145
  Y("YYYY/MM/DD")
1049
1146
  ],
1050
1147
  month: [
1051
- v,
1148
+ _,
1052
1149
  g("MMM YYYY", "Jan 2024 (MMM YYYY)"),
1053
1150
  g("MMMM YYYY", "January 2024 (MMMM YYYY)"),
1054
1151
  g("YYYY-MM", "2024-01 (YYYY-MM)"),
@@ -1057,16 +1154,16 @@ const q = {
1057
1154
  Y("YYYY/MM")
1058
1155
  ],
1059
1156
  quarter: [
1060
- v,
1157
+ _,
1061
1158
  T("quarter_short", "Q1 2024"),
1062
1159
  T("quarter_long", "1st Quarter 2024")
1063
1160
  ],
1064
1161
  year: [
1065
- v,
1162
+ _,
1066
1163
  g("YYYY", "2024 (YYYY)"),
1067
1164
  g("YY", "24 (YY)")
1068
1165
  ]
1069
- }, Ke = {
1166
+ }, et = {
1070
1167
  second: "2026-07-31T14:05:09",
1071
1168
  minute: "2026-07-31T14:05:00",
1072
1169
  hour: "2026-07-31T14:00:00",
@@ -1076,9 +1173,9 @@ const q = {
1076
1173
  quarter: "2026-07-01",
1077
1174
  year: "2026-01-01"
1078
1175
  };
1079
- function Qe(e, t, n = te) {
1080
- return Ye({
1081
- value: Ke[t],
1176
+ function tt(e, t, n = se) {
1177
+ return Ee({
1178
+ value: et[t],
1082
1179
  metadata: {
1083
1180
  kind: "temporal_bucket",
1084
1181
  granularity: t,
@@ -1110,33 +1207,33 @@ function Qe(e, t, n = te) {
1110
1207
  }
1111
1208
  });
1112
1209
  }
1113
- function yt(e, t, n = te) {
1114
- const o = q[e], i = (t == null ? void 0 : t.presentation.mode) === "preset" ? t.presentation.preset : void 0, a = i && t && $(t, e).ok && !o.some(
1115
- (r) => {
1210
+ function Et(e, t, n = se) {
1211
+ const o = K[e], i = (t == null ? void 0 : t.presentation.mode) === "preset" ? t.presentation.preset : void 0, r = i && t && $(t, e).ok && !o.some(
1212
+ (a) => {
1116
1213
  var m;
1117
- return ((m = r.format) == null ? void 0 : m.presentation.mode) === "preset" && r.format.presentation.preset === i;
1214
+ return ((m = a.format) == null ? void 0 : m.presentation.mode) === "preset" && a.format.presentation.preset === i;
1118
1215
  }
1119
1216
  ) ? T(i, i) : void 0;
1120
- return (a ? [...o, a] : o).map((r) => {
1121
- if (!r.format || r.custom) return r;
1122
- const m = Qe(
1123
- r.format,
1217
+ return (r ? [...o, r] : o).map((a) => {
1218
+ if (!a.format || a.custom) return a;
1219
+ const m = tt(
1220
+ a.format,
1124
1221
  e,
1125
1222
  n
1126
1223
  );
1127
- return r.format.presentation.mode === "pattern" ? {
1128
- ...r,
1129
- label: `${m} (${r.format.presentation.pattern})`
1130
- } : r.format.presentation.mode === "auto" ? { ...r, label: `Automatic (${m})` } : { ...r, label: m };
1224
+ return a.format.presentation.mode === "pattern" ? {
1225
+ ...a,
1226
+ label: `${m} (${a.format.presentation.pattern})`
1227
+ } : a.format.presentation.mode === "auto" ? { ...a, label: `Automatic (${m})` } : { ...a, label: m };
1131
1228
  });
1132
1229
  }
1133
- function Ct(e, t) {
1134
- const n = q[t];
1230
+ function Tt(e, t) {
1231
+ const n = K[t];
1135
1232
  if (e.presentation.mode === "pattern") {
1136
1233
  const o = e.presentation.pattern, i = n.find(
1137
- (a) => {
1234
+ (r) => {
1138
1235
  var s;
1139
- return ((s = a.format) == null ? void 0 : s.presentation.mode) === "pattern" && a.format.presentation.pattern === o;
1236
+ return ((s = r.format) == null ? void 0 : s.presentation.mode) === "pattern" && r.format.presentation.pattern === o;
1140
1237
  }
1141
1238
  );
1142
1239
  return {
@@ -1148,14 +1245,14 @@ function Ct(e, t) {
1148
1245
  if (e.presentation.mode === "preset") {
1149
1246
  const o = e.presentation.preset, i = n.find(
1150
1247
  (s) => {
1151
- var r;
1152
- return ((r = s.format) == null ? void 0 : r.presentation.mode) === "preset" && s.format.presentation.preset === o;
1248
+ var a;
1249
+ return ((a = s.format) == null ? void 0 : a.presentation.mode) === "preset" && s.format.presentation.preset === o;
1153
1250
  }
1154
- ), a = $(
1251
+ ), r = $(
1155
1252
  e,
1156
1253
  t
1157
1254
  ).ok;
1158
- return i ? { value: i.value, customPattern: "", format: e } : a ? {
1255
+ return i ? { value: i.value, customPattern: "", format: e } : r ? {
1159
1256
  value: `preset:${o}`,
1160
1257
  customPattern: "",
1161
1258
  format: e
@@ -1163,67 +1260,73 @@ function Ct(e, t) {
1163
1260
  }
1164
1261
  return { value: "auto", customPattern: "", format: e };
1165
1262
  }
1166
- function vt(e, t, n = "") {
1263
+ function At(e, t, n = "") {
1167
1264
  var s;
1168
- const o = q[e].find(
1169
- (r) => r.value === t
1170
- ), i = t.startsWith("preset:") ? t.slice(7) : void 0, a = t === "custom" ? {
1265
+ const o = K[e].find(
1266
+ (a) => a.value === t
1267
+ ), i = t.startsWith("preset:") ? t.slice(7) : void 0, r = t === "custom" ? {
1171
1268
  type: "temporal_bucket",
1172
1269
  presentation: {
1173
1270
  mode: "pattern",
1174
1271
  pattern: n.trim() || (((s = o == null ? void 0 : o.format) == null ? void 0 : s.presentation.mode) === "pattern" ? o.format.presentation.pattern : "")
1175
1272
  }
1176
- } : (o == null ? void 0 : o.format) ?? (i && _e(i) ? {
1273
+ } : (o == null ? void 0 : o.format) ?? (i && Ie(i) ? {
1177
1274
  type: "temporal_bucket",
1178
1275
  presentation: {
1179
1276
  mode: "preset",
1180
1277
  preset: i
1181
1278
  }
1182
1279
  } : void 0);
1183
- return !a || !$(a, e).ok ? P : a;
1280
+ return !r || !$(r, e).ok ? P : r;
1184
1281
  }
1185
- function _t(e, t) {
1282
+ function Dt(e, t) {
1186
1283
  return $(e, t).ok ? e : P;
1187
1284
  }
1188
- const pe = [
1285
+ const fe = [
1189
1286
  { value: "COUNT", label: "Count" },
1190
1287
  { value: "DISTINCT", label: "Count Distinct" }
1191
- ], We = [
1192
- ...pe,
1288
+ ], nt = [
1289
+ ...fe,
1193
1290
  { value: "SUM", label: "Sum" },
1194
1291
  { value: "AVG", label: "Average" },
1195
1292
  { value: "MIN", label: "Min" },
1196
1293
  { value: "MAX", label: "Max" },
1197
1294
  { value: "MEDIAN", label: "Median" }
1198
1295
  ];
1199
- function Yt(e) {
1200
- return Z(e) === "number" ? We : pe;
1296
+ function Nt(e) {
1297
+ return oe(e) === "number" ? nt : fe;
1201
1298
  }
1202
1299
  export {
1203
1300
  P as A,
1204
- Ue as S,
1205
- gt as a,
1206
- Ct as b,
1207
- ft as c,
1208
- vt as d,
1209
- _t as e,
1210
- I as f,
1211
- yt as g,
1212
- xe as h,
1213
- ze as i,
1214
- pt as j,
1215
- Ve as k,
1216
- mt as l,
1217
- Re as m,
1218
- je as n,
1219
- qe as o,
1220
- Qe as p,
1301
+ Nt as B,
1302
+ bt as C,
1303
+ J as D,
1304
+ gt as E,
1305
+ We as S,
1306
+ It as a,
1307
+ Tt as b,
1308
+ vt as c,
1309
+ At as d,
1310
+ Dt as e,
1311
+ E as f,
1312
+ Et as g,
1313
+ He as h,
1314
+ Ze as i,
1315
+ yt as j,
1316
+ qe as k,
1317
+ Ct as l,
1318
+ Ue as m,
1319
+ z as n,
1320
+ Te as o,
1321
+ tt as p,
1221
1322
  ut as q,
1222
- dt as r,
1223
- bt as s,
1224
- at as t,
1225
- ht as u,
1226
- Yt as v,
1227
- ct as w,
1228
- lt as x
1323
+ Yt as r,
1324
+ kt as s,
1325
+ ht as t,
1326
+ dt as u,
1327
+ ft as v,
1328
+ Ke as w,
1329
+ Ge as x,
1330
+ _t as y,
1331
+ Mt as z
1229
1332
  };