react-semaphor 0.1.525 → 0.1.527

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 (196) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1179 -296
  3. package/dist/brand-studio/index.js +31 -31
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-Dy_WpDdo.js → calculated-field-identity-DEhjPSr-.js} +77 -76
  6. package/dist/chunks/{card-config-utils-CAyjC5Tp.js → card-config-utils-BlIbwkuD.js} +62 -59
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-BilVIEyw.js → dashboard-briefing-launcher-D9pFByPh.js} +274 -267
  10. package/dist/chunks/{dashboard-controls-DyLPcvCK.js → dashboard-controls-CJI5ZWMq.js} +740 -692
  11. package/dist/chunks/dashboard-json-DLdrFry-.js +65 -0
  12. package/dist/chunks/{edit-dashboard-visual-DtmKNNdE.js → edit-dashboard-visual-D5LjWle1.js} +6760 -6728
  13. package/dist/chunks/editor-action-buttons-G91NQKxU.js +2070 -0
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-ON7Gpvcv.js → index-BvJOYbNv.js} +760 -750
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-B1K7x0SL.js → matrix-control-sources-BypfLZsK.js} +36 -36
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/report-preferences-dialog-D3hxu4sE.js +1231 -0
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-CvCBQbl2.js → selection-reducer-C7Um5XN-.js} +3 -3
  35. package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
  36. package/dist/chunks/{index-DYOaHuLS.js → semaphor-ready-indicator-D46I_4g7.js} +145070 -146854
  37. package/dist/chunks/slider-B6LELqx6.js +876 -0
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/{switch-CWPcwAZ4.js → switch-_7uBAbYx.js} +7950 -8545
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +30 -29
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +435 -246
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +4 -5
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
  58. package/dist/types/components/dashboard/sheet/layout-change-guard.d.ts +1 -1
  59. package/dist/types/components/dashboard/sheet/sheet-layout.d.ts +1 -1
  60. package/dist/types/components/editor/editor-main/text-card.d.ts +1 -1
  61. package/dist/types/components/editor/editor.d.ts +1 -1
  62. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  63. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  64. package/dist/types/components/providers/semaphor-context-provider.d.ts +1 -1
  65. package/dist/types/components/providers/theme-provider-context.d.ts +1 -1
  66. package/dist/types/components/providers/theme-provider.d.ts +1 -1
  67. package/dist/types/components/shared/unsaved-changes/use-pristine-snapshot-initializer.d.ts +1 -1
  68. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  69. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  70. package/dist/types/components/surfboard/dashboard-plus.d.ts +1 -1
  71. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  72. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  73. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  74. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  75. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  76. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  77. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  78. package/dist/types/components/visual/column-display-utils.d.ts +1 -1
  79. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  80. package/dist/types/components/visual/kpi-visual/kpi-utils.d.ts +1 -1
  81. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  82. package/dist/types/components/visual/settings/color-format.d.ts +1 -1
  83. package/dist/types/components/visual/visual-utils.d.ts +1 -1
  84. package/dist/types/index.js +5 -5
  85. package/dist/types/lib/actions/data-point-click-action.d.ts +2 -1
  86. package/dist/types/lib/api/exports-api.d.ts +3 -0
  87. package/dist/types/lib/csv-download.d.ts +9 -0
  88. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  89. package/dist/types/lib/dashboard/normalize-dashboard-for-dirty-check.d.ts +1 -1
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  91. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  92. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  93. package/dist/types/lib/export-utils.d.ts +17 -15
  94. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  95. package/dist/types/lib/hooks/explorer/use-schemas.d.ts +1 -1
  96. package/dist/types/lib/hooks/use-dashboard.d.ts +2 -2
  97. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  98. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +1 -2
  99. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  100. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  101. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  102. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  103. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  104. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  105. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  106. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  107. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  108. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  109. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  110. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  111. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  112. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  113. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  114. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  115. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  116. package/dist/types/lib/stores/editor-store.d.ts +1 -2
  117. package/dist/types/lib/stores/table-actions.d.ts +2 -1
  118. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  119. package/dist/types/lib/types/common-types.d.ts +5 -0
  120. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  121. package/dist/types/lib/types/token-types.d.ts +0 -13
  122. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  123. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  124. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  125. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  126. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  127. package/dist/types/lib/utils.d.ts +0 -2
  128. package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
  129. package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
  130. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  131. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  132. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  133. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
  134. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  135. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  136. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  137. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  138. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  139. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  140. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  141. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  142. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  143. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  144. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  145. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  146. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  147. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  148. package/dist/types/shared/temporal/index.d.ts +5 -0
  149. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  150. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  151. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  152. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  153. package/package.json +2 -17
  154. package/src/data-app-sdk/README.md +6 -3
  155. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  156. package/dist/chunks/dashboard-json-QEoU-mx4.js +0 -75
  157. package/dist/chunks/editor-action-buttons-B9VRW3Bh.js +0 -2019
  158. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  159. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  160. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  161. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  162. package/dist/chunks/report-preferences-dialog-BLaFmlE2.js +0 -723
  163. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  164. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  165. package/dist/data-app-builder/index.js +0 -3666
  166. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  167. package/dist/data-app-codegen/index.js +0 -22
  168. package/dist/data-app-codegen-node/index.js +0 -1807
  169. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  170. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  171. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  172. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  173. package/dist/types/data-app-builder/constants.d.ts +0 -14
  174. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  175. package/dist/types/data-app-builder/index.d.ts +0 -1
  176. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  177. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  178. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  179. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  180. package/dist/types/data-app-builder/types.d.ts +0 -558
  181. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  182. package/dist/types/data-app-builder.d.ts +0 -2
  183. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  184. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  185. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  186. package/dist/types/data-app-codegen/index.d.ts +0 -6
  187. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  188. package/dist/types/data-app-codegen/node.d.ts +0 -2
  189. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  190. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  191. package/dist/types/data-app-codegen-node.d.ts +0 -2
  192. package/dist/types/data-app-codegen.d.ts +0 -2
  193. package/dist/types/lib/encrypt-utils.d.ts +0 -9
  194. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  195. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  196. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -1,341 +0,0 @@
1
- import { b5 as v, S as p, al as N, W as _ } from "./validators-CsdOtZI6.js";
2
- import "./matrix-operation-contract-D32U2CSw.js";
3
- import { t as m, c as L, g as I, e as A, a as d, b as C, d as O, f as R } from "./semantic-format-Baqp8kD_.js";
4
- import { f as S, h as Z, r as k, i as z } from "./raw-temporal-7bFbXd2a.js";
5
- import { f as X, l as V, g as E, i as P } from "./numeric-presentation-VhMUHfrJ.js";
6
- import { b as g, c as y } from "./constants-DeLIHVAW.js";
7
- import { r as $, f as Y } from "./temporal-bucket-PcLFSYWX.js";
8
- function T(t, e) {
9
- const n = m(t), s = m(e), r = n.getTime() - s.getTime();
10
- return r < 0 ? -1 : r > 0 ? 1 : r;
11
- }
12
- function j(t) {
13
- return L(t, Date.now());
14
- }
15
- function B(t, e) {
16
- const n = m(t), s = m(e), r = n.getFullYear() - s.getFullYear(), o = n.getMonth() - s.getMonth();
17
- return r * 12 + o;
18
- }
19
- function H(t) {
20
- return (e) => {
21
- const s = (t ? Math[t] : Math.trunc)(e);
22
- return s === 0 ? 0 : s;
23
- };
24
- }
25
- function U(t, e) {
26
- return +m(t) - +m(e);
27
- }
28
- function W(t) {
29
- const e = m(t);
30
- return e.setHours(23, 59, 59, 999), e;
31
- }
32
- function q(t) {
33
- const e = m(t), n = e.getMonth();
34
- return e.setFullYear(e.getFullYear(), n + 1, 0), e.setHours(23, 59, 59, 999), e;
35
- }
36
- function G(t) {
37
- const e = m(t);
38
- return +W(e) == +q(e);
39
- }
40
- function K(t, e) {
41
- const n = m(t), s = m(e), r = T(n, s), o = Math.abs(
42
- B(n, s)
43
- );
44
- let l;
45
- if (o < 1)
46
- l = 0;
47
- else {
48
- n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - r * o);
49
- let a = T(n, s) === -r;
50
- G(m(t)) && o === 1 && T(t, s) === 1 && (a = !1), l = r * (o - Number(a));
51
- }
52
- return l === 0 ? 0 : l;
53
- }
54
- function J(t, e, n) {
55
- const s = U(t, e) / 1e3;
56
- return H(n == null ? void 0 : n.roundingMethod)(s);
57
- }
58
- function Q(t, e, n) {
59
- const s = I(), r = (n == null ? void 0 : n.locale) ?? s.locale ?? A, o = 2520, l = T(t, e);
60
- if (isNaN(l))
61
- throw new RangeError("Invalid time value");
62
- const a = Object.assign({}, n, {
63
- addSuffix: n == null ? void 0 : n.addSuffix,
64
- comparison: l
65
- });
66
- let h, u;
67
- l > 0 ? (h = m(e), u = m(t)) : (h = m(t), u = m(e));
68
- const f = J(u, h), c = (d(u) - d(h)) / 1e3, i = Math.round((f - c) / 60);
69
- let M;
70
- if (i < 2)
71
- return n != null && n.includeSeconds ? f < 5 ? r.formatDistance("lessThanXSeconds", 5, a) : f < 10 ? r.formatDistance("lessThanXSeconds", 10, a) : f < 20 ? r.formatDistance("lessThanXSeconds", 20, a) : f < 40 ? r.formatDistance("halfAMinute", 0, a) : f < 60 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", 1, a) : i === 0 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", i, a);
72
- if (i < 45)
73
- return r.formatDistance("xMinutes", i, a);
74
- if (i < 90)
75
- return r.formatDistance("aboutXHours", 1, a);
76
- if (i < g) {
77
- const D = Math.round(i / 60);
78
- return r.formatDistance("aboutXHours", D, a);
79
- } else {
80
- if (i < o)
81
- return r.formatDistance("xDays", 1, a);
82
- if (i < y) {
83
- const D = Math.round(i / g);
84
- return r.formatDistance("xDays", D, a);
85
- } else if (i < y * 2)
86
- return M = Math.round(i / y), r.formatDistance("aboutXMonths", M, a);
87
- }
88
- if (M = K(u, h), M < 12) {
89
- const D = Math.round(i / y);
90
- return r.formatDistance("xMonths", D, a);
91
- } else {
92
- const D = M % 12, b = Math.trunc(M / 12);
93
- return D < 3 ? r.formatDistance("aboutXYears", b, a) : D < 9 ? r.formatDistance("overXYears", b, a) : r.formatDistance("almostXYears", b + 1, a);
94
- }
95
- }
96
- function F(t, e) {
97
- return Q(t, j(t), e);
98
- }
99
- function Me(t, e) {
100
- return t && t !== "auto" ? t : e;
101
- }
102
- function De(t, e = /* @__PURE__ */ new Date()) {
103
- try {
104
- const n = {
105
- timeZone: t,
106
- timeZoneName: "short"
107
- }, r = new Intl.DateTimeFormat("en-US", n).formatToParts(e).find((o) => o.type === "timeZoneName");
108
- return (r == null ? void 0 : r.value) || t;
109
- } catch {
110
- return t;
111
- }
112
- }
113
- function ye(t) {
114
- try {
115
- const e = {
116
- timeZone: t,
117
- timeZoneName: "long"
118
- }, s = new Intl.DateTimeFormat("en-US", e).formatToParts(
119
- /* @__PURE__ */ new Date()
120
- ).find((r) => r.type === "timeZoneName");
121
- return (s == null ? void 0 : s.value) || t;
122
- } catch {
123
- return t;
124
- }
125
- }
126
- function w(t, e = "auto") {
127
- if (!t)
128
- return /* @__PURE__ */ new Date(NaN);
129
- const n = t.endsWith("Z"), s = /[+-]\d{2}:?\d{2}$/.test(t), r = /\([A-Z]{3,4}\)$/.test(t);
130
- if (e === "auto")
131
- return n || s || r ? new Date(t) : /* @__PURE__ */ new Date(t + "Z");
132
- if (e === "local") {
133
- if (n || s) {
134
- const o = t.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
135
- return new Date(o);
136
- }
137
- return new Date(t);
138
- } else return e === "UTC" ? n ? new Date(t) : s ? new Date(t) : /* @__PURE__ */ new Date(t + "Z") : n || s || r ? new Date(t) : S(t, e);
139
- }
140
- const ee = "MM/dd/yyyy", te = (t, e, n, s = "auto") => {
141
- if (!t)
142
- return "";
143
- try {
144
- const r = w(t, s);
145
- if (isNaN(r.getTime()))
146
- return t;
147
- const l = (e && e.trim() ? e : ee).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
148
- return n && n !== "auto" ? C(r, n, l) : O(r, l);
149
- } catch (r) {
150
- return console.error("Date formatting error:", r), t;
151
- }
152
- }, ne = (t, e = "auto") => {
153
- if (!t)
154
- return "";
155
- try {
156
- const n = w(t, e);
157
- return isNaN(n.getTime()) ? t : F(n, { addSuffix: !0 });
158
- } catch (n) {
159
- return console.error("Relative time formatting error:", n), t;
160
- }
161
- };
162
- function re(t, e, n, s) {
163
- const r = t instanceof Date ? t.toISOString() : String(t), o = (s == null ? void 0 : s.browserTimezone) || n, l = (s == null ? void 0 : s.isSqlCard) ?? !1;
164
- if (e != null && e.useRelativeTime)
165
- return ne(
166
- r,
167
- (e == null ? void 0 : e.sourceTimezone) || "auto"
168
- );
169
- const a = e != null && e.useCustomFormat && (e != null && e.customFormat) ? e.customFormat : (e == null ? void 0 : e.format) || "MM/dd/yyyy";
170
- return te(
171
- r,
172
- a,
173
- e != null && e.timezone && (e == null ? void 0 : e.timezone) !== "auto" ? e.timezone : l ? o : n,
174
- (e == null ? void 0 : e.sourceTimezone) || "auto"
175
- );
176
- }
177
- function x(t, e, n) {
178
- var l, a;
179
- if (t == null)
180
- return t === null ? ((l = n.absence) == null ? void 0 : l.nullText) ?? "" : ((a = n.absence) == null ? void 0 : a.emptyText) ?? "";
181
- const s = v(t) ? t : void 0, r = s ? s.value : t, o = s ?? (typeof t == "number" ? t : void 0);
182
- if (!n.useFormattedValues || !e)
183
- return String(r);
184
- switch (e.type) {
185
- case "number":
186
- return o !== void 0 ? X(
187
- o,
188
- e.numberFormat,
189
- n.locale
190
- ) : String(r);
191
- case "date":
192
- return re(
193
- r,
194
- e.dateFormat,
195
- n.timezone,
196
- {
197
- browserTimezone: n.browserTimezone,
198
- isSqlCard: n.isSqlCard
199
- }
200
- );
201
- case "progress":
202
- return o !== void 0 ? `${r}%` : String(r);
203
- case "badge":
204
- case "link":
205
- case "text":
206
- case "none":
207
- default:
208
- return String(r);
209
- }
210
- }
211
- function Te(t, e) {
212
- return e.visibleColumns.map((n) => {
213
- const s = t[n], r = e.columnSettings[n];
214
- return x(s, r, {
215
- useFormattedValues: e.useFormattedValues,
216
- timezone: e.timezone,
217
- locale: e.locale
218
- });
219
- });
220
- }
221
- function se(t, e) {
222
- var r;
223
- const n = t[t.length - 1];
224
- if (!n) return "";
225
- if (n.member.kind === "others") return "Others";
226
- const s = n.member.value;
227
- return s === null ? "(Blank)" : ((r = e == null ? void 0 : e.get(n.levelId)) == null ? void 0 : r(s)) ?? (typeof s == "object" ? s.value : String(s));
228
- }
229
- function ae(t, e, n) {
230
- return t === "grand_total" ? n ?? "Grand Total" : t === "subtotal" ? (n == null ? void 0 : n.split(_).join(e)) ?? `${e} Total` : e;
231
- }
232
- function be(t, e, n, s) {
233
- var l;
234
- const r = t[t.length - 1], o = e === "grand_total" ? n.grand.label : r ? (l = n.levels[r.levelId]) == null ? void 0 : l.label : void 0;
235
- return ae(e, se(t, s), o);
236
- }
237
- function pe(t, e, n) {
238
- return t.kind === "value" ? (e == null ? void 0 : e(t.value)) ?? "" : t.kind === "null" ? n.nullText : n.emptyText;
239
- }
240
- function de(t) {
241
- const { path: e, previousPath: n, role: s, repeatLabels: r, levelCount: o } = t;
242
- return Array.from({ length: o }, (l, a) => {
243
- const h = e.slice(0, a + 1), u = s === "grand_total" ? a === 0 : s === "subtotal" && a === e.length - 1, f = n && n.length > a && p(n.slice(0, a + 1)) === p(h);
244
- return {
245
- path: h,
246
- total: u,
247
- visible: u || e.length > a && (r || !f || a === e.length - 1)
248
- };
249
- });
250
- }
251
- function oe(t, e) {
252
- return R(t ?? e, {
253
- preserveOmittedProperties: !0,
254
- numericInput: "canonical"
255
- });
256
- }
257
- function ge(t, e, n) {
258
- const s = /* @__PURE__ */ new Map(), r = (o, l) => {
259
- const a = (l === "levels" ? e.levelFormats : e.measureFormats)[o.id], h = o.semanticFormat, u = oe(a, h);
260
- l === "measures" && s.set(o.id, {
261
- isNumeric: N(o.column.dataType) === "number",
262
- // Use normalized affixes: a redundant percent suffix is already removed.
263
- hasTextAffixes: !!u && !!("prefix" in u && u.prefix || "suffix" in u && u.suffix)
264
- });
265
- const f = (c) => x(c, void 0, {
266
- useFormattedValues: !0,
267
- timezone: n.calendar.tz,
268
- locale: n.valueFormat.locale,
269
- absence: e.absence
270
- });
271
- if (o.column.temporalBucket) {
272
- const c = o.column.temporalBucket, i = $({
273
- metadata: c,
274
- cardFormat: (a == null ? void 0 : a.type) === "temporal_bucket" ? a : void 0,
275
- semanticFormat: (h == null ? void 0 : h.type) === "temporal_bucket" ? { granularity: c.granularity, format: h } : void 0,
276
- locale: n.valueFormat.locale,
277
- styles: { dateStyle: n.valueFormat.dateStyle, dateTime: n.valueFormat.dateTime }
278
- });
279
- return (M) => typeof M == "string" ? Y({ value: M, metadata: c, format: i.format }) : f(M);
280
- }
281
- if (o.column.rawTemporal) {
282
- const c = Z({
283
- metadata: o.column.rawTemporal,
284
- format: k({
285
- format: (u == null ? void 0 : u.type) === "date" ? {
286
- type: "raw_temporal",
287
- timezone: u.timezone,
288
- sourceTimezone: u.sourceTimezone,
289
- presentation: u.pattern ? {
290
- mode: "pattern",
291
- dialect: "semaphor_tokens",
292
- pattern: u.pattern
293
- } : { mode: "auto" }
294
- } : void 0,
295
- preferences: n.valueFormat,
296
- calendar: n.calendar
297
- })
298
- });
299
- return (i) => {
300
- if (typeof i != "string") return f(i);
301
- const M = c(i);
302
- return M.ok ? M.text : f(i);
303
- };
304
- }
305
- if (z(u)) {
306
- const c = V(u, n.valueFormat);
307
- return (i) => typeof i == "number" || typeof i == "object" && i !== null ? E(i, c) : f(i);
308
- }
309
- return (u == null ? void 0 : u.type) === "duration" ? (c) => typeof c == "number" || typeof c == "string" || typeof c == "object" && c !== null ? P(
310
- typeof c == "object" ? c.value : c,
311
- u
312
- ) : f(c) : (u == null ? void 0 : u.type) === "string" ? (c) => c === null ? f(c) : `${u.prefix ?? ""}${f(c)}${u.suffix ?? ""}` : f;
313
- };
314
- return {
315
- levels: new Map(
316
- t.levels.map((o) => [o.id, r(o, "levels")])
317
- ),
318
- measures: new Map(
319
- t.measures.map((o) => [o.id, r(o, "measures")])
320
- ),
321
- measureSemantics: s
322
- };
323
- }
324
- export {
325
- te as a,
326
- ne as b,
327
- ye as c,
328
- x as d,
329
- ge as e,
330
- Te as f,
331
- De as g,
332
- be as h,
333
- de as i,
334
- pe as j,
335
- F as k,
336
- oe as l,
337
- se as m,
338
- ae as n,
339
- w as p,
340
- Me as r
341
- };