@milaboratories/graph-maker 1.1.140 → 1.1.142

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 (115) hide show
  1. package/dist/GraphMaker/components/LassoControls/index.vue.js +1 -1
  2. package/dist/GraphMaker/constantsCommon.d.ts +8 -0
  3. package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
  4. package/dist/GraphMaker/constantsCommon.js +94 -83
  5. package/dist/GraphMaker/constantsCommon.js.map +1 -1
  6. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts +3 -0
  7. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts.map +1 -0
  8. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js +90 -0
  9. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js.map +1 -0
  10. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js +5 -0
  11. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js.map +1 -0
  12. package/dist/GraphMaker/forms/LayersForm/index.vue.d.ts.map +1 -1
  13. package/dist/GraphMaker/forms/LayersForm/index.vue.js +45 -43
  14. package/dist/GraphMaker/forms/LayersForm/index.vue.js.map +1 -1
  15. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  16. package/dist/GraphMaker/index.vue.js +24 -24
  17. package/dist/GraphMaker/index.vue.js.map +1 -1
  18. package/dist/GraphMaker/store.js +9 -9
  19. package/dist/GraphMaker/types.d.ts +1 -1
  20. package/dist/GraphMaker/types.d.ts.map +1 -1
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +16 -0
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +54 -52
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts.map +1 -1
  27. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js +84 -70
  28. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js.map +1 -1
  29. package/dist/GraphMaker/utils/loadDefaultSources.js +4 -3
  30. package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
  31. package/dist/_virtual/_commonjsHelpers.js +3 -5
  32. package/dist/_virtual/_commonjsHelpers.js.map +1 -1
  33. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +1 -1
  34. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +185 -164
  35. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  36. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js +120 -103
  37. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js.map +1 -1
  38. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/ChartsGroup.js +4 -4
  39. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js +105 -0
  40. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js.map +1 -0
  41. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js +66 -59
  42. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
  43. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +57 -54
  44. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  45. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js +17 -0
  46. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js.map +1 -0
  47. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +24 -9
  48. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
  49. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js +9 -0
  50. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
  51. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
  52. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
  53. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
  54. package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
  55. package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
  56. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
  57. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
  58. package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
  59. package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
  60. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
  61. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
  62. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
  63. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
  64. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
  65. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
  66. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
  67. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
  68. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
  69. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
  70. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
  71. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
  72. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
  73. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
  74. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
  75. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
  76. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
  77. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
  78. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
  79. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
  80. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
  81. package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
  82. package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
  83. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3426
  84. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  85. package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
  86. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
  87. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
  88. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
  89. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
  90. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
  91. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
  92. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
  93. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
  94. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
  95. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
  96. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
  97. package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
  98. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
  99. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
  100. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
  101. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
  102. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
  103. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
  104. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
  105. package/package.json +3 -3
  106. package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
  107. package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
  108. package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
  109. package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
  110. package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
  111. package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
  112. package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
  113. package/dist/node_modules/lodash/lodash.js +0 -3678
  114. package/dist/node_modules/lodash/lodash.js.map +0 -1
  115. package/dist/node_modules/zod/lib/index.js.map +0 -1
@@ -1,3436 +1,46 @@
1
- import z from "../../../canonicalize/lib/canonicalize.js";
2
- import { deriveLabels as Fe, isLabelColumn as Le } from "../../../@platforma-sdk/model/dist/index.js";
3
- import { canonicalizeJson as j, pTableValue as Te } from "../../pl-model-common/dist/index.js";
4
- import pe from "../../../lodash/lodash.js";
5
- var ke = "pl7.app/axisNature", we = "pl7.app/label", Ee = "pl7.app/columnAsAxis/name", Ne = "pl7.app/columnAsAxis/domain", $ = "pl7.app/isSubset", te = "pl7.app/isDiscreteFilter", Ge = "pl7.app/discreteValues", Me = "pl7.app/graph/axis/highCardinality", qe = "pl7.app/graph/isVirtual", ve = "pl7.app/isLinkerColumn", ne = "pl7.app/format", F = class ae {
6
- constructor({ type: e, name: o, domain: n }) {
7
- this.kind = "axis", this.type = e, this.name = o, this.domain = { ...n };
8
- }
9
- toCanonicalString() {
10
- return z(this);
11
- }
12
- static fromAxisSpec(e) {
13
- return new ae({ name: e.name, type: e.type, domain: e.domain });
14
- }
15
- static fromAxesSpec(e) {
16
- return e.map((o) => ae.fromAxisSpec(o));
17
- }
18
- copy() {
19
- return new ae({ type: this.type, name: this.name, domain: this.domain });
20
- }
21
- toPFrameId() {
22
- return {
23
- type: this.type,
24
- name: this.name,
25
- domain: this.domain
26
- };
27
- }
28
- static fromPojo(e) {
29
- return new ae(e);
30
- }
31
- }, W = class Ce {
32
- constructor({ name: e, type: o }) {
33
- this.kind = "column", this.name = e, this.type = o;
34
- }
35
- toCanonicalString() {
36
- return z(this);
37
- }
38
- static fromPojo(e) {
39
- return new Ce(e);
40
- }
41
- };
42
- function O(t) {
43
- return t !== null && t.kind === "column";
44
- }
45
- function re(t) {
46
- return t !== null && t.kind === "axis";
47
- }
48
- function b(t) {
49
- const e = JSON.parse(t);
50
- if (e.kind === "column")
51
- return W.fromPojo(e);
52
- if (e.kind === "axis")
53
- return F.fromPojo(e);
54
- throw Error("wrong column or axis object");
55
- }
56
- var fe = "pl7.app/parents";
57
- function Ae(t) {
58
- return !t.annotations || !t.annotations[fe] ? [] : JSON.parse(t.annotations[fe]);
59
- }
60
- function Ve(t, e) {
61
- const o = j(t[e]);
62
- for (let n = 0; n < t.length; n++) {
63
- const l = t[n];
64
- if (e === n)
65
- continue;
66
- if (Ae(l).some((c) => j(c) === o))
67
- return !1;
68
- }
69
- return !0;
70
- }
71
- function je(t) {
72
- for (let e = 0; e < t.length; e++)
73
- if (Ve(t, e))
74
- return t[e];
75
- return null;
76
- }
77
- function ze(t) {
78
- const e = { axis: t, parents: [] };
79
- let o = [e];
80
- for (; o.length; ) {
81
- const n = [];
82
- for (const l of o) {
83
- const s = Ae(l.axis);
84
- l.parents = s.map((c) => ({ axis: c, parents: [] })), n.push(...l.parents);
85
- }
86
- o = n;
87
- }
88
- return e;
89
- }
90
- function Ke(t) {
91
- const e = /* @__PURE__ */ new Set([j(t.axis)]);
92
- let o = [t];
93
- for (; o.length; ) {
94
- const n = [];
95
- for (const l of o)
96
- for (const s of l.parents)
97
- e.add(j(s.axis)), n.push(s);
98
- o = n;
99
- }
100
- return e;
101
- }
102
- function Ue(t) {
103
- const e = [t.axis];
104
- let o = [t];
105
- for (; o.length; ) {
106
- const n = [];
107
- for (const l of o)
108
- for (const s of l.parents)
109
- e.push(s.axis), n.push(s);
110
- o = n;
111
- }
112
- return e;
113
- }
114
- function oe(t) {
115
- if (!t.length)
116
- return [];
117
- let e = t;
118
- const o = [];
119
- for (; e.length; ) {
120
- const n = je(e);
121
- if (n === null)
122
- return null;
123
- const l = ze(n);
124
- if (l === null)
125
- return null;
126
- const s = Ke(l), c = Ue(l);
127
- o.push(c), e = e.filter((r) => !s.has(j(r)));
128
- }
129
- return o;
130
- }
131
- function We(t) {
132
- var e, o;
133
- const n = /* @__PURE__ */ new Map();
134
- for (const l of t) {
135
- const s = new W({ name: l.columnId, type: l.spec.valueType }), c = oe(l.spec.axesSpec);
136
- if (!c || c.length !== 2)
137
- continue;
138
- const [r, a] = c, u = j(r), p = j(a);
139
- n.has(u) || n.set(u, /* @__PURE__ */ new Map()), n.has(p) || n.set(p, /* @__PURE__ */ new Map()), (e = n.get(u)) == null || e.set(p, s), (o = n.get(p)) == null || o.set(u, s);
140
- }
141
- return n;
142
- }
143
- async function He(t, e, o, n, l, s, c, r = !0, a) {
144
- var u, p, m, S;
145
- const h = b(e);
146
- if (O(h)) {
147
- const x = await t.pFrameProvider.getColumnSpecById(h);
148
- if (!x)
149
- return;
150
- const w = De(
151
- x,
152
- l,
153
- s,
154
- c,
155
- a
156
- ).map((d) => F.fromAxisSpec(d).toCanonicalString()), v = new Set(w), D = x.axesSpec.map((d) => F.fromAxisSpec(d).toCanonicalString()), B = {};
157
- r && D.forEach((d, i) => {
158
- v.has(d) && (B[d] = i);
159
- });
160
- const C = {
161
- kind: "column",
162
- name: x.name,
163
- label: o ?? await T(t, e, []),
164
- type: x.valueType,
165
- spec: x,
166
- annotations: x.annotations,
167
- isSubsetFilter: ((u = x.annotations) == null ? void 0 : u[$]) === "true",
168
- isDiscreteFilter: x.valueType === "String" || ((p = x.annotations) == null ? void 0 : p[te]) === "true",
169
- axesToBeFixed: w,
170
- axesToBeFixedIndexes: B
171
- };
172
- n.set(h.toCanonicalString(), C);
173
- for (const d of x.axesSpec) {
174
- const y = F.fromAxisSpec(d).toCanonicalString();
175
- if (n.has(y))
176
- continue;
177
- const f = Ie(d), g = {
178
- kind: "axis",
179
- name: d.name,
180
- label: await T(t, y, [e]),
181
- type: d.type,
182
- mustBeConsumed: f,
183
- dividable: !1,
184
- spec: d,
185
- annotations: d.annotations,
186
- isSubsetFilter: ((m = d.annotations) == null ? void 0 : m[$]) === "true",
187
- isDiscreteFilter: d.type === "String" || ((S = d.annotations) == null ? void 0 : S[te]) === "true",
188
- parentSources: [e]
189
- };
190
- n.set(y, g);
191
- }
192
- }
193
- }
194
- function ge(t) {
195
- const e = b(t), { name: o, type: n } = e;
196
- return O(e) ? {
197
- kind: "column",
198
- name: "",
199
- label: " ",
200
- type: e.type,
201
- spec: { axesSpec: [], kind: "PColumn", valueType: e.type, name: o },
202
- annotations: void 0,
203
- isSubsetFilter: !1,
204
- isDiscreteFilter: e.type === "String",
205
- axesToBeFixed: [],
206
- axesToBeFixedIndexes: {}
207
- } : {
208
- kind: "axis",
209
- name: "",
210
- label: " ",
211
- type: n,
212
- spec: { type: n, name: o },
213
- mustBeConsumed: !1,
214
- dividable: !1,
215
- annotations: void 0,
216
- isSubsetFilter: !1,
217
- isDiscreteFilter: n === "String",
218
- parentSources: []
219
- };
220
- }
221
- function me(t) {
222
- return {
223
- type: t.type,
224
- components: { ...t.components },
225
- dividedAxes: { ...t.dividedAxes }
226
- };
227
- }
228
- function Ye(t) {
229
- const { selectedSource: e, type: o, selectedFilterRange: n, selectedFilterValue: l } = t, s = b(e);
230
- if (!s)
231
- throw Error("Empty source selected");
232
- if (o === "range") {
233
- const c = [];
234
- return (n == null ? void 0 : n.max) !== void 0 && c.push({
235
- type: "bySingleColumnV2",
236
- column: re(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
237
- predicate: {
238
- operator: "LessOrEqual",
239
- reference: n.max
240
- }
241
- }), (n == null ? void 0 : n.min) !== void 0 && c.push({
242
- type: "bySingleColumnV2",
243
- column: re(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
244
- predicate: {
245
- operator: "GreaterOrEqual",
246
- reference: n == null ? void 0 : n.min
247
- }
248
- }), c;
249
- } else if (o === "subset")
250
- return [
251
- {
252
- type: "bySingleColumnV2",
253
- column: re(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
254
- predicate: {
255
- operator: "Not",
256
- operand: { operator: "IsNA" }
257
- }
258
- }
259
- ];
260
- return typeof l > "u" ? [] : [
261
- {
262
- type: "bySingleColumnV2",
263
- column: re(s) ? { type: "axis", id: s.toPFrameId() } : {
264
- type: "column",
265
- id: s.name
266
- },
267
- predicate: {
268
- operator: "Equal",
269
- reference: s.type === "String" ? String(l) : Number(l)
270
- }
271
- }
272
- ];
273
- }
274
- function Y(t) {
275
- const e = [];
276
- for (const o of t)
277
- e.push(...Ye(o));
278
- return e;
279
- }
280
- function xe(t) {
281
- var e, o, n, l;
282
- if ("kind" in t && t.kind === "PColumn") {
283
- const r = (o = t.name) != null ? o : (e = t.annotations) == null ? void 0 : e[Ee], a = (l = t.domain) != null ? l : (n = t.annotations) == null ? void 0 : n[Ne];
284
- return z({ name: r, domain: a });
285
- }
286
- const s = t.name, c = t.domain;
287
- return z({ name: s, domain: c });
288
- }
289
- async function be(t, e, o) {
290
- var n;
291
- for (const l of o) {
292
- const s = b(l);
293
- if (O(s)) {
294
- const c = await t.pFrameProvider.getColumnSpecById(s), r = ((n = c == null ? void 0 : c.axesSpec) != null ? n : []).find(
295
- (a) => F.fromAxisSpec(a).toCanonicalString() === e.toCanonicalString()
296
- );
297
- if (r)
298
- return r;
299
- }
300
- }
301
- return null;
302
- }
303
- var Re = "pl7.app/label";
304
- async function k(t, e, o) {
305
- const n = b(e);
306
- if (O(n))
307
- return;
308
- async function l(a) {
309
- const u = await be(t, a, o);
310
- return u ? xe(u) : null;
311
- }
312
- const s = await t.pFrameProvider.getColumnsFull([], !1, void 0, [Re]), c = await l(n), r = s.find(({ spec: a }) => a && a.axesSpec.length === 1 && xe(a.axesSpec[0]) === c);
313
- return r ? new W({ name: r.columnId, type: r.spec.valueType }) : void 0;
314
- }
315
- async function J(t, e, o) {
316
- const n = b(e), l = await k(t, e, o);
317
- let s;
318
- return O(n) ? s = await t.pFrameProvider.getColumnSpecById(l ?? n) : s = l ? await t.pFrameProvider.getColumnSpecById(l) : await be(t, n, o), s;
319
- }
320
- async function T(t, e, o) {
321
- var n, l;
322
- const s = await J(t, e, o);
323
- if (!s)
324
- return "";
325
- const c = (l = (n = s.annotations) == null ? void 0 : n[we]) != null ? l : s.name;
326
- return t.labelsModifier(s.name, c);
327
- }
328
- function Ie(t) {
329
- var e, o;
330
- const n = (o = (e = t.annotations) == null ? void 0 : e[ke]) == null ? void 0 : o.toLowerCase();
331
- return !!n && n !== "homogenous" && n !== "homogeneous";
332
- }
333
- function R(t) {
334
- var e, o;
335
- return ((e = t.annotations) == null ? void 0 : e[$]) === "true" || ((o = t.annotations) == null ? void 0 : o[te]) === "true", !0;
336
- }
337
- function Xe(t) {
338
- var e, o;
339
- return !t.name.includes("metadata") && ((e = t.annotations) == null ? void 0 : e[qe]) !== "true" && ((o = t.annotations) == null ? void 0 : o[$]) !== "true";
340
- }
341
- function $e(t) {
342
- var e;
343
- const o = {};
344
- for (const n of t.filter((l) => l.spec.axesSpec.length === 2)) {
345
- const l = new W({ name: n.columnId, type: n.spec.valueType }), s = (e = n.spec.axesSpec) != null ? e : [];
346
- if (s.length) {
347
- const [c, r] = s, a = F.fromAxisSpec(c).toCanonicalString(), u = F.fromAxisSpec(r).toCanonicalString();
348
- o[a] || (o[a] = {}), o[u] || (o[u] = {}), o[a][u] = { id: l, spec: n.spec }, o[u][a] = { id: l, spec: n.spec };
349
- }
350
- }
351
- return o;
352
- }
353
- async function Q(t, e) {
354
- const o = /* @__PURE__ */ new Set(), n = [];
355
- for (const l of e) {
356
- const s = b(l);
357
- if (O(s)) {
358
- const c = await t.pFrameProvider.getColumnSpecById(s);
359
- if (!c)
360
- continue;
361
- c.axesSpec.forEach((r) => {
362
- const a = F.fromAxisSpec(r).toCanonicalString();
363
- o.has(a) || (o.add(a), n.push(r));
364
- });
365
- }
366
- }
367
- return n;
368
- }
369
- function Je(t, e, o) {
370
- const n = {}, l = /* @__PURE__ */ new Set([e]);
371
- let s = [e];
372
- for (; s.length; ) {
373
- const c = /* @__PURE__ */ new Set();
374
- for (const r of s)
375
- if (t[r]) {
376
- const a = Object.keys(t[r]);
377
- for (const u of a)
378
- if (n[u] = r, u === o) {
379
- const p = [];
380
- let m = o;
381
- for (; n[m] !== e; )
382
- p.push(m), m = n[m];
383
- return p.push(m), p.map((S) => t[S][n[S]].id);
384
- } else l.has(u) || (c.add(u), l.add(u));
385
- }
386
- s = [...c];
387
- }
388
- return null;
389
- }
390
- function Qe(t, e, o) {
391
- const n = [...e].map((s) => Je(t, s, o)).filter((s) => s !== null);
392
- if (n.length === 0)
393
- return [];
394
- let l = n[0];
395
- for (const s of n)
396
- s.length < l.length && (l = s);
397
- return l;
398
- }
399
- async function X(t) {
400
- const e = await t.pFrameProvider.getColumnsFull(
401
- [],
402
- !1,
403
- void 0,
404
- void 0,
405
- { [ve]: "true" }
406
- ), o = $e(e.filter((l) => l.spec.axesSpec.length === 2)), n = We(e.filter((l) => l.spec.axesSpec.length > 2));
407
- return { linkerColumnsMap: o, compositeLinkerMap: n };
408
- }
409
- async function V(t, e, o, n, l, s) {
410
- const c = b(l);
411
- if (!O(c))
412
- return [];
413
- const r = await t.pFrameProvider.getColumnSpecById(c);
414
- if (!r)
415
- return [];
416
- const a = r.axesSpec.filter(
417
- (w) => {
418
- const v = F.fromAxisSpec(w).toCanonicalString();
419
- return !(s != null && s.some((D) => D.axisSource === v));
420
- }
421
- ), u = new Set(n.map((w) => F.fromAxisSpec(w).toCanonicalString())), p = a.filter((w) => {
422
- const v = F.fromAxisSpec(w).toCanonicalString();
423
- return !u.has(v);
424
- });
425
- if (!p.length)
426
- return [];
427
- const m = oe(n), S = oe(p);
428
- if (!m || !S)
429
- throw Error(`Can't create axes tree for ${r.name}`);
430
- const h = new Set(m.map(j)), x = /* @__PURE__ */ new Set();
431
- return S.forEach((w) => {
432
- var v;
433
- const D = j(w);
434
- if (o.has(D)) {
435
- const B = o.get(D), d = (B ? [...B.keys()] : []).find((y) => h.has(y));
436
- if (!d)
437
- throw Error(`Can't find composite linker column for ${r.name}, ${D}`);
438
- const i = (v = o.get(D)) == null ? void 0 : v.get(d);
439
- x.add(i.toCanonicalString());
440
- } else if (w.length === 1) {
441
- const B = F.fromAxisSpec(w[0]).toCanonicalString();
442
- Qe(e, u, B).forEach((d) => {
443
- x.add(d.toCanonicalString());
444
- });
445
- }
446
- }), [...x].map((w) => b(w));
447
- }
448
- function De(t, e, o, n, l) {
449
- const c = t.axesSpec.filter(
450
- (p) => !o.has(F.fromAxisSpec(p).toCanonicalString())
451
- );
452
- if (!c.length)
453
- return [];
454
- const r = oe(e);
455
- let a = oe(c);
456
- if (!r || !a)
457
- return c;
458
- const u = new Set(r.map(j));
459
- return a = a.filter(
460
- (p) => {
461
- const m = j(p), S = l.get(m);
462
- return !(S ? [...S.keys()] : []).some((x) => u.has(x));
463
- }
464
- ), a.some((p) => p.length > 1) ? a.flatMap((p) => p) : (a = a.filter(([p]) => !n.has(F.fromAxisSpec(p).toCanonicalString())), a.flatMap((p) => p));
465
- }
466
- function Be(t, e) {
467
- const o = e.columnsData[Object.keys(e.columnsData)[0]].length, n = new Int32Array(o).fill(0);
468
- for (let l = 0; l < o; l++) {
469
- let s = !1;
470
- for (let c = 0; c < t.length; c++) {
471
- const { selectedSource: r, selectedFilterValue: a, selectedFilterRange: u, type: p } = t[c], m = b(r), S = (O(m) ? e.columnsData[r] : e.axesData[r])[l];
472
- if (a !== void 0 && (s = s || S === a), u !== void 0 && (u.min !== void 0 || u.max !== void 0) && typeof S == "number") {
473
- let h = !0;
474
- u.min !== void 0 && (h = h && S >= u.min), u.max !== void 0 && (h = h && S <= u.max), s = s || h;
475
- }
476
- p === "subset" && (s = s || S != null);
477
- }
478
- s && (n[l] = 1);
479
- }
480
- return n;
481
- }
482
- var Z = class {
483
- constructor(t, e) {
484
- this.simpleComponentControllers = t, this.filterComponentControllers = e, this.ignoredOptionIdNames = [], this.dataInputs = [], this.dontAllowUnfilteredHighCardinality = !1;
485
- }
486
- get requiredComponents() {
487
- const t = [];
488
- for (const e of Object.keys(this.simpleComponentControllers))
489
- this.simpleComponentControllers[e].isRequired && t.push(e);
490
- return t;
491
- }
492
- get dimensionsConsumerComponents() {
493
- const t = [];
494
- for (const e of Object.keys(this.simpleComponentControllers))
495
- this.simpleComponentControllers[e].isDimensionsConsumer && t.push(e);
496
- for (const e of Object.keys(this.filterComponentControllers))
497
- this.filterComponentControllers[e].isDimensionsConsumer && t.push(e);
498
- return t;
499
- }
500
- addSelected(t, e, o) {
501
- if (t in this.simpleComponentControllers)
502
- return this.simpleComponentControllers[t].addSelected(e, o);
503
- if (t in this.filterComponentControllers)
504
- return this.filterComponentControllers[t].addSelected(e, o);
505
- throw Error(`Unknown input name: ${String(t)}`);
506
- }
507
- deleteSelected(t, e, o, n) {
508
- if (t in this.simpleComponentControllers)
509
- return this.simpleComponentControllers[t].deleteSelected(o, n.selectedSource);
510
- if (t in this.filterComponentControllers)
511
- return this.filterComponentControllers[t].deleteSelected(o, n.selectedSource);
512
- throw Error(`Unknown input name: ${String(t)}`);
513
- }
514
- changeSelected(t, e, o, n) {
515
- const l = o.components[t].selectorStates, s = l.filter((a) => !n.find((u) => u.selectedSource === a.selectedSource)), c = n.filter((a) => !l.find((u) => u.selectedSource === a.selectedSource));
516
- let r = me(o);
517
- return s.forEach((a) => {
518
- r = this.deleteSelected(t, e, r, a);
519
- }), c.forEach((a) => {
520
- r = this.addSelected(t, r, a);
521
- }), o.components[t].selectorStates = n.map(
522
- (a) => o.components[t].selectorStates.find(
523
- (u) => u.selectedSource === a.selectedSource
524
- )
525
- ).filter(Boolean), r;
526
- }
527
- switchDividableAxis(t, e) {
528
- return me(t);
529
- }
530
- async getMustBeConsumedAxes(t, e) {
531
- return Promise.resolve(/* @__PURE__ */ new Set());
532
- }
533
- createEmptyComponentsGuide(t) {
534
- return Object.fromEntries(
535
- Object.entries(t.components).map(
536
- ([e, o]) => [
537
- e,
538
- {
539
- options: [],
540
- optionsInfo: /* @__PURE__ */ new Map(),
541
- stateConsistency: {},
542
- required: !1,
543
- multipleSelectors: !1
544
- }
545
- ]
546
- )
547
- );
548
- }
549
- async getSelectedSourcesInfo(t, e, o, n, l) {
550
- var s;
551
- const c = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), a = [];
552
- for (const m of this.dataInputs)
553
- for (const S of e.components[m].selectorStates) {
554
- const h = b(S.selectedSource);
555
- if (O(h)) {
556
- const x = await t.pFrameProvider.getColumnSpecById(h);
557
- x && x.axesSpec.forEach((w) => {
558
- const v = F.fromAxisSpec(w).toCanonicalString();
559
- r.has(v) || (r.add(v), a.push(w));
560
- });
561
- }
562
- }
563
- const u = /* @__PURE__ */ new Set();
564
- let p = [...r];
565
- for (; p.length; ) {
566
- const m = [];
567
- for (const S of p)
568
- if (n[S]) {
569
- const h = Object.keys(n[S]);
570
- for (const x of h)
571
- !u.has(x) && !r.has(x) && (m.push(x), u.add(x));
572
- }
573
- p = m;
574
- }
575
- for (const [m, { selectorStates: S }] of Object.entries(e.components)) {
576
- const x = ((s = this.simpleComponentControllers[m]) != null ? s : this.filterComponentControllers[m]).settings.columnsWithExtraAxesAllowed;
577
- for (const { selectedSource: w } of S)
578
- await He(
579
- t,
580
- w,
581
- o[w],
582
- c,
583
- a,
584
- r,
585
- u,
586
- x,
587
- l
588
- );
589
- }
590
- return c;
591
- }
592
- getEmptyInputGuide(t) {
593
- return {
594
- components: this.createEmptyComponentsGuide(t),
595
- getSourceInfo: (e) => ge(e),
596
- freeOptionsSet: /* @__PURE__ */ new Set(),
597
- axesToBeFixedSet: /* @__PURE__ */ new Set(),
598
- readyData: !1,
599
- ready: !1,
600
- consistent: !0
601
- };
602
- }
603
- getConsumedOptionsSet(t) {
604
- const e = /* @__PURE__ */ new Set();
605
- for (const o of this.dimensionsConsumerComponents)
606
- for (const { selectedSource: n } of t.components[o].selectorStates)
607
- e.add(n);
608
- return e;
609
- }
610
- async getLabelsMap(t, e) {
611
- const o = await t.pFrameProvider.getColumnsFull(
612
- this.dataInputs.reduce((n, l) => {
613
- const c = e.components[l].selectorStates.map((r) => b(r.selectedSource));
614
- return n.concat(c);
615
- }, []),
616
- !1
617
- );
618
- return Fe(o, (n) => n.spec).reduce((n, l) => {
619
- const s = new W({ name: l.value.columnId, type: l.value.spec.valueType }).toCanonicalString();
620
- return n[s] = l.label, n;
621
- }, {});
622
- }
623
- async calculateOptions(t, e, o = [], n = Xe) {
624
- var l, s;
625
- const c = this.createEmptyComponentsGuide(e), r = this.getConsumedOptionsSet(e), a = new Set(this.ignoredOptionIdNames), u = new Set(o), { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), S = await this.getLabelsMap(t, e), h = await this.getSelectedSourcesInfo(t, e, S, p, m), x = /* @__PURE__ */ new Map(), w = { ...this.simpleComponentControllers, ...this.filterComponentControllers }, v = /* @__PURE__ */ new Set();
626
- for (const [y, f] of Object.entries(w)) {
627
- const g = await f.getOptions(
628
- t,
629
- e,
630
- S,
631
- r,
632
- p,
633
- m,
634
- n,
635
- a,
636
- u
637
- );
638
- this.dataInputs.includes(y) || g.options.forEach((A) => {
639
- v.add(A.value);
640
- });
641
- for (const [A, P] of g.optionsInfo)
642
- x.set(A, P);
643
- c[y] = g;
644
- }
645
- const D = (y) => {
646
- const f = x.get(y);
647
- f && f.kind === "axis" && (f.mustBeConsumed = !0);
648
- const g = h.get(y);
649
- g && g.kind === "axis" && (g.mustBeConsumed = !0);
650
- }, B = await this.getMustBeConsumedAxes(t, e);
651
- for (const y of B)
652
- D(y);
653
- if (this.dontAllowUnfilteredHighCardinality) {
654
- const y = (g) => {
655
- var A;
656
- return ((A = g == null ? void 0 : g.annotations) == null ? void 0 : A[Me]) === "true";
657
- }, f = (s = (l = e.components.filters) == null ? void 0 : l.selectorStates.reduce((g, A) => {
658
- const P = h.get(A.selectedSource);
659
- return (P == null ? void 0 : P.kind) === "column" && P.spec.axesSpec.filter(y).forEach((L) => g.add(F.fromAxisSpec(L).toCanonicalString())), (P == null ? void 0 : P.kind) === "axis" && y(P.spec) && g.add(F.fromAxisSpec(P.spec).toCanonicalString()), g;
660
- }, /* @__PURE__ */ new Set())) != null ? s : /* @__PURE__ */ new Set();
661
- this.dataInputs.forEach((g) => {
662
- for (const { selectedSource: A } of e.components[g].selectorStates) {
663
- const P = h.get(A);
664
- if ((P == null ? void 0 : P.kind) === "column" && P.spec.axesSpec.filter(y).forEach((L) => {
665
- const N = F.fromAxisSpec(L).toCanonicalString();
666
- !v.has(N) && !f.has(N) && v.add(N), f.has(N) || D(N);
667
- }), (P == null ? void 0 : P.kind) === "axis" && y(P.spec)) {
668
- const E = F.fromAxisSpec(P.spec).toCanonicalString();
669
- v.has(E) || v.add(E), f.has(E) || D(E);
670
- }
671
- }
672
- });
673
- }
674
- const C = /* @__PURE__ */ new Set();
675
- for (const { selectorStates: y } of Object.values(e.components))
676
- for (const { selectedSource: f } of y) {
677
- const g = h.get(f);
678
- g && g.kind === "column" && g.axesToBeFixed.forEach((A) => {
679
- C.add(A);
680
- });
681
- }
682
- const d = await this.isConsistent(t, e, p, m), i = (y) => {
683
- var f, g, A;
684
- const P = (f = b(y).toCanonicalString()) != null ? f : y;
685
- return (A = (g = x.get(P)) != null ? g : h.get(P)) != null ? A : ge(y);
686
- };
687
- return {
688
- components: c,
689
- getSourceInfo: i,
690
- freeOptionsSet: v,
691
- axesToBeFixedSet: C,
692
- readyData: this.readyDataInputs(e),
693
- ready: this.readyForPlotBuilding(t, e, d, v, i),
694
- consistent: d
695
- };
696
- }
697
- async getUniqueSourceValuesWithLabels(t, e, o, n, l, s) {
698
- var c;
699
- const r = (p) => p.sort((m, S) => m.label.localeCompare(S.label, "en", { numeric: !0 })), a = e.getSourceInfo(o), u = (c = a.annotations) == null ? void 0 : c[Ge];
700
- try {
701
- const p = u ? JSON.parse(u).map((m) => String(m)) : null;
702
- if (p) {
703
- const m = p.map((S) => ({ value: S, label: S }));
704
- return r(m), { values: m, overflow: !1 };
705
- }
706
- } catch {
707
- console.error(`Parsing error: discrete values annotation ${u} in ${o}`);
708
- }
709
- if (a.kind === "axis") {
710
- const p = b(o), m = a.parentSources.map(b), S = await k(t, o, a.parentSources);
711
- let h = [];
712
- if (S) {
713
- l && (h = [{
714
- type: "bySingleColumnV2",
715
- column: {
716
- type: "column",
717
- id: S.name
718
- },
719
- predicate: {
720
- operator: "StringIContains",
721
- substring: l
722
- }
723
- }]), s && (h = [{
724
- type: "bySingleColumnV2",
725
- column: {
726
- type: "axis",
727
- id: p.toPFrameId()
728
- },
729
- predicate: {
730
- operator: "StringIContains",
731
- substring: s
732
- }
733
- }]);
734
- const { data: D, axesData: B } = await t.pFrameProvider.getSingleColumnData(S, h), C = B[p.toCanonicalString()], d = [];
735
- for (let i = 0; i < Math.min(C.length, n ?? C.length); i++)
736
- d.push({ value: String(C[i]), label: String(D[i]) });
737
- return r(d), { values: d, overflow: !(n === void 0 || C.length < n) };
738
- }
739
- const x = l ?? s;
740
- x && (h = [{
741
- type: "bySingleColumnV2",
742
- column: {
743
- type: "axis",
744
- id: p.toPFrameId()
745
- },
746
- predicate: {
747
- operator: "StringIContains",
748
- substring: x
749
- }
750
- }]);
751
- const w = await t.pFrameProvider.getAxisUniqueValues(p, [m[0]], n, h), v = w.values.map((D) => ({ value: String(D), label: String(D) }));
752
- return r(v), { values: v, overflow: w.overflow };
753
- }
754
- if (a.kind === "column") {
755
- const p = l ?? s, m = b(o), S = p ? [{
756
- type: "bySingleColumnV2",
757
- column: {
758
- type: "column",
759
- id: m.name
760
- },
761
- predicate: {
762
- operator: "StringIContains",
763
- substring: p
764
- }
765
- }] : [], h = await t.pFrameProvider.getColumnUniqueValues(m, n, S), x = h.values.map((w) => ({ value: String(w), label: String(w) }));
766
- return r(x), { values: x, overflow: h.overflow };
767
- }
768
- return { values: [], overflow: !1 };
769
- }
770
- async checkStateConsistency(t, e, o, n) {
771
- const l = /* @__PURE__ */ new Map();
772
- for (const s of Object.keys(this.simpleComponentControllers))
773
- l.set(
774
- s,
775
- await this.simpleComponentControllers[s].checkStateConsistency(t, e, o, n)
776
- );
777
- for (const s of Object.keys(this.filterComponentControllers))
778
- l.set(
779
- s,
780
- await this.filterComponentControllers[s].checkStateConsistency(t, e, o, n)
781
- );
782
- return l;
783
- }
784
- async isConsistent(t, e, o, n) {
785
- const l = await this.checkStateConsistency(t, e, o, n);
786
- for (const s of l.values())
787
- if (Object.values(s).some((c) => !c))
788
- return !1;
789
- return !0;
790
- }
791
- readyDataInputs(t) {
792
- return this.dataInputs.every((e) => t.components[e].selectorStates.length > 0);
793
- }
794
- readyForPlotBuilding(t, e, o, n, l) {
795
- if (!o || !this.readyDataInputs(e))
796
- return !1;
797
- let s = !1;
798
- for (const r of n) {
799
- const a = l(r);
800
- if (a && a.kind === "axis" && a.mustBeConsumed) {
801
- s = !0;
802
- break;
803
- }
804
- }
805
- let c = !1;
806
- for (const { selectorStates: r } of Object.values(e.components)) {
807
- for (const { selectedSource: a, fixedAxes: u } of r) {
808
- const p = l(a);
809
- if (p && p.kind === "column" && p.axesToBeFixed.some(
810
- (m) => {
811
- var S;
812
- return ((S = (u ?? []).find((h) => h.axisSource === m)) == null ? void 0 : S.axisValue) === void 0;
813
- }
814
- )) {
815
- c = !0;
816
- break;
817
- }
818
- }
819
- if (c)
820
- break;
821
- }
822
- return this.requiredComponents.every((r) => e.components[r].selectorStates.length > 0) && !s && !c;
823
- }
824
- async createDataForPlot(t, e) {
825
- return {
826
- data: await this.createDataByColumns(t, e),
827
- settings: await this.createChartSettings(t, e)
828
- };
829
- }
830
- }, Ze = (t) => {
831
- var e;
832
- return ((e = t == null ? void 0 : t.annotations) == null ? void 0 : e[ve]) === "true";
833
- }, Pe = class Oe {
834
- constructor({
835
- componentName: e,
836
- allowedTypes: o,
837
- settings: n,
838
- strictlyDependsOnParents: l,
839
- dependsOn: s = [],
840
- parentComponents: c = [],
841
- annotations: r = {},
842
- checkSourceBySpec: a
843
- }) {
844
- this.componentName = e, this.allowedTypes = [...o], this.settings = { ...Oe.DefaultSettings, ...n }, this.dependsOn = [...s], this.parentComponents = [...c], this.strictlyDependsOnParents = l ?? !0, this.annotations = { ...r }, a && (this.checkSourceBySpec = a);
845
- }
846
- get isRequired() {
847
- return this.settings.required;
848
- }
849
- get isDimensionsConsumer() {
850
- return this.settings.dimensionConsumer;
851
- }
852
- addSelected(e, o) {
853
- const n = me(e);
854
- return n.components[this.componentName].selectorStates.push(o), n;
855
- }
856
- deleteSelected(e, o) {
857
- const n = me(e);
858
- return n.components[this.componentName].selectorStates = n.components[this.componentName].selectorStates.filter((l) => l.selectedSource !== o), n;
859
- }
860
- async checkStateConsistency(e, o, n, l) {
861
- const s = o.components[this.componentName], { parentAxes: c, linkerAxes: r } = await this.getAllowedAxes(e, o, n);
862
- function a(p) {
863
- const m = F.fromAxisSpec(p).toCanonicalString();
864
- return c.has(m) || r.has(m);
865
- }
866
- const u = await Promise.all(
867
- s.selectorStates.map(async ({ selectedSource: p }) => {
868
- const m = b(p);
869
- if (O(m)) {
870
- const S = await e.pFrameProvider.getColumnSpecById(m);
871
- if (!S)
872
- return !1;
873
- if (this.parentComponents.length === 0)
874
- return !0;
875
- if (this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent)
876
- return S.axesSpec.every((x) => a(x));
877
- if (this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent) {
878
- if (S.axesSpec.some((w) => a(w)))
879
- return !0;
880
- const x = oe(S.axesSpec);
881
- return x ? x.some((w) => l.has(j(w))) : !1;
882
- } else
883
- return c.size === 0 || S.axesSpec.some((x) => a(x));
884
- }
885
- return c.has(p);
886
- })
887
- );
888
- return s.selectorStates.reduce(
889
- (p, m, S) => (p[m.selectedSource] = u[S], p),
890
- {}
891
- );
892
- }
893
- async getProducingAxes(e, o) {
894
- const s = o.components[this.componentName].selectorStates.map((a) => b(a.selectedSource)).filter((a) => O(a)), c = /* @__PURE__ */ new Set();
895
- return (await Promise.all(
896
- s.map((a) => e.pFrameProvider.getColumnSpecById(a))
897
- )).forEach((a) => {
898
- a && a.axesSpec.forEach((u) => {
899
- c.add(F.fromAxisSpec(u).toCanonicalString());
900
- });
901
- }), c;
902
- }
903
- getParentSelectedSources(e, o) {
904
- return this.parentComponents.reduce((l, s) => {
905
- const c = o.components[s].selectorStates.map(
906
- (r) => b(r.selectedSource)
907
- );
908
- return l.push(...c), l;
909
- }, []);
910
- }
911
- async getParentAxes(e, o) {
912
- var n;
913
- const l = this.getParentSelectedSources(e, o), s = /* @__PURE__ */ new Set();
914
- for (const c of l)
915
- if (O(c)) {
916
- const r = await e.pFrameProvider.getColumnSpecById(c);
917
- (n = r == null ? void 0 : r.axesSpec) == null || n.forEach((a) => {
918
- const u = F.fromAxisSpec(a);
919
- s.add(u.toCanonicalString());
920
- });
921
- }
922
- return s;
923
- }
924
- async getAllowedAxes(e, o, n) {
925
- var l, s, c, r, a, u, p;
926
- const m = this.getParentSelectedSources(e, o), S = /* @__PURE__ */ new Set(), h = [], x = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
927
- for (const D of m)
928
- if (O(D)) {
929
- const B = await e.pFrameProvider.getColumnSpecById(D);
930
- for (const C of (l = B == null ? void 0 : B.axesSpec) != null ? l : []) {
931
- const i = F.fromAxisSpec(C).toCanonicalString();
932
- if (S.has(i))
933
- continue;
934
- S.add(i), h.push(C);
935
- const y = Ie(C);
936
- w.set(i, {
937
- kind: "axis",
938
- name: C.name,
939
- label: await T(e, i, [
940
- D.toCanonicalString()
941
- ]),
942
- type: C.type,
943
- mustBeConsumed: y,
944
- dividable: !1,
945
- spec: C,
946
- annotations: C.annotations,
947
- isSubsetFilter: ((s = C.annotations) == null ? void 0 : s[$]) === "true",
948
- isDiscreteFilter: C.type === "String" || ((c = C.annotations) == null ? void 0 : c[te]) === "true",
949
- parentSources: [D.toCanonicalString()]
950
- });
951
- }
952
- }
953
- let v = [...S];
954
- for (; v.length; ) {
955
- const D = [];
956
- for (const B of v)
957
- if (n[B]) {
958
- const C = Object.keys(n[B]);
959
- for (const d of C)
960
- if (!x.has(d)) {
961
- D.push(d), x.add(d);
962
- const { spec: i, id: y } = n[B][d];
963
- for (const f of i.axesSpec) {
964
- const g = F.fromAxisSpec(f).toCanonicalString();
965
- w.has(g) || w.set(g, {
966
- kind: "axis",
967
- name: f.name,
968
- label: (a = (r = f.annotations) == null ? void 0 : r[we]) != null ? a : "",
969
- type: f.type,
970
- mustBeConsumed: !1,
971
- dividable: !1,
972
- spec: f,
973
- annotations: f.annotations,
974
- isSubsetFilter: ((u = f.annotations) == null ? void 0 : u[$]) === "true",
975
- isDiscreteFilter: f.type === "String" || ((p = f.annotations) == null ? void 0 : p[te]) === "true",
976
- parentSources: [y.toCanonicalString()]
977
- });
978
- }
979
- }
980
- }
981
- v = D;
982
- }
983
- return { parentAxes: S, parentAxesList: h, linkerAxes: x, optionsInfo: w };
984
- }
985
- async getOptions(e, o, n, l, s, c, r, a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set()) {
986
- var p, m, S, h, x;
987
- const w = this.settings.multipleSelectors, v = this.settings.required, D = await this.checkStateConsistency(e, o, s, c);
988
- if (this.dependsOn.length && this.dependsOn.some((P) => o.components[P].selectorStates.length === 0))
989
- return { multipleSelectors: w, required: v, stateConsistency: D, options: [], optionsInfo: /* @__PURE__ */ new Map() };
990
- if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((P) => o.components[P].selectorStates.length === 0))
991
- return { multipleSelectors: w, required: v, stateConsistency: D, options: [], optionsInfo: /* @__PURE__ */ new Map() };
992
- const B = this.getParentSelectedSources(e, o), C = (await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations)).filter((P) => !l.has(P.toCanonicalString())), { parentAxes: d, linkerAxes: i, parentAxesList: y, optionsInfo: f } = await this.getAllowedAxes(e, o, s), g = o.components[this.componentName], A = [];
993
- if (this.settings.axesAllowed)
994
- for (const P of d) {
995
- const E = b(P), L = f.get(E.toCanonicalString()), N = this.allowedTypes.includes(L.spec.type), _ = Object.entries(this.annotations).every(
996
- ([le, q]) => {
997
- var U;
998
- return ((U = L.spec.annotations) == null ? void 0 : U[le]) === q;
999
- }
1000
- ), G = this.checkSourceBySpec ? this.checkSourceBySpec(L.spec, o) : !0, M = !this.settings.homogeneous || !(L != null && L.mustBeConsumed), K = !l.has(P), ee = a.has(E.name) || u.has(E.toCanonicalString()), se = g.selectorStates.some((le) => le.selectedSource === P);
1001
- N && _ && G && M && K && !ee && !se && A.push({ value: P });
1002
- }
1003
- if (this.settings.columnsAllowed) {
1004
- const P = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;
1005
- for (const E of C) {
1006
- const L = E.toCanonicalString(), N = b(L), _ = await e.pFrameProvider.getColumnSpecById(N);
1007
- if (!_)
1008
- continue;
1009
- const G = De(
1010
- _,
1011
- y,
1012
- d,
1013
- i,
1014
- c
1015
- ).map((q) => F.fromAxisSpec(q).toCanonicalString()), M = new Set(G);
1016
- if (
1017
- // do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs
1018
- Le(_) || Ze(_) || this.checkSourceBySpec && !this.checkSourceBySpec(_, o) || this.settings.isDataComponent && !r(_) || P && G.length > 0 || B.length && G.length > 0 && !_.axesSpec.some((q) => {
1019
- const U = F.fromAxisSpec(q).toCanonicalString();
1020
- return d.has(U) || i.has(U);
1021
- })
1022
- )
1023
- continue;
1024
- const K = (m = (p = _ == null ? void 0 : _.axesSpec) == null ? void 0 : p.map((q) => F.fromAxisSpec(q).toCanonicalString())) != null ? m : [], ee = {};
1025
- if (this.settings.columnsWithExtraAxesAllowed && K.forEach((q, U) => {
1026
- M.has(q) && (ee[q] = U);
1027
- }), _) {
1028
- const q = (S = n[L]) != null ? S : await T(e, E.toCanonicalString(), []), U = {
1029
- kind: "column",
1030
- name: _.name,
1031
- label: q,
1032
- type: _.valueType,
1033
- spec: _,
1034
- annotations: _.annotations,
1035
- isSubsetFilter: ((h = _.annotations) == null ? void 0 : h[$]) === "true",
1036
- isDiscreteFilter: _.valueType === "String" || ((x = _.annotations) == null ? void 0 : x[te]) === "true",
1037
- axesToBeFixed: G,
1038
- axesToBeFixedIndexes: ee
1039
- };
1040
- f.set(N.toCanonicalString(), U);
1041
- }
1042
- const se = a.has(N.name) || u.has(N.toCanonicalString()), le = o.components[this.componentName].selectorStates.some(
1043
- (q) => q.selectedSource === L
1044
- );
1045
- !se && !le && A.push({ value: L });
1046
- }
1047
- }
1048
- return { multipleSelectors: w, required: v, stateConsistency: D, options: A, optionsInfo: f };
1049
- }
1050
- };
1051
- Pe.DefaultSettings = {
1052
- isDataComponent: !1,
1053
- multipleSelectors: !1,
1054
- required: !1,
1055
- homogeneous: !1,
1056
- axesAllowed: !1,
1057
- columnsAllowed: !0,
1058
- columnsWithExtraAxesAllowed: !0,
1059
- dimensionConsumer: !1
1060
- };
1061
- var I = Pe, et = {
1062
- type: "bubble",
1063
- components: {
1064
- valueSize: { type: "simple", selectorStates: [] },
1065
- valueColor: { type: "simple", selectorStates: [] },
1066
- x: { type: "simple", selectorStates: [] },
1067
- y: { type: "simple", selectorStates: [] },
1068
- filters: { type: "filter", selectorStates: [] },
1069
- tabBy: { type: "filter", selectorStates: [] },
1070
- facetBy: { type: "simple", selectorStates: [] },
1071
- tooltipContent: { type: "simple", selectorStates: [] }
1072
- },
1073
- dividedAxes: {}
1074
- };
1075
- function ce(t, e) {
1076
- if (!e.length)
1077
- return [];
1078
- const o = e.map((s) => b(s)), n = Object.values(t.columnsData)[0].length, l = [];
1079
- for (let s = 0; s < n; s++) {
1080
- const c = o.map((r) => {
1081
- const a = r.toCanonicalString();
1082
- return O(r) ? t.columnsData[a][s] : t.axesData[a][s];
1083
- }).join(", ");
1084
- l.push(c);
1085
- }
1086
- return l;
1087
- }
1088
- var tt = class extends Z {
1089
- constructor() {
1090
- super({
1091
- valueSize: new I({
1092
- componentName: "valueSize",
1093
- allowedTypes: ["Int", "Long", "Double", "Float"],
1094
- strictlyDependsOnParents: !0,
1095
- parentComponents: ["valueColor"],
1096
- settings: {
1097
- isDataComponent: !0,
1098
- columnsAllowed: !0,
1099
- axesAllowed: !1,
1100
- required: !0
1101
- }
1102
- }),
1103
- valueColor: new I({
1104
- componentName: "valueColor",
1105
- allowedTypes: ["Int", "Long", "Double", "Float"],
1106
- strictlyDependsOnParents: !0,
1107
- parentComponents: ["valueSize"],
1108
- settings: {
1109
- isDataComponent: !0,
1110
- columnsAllowed: !0,
1111
- axesAllowed: !1,
1112
- required: !0
1113
- }
1114
- }),
1115
- x: new I({
1116
- componentName: "x",
1117
- allowedTypes: ["Int", "String", "Long"],
1118
- strictlyDependsOnParents: !0,
1119
- parentComponents: ["valueSize", "valueColor"],
1120
- settings: {
1121
- required: !0,
1122
- dimensionConsumer: !0,
1123
- multipleSelectors: !0,
1124
- axesAllowed: !0,
1125
- columnsAllowed: !1
1126
- }
1127
- }),
1128
- y: new I({
1129
- componentName: "y",
1130
- allowedTypes: ["Int", "String", "Long"],
1131
- strictlyDependsOnParents: !0,
1132
- parentComponents: ["valueSize", "valueColor"],
1133
- settings: {
1134
- required: !0,
1135
- dimensionConsumer: !0,
1136
- multipleSelectors: !0,
1137
- axesAllowed: !0,
1138
- columnsAllowed: !1
1139
- }
1140
- }),
1141
- tooltipContent: new I({
1142
- componentName: "tooltipContent",
1143
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
1144
- strictlyDependsOnParents: !0,
1145
- parentComponents: ["valueSize", "valueColor"],
1146
- settings: {
1147
- columnsAllowed: !0,
1148
- axesAllowed: !0,
1149
- multipleSelectors: !0
1150
- }
1151
- }),
1152
- facetBy: new I({
1153
- componentName: "facetBy",
1154
- allowedTypes: ["String", "Int", "Long"],
1155
- strictlyDependsOnParents: !0,
1156
- parentComponents: ["valueSize", "valueColor"],
1157
- settings: {
1158
- axesAllowed: !0,
1159
- dimensionConsumer: !0,
1160
- multipleSelectors: !0
1161
- }
1162
- })
1163
- }, {
1164
- filters: new I({
1165
- componentName: "filters",
1166
- allowedTypes: ["String", "Int", "Long", "Double", "Long"],
1167
- strictlyDependsOnParents: !0,
1168
- parentComponents: ["valueSize", "valueColor"],
1169
- settings: {
1170
- columnsAllowed: !0,
1171
- axesAllowed: !0,
1172
- dimensionConsumer: !0,
1173
- multipleSelectors: !0
1174
- },
1175
- checkSourceBySpec: R
1176
- }),
1177
- tabBy: new I({
1178
- componentName: "tabBy",
1179
- allowedTypes: ["String", "Int"],
1180
- strictlyDependsOnParents: !0,
1181
- parentComponents: ["valueSize", "valueColor"],
1182
- settings: {
1183
- columnsAllowed: !0,
1184
- axesAllowed: !0,
1185
- dimensionConsumer: !0
1186
- }
1187
- })
1188
- }), this.dataInputs = ["valueSize", "valueColor"], this.dontAllowUnfilteredHighCardinality = !0;
1189
- }
1190
- async getMustBeConsumedAxes(t, e) {
1191
- if (!e.components.valueColor.selectorStates.length)
1192
- return /* @__PURE__ */ new Set();
1193
- const o = e.components.valueColor.selectorStates[0].selectedSource, n = await t.pFrameProvider.getColumnSpecById(b(o));
1194
- return n ? new Set(n.axesSpec.map((l) => F.fromAxisSpec(l).toCanonicalString())) : /* @__PURE__ */ new Set();
1195
- }
1196
- async createDataByColumns(t, e) {
1197
- var o, n, l;
1198
- const s = (o = e.components.valueColor.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.valueSize.selectorStates[0]) == null ? void 0 : n.selectedSource;
1199
- if (!s || !c)
1200
- throw Error("Value column is not valid");
1201
- const r = b(s), a = b(c);
1202
- if (!r || !a || !O(r) && !O(a))
1203
- throw Error("Value column is not valid");
1204
- const u = {
1205
- type: "columns",
1206
- id: (l = z(e.components)) != null ? l : "",
1207
- values: {}
1208
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), S = [
1209
- ...e.components.filters.selectorStates,
1210
- ...e.components.tabBy.selectorStates
1211
- ], h = Y(S), x = S.map((_) => b(_.selectedSource)).filter(O), w = [r, a].filter(O), v = w.map((_) => _.toCanonicalString()), D = await Q(t, v), B = [
1212
- e.components.facetBy,
1213
- e.components.x,
1214
- e.components.y,
1215
- e.components.tooltipContent
1216
- ], C = [], d = w.map(() => []), i = [], y = [];
1217
- for (const { selectedSource: _, fixedAxes: G } of S)
1218
- y.push(...await V(
1219
- t,
1220
- p,
1221
- m,
1222
- D,
1223
- _,
1224
- G
1225
- )), d.push(
1226
- (G ?? []).map(({ axisIdx: M, axisValue: K }) => ({ idx: M, value: K }))
1227
- );
1228
- for (const _ of B)
1229
- for (const { selectedSource: G, fixedAxes: M } of _.selectorStates) {
1230
- C.push(b(G)), i.push(
1231
- (M ?? []).map(({ axisIdx: ee, axisValue: se }) => ({ idx: ee, value: se }))
1232
- ), y.push(...await V(
1233
- t,
1234
- p,
1235
- m,
1236
- D,
1237
- G,
1238
- M
1239
- ));
1240
- const K = await k(t, G, v);
1241
- K && C.push(K);
1242
- }
1243
- const f = await t.pFrameProvider.getTableOuterJoin(
1244
- [...w, ...y, ...x],
1245
- C,
1246
- h,
1247
- !0,
1248
- d,
1249
- i
1250
- );
1251
- C.forEach((_) => {
1252
- const G = _.toCanonicalString();
1253
- u.values[G] = O(_) ? f.columnsData[G] : f.axesData[G];
1254
- }), u.values[s] = O(r) ? f.columnsData[s] : f.axesData[s], u.values[c] = O(a) ? f.columnsData[c] : f.axesData[c];
1255
- const g = e.components.x.selectorStates.map((_) => _.selectedSource), A = g.join(", "), P = await Promise.all(g.map(
1256
- async (_) => {
1257
- var G, M;
1258
- return (M = (G = await k(t, _, v)) == null ? void 0 : G.toCanonicalString()) != null ? M : _;
1259
- }
1260
- ));
1261
- u.values[A] = ce(f, g), u.values.xLabels = ce(f, P);
1262
- const E = e.components.y.selectorStates.map((_) => _.selectedSource), L = E.join(", "), N = await Promise.all(E.map(
1263
- async (_) => {
1264
- var G, M;
1265
- return (M = (G = await k(t, _, v)) == null ? void 0 : G.toCanonicalString()) != null ? M : _;
1266
- }
1267
- ));
1268
- return u.values[L] = ce(f, E), u.values.yLabels = ce(f, N), { byColumns: u };
1269
- }
1270
- async createChartSettings(t, e) {
1271
- var o, n;
1272
- const l = (o = e.components.valueColor.selectorStates[0]) == null ? void 0 : o.selectedSource, s = (n = e.components.valueSize.selectorStates[0]) == null ? void 0 : n.selectedSource;
1273
- if (!l || !s)
1274
- throw Error("Value column is not valid");
1275
- const c = b(l), r = b(s);
1276
- if (!O(c) && !O(r))
1277
- throw Error("Value column is not valid");
1278
- const a = [c, r].filter(O).map((C) => C.toCanonicalString()), u = {
1279
- type: "column",
1280
- value: l,
1281
- label: await T(t, l, [])
1282
- }, p = {
1283
- type: "column",
1284
- value: s,
1285
- label: await T(t, s, [])
1286
- }, S = e.components.x.selectorStates.map(({ selectedSource: C }) => C).join(", "), x = e.components.y.selectorStates.map(({ selectedSource: C }) => C).join(", "), w = await Promise.all(e.components.facetBy.selectorStates.map(async (C) => {
1287
- var d, i;
1288
- return {
1289
- type: "column",
1290
- value: (i = (d = await k(t, C.selectedSource, a)) == null ? void 0 : d.toCanonicalString()) != null ? i : C.selectedSource
1291
- };
1292
- })), v = (await Promise.all(e.components.x.selectorStates.map((C) => T(t, C.selectedSource, a)))).join(", "), D = (await Promise.all(e.components.y.selectorStates.map((C) => T(t, C.selectedSource, a)))).join(", "), B = await Promise.all(
1293
- e.components.tooltipContent.selectorStates.map(async (C) => {
1294
- var d, i, y, f;
1295
- const g = C.selectedSource, A = await J(t, g, a);
1296
- return {
1297
- type: "column",
1298
- label: await T(t, g, a) || g,
1299
- value: g,
1300
- valueLabels: (i = (d = await k(t, g, a)) == null ? void 0 : d.toCanonicalString()) != null ? i : g,
1301
- format: (f = (y = A == null ? void 0 : A.annotations) == null ? void 0 : y[ne]) != null ? f : ".0%"
1302
- };
1303
- })
1304
- );
1305
- return {
1306
- type: "bubble",
1307
- valueColor: u,
1308
- valueSize: p,
1309
- xColumn: {
1310
- type: "column",
1311
- value: S,
1312
- label: v,
1313
- valueLabels: "xLabels"
1314
- },
1315
- yColumn: {
1316
- type: "column",
1317
- value: x,
1318
- label: D,
1319
- valueLabels: "yLabels"
1320
- },
1321
- facetBy: w,
1322
- tooltips: {
1323
- show: !0,
1324
- content: B
1325
- }
1326
- };
1327
- }
1328
- }, nt = {
1329
- type: "histogram",
1330
- components: {
1331
- value: { type: "simple", selectorStates: [] },
1332
- grouping: { type: "simple", selectorStates: [] },
1333
- filters: { type: "filter", selectorStates: [] },
1334
- tabBy: { type: "filter", selectorStates: [] },
1335
- facetBy: { type: "simple", selectorStates: [] }
1336
- },
1337
- dividedAxes: {}
1338
- }, ot = class extends Z {
1339
- constructor() {
1340
- super(
1341
- {
1342
- value: new I({
1343
- componentName: "value",
1344
- allowedTypes: ["Int", "Long", "Double", "Float"],
1345
- settings: {
1346
- isDataComponent: !0,
1347
- columnsAllowed: !0,
1348
- axesAllowed: !1,
1349
- required: !0
1350
- }
1351
- }),
1352
- grouping: new I({
1353
- componentName: "grouping",
1354
- allowedTypes: ["String", "Int", "Long"],
1355
- parentComponents: ["value"],
1356
- dependsOn: ["value"],
1357
- settings: {
1358
- axesAllowed: !0,
1359
- multipleSelectors: !1
1360
- }
1361
- }),
1362
- facetBy: new I({
1363
- componentName: "facetBy",
1364
- allowedTypes: ["String", "Int", "Long"],
1365
- parentComponents: ["value"],
1366
- dependsOn: ["value"],
1367
- settings: {
1368
- axesAllowed: !0,
1369
- dimensionConsumer: !0,
1370
- multipleSelectors: !0
1371
- }
1372
- })
1373
- },
1374
- {
1375
- filters: new I({
1376
- componentName: "filters",
1377
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
1378
- parentComponents: ["value"],
1379
- dependsOn: ["value"],
1380
- settings: {
1381
- columnsAllowed: !0,
1382
- axesAllowed: !0,
1383
- dimensionConsumer: !0,
1384
- multipleSelectors: !0
1385
- },
1386
- checkSourceBySpec: R
1387
- }),
1388
- tabBy: new I({
1389
- componentName: "tabBy",
1390
- allowedTypes: ["String", "Int"],
1391
- parentComponents: ["value"],
1392
- dependsOn: ["value"],
1393
- settings: {
1394
- columnsAllowed: !0,
1395
- axesAllowed: !0,
1396
- dimensionConsumer: !0
1397
- }
1398
- })
1399
- }
1400
- ), this.dataInputs = ["value"];
1401
- }
1402
- async createDataByColumns(t, e) {
1403
- var o, n;
1404
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1405
- if (!l)
1406
- throw Error("Value column is not valid");
1407
- const s = b(l);
1408
- if (!O(s))
1409
- throw Error("Value column is not valid");
1410
- const c = {
1411
- type: "columns",
1412
- id: (n = z(e.components)) != null ? n : "",
1413
- values: {}
1414
- }, { linkerColumnsMap: r, compositeLinkerMap: a } = await X(t), u = [
1415
- ...e.components.filters.selectorStates,
1416
- ...e.components.tabBy.selectorStates
1417
- ], p = Y(u), m = u.map((d) => b(d.selectedSource)).filter(O), S = [l], h = await Q(t, S), x = [e.components.facetBy, e.components.grouping], w = [], v = [[]], D = [], B = [];
1418
- for (const { selectedSource: d, fixedAxes: i } of u)
1419
- B.push(
1420
- ...await V(t, r, a, h, d, i)
1421
- ), v.push(
1422
- (i ?? []).map(({ axisIdx: y, axisValue: f }) => ({ idx: y, value: f }))
1423
- );
1424
- for (const d of x)
1425
- for (const { selectedSource: i, fixedAxes: y } of d.selectorStates) {
1426
- w.push(b(i)), D.push(
1427
- (y ?? []).map(({ axisIdx: g, axisValue: A }) => ({ idx: g, value: A }))
1428
- ), B.push(
1429
- ...await V(t, r, a, h, i, y)
1430
- );
1431
- const f = await k(t, i, S);
1432
- f && w.push(f);
1433
- }
1434
- const C = await t.pFrameProvider.getTableOuterJoin(
1435
- [s, ...B, ...m],
1436
- w,
1437
- p,
1438
- !0,
1439
- v,
1440
- D
1441
- );
1442
- return w.forEach((d) => {
1443
- const i = d.toCanonicalString();
1444
- c.values[i] = O(d) ? C.columnsData[i] : C.axesData[i];
1445
- }), c.values[s.toCanonicalString()] = C.columnsData[s.toCanonicalString()], { byColumns: c };
1446
- }
1447
- async createChartSettings(t, e) {
1448
- var o, n;
1449
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1450
- if (!l)
1451
- throw Error("Value column is not valid");
1452
- const s = b(l);
1453
- if (!O(s))
1454
- throw Error("Value column is not valid");
1455
- const c = [l], r = {
1456
- type: "column",
1457
- value: l,
1458
- label: await T(t, l, [])
1459
- }, a = await Promise.all(
1460
- e.components.facetBy.selectorStates.map(async (p) => {
1461
- var m, S;
1462
- return {
1463
- type: "column",
1464
- value: (S = (m = await k(t, p.selectedSource, c)) == null ? void 0 : m.toCanonicalString()) != null ? S : p.selectedSource
1465
- };
1466
- })
1467
- );
1468
- let u;
1469
- if (e.components.grouping.selectorStates.length) {
1470
- const { selectedSource: p } = e.components.grouping.selectorStates[0];
1471
- u = {
1472
- type: "column",
1473
- value: p,
1474
- label: await T(t, p, c),
1475
- valueLabels: (n = await k(t, p, c)) == null ? void 0 : n.toCanonicalString()
1476
- };
1477
- }
1478
- return {
1479
- type: "histogram",
1480
- valueColumn: r,
1481
- facetBy: a,
1482
- grouping: u
1483
- };
1484
- }
1485
- }, st = {
1486
- type: "discrete",
1487
- components: {
1488
- y: { type: "simple", selectorStates: [] },
1489
- filters: { type: "filter", selectorStates: [] },
1490
- tabBy: { type: "filter", selectorStates: [] },
1491
- facetBy: { type: "simple", selectorStates: [] },
1492
- primaryGrouping: { type: "simple", selectorStates: [] },
1493
- secondaryGrouping: { type: "simple", selectorStates: [] }
1494
- },
1495
- dividedAxes: {}
1496
- }, lt = class extends Z {
1497
- constructor() {
1498
- super(
1499
- {
1500
- y: new I({
1501
- componentName: "y",
1502
- allowedTypes: ["Int", "Double", "Long", "Float"],
1503
- settings: { isDataComponent: !0 }
1504
- }),
1505
- primaryGrouping: new I({
1506
- componentName: "primaryGrouping",
1507
- allowedTypes: ["String", "Int", "Long"],
1508
- strictlyDependsOnParents: !0,
1509
- parentComponents: ["y"],
1510
- dependsOn: ["y"],
1511
- settings: {
1512
- axesAllowed: !0,
1513
- homogeneous: !0
1514
- }
1515
- }),
1516
- secondaryGrouping: new I({
1517
- componentName: "secondaryGrouping",
1518
- allowedTypes: ["String", "Int", "Long"],
1519
- strictlyDependsOnParents: !0,
1520
- parentComponents: ["y"],
1521
- dependsOn: ["primaryGrouping"],
1522
- settings: {
1523
- axesAllowed: !0,
1524
- homogeneous: !0
1525
- }
1526
- }),
1527
- facetBy: new I({
1528
- componentName: "facetBy",
1529
- allowedTypes: ["String", "Int", "Long"],
1530
- strictlyDependsOnParents: !0,
1531
- parentComponents: ["y"],
1532
- dependsOn: ["y"],
1533
- settings: {
1534
- axesAllowed: !0,
1535
- dimensionConsumer: !0,
1536
- multipleSelectors: !0
1537
- }
1538
- })
1539
- },
1540
- {
1541
- filters: new I({
1542
- componentName: "filters",
1543
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
1544
- strictlyDependsOnParents: !0,
1545
- parentComponents: ["y"],
1546
- dependsOn: ["y"],
1547
- settings: {
1548
- axesAllowed: !0,
1549
- dimensionConsumer: !0,
1550
- multipleSelectors: !0
1551
- },
1552
- checkSourceBySpec: R
1553
- }),
1554
- tabBy: new I({
1555
- componentName: "tabBy",
1556
- allowedTypes: ["String", "Int"],
1557
- strictlyDependsOnParents: !0,
1558
- parentComponents: ["y"],
1559
- dependsOn: ["y"],
1560
- settings: {
1561
- axesAllowed: !0,
1562
- dimensionConsumer: !0
1563
- }
1564
- })
1565
- }
1566
- ), this.dataInputs = ["y"], this.dontAllowUnfilteredHighCardinality = !0;
1567
- }
1568
- async createDataByColumns(t, e) {
1569
- var o;
1570
- const n = e.components.y.selectorStates[0].selectedSource, l = b(n);
1571
- if (!n || !O(l))
1572
- throw Error("Y column is not valid");
1573
- const s = {
1574
- type: "columns",
1575
- id: (o = z(e.components)) != null ? o : "",
1576
- values: {}
1577
- }, { linkerColumnsMap: c, compositeLinkerMap: r } = await X(t), a = [
1578
- ...e.components.filters.selectorStates,
1579
- ...e.components.tabBy.selectorStates
1580
- ], u = Y(a), p = a.map((C) => b(C.selectedSource)).filter(O), m = [n], S = await Q(t, m), h = [e.components.primaryGrouping, e.components.secondaryGrouping, e.components.facetBy], x = [], w = [[]], v = [], D = [];
1581
- for (const { selectedSource: C, fixedAxes: d } of a)
1582
- D.push(...await V(
1583
- t,
1584
- c,
1585
- r,
1586
- S,
1587
- C,
1588
- d
1589
- )), w.push(
1590
- (d ?? []).map(({ axisIdx: i, axisValue: y }) => ({ idx: i, value: y }))
1591
- );
1592
- for (const C of h)
1593
- for (const { selectedSource: d, fixedAxes: i } of C.selectorStates) {
1594
- x.push(b(d)), v.push(
1595
- (i ?? []).map(({ axisIdx: f, axisValue: g }) => ({ idx: f, value: g }))
1596
- ), D.push(...await V(
1597
- t,
1598
- c,
1599
- r,
1600
- S,
1601
- d,
1602
- i
1603
- ));
1604
- const y = await k(t, d, m);
1605
- y && x.push(y);
1606
- }
1607
- const B = await t.pFrameProvider.getTableOuterJoin(
1608
- [l, ...D, ...p],
1609
- x,
1610
- u,
1611
- !0,
1612
- w,
1613
- v
1614
- );
1615
- return x.forEach((C) => {
1616
- const d = C.toCanonicalString();
1617
- s.values[d] = O(C) ? B.columnsData[d] : B.axesData[d];
1618
- }), s.values[l.toCanonicalString()] = B.columnsData[l.toCanonicalString()], { byColumns: s };
1619
- }
1620
- async createChartSettings(t, e) {
1621
- var o, n;
1622
- const l = e.components.y.selectorStates[0].selectedSource, s = b(l);
1623
- if (!l || !O(s))
1624
- throw Error("Y column is not valid");
1625
- const c = {
1626
- type: "column",
1627
- value: l,
1628
- label: await T(t, l, [])
1629
- }, r = [l];
1630
- let a;
1631
- if (e.components.primaryGrouping.selectorStates.length) {
1632
- const { selectedSource: m } = e.components.primaryGrouping.selectorStates[0];
1633
- a = {
1634
- columnName: {
1635
- type: "column",
1636
- value: m,
1637
- label: await T(t, m, r),
1638
- valueLabels: (o = await k(
1639
- t,
1640
- m,
1641
- r
1642
- )) == null ? void 0 : o.toCanonicalString()
1643
- }
1644
- };
1645
- }
1646
- let u;
1647
- if (e.components.secondaryGrouping.selectorStates.length) {
1648
- const { selectedSource: m } = e.components.secondaryGrouping.selectorStates[0];
1649
- u = {
1650
- columnName: {
1651
- type: "column",
1652
- value: m,
1653
- label: await T(t, m, r),
1654
- valueLabels: (n = await k(
1655
- t,
1656
- m,
1657
- r
1658
- )) == null ? void 0 : n.toCanonicalString()
1659
- }
1660
- };
1661
- }
1662
- const p = await Promise.all(e.components.facetBy.selectorStates.map(async (m) => {
1663
- var S, h;
1664
- return {
1665
- type: "column",
1666
- value: (h = (S = await k(t, m.selectedSource, r)) == null ? void 0 : S.toCanonicalString()) != null ? h : m.selectedSource,
1667
- label: await T(t, m.selectedSource, r)
1668
- };
1669
- }));
1670
- return {
1671
- type: "discrete",
1672
- y: c,
1673
- primaryGrouping: a,
1674
- secondaryGrouping: u,
1675
- facetBy: p
1676
- };
1677
- }
1678
- }, at = {
1679
- type: "heatmap",
1680
- components: {
1681
- value: { type: "simple", selectorStates: [] },
1682
- x: { type: "simple", selectorStates: [] },
1683
- y: { type: "simple", selectorStates: [] },
1684
- xGroupBy: { type: "simple", selectorStates: [] },
1685
- yGroupBy: { type: "simple", selectorStates: [] },
1686
- filters: { type: "filter", selectorStates: [] },
1687
- tabBy: { type: "filter", selectorStates: [] },
1688
- facetBy: { type: "simple", selectorStates: [] },
1689
- annotationsX: { type: "simple", selectorStates: [] },
1690
- annotationsY: { type: "simple", selectorStates: [] },
1691
- tooltipContent: { type: "simple", selectorStates: [] }
1692
- },
1693
- dividedAxes: {}
1694
- };
1695
- function de(t) {
1696
- return t ? "kind" in t && t.kind === "PColumn" ? t.valueType === "String" : t.type === "String" : !0;
1697
- }
1698
- function ie(t, e) {
1699
- if (!e.length)
1700
- return [];
1701
- const o = e.map((s) => b(s)), n = Object.values(t.columnsData)[0].length, l = [];
1702
- for (let s = 0; s < n; s++) {
1703
- const c = o.map((r) => {
1704
- const a = r.toCanonicalString();
1705
- return O(r) ? t.columnsData[a][s] : t.axesData[a][s];
1706
- }).join(", ");
1707
- l.push(c);
1708
- }
1709
- return l;
1710
- }
1711
- var rt = class extends Z {
1712
- constructor() {
1713
- super(
1714
- {
1715
- value: new I({
1716
- componentName: "value",
1717
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1718
- settings: {
1719
- isDataComponent: !0,
1720
- columnsAllowed: !0,
1721
- axesAllowed: !1,
1722
- required: !0
1723
- }
1724
- }),
1725
- x: new I({
1726
- componentName: "x",
1727
- allowedTypes: ["Int", "String", "Long"],
1728
- strictlyDependsOnParents: !0,
1729
- parentComponents: ["value"],
1730
- settings: {
1731
- required: !0,
1732
- dimensionConsumer: !0,
1733
- multipleSelectors: !0,
1734
- axesAllowed: !0,
1735
- columnsAllowed: !1
1736
- }
1737
- }),
1738
- xGroupBy: new I({
1739
- componentName: "xGroupBy",
1740
- allowedTypes: ["Int", "String", "Long"],
1741
- strictlyDependsOnParents: !0,
1742
- parentComponents: ["value"],
1743
- settings: {
1744
- dimensionConsumer: !0,
1745
- multipleSelectors: !0,
1746
- axesAllowed: !0,
1747
- columnsAllowed: !0
1748
- },
1749
- dependsOn: ["x"],
1750
- checkSourceBySpec: (t, e) => {
1751
- const o = /* @__PURE__ */ new Set([
1752
- ...e.components.x.selectorStates.map((n) => n.selectedSource),
1753
- ...e.components.xGroupBy.selectorStates.map((n) => n.selectedSource)
1754
- ]);
1755
- return "kind" in t && t.kind === "PColumn" ? F.fromAxesSpec(t.axesSpec).every(
1756
- (n) => o.has(n.toCanonicalString())
1757
- ) : !0;
1758
- }
1759
- }),
1760
- y: new I({
1761
- componentName: "y",
1762
- allowedTypes: ["Int", "String", "Long"],
1763
- strictlyDependsOnParents: !0,
1764
- parentComponents: ["value"],
1765
- settings: {
1766
- required: !0,
1767
- dimensionConsumer: !0,
1768
- multipleSelectors: !0,
1769
- axesAllowed: !0,
1770
- columnsAllowed: !0
1771
- }
1772
- }),
1773
- yGroupBy: new I({
1774
- componentName: "yGroupBy",
1775
- allowedTypes: ["Int", "String", "Long"],
1776
- strictlyDependsOnParents: !0,
1777
- parentComponents: ["value"],
1778
- settings: {
1779
- dimensionConsumer: !0,
1780
- multipleSelectors: !0,
1781
- axesAllowed: !0,
1782
- columnsAllowed: !0
1783
- },
1784
- dependsOn: ["y"],
1785
- checkSourceBySpec: (t, e) => {
1786
- const o = /* @__PURE__ */ new Set([
1787
- ...e.components.y.selectorStates.map((n) => n.selectedSource),
1788
- ...e.components.yGroupBy.selectorStates.map((n) => n.selectedSource)
1789
- ]);
1790
- return "kind" in t && t.kind === "PColumn" ? F.fromAxesSpec(t.axesSpec).every(
1791
- (n) => o.has(n.toCanonicalString())
1792
- ) : !0;
1793
- }
1794
- }),
1795
- tooltipContent: new I({
1796
- componentName: "tooltipContent",
1797
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
1798
- strictlyDependsOnParents: !0,
1799
- parentComponents: ["value"],
1800
- dependsOn: ["value"],
1801
- settings: {
1802
- columnsAllowed: !0,
1803
- axesAllowed: !0,
1804
- multipleSelectors: !0
1805
- }
1806
- }),
1807
- facetBy: new I({
1808
- componentName: "facetBy",
1809
- allowedTypes: ["String", "Int", "Long"],
1810
- strictlyDependsOnParents: !0,
1811
- parentComponents: ["value"],
1812
- dependsOn: ["value"],
1813
- settings: {
1814
- axesAllowed: !0,
1815
- dimensionConsumer: !0,
1816
- multipleSelectors: !0
1817
- }
1818
- }),
1819
- annotationsX: new I({
1820
- componentName: "annotationsX",
1821
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1822
- parentComponents: ["value"],
1823
- settings: {
1824
- axesAllowed: !0,
1825
- multipleSelectors: !0
1826
- },
1827
- dependsOn: ["x"],
1828
- checkSourceBySpec: (t, e) => {
1829
- const o = /* @__PURE__ */ new Set([
1830
- ...e.components.x.selectorStates.map((n) => n.selectedSource),
1831
- ...e.components.xGroupBy.selectorStates.map((n) => n.selectedSource)
1832
- ]);
1833
- return "kind" in t && t.kind === "PColumn" ? F.fromAxesSpec(t.axesSpec).every(
1834
- (n) => o.has(n.toCanonicalString())
1835
- ) : o.has(F.fromAxisSpec(t).toCanonicalString());
1836
- }
1837
- }),
1838
- annotationsY: new I({
1839
- componentName: "annotationsY",
1840
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1841
- parentComponents: ["value"],
1842
- settings: {
1843
- axesAllowed: !0,
1844
- multipleSelectors: !0
1845
- },
1846
- dependsOn: ["y"],
1847
- checkSourceBySpec: (t, e) => {
1848
- const o = /* @__PURE__ */ new Set([
1849
- ...e.components.y.selectorStates.map((n) => n.selectedSource),
1850
- ...e.components.yGroupBy.selectorStates.map((n) => n.selectedSource)
1851
- ]);
1852
- return "kind" in t && t.kind === "PColumn" ? F.fromAxesSpec(t.axesSpec).every(
1853
- (n) => o.has(n.toCanonicalString())
1854
- ) : o.has(F.fromAxisSpec(t).toCanonicalString());
1855
- }
1856
- })
1857
- },
1858
- {
1859
- filters: new I({
1860
- componentName: "filters",
1861
- allowedTypes: ["String", "Int", "Long", "Double", "Long"],
1862
- strictlyDependsOnParents: !0,
1863
- parentComponents: ["value"],
1864
- dependsOn: ["value"],
1865
- settings: {
1866
- columnsAllowed: !0,
1867
- axesAllowed: !0,
1868
- dimensionConsumer: !0,
1869
- multipleSelectors: !0
1870
- },
1871
- checkSourceBySpec: R
1872
- }),
1873
- tabBy: new I({
1874
- componentName: "tabBy",
1875
- allowedTypes: ["String", "Int"],
1876
- strictlyDependsOnParents: !0,
1877
- parentComponents: ["value"],
1878
- dependsOn: ["value"],
1879
- settings: {
1880
- columnsAllowed: !0,
1881
- axesAllowed: !0,
1882
- dimensionConsumer: !0
1883
- }
1884
- })
1885
- }
1886
- ), this.dataInputs = ["value"], this.dontAllowUnfilteredHighCardinality = !0;
1887
- }
1888
- async getMustBeConsumedAxes(t, e) {
1889
- if (!e.components.value.selectorStates.length)
1890
- return /* @__PURE__ */ new Set();
1891
- const o = e.components.value.selectorStates[0].selectedSource, n = await t.pFrameProvider.getColumnSpecById(b(o));
1892
- return n ? new Set(n.axesSpec.map((l) => F.fromAxisSpec(l).toCanonicalString())) : /* @__PURE__ */ new Set();
1893
- }
1894
- async createDataByColumns(t, e) {
1895
- var o, n;
1896
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1897
- if (!l)
1898
- throw Error("Value column is not valid");
1899
- const s = b(l);
1900
- if (!O(s))
1901
- throw Error("Value column is not valid");
1902
- const c = {
1903
- type: "columns",
1904
- id: (n = z(e.components)) != null ? n : "",
1905
- values: {}
1906
- }, { linkerColumnsMap: r, compositeLinkerMap: a } = await X(t), u = [
1907
- ...e.components.filters.selectorStates,
1908
- ...e.components.tabBy.selectorStates
1909
- ], p = Y(u), m = u.map((L) => b(L.selectedSource)).filter(O), S = [l], h = await Q(t, S), x = [
1910
- e.components.facetBy,
1911
- e.components.annotationsX,
1912
- e.components.annotationsY,
1913
- e.components.x,
1914
- e.components.y,
1915
- e.components.xGroupBy,
1916
- e.components.yGroupBy,
1917
- e.components.tooltipContent
1918
- ], w = [], v = [[]], D = [], B = [];
1919
- for (const { selectedSource: L, fixedAxes: N } of u)
1920
- B.push(...await V(
1921
- t,
1922
- r,
1923
- a,
1924
- h,
1925
- L,
1926
- N
1927
- )), v.push(
1928
- (N ?? []).map(({ axisIdx: _, axisValue: G }) => ({ idx: _, value: G }))
1929
- );
1930
- for (const L of x)
1931
- for (const { selectedSource: N, fixedAxes: _ } of L.selectorStates) {
1932
- w.push(b(N)), D.push(
1933
- (_ ?? []).map(({ axisIdx: M, axisValue: K }) => ({ idx: M, value: K }))
1934
- ), B.push(...await V(
1935
- t,
1936
- r,
1937
- a,
1938
- h,
1939
- N,
1940
- _
1941
- ));
1942
- const G = await k(t, N, S);
1943
- G && w.push(G);
1944
- }
1945
- const C = await t.pFrameProvider.getTableOuterJoin(
1946
- [s, ...B, ...m],
1947
- w,
1948
- p,
1949
- !0,
1950
- v,
1951
- D
1952
- );
1953
- w.forEach((L) => {
1954
- const N = L.toCanonicalString();
1955
- c.values[N] = O(L) ? C.columnsData[N] : C.axesData[N];
1956
- }), c.values[s.toCanonicalString()] = C.columnsData[s.toCanonicalString()];
1957
- const d = e.components.x.selectorStates.concat(e.components.xGroupBy.selectorStates).map((L) => L.selectedSource), i = d.join(", ");
1958
- c.values[i] = ie(C, d);
1959
- const y = e.components.x.selectorStates.map((L) => L.selectedSource), f = await Promise.all(
1960
- y.map(
1961
- async (L) => {
1962
- var N, _;
1963
- return (_ = (N = await k(t, L, S)) == null ? void 0 : N.toCanonicalString()) != null ? _ : L;
1964
- }
1965
- )
1966
- );
1967
- c.values.xLabelsKey = ie(C, f);
1968
- const g = e.components.y.selectorStates.concat(e.components.yGroupBy.selectorStates).map((L) => L.selectedSource), A = g.join(", ");
1969
- c.values[A] = ie(C, g);
1970
- const P = e.components.y.selectorStates.map((L) => L.selectedSource), E = await Promise.all(
1971
- P.map(
1972
- async (L) => {
1973
- var N, _;
1974
- return (_ = (N = await k(t, L, S)) == null ? void 0 : N.toCanonicalString()) != null ? _ : L;
1975
- }
1976
- )
1977
- );
1978
- return c.values.yLabelsKey = ie(C, E), { byColumns: c };
1979
- }
1980
- async createChartSettings(t, e) {
1981
- var o;
1982
- const n = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1983
- if (!n)
1984
- throw Error("Value column is not valid");
1985
- const l = b(n);
1986
- if (!O(l))
1987
- throw Error("Value column is not valid");
1988
- const s = [n], c = {
1989
- type: "column",
1990
- value: n,
1991
- label: await T(t, n, [])
1992
- }, a = e.components.x.selectorStates.concat(e.components.xGroupBy.selectorStates).map(({ selectedSource: d }) => b(d)).map((d) => d.toCanonicalString()).join(", "), p = e.components.y.selectorStates.concat(e.components.yGroupBy.selectorStates).map(({ selectedSource: d }) => b(d)).map((d) => d.toCanonicalString()).join(", "), m = await Promise.all(
1993
- e.components.facetBy.selectorStates.map(async (d) => {
1994
- var i, y;
1995
- return {
1996
- type: "column",
1997
- value: (y = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? y : d.selectedSource
1998
- };
1999
- })
2000
- ), S = await Promise.all(
2001
- e.components.xGroupBy.selectorStates.map(async (d) => {
2002
- var i, y;
2003
- return {
2004
- type: "column",
2005
- label: await T(t, d.selectedSource, s),
2006
- value: d.selectedSource,
2007
- valueLabels: (y = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? y : d.selectedSource
2008
- };
2009
- })
2010
- ), h = await Promise.all(
2011
- e.components.yGroupBy.selectorStates.map(async (d) => {
2012
- var i, y;
2013
- return {
2014
- type: "column",
2015
- label: await T(t, d.selectedSource, s),
2016
- value: d.selectedSource,
2017
- valueLabels: (y = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? y : d.selectedSource
2018
- };
2019
- })
2020
- ), x = await t.pFrameProvider.getColumnSpecById(l), w = await Promise.all(
2021
- e.components.annotationsX.selectorStates.map(async (d) => {
2022
- var i, y;
2023
- const f = d.selectedSource, g = b(f), A = O(g) ? await t.pFrameProvider.getColumnSpecById(g) : (y = (i = x == null ? void 0 : x.axesSpec) == null ? void 0 : i.find(
2024
- (P) => F.fromAxisSpec(P).toCanonicalString() === f
2025
- )) != null ? y : null;
2026
- return {
2027
- axis: "x",
2028
- valueColumn: {
2029
- type: "column",
2030
- value: f,
2031
- label: await T(t, f, s)
2032
- },
2033
- type: de(A) ? "discrete" : "continuous"
2034
- };
2035
- })
2036
- ), v = await Promise.all(
2037
- e.components.annotationsY.selectorStates.map(async (d) => {
2038
- var i, y;
2039
- const f = d.selectedSource, g = b(f), A = O(g) ? await t.pFrameProvider.getColumnSpecById(g) : (y = (i = x == null ? void 0 : x.axesSpec) == null ? void 0 : i.find(
2040
- (P) => F.fromAxisSpec(P).toCanonicalString() === f
2041
- )) != null ? y : null;
2042
- return {
2043
- axis: "y",
2044
- valueColumn: {
2045
- type: "column",
2046
- value: f,
2047
- label: await T(t, f, s)
2048
- },
2049
- type: de(A) ? "discrete" : "continuous"
2050
- };
2051
- })
2052
- ), D = (await Promise.all(
2053
- e.components.x.selectorStates.map(
2054
- (d) => T(t, d.selectedSource, s)
2055
- )
2056
- )).join(", "), B = (await Promise.all(
2057
- e.components.y.selectorStates.map(
2058
- (d) => T(t, d.selectedSource, s)
2059
- )
2060
- )).join(", "), C = await Promise.all(
2061
- e.components.tooltipContent.selectorStates.map(async (d) => {
2062
- var i, y, f, g;
2063
- const A = d.selectedSource, P = await J(t, A, s);
2064
- return {
2065
- type: "column",
2066
- label: await T(t, A, s) || A,
2067
- value: A,
2068
- valueLabels: (y = (i = await k(t, A, s)) == null ? void 0 : i.toCanonicalString()) != null ? y : A,
2069
- format: (g = (f = P == null ? void 0 : P.annotations) == null ? void 0 : f[ne]) != null ? g : ".0%"
2070
- };
2071
- })
2072
- );
2073
- return {
2074
- type: "heatmap",
2075
- valueColumn: c,
2076
- valueType: de(x) ? "discrete" : "continuous",
2077
- xColumn: {
2078
- type: "column",
2079
- value: a,
2080
- label: D,
2081
- valueLabels: "xLabelsKey"
2082
- },
2083
- yColumn: {
2084
- type: "column",
2085
- value: p,
2086
- label: B,
2087
- valueLabels: "yLabelsKey"
2088
- },
2089
- facetBy: m,
2090
- xGroupBy: S,
2091
- yGroupBy: h,
2092
- annotations: [...w, ...v],
2093
- tooltips: {
2094
- show: !0,
2095
- content: C
2096
- }
2097
- };
2098
- }
2099
- }, ct = {
2100
- type: "scatterplot",
2101
- components: {
2102
- x: { type: "simple", selectorStates: [] },
2103
- y: { type: "simple", selectorStates: [] },
2104
- filters: { type: "filter", selectorStates: [] },
2105
- highlight: { type: "filter", selectorStates: [] },
2106
- tabBy: { type: "filter", selectorStates: [] },
2107
- facetBy: { type: "simple", selectorStates: [] },
2108
- grouping: { type: "simple", selectorStates: [] },
2109
- shape: { type: "simple", selectorStates: [] },
2110
- size: { type: "simple", selectorStates: [] },
2111
- label: { type: "simple", selectorStates: [] },
2112
- tooltipContent: { type: "simple", selectorStates: [] }
2113
- },
2114
- dividedAxes: {}
2115
- }, it = class extends Z {
2116
- constructor() {
2117
- super(
2118
- {
2119
- x: new I({
2120
- componentName: "x",
2121
- allowedTypes: ["Int", "Long", "Double", "Float"],
2122
- parentComponents: ["y"],
2123
- strictlyDependsOnParents: !1,
2124
- settings: {
2125
- isDataComponent: !0,
2126
- required: !0,
2127
- axesAllowed: !0,
2128
- columnsAllowed: !0
2129
- }
2130
- }),
2131
- y: new I({
2132
- componentName: "y",
2133
- allowedTypes: ["Int", "Long", "Double", "Float"],
2134
- parentComponents: ["x"],
2135
- strictlyDependsOnParents: !1,
2136
- settings: {
2137
- isDataComponent: !0,
2138
- required: !0,
2139
- axesAllowed: !0,
2140
- columnsAllowed: !0
2141
- }
2142
- }),
2143
- facetBy: new I({
2144
- componentName: "facetBy",
2145
- allowedTypes: ["String", "Int", "Long"],
2146
- strictlyDependsOnParents: !0,
2147
- parentComponents: ["x", "y"],
2148
- dependsOn: ["x", "y"],
2149
- settings: {
2150
- axesAllowed: !0,
2151
- dimensionConsumer: !0,
2152
- multipleSelectors: !0
2153
- }
2154
- }),
2155
- grouping: new I({
2156
- componentName: "grouping",
2157
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2158
- strictlyDependsOnParents: !0,
2159
- parentComponents: ["x", "y"],
2160
- dependsOn: ["x", "y"],
2161
- settings: {
2162
- axesAllowed: !0,
2163
- multipleSelectors: !0
2164
- }
2165
- }),
2166
- shape: new I({
2167
- componentName: "shape",
2168
- allowedTypes: ["String", "Int", "Long"],
2169
- strictlyDependsOnParents: !0,
2170
- parentComponents: ["x", "y"],
2171
- dependsOn: ["x", "y"],
2172
- settings: {
2173
- axesAllowed: !0
2174
- }
2175
- }),
2176
- size: new I({
2177
- componentName: "size",
2178
- allowedTypes: ["Int", "Long", "Double", "Float"],
2179
- strictlyDependsOnParents: !0,
2180
- parentComponents: ["x", "y"],
2181
- dependsOn: ["x", "y"],
2182
- settings: {
2183
- axesAllowed: !0
2184
- }
2185
- }),
2186
- tooltipContent: new I({
2187
- componentName: "tooltipContent",
2188
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2189
- strictlyDependsOnParents: !0,
2190
- parentComponents: ["x", "y"],
2191
- dependsOn: ["x", "y"],
2192
- settings: {
2193
- columnsAllowed: !0,
2194
- axesAllowed: !0,
2195
- multipleSelectors: !0
2196
- }
2197
- }),
2198
- label: new I({
2199
- componentName: "label",
2200
- allowedTypes: ["String", "Int", "Long"],
2201
- strictlyDependsOnParents: !0,
2202
- parentComponents: ["x", "y"],
2203
- dependsOn: ["x", "y"],
2204
- settings: {
2205
- axesAllowed: !0,
2206
- columnsAllowed: !0,
2207
- multipleSelectors: !1
2208
- }
2209
- })
2210
- },
2211
- {
2212
- filters: new I({
2213
- componentName: "filters",
2214
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2215
- strictlyDependsOnParents: !0,
2216
- parentComponents: ["x", "y"],
2217
- dependsOn: ["x", "y"],
2218
- settings: {
2219
- axesAllowed: !0,
2220
- columnsAllowed: !0,
2221
- dimensionConsumer: !0,
2222
- multipleSelectors: !0
2223
- },
2224
- checkSourceBySpec: R
2225
- }),
2226
- tabBy: new I({
2227
- componentName: "tabBy",
2228
- allowedTypes: ["String", "Int"],
2229
- strictlyDependsOnParents: !0,
2230
- parentComponents: ["x", "y"],
2231
- dependsOn: ["x", "y"],
2232
- settings: {
2233
- axesAllowed: !0,
2234
- dimensionConsumer: !0
2235
- }
2236
- }),
2237
- highlight: new I({
2238
- componentName: "highlight",
2239
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2240
- strictlyDependsOnParents: !0,
2241
- parentComponents: ["x", "y"],
2242
- dependsOn: ["x", "y"],
2243
- settings: {
2244
- axesAllowed: !0,
2245
- columnsAllowed: !0,
2246
- multipleSelectors: !0
2247
- },
2248
- checkSourceBySpec: R
2249
- })
2250
- }
2251
- ), this.dataInputs = ["x", "y"];
2252
- }
2253
- async getMustBeConsumedAxes(t, e) {
2254
- if (!e.components.x.selectorStates.length || !e.components.y.selectorStates.length)
2255
- return /* @__PURE__ */ new Set();
2256
- const o = e.components.x.selectorStates[0].selectedSource, n = e.components.y.selectorStates[0].selectedSource, l = await t.pFrameProvider.getColumnSpecById(b(o)), s = await t.pFrameProvider.getColumnSpecById(b(n));
2257
- if (!l || !s)
2258
- return /* @__PURE__ */ new Set();
2259
- const c = l.axesSpec.map((p) => F.fromAxisSpec(p).toCanonicalString()), r = s.axesSpec.map((p) => F.fromAxisSpec(p).toCanonicalString()), a = c.filter((p) => !r.some((m) => m === p)), u = r.filter((p) => !c.some((m) => m === p));
2260
- return /* @__PURE__ */ new Set([...a, ...u]);
2261
- }
2262
- async createDataByColumns(t, e) {
2263
- var o, n, l;
2264
- const s = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource;
2265
- if (!s || !c)
2266
- throw Error("X or Y column is not valid");
2267
- const r = b(s), a = b(c), u = {
2268
- type: "columns",
2269
- id: (l = z(e.components)) != null ? l : "",
2270
- values: {}
2271
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), S = [
2272
- ...e.components.filters.selectorStates,
2273
- ...e.components.tabBy.selectorStates
2274
- ], h = Y(S), x = S.map((g) => b(g.selectedSource)).filter(O), w = [r, a].filter(O).map((g) => g.toCanonicalString());
2275
- if (w.length === 0)
2276
- throw Error("One of X and Y should be a column");
2277
- const v = await Q(t, w), D = [r, a, ...x], B = [], C = [[], []], d = [], i = [];
2278
- for (const { selectedSource: g, fixedAxes: A } of S)
2279
- i.push(...await V(
2280
- t,
2281
- p,
2282
- m,
2283
- v,
2284
- g,
2285
- A
2286
- )), C.push(
2287
- (A ?? []).map(({ axisIdx: P, axisValue: E }) => ({ idx: P, value: E }))
2288
- );
2289
- const y = [
2290
- e.components.grouping,
2291
- e.components.size,
2292
- e.components.shape,
2293
- e.components.tooltipContent,
2294
- e.components.facetBy,
2295
- e.components.label,
2296
- e.components.highlight
2297
- ];
2298
- for (const g of y)
2299
- for (const { selectedSource: A, fixedAxes: P } of g.selectorStates) {
2300
- B.push(b(A)), d.push(
2301
- (P ?? []).map(({ axisIdx: L, axisValue: N }) => ({ idx: L, value: N }))
2302
- ), i.push(...await V(
2303
- t,
2304
- p,
2305
- m,
2306
- v,
2307
- A,
2308
- P
2309
- ));
2310
- const E = await k(t, A, w);
2311
- E && B.push(E);
2312
- }
2313
- const f = await t.pFrameProvider.getTableOuterJoin(
2314
- [r, a, ...i, ...x],
2315
- B,
2316
- h,
2317
- !1,
2318
- C,
2319
- d
2320
- );
2321
- return [...D, ...B].forEach((g) => {
2322
- const A = g.toCanonicalString();
2323
- u.values[A] = O(g) ? f.columnsData[A] : f.axesData[A];
2324
- }), u.values.key = new Array(u.values[Object.keys(u.values)[0]].length).fill(0).map((g, A) => A), e.components.highlight.selectorStates.length && (u.values.highlight = Be(e.components.highlight.selectorStates, f)), { byColumns: u };
2325
- }
2326
- async createChartSettings(t, e) {
2327
- var o, n, l, s, c;
2328
- const r = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, a = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource, u = r ? b(r) : null, p = a ? b(a) : null;
2329
- if (!r || !a || !u || !p || !O(u) && !O(p))
2330
- throw Error("Empty or invalid required data");
2331
- const m = [u, p].filter(O).map((i) => i.toCanonicalString()), S = {
2332
- type: "column",
2333
- value: r,
2334
- label: await T(t, r, m)
2335
- }, h = {
2336
- type: "column",
2337
- value: a,
2338
- label: await T(t, a, m)
2339
- }, x = {
2340
- type: "column",
2341
- value: "key"
2342
- }, w = await Promise.all(
2343
- e.components.facetBy.selectorStates.map(async (i) => {
2344
- var y, f;
2345
- return {
2346
- type: "column",
2347
- value: (f = (y = await k(t, i.selectedSource, m)) == null ? void 0 : y.toCanonicalString()) != null ? f : i.selectedSource
2348
- };
2349
- })
2350
- ), v = pe.uniq([
2351
- ...e.components.grouping.selectorStates.map((i) => i.selectedSource),
2352
- ...e.components.size.selectorStates.map((i) => i.selectedSource),
2353
- ...e.components.shape.selectorStates.map((i) => i.selectedSource)
2354
- ]), D = await Promise.all(
2355
- v.map(async (i) => {
2356
- var y, f;
2357
- return {
2358
- columnName: {
2359
- type: "column",
2360
- label: await T(t, i, m) || i,
2361
- value: i,
2362
- valueLabels: (f = (y = await k(t, i, m)) == null ? void 0 : y.toCanonicalString()) != null ? f : i
2363
- }
2364
- };
2365
- })
2366
- ), B = await Promise.all(
2367
- e.components.tooltipContent.selectorStates.map(async (i) => {
2368
- var y, f;
2369
- const g = i.selectedSource, A = b(g), P = (y = await k(t, g, m)) != null ? y : A, E = await J(t, g, m);
2370
- return {
2371
- type: "column",
2372
- label: await T(t, g, m) || g,
2373
- value: g,
2374
- valueLabels: P.toCanonicalString(),
2375
- format: (f = E == null ? void 0 : E.annotations) == null ? void 0 : f[ne]
2376
- };
2377
- })
2378
- );
2379
- let C;
2380
- if (e.components.label.selectorStates.length) {
2381
- const i = e.components.label.selectorStates[0].selectedSource, y = await J(t, i, m);
2382
- C = {
2383
- type: "column",
2384
- value: i,
2385
- label: await T(t, i, m),
2386
- valueLabels: (s = (l = await k(t, i, m)) == null ? void 0 : l.toCanonicalString()) != null ? s : i,
2387
- format: (c = y == null ? void 0 : y.annotations) == null ? void 0 : c[ne]
2388
- };
2389
- }
2390
- let d;
2391
- return e.components.highlight.selectorStates.length && (d = {
2392
- type: "column",
2393
- value: "highlight"
2394
- }), {
2395
- type: "scatterplot",
2396
- x: S,
2397
- y: h,
2398
- keyColumn: x,
2399
- facetBy: w,
2400
- grouping: D,
2401
- label: C,
2402
- highlight: d,
2403
- tooltips: {
2404
- show: !0,
2405
- content: B
2406
- }
2407
- };
2408
- }
2409
- }, ut = {
2410
- type: "scatterplot-umap",
2411
- components: {
2412
- x: { type: "simple", selectorStates: [] },
2413
- y: { type: "simple", selectorStates: [] },
2414
- filters: { type: "filter", selectorStates: [] },
2415
- highlight: { type: "filter", selectorStates: [] },
2416
- tabBy: { type: "filter", selectorStates: [] },
2417
- facetBy: { type: "simple", selectorStates: [] },
2418
- grouping: { type: "simple", selectorStates: [] },
2419
- label: { type: "simple", selectorStates: [] },
2420
- tooltipContent: { type: "simple", selectorStates: [] },
2421
- size: { type: "simple", selectorStates: [] }
2422
- },
2423
- dividedAxes: {}
2424
- }, pt = class extends Z {
2425
- constructor() {
2426
- super(
2427
- {
2428
- x: new I({
2429
- componentName: "x",
2430
- allowedTypes: ["Int", "Long", "Double", "Float"],
2431
- parentComponents: ["y"],
2432
- strictlyDependsOnParents: !1,
2433
- settings: {
2434
- isDataComponent: !0,
2435
- required: !0,
2436
- axesAllowed: !0,
2437
- columnsAllowed: !0
2438
- }
2439
- }),
2440
- y: new I({
2441
- componentName: "y",
2442
- allowedTypes: ["Int", "Long", "Double", "Float"],
2443
- parentComponents: ["x"],
2444
- strictlyDependsOnParents: !1,
2445
- settings: {
2446
- isDataComponent: !0,
2447
- required: !0,
2448
- axesAllowed: !0,
2449
- columnsAllowed: !0
2450
- }
2451
- }),
2452
- facetBy: new I({
2453
- componentName: "facetBy",
2454
- allowedTypes: ["String", "Int", "Long"],
2455
- strictlyDependsOnParents: !0,
2456
- parentComponents: ["x", "y"],
2457
- dependsOn: ["x", "y"],
2458
- settings: {
2459
- axesAllowed: !0,
2460
- dimensionConsumer: !0,
2461
- multipleSelectors: !0
2462
- }
2463
- }),
2464
- grouping: new I({
2465
- componentName: "grouping",
2466
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2467
- strictlyDependsOnParents: !0,
2468
- parentComponents: ["x", "y"],
2469
- dependsOn: ["x", "y"],
2470
- settings: {
2471
- axesAllowed: !0,
2472
- multipleSelectors: !0
2473
- }
2474
- }),
2475
- tooltipContent: new I({
2476
- componentName: "tooltipContent",
2477
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2478
- strictlyDependsOnParents: !0,
2479
- parentComponents: ["x", "y"],
2480
- dependsOn: ["x", "y"],
2481
- settings: {
2482
- columnsAllowed: !0,
2483
- axesAllowed: !0,
2484
- multipleSelectors: !0
2485
- }
2486
- }),
2487
- label: new I({
2488
- componentName: "label",
2489
- allowedTypes: ["String", "Int", "Long"],
2490
- strictlyDependsOnParents: !0,
2491
- parentComponents: ["x", "y"],
2492
- dependsOn: ["x", "y"],
2493
- settings: {
2494
- axesAllowed: !0,
2495
- columnsAllowed: !0,
2496
- multipleSelectors: !1
2497
- }
2498
- }),
2499
- size: new I({
2500
- componentName: "size",
2501
- allowedTypes: ["Int", "Long", "Double", "Float"],
2502
- strictlyDependsOnParents: !0,
2503
- parentComponents: ["x", "y"],
2504
- dependsOn: ["x", "y"],
2505
- settings: {
2506
- axesAllowed: !0
2507
- }
2508
- })
2509
- },
2510
- {
2511
- filters: new I({
2512
- componentName: "filters",
2513
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2514
- strictlyDependsOnParents: !0,
2515
- parentComponents: ["x", "y"],
2516
- dependsOn: ["x", "y"],
2517
- settings: {
2518
- axesAllowed: !0,
2519
- dimensionConsumer: !0,
2520
- multipleSelectors: !0
2521
- },
2522
- checkSourceBySpec: R
2523
- }),
2524
- tabBy: new I({
2525
- componentName: "tabBy",
2526
- allowedTypes: ["String", "Int"],
2527
- strictlyDependsOnParents: !0,
2528
- parentComponents: ["x", "y"],
2529
- dependsOn: ["x", "y"],
2530
- settings: {
2531
- axesAllowed: !0,
2532
- dimensionConsumer: !0
2533
- }
2534
- }),
2535
- highlight: new I({
2536
- componentName: "highlight",
2537
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2538
- strictlyDependsOnParents: !0,
2539
- parentComponents: ["x", "y"],
2540
- dependsOn: ["x", "y"],
2541
- settings: {
2542
- axesAllowed: !0,
2543
- columnsAllowed: !0,
2544
- multipleSelectors: !0
2545
- },
2546
- checkSourceBySpec: R
2547
- })
2548
- }
2549
- ), this.dataInputs = ["x", "y"];
2550
- }
2551
- async getMustBeConsumedAxes(t, e) {
2552
- if (!e.components.x.selectorStates.length || !e.components.y.selectorStates.length)
2553
- return /* @__PURE__ */ new Set();
2554
- const o = e.components.x.selectorStates[0].selectedSource, n = e.components.y.selectorStates[0].selectedSource, l = await t.pFrameProvider.getColumnSpecById(b(o)), s = await t.pFrameProvider.getColumnSpecById(b(n));
2555
- if (!l || !s)
2556
- return /* @__PURE__ */ new Set();
2557
- const c = l.axesSpec.map((p) => F.fromAxisSpec(p).toCanonicalString()), r = s.axesSpec.map((p) => F.fromAxisSpec(p).toCanonicalString()), a = c.filter((p) => !r.some((m) => m === p)), u = r.filter((p) => !c.some((m) => m === p));
2558
- return /* @__PURE__ */ new Set([...a, ...u]);
2559
- }
2560
- async createDataByColumns(t, e) {
2561
- var o, n, l;
2562
- const s = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource;
2563
- if (!s || !c)
2564
- throw Error("X or Y column is not valid");
2565
- const r = b(s), a = b(c);
2566
- if (!r || !a)
2567
- throw Error("X or Y column is not valid");
2568
- const u = {
2569
- type: "columns",
2570
- id: (l = z(e.components)) != null ? l : "",
2571
- values: {}
2572
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), S = [
2573
- ...e.components.filters.selectorStates,
2574
- ...e.components.tabBy.selectorStates
2575
- ], h = Y(S), x = S.map((g) => b(g.selectedSource)).filter(O), w = [r, a].filter(O).map((g) => g.toCanonicalString());
2576
- if (w.length === 0)
2577
- throw Error("One of X and Y should be a column");
2578
- const v = await Q(t, w), D = [r, a, ...x], B = [], C = [[], []], d = [], i = [];
2579
- for (const { selectedSource: g, fixedAxes: A } of S)
2580
- i.push(...await V(
2581
- t,
2582
- p,
2583
- m,
2584
- v,
2585
- g,
2586
- A
2587
- )), C.push(
2588
- (A ?? []).map(({ axisIdx: P, axisValue: E }) => ({ idx: P, value: E }))
2589
- );
2590
- const y = [
2591
- e.components.grouping,
2592
- e.components.facetBy,
2593
- e.components.tooltipContent,
2594
- e.components.label,
2595
- e.components.highlight,
2596
- e.components.size
2597
- ];
2598
- for (const g of y)
2599
- for (const { selectedSource: A, fixedAxes: P } of g.selectorStates) {
2600
- B.push(b(A)), d.push(
2601
- (P ?? []).map(({ axisIdx: L, axisValue: N }) => ({ idx: L, value: N }))
2602
- ), i.push(...await V(
2603
- t,
2604
- p,
2605
- m,
2606
- v,
2607
- A,
2608
- P
2609
- ));
2610
- const E = await k(t, A, w);
2611
- E && B.push(E);
2612
- }
2613
- const f = await t.pFrameProvider.getTableOuterJoin(
2614
- [r, a, ...i, ...x],
2615
- B,
2616
- h,
2617
- !1,
2618
- C,
2619
- d
2620
- );
2621
- return [...D, ...B].forEach((g) => {
2622
- const A = g.toCanonicalString();
2623
- u.values[A] = O(g) ? f.columnsData[A] : f.axesData[A];
2624
- }), e.components.highlight.selectorStates.length && (u.values.highlight = Be(e.components.highlight.selectorStates, f)), {
2625
- byColumns: u,
2626
- axesData: f.axesData
2627
- };
2628
- }
2629
- async createChartSettings(t, e) {
2630
- var o, n, l, s, c;
2631
- const r = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, a = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource, u = r ? b(r) : null, p = a ? b(a) : null;
2632
- if (!r || !a || !u || !p || !O(u) && !O(p))
2633
- throw Error("Empty or invalid required data");
2634
- const m = [u, p].filter(O).map((i) => i.toCanonicalString()), S = {
2635
- type: "column",
2636
- value: r,
2637
- label: await T(t, r, m)
2638
- }, h = {
2639
- type: "column",
2640
- value: a,
2641
- label: await T(t, a, m)
2642
- }, x = {
2643
- type: "column",
2644
- value: "key"
2645
- }, w = await Promise.all(
2646
- e.components.facetBy.selectorStates.map(async (i) => {
2647
- var y, f;
2648
- return {
2649
- type: "column",
2650
- value: (f = (y = await k(t, i.selectedSource, m)) == null ? void 0 : y.toCanonicalString()) != null ? f : i.selectedSource
2651
- };
2652
- })
2653
- ), v = pe.uniq([
2654
- ...e.components.grouping.selectorStates.map((i) => i.selectedSource),
2655
- ...e.components.size.selectorStates.map((i) => i.selectedSource)
2656
- ]), D = await Promise.all(
2657
- v.map(async (i) => {
2658
- var y, f;
2659
- return {
2660
- columnName: {
2661
- type: "column",
2662
- label: await T(t, i, m) || i,
2663
- value: i,
2664
- valueLabels: (f = (y = await k(t, i, m)) == null ? void 0 : y.toCanonicalString()) != null ? f : i
2665
- }
2666
- };
2667
- })
2668
- ), B = await Promise.all(
2669
- e.components.tooltipContent.selectorStates.map(async (i) => {
2670
- var y, f, g;
2671
- const A = i.selectedSource, P = await J(t, A, m);
2672
- return {
2673
- type: "column",
2674
- label: await T(t, A, m) || A,
2675
- value: A,
2676
- valueLabels: (f = (y = await k(t, A, m)) == null ? void 0 : y.toCanonicalString()) != null ? f : A,
2677
- format: (g = P == null ? void 0 : P.annotations) == null ? void 0 : g[ne]
2678
- };
2679
- })
2680
- );
2681
- let C;
2682
- if (e.components.label.selectorStates.length) {
2683
- const i = e.components.label.selectorStates[0].selectedSource, y = await J(t, i, m);
2684
- C = {
2685
- type: "column",
2686
- value: i,
2687
- label: await T(t, i, m),
2688
- valueLabels: (s = (l = await k(t, i, m)) == null ? void 0 : l.toCanonicalString()) != null ? s : i,
2689
- format: (c = y == null ? void 0 : y.annotations) == null ? void 0 : c[ne]
2690
- };
2691
- }
2692
- let d;
2693
- return e.components.highlight.selectorStates.length && (d = {
2694
- type: "column",
2695
- value: "highlight"
2696
- }), {
2697
- type: "scatterplot-umap",
2698
- x: S,
2699
- y: h,
2700
- keyColumn: x,
2701
- facetBy: w,
2702
- grouping: D,
2703
- label: C,
2704
- highlight: d,
2705
- tooltips: {
2706
- show: !0,
2707
- content: B
2708
- }
2709
- };
2710
- }
2711
- }, Se = "pl7.app/dendrogram/nodeId", ye = "id", mt = {
2712
- type: "dendro",
2713
- components: {
2714
- value: { type: "simple", selectorStates: [] },
2715
- height: { type: "simple", selectorStates: [] },
2716
- labels: { type: "simple", selectorStates: [] },
2717
- tableContent: { type: "simple", selectorStates: [] },
2718
- nodeColor: { type: "simple", selectorStates: [] },
2719
- nodeShape: { type: "simple", selectorStates: [] },
2720
- nodeSize: { type: "simple", selectorStates: [] },
2721
- lineColor: { type: "simple", selectorStates: [] },
2722
- heatmapAnnotation: { type: "simple", selectorStates: [] },
2723
- heatmapForSequence: { type: "simple", selectorStates: [] },
2724
- filters: { type: "filter", selectorStates: [] },
2725
- tabBy: { type: "filter", selectorStates: [] },
2726
- facetBy: { type: "simple", selectorStates: [] },
2727
- heatmapAxis: { type: "simple", selectorStates: [] },
2728
- heatmapGroup: { type: "simple", selectorStates: [] }
2729
- },
2730
- dividedAxes: {}
2731
- }, dt = class extends Z {
2732
- constructor() {
2733
- super(
2734
- {
2735
- value: new I({
2736
- componentName: "value",
2737
- allowedTypes: ["Int", "Long"],
2738
- annotations: { "pl7.app/dendrogram/isTopology": "true" },
2739
- settings: {
2740
- isDataComponent: !0,
2741
- columnsAllowed: !0,
2742
- required: !0,
2743
- dimensionConsumer: !0,
2744
- columnsWithExtraAxesAllowed: !1
2745
- }
2746
- }),
2747
- height: new I({
2748
- componentName: "height",
2749
- allowedTypes: ["Int", "Long", "Double", "Float"],
2750
- annotations: { "pl7.app/dendrogram/isDistance": "true" },
2751
- parentComponents: ["value"],
2752
- strictlyDependsOnParents: !0,
2753
- settings: {
2754
- columnsAllowed: !0,
2755
- axesAllowed: !1,
2756
- dimensionConsumer: !0,
2757
- columnsWithExtraAxesAllowed: !1
2758
- }
2759
- }),
2760
- labels: new I({
2761
- componentName: "labels",
2762
- allowedTypes: ["Int", "String", "Long"],
2763
- parentComponents: ["value"],
2764
- strictlyDependsOnParents: !1,
2765
- settings: {
2766
- columnsAllowed: !0,
2767
- axesAllowed: !1,
2768
- columnsWithExtraAxesAllowed: !1
2769
- }
2770
- }),
2771
- tableContent: new I({
2772
- componentName: "tableContent",
2773
- allowedTypes: ["Int", "String", "Long", "Double", "Float"],
2774
- parentComponents: ["value"],
2775
- strictlyDependsOnParents: !1,
2776
- settings: {
2777
- columnsAllowed: !0,
2778
- axesAllowed: !0,
2779
- multipleSelectors: !0,
2780
- columnsWithExtraAxesAllowed: !1
2781
- }
2782
- }),
2783
- nodeShape: new I({
2784
- componentName: "nodeShape",
2785
- allowedTypes: ["Int", "String", "Long"],
2786
- parentComponents: ["value"],
2787
- strictlyDependsOnParents: !1,
2788
- settings: {
2789
- columnsAllowed: !0,
2790
- axesAllowed: !0,
2791
- columnsWithExtraAxesAllowed: !1
2792
- }
2793
- }),
2794
- nodeSize: new I({
2795
- componentName: "nodeSize",
2796
- allowedTypes: ["Double", "Int", "String", "Long"],
2797
- parentComponents: ["value"],
2798
- strictlyDependsOnParents: !1,
2799
- settings: {
2800
- columnsAllowed: !0,
2801
- axesAllowed: !0,
2802
- columnsWithExtraAxesAllowed: !1
2803
- }
2804
- }),
2805
- nodeColor: new I({
2806
- componentName: "nodeColor",
2807
- allowedTypes: ["Double", "Int", "String", "Long"],
2808
- parentComponents: ["value"],
2809
- strictlyDependsOnParents: !1,
2810
- settings: {
2811
- columnsAllowed: !0,
2812
- axesAllowed: !0,
2813
- columnsWithExtraAxesAllowed: !1
2814
- }
2815
- }),
2816
- lineColor: new I({
2817
- componentName: "lineColor",
2818
- allowedTypes: ["Double", "Int", "String", "Long"],
2819
- parentComponents: ["value"],
2820
- strictlyDependsOnParents: !1,
2821
- settings: {
2822
- columnsAllowed: !0,
2823
- axesAllowed: !1,
2824
- columnsWithExtraAxesAllowed: !1
2825
- }
2826
- }),
2827
- heatmapForSequence: new I({
2828
- componentName: "heatmapForSequence",
2829
- allowedTypes: ["String"],
2830
- annotations: { "pl7.app/type": "sequence" },
2831
- parentComponents: ["value"],
2832
- strictlyDependsOnParents: !1,
2833
- settings: {
2834
- columnsAllowed: !0,
2835
- axesAllowed: !0,
2836
- columnsWithExtraAxesAllowed: !1
2837
- }
2838
- }),
2839
- heatmapAnnotation: new I({
2840
- componentName: "heatmapAnnotation",
2841
- allowedTypes: ["Double", "Int", "Long", "Float", "String"],
2842
- parentComponents: ["value"],
2843
- strictlyDependsOnParents: !1,
2844
- settings: {
2845
- isDataComponent: !0,
2846
- columnsAllowed: !0,
2847
- axesAllowed: !1,
2848
- columnsWithExtraAxesAllowed: !1
2849
- }
2850
- }),
2851
- facetBy: new I({
2852
- componentName: "facetBy",
2853
- allowedTypes: ["String", "Int", "Long"],
2854
- parentComponents: ["value"],
2855
- strictlyDependsOnParents: !0,
2856
- settings: {
2857
- dimensionConsumer: !0,
2858
- multipleSelectors: !0,
2859
- axesAllowed: !0,
2860
- columnsAllowed: !1,
2861
- columnsWithExtraAxesAllowed: !1
2862
- }
2863
- }),
2864
- heatmapAxis: new I({
2865
- componentName: "heatmapAxis",
2866
- allowedTypes: ["String", "Int", "Long"],
2867
- parentComponents: ["heatmapAnnotation"],
2868
- settings: {
2869
- dimensionConsumer: !0,
2870
- axesAllowed: !0,
2871
- columnsAllowed: !1,
2872
- columnsWithExtraAxesAllowed: !1
2873
- }
2874
- }),
2875
- heatmapGroup: new I({
2876
- componentName: "heatmapGroup",
2877
- allowedTypes: ["String", "Int", "Long"],
2878
- parentComponents: ["heatmapAnnotation"],
2879
- settings: {
2880
- dimensionConsumer: !0,
2881
- multipleSelectors: !0,
2882
- axesAllowed: !0,
2883
- columnsAllowed: !1,
2884
- columnsWithExtraAxesAllowed: !1
2885
- }
2886
- })
2887
- },
2888
- {
2889
- filters: new I({
2890
- componentName: "filters",
2891
- allowedTypes: ["String", "Int", "Long"],
2892
- parentComponents: ["value", "heatmapAnnotation"],
2893
- strictlyDependsOnParents: !1,
2894
- settings: {
2895
- dimensionConsumer: !0,
2896
- multipleSelectors: !0,
2897
- axesAllowed: !0,
2898
- columnsAllowed: !1,
2899
- columnsWithExtraAxesAllowed: !1
2900
- }
2901
- }),
2902
- tabBy: new I({
2903
- componentName: "tabBy",
2904
- allowedTypes: ["String", "Int", "Long"],
2905
- parentComponents: ["value", "heatmapAnnotation"],
2906
- strictlyDependsOnParents: !1,
2907
- settings: {
2908
- dimensionConsumer: !0,
2909
- axesAllowed: !0,
2910
- columnsAllowed: !1,
2911
- columnsWithExtraAxesAllowed: !1
2912
- }
2913
- })
2914
- }
2915
- ), this.ignoredOptionIdNames = [Se];
2916
- }
2917
- readyDataInputs(t) {
2918
- return t.components.value.selectorStates.length > 0;
2919
- }
2920
- async createTableData(t, e) {
2921
- var o;
2922
- const n = {}, l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, s = b(l);
2923
- if (!l || !O(s))
2924
- throw Error("Value column is not valid");
2925
- const { linkerColumnsMap: c, compositeLinkerMap: r } = await X(t), a = Y([
2926
- ...e.components.filters.selectorStates,
2927
- ...e.components.tabBy.selectorStates
2928
- ]), u = [
2929
- ...e.components.filters.selectorStates.map((d) => b(d.selectedSource)),
2930
- ...e.components.tabBy.selectorStates.map((d) => b(d.selectedSource))
2931
- ].filter(O), p = [l], m = await Q(t, p), S = [], h = [], x = [], w = [e.components.value], v = [
2932
- e.components.tableContent,
2933
- // next components can content data mapped on tree
2934
- e.components.labels,
2935
- e.components.nodeColor,
2936
- e.components.nodeSize,
2937
- e.components.nodeShape,
2938
- e.components.lineColor
2939
- ], D = {};
2940
- for (const d of w)
2941
- for (const { selectedSource: i, fixedAxes: y } of d.selectorStates) {
2942
- x.push(...await V(
2943
- t,
2944
- c,
2945
- r,
2946
- m,
2947
- i,
2948
- y
2949
- ));
2950
- const f = await k(t, i, p), g = f ?? b(i);
2951
- D[g.toCanonicalString()] = i, S.push(g);
2952
- }
2953
- for (const d of v)
2954
- for (const { selectedSource: i, fixedAxes: y } of d.selectorStates) {
2955
- x.push(...await V(
2956
- t,
2957
- c,
2958
- r,
2959
- m,
2960
- i,
2961
- y
2962
- ));
2963
- const f = await k(t, i, p), g = f ?? b(i);
2964
- D[i] = g.toCanonicalString(), h.push(g);
2965
- }
2966
- const B = await t.pFrameProvider.getTableOuterJoin(
2967
- [...S, ...u, ...x],
2968
- h,
2969
- a,
2970
- !1
2971
- );
2972
- for (const d of [...S, ...h]) {
2973
- const i = d.toCanonicalString(), y = D[d.toCanonicalString()];
2974
- n[y] = {
2975
- data: O(d) ? B.columnsData[i] : B.axesData[i],
2976
- spec: O(d) ? B.columnSpecs[i] : B.axesSpecs[i],
2977
- label: await T(t, y, p)
2978
- };
2979
- }
2980
- const C = Object.keys(B.axesData).find(
2981
- (d) => {
2982
- var i;
2983
- return ((i = b(d)) == null ? void 0 : i.name) === Se;
2984
- }
2985
- );
2986
- return C ? n[ye] = {
2987
- data: B.axesData[C],
2988
- spec: { kind: "PColumn", valueType: "Int", name: "Node id" },
2989
- label: "Node id"
2990
- } : console.warn("Missed node id axis in data column"), n;
2991
- }
2992
- async createDataByColumns(t, e) {
2993
- var o, n, l;
2994
- const s = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.heatmapAnnotation.selectorStates[0]) == null ? void 0 : n.selectedSource, r = b(s), a = c ? b(c) : null;
2995
- if (!s || !O(r))
2996
- throw Error("Value column is not valid");
2997
- const u = {
2998
- type: "columns",
2999
- id: (l = z(e.components)) != null ? l : "",
3000
- values: {}
3001
- }, p = [
3002
- ...e.components.filters.selectorStates,
3003
- ...e.components.tabBy.selectorStates
3004
- ], m = Y(p), S = p.map((y) => b(y.selectedSource)).filter(O), h = [r, a].filter(O).map((y) => y.toCanonicalString()), x = [], w = [], v = [], D = [], B = [
3005
- e.components.value,
3006
- e.components.height,
3007
- e.components.labels,
3008
- e.components.nodeColor,
3009
- e.components.nodeSize,
3010
- e.components.nodeShape,
3011
- e.components.lineColor,
3012
- e.components.heatmapAnnotation,
3013
- e.components.heatmapForSequence
3014
- ], C = [
3015
- e.components.facetBy,
3016
- e.components.heatmapAxis,
3017
- e.components.heatmapGroup,
3018
- e.components.tableContent
3019
- ];
3020
- for (const y of B)
3021
- for (const { selectedSource: f, fixedAxes: g } of y.selectorStates) {
3022
- x.push(b(f)), v.push(
3023
- (g ?? []).map(({ axisIdx: P, axisValue: E }) => ({ idx: P, value: E }))
3024
- );
3025
- const A = await k(t, f, h);
3026
- A && x.push(A);
3027
- }
3028
- p.forEach(({ fixedAxes: y }) => {
3029
- v.push(
3030
- (y ?? []).map(({ axisIdx: f, axisValue: g }) => ({ idx: f, value: g }))
3031
- );
3032
- });
3033
- for (const y of C)
3034
- for (const { selectedSource: f, fixedAxes: g } of y.selectorStates) {
3035
- w.push(b(f)), D.push(
3036
- (g ?? []).map(({ axisIdx: P, axisValue: E }) => ({ idx: P, value: E }))
3037
- );
3038
- const A = await k(t, f, h);
3039
- A && w.push(A);
3040
- }
3041
- const d = await t.pFrameProvider.getTableOuterJoin(
3042
- [...x, ...S],
3043
- w,
3044
- m,
3045
- !1,
3046
- v,
3047
- D
3048
- );
3049
- [...x, ...w].forEach((y) => {
3050
- const f = y.toCanonicalString(), g = O(y) ? d.columnsData[f] : d.axesData[f];
3051
- u.values[f] = [], u.values[f] = g;
3052
- });
3053
- const i = Object.keys(d.axesData).find(
3054
- (y) => {
3055
- var f;
3056
- return ((f = b(y)) == null ? void 0 : f.name) === Se;
3057
- }
3058
- );
3059
- return i ? u.values[ye] = d.axesData[i] : console.warn("Missed node id axis in data column"), { byColumns: u };
3060
- }
3061
- async createChartSettings(t, e) {
3062
- var o, n, l;
3063
- const s = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, c = b(s);
3064
- if (!s || !O(c))
3065
- throw Error("Data column is not valid");
3066
- const r = [s], a = { type: "column", value: ye }, u = { type: "column", value: s }, p = e.components.height.selectorStates.length ? { type: "column", value: e.components.height.selectorStates[0].selectedSource } : void 0, m = e.components.labels.selectorStates.length ? { type: "column", value: e.components.labels.selectorStates[0].selectedSource } : void 0, S = {};
3067
- if (e.components.nodeColor.selectorStates.length) {
3068
- const v = e.components.nodeColor.selectorStates[0].selectedSource;
3069
- S.nodeColor = {
3070
- columnName: {
3071
- type: "column",
3072
- value: v,
3073
- label: await T(t, v, r)
3074
- }
3075
- };
3076
- }
3077
- if (e.components.nodeShape.selectorStates.length) {
3078
- const v = e.components.nodeShape.selectorStates[0].selectedSource;
3079
- S.nodeShape = {
3080
- columnName: {
3081
- type: "column",
3082
- value: v,
3083
- label: await T(t, v, r)
3084
- }
3085
- };
3086
- }
3087
- if (e.components.nodeSize.selectorStates.length) {
3088
- const v = e.components.nodeSize.selectorStates[0].selectedSource;
3089
- S.nodeSize = {
3090
- columnName: {
3091
- type: "column",
3092
- value: v,
3093
- label: await T(t, v, r)
3094
- }
3095
- };
3096
- }
3097
- if (e.components.lineColor.selectorStates.length) {
3098
- const v = e.components.lineColor.selectorStates[0].selectedSource;
3099
- S.lineColor = {
3100
- columnName: {
3101
- type: "column",
3102
- value: v,
3103
- label: await T(t, v, r)
3104
- }
3105
- };
3106
- }
3107
- let h, x, w;
3108
- if (e.components.heatmapAnnotation.selectorStates.length && e.components.heatmapAxis.selectorStates.length) {
3109
- const v = e.components.heatmapAnnotation.selectorStates[0].selectedSource;
3110
- h = {
3111
- type: "column",
3112
- value: v,
3113
- label: await T(t, v, []),
3114
- valueLabels: (n = await k(t, v, [])) == null ? void 0 : n.toCanonicalString()
3115
- };
3116
- const D = e.components.heatmapAxis.selectorStates[0].selectedSource;
3117
- x = {
3118
- type: "column",
3119
- value: D,
3120
- label: await T(t, D, [v]),
3121
- valueLabels: (l = await k(t, D, [v])) == null ? void 0 : l.toCanonicalString()
3122
- }, w = await Promise.all(
3123
- e.components.heatmapGroup.selectorStates.map(async (B) => {
3124
- var C;
3125
- return {
3126
- type: "column",
3127
- value: B.selectedSource,
3128
- label: await T(t, B.selectedSource, [v]),
3129
- valueLabels: (C = await k(t, B.selectedSource, [v])) == null ? void 0 : C.toCanonicalString()
3130
- };
3131
- })
3132
- );
3133
- } else if (e.components.heatmapForSequence.selectorStates.length) {
3134
- const v = e.components.heatmapForSequence.selectorStates[0].selectedSource;
3135
- h = {
3136
- type: "column",
3137
- value: v,
3138
- label: await T(t, v, [])
3139
- };
3140
- }
3141
- return {
3142
- type: "dendro",
3143
- id: a,
3144
- parentId: u,
3145
- height: p,
3146
- labels: m,
3147
- aes: S,
3148
- heatmapAnnotation: h,
3149
- heatmapAxis: x,
3150
- heatmapGroup: w
3151
- };
3152
- }
3153
- }, he = 1e6;
3154
- function ue(t, e) {
3155
- if (t === "String")
3156
- return e.data;
3157
- const o = new Array(e.data.length);
3158
- for (let n = 0; n < e.data.length; n++)
3159
- o[n] = Te(e, n, { absent: null, na: null });
3160
- return o;
3161
- }
3162
- var H = !1;
3163
- var St = class {
3164
- constructor(t, e) {
3165
- this.pframeHandle = t, this.pframeDriver = e;
3166
- }
3167
- async isColumnExisted(t) {
3168
- return !!await this.getColumnSpecById(t);
3169
- }
3170
- async getSingleColumnData(t, e = []) {
3171
- if (!await this.isColumnExisted(t))
3172
- return {
3173
- axesData: {},
3174
- data: []
3175
- };
3176
- try {
3177
- const o = Date.now(), n = await this.pframeDriver.calculateTableData(this.pframeHandle, {
3178
- src: {
3179
- type: "column",
3180
- column: t.name
3181
- },
3182
- filters: e,
3183
- sorting: []
3184
- }), l = n.filter((c) => c.spec.type === "axis"), s = n.filter((c) => c.spec.type === "column");
3185
- return {
3186
- axesData: l.reduce((c, r) => {
3187
- const a = F.fromAxisSpec(r.spec.spec);
3188
- return c[a.toCanonicalString()] = ue(a.type, r.data), c;
3189
- }, {}),
3190
- data: s.length ? ue(t.type, s[0].data) : []
3191
- };
3192
- } catch (o) {
3193
- throw console.error("PFrame: calculateTableData error"), o;
3194
- }
3195
- }
3196
- async getColumnUniqueValues(t, e = he, o = []) {
3197
- if (!await this.isColumnExisted(t))
3198
- return { values: [], overflow: !1 };
3199
- const n = {
3200
- columnId: t.name,
3201
- filters: o,
3202
- limit: e
3203
- };
3204
- try {
3205
- const l = Date.now(), s = await this.pframeDriver.getUniqueValues(this.pframeHandle, n);
3206
- let c = !1;
3207
- return s.overflow && (c = !0, console.warn(`More than ${e} values for ${t.name} column`)), {
3208
- values: Array.from(s.values.data).map(String),
3209
- overflow: c
3210
- };
3211
- } catch (l) {
3212
- throw console.error("PFrame: getUniqueValues for column error"), l;
3213
- }
3214
- }
3215
- async getAxisUniqueValues(t, e, o = he, n = []) {
3216
- const l = e.filter(O), s = await Promise.all(l.map((a) => this.getColumnSpecById(a))), c = t.toCanonicalString(), r = l.filter((a, u) => {
3217
- const p = s[u];
3218
- return p !== null && p.axesSpec.some((m) => F.fromAxisSpec(m).toCanonicalString() === c);
3219
- });
3220
- if (r.length === 0)
3221
- return { values: [], overflow: !1 };
3222
- try {
3223
- const a = Date.now(), u = await Promise.all(
3224
- r.map(
3225
- (m) => this.pframeDriver.getUniqueValues(this.pframeHandle, {
3226
- columnId: m.name,
3227
- axis: t.toPFrameId(),
3228
- filters: n,
3229
- limit: o
3230
- })
3231
- )
3232
- );
3233
- let p = !1;
3234
- return u.forEach((m, S) => {
3235
- m.overflow && (p = !0, console.warn(`More than ${o} values for ${r[S].name} column`));
3236
- }), {
3237
- values: pe.uniq(
3238
- pe.flatten(u.map((m) => Array.from(m.values.data).map(String)))
3239
- ),
3240
- overflow: p
3241
- };
3242
- } catch (a) {
3243
- throw console.error("PFrame: getUniqueValues for axis error", a), a;
3244
- }
3245
- }
3246
- async getTableOuterJoin(t, e, o = [], n = !0, l = [], s = []) {
3247
- const c = t.filter(O), r = e.filter(O), a = {
3248
- src: {
3249
- type: "outer",
3250
- primary: {
3251
- type: n ? "inner" : "full",
3252
- entries: c.map((u, p) => {
3253
- var m;
3254
- const S = (m = l[p]) == null ? void 0 : m.map((h) => ({
3255
- type: "constant",
3256
- axisIndex: h.idx,
3257
- constant: h.value
3258
- })).filter((h) => h.constant !== void 0);
3259
- return S != null && S.length ? {
3260
- type: "slicedColumn",
3261
- newId: u.name,
3262
- column: u.name,
3263
- axisFilters: S
3264
- } : {
3265
- type: "column",
3266
- column: u.name
3267
- };
3268
- })
3269
- },
3270
- secondary: r.map((u, p) => {
3271
- var m;
3272
- const S = (m = s[p]) == null ? void 0 : m.map((h) => ({
3273
- type: "constant",
3274
- axisIndex: h.idx,
3275
- constant: h.value
3276
- })).filter((h) => h.constant !== void 0);
3277
- return S != null && S.length ? {
3278
- type: "slicedColumn",
3279
- newId: u.name,
3280
- column: u.name,
3281
- axisFilters: S
3282
- } : {
3283
- type: "column",
3284
- column: u.name
3285
- };
3286
- })
3287
- },
3288
- filters: o,
3289
- sorting: []
3290
- };
3291
- try {
3292
- const u = Date.now(), p = await this.pframeDriver.calculateTableData(this.pframeHandle, a), m = p.filter((h) => h.spec.type === "axis"), S = p.filter((h) => h.spec.type === "column");
3293
- return {
3294
- axesData: m.reduce((h, x) => {
3295
- const w = F.fromAxisSpec(x.spec.spec);
3296
- return h[w.toCanonicalString()] = ue(w.type, x.data), h;
3297
- }, {}),
3298
- columnsData: S.reduce((h, x) => {
3299
- const w = x.spec.spec, v = new W({
3300
- name: x.spec.id,
3301
- type: w.valueType
3302
- });
3303
- return h[v.toCanonicalString()] = ue(v.type, x.data), h;
3304
- }, {}),
3305
- columnSpecs: S.reduce((h, x) => {
3306
- const w = x.spec.spec, v = new W({
3307
- name: x.spec.id,
3308
- type: w.valueType
3309
- });
3310
- return h[v.toCanonicalString()] = w, h;
3311
- }, {}),
3312
- axesSpecs: m.reduce((h, x) => {
3313
- const w = x.spec.spec, v = F.fromAxisSpec(w);
3314
- return h[v.toCanonicalString()] = w, h;
3315
- }, {})
3316
- };
3317
- } catch (u) {
3318
- throw console.error("PFrame: table outer join error"), console.info("error with request: ", a), u;
3319
- }
3320
- }
3321
- async getColumnSpecById(t) {
3322
- try {
3323
- const e = Date.now(), o = await this.pframeDriver.getColumnSpec(this.pframeHandle, t.name);
3324
- return o ?? null;
3325
- } catch {
3326
- return console.error("PFrame: get single column error"), null;
3327
- }
3328
- }
3329
- async getColumnAxesIds(t) {
3330
- var e, o;
3331
- return (o = (e = await this.getColumnSpecById(t)) == null ? void 0 : e.axesSpec.map((n) => F.fromAxisSpec(n))) != null ? o : [];
3332
- }
3333
- async getRequestColumnsFromSelectedSources(t) {
3334
- var e, o;
3335
- const n = [];
3336
- for (const l of t)
3337
- if (O(l)) {
3338
- const s = (o = (e = await this.getColumnSpecById(l)) == null ? void 0 : e.axesSpec) != null ? o : [];
3339
- n.push(...s.map((c) => F.fromAxisSpec(c).toPFrameId()));
3340
- }
3341
- return n;
3342
- }
3343
- async getColumnsList() {
3344
- return this.pframeDriver.listColumns(this.pframeHandle);
3345
- }
3346
- async getColumnsFull(t, e, o, n, l) {
3347
- try {
3348
- const s = {
3349
- columnFilter: {
3350
- type: o,
3351
- name: n,
3352
- annotationValue: l
3353
- },
3354
- compatibleWith: await this.getRequestColumnsFromSelectedSources(t),
3355
- strictlyCompatible: e
3356
- // should be true if we want to get meta and false if X/Y
3357
- }, c = Date.now(), r = await this.pframeDriver.findColumns(this.pframeHandle, s), a = [];
3358
- return r.hits.forEach((u) => {
3359
- a.push(u);
3360
- }), a;
3361
- } catch (s) {
3362
- throw console.error("PFrame: findColumns error"), s;
3363
- }
3364
- }
3365
- async getColumns(t, e, o, n, l) {
3366
- return (await this.getColumnsFull(t, e, o, n, l)).map(
3367
- (s) => new W({
3368
- name: s.columnId,
3369
- type: s.spec.valueType
3370
- })
3371
- );
3372
- }
3373
- async findColumnBy(t, e, o, n) {
3374
- try {
3375
- const l = {
3376
- columnFilter: {
3377
- name: [t],
3378
- ...e ? { type: [e] } : {},
3379
- ...o ? { annotationValue: o } : {},
3380
- ...n ? { domainValue: n } : {}
3381
- },
3382
- compatibleWith: [],
3383
- strictlyCompatible: !1
3384
- }, s = Date.now(), c = await this.pframeDriver.findColumns(this.pframeHandle, l), r = [];
3385
- return c.hits.forEach(({ columnId: a, spec: u }) => {
3386
- r.push(new W({ name: a, type: u.valueType }));
3387
- }), r.length > 1 && console.warn(`More than 1 column found for ${t}}`), r.length === 0 ? (console.warn(`No columns found for ${t}}`), null) : r[0];
3388
- } catch (l) {
3389
- throw console.error("PFrame: findColumns error"), l;
3390
- }
3391
- }
3392
- }, ht = class {
3393
- constructor(t, e, o = (n, l) => l ?? n) {
3394
- this.labelsModifier = o, this.pFrameProvider = new St(t, e);
3395
- }
3396
- }, _e = {
1
+ import { BubbleStateController as a, InitialBubbleState as r } from "./controllers/controllersByChartType/bubble.js";
2
+ import { DendroStateController as o, InitialDendroState as l } from "./controllers/controllersByChartType/dendro.js";
3
+ import { DiscreteStateController as n, InitialDiscreteState as i } from "./controllers/controllersByChartType/discrete.js";
4
+ import { HeatmapStateController as s, InitialHeatmapState as p } from "./controllers/controllersByChartType/heatmap.js";
5
+ import { HistogramStateController as m, InitialHistogramState as S } from "./controllers/controllersByChartType/histogram.js";
6
+ import { ScatterplotStateController as c, InitialScatterplotState as C } from "./controllers/controllersByChartType/scatterplot.js";
7
+ import { ScatterplotUmapStateController as b, InitialScatterplotUmapState as u } from "./controllers/controllersByChartType/scatterplot-umap.js";
8
+ import "./_virtual/canonicalize.js";
9
+ import "./_virtual/lodash.js";
10
+ import "./node_modules/@milaboratories/pl-model-common/dist/index.js";
11
+ const e = {
3397
12
  controllers: {
3398
- discrete: new lt(),
3399
- scatterplot: new it(),
3400
- "scatterplot-umap": new pt(),
3401
- heatmap: new rt(),
3402
- dendro: new dt(),
3403
- histogram: new ot(),
3404
- bubble: new tt()
13
+ discrete: new n(),
14
+ scatterplot: new c(),
15
+ "scatterplot-umap": new b(),
16
+ heatmap: new s(),
17
+ dendro: new o(),
18
+ histogram: new m(),
19
+ bubble: new a()
3405
20
  },
3406
21
  initialStates: {
3407
- discrete: st,
3408
- scatterplot: ct,
3409
- "scatterplot-umap": ut,
3410
- heatmap: at,
3411
- dendro: mt,
3412
- histogram: nt,
3413
- bubble: et
22
+ discrete: i,
23
+ scatterplot: C,
24
+ "scatterplot-umap": u,
25
+ heatmap: p,
26
+ dendro: l,
27
+ histogram: S,
28
+ bubble: r
3414
29
  }
3415
30
  };
3416
- function wt(t) {
3417
- return _e.controllers[t];
31
+ function U(t) {
32
+ return e.controllers[t];
3418
33
  }
3419
- function vt(t) {
3420
- return _e.initialStates[t];
34
+ function $(t) {
35
+ return e.initialStates[t];
3421
36
  }
3422
37
  export {
3423
- F as AxisId,
3424
- tt as BubbleStateController,
3425
- W as ColumnId,
3426
- ht as DemoDataStore,
3427
- dt as DendroStateController,
3428
- lt as DiscreteStateController,
3429
- rt as HeatmapStateController,
3430
- it as ScatterplotStateController,
3431
- b as columnOrAxisIdFromString,
3432
- wt as getControllerByType,
3433
- vt as getInitialStateByType,
3434
- O as isColumnId
38
+ a as BubbleStateController,
39
+ o as DendroStateController,
40
+ n as DiscreteStateController,
41
+ s as HeatmapStateController,
42
+ c as ScatterplotStateController,
43
+ U as getControllerByType,
44
+ $ as getInitialStateByType
3435
45
  };
3436
46
  //# sourceMappingURL=index.js.map