@astrato-io/visualizations 0.8.0 → 0.10.0

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 (161) hide show
  1. package/README.md +9 -5
  2. package/THIRD_PARTY_NOTICES.md +403 -325
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-BrGKp9Nm.js → Button-CCF851ea.js} +10 -10
  5. package/chunks/CircularProgress-yupH6YWs.js +765 -0
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/LinearProgress-CyFjN4px.js +327 -0
  8. package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-CQpT79AP.js} +1391 -1008
  9. package/chunks/Title-C-p4ZarD.js +1804 -0
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-DEDvNq1k.js → builder-CScg1TOS.js} +156 -60
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-CncX_JRX.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/contains-BK-sRXcB.js +21 -0
  19. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  20. package/chunks/defaults-cyNhn37t.js +3 -0
  21. package/chunks/{definitions-BPJQTx16.js → definitions-C4grxhye.js} +612 -400
  22. package/chunks/{escobar-DRhRMYRE.js → escobar-CjirINHP.js} +5354 -5473
  23. package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-D-l9u_we.js} +974 -909
  24. package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-lji2Acgn.js} +7 -7
  25. package/chunks/{filtering-cc7WqWpg.js → filtering-C1zakrrX.js} +570 -390
  26. package/chunks/handlers-ZviIUC-j.js +15387 -0
  27. package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  28. package/chunks/isEqual-Ch9OEye3.js +16 -0
  29. package/chunks/isFocusVisible-CgMP0qkR.js +144 -0
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-De5fiKuR.js} +6 -6
  32. package/chunks/{logger-DpQtYQnX.js → logger-CKRjhSHQ.js} +77 -66
  33. package/chunks/map.compiler-CKzorLgK.js +345 -0
  34. package/chunks/{metadata-WABZrt7Y.js → metadata-Bb9pTXrq.js} +1 -1
  35. package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CaTmJkmi.js} +4 -4
  36. package/chunks/operations-DZoY50VX.js +31297 -0
  37. package/chunks/{range-Bi-7zT0k.js → range-D1BTmFMp.js} +2 -2
  38. package/chunks/react-dom-Dgv2azN2.js +368 -0
  39. package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-_P3xwu5A.js} +1 -1
  40. package/chunks/{requirements-Dvd8jqYF.js → requirements-NHNrR8Ie.js} +55 -53
  41. package/chunks/responsive.styles-FItb913l.js +93 -0
  42. package/chunks/shared-UitWpq1J.js +1331 -0
  43. package/chunks/standalone-B0U6c3su.js +3638 -0
  44. package/chunks/{standalone-we5D5MIn.js → standalone-BBu90BhK.js} +113 -113
  45. package/chunks/standalone-BEekPuA12.js +357 -0
  46. package/chunks/{standalone-BMTCb10X.js → standalone-BOzHA_d4.js} +41 -41
  47. package/chunks/standalone-BR2JuRIC.js +422 -0
  48. package/chunks/{standalone-BGkmozIb.js → standalone-BapqaniK.js} +619 -619
  49. package/chunks/standalone-Bnnr87pc.js +2009 -0
  50. package/chunks/standalone-BwJqDj2Z.js +396 -0
  51. package/chunks/{standalone-BDhPQtzQ.js → standalone-ByKKqT5L.js} +308 -300
  52. package/chunks/{standalone-vBnBS2YC.js → standalone-CRdDZYeM.js} +1788 -1004
  53. package/chunks/standalone-CRfDOO1x.js +287 -0
  54. package/chunks/{standalone-D5Q5ngsD.js → standalone-CVknVdUC.js} +30 -27
  55. package/chunks/standalone-CbPk8bKn.js +580 -0
  56. package/chunks/{standalone-CJvIXsQE.js → standalone-Ck63MZzj.js} +234 -232
  57. package/chunks/{standalone-CM5XcAN5.js → standalone-DCFY1MAV.js} +8075 -7729
  58. package/chunks/{standalone-DW6NT205.js → standalone-DZDGX3aa.js} +168 -168
  59. package/chunks/standalone-DhfgeJIk.js +1012 -0
  60. package/chunks/{standalone-DT0wKji7.js → standalone-DibjA73M.js} +2 -2
  61. package/chunks/{standalone-XuGksArp.js → standalone-DtBk_iUz.js} +9 -8
  62. package/chunks/standalone-DxBAyqAu.js +772 -0
  63. package/chunks/standalone-KMQPsNsq.js +2 -0
  64. package/chunks/standalone-MBLSvsrY.js +2 -0
  65. package/chunks/standalone-U0WJwFlG.js +354 -0
  66. package/chunks/{standalone-C8ZAEutO.js → standalone-swGs70tD.js} +49 -51
  67. package/chunks/standalone-wgFAVnnm.js +355 -0
  68. package/chunks/standalone-xGV0dqPV.js +689 -0
  69. package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-OWSx5MOq.js} +7 -7
  70. package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
  71. package/chunks/useFieldName-B8iCYyw1.js +7 -0
  72. package/chunks/{utils-vdmi_2PK.js → utils-3Igg6xmO.js} +7668 -12779
  73. package/chunks/{view-BuwQugKb.js → view-DdMLZySj.js} +2430 -2110
  74. package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-CzvFHE6M.js} +5205 -4438
  75. package/chunks/with-html-element-DOfkR3C1.js +16094 -0
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +303 -2
  79. package/docs/operations/combo.md +262 -1
  80. package/docs/operations/date-picker.md +1 -1
  81. package/docs/operations/distribution-gauge.md +1 -1
  82. package/docs/operations/dot.md +148 -1
  83. package/docs/operations/filter.md +1 -1
  84. package/docs/operations/gauge.md +1 -1
  85. package/docs/operations/heatMap.md +1 -1
  86. package/docs/operations/histogram.md +262 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +8 -8
  90. package/docs/operations/line.md +262 -1
  91. package/docs/operations/number.md +1 -1
  92. package/docs/operations/pie.md +1 -1
  93. package/docs/operations/radar.md +1 -1
  94. package/docs/operations/sankey.md +1 -1
  95. package/docs/operations/scatter.md +148 -1
  96. package/docs/operations/shape.md +1 -1
  97. package/docs/operations/simpleTextObject.md +1 -1
  98. package/docs/operations/slider.md +1 -1
  99. package/docs/operations/table.md +439 -157
  100. package/docs/operations/tree.md +1 -1
  101. package/docs/operations/treemap.md +1 -1
  102. package/docs/operations/waterfall.md +1 -1
  103. package/docs/operations/word-cloud.md +1 -1
  104. package/getters.js +2 -2
  105. package/index.js +523 -469
  106. package/metadata.js +2 -2
  107. package/operations.js +5 -5
  108. package/package.json +74 -68
  109. package/src/definitions/index.d.ts +1 -1
  110. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  111. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  112. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  113. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +535 -349
  114. package/src/definitions/model/definitions/index.d.ts +2 -1
  115. package/src/definitions/model/definitions/schema-registry.d.ts +406 -101
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +10 -8
  117. package/src/definitions/model/definitions/schemas/common.schema.d.ts +33 -32
  118. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  119. package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
  120. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  121. package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
  122. package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
  123. package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
  124. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  125. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  126. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  127. package/src/index.d.ts +1 -1
  128. package/src/operations/index.d.ts +1 -1
  129. package/src/types.d.ts +45 -41
  130. package/src/visualization-catalog.d.ts +26 -26
  131. package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
  132. package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
  133. package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
  134. package/chunks/Title-CO5dP1ma.js +0 -1691
  135. package/chunks/ToggleButton-KOBAimC1.js +0 -112
  136. package/chunks/color-rules-CN7TcGrC.js +0 -6
  137. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  138. package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
  139. package/chunks/handlers-TOT-7INo.js +0 -12871
  140. package/chunks/isEqual-B8loyPsC.js +0 -12
  141. package/chunks/label-format-type-weq1XfcX.js +0 -8
  142. package/chunks/operations-Dh4v1Ovt.js +0 -26280
  143. package/chunks/responsive.styles-DSiOGD7u.js +0 -82
  144. package/chunks/shared-Bn4N5QcZ.js +0 -1218
  145. package/chunks/standalone-B55oyW6c.js +0 -689
  146. package/chunks/standalone-BXKRE_Se.js +0 -468
  147. package/chunks/standalone-Bes8srx1.js +0 -354
  148. package/chunks/standalone-BjZp0QMe.js +0 -2
  149. package/chunks/standalone-BlMIwpEe.js +0 -1877
  150. package/chunks/standalone-C8qAelL4.js +0 -2
  151. package/chunks/standalone-CLmGb7nn2.js +0 -355
  152. package/chunks/standalone-CXNP6-xD.js +0 -420
  153. package/chunks/standalone-DLlyRIE6.js +0 -287
  154. package/chunks/standalone-DMcI1afI.js +0 -396
  155. package/chunks/standalone-DN4S1MjT.js +0 -3874
  156. package/chunks/standalone-DYQIQH4c.js +0 -2095
  157. package/chunks/standalone-D__XCp-h.js +0 -1003
  158. package/chunks/standalone-XTgSsTAa.js +0 -354
  159. package/chunks/useFieldName-Cjn9KCVp.js +0 -7
  160. package/chunks/useSlotProps-DLbQp4lc.js +0 -166
  161. package/chunks/with-html-element-D0uY2zjI.js +0 -7328
@@ -1,1218 +0,0 @@
1
- import { Mo as e, Oo as t, Ro as n, Xa as r, Za as i, jo as a, r as o, vc as s, xo as c, zo as l } from "./visualization-filters-Cc4KU-l-.js";
2
- import { Bp as u, Em as d, Kd as ee, Nm as te, Pf as f, Qp as p, Rd as m, Sf as ne, Ud as h, Vd as g, Wd as re, Xf as ie, Yf as ae, Zf as oe, _m as se, am as ce, bm as le, cf as _, cm as ue, cp as de, km as fe, lp as pe, nm as me, qd as he, sp as ge, tp as _e } from "./handlers-TOT-7INo.js";
3
- import { T as ve, d as ye, t as be, y as v } from "./operations-Dh4v1Ovt.js";
4
- import { z as y } from "zod";
5
- var b = s(), xe = y.object({
6
- orientation: y.enum(["horizontal", "vertical"]).optional(),
7
- selectionMode: y.enum([
8
- "inherit",
9
- "auto",
10
- "manual"
11
- ]).optional(),
12
- enableAddingNewFilters: y.boolean().optional(),
13
- enableAssociativeFilter: y.boolean().optional(),
14
- showClearAll: y.boolean().optional(),
15
- showChartBreakdown: y.boolean().optional(),
16
- selectableFieldKeys: y.array(y.string()).optional()
17
- }).strict(), Se = y.object({
18
- settings: xe.optional(),
19
- type: y.literal("astrato-app-filter-bar"),
20
- version: y.literal(1)
21
- }).strict(), x = (e) => e, S = y.string().trim().min(1).max(100), C = y.string().min(1).refine((e) => e.trim().length > 0, "Field key cannot be blank."), Ce = x(le.shape.dataType), we = x(se.shape.formatType), Te = y.object({
22
- distinct: y.boolean().optional(),
23
- name: y.string().trim().min(1),
24
- resultType: y.string().optional()
25
- }).strict(), Ee = y.object({
26
- aggregations: y.array(Te).default([]),
27
- dataType: Ce,
28
- fieldKey: C,
29
- isManualData: y.boolean().optional(),
30
- kind: y.literal("field").default("field"),
31
- name: y.string().min(1),
32
- view: y.string().min(1)
33
- }).strict(), w = y.object({
34
- description: y.string().optional(),
35
- id: y.string().min(1).optional(),
36
- key: C,
37
- name: y.string().min(1),
38
- views: y.array(y.string()).optional()
39
- }).passthrough(), De = w.extend({
40
- dimension: y.record(y.string(), y.unknown()),
41
- type: y.literal("dimension")
42
- }), Oe = w.extend({
43
- measure: y.object({ aggregation: y.string().min(1) }).passthrough(),
44
- type: y.literal("measure")
45
- }), ke = w.extend({
46
- calculation: y.record(y.string(), y.unknown()),
47
- type: y.literal("calculation")
48
- }), Ae = y.object({
49
- fieldKey: C,
50
- item: De,
51
- kind: y.literal("dimension"),
52
- name: y.string().min(1)
53
- }).strict(), je = y.object({
54
- fieldKey: C,
55
- item: Oe,
56
- kind: y.literal("measure"),
57
- name: y.string().min(1)
58
- }).strict(), Me = y.object({
59
- fieldKey: C,
60
- item: ke,
61
- kind: y.literal("calculation"),
62
- name: y.string().min(1)
63
- }).strict(), T = y.union([
64
- Ee,
65
- Ae,
66
- je,
67
- Me
68
- ]).superRefine((e, t) => {
69
- e.kind !== "field" && e.item.key !== e.fieldKey && t.addIssue({
70
- code: "custom",
71
- message: "Semantic item key must match fieldKey.",
72
- path: ["item", "key"]
73
- });
74
- }), Ne = y.object({
75
- currency: y.string().min(1).optional(),
76
- currencyIsPrefix: y.boolean().optional(),
77
- formatString: y.string().optional(),
78
- formatType: we.optional(),
79
- negativeType: x(se.shape.negativeType.unwrap()).optional()
80
- }).strict(), Pe = y.discriminatedUnion("mode", [y.object({
81
- dateLevel: x(y.enum(b.DateLevel)).describe("Year-aware bucket, such as month over time."),
82
- mode: y.literal("level")
83
- }).strict(), y.object({
84
- datePart: x(y.enum(b.DatePart)).describe("Date part, such as month of year."),
85
- mode: y.literal("part")
86
- }).strict()]), E = y.object({
87
- fieldKey: C,
88
- format: Ne.pick({
89
- formatString: !0,
90
- formatType: !0
91
- }).optional(),
92
- ref: S,
93
- showNullValues: y.boolean().optional(),
94
- temporalGrouping: Pe.describe("Groups a date dimension. Applied before format; format must then suit the grouping.").optional()
95
- }).strict(), Fe = y.object({
96
- placements: y.array(x(y.enum(fe))).min(1).optional(),
97
- visible: y.boolean()
98
- }).strict(), D = y.object({
99
- aggregation: y.string().trim().min(1).describe("Required for a raw field measure; omit for a predefined measure or calculation.").optional(),
100
- dataLabels: Fe.optional(),
101
- fieldKey: C,
102
- format: Ne.optional(),
103
- ref: S
104
- }).strict(), Ie = y.object({
105
- fieldKey: C,
106
- operator: x(y.enum(_e)),
107
- value: y.string()
108
- }).strict(), Le = y.object({
109
- fieldKey: C,
110
- operator: x(y.enum(oe)),
111
- valueFrom: y.string(),
112
- valueTo: y.string()
113
- }).strict(), Re = y.object({
114
- fieldKey: C,
115
- operator: x(y.enum(ae)),
116
- values: y.array(y.string()).min(1)
117
- }).strict(), ze = y.object({
118
- fieldKey: C,
119
- operator: x(y.enum(ie))
120
- }).strict(), Be = y.union([
121
- Ie,
122
- Le,
123
- Re,
124
- ze
125
- ]), O = y.lazy(() => y.object({
126
- filters: y.array(y.union([Be, O])),
127
- operator: y.enum(["and", "or"])
128
- }).strict()), k = y.object({
129
- by: S,
130
- direction: x(p.shape.sortDirection),
131
- enabled: y.boolean().optional()
132
- }).strict(), Ve = y.object({
133
- by: S,
134
- count: y.number().int().positive(),
135
- direction: x(p.shape.sortDirection),
136
- showOthers: y.boolean().optional()
137
- }).strict(), He = y.object({
138
- queryLimit: y.number().int().positive().optional(),
139
- topN: Ve.optional()
140
- }).strict(), Ue = y.object({
141
- position: x(ue.shape.position).optional(),
142
- title: y.string().optional(),
143
- visible: y.boolean().optional()
144
- }).strict(), A = y.object({
145
- labelsVisible: y.boolean().optional(),
146
- lineVisible: y.boolean().optional(),
147
- ticksVisible: y.boolean().optional(),
148
- title: y.string().optional(),
149
- titleVisible: y.boolean().optional()
150
- }).strict(), We = y.union([y.object({
151
- max: y.number().optional(),
152
- min: y.number().optional().describe("Must be less than max when both are set")
153
- }).strict(), y.object({ startsAtZero: y.boolean() }).strict()]).describe("Fix min, max or both, or set startsAtZero on an axis fitted to the data"), Ge = y.array(u).optional().describe("Shaded ranges drawn across the plot between two primary measure axis values"), Ke = ge({}), qe = ge({ dimension: S.describe(`Alias of a dimension in data.dimensions. ${pe}`) }), Je = de({ measure: S.describe("Alias of the measure in data.measures whose value is compared") }), Ye = "Colors bound to dimension values, eg. \"Happy\" is dark teal. The first matching entry wins, ahead of rules and the palette. For ordered bands, add one entry per band with colors taken along a ramp.", Xe = y.array(Je).min(1).describe("Colors bound to measure thresholds, eg. red when sales is below 100. The first matching rule wins."), j = (e) => y.object({
154
- overwrites: y.array(e.requiresOverwriteDimension ? qe : Ke).min(1).describe(Ye).optional(),
155
- ...e.rules ? { rules: Xe.optional() } : {}
156
- }).strict(), M = {
157
- inverted: y.boolean().optional().describe("Reverse the direction of the axis values, eg. to put rank 1 at the top"),
158
- range: We.optional()
159
- }, N = { bands: Ge }, Ze = { scale: x(y.enum(te)).optional() };
160
- A.extend({
161
- ...M,
162
- ...N,
163
- ...Ze
164
- }).strict();
165
- var P = ({ logScale: e = !1, primaryMeasureBands: t = !1, rangedMeasureAxes: n = [] } = {}) => {
166
- let r = (t, r) => A.extend({
167
- ...n.includes(t) ? M : {},
168
- ...r ? N : {},
169
- ...e ? Ze : {}
170
- }).strict();
171
- return y.object({
172
- dimension: A.optional(),
173
- primaryMeasure: r("primaryMeasure", t).optional(),
174
- secondaryMeasure: r("secondaryMeasure", !1).optional()
175
- }).strict();
176
- };
177
- P();
178
- var Qe = y.object({
179
- axes: P({
180
- logScale: !0,
181
- primaryMeasureBands: !0,
182
- rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"]
183
- }).optional(),
184
- legend: Ue.optional(),
185
- orientation: x(y.enum(i)).optional()
186
- }).strict(), $e = D.extend({ axis: y.enum(["primary", "secondary"]).optional() }), et = y.object({
187
- data: y.object({
188
- dimensions: y.array(E).min(1),
189
- measures: y.array($e).min(1)
190
- }).strict(),
191
- filterGroup: O.optional(),
192
- limiting: He.optional(),
193
- presentation: Qe.extend({ coloring: j({ rules: !0 }).optional() }).optional(),
194
- sorting: y.array(k).optional(),
195
- type: y.literal("bar"),
196
- version: y.literal(1)
197
- }).strict(), tt = y.object({ visible: y.boolean() }).strict(), nt = (e, t) => y.array(e).min(t.min).max(t.max), F = (e, t) => {
198
- let n = {};
199
- if (t.dimensions.max > 0) {
200
- let e = nt(E, t.dimensions);
201
- n.dimensions = t.dimensions.min === 0 ? e.optional() : e;
202
- }
203
- if (t.measures.max > 0) {
204
- let e = t.dataLabels ? D.omit({ dataLabels: !0 }).extend({ dataLabels: tt.optional() }) : D.omit({ dataLabels: !0 }), r = t.comboSeriesTypes ? e.extend({ seriesType: y.enum([
205
- "bar",
206
- "line",
207
- "point"
208
- ]).optional() }) : e, i = nt(t.measureAxis ? r.extend({ axis: y.enum(["primary", "secondary"]).optional() }) : r, t.measures);
209
- n.measures = t.measures.min === 0 ? i.optional() : i;
210
- }
211
- let r = {};
212
- if (t.axes) {
213
- let e = P({
214
- logScale: t.measureAxisScale,
215
- primaryMeasureBands: t.measureAxisBands,
216
- rangedMeasureAxes: t.rangedMeasureAxes
217
- });
218
- r.axes = (t.secondaryDimensionAxis ? e.extend({ secondaryDimension: A.optional() }) : e).optional();
219
- }
220
- t.conditionalColoring && (r.coloring = j(t.conditionalColoring).optional()), t.dataLabels && (r.dataLabels = tt.optional()), t.gaugeDisplayMode && (r.displayMode = y.enum(["bar", "radial"]).optional()), t.legend && (r.legend = Ue.optional()), t.orientation && (r.orientation = x(y.enum(i)).optional()), t.treeLayout && (r.layout = y.object({
221
- compact: y.boolean().optional(),
222
- direction: y.enum([
223
- "bottom",
224
- "left",
225
- "right",
226
- "top"
227
- ]).optional(),
228
- forceAutoFit: y.boolean().optional(),
229
- initialExpandedLevels: y.number().int().min(0).optional()
230
- }).strict().optional());
231
- let a = {
232
- data: y.object(n).strict(),
233
- filterGroup: O.optional(),
234
- type: y.literal(e),
235
- version: y.literal(1)
236
- };
237
- return t.queryLimit && (a.limiting = y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional()), Object.keys(r).length > 0 && (a.presentation = y.object(r).strict().optional()), t.sorting && (a.sorting = y.array(k).optional()), y.object(a).strict().superRefine((n, r) => {
238
- let i = n.data, a = t.validateCounts?.(i.dimensions?.length ?? 0, i.measures?.length ?? 0);
239
- a && r.addIssue({
240
- code: "custom",
241
- message: a,
242
- path: ["data"]
243
- });
244
- let o = t.conditionalColoring?.minDimensions ?? 0;
245
- n.presentation?.coloring && (i.dimensions?.length ?? 0) < o && r.addIssue({
246
- code: "custom",
247
- message: `${e} value colors require at least ${o} dimensions.`,
248
- path: ["presentation", "coloring"]
249
- }), t.validateDefinition?.(n, r);
250
- });
251
- }, rt = F("combo", {
252
- axes: !0,
253
- comboSeriesTypes: !0,
254
- dataLabels: !0,
255
- dimensions: {
256
- min: 1,
257
- max: 1
258
- },
259
- legend: !0,
260
- measureAxis: !0,
261
- measureAxisBands: !0,
262
- measureAxisScale: !0,
263
- measures: {
264
- min: 1,
265
- max: 10
266
- },
267
- orientation: !0,
268
- queryLimit: !0,
269
- sorting: !0,
270
- rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
271
- validateDefinition: (e, t) => {
272
- let n = e.data.measures ?? [];
273
- n.forEach((e, n) => {
274
- e.dataLabels?.visible && e.seriesType !== "bar" && t.addIssue({
275
- code: "custom",
276
- message: "Combo data labels are supported only for bar series.",
277
- path: [
278
- "data",
279
- "measures",
280
- n,
281
- "dataLabels"
282
- ]
283
- });
284
- }), e.presentation?.dataLabels?.visible && !n.some((e) => e.seriesType === "bar") && t.addIssue({
285
- code: "custom",
286
- message: "Visible combo data labels require at least one bar series.",
287
- path: ["presentation", "dataLabels"]
288
- }), new Set(n.filter((e) => e.seriesType === "bar" && e.axis).map((e) => e.axis)).size > 1 && n.forEach((e, n) => {
289
- e.seriesType === "bar" && e.axis && t.addIssue({
290
- code: "custom",
291
- message: "Combo bar series share one measure axis, so every bar measure must name the same axis.",
292
- path: [
293
- "data",
294
- "measures",
295
- n,
296
- "axis"
297
- ]
298
- });
299
- });
300
- }
301
- }), it = F("dot", {
302
- conditionalColoring: { rules: !0 },
303
- axes: !0,
304
- dimensions: {
305
- min: 2,
306
- max: 2
307
- },
308
- legend: !0,
309
- measures: {
310
- min: 1,
311
- max: 1
312
- },
313
- orientation: !0,
314
- rangedMeasureAxes: ["primaryMeasure"]
315
- }), at = F("scatter", {
316
- conditionalColoring: { rules: !0 },
317
- axes: !0,
318
- dimensions: {
319
- min: 1,
320
- max: 2
321
- },
322
- legend: !0,
323
- measures: {
324
- min: 2,
325
- max: 3
326
- },
327
- queryLimit: !0,
328
- rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
329
- sorting: !0
330
- }), ot = F("histogram", {
331
- axes: !0,
332
- dimensions: {
333
- min: 1,
334
- max: 1
335
- },
336
- legend: !0,
337
- measureAxisBands: !0,
338
- measures: {
339
- min: 0,
340
- max: 0
341
- },
342
- orientation: !0,
343
- rangedMeasureAxes: ["primaryMeasure"]
344
- }), st = F("heatMap", {
345
- conditionalColoring: { rules: !0 },
346
- axes: !0,
347
- dimensions: {
348
- min: 2,
349
- max: 2
350
- },
351
- legend: !0,
352
- measures: {
353
- min: 1,
354
- max: 2
355
- },
356
- queryLimit: !0,
357
- secondaryDimensionAxis: !0,
358
- sorting: !0
359
- }), ct = F("radar", {
360
- conditionalColoring: {
361
- minDimensions: 2,
362
- rules: !1
363
- },
364
- dimensions: {
365
- min: 0,
366
- max: 2
367
- },
368
- legend: !0,
369
- measures: {
370
- min: 1,
371
- max: 5
372
- },
373
- validateCounts: (e, t) => {
374
- if (e === 0 && t < 2) return "Radar charts without dimensions require at least two measures.";
375
- if (e > 0 && t > 1) return "Radar charts with dimensions support exactly one measure.";
376
- }
377
- }), lt = F("gauge", {
378
- conditionalColoring: { rules: !0 },
379
- dimensions: {
380
- min: 0,
381
- max: 1
382
- },
383
- gaugeDisplayMode: !0,
384
- legend: !0,
385
- measures: {
386
- min: 1,
387
- max: 20
388
- },
389
- validateCounts: (e, t) => e === 1 && t > 2 ? "Gauge charts with a dimension support at most two measures." : void 0
390
- }), ut = F("distribution-gauge", {
391
- conditionalColoring: { rules: !0 },
392
- dimensions: {
393
- min: 0,
394
- max: 1
395
- },
396
- gaugeDisplayMode: !0,
397
- legend: !0,
398
- measures: {
399
- min: 1,
400
- max: 20
401
- }
402
- }), dt = F("pie", {
403
- conditionalColoring: { rules: !0 },
404
- dimensions: {
405
- min: 1,
406
- max: 1
407
- },
408
- legend: !0,
409
- measures: {
410
- min: 1,
411
- max: 2
412
- },
413
- queryLimit: !0,
414
- sorting: !0
415
- }), ft = F("tree", {
416
- dimensions: {
417
- min: 0,
418
- max: 10
419
- },
420
- measures: {
421
- min: 0,
422
- max: 100
423
- },
424
- queryLimit: !0,
425
- sorting: !0,
426
- treeLayout: !0,
427
- validateCounts: (e, t) => e + t === 0 ? "Tree charts require at least one dimension or measure." : e > 0 && t > 1 ? "Tree charts with dimensions support at most one measure." : void 0
428
- }), pt = F("treemap", {
429
- conditionalColoring: { rules: !0 },
430
- dimensions: {
431
- min: 1,
432
- max: 10
433
- },
434
- legend: !0,
435
- measures: {
436
- min: 1,
437
- max: 1
438
- }
439
- }), mt = F("sankey", {
440
- conditionalColoring: {
441
- requiresOverwriteDimension: !0,
442
- rules: !0
443
- },
444
- dimensions: {
445
- min: 2,
446
- max: 15
447
- },
448
- measures: {
449
- min: 1,
450
- max: 1
451
- }
452
- }), ht = F("waterfall", {
453
- axes: !0,
454
- dataLabels: !0,
455
- dimensions: {
456
- min: 0,
457
- max: 0
458
- },
459
- measureAxisBands: !0,
460
- measures: {
461
- min: 1,
462
- max: 100
463
- },
464
- orientation: !0,
465
- rangedMeasureAxes: ["primaryMeasure"]
466
- }), gt = F("word-cloud", {
467
- conditionalColoring: { rules: !0 },
468
- dimensions: {
469
- min: 1,
470
- max: 1
471
- },
472
- measures: {
473
- min: 1,
474
- max: 1
475
- }
476
- }), _t = y.enum(["dropdown", "listbox"]), vt = y.object({
477
- mode: _t.optional(),
478
- quickSelect: y.boolean().optional(),
479
- responsive: y.boolean().optional(),
480
- searchable: y.boolean().optional(),
481
- showProgressBar: y.boolean().optional()
482
- }).strict(), yt = y.object({
483
- data: y.object({ field: E.omit({
484
- format: !0,
485
- showNullValues: !0,
486
- temporalGrouping: !0
487
- }) }).strict(),
488
- presentation: vt.optional(),
489
- type: y.literal("filter"),
490
- version: y.literal(1)
491
- }).strict(), bt = D.omit({ dataLabels: !0 }).extend({
492
- axis: y.enum(["primary", "secondary"]).optional(),
493
- dataPointShape: x(ce.shape.dataPointShape)
494
- }), xt = y.object({
495
- density: me.optional(),
496
- visible: y.boolean()
497
- }).strict(), St = Qe.extend({
498
- coloring: j({ rules: !1 }).optional(),
499
- dataLabels: xt.optional()
500
- }), Ct = y.object({
501
- data: y.object({
502
- dimensions: y.array(E).min(1),
503
- measures: y.array(bt).min(1)
504
- }).strict(),
505
- filterGroup: O.optional(),
506
- limiting: y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional(),
507
- presentation: St.optional(),
508
- sorting: y.array(k).optional(),
509
- type: y.literal("line"),
510
- version: y.literal(1)
511
- }).strict().superRefine((e, t) => {
512
- e.presentation?.coloring && e.data.dimensions.length < 2 && t.addIssue({
513
- code: "custom",
514
- message: "Line value colors require at least two dimensions.",
515
- path: ["presentation", "coloring"]
516
- }), e.presentation?.dataLabels?.visible && e.data.measures.forEach((e, n) => {
517
- e.dataPointShape || t.addIssue({
518
- code: "custom",
519
- message: "Visible line data labels require a data-point shape for every measure.",
520
- path: [
521
- "data",
522
- "measures",
523
- n,
524
- "dataPointShape"
525
- ]
526
- });
527
- });
528
- }), wt = y.object({
529
- data: y.object({ measure: D.omit({ dataLabels: !0 }) }).strict(),
530
- filterGroup: O.optional(),
531
- type: y.literal("number"),
532
- version: y.literal(1)
533
- }).strict(), Tt = x(ne.pick({
534
- endDateLabel: !0,
535
- pickerState: !0,
536
- pickerType: !0,
537
- quickSelect: !0,
538
- responsive: !0,
539
- startDateLabel: !0,
540
- timePickerVisibility: !0,
541
- weekStart: !0
542
- }).partial()), Et = y.object({
543
- data: y.object({ field: E.omit({
544
- format: !0,
545
- showNullValues: !0,
546
- temporalGrouping: !0
547
- }) }).strict(),
548
- settings: Tt.optional(),
549
- type: y.literal("date-picker"),
550
- version: y.literal(1)
551
- }).strict(), Dt = y.object({
552
- settings: y.object({ url: y.string().url().nullable() }).strict(),
553
- type: y.literal("iframe"),
554
- version: y.literal(1)
555
- }).strict(), Ot = y.object({
556
- settings: x(y.object({
557
- blur: _.shape.blur.optional(),
558
- fit: _.shape.image.unwrap().shape.imageFit.optional(),
559
- opacity: _.shape.opacity.optional(),
560
- saturation: _.shape.saturation.optional(),
561
- shadow: _.shape.shadow.optional(),
562
- source: ye.optional()
563
- }).strict()),
564
- type: y.literal("image"),
565
- version: y.literal(1)
566
- }).strict(), kt = y.object({
567
- settings: x(he.pick({
568
- backgroundColor: !0,
569
- backgroundType: !0,
570
- borderEnabled: !0,
571
- borderRadius: !0,
572
- heightBasedSize: !0,
573
- imageFit: !0,
574
- imageURL: !0,
575
- lineThickness: !0,
576
- preserveAspectRatio: !0,
577
- rotate: !0,
578
- scale: !0,
579
- shape: !0,
580
- strokeColor: !0
581
- }).partial().strict()),
582
- type: y.literal("shape"),
583
- version: y.literal(1)
584
- }).strict(), I = ee.shape.simpleTextObjectSettings, At = y.object({
585
- settings: x(y.object({
586
- align: I.shape.align.optional(),
587
- content: y.string().optional(),
588
- fontFamily: I.shape.fontFamily.optional(),
589
- fontSize: I.shape.fontSize.optional(),
590
- position: I.shape.position.optional(),
591
- representation: I.shape.representation.optional(),
592
- responsive: I.shape.responsive.optional(),
593
- textColor: I.shape.textColor.optional(),
594
- wordWrap: I.shape.wordWrap.optional()
595
- }).strict()),
596
- type: y.literal("simpleTextObject"),
597
- version: y.literal(1)
598
- }).strict(), jt = y.object({
599
- settings: x(y.object({
600
- customLabel: f.shape.commonSettings.shape.customLabel.optional(),
601
- hideLabel: f.shape.commonSettings.shape.hideLabel.optional(),
602
- inputType: f.shape.type.optional(),
603
- placeholder: f.shape.commonSettings.shape.placeholder.optional(),
604
- responsive: f.shape.commonSettings.shape.responsive.optional(),
605
- variableId: f.shape.commonSettings.shape.variableId.optional()
606
- }).strict()),
607
- type: y.literal("atomic-input"),
608
- version: y.literal(1)
609
- }).strict(), Mt = y.object({
610
- data: y.object({ field: E.omit({
611
- format: !0,
612
- showNullValues: !0,
613
- temporalGrouping: !0
614
- }) }).strict(),
615
- settings: x(re.pick({
616
- layout: !0,
617
- quickSelect: !0,
618
- range: !0,
619
- step: !0
620
- }).partial()).optional(),
621
- type: y.literal("slider"),
622
- version: y.literal(1)
623
- }).strict(), Nt = E.extend({ role: y.literal("dimension") }), L = D.omit({ dataLabels: !0 }), Pt = L.extend({ role: y.literal("measure") }), Ft = y.object({
624
- columns: y.array(y.discriminatedUnion("role", [Nt, Pt])).min(1),
625
- structure: y.literal("normal").optional()
626
- }).strict(), It = y.object({
627
- dimensions: y.array(E).min(1),
628
- measures: y.array(L).min(1),
629
- structure: y.literal("expandable")
630
- }).strict(), Lt = y.object({
631
- columnDimensions: y.array(E).min(1),
632
- measures: y.array(L).min(1),
633
- rowDimensions: y.array(E).min(1),
634
- structure: y.literal("pivot")
635
- }).strict(), Rt = y.union([
636
- Ft,
637
- It,
638
- Lt
639
- ]), zt = y.object({
640
- applyTo: m.shape.applyTo,
641
- enabled: m.shape.enabled,
642
- showRecordsCount: m.shape.showRecordsCount,
643
- style: y.object({
644
- backgroundColor: h.shape.backgroundColor.optional(),
645
- fontColor: h.shape.fontColor.optional(),
646
- fontStyle: g.optional(),
647
- position: h.shape.position.optional(),
648
- responsiveHeight: h.shape.responsive
649
- }).strict().optional()
650
- }).strict(), Bt = y.object({
651
- background: y.object({
652
- color: d.optional(),
653
- evenColor: d.optional(),
654
- oddColor: d.optional(),
655
- type: y.enum([
656
- "none",
657
- "single",
658
- "zebra"
659
- ])
660
- }).strict().optional(),
661
- body: y.object({
662
- fontColor: d.optional(),
663
- fontFamily: y.string().trim().min(1).optional(),
664
- fontSize: y.number().positive().optional(),
665
- fontStyle: g.optional(),
666
- horizontalAlign: y.enum([
667
- "auto",
668
- "center",
669
- "left",
670
- "right"
671
- ]).optional(),
672
- verticalAlign: y.enum([
673
- "auto",
674
- "bottom",
675
- "middle",
676
- "top"
677
- ]).optional()
678
- }).strict().optional(),
679
- borders: y.object({
680
- color: d.optional(),
681
- dividerColor: d.optional(),
682
- dividers: y.enum([
683
- "all",
684
- "auto",
685
- "horizontal",
686
- "none",
687
- "vertical"
688
- ]).optional(),
689
- enabled: y.boolean(),
690
- lineStyle: y.enum([
691
- "dashed",
692
- "dotted",
693
- "line"
694
- ]).optional(),
695
- radius: y.number().nonnegative().optional(),
696
- strokeWidth: y.number().nonnegative().optional()
697
- }).strict().optional(),
698
- header: y.object({
699
- backgroundColor: d.optional(),
700
- borderColor: d.optional(),
701
- fontColor: d.optional(),
702
- fontFamily: y.string().trim().min(1).optional(),
703
- fontSize: y.number().positive().optional(),
704
- fontStyle: g.optional(),
705
- responsiveHeight: y.boolean().optional()
706
- }).strict().optional(),
707
- highlight: y.object({
708
- backgroundColor: d.optional(),
709
- mode: y.enum([
710
- "column",
711
- "none",
712
- "row",
713
- "row-and-column"
714
- ]),
715
- textColor: d.optional()
716
- }).strict().optional(),
717
- layout: y.object({
718
- columnWidthBehavior: y.enum(["responsive", "static"]).optional(),
719
- rowHeight: y.number().positive().optional()
720
- }).strict().optional()
721
- }).strict(), Vt = y.object({
722
- data: Rt,
723
- filterGroup: O.optional(),
724
- limiting: y.object({ queryLimit: y.number().int().positive().optional() }).strict().optional(),
725
- presentation: Bt.optional(),
726
- sorting: y.array(k).optional(),
727
- totals: zt.optional(),
728
- type: y.literal("table"),
729
- version: y.literal(1)
730
- }).strict(), R = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ht = (e) => {
731
- let t = e.fieldKey ?? e.key;
732
- return typeof t == "string" ? t : void 0;
733
- }, Ut = (e) => {
734
- if (Array.isArray(e)) return e;
735
- if (!R(e)) throw Error("Available field metadata must be an array or an object.");
736
- return [
737
- "fields",
738
- "dimensions",
739
- "measures"
740
- ].flatMap((t) => {
741
- let n = e[t];
742
- if (n === void 0) return [];
743
- if (!Array.isArray(n)) throw Error(`Available field metadata "${t}" must be an array.`);
744
- return n;
745
- });
746
- }, Wt = (e, t) => {
747
- let n = e.type;
748
- if (!(n === "dimension" && R(e.dimension) || n === "measure" && R(e.measure) || n === "calculation" && R(e.calculation))) return;
749
- let r = T.safeParse({
750
- fieldKey: e.key,
751
- item: e,
752
- kind: n,
753
- name: e.name
754
- });
755
- if (!r.success) throw Error(`Invalid available semantic item at index ${t}: ${r.error.message}`);
756
- return r.data;
757
- }, Gt = (e, t) => {
758
- if (!R(e)) throw Error(`Available field at index ${t} must be an object.`);
759
- let n = T.safeParse(e);
760
- if (n.success) return n.data;
761
- let r = Wt(e, t);
762
- if (r) return r;
763
- let i = Array.isArray(e.aggregations) ? e.aggregations : Array.isArray(e.aggregators) ? e.aggregators : [], a = T.safeParse({
764
- aggregations: i.map((e) => R(e) ? {
765
- distinct: e.distinct,
766
- name: e.name ?? e.funcName,
767
- resultType: e.resultType
768
- } : e),
769
- dataType: e.dataType,
770
- fieldKey: Ht(e),
771
- isManualData: e.isManualData,
772
- kind: "field",
773
- name: e.name,
774
- view: e.view
775
- });
776
- if (!a.success) throw Error(`Invalid available field at index ${t}: ${a.error.message}`);
777
- return a.data;
778
- }, Kt = (e) => {
779
- let t = Ut(e).map(Gt), n = /* @__PURE__ */ new Map();
780
- return t.forEach((e, t) => {
781
- let r = n.get(e.fieldKey);
782
- if (r !== void 0) throw Error(`Duplicate available field key "${e.fieldKey}" at indexes ${r} and ${t}.`);
783
- n.set(e.fieldKey, t);
784
- }), t;
785
- }, qt = (e) => e.kind === "field" ? [...new Set(e.aggregations.flatMap((e) => [e.name, ...e.distinct ? [`${e.name}_DISTINCT`] : []]))] : [], Jt = (e, t) => e.kind === "field" || t === "dimension" && e.kind === "dimension" || t === "measure" && (e.kind === "measure" || e.kind === "calculation"), Yt = (e) => {
786
- if (e.kind !== "dimension") return e.kind;
787
- }, z = (e) => ({
788
- ...t(e.item),
789
- id: e.item.id ?? e.fieldKey
790
- }), B = (t) => t.map((t) => t.kind === "dimension" ? e(z(t)) : t.kind === "measure" || t.kind === "calculation" ? a(z(t)) : {
791
- aggregators: n(t.aggregations.map((e) => ({
792
- distinct: e.distinct ?? !1,
793
- name: e.name,
794
- resultType: e.resultType
795
- }))),
796
- dataType: t.dataType,
797
- isManualData: t.isManualData,
798
- key: t.fieldKey,
799
- name: t.name,
800
- view: t.view,
801
- views: [t.view]
802
- }), V = (e, t) => {
803
- let n = Math.min(e.length, t.length), r = 0;
804
- for (; r < n && e[r].toLocaleLowerCase() === t[r].toLocaleLowerCase();) r += 1;
805
- return r;
806
- }, Xt = (e, t) => [...t].sort((t, n) => V(e, n.fieldKey) - V(e, t.fieldKey) || t.fieldKey.localeCompare(n.fieldKey)).slice(0, 5).map((e) => e.fieldKey), Zt = [
807
- b.FieldType.DATE,
808
- b.FieldType.TIME,
809
- b.FieldType.TIMESTAMP,
810
- b.FieldType.TIMESTAMP_TZ
811
- ], H = (e, t, n, r) => ({
812
- ...r ? { allowedValues: r } : {},
813
- code: e,
814
- message: n,
815
- path: t
816
- }), U = (e) => qt(e).filter((e) => !!l(e)), Qt = (e, t) => {
817
- let n = t.find((t) => t.fieldKey === e.fieldKey);
818
- return n?.kind === "field" ? U(n).find((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) : void 0;
819
- }, $t = (e, t) => {
820
- let n = t.find((t) => t.fieldKey === e.fieldKey);
821
- return n?.kind === "measure" ? n.item.measure.aggregation : Qt(e, t);
822
- }, en = (e, t, n = {}) => {
823
- let r = t.find((t) => t.fieldKey === e.fieldKey), i = r ? Yt(r) : void 0, a = Qt(e, t);
824
- return {
825
- ...n,
826
- key: e.fieldKey,
827
- ...i ? { sourceKind: i } : {},
828
- ...a ? { aggregation: a } : {}
829
- };
830
- }, W = (e, t, n, r) => {
831
- let i = t.find((t) => t.fieldKey === e.fieldKey);
832
- if (!i) return [H("unknown_field_key", [...n, "fieldKey"], `Field key "${e.fieldKey}" is not available.`, Xt(e.fieldKey, t))];
833
- if (!Jt(i, r)) return [H("invalid_field_role", [...n, "fieldKey"], `Available item "${e.fieldKey}" of kind "${i.kind}" cannot be used as a ${r}.`)];
834
- if (r !== "measure") return e.temporalGrouping ? nn(e, t, n, Zt, "a temporally grouped dimension") : [];
835
- if (i.kind !== "field") return e.aggregation === void 0 ? [] : [H("invalid_aggregation", [...n, "aggregation"], `Aggregation must be omitted for semantic ${i.kind} "${e.fieldKey}".`)];
836
- let a = U(i);
837
- return e.aggregation ? a.some((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) ? [] : [H("invalid_aggregation", [...n, "aggregation"], `Aggregation "${e.aggregation}" is not available for field key "${e.fieldKey}".`, a)] : [H("invalid_aggregation", [...n, "aggregation"], `Aggregation is required for raw field "${e.fieldKey}" when it is used as a measure.`, a)];
838
- }, tn = (e, t, n, r) => e.flatMap((e, i) => W(e, t, [...n, i], r)), nn = (e, t, n, r, i) => {
839
- let a = t.find((t) => t.fieldKey === e.fieldKey);
840
- return a?.kind !== "field" || r.includes(a.dataType) ? [] : [H("invalid_field_role", [...n, "fieldKey"], `Raw field "${e.fieldKey}" has data type "${a.dataType}" and cannot be used as ${i}.`, [...r])];
841
- }, rn = (e, t, n = ["filterGroup"]) => e ? e.filters.flatMap((e, r) => {
842
- let i = [
843
- ...n,
844
- "filters",
845
- r
846
- ];
847
- return "filters" in e ? rn(e, t, i) : W({
848
- fieldKey: e.fieldKey,
849
- ref: `filter:${r}`
850
- }, t, i, "dimension");
851
- }) : [], G = (e) => e.reduce((e, t) => typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][\w$]*$/.test(t) ? e ? `${e}.${t}` : t : `${e}[${JSON.stringify(t)}]`, "") || "definition", K = (e) => {
852
- if (typeof e == "number" && !Number.isFinite(e)) return String(e);
853
- try {
854
- return JSON.stringify(e) ?? String(e);
855
- } catch {
856
- return String(e);
857
- }
858
- }, q = (e, t) => t.reduce((e, t) => typeof e == "object" && e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e), an = (e) => {
859
- if (e.code === "invalid_value") return e.values;
860
- if (e.code !== "invalid_union" || e.errors.length === 0) return;
861
- let t = e.errors.map((e) => e.length === 1 && e[0].path.length === 0 ? an(e[0]) : void 0);
862
- return t.every((e) => e !== void 0) ? [...new Set(t.flat())] : void 0;
863
- }, on = (e) => e.filter((e) => typeof e != "symbol"), sn = (e, t, n = []) => {
864
- let r = (e, n) => e.code === "invalid_union" && e.path.length === 0 ? e.errors.length > 0 && e.errors.every((e) => e.some((e) => r(e, n))) : e.code === "invalid_value" && e.path.length === 1 && q(t, [...n, ...on(e.path)]) !== void 0, i = (e, a) => {
865
- let o = [...a, ...on(e.path)];
866
- if (e.code === "unrecognized_keys") return e.keys.map((r) => {
867
- let i = [
868
- ...n,
869
- ...o,
870
- r
871
- ];
872
- return {
873
- code: "invalid_structure",
874
- path: i,
875
- message: `${G(i)}: Unrecognized key.`,
876
- details: {
877
- received: q(t, [...o, r]),
878
- zodCode: e.code
879
- }
880
- };
881
- });
882
- let s = [...n, ...o], c = q(t, o), l = an(e), u = {
883
- received: c,
884
- zodCode: e.code
885
- }, d = l ? `Unsupported value ${K(c)}. Allowed values: ${l.map(K).join(", ")}.` : `${e.message}. Received: ${K(c)}.`;
886
- if (e.code === "invalid_union" && !l && e.errors.length > 0) {
887
- let t = e.errors, n = t.filter((e) => !e.some((e) => r(e, o))), a = n.length > 0 ? n : t, s = a.length === 1 ? a : a.filter((e) => !e.some((e) => e.code === "unrecognized_keys"));
888
- if (s.length === 1) return s[0].flatMap((e) => i(e, o));
889
- let c = e.errors.map((e) => e.flatMap((e) => i(e, o)));
890
- u.alternatives = c, d = `Value does not match any allowed shape. ${c.map((e, t) => `Alternative ${t + 1}: ${e.map((e) => e.message).join(" ")}`).join(" ")}`;
891
- }
892
- return [{
893
- code: "invalid_structure",
894
- path: s,
895
- message: `${G(s)}: ${d}`,
896
- details: u,
897
- ...l ? { allowedValues: l } : {}
898
- }];
899
- };
900
- return e.issues.flatMap((e) => i(e, []));
901
- };
902
- o();
903
- var cn = (e, t) => {
904
- let n = "legend" in e && !!e.legend, i = t.position !== void 0 || t.title !== void 0, a = [];
905
- return t.visible !== void 0 && (t.visible || i || n) ? a.push({
906
- name: "setLegendEnabled",
907
- payload: t.visible
908
- }) : t.visible === void 0 && i && !n && a.push({
909
- name: "setLegendEnabled",
910
- payload: !0
911
- }), t.position === void 0 ? (t.visible === !0 || i && !n) && a.push({
912
- name: "setLegendPosition",
913
- payload: r.Right
914
- }) : a.push({
915
- name: "setLegendPosition",
916
- payload: t.position
917
- }), t.title !== void 0 && a.push({
918
- name: "setLegendTitle",
919
- payload: t.title
920
- }), a;
921
- }, J = (e, t, n, r = {}) => ({
922
- code: e,
923
- message: n,
924
- path: t,
925
- ...r
926
- }), ln = (e, t, n, r, i, a) => ({
927
- name: e,
928
- payload: {
929
- ...Y(t),
930
- [i]: a
931
- },
932
- definitionContext: {
933
- path: [
934
- ...r,
935
- "format",
936
- i
937
- ],
938
- received: a,
939
- ref: n,
940
- kind: t.kind
941
- }
942
- }), un = (e, t, n, r, i, a, o) => ({
943
- name: e,
944
- payload: {
945
- name: t,
946
- [i]: a
947
- },
948
- definitionContext: {
949
- path: [
950
- ...r,
951
- "format",
952
- i
953
- ],
954
- received: a,
955
- ref: n,
956
- kind: o
957
- }
958
- }), Y = (e) => ({
959
- dataItemInternalKey: e.dataItemInternalKey,
960
- dataItemUniqueSignature: e.dataItemUniqueSignature
961
- }), dn = (e) => {
962
- let t = [], n = /* @__PURE__ */ new Set();
963
- return e.forEach(({ items: e, path: r }) => {
964
- e.forEach((e, i) => {
965
- n.has(e.ref) && t.push(J("duplicate_alias", [
966
- ...r,
967
- i,
968
- "ref"
969
- ], `Reference "${e.ref}" is duplicated.`)), n.add(e.ref);
970
- });
971
- }), t;
972
- }, fn = (e, t) => {
973
- let n = e, r = n.referencedData;
974
- return t.every((e) => !Array.isArray(n[e]) || n[e].length === 0) && (typeof r != "object" || !r || Object.keys(r).length === 0);
975
- }, pn = (e, t) => ({
976
- availableFields: B(e.availableFields),
977
- input: e,
978
- resolvedRefs: {},
979
- vSpec: t
980
- }), mn = (e, t, n, r, i) => ({
981
- name: e,
982
- payload: {
983
- ...Y(t),
984
- ...i
985
- },
986
- definitionContext: {
987
- path: [...r, "temporalGrouping"],
988
- received: i,
989
- ref: n,
990
- kind: t.kind
991
- }
992
- }), hn = (e) => "value" in e ? { value: e.value } : "values" in e ? {
993
- secondValue: e.values.join(","),
994
- value: ","
995
- } : "valueFrom" in e ? {
996
- valueFrom: e.valueFrom,
997
- valueTo: e.valueTo
998
- } : {}, X = (e) => ({
999
- filters: e.filters.map((e) => "filters" in e ? X(e) : {
1000
- fieldKey: e.fieldKey,
1001
- operator: e.operator,
1002
- values: hn(e)
1003
- }),
1004
- operator: e.operator
1005
- }), gn = (e, t) => (e ?? []).flatMap((e, n) => t.includes(e.by) ? [] : [J("unknown_alias", [
1006
- "sorting",
1007
- n,
1008
- "by"
1009
- ], `Reference "${e.by}" does not exist.`, { allowedValues: t })]), Z = ["presentation", "coloring"], _n = (e, t, n) => [...(e?.overwrites ?? []).flatMap(({ dimension: e }, n) => e === void 0 || t.includes(e) ? [] : [J("unknown_alias", [
1010
- ...Z,
1011
- "overwrites",
1012
- n,
1013
- "dimension"
1014
- ], `Dimension reference "${e}" does not exist.`, { allowedValues: t })]), ...(e?.rules ?? []).flatMap(({ measure: e }, t) => n.includes(e) ? [] : [J("unknown_alias", [
1015
- ...Z,
1016
- "rules",
1017
- t,
1018
- "measure"
1019
- ], `Measure reference "${e}" does not exist.`, { allowedValues: n })])], vn = (e, t) => {
1020
- let n = t.safeParse(e.vSpec);
1021
- return n.success ? {
1022
- resolvedRefs: e.resolvedRefs,
1023
- success: !0,
1024
- vSpec: n.data
1025
- } : {
1026
- issues: [J("invalid_compiled_vspec", [], "Compiled vSpec failed final validation.", { details: { issues: n.error.issues } })],
1027
- success: !1
1028
- };
1029
- }, Q = (e) => "startsAtZero" in e ? {} : e, yn = (e) => {
1030
- let { max: t, min: n } = Q(e);
1031
- return n !== void 0 && t !== void 0 ? c.MinMax : n === void 0 ? t === void 0 ? c.Auto : c.Max : c.Min;
1032
- }, bn = (e) => {
1033
- for (let [t, n] of Object.entries(e ?? {})) {
1034
- let { max: e, min: r } = n?.range ? Q(n.range) : {};
1035
- if (r !== void 0 && e !== void 0 && r >= e) return J("invalid_structure", [
1036
- "presentation",
1037
- "axes",
1038
- t,
1039
- "range",
1040
- "min"
1041
- ], `Axis range min (${r}) must be less than max (${e}).`);
1042
- }
1043
- }, xn = (e, t) => {
1044
- let n = [];
1045
- t.inverted !== void 0 && n.push({
1046
- name: v.SET_INVERT_AXIS,
1047
- payload: {
1048
- axisName: e,
1049
- invertAxis: t.inverted
1050
- }
1051
- });
1052
- let { range: r } = t;
1053
- if (r) {
1054
- n.push({
1055
- name: v.SET_AXIS_RANGE_OPTION,
1056
- payload: {
1057
- axisName: e,
1058
- axisRangeOption: yn(r)
1059
- }
1060
- });
1061
- let { max: t, min: i } = Q(r);
1062
- i !== void 0 && n.push({
1063
- name: v.SET_AXIS_RANGE_MIN,
1064
- payload: {
1065
- axisName: e,
1066
- minValue: i
1067
- }
1068
- }), t !== void 0 && n.push({
1069
- name: v.SET_AXIS_RANGE_MAX,
1070
- payload: {
1071
- axisName: e,
1072
- maxValue: t
1073
- }
1074
- }), "startsAtZero" in r && n.push({
1075
- name: v.SET_AXIS_STARTS_AT_ZERO,
1076
- payload: {
1077
- axisName: e,
1078
- startsAtZero: r.startsAtZero
1079
- }
1080
- });
1081
- }
1082
- return n;
1083
- }, Sn = (e) => {
1084
- let t = Object.entries(e).find(([, e]) => e.success === !1);
1085
- return t ? {
1086
- id: t[0],
1087
- result: t[1]
1088
- } : void 0;
1089
- }, $ = async (e, t, n) => {
1090
- let r = t.map((e, t) => ({
1091
- ...e,
1092
- id: e.id ?? `definition:${t}`
1093
- })), i = await be(e.vSpec, e.availableFields, r.map(({ id: e, name: t, payload: n }) => ({
1094
- id: e,
1095
- name: t,
1096
- payload: n
1097
- })), e.input.variables ?? [], [], e.input.theme), a = Sn(i.results);
1098
- if (!a) return {
1099
- state: {
1100
- ...e,
1101
- vSpec: i.vSpec
1102
- },
1103
- success: !0
1104
- };
1105
- let o = r.find((e) => e.id === a.id), s = o?.definitionContext, c = s?.path ?? n, l = o?.name ?? a.id, u = a.result.error ?? "Operation failed.", d = s ? `Cannot apply ${K(s.received)} to ${s.kind} ${K(s.ref)}` : "Operation failed";
1106
- return {
1107
- issue: J("operation_failed", c, `${G(c)}: ${d} (operation "${l}"): ${u}`, { details: {
1108
- error: a.result.error,
1109
- operationId: a.id,
1110
- operationName: l,
1111
- ...s ? {
1112
- received: s.received,
1113
- ref: s.ref,
1114
- role: s.kind
1115
- } : {}
1116
- } }),
1117
- success: !1
1118
- };
1119
- }, Cn = (e, t) => {
1120
- if (!e || typeof e.data != "object" || e.data === null || !("dataItem" in e.data)) return;
1121
- let n = e.data.dataItem;
1122
- if (!(typeof n != "object" || !n || !("internalKey" in n) || typeof n.internalKey != "string" || !("uniqueSignature" in n) || typeof n.uniqueSignature != "string")) return {
1123
- dataItemInternalKey: n.internalKey,
1124
- dataItemUniqueSignature: n.uniqueSignature,
1125
- kind: t
1126
- };
1127
- }, wn = async (e, t, n, r, i, a) => {
1128
- let o = `${n}:${t.ref}`, s = await be(e.vSpec, e.availableFields, [{
1129
- id: o,
1130
- name: r,
1131
- payload: i
1132
- }], e.input.variables ?? [], [], e.input.theme), c = Sn(s.results), l = Cn(s.results[o], n);
1133
- return c || !l ? {
1134
- issue: J("operation_failed", a, c?.result.error ?? `${n} operation did not return the created data-item identity.`),
1135
- success: !1
1136
- } : {
1137
- state: {
1138
- ...e,
1139
- resolvedRefs: {
1140
- ...e.resolvedRefs,
1141
- [t.ref]: l
1142
- },
1143
- vSpec: s.vSpec
1144
- },
1145
- success: !0
1146
- };
1147
- }, Tn = (e, t, n, r) => {
1148
- let i = [
1149
- "formatType",
1150
- "formatString",
1151
- "currency",
1152
- "currencyIsPrefix",
1153
- "negativeType"
1154
- ];
1155
- return $(e, t.flatMap((t, a) => {
1156
- let o = e.resolvedRefs[t.ref];
1157
- return i.flatMap((e) => {
1158
- let i = t.format?.[e], s = n[e];
1159
- return i !== void 0 && s ? [ln(s, o, t.ref, t.path ?? [...r, a], e, i)] : [];
1160
- });
1161
- }), r);
1162
- }, En = (e, t, n, r) => $(e, t.flatMap((t, i) => t.temporalGrouping ? [mn(n, e.resolvedRefs[t.ref], t.ref, t.path ?? [...r, i], t.temporalGrouping)] : []), r), Dn = (e, t, n, r) => $(e, t.flatMap((t) => t.showNullValues === void 0 ? [] : [{
1163
- name: n,
1164
- payload: {
1165
- ...Y(e.resolvedRefs[t.ref]),
1166
- changes: { showNullValues: t.showNullValues }
1167
- }
1168
- }]), r), On = (e, t) => t ? $(e, [{
1169
- id: "filterGroup",
1170
- name: "setStaticFilterGroup",
1171
- payload: X(t)
1172
- }], ["filterGroup"]) : Promise.resolve({
1173
- state: e,
1174
- success: !0
1175
- }), kn = (e, t, n, r) => {
1176
- if (!t?.length) return Promise.resolve({
1177
- state: e,
1178
- success: !0
1179
- });
1180
- let i = e.vSpec.querySettings?.sortingOrder ?? [], a = new Map(t.map((e) => [e.by, e])), o = new Map(Object.entries(e.resolvedRefs).map(([e, t]) => [`${t.dataItemInternalKey}:${t.dataItemUniqueSignature}`, e])), s = t.map((t) => e.resolvedRefs[t.by]), c = new Set(s.map((e) => `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`));
1181
- return $(e, [{
1182
- name: n,
1183
- payload: { changeRequests: [...s, ...i.filter((e) => !c.has(`${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}`)).map((e) => ({
1184
- dataItemInternalKey: e.dataItem.internalKey,
1185
- dataItemUniqueSignature: e.dataItem.uniqueSignature,
1186
- kind: "dimension"
1187
- }))].map((e, t) => {
1188
- let n = `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`, r = o.get(n), s = i.find((e) => `${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}` === n);
1189
- return {
1190
- ...Y(e),
1191
- newIndex: t,
1192
- sortDirection: (r ? a.get(r)?.direction : void 0) ?? s?.sortDirection ?? "asc"
1193
- };
1194
- }) }
1195
- }, ...t.map((t) => ({
1196
- name: r,
1197
- payload: {
1198
- ...Y(e.resolvedRefs[t.by]),
1199
- enabled: t.enabled ?? !0
1200
- }
1201
- }))], ["sorting"]);
1202
- }, An = (e, t) => {
1203
- let n = [];
1204
- return t?.overwrites && n.push({
1205
- name: ve.SET_COLORING_OVERWRITES,
1206
- payload: { overwrites: t.overwrites.map(({ dimension: t, ...n }) => t === void 0 ? n : {
1207
- ...n,
1208
- dimension: Y(e.resolvedRefs[t])
1209
- }) }
1210
- }), t?.rules && n.push({
1211
- name: ve.SET_COLORING_RULES,
1212
- payload: { rules: t.rules.map(({ measure: t, ...n }) => ({
1213
- ...n,
1214
- measure: Y(e.resolvedRefs[t])
1215
- })) }
1216
- }), $(e, n, Z);
1217
- };
1218
- export { mt as $, rn as A, Mt as B, dn as C, $t as D, en as E, jt as F, rt as G, wt as H, Et as I, lt as J, ut as K, Dt as L, Kt as M, B as N, W as O, Vt as P, ct as Q, Ot as R, _n as S, sn as T, Ct as U, At as V, yt as W, ot as X, st as Y, dt as Z, bn as _, Tn as a, et as at, X as b, xn as c, J as d, at as et, cn as f, vn as g, $ as h, On as i, gt as it, nn as j, tn as k, ln as l, mn as m, An as n, pt as nt, kn as o, T as ot, un as p, it as q, Dn as r, ht as rt, En as s, Se as st, wn as t, ft as tt, pn as u, fn as v, G as w, gn as x, Y as y, kt as z };