react-semaphor 0.1.602 → 0.1.603

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/analytics-protocol/index.js +415 -375
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +8 -8
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{add-to-dashboard-ClhEIFst.js → add-to-dashboard-CFF-wFU-.js} +1 -1
  7. package/dist/chunks/{analytics-base-schemas-DevrgqQb.js → analytics-base-schemas-DsUh5Q3C.js} +14 -12
  8. package/dist/chunks/{assistant-chat-BWF3GYip.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-BF3iRx5a.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-CBSTdW6q.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-B8XHwMY6.js → card-filter-builder-Y22HizVx.js} +104 -104
  12. package/dist/chunks/{comparison-window-caption-W83qB4V5.js → comparison-window-caption-Ck2TIbnR.js} +69 -69
  13. package/dist/chunks/{context-BJoEFgNl.js → context-UCQ7sere.js} +1 -1
  14. package/dist/chunks/{dashboard-DG5EIYYB.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CBSrhyWZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +103 -103
  16. package/dist/chunks/{dashboard-controls-D6ECO4N1.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-DrJftBSL.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-BDYAJIbb.js → edit-dashboard-visual-oxt3x1wb.js} +7976 -8184
  20. package/dist/chunks/{filter-line-BXT6y303.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-BukhZmzm.js → filter-reach-copy-CE_ZX147.js} +1590 -1729
  22. package/dist/chunks/{filter-value-text-D3-bf3_b.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-BW0yozjs.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-Ds0diMeY.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CgQgVeeI.js → matrix-analytical-definition-CCp48UCw.js} +496 -425
  26. package/dist/chunks/matrix-member-presentation-zNehruXR.js +391 -0
  27. package/dist/chunks/{matrix-operation-contract--DkNCOzd.js → matrix-operation-contract-DPBj69D8.js} +3 -2
  28. package/dist/chunks/{metric-comparison-zMylnIkc.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-CX8pao1j.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-CuA0HlzF.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C8KL7hPx.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-C1AOH1PS.js → pivot-result-identity-CAP4--iq.js} +1 -1
  33. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +3778 -0
  34. package/dist/chunks/{report-preferences-dialog-CbuVNDGi.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-E7USjN7E.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-CULCE_hM.js → resolve-dashboard-input-context-Rtl1ffmE.js} +7115 -6963
  37. package/dist/chunks/{save-BKHlDONy.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-C1WlOx5z.js → saved-dashboard-context-tcyTU8jm.js} +193 -207
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-CBIRcDWs.js → semaphor-ready-indicator-FBvunj6S.js} +35550 -35273
  41. package/dist/chunks/{shelf-drop-preview-context-xR69SMA8.js → shelf-drop-preview-context-QKStrcK9.js} +6 -6
  42. package/dist/chunks/{stored-dashboard-BuM8vnWf.js → stored-dashboard-CHozcAY9.js} +621 -616
  43. package/dist/chunks/{style-sheet-parts-Bt9ZNre8.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-DVljtHkG.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-D_xKgyVS.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Dll_M7XQ.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-ClWHpYql.js → validators-Baf3VIf5.js} +3 -3
  48. package/dist/chunks/{variable-draft-CDGGl53R.js → variable-draft-C2y8Jp6Z.js} +3 -3
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +2466 -2343
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +20 -20
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  57. package/dist/types/index.js +5 -5
  58. package/dist/types/lib/document/document-edits.d.ts +0 -4
  59. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  60. package/dist/types/lib/types/common-types.d.ts +0 -2
  61. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  62. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  63. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  64. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  65. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  66. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  67. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  68. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  69. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  70. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  71. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  72. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  73. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  74. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  75. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  76. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  77. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  78. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  79. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  80. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  81. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  82. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  83. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  84. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  85. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  86. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  87. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  88. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  89. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  91. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  92. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  93. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  94. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  95. package/dist/types/shared/format-utils/index.d.ts +1 -0
  96. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  97. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  98. package/dist/types/shared/temporal/index.d.ts +2 -0
  99. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  100. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  101. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  102. package/dist/usage-events/index.js +1 -1
  103. package/package.json +3 -2
  104. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  105. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  106. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  107. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.602",
8
+ "version": "0.1.603",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -117,7 +117,7 @@
117
117
  "build": "node scripts/build.mjs",
118
118
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
119
119
  "lint:regressions": "node scripts/lint-regressions.mjs",
120
- "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs",
120
+ "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs && node scripts/comparison-words.mjs",
121
121
  "preview": "vite preview",
122
122
  "test": "vitest run",
123
123
  "test:changed": "vitest run --changed",
@@ -222,6 +222,7 @@
222
222
  "sonner": "^1.5.0",
223
223
  "tailwind-merge": "^2.1.0",
224
224
  "tailwindcss-animate": "^1.0.7",
225
+ "temporal-polyfill": "1.0.8",
225
226
  "uuid": "^9.0.1",
226
227
  "zod": "^3.25.76",
227
228
  "zustand": "^5.0.9"
@@ -1,164 +0,0 @@
1
- import { k as h, m as D, n as F, r as b, e as m, o as g } from "./resolve-dashboard-input-context-CULCE_hM.js";
2
- import { d as y, g as T } from "./filter-reach-copy-BukhZmzm.js";
3
- import "./validators-ClWHpYql.js";
4
- import "./matrix-operation-contract--DkNCOzd.js";
5
- import "./analytics-base-schemas-DevrgqQb.js";
6
- import "zod";
7
- import "./pivot-result-contract-expectations-C8KL7hPx.js";
8
- import "../value-format-preferences/index.js";
9
- import { D as N } from "./bookmark-state-CBSTdW6q.js";
10
- import "./schema-C9NPiIru.js";
11
- import "./index-CV_Kzou0.js";
12
- import "./context-BJoEFgNl.js";
13
- import { p as P, r as w } from "./stored-dashboard-BuM8vnWf.js";
14
- import { g as C } from "./saved-dashboard-context-C1WlOx5z.js";
15
- function H(e, a, r) {
16
- const t = e.findIndex((o) => o.id === a);
17
- if (t === -1) return e;
18
- const n = e.filter((o, s) => s !== t), i = Math.max(0, Math.min(Math.trunc(r), n.length));
19
- return i === t ? e : [...n.slice(0, i), e[t], ...n.slice(i)];
20
- }
21
- const I = /* @__PURE__ */ new Set([
22
- "bar",
23
- "line",
24
- "pie",
25
- "doughnut",
26
- "table",
27
- "detailTable",
28
- "stackedBar",
29
- "stackedLine",
30
- "horizontalBar",
31
- "radar",
32
- "polarArea",
33
- "scatter",
34
- "bubble",
35
- "funnel",
36
- "custom"
37
- ]);
38
- function U(e) {
39
- return !!(e && I.has(e));
40
- }
41
- const k = 250;
42
- function Y(e) {
43
- return {
44
- id: e.id,
45
- ...h(e.field, {
46
- dataSource: e.dataSource,
47
- connectionId: e.connectionId
48
- }),
49
- width: k
50
- };
51
- }
52
- function J(e, a, r) {
53
- const t = e.flatMap((n) => {
54
- if (r !== void 0 && n.id !== r) return [];
55
- const i = (n.inlineFilters ?? []).findIndex((o) => o.id === a);
56
- return i === -1 ? [] : [{ card: n, filter: n.inlineFilters[i], index: i }];
57
- });
58
- return t.length === 1 ? { kind: "found", ...t[0] } : t.length > 1 ? { kind: "ambiguous", cards: t.map((n) => n.card) } : { kind: "none" };
59
- }
60
- const X = ["hour", "day", "week", "month", "quarter", "year"], Z = 12, R = {
61
- automatic: "Automatic",
62
- card: "Set on this card",
63
- trend_by: "From Trend By"
64
- };
65
- function G(e, a, r = {}) {
66
- if (!e) return;
67
- const t = e.granularity;
68
- if (e.skipped)
69
- return {
70
- head: `Too many points by ${t}`,
71
- // A Trend By sets the grain, so the fix is there (ledger P3-05).
72
- detail: e.grainSource === "trend_by" ? "Pick a coarser grain on the Trend By." : "Pick a coarser grain, or Automatic."
73
- };
74
- const n = R[e.grainSource], i = e.span === "recent" ? `The last 12 ${t}s: no date range` : e.span === "history" ? `The 12 ${t}s ending with this one` : e.window ? y({ ...e.window, timezone: e.calendar.tz }, r.now) : void 0;
75
- return {
76
- head: `By ${t} · ${a} ${a === 1 ? "point" : "points"}`,
77
- detail: i ? `${i} · ${n}` : n
78
- };
79
- }
80
- function S(e, a) {
81
- var t;
82
- if (a.status === "blocked" || (t = e.sql) != null && t.trim()) return !1;
83
- const r = new Set(
84
- a.mappingDispositions.flatMap(
85
- (n) => n.status === "apply" ? [n.filterValue.filterId] : []
86
- )
87
- );
88
- return a.cardFilterValues.some((n) => {
89
- const i = a.queryFilterDefinitions.find(
90
- (d) => d.id === n.filterId
91
- );
92
- if (!D(n)) return !1;
93
- if (!(r.has(n.filterId) || (i == null ? void 0 : i.kind) === "global-date"))
94
- return !!(i && q(
95
- [i],
96
- a.resolvedPrimaryDateField,
97
- [n]
98
- ));
99
- const s = F(n);
100
- return !!(s && b({
101
- card: e,
102
- filter: s,
103
- filterValue: n,
104
- effectiveFilterValue: n,
105
- temporalBinding: a.resolvedPrimaryDateField
106
- }).status === "eligible");
107
- });
108
- }
109
- function q(e, a, r) {
110
- if (!a) return !1;
111
- const t = a.qualifiedFieldName, n = a.qualifiedEntityName, i = n && a.name ? `${n}.${a.name}` : t;
112
- return e.some((o) => {
113
- if (!(m(o.dataType || "") === "date")) return !1;
114
- const d = T(o, r), l = d.split("."), c = l[l.length - 1] || d, p = l.length > 1 ? l.slice(0, -1).join(".") : void 0, f = o.qualifiedTableName || p, u = f ? `${f}.${c}` : void 0;
115
- return t ? u ? u === i || u.endsWith(`.${t}`) : c === a.name : u ? u === i : c === a.name;
116
- });
117
- }
118
- function _(e, a) {
119
- const r = (i) => {
120
- const o = i.field;
121
- return o ? a.id && o.id === a.id ? !0 : a.qualifiedFieldName && o.qualifiedFieldName ? o.qualifiedFieldName === a.qualifiedFieldName : o.name === a.name : !1;
122
- }, t = (i) => i.conditions.some((o) => {
123
- var s;
124
- return m(((s = o.field) == null ? void 0 : s.dataType) || "") === "date" && r(o);
125
- }) || i.groups.some(t), n = g(e);
126
- return n ? t(n) : !1;
127
- }
128
- function v(e, a) {
129
- var s, d;
130
- const r = (d = (s = e.config) == null ? void 0 : s.groupByColumns) == null ? void 0 : d.find((l) => m(l.dataType || "") === "date"), t = a.resolvedPrimaryDateField, n = r ? { id: r.id, name: r.name, label: r.label || r.name, qualifiedFieldName: r.qualifiedFieldName } : t ? { name: t.name, label: t.name, qualifiedFieldName: t.qualifiedFieldName } : void 0;
131
- if (!n) return { comparisonDate: null, dateWindow: a.status === "ready" ? "none" : "unknown" };
132
- const i = { name: n.name, label: n.label };
133
- if (_(e, n)) return { comparisonDate: i, dateWindow: "applies" };
134
- if (a.status !== "ready") return { comparisonDate: i, dateWindow: "unknown" };
135
- const o = S(e, { status: "ready", ...a.compiledFilters });
136
- return { comparisonDate: i, dateWindow: o ? "applies" : "none" };
137
- }
138
- function ee(e) {
139
- const a = P(e.dashboard), r = N(a).find((o) => o.cardId === e.cardId);
140
- if (!r || r.kind === "documentSectionCard") return { comparisonDate: null, dateWindow: "unknown" };
141
- const { runtimeValues: t, transientContexts: n } = w({ dashboard: a, capture: {}, calendar: e.calendar }), i = C({
142
- dashboard: a,
143
- location: r,
144
- runtimeValues: t,
145
- semanticExecutionPayload: e.semanticExecutionPayload,
146
- calendar: e.calendar,
147
- transientContexts: n
148
- });
149
- return v(
150
- r.card,
151
- (i == null ? void 0 : i.status) === "ready" ? { status: "ready", compiledFilters: i.compiledFilters, resolvedPrimaryDateField: i.resolvedPrimaryDateField } : { status: "blocked", resolvedPrimaryDateField: i == null ? void 0 : i.resolvedPrimaryDateField }
152
- );
153
- }
154
- export {
155
- X as K,
156
- Z as a,
157
- Y as b,
158
- U as c,
159
- G as d,
160
- ee as e,
161
- J as f,
162
- H as m,
163
- v as r
164
- };
@@ -1,258 +0,0 @@
1
- import { m as p } from "./validators-ClWHpYql.js";
2
- function _(t) {
3
- const e = y(t);
4
- return h(e) ? e : void 0;
5
- }
6
- function y(t) {
7
- if (typeof t != "string" || t.trim().length === 0)
8
- return;
9
- const e = t.trim().toLowerCase();
10
- switch (e) {
11
- case "=":
12
- return "=";
13
- case "!=":
14
- return "!=";
15
- case "in":
16
- return "in";
17
- case "not_in":
18
- return "not_in";
19
- case "contains":
20
- return "contains";
21
- case "not_contains":
22
- return "not_contains";
23
- case "between":
24
- return "between";
25
- case "not_between":
26
- return "not_between";
27
- case ">":
28
- case ">=":
29
- case "<":
30
- case "<=":
31
- return e;
32
- case "is_null":
33
- return "is_null";
34
- case "is_not_null":
35
- return "is_not_null";
36
- default:
37
- return x(t) ? t : void 0;
38
- }
39
- }
40
- function h(t) {
41
- return t === "=" || t === "!=" || t === "in" || t === "not_in" || t === "contains" || t === "not_contains" || t === "between" || t === "not_between" || t === ">" || t === ">=" || t === "<" || t === "<=";
42
- }
43
- function x(t) {
44
- return h(t) || t === "not_contains" || t === "is_null" || t === "is_not_null";
45
- }
46
- function O(t) {
47
- switch (t) {
48
- case "not in":
49
- return "not_in";
50
- case "like":
51
- return "contains";
52
- case "not like":
53
- return "not_contains";
54
- case "not between":
55
- return "not_between";
56
- case "is null":
57
- case "is not null":
58
- return;
59
- default:
60
- return _(t);
61
- }
62
- }
63
- const E = [
64
- "=",
65
- "!=",
66
- ">",
67
- "<",
68
- ">=",
69
- "<=",
70
- "like",
71
- "not like",
72
- "between",
73
- "not between",
74
- "in",
75
- "not in",
76
- "is null",
77
- "is not null"
78
- ], N = /* @__PURE__ */ new Set(["string", "number", "date", "boolean"]);
79
- function A(t) {
80
- return typeof t == "string" && E.includes(t);
81
- }
82
- function P(t, e) {
83
- switch (t) {
84
- case "is null":
85
- case "is not null":
86
- return e.length === 0;
87
- case "between":
88
- case "not between":
89
- return e.length === 2;
90
- case "in":
91
- case "not in":
92
- return e.length >= 1;
93
- default:
94
- return e.length === 1;
95
- }
96
- }
97
- function R(t) {
98
- if (!t || typeof t != "object" || Array.isArray(t))
99
- return;
100
- const e = t, n = {};
101
- for (const o of S)
102
- e[o] !== void 0 && (n[o] = e[o]);
103
- return n;
104
- }
105
- const S = [
106
- "operation",
107
- "values",
108
- "valueType",
109
- "temporalBucket",
110
- "relativeMeta",
111
- "temporalPrecision"
112
- ];
113
- function M(t) {
114
- const e = R(t);
115
- if (!e) return;
116
- const { operation: n, values: o } = e;
117
- if (!A(n) || !Array.isArray(o) || !P(n, o)) return;
118
- const i = typeof e.valueType == "string" && N.has(e.valueType) ? e.valueType : void 0;
119
- return {
120
- operation: n,
121
- values: o,
122
- ...i ? { valueType: i } : {},
123
- ...e.temporalBucket !== void 0 ? { temporalBucket: e.temporalBucket } : {},
124
- ...e.relativeMeta !== void 0 ? { relativeMeta: e.relativeMeta } : {},
125
- ...e.temporalPrecision !== void 0 ? { temporalPrecision: e.temporalPrecision } : {}
126
- };
127
- }
128
- function B(t) {
129
- const e = M(t);
130
- if (!e)
131
- throw new Error(
132
- `Filter operation "${String(t.operation)}" cannot be expressed as predicate semantics.`
133
- );
134
- return e;
135
- }
136
- function I(t) {
137
- return t.operation === "is null" || t.operation === "is not null";
138
- }
139
- const w = "numeric_range", F = 32, T = (t) => typeof t == "number" && Number.isFinite(t), f = (t) => {
140
- if (T(t)) return t;
141
- if (typeof t == "string" && t.trim() !== "") {
142
- const e = Number(t);
143
- return Number.isFinite(e) ? e : null;
144
- }
145
- return null;
146
- };
147
- function V(t) {
148
- if (!t || typeof t != "object") return;
149
- const e = t;
150
- if (e.kind !== w) return;
151
- const n = f(e.min), o = f(e.max), i = f(e.emptyRows) ?? 0, c = e.bucketing === "value" ? "value" : "width", u = f(e.bucketWidth) ?? 0, r = Array.isArray(e.buckets) ? e.buckets.map((s) => Math.max(0, f(s) ?? 0)) : [];
152
- if (n === null == (o === null) && !(n !== null && o !== null && n > o) && !(r.length > 0 && !(u > 0)))
153
- return { kind: w, min: n, max: o, emptyRows: i, bucketing: c, buckets: r, bucketWidth: u };
154
- }
155
- function k(t) {
156
- return t.buckets.reduce((e, n) => e + n, 0);
157
- }
158
- function U(t, e) {
159
- const n = t.min ?? 0;
160
- return { from: n + e * t.bucketWidth, to: n + (e + 1) * t.bucketWidth };
161
- }
162
- function a(t, e, n) {
163
- const o = k(t);
164
- if (t.min === null || t.max === null || t.buckets.length === 0)
165
- return t.min === null ? { rows: 0, exact: !0 } : { rows: (n ? e >= t.min : e > t.min) ? o : 0, exact: !0 };
166
- if (t.bucketing === "value") {
167
- let s = 0;
168
- return t.buckets.forEach((l, d) => {
169
- const m = t.min + d;
170
- (n ? m <= e : m < e) && (s += l);
171
- }), { rows: s, exact: !0 };
172
- }
173
- if (e <= t.min) return { rows: 0, exact: !(n && e === t.min) };
174
- if (e >= t.max) return { rows: o, exact: n || e > t.max };
175
- const i = (e - t.min) / t.bucketWidth, c = Math.floor(i);
176
- let u = 0;
177
- for (let s = 0; s < c; s += 1) u += t.buckets[s] ?? 0;
178
- const r = i - c;
179
- return u += (t.buckets[c] ?? 0) * r, { rows: u, exact: r === 0 && !n };
180
- }
181
- function j(t, e, n) {
182
- const o = k(t), i = (r, ...s) => ({
183
- rows: Math.round(Math.max(0, Math.min(o, r))),
184
- exact: s.every(Boolean)
185
- }), [c, u] = n;
186
- switch (e) {
187
- case "is null":
188
- return { rows: t.emptyRows, exact: !0 };
189
- case "is not null":
190
- return { rows: o, exact: !0 };
191
- case ">=": {
192
- const r = a(t, c, !1);
193
- return i(o - r.rows, r.exact);
194
- }
195
- case ">": {
196
- const r = a(t, c, !0);
197
- return i(o - r.rows, r.exact);
198
- }
199
- case "<=": {
200
- const r = a(t, c, !0);
201
- return i(r.rows, r.exact);
202
- }
203
- case "<": {
204
- const r = a(t, c, !1);
205
- return i(r.rows, r.exact);
206
- }
207
- case "between":
208
- case "not between": {
209
- const r = a(t, u, !0), s = a(t, c, !1), l = r.rows - s.rows;
210
- return i(e === "between" ? l : o - l, r.exact, s.exact);
211
- }
212
- case "=":
213
- case "!=": {
214
- if (t.bucketing !== "value" && t.buckets.length > 0) return null;
215
- const r = a(t, c, !0).rows - a(t, c, !1).rows;
216
- return i(e === "=" ? r : o - r, !0);
217
- }
218
- default:
219
- return null;
220
- }
221
- }
222
- function C(t, e) {
223
- var o;
224
- if (e === null) return !0;
225
- if (e.overrides.length === 0) return t.length <= e.depth;
226
- const n = p(t);
227
- return ((o = e.overrides.find((i) => i.path.length === t.length && p(i.path) === n)) == null ? void 0 : o.expanded) ?? t.length <= e.depth;
228
- }
229
- function W(t) {
230
- var b;
231
- const { path: e, levelCount: n, expansion: o, total: i, axis: c } = t, u = e.length >= n || ((b = e[e.length - 1]) == null ? void 0 : b.member.kind) === "others", r = !u && !t.childrenEmpty, s = r && C(e, o), l = c === "rows" && t.rowLayout !== "tabular", d = s && !!t.skipRedundant && !!t.singleChild, m = !!(i != null && i.visible) && !d;
232
- return {
233
- expandable: r,
234
- expanded: s,
235
- memberVisible: l || !s,
236
- valueVisible: u || m && (!s || i.position === "before"),
237
- subtotalBefore: !l && s && m && i.position === "before",
238
- subtotalAfter: s && m && i.position === "after"
239
- };
240
- }
241
- export {
242
- E as N,
243
- y as a,
244
- M as b,
245
- B as c,
246
- w as d,
247
- F as e,
248
- k as f,
249
- U as g,
250
- j as h,
251
- I as i,
252
- C as j,
253
- W as k,
254
- _ as n,
255
- R as p,
256
- V as r,
257
- O as t
258
- };