react-semaphor 0.1.568 → 0.1.570

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 (191) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/appearance/index.js +6 -3
  4. package/dist/appearance-runtime/index.js +1 -1
  5. package/dist/assistant-context/index.js +1 -1
  6. package/dist/brand-studio/index.js +572 -436
  7. package/dist/briefings/index.js +4 -4
  8. package/dist/chunks/appearance-context-BwBp25ZG.js +162 -0
  9. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +80 -0
  10. package/dist/chunks/assistant-chat-B-Ddyy8b.js +5940 -0
  11. package/dist/chunks/{bookmark-impact-CJ-65omV.js → bookmark-impact-DCYD-6Fr.js} +2 -2
  12. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  13. package/dist/chunks/brand-B4BdpAB_.js +54 -0
  14. package/dist/chunks/{card-filter-builder-BBuB99GZ.js → card-filter-builder-0VvKmRst.js} +992 -991
  15. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-PtcDWvkN.js} +252 -253
  16. package/dist/chunks/{dashboard-YnWZC4dK.js → dashboard-DxGIr1vZ.js} +1 -1
  17. package/dist/chunks/{dashboard-briefing-launcher-BF89TU2h.js → dashboard-briefing-launcher-B-quOOOQ.js} +253 -253
  18. package/dist/chunks/{dashboard-controls-atHc1EjP.js → dashboard-controls-Caodx80b.js} +288 -285
  19. package/dist/chunks/dashboard-json-Ct-AGDHF.js +66 -0
  20. package/dist/chunks/{dates-CKO05ino.js → dates-B9mL8BHE.js} +16 -15
  21. package/dist/chunks/edit-Bpdh_P_a.js +226 -0
  22. package/dist/chunks/{edit-dashboard-visual-DdmTfn-J.js → edit-dashboard-visual-DeDTuYB5.js} +2257 -2270
  23. package/dist/chunks/{filter-reach-copy-jZGzK_IH.js → filter-reach-copy-BSY33ro5.js} +1440 -1301
  24. package/dist/chunks/filter-value-text-DvvSNlho.js +146 -0
  25. package/dist/chunks/index-BVKzKl5d.js +90 -0
  26. package/dist/chunks/{index-RNaTnE3m.js → index-CV_Kzou0.js} +233 -223
  27. package/dist/chunks/{index-CPNZW0mu.js → index-y3HUzRNk.js} +76 -77
  28. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-8rR-LPTk.js} +1 -1
  29. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C1-uTgjR.js} +1 -1
  30. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  31. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  32. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  33. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  34. package/dist/chunks/paintbrush-aR17Z3C9.js +27 -0
  35. package/dist/chunks/{palette-4vf2BEEg.js → palette-a5FCZKFI.js} +1 -1
  36. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → pickers-DkqmtnTL.js} +352 -290
  37. package/dist/chunks/pivot-result-contract-expectations-C-HnUKYe.js +55 -0
  38. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  39. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  40. package/dist/chunks/{report-preferences-dialog-Mbd-I0wV.js → report-preferences-dialog-Yvhv3WX2.js} +95 -97
  41. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  42. package/dist/chunks/{resolve-dashboard-input-context-Du0fjN3h.js → resolve-dashboard-input-context-Lkbwycwe.js} +5491 -5683
  43. package/dist/chunks/resolver-DG_tfEpt.js +156 -0
  44. package/dist/chunks/{save-D6pHmSSP.js → save-D985VvYp.js} +1 -1
  45. package/dist/chunks/{saved-dashboard-context-y8N6RvjS.js → saved-dashboard-context-DC_TEd6y.js} +6 -6
  46. package/dist/chunks/schema-C9NPiIru.js +2568 -0
  47. package/dist/chunks/{semaphor-ready-indicator-BSEdUq40.js → semaphor-ready-indicator-ByFvqHEO.js} +35916 -36001
  48. package/dist/chunks/{shelf-drop-preview-context-D7QqPl36.js → shelf-drop-preview-context-CjoVaK6J.js} +64 -66
  49. package/dist/chunks/{stored-dashboard-d3xQYxBD.js → stored-dashboard-C0hekXiI.js} +332 -333
  50. package/dist/chunks/{code-editor-DJNOsgJH.js → style-sheet-parts-C7qGZuH1.js} +2402 -2040
  51. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-CP8zSOhj.js} +1 -1
  52. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-CqbJjIuu.js} +18 -18
  53. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  54. package/dist/chunks/{upload-Cf3wXZT8.js → upload-CiGNKJ_0.js} +1 -1
  55. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  56. package/dist/chunks/{variable-draft-DOX03R4A.js → variable-draft-9-huI1h4.js} +4 -4
  57. package/dist/dashboard/index.js +2 -2
  58. package/dist/dashboard-authoring/index.js +1888 -1826
  59. package/dist/format-utils/index.js +230 -231
  60. package/dist/index.js +349 -353
  61. package/dist/layouts/index.js +1 -1
  62. package/dist/report-runtime-context/index.js +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/appearance/index.d.ts +1 -0
  66. package/dist/types/brand-studio/brand-studio-draft.d.ts +7 -0
  67. package/dist/types/brand-studio/index.d.ts +1 -1
  68. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  69. package/dist/types/components/providers/appearance-runtime-provider.d.ts +4 -1
  70. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -2
  71. package/dist/types/components/sharing-and-management/utils/types.d.ts +0 -72
  72. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  73. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  74. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -1
  75. package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -9
  76. package/dist/types/components/visual/data-table/utils/pagination-utils.d.ts +0 -19
  77. package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -1
  78. package/dist/types/index.js +9 -9
  79. package/dist/types/lib/appearance/aliases.d.ts +42 -0
  80. package/dist/types/lib/appearance/compiler.d.ts +6 -0
  81. package/dist/types/lib/appearance/defaults.d.ts +6 -0
  82. package/dist/types/lib/appearance/index.d.ts +2 -0
  83. package/dist/types/lib/appearance/normalize-organization.d.ts +17 -0
  84. package/dist/types/lib/appearance/resolver.d.ts +2 -2
  85. package/dist/types/lib/appearance/types.d.ts +38 -1
  86. package/dist/types/lib/charts/types.d.ts +6 -2
  87. package/dist/types/lib/dashboard/semantic-dataset-references.d.ts +0 -1
  88. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +0 -2
  89. package/dist/types/lib/dashboard-variables/types.d.ts +1 -6
  90. package/dist/types/lib/download-pdf.d.ts +0 -1
  91. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -4
  92. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  93. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  94. package/dist/types/lib/stores/dashboard-store.d.ts +15 -6
  95. package/dist/types/lib/stores/editor-store.d.ts +0 -1
  96. package/dist/types/lib/stores/table-actions.d.ts +0 -1
  97. package/dist/types/lib/table-formatting/table-formatting-css.d.ts +0 -5
  98. package/dist/types/lib/types/common-types.d.ts +3 -2
  99. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  100. package/dist/types/lib/types/index.d.ts +1 -1
  101. package/dist/types/lib/types/summary-types.d.ts +0 -5
  102. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  103. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  104. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +4 -4
  105. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  107. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +10 -10
  108. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  109. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  110. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +72 -72
  111. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  112. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  113. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  114. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  115. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  116. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  117. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  118. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  119. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  120. package/dist/types/shared/assistant-protocol/context.d.ts +30 -30
  121. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +344 -1772
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +4 -1
  124. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  125. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +9 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +104 -104
  127. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  128. package/dist/types/shared/dashboard-authoring/dashboard-style/bounds.d.ts +17 -0
  129. package/dist/types/shared/dashboard-authoring/dashboard-style/brand.d.ts +20 -0
  130. package/dist/types/shared/dashboard-authoring/dashboard-style/edit-words.d.ts +7 -0
  131. package/dist/types/shared/dashboard-authoring/dashboard-style/edit.d.ts +19 -0
  132. package/dist/types/shared/dashboard-authoring/dashboard-style/index.d.ts +15 -0
  133. package/dist/types/shared/dashboard-authoring/dashboard-style/layers.d.ts +19 -0
  134. package/dist/types/shared/dashboard-authoring/dashboard-style/legacy.d.ts +21 -0
  135. package/dist/types/shared/dashboard-authoring/dashboard-style/parse.d.ts +18 -0
  136. package/dist/types/shared/dashboard-authoring/dashboard-style/pickers.d.ts +12 -0
  137. package/dist/types/shared/dashboard-authoring/dashboard-style/types.d.ts +122 -0
  138. package/dist/types/shared/dashboard-authoring/dashboard-style/view.d.ts +10 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +11 -0
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +23 -0
  142. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  144. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  145. package/dist/types/shared/format-utils/matrix-continuation.d.ts +10 -10
  146. package/dist/types/shared/temporal/index.d.ts +0 -2
  147. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  148. package/package.json +7 -26
  149. package/DATA_APP_SDK.md +0 -339
  150. package/dist/chunks/appearance-context-DEYtWinQ.js +0 -126
  151. package/dist/chunks/appearance-runtime-provider-B-M8gwlZ.js +0 -81
  152. package/dist/chunks/assistant-chat-BN5I8KuN.js +0 -8849
  153. package/dist/chunks/color-CJvdlFM_.js +0 -2162
  154. package/dist/chunks/dashboard-json-Cxp3inxd.js +0 -68
  155. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  156. package/dist/chunks/index-CLIro-EG.js +0 -425
  157. package/dist/chunks/index-CuHybtft.js +0 -51
  158. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  159. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  160. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  161. package/dist/chunks/operators-B3zZoskU.js +0 -66
  162. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  163. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  164. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  165. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  166. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  167. package/dist/data-app-sdk/index.js +0 -1412
  168. package/dist/data-app-sdk-adapters/index.js +0 -361
  169. package/dist/data-app-sdk-validation/index.js +0 -1031
  170. package/dist/types/components/sharing-and-management/utils/group-types.d.ts +0 -105
  171. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  172. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  173. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  174. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  175. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  176. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  177. package/dist/types/data-app-sdk/index.d.ts +0 -9
  178. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  179. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  180. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  181. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  182. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  183. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  184. package/dist/types/data-app-sdk.d.ts +0 -2
  185. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  186. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  187. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  188. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  189. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  190. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  191. package/src/data-app-sdk/README.md +0 -402
@@ -1,361 +0,0 @@
1
- import { n as y } from "../chunks/operators-B3zZoskU.js";
2
- import { m as v, s as m, p as I, a as S } from "../chunks/validators-wtjw0aw6.js";
3
- import { a as F, c as b } from "../chunks/matrix-operation-contract-Eb6elidS.js";
4
- import "../chunks/analytics-base-schemas-BaIQrEzX.js";
5
- import "zod";
6
- function w(i) {
7
- var n, r, o;
8
- const t = R(i);
9
- return {
10
- version: 1,
11
- kind: "metric",
12
- id: i.id,
13
- label: i.label,
14
- source: s(i),
15
- measures: t,
16
- primaryMeasure: M(i, t),
17
- dateField: i.dateField ? a(i.dateField, "date") : void 0,
18
- timeGrain: i.timeGrain,
19
- dimensions: (n = i.dimensions) == null ? void 0 : n.map((e) => a(e, "dimension")),
20
- comparison: x(i.comparison),
21
- orderBy: i.orderBy ? {
22
- field: a(i.orderBy.field),
23
- direction: i.orderBy.direction
24
- } : void 0,
25
- inputs: d(i.inputs),
26
- ...(r = i.filters) != null && r.length ? { filters: i.filters } : {},
27
- ...i.relationshipHint ? { relationshipHint: i.relationshipHint } : {},
28
- limit: i.limit,
29
- ...(o = i.derivedFields) != null && o.length ? { derivedFields: i.derivedFields } : {}
30
- };
31
- }
32
- function j(i) {
33
- return {
34
- ...w(i),
35
- ...i.timeWindow ? { timeWindow: i.timeWindow } : {},
36
- ...i.analysis ? { analysis: i.analysis } : {}
37
- };
38
- }
39
- function K(i) {
40
- return {
41
- ...i.chartTitle ? { chartTitle: i.chartTitle } : {},
42
- ...i.chartType ? { chartType: i.chartType } : {},
43
- ...i.driverMode ? { driverMode: i.driverMode } : {},
44
- ...i.includePopulation !== void 0 ? { includePopulation: i.includePopulation } : {},
45
- ...i.calendarContext ? { calendarContext: i.calendarContext } : {}
46
- };
47
- }
48
- function M(i, t) {
49
- if (!i.primaryMeasure)
50
- return t[0] || { name: "", role: "measure" };
51
- const n = a(i.primaryMeasure, "measure"), r = B(n, t), o = r.length === 1 ? r[0] : void 0;
52
- return o ? f(n, o) : n;
53
- }
54
- function R(i) {
55
- const t = [];
56
- for (const n of i.measures.map(
57
- (r) => a(r, "measure")
58
- )) {
59
- if (!n.name)
60
- continue;
61
- const r = t.findIndex(
62
- (o) => k(o, n)
63
- );
64
- if (r === -1) {
65
- t.push(n);
66
- continue;
67
- }
68
- t[r] = f(
69
- t[r],
70
- n
71
- );
72
- }
73
- return t;
74
- }
75
- function k(i, t) {
76
- return m(i, t) && l(i) === l(t);
77
- }
78
- function H(i, t) {
79
- return l(t) === l(i);
80
- }
81
- function A(i, t) {
82
- return t.name !== i.name || i.source && !m(t, i) ? !1 : H(i, t);
83
- }
84
- function B(i, t) {
85
- const n = t.filter(
86
- (r) => A(i, r)
87
- );
88
- return i.aggregate !== void 0, n;
89
- }
90
- function l(i) {
91
- return S(i);
92
- }
93
- function f(i, t) {
94
- if (i.aggregate && t.aggregate && i.aggregate !== t.aggregate)
95
- throw new Error(
96
- `Measure "${i.name}" was requested with conflicting aggregate semantics: ${i.aggregate} and ${t.aggregate}.`
97
- );
98
- return {
99
- ...I(i, t),
100
- aggregate: i.aggregate || t.aggregate
101
- };
102
- }
103
- function V(i) {
104
- var n, r;
105
- if ("sort" in i)
106
- throw new Error(
107
- "semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
108
- );
109
- if (!q(i))
110
- throw new Error("semaphor.records needs at least one field.");
111
- const t = O(i.fields);
112
- return {
113
- version: 1,
114
- kind: "records",
115
- id: i.id,
116
- label: i.label,
117
- source: s(i),
118
- fields: t,
119
- dateField: i.dateField ? a(i.dateField, "date") : void 0,
120
- timeGrain: i.timeGrain,
121
- ...i.timeWindow ? { timeWindow: i.timeWindow } : {},
122
- ...(n = i.filters) != null && n.length ? { filters: i.filters } : {},
123
- orderBy: i.orderBy ? {
124
- field: a(i.orderBy.field),
125
- direction: i.orderBy.direction
126
- } : void 0,
127
- inputs: d(i.inputs),
128
- ...i.relationshipHint ? { relationshipHint: i.relationshipHint } : {},
129
- limit: i.limit,
130
- ...i.pagination ? { pagination: i.pagination } : {},
131
- ...i.totals ? {
132
- totals: {
133
- mode: "server",
134
- measures: i.totals.measures.map(
135
- (o) => a(o, "measure")
136
- )
137
- }
138
- } : {},
139
- ...(r = i.derivedFields) != null && r.length ? { derivedFields: i.derivedFields } : {}
140
- };
141
- }
142
- function O(i) {
143
- return i.map((t) => {
144
- const n = a(t);
145
- if (!n.role)
146
- throw new Error(
147
- `semaphor.records field "${n.name}" needs an explicit role.`
148
- );
149
- return n;
150
- });
151
- }
152
- function Q(i) {
153
- var n, r, o;
154
- const t = s(i);
155
- if (t.kind === "sql")
156
- throw new Error(
157
- "semaphor.inputOptions requires a semantic or physical option source."
158
- );
159
- return {
160
- version: 1,
161
- kind: "inputOptions",
162
- id: i.id,
163
- label: i.label,
164
- inputId: i.inputId,
165
- source: t,
166
- labelField: a(i.labelField, "dimension"),
167
- valueField: a(i.valueField, "dimension"),
168
- ...i.searchField ? { searchField: a(i.searchField, "dimension") } : {},
169
- ...(n = i.disambiguationFields) != null && n.length ? {
170
- disambiguationFields: i.disambiguationFields.map(
171
- (e) => a(e, "dimension")
172
- )
173
- } : {},
174
- ...i.population ? { population: i.population } : {},
175
- ...i.dependencies ? { dependencies: i.dependencies } : {},
176
- search: i.search,
177
- limit: i.limit,
178
- ...(r = i.inputs) != null && r.length ? { inputs: i.inputs.map((e) => h(e)) } : {},
179
- ...(o = i.derivedFields) != null && o.length ? { derivedFields: i.derivedFields } : {}
180
- };
181
- }
182
- function D(i) {
183
- var t;
184
- return {
185
- version: 1,
186
- kind: "sql",
187
- id: i.id,
188
- label: i.label,
189
- source: i.source,
190
- sql: i.sql,
191
- ...i.defaultParameters ? { defaultParameters: i.defaultParameters } : {},
192
- ...i.pythonCode ? { pythonCode: i.pythonCode } : {},
193
- ...(t = i.fields) != null && t.length ? { fields: i.fields.map((n) => a(n)) } : {},
194
- inputs: d(i.inputs),
195
- limit: i.limit,
196
- ...i.pagination ? { pagination: i.pagination } : {},
197
- rationale: i.rationale
198
- };
199
- }
200
- function J(i) {
201
- const { id: t, label: n, inputs: r, matrixWindowRequest: o, ...e } = i, { queryKind: T, ...p } = e;
202
- return v.parse({ ...p, kind: "matrix" });
203
- }
204
- function h(i) {
205
- if ("toAnalyticsInput" in i) {
206
- const e = i.toAnalyticsInput();
207
- return {
208
- inputId: e.inputId,
209
- kind: e.kind,
210
- ...e.controlRole ? { controlRole: e.controlRole } : {},
211
- ...e.operator ? { operator: e.operator } : {},
212
- ...e.field ? { field: e.field } : {},
213
- ...e.relationshipHint ? { relationshipHint: e.relationshipHint } : {}
214
- };
215
- }
216
- if ("id" in i) {
217
- const e = g(i);
218
- return {
219
- inputId: e.inputId,
220
- kind: e.kind,
221
- ...e.controlRole ? { controlRole: e.controlRole } : {},
222
- ...e.operator ? { operator: e.operator } : {},
223
- ...e.field ? { field: e.field } : {},
224
- ...e.relationshipHint ? { relationshipHint: e.relationshipHint } : {}
225
- };
226
- }
227
- const t = "kind" in i ? i.kind : void 0, n = "operator" in i ? c(i.operator, i.inputId) : void 0, r = "controlRole" in i ? i.controlRole : "role" in i ? i.role : void 0, o = z(r) ? r : void 0;
228
- return {
229
- inputId: i.inputId,
230
- ...t ? { kind: t } : {},
231
- ...o ? { controlRole: o } : {},
232
- ...n ? { operator: n } : {},
233
- ...i.field ? { field: i.field } : {},
234
- ...i.relationshipHint ? { relationshipHint: i.relationshipHint } : {}
235
- };
236
- }
237
- function z(i) {
238
- return i === "grain" || i === "measure" || i === "dimension" || i === "aggregation" || i === "sqlParam";
239
- }
240
- function L(i) {
241
- const t = d(i);
242
- return t.length > 0 ? t : void 0;
243
- }
244
- function C(i) {
245
- return (i || []).map(P);
246
- }
247
- function N(i) {
248
- return C(i).filter((t) => t.isActive);
249
- }
250
- function U(i) {
251
- const t = (i || []).flatMap((n) => {
252
- const r = "toAnalyticsSelection" in n ? n.toAnalyticsSelection() : n;
253
- return r ? [F.parse(r)] : [];
254
- });
255
- return b(t);
256
- }
257
- function g(i) {
258
- if (i.kind === "filter") {
259
- const t = c(i.operator, i.id);
260
- return {
261
- inputId: i.id,
262
- kind: i.kind,
263
- label: i.label,
264
- field: a(i.field, "dimension"),
265
- operator: t || "in",
266
- ...i.relationshipHint ? { relationshipHint: i.relationshipHint } : {}
267
- };
268
- }
269
- return {
270
- inputId: i.id,
271
- kind: i.kind,
272
- label: i.label,
273
- controlRole: i.role
274
- };
275
- }
276
- function X(i = []) {
277
- return i.map(
278
- (t) => typeof t == "object" ? t : {
279
- label: String(t),
280
- value: t
281
- }
282
- );
283
- }
284
- function u(i) {
285
- return i == null ? !1 : Array.isArray(i) ? i.length > 0 : typeof i == "string" ? i.trim().length > 0 : !0;
286
- }
287
- function P(i) {
288
- if ("toAnalyticsInput" in i)
289
- return i.toAnalyticsInput();
290
- if ("kind" in i && "isActive" in i)
291
- return i;
292
- if ("id" in i) {
293
- const t = g(i), n = Object.prototype.hasOwnProperty.call(i, "value") ? i.value : i.defaultValue;
294
- return {
295
- inputId: t.inputId,
296
- kind: t.kind,
297
- label: t.label,
298
- ...t.field ? { field: t.field } : {},
299
- ...t.operator ? { operator: t.operator } : {},
300
- ...t.controlRole ? { controlRole: t.controlRole } : {},
301
- ...t.relationshipHint ? { relationshipHint: t.relationshipHint } : {},
302
- value: n,
303
- isActive: u(n)
304
- };
305
- }
306
- return {
307
- ...i,
308
- kind: "filter",
309
- isActive: u(
310
- i.value
311
- ),
312
- value: i.value
313
- };
314
- }
315
- function s(i) {
316
- return i.source;
317
- }
318
- function q(i) {
319
- var t;
320
- return !!((t = i.fields) != null && t.length);
321
- }
322
- function a(i, t) {
323
- return {
324
- ...i,
325
- role: i.role || t
326
- };
327
- }
328
- function d(i) {
329
- return (i || []).map(h);
330
- }
331
- function x(i) {
332
- if (i)
333
- return i;
334
- }
335
- function c(i, t) {
336
- if (i === void 0)
337
- return;
338
- const n = y(i);
339
- if (!n)
340
- throw new Error(
341
- `useSemaphorInput "${t}" uses unsupported filter operator "${i}".`
342
- );
343
- return n;
344
- }
345
- export {
346
- u as hasSemaphorInputValue,
347
- X as normalizeSemaphorInputOptions,
348
- N as toSemaphorActiveInputSnapshots,
349
- j as toSemaphorAnalysisIntent,
350
- K as toSemaphorAnalysisQueryOptions,
351
- h as toSemaphorInputBinding,
352
- L as toSemaphorInputBindings,
353
- Q as toSemaphorInputOptionsIntent,
354
- C as toSemaphorInputSnapshots,
355
- g as toSemaphorInputSpec,
356
- J as toSemaphorMatrixIntent,
357
- w as toSemaphorMetricIntent,
358
- V as toSemaphorRecordsIntent,
359
- U as toSemaphorSelectionSnapshots,
360
- D as toSemaphorSqlIntent
361
- };