@platforma-sdk/model 1.22.97 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- var he = Object.defineProperty;
2
- var ge = (t, e, n) => e in t ? he(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var S = (t, e, n) => ge(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { isPColumn as N, mapPObjectData as U, mapValueInVOE as me, ensurePColumn as ye, isPColumnSpec as Z, extractAllColumns as be, mapPTableDef as ve, getAxisId as w, matchAxisId as O } from "@milaboratories/pl-model-common";
1
+ var be = Object.defineProperty;
2
+ var ve = (t, e, n) => e in t ? be(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var A = (t, e, n) => ve(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isPColumn as N, mapPObjectData as U, selectorsToPredicate as te, AnchorIdDeriver as $, isPlRef as _e, resolveAnchors as ne, isPColumnSpec as G, mapValueInVOE as Ae, ensurePColumn as Se, extractAllColumns as we, mapPTableDef as Ie, getAxisId as w, matchAxisId as L } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- import { z as P } from "zod";
7
- class _e extends Error {
6
+ import { z as C } from "zod";
7
+ class Pe extends Error {
8
8
  constructor(e, n) {
9
9
  super(`${e.length}${n ? "+" : ""} errors, first error: ` + e[0]), this.errors = e, this.moreErrors = n;
10
10
  }
11
11
  }
12
- function Se(t) {
13
- if (!t.ok) throw new _e(t.errors, t.moreErrors);
12
+ function Ce(t) {
13
+ if (!t.ok) throw new Pe(t.errors, t.moreErrors);
14
14
  return t.value;
15
15
  }
16
- function qe(t) {
16
+ function Qe(t) {
17
17
  return new Proxy(t, {
18
18
  get(e, n) {
19
- return Se(e[n]);
19
+ return Ce(e[n]);
20
20
  }
21
21
  });
22
22
  }
@@ -26,25 +26,25 @@ function m(t) {
26
26
  function k(t) {
27
27
  return { type: "GetFromCtx", variable: t };
28
28
  }
29
- function ze(t) {
29
+ function Ze(t) {
30
30
  return {
31
31
  type: "Isolate",
32
32
  cfg: t
33
33
  };
34
34
  }
35
- const Ye = k("$args"), Xe = k("$it"), Qe = k("$prod"), Ze = k("$staging"), et = k("$ui");
35
+ const et = k("$args"), tt = k("$it"), nt = k("$prod"), st = k("$staging"), rt = k("$ui");
36
36
  function j(t) {
37
37
  return { type: "Immediate", value: t };
38
38
  }
39
- function ie(t) {
39
+ function ue(t) {
40
40
  const e = {};
41
- for (const [n, r] of Object.entries(t)) e[n] = m(r);
41
+ for (const [n, s] of Object.entries(t)) e[n] = m(s);
42
42
  return {
43
43
  type: "MakeObject",
44
44
  template: e
45
45
  };
46
46
  }
47
- function tt(...t) {
47
+ function it(...t) {
48
48
  const e = [];
49
49
  for (const n of t) e.push(m(n));
50
50
  return {
@@ -59,7 +59,7 @@ function B(t, e) {
59
59
  field: m(e)
60
60
  };
61
61
  }
62
- function nt(t, e, n = "$it") {
62
+ function ot(t, e, n = "$it") {
63
63
  return {
64
64
  type: "MapRecordValues",
65
65
  source: t,
@@ -67,7 +67,7 @@ function nt(t, e, n = "$it") {
67
67
  itVar: n
68
68
  };
69
69
  }
70
- function rt(t, e, n = "$it") {
70
+ function at(t, e, n = "$it") {
71
71
  return {
72
72
  type: "MapArrayValues",
73
73
  source: t,
@@ -75,46 +75,46 @@ function rt(t, e, n = "$it") {
75
75
  itVar: n
76
76
  };
77
77
  }
78
- function st(t) {
78
+ function lt(t) {
79
79
  return {
80
80
  type: "Flatten",
81
81
  source: t
82
82
  };
83
83
  }
84
- function it(t) {
84
+ function ut(t) {
85
85
  return {
86
86
  type: "IsEmpty",
87
87
  arg: t
88
88
  };
89
89
  }
90
- function ot(t) {
90
+ function ct(t) {
91
91
  return {
92
92
  type: "Not",
93
93
  operand: t
94
94
  };
95
95
  }
96
- function at(t, e) {
96
+ function dt(t, e) {
97
97
  return {
98
98
  type: "And",
99
99
  operand1: t,
100
100
  operand2: e
101
101
  };
102
102
  }
103
- function lt(t, e) {
103
+ function pt(t, e) {
104
104
  return {
105
105
  type: "Or",
106
106
  operand1: t,
107
107
  operand2: e
108
108
  };
109
109
  }
110
- function ut(t, e) {
110
+ function ft(t, e) {
111
111
  return {
112
112
  type: "GetResourceField",
113
113
  source: m(t),
114
114
  field: m(e)
115
115
  };
116
116
  }
117
- function ct() {
117
+ function ht() {
118
118
  return function(t) {
119
119
  return {
120
120
  type: "GetResourceValueAsJson",
@@ -122,7 +122,7 @@ function ct() {
122
122
  };
123
123
  };
124
124
  }
125
- function dt(t, e, n = "$it") {
125
+ function gt(t, e, n = "$it") {
126
126
  return {
127
127
  type: "MapResourceFields",
128
128
  source: t,
@@ -130,19 +130,19 @@ function dt(t, e, n = "$it") {
130
130
  itVar: n
131
131
  };
132
132
  }
133
- function pt(t) {
133
+ function mt(t) {
134
134
  return {
135
135
  type: "GetBlobContent",
136
136
  source: m(t)
137
137
  };
138
138
  }
139
- function ft(t) {
139
+ function yt(t) {
140
140
  return {
141
141
  type: "GetBlobContentAsString",
142
142
  source: m(t)
143
143
  };
144
144
  }
145
- function ht() {
145
+ function bt() {
146
146
  return function(t) {
147
147
  return {
148
148
  type: "GetBlobContentAsJson",
@@ -150,68 +150,68 @@ function ht() {
150
150
  };
151
151
  };
152
152
  }
153
- function gt(t) {
153
+ function vt(t) {
154
154
  return {
155
155
  type: "GetDownloadedBlobContent",
156
156
  source: m(t)
157
157
  };
158
158
  }
159
- function mt(t) {
159
+ function _t(t) {
160
160
  return {
161
161
  type: "GetOnDemandBlobContent",
162
162
  source: m(t)
163
163
  };
164
164
  }
165
- function yt(t, e) {
165
+ function At(t, e) {
166
166
  return {
167
167
  type: "ExtractArchiveAndGetURL",
168
168
  format: e,
169
169
  source: m(t)
170
170
  };
171
171
  }
172
- function bt(t) {
172
+ function St(t) {
173
173
  return {
174
174
  type: "GetImportProgress",
175
175
  source: m(t)
176
176
  };
177
177
  }
178
- function vt(t, e) {
178
+ function wt(t, e) {
179
179
  return {
180
180
  type: "GetLastLogs",
181
181
  source: m(t),
182
182
  lines: e
183
183
  };
184
184
  }
185
- function _t(t, e) {
185
+ function It(t, e) {
186
186
  return {
187
187
  type: "GetProgressLog",
188
188
  source: m(t),
189
189
  patternToSearch: e
190
190
  };
191
191
  }
192
- function St(t, e) {
192
+ function Pt(t, e) {
193
193
  return {
194
194
  type: "GetProgressLogWithInfo",
195
195
  source: m(t),
196
196
  patternToSearch: e
197
197
  };
198
198
  }
199
- function At(t) {
199
+ function Ct(t) {
200
200
  return {
201
201
  type: "GetLogHandle",
202
202
  source: m(t)
203
203
  };
204
204
  }
205
- function Ae() {
205
+ function Re() {
206
206
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
207
207
  }
208
- function oe(t) {
208
+ function ce(t) {
209
209
  if (t && typeof globalThis.getPlatforma == "function")
210
210
  return globalThis.getPlatforma(t);
211
211
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
212
212
  throw new Error("Can't get platforma instance.");
213
213
  }
214
- function we() {
214
+ function Fe() {
215
215
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
216
216
  }
217
217
  function c() {
@@ -219,24 +219,24 @@ function c() {
219
219
  throw new Error("Not in config rendering context");
220
220
  }
221
221
  function E(t, e) {
222
- const n = we();
222
+ const n = Fe();
223
223
  if (n === void 0) return !1;
224
224
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
225
225
  return n.callbackRegistry[t] = e, !0;
226
226
  }
227
- const $ = /* @__PURE__ */ new Map();
228
- function Ie(t, e) {
227
+ const W = /* @__PURE__ */ new Map();
228
+ function xe(t, e) {
229
229
  t in c().callbackRegistry || (c().callbackRegistry[t] = (n) => {
230
- for (const r of $.get(t))
231
- r(n);
232
- }, $.set(t, [])), $.get(t).push(e);
230
+ for (const s of W.get(t))
231
+ s(n);
232
+ }, W.set(t, [])), W.get(t).push(e);
233
233
  }
234
234
  class b {
235
- constructor(e, n = (r) => r) {
236
- S(this, "isResolved", !1);
237
- S(this, "resolvedValue");
238
- this.handle = e, this.postProcess = n, Ie(e, (r) => {
239
- this.resolvedValue = n(r), this.isResolved = !0;
235
+ constructor(e, n = (s) => s) {
236
+ A(this, "isResolved", !1);
237
+ A(this, "resolvedValue");
238
+ this.handle = e, this.postProcess = n, xe(e, (s) => {
239
+ this.resolvedValue = n(s), this.isResolved = !0;
240
240
  });
241
241
  }
242
242
  map(e) {
@@ -244,15 +244,15 @@ class b {
244
244
  }
245
245
  mapDefined(e) {
246
246
  return new b(this.handle, (n) => {
247
- const r = this.postProcess(n);
248
- return r ? e(r) : void 0;
247
+ const s = this.postProcess(n);
248
+ return s ? e(s) : void 0;
249
249
  });
250
250
  }
251
251
  toJSON() {
252
252
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
253
253
  }
254
254
  }
255
- function H(t, e) {
255
+ function z(t, e) {
256
256
  return t === void 0 ? void 0 : e(t);
257
257
  }
258
258
  class v {
@@ -261,27 +261,27 @@ class v {
261
261
  }
262
262
  resolve(...e) {
263
263
  const n = e.map(
264
- (r) => ({
264
+ (s) => ({
265
265
  assertFieldType: "Input",
266
- ...typeof r == "string" ? { field: r } : r
266
+ ...typeof s == "string" ? { field: s } : s
267
267
  })
268
268
  );
269
269
  return this.resolveWithCommon({}, ...n);
270
270
  }
271
271
  resolveOutput(...e) {
272
272
  const n = e.map(
273
- (r) => ({
273
+ (s) => ({
274
274
  assertFieldType: "Output",
275
- ...typeof r == "string" ? { field: r } : r
275
+ ...typeof s == "string" ? { field: s } : s
276
276
  })
277
277
  );
278
278
  return this.resolveWithCommon({}, ...n);
279
279
  }
280
280
  resolveInput(...e) {
281
281
  const n = e.map(
282
- (r) => ({
282
+ (s) => ({
283
283
  assertFieldType: "Input",
284
- ...typeof r == "string" ? { field: r } : r
284
+ ...typeof s == "string" ? { field: s } : s
285
285
  })
286
286
  );
287
287
  return this.resolveWithCommon({}, ...n);
@@ -290,13 +290,13 @@ class v {
290
290
  return this.resolveWithCommon({}, ...e);
291
291
  }
292
292
  resolveWithCommon(e, ...n) {
293
- const r = [
293
+ const s = [
294
294
  ...this.resolvePath,
295
- ...n.map((s) => typeof s == "string" ? s : s.field)
295
+ ...n.map((r) => typeof r == "string" ? r : r.field)
296
296
  ];
297
- return H(
297
+ return z(
298
298
  c().resolveWithCommon(this.handle, e, ...n),
299
- (s) => new v(s, r)
299
+ (r) => new v(r, s)
300
300
  );
301
301
  }
302
302
  get resourceType() {
@@ -316,7 +316,7 @@ class v {
316
316
  }
317
317
  getError() {
318
318
  const e = [...this.resolvePath, "error"];
319
- return H(
319
+ return z(
320
320
  c().getError(this.handle),
321
321
  (n) => new v(n, e)
322
322
  );
@@ -356,8 +356,8 @@ class v {
356
356
  *
357
357
  */
358
358
  getPColumns(e = !1, n = "") {
359
- const r = this.parsePObjectCollection(e, n);
360
- return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
359
+ const s = this.parsePObjectCollection(e, n);
360
+ return s === void 0 ? void 0 : Object.entries(s).map(([, i]) => {
361
361
  if (!N(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
362
362
  return i;
363
363
  });
@@ -366,19 +366,19 @@ class v {
366
366
  *
367
367
  */
368
368
  parsePObjectCollection(e = !1, n = "") {
369
- const r = c().parsePObjectCollection(
369
+ const s = c().parsePObjectCollection(
370
370
  this.handle,
371
371
  e,
372
372
  n,
373
373
  ...this.resolvePath
374
374
  );
375
- if (r === void 0) return;
376
- const s = {};
377
- for (const [i, o] of Object.entries(r)) {
378
- const a = [...this.resolvePath, i];
379
- s[i] = U(o, (l) => new v(l, a));
375
+ if (s === void 0) return;
376
+ const r = {};
377
+ for (const [i, o] of Object.entries(s)) {
378
+ const l = [...this.resolvePath, i];
379
+ r[i] = U(o, (a) => new v(a, l));
380
380
  }
381
- return s;
381
+ return r;
382
382
  }
383
383
  getFileContentAsBase64() {
384
384
  return new b(c().getBlobContentAsBase64(this.handle));
@@ -461,114 +461,114 @@ class v {
461
461
  }
462
462
  }
463
463
  mapFields(e, n) {
464
- const { fieldType: r, requireLocked: s, skipUnresolved: i } = {
464
+ const { fieldType: s, requireLocked: r, skipUnresolved: i } = {
465
465
  fieldType: "Input",
466
466
  requireLocked: !0,
467
467
  skipUnresolved: !1,
468
468
  ...n
469
469
  }, o = e;
470
- if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
470
+ if (r && (s === "Input" && !this.getInputsLocked() || s === "Output" && !this.getOutputsLocked()))
471
471
  return;
472
- let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
473
- (u) => [u, this.resolve({ field: u, assertFieldType: r })]
472
+ let a = (s === "Input" ? this.listInputFields() : s === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
473
+ (u) => [u, this.resolve({ field: u, assertFieldType: s })]
474
474
  );
475
- return i && (l = l.filter((u) => u[1] !== void 0)), l.map(([u, h]) => o(u, h));
475
+ return i && (a = a.filter((u) => u[1] !== void 0)), a.map(([u, p]) => o(u, p));
476
476
  }
477
477
  }
478
- const ae = "staging", le = "main", Ce = {
478
+ const de = "staging", pe = "main", Te = {
479
479
  inlineColumnsSupport: !0,
480
480
  activeArgs: !0
481
481
  };
482
- function ue(t) {
482
+ function fe(t) {
483
483
  return typeof t == "object" && t !== null && "__awaited_futures__" in t;
484
484
  }
485
- function q(t, e, n) {
485
+ function Y(t, e, n) {
486
486
  if (e.has(n)) return;
487
487
  if (e.add(n), typeof n === "object")
488
- if (ue(n)) n.__awaited_futures__.forEach((s) => t.add(s));
488
+ if (fe(n)) n.__awaited_futures__.forEach((r) => t.add(r));
489
489
  else if (Array.isArray(n))
490
- for (const s of n) q(t, e, s);
490
+ for (const r of n) Y(t, e, r);
491
491
  else
492
- for (const [, s] of Object.entries(n))
493
- s !== n && q(t, e, s);
492
+ for (const [, r] of Object.entries(n))
493
+ r !== n && Y(t, e, r);
494
494
  }
495
- function Pe(t) {
495
+ function Le(t) {
496
496
  const e = /* @__PURE__ */ new Set();
497
- return q(e, /* @__PURE__ */ new Set(), t), e;
497
+ return Y(e, /* @__PURE__ */ new Set(), t), e;
498
498
  }
499
- const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
499
+ const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
500
500
  __proto__: null,
501
- GlobalCfgRenderCtxFeatureFlags: Ce,
502
- MainAccessorName: le,
503
- StagingAccessorName: ae,
504
- getAllFutureAwaits: Pe,
505
- isFutureAwait: ue
506
- }, Symbol.toStringTag, { value: "Module" })), Fe = "pl7.app/label", Re = "pl7.app/trace", xe = P.object({
507
- type: P.string(),
508
- importance: P.number().optional(),
509
- id: P.string().optional(),
510
- label: P.string()
511
- }), Te = P.array(xe), Oe = 1e-3, ke = "__LABEL__", ee = "__LABEL__@1";
512
- function Le(t, e, n = {}) {
513
- const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = t.map((p) => {
514
- var R, Q;
515
- const g = e(p), f = (R = g.annotations) == null ? void 0 : R[Fe], I = (Q = g.annotations) == null ? void 0 : Q[Re], y = (I ? Te.safeParse(JSON.parse(I)).data : void 0) ?? [];
516
- if (f) {
517
- const A = { label: f, type: ke, importance: -2 };
518
- n.addLabelAsSuffix ? y.push(A) : y.splice(0, 0, A);
501
+ GlobalCfgRenderCtxFeatureFlags: Te,
502
+ MainAccessorName: pe,
503
+ StagingAccessorName: de,
504
+ getAllFutureAwaits: Le,
505
+ isFutureAwait: fe
506
+ }, Symbol.toStringTag, { value: "Module" })), ke = "pl7.app/label", De = "pl7.app/trace", Oe = C.object({
507
+ type: C.string(),
508
+ importance: C.number().optional(),
509
+ id: C.string().optional(),
510
+ label: C.string()
511
+ }), Ee = C.array(Oe), Ve = 1e-3, je = "__LABEL__", se = "__LABEL__@1";
512
+ function re(t, e, n = {}) {
513
+ const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = t.map((f) => {
514
+ var F, ee;
515
+ const g = e(f), h = (F = g.annotations) == null ? void 0 : F[ke], I = (ee = g.annotations) == null ? void 0 : ee[De], y = (I ? Ee.safeParse(JSON.parse(I)).data : void 0) ?? [];
516
+ if (h) {
517
+ const S = { label: h, type: je, importance: -2 };
518
+ n.addLabelAsSuffix ? y.push(S) : y.splice(0, 0, S);
519
519
  }
520
- const F = [], D = /* @__PURE__ */ new Map();
521
- for (let A = y.length - 1; A >= 0; --A) {
522
- const { type: M } = y[A], fe = y[A].importance ?? 0, J = (D.get(M) ?? 0) + 1;
523
- D.set(M, J);
520
+ const R = [], O = /* @__PURE__ */ new Map();
521
+ for (let S = y.length - 1; S >= 0; --S) {
522
+ const { type: M } = y[S], ye = y[S].importance ?? 0, J = (O.get(M) ?? 0) + 1;
523
+ O.set(M, J);
524
524
  const x = `${M}@${J}`;
525
- s.set(x, (s.get(x) ?? 0) + 1), r.set(
525
+ r.set(x, (r.get(x) ?? 0) + 1), s.set(
526
526
  x,
527
527
  Math.max(
528
- r.get(x) ?? Number.NEGATIVE_INFINITY,
529
- fe - (y.length - A) * Oe
528
+ s.get(x) ?? Number.NEGATIVE_INFINITY,
529
+ ye - (y.length - S) * Ve
530
530
  )
531
- ), F.push({ ...y[A], fullType: x, occurenceIndex: J });
531
+ ), R.push({ ...y[S], fullType: x, occurenceIndex: J });
532
532
  }
533
- return F.reverse(), {
534
- value: p,
533
+ return R.reverse(), {
534
+ value: f,
535
535
  spec: g,
536
- label: f,
537
- fullTrace: F
536
+ label: h,
537
+ fullTrace: R
538
538
  };
539
- }), o = [], a = [], l = [...r];
540
- l.sort(([, p], [, g]) => g - p);
541
- for (const [p] of l)
542
- p.endsWith("@1") || s.get(p) === t.length ? o.push(p) : a.push(p);
543
- const u = (p) => i.map((g) => {
544
- const f = g.fullTrace.filter((y) => p.has(y.fullType)).map((y) => y.label), I = n.separator ?? " / ";
539
+ }), o = [], l = [], a = [...s];
540
+ a.sort(([, f], [, g]) => g - f);
541
+ for (const [f] of a)
542
+ f.endsWith("@1") || r.get(f) === t.length ? o.push(f) : l.push(f);
543
+ const u = (f) => i.map((g) => {
544
+ const h = g.fullTrace.filter((y) => f.has(y.fullType)).map((y) => y.label), I = n.separator ?? " / ";
545
545
  return {
546
- label: f.join(I),
546
+ label: h.join(I),
547
547
  value: g.value
548
548
  };
549
549
  });
550
550
  if (o.length === 0) {
551
- if (a.length !== 0) throw new Error("Assertion error.");
552
- return u(new Set(ee));
553
- }
554
- let h = 0, d = 0;
555
- for (; h < o.length; ) {
556
- const p = /* @__PURE__ */ new Set();
557
- n.includeNativeLabel && p.add(ee);
558
- for (let f = 0; f < h; ++f) p.add(o[f]);
559
- p.add(o[d]);
560
- const g = u(p);
561
- if (new Set(g.map((f) => f.label)).size === t.length) return g;
562
- d++, d == o.length && (h++, d = h);
563
- }
564
- return u(/* @__PURE__ */ new Set([...o, ...a]));
565
- }
566
- class De {
551
+ if (l.length !== 0) throw new Error("Assertion error.");
552
+ return u(new Set(se));
553
+ }
554
+ let p = 0, d = 0;
555
+ for (; p < o.length; ) {
556
+ const f = /* @__PURE__ */ new Set();
557
+ n.includeNativeLabel && f.add(se);
558
+ for (let h = 0; h < p; ++h) f.add(o[h]);
559
+ f.add(o[d]);
560
+ const g = u(f);
561
+ if (new Set(g.map((h) => h.label)).size === t.length) return g;
562
+ d++, d == o.length && (p++, d = p);
563
+ }
564
+ return u(/* @__PURE__ */ new Set([...o, ...l]));
565
+ }
566
+ class Ue {
567
567
  constructor() {
568
- S(this, "ctx", c());
569
- S(this, "defaultLabelFn", (e, n) => {
570
- var r;
571
- return ((r = e.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
568
+ A(this, "ctx", c());
569
+ A(this, "defaultLabelFn", (e, n) => {
570
+ var s;
571
+ return ((s = e.annotations) == null ? void 0 : s["pl7.app/label"]) ?? "Unlabelled";
572
572
  });
573
573
  }
574
574
  /**
@@ -578,13 +578,33 @@ class De {
578
578
  return this.ctx.calculateOptions(e);
579
579
  }
580
580
  getOptions(e, n) {
581
- const r = this.getSpecs().entries.filter((s) => e(s.obj));
582
- return typeof n == "object" || typeof n > "u" ? Le(r, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i }) => ({
583
- ref: s,
584
- label: i
585
- })) : r.map((s) => ({
586
- ref: s.ref,
587
- label: n(s.obj, s.ref)
581
+ const s = typeof e == "function" ? e : te(e), r = this.getSpecs().entries.filter((i) => s(i.obj));
582
+ return typeof n == "object" || typeof n > "u" ? re(r, (i) => i.obj, n ?? {}).map(({ value: { ref: i }, label: o }) => ({
583
+ ref: i,
584
+ label: o
585
+ })) : r.map((i) => ({
586
+ ref: i.ref,
587
+ label: n(i.obj, i.ref)
588
+ }));
589
+ }
590
+ // Implementation
591
+ getAnchoredOptions(e, n, s) {
592
+ const r = {};
593
+ if (!(e instanceof $))
594
+ for (const [a, u] of Object.entries(e))
595
+ if (_e(u)) {
596
+ const p = this.getPColumnSpecByRef(u);
597
+ if (!p)
598
+ return;
599
+ r[a] = p;
600
+ } else
601
+ r[a] = u;
602
+ const i = typeof n == "function" ? n : te(
603
+ Array.isArray(n) ? n.map((a) => ne(r, a)) : ne(r, n)
604
+ ), o = this.getSpecs().entries.filter(({ obj: a }) => G(a) ? i(a) : !1), l = e instanceof $ ? e : new $(r);
605
+ return re(o, (a) => a.obj, s ?? {}).map(({ value: { obj: a }, label: u }) => ({
606
+ value: l.deriveString(a),
607
+ label: u
588
608
  }));
589
609
  }
590
610
  /**
@@ -620,9 +640,9 @@ class De {
620
640
  ref: n.ref,
621
641
  obj: {
622
642
  ...n.obj,
623
- data: me(
643
+ data: Ae(
624
644
  n.obj.data,
625
- (r) => new v(r, [n.ref.blockId, n.ref.name])
645
+ (s) => new v(s, [n.ref.blockId, n.ref.name])
626
646
  )
627
647
  }
628
648
  }))
@@ -644,10 +664,10 @@ class De {
644
664
  getDataByRef(e) {
645
665
  var n;
646
666
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
647
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
667
+ (s) => s.ref.blockId === e.blockId && s.ref.name === e.name
648
668
  )) == null ? void 0 : n.obj : U(
649
669
  this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
650
- (r) => new v(r, [e.blockId, e.name])
670
+ (s) => new v(s, [e.blockId, e.name])
651
671
  );
652
672
  }
653
673
  /**
@@ -658,7 +678,7 @@ class De {
658
678
  getPColumnByRef(e) {
659
679
  const n = this.getDataByRef(e);
660
680
  if (n)
661
- return ye(n);
681
+ return Se(n);
662
682
  }
663
683
  /**
664
684
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -668,7 +688,7 @@ class De {
668
688
  getPColumnSpecByRef(e) {
669
689
  const n = this.getSpecByRef(e);
670
690
  if (n) {
671
- if (!Z(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
691
+ if (!G(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
672
692
  return n;
673
693
  }
674
694
  }
@@ -677,10 +697,7 @@ class De {
677
697
  * @returns object spec associated with the ref
678
698
  */
679
699
  getSpecByRef(e) {
680
- var n;
681
- return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
682
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
683
- )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
700
+ return this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
684
701
  }
685
702
  /**
686
703
  * @param spec object specification
@@ -689,23 +706,23 @@ class De {
689
706
  */
690
707
  findDataWithCompatibleSpec(e) {
691
708
  const n = [];
692
- e: for (const r of this.getData().entries) {
693
- if (!Z(r.obj.spec))
709
+ e: for (const s of this.getData().entries) {
710
+ if (!G(s.obj.spec))
694
711
  continue;
695
- const s = r.obj.spec;
696
- if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && z(e.domain, s.domain)) {
712
+ const r = s.obj.spec;
713
+ if (e.name === r.name && e.valueType === r.valueType && e.axesSpec.length === r.axesSpec.length && X(e.domain, r.domain)) {
697
714
  for (let i = 0; i < e.axesSpec.length; ++i) {
698
- const o = e.axesSpec[i], a = s.axesSpec[i];
699
- if (o.name !== a.name || o.type !== a.type || !z(o.domain, a.domain))
715
+ const o = e.axesSpec[i], l = r.axesSpec[i];
716
+ if (o.name !== l.name || o.type !== l.type || !X(o.domain, l.domain))
700
717
  continue e;
701
718
  }
702
- n.push(r.obj);
719
+ n.push(s.obj);
703
720
  }
704
721
  }
705
722
  return n;
706
723
  }
707
724
  }
708
- function z(t, e) {
725
+ function X(t, e) {
709
726
  if (t === void 0) return e === void 0;
710
727
  if (e === void 0) return !0;
711
728
  for (const n in e)
@@ -714,12 +731,12 @@ function z(t, e) {
714
731
  }
715
732
  class V {
716
733
  constructor() {
717
- S(this, "ctx");
718
- S(this, "args");
719
- S(this, "uiState");
734
+ A(this, "ctx");
735
+ A(this, "args");
736
+ A(this, "uiState");
720
737
  // lazy rendering because this feature is rarely used
721
- S(this, "_activeArgsCache");
722
- S(this, "resultPool", new De());
738
+ A(this, "_activeArgsCache");
739
+ A(this, "resultPool", new Ue());
723
740
  this.ctx = c(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
724
741
  }
725
742
  /**
@@ -736,16 +753,16 @@ class V {
736
753
  // return this.ctx.featureFlags;
737
754
  // }
738
755
  getNamedAccessor(e) {
739
- return H(
756
+ return z(
740
757
  this.ctx.getAccessorHandleByName(e),
741
758
  (n) => new v(n, [e])
742
759
  );
743
760
  }
744
761
  get prerun() {
745
- return this.getNamedAccessor(ae);
762
+ return this.getNamedAccessor(de);
746
763
  }
747
764
  get outputs() {
748
- return this.getNamedAccessor(le);
765
+ return this.getNamedAccessor(pe);
749
766
  }
750
767
  /**
751
768
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -753,43 +770,43 @@ class V {
753
770
  */
754
771
  findLabels(e) {
755
772
  const n = this.resultPool.getData();
756
- for (const r of n.entries) {
757
- if (!N(r.obj)) continue;
758
- const s = r.obj.spec;
759
- if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && z(e.domain, s.axesSpec[0].domain)) {
760
- if (r.obj.data.resourceType.name !== "PColumnData/Json")
761
- throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
773
+ for (const s of n.entries) {
774
+ if (!N(s.obj)) continue;
775
+ const r = s.obj.spec;
776
+ if (r.name === "pl7.app/label" && r.axesSpec.length === 1 && r.axesSpec[0].name === e.name && r.axesSpec[0].type === e.type && X(e.domain, r.axesSpec[0].domain)) {
777
+ if (s.obj.data.resourceType.name !== "PColumnData/Json")
778
+ throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);
762
779
  return Object.fromEntries(
763
780
  Object.entries(
764
- r.obj.data.getDataAsJson().data
781
+ s.obj.data.getDataAsJson().data
765
782
  ).map((o) => [JSON.parse(o[0])[0], o[1]])
766
783
  );
767
784
  }
768
785
  }
769
786
  }
770
787
  verifyInlineColumnsSupport(e) {
771
- var s;
772
- const n = e.some((i) => !(i.data instanceof v)), r = ((s = this.ctx.featureFlags) == null ? void 0 : s.inlineColumnsSupport) === !0;
773
- if (n && !r) throw Error("inline columns not supported");
788
+ var r;
789
+ const n = e.some((i) => !(i.data instanceof v)), s = ((r = this.ctx.featureFlags) == null ? void 0 : r.inlineColumnsSupport) === !0;
790
+ if (n && !s) throw Error("inline columns not supported");
774
791
  }
775
792
  createPFrame(e) {
776
793
  return this.verifyInlineColumnsSupport(e), this.ctx.createPFrame(
777
- e.map((n) => U(n, (r) => r instanceof v ? r.handle : r))
794
+ e.map((n) => U(n, (s) => s instanceof v ? s.handle : s))
778
795
  );
779
796
  }
780
797
  createPTable(e) {
781
- var n;
798
+ let n;
782
799
  return "columns" in e ? n = {
783
800
  src: {
784
801
  type: "full",
785
- entries: e.columns.map((r) => ({ type: "column", column: r }))
802
+ entries: e.columns.map((s) => ({ type: "column", column: s }))
786
803
  },
787
804
  filters: e.filters ?? [],
788
805
  sorting: e.sorting ?? []
789
- } : n = e, this.verifyInlineColumnsSupport(be(n.src)), this.ctx.createPTable(
790
- ve(
806
+ } : n = e, this.verifyInlineColumnsSupport(we(n.src)), this.ctx.createPTable(
807
+ Ie(
791
808
  n,
792
- (r) => U(r, (s) => s instanceof v ? s.handle : s)
809
+ (s) => U(s, (r) => r instanceof v ? r.handle : r)
793
810
  )
794
811
  );
795
812
  }
@@ -802,30 +819,30 @@ class V {
802
819
  return this.ctx.getCurrentUnstableMarker();
803
820
  }
804
821
  }
805
- const L = "PColumnData/", Y = L + "ResourceMap", X = L + "Partitioned/ResourceMap", te = L + "JsonPartitioned", G = L + "BinaryPartitioned", ce = L + "Partitioned/", ne = ce + "JsonPartitioned", W = ce + "BinaryPartitioned";
806
- function de(t, e, n, r = [], s) {
822
+ const D = "PColumnData/", Q = D + "ResourceMap", Z = D + "Partitioned/ResourceMap", ie = D + "JsonPartitioned", K = D + "BinaryPartitioned", he = D + "Partitioned/", oe = he + "JsonPartitioned", H = he + "BinaryPartitioned";
823
+ function ge(t, e, n, s = [], r) {
807
824
  if (t === void 0) return !1;
808
825
  switch (t.resourceType.name) {
809
- case Y: {
826
+ case Q: {
810
827
  let i = t.getInputsLocked();
811
828
  for (const o of t.listInputFields()) {
812
- const a = t.resolve({ field: o, assertFieldType: "Input" }), l = [...r, ...JSON.parse(o)], u = a === void 0 ? void 0 : e(a);
813
- u === void 0 && (i = !1), (u !== void 0 || s) && n.push({ key: l, value: u });
829
+ const l = t.resolve({ field: o, assertFieldType: "Input" }), a = [...s, ...JSON.parse(o)], u = l === void 0 ? void 0 : e(l);
830
+ u === void 0 && (i = !1), (u !== void 0 || r) && n.push({ key: a, value: u });
814
831
  }
815
832
  return i;
816
833
  }
817
- case X: {
834
+ case Z: {
818
835
  let i = t.getInputsLocked();
819
836
  for (const o of t.listInputFields()) {
820
- const a = t.resolve({ field: o, assertFieldType: "Input" });
821
- if (a === void 0) i = !1;
837
+ const l = t.resolve({ field: o, assertFieldType: "Input" });
838
+ if (l === void 0) i = !1;
822
839
  else {
823
- const l = [...r, ...JSON.parse(o)], u = de(
824
- a,
840
+ const a = [...s, ...JSON.parse(o)], u = ge(
841
+ l,
825
842
  e,
826
843
  n,
827
- l,
828
- s
844
+ a,
845
+ r
829
846
  );
830
847
  i = i && u;
831
848
  }
@@ -836,155 +853,155 @@ function de(t, e, n, r = [], s) {
836
853
  throw new Error(`Unknown resource type: ${t.resourceType.name}`);
837
854
  }
838
855
  }
839
- function It(t, e, n = !1) {
840
- const r = [];
841
- return { isComplete: de(t, e, r, [], n), data: r };
856
+ function Ft(t, e, n = !1) {
857
+ const s = [];
858
+ return { isComplete: ge(t, e, s, [], n), data: s };
842
859
  }
843
- const re = (t) => {
860
+ const ae = (t) => {
844
861
  if (!t.endsWith(".index")) {
845
862
  if (t.endsWith(".values"))
846
863
  return t.substring(0, t.length - 7);
847
864
  throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
848
865
  }
849
866
  };
850
- function Ee(t) {
867
+ function Be(t) {
851
868
  if (!t) return;
852
- const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
853
- let s = 0;
869
+ const e = t.resourceType.name, n = t.getDataAsJson(), s = [];
870
+ let r = 0;
854
871
  switch (e) {
855
- case Y:
856
- s = n.keyLength;
872
+ case Q:
873
+ r = n.keyLength;
857
874
  break;
858
- case X:
859
- s = n.partitionKeyLength + n.keyLength;
875
+ case Z:
876
+ r = n.partitionKeyLength + n.keyLength;
860
877
  break;
861
- case te:
862
- case G:
863
- s = n.partitionKeyLength;
878
+ case ie:
879
+ case K:
880
+ r = n.partitionKeyLength;
864
881
  break;
865
- case W:
866
- case ne:
867
- s = n.superPartitionKeyLength + n.partitionKeyLength;
882
+ case H:
883
+ case oe:
884
+ r = n.superPartitionKeyLength + n.partitionKeyLength;
868
885
  break;
869
886
  }
870
887
  switch (e) {
871
- case Y:
872
- case te:
873
- case G:
888
+ case Q:
889
+ case ie:
890
+ case K:
874
891
  for (let i of t.listInputFields()) {
875
- if (e === G) {
876
- const a = re(i);
877
- if (a) i = a;
892
+ if (e === K) {
893
+ const l = ae(i);
894
+ if (l) i = l;
878
895
  else continue;
879
896
  }
880
897
  const o = [...JSON.parse(i)];
881
- r.push(o);
898
+ s.push(o);
882
899
  }
883
900
  break;
884
- case X:
885
- case W:
886
- case ne:
901
+ case Z:
902
+ case H:
903
+ case oe:
887
904
  for (const i of t.listInputFields()) {
888
- const o = [...JSON.parse(i)], a = t.resolve({ field: i, assertFieldType: "Input" });
889
- if (a !== void 0)
890
- for (let l of a.listInputFields()) {
891
- if (e === W) {
892
- const h = re(l);
893
- if (h) l = h;
905
+ const o = [...JSON.parse(i)], l = t.resolve({ field: i, assertFieldType: "Input" });
906
+ if (l !== void 0)
907
+ for (let a of l.listInputFields()) {
908
+ if (e === H) {
909
+ const p = ae(a);
910
+ if (p) a = p;
894
911
  else continue;
895
912
  }
896
- const u = [...o, ...JSON.parse(l)];
897
- r.push(u);
913
+ const u = [...o, ...JSON.parse(a)];
914
+ s.push(u);
898
915
  }
899
916
  }
900
917
  break;
901
918
  }
902
- return { data: r, keyLength: s };
919
+ return { data: s, keyLength: r };
903
920
  }
904
- function Ct(t) {
905
- const e = Ee(t);
921
+ function xt(t) {
922
+ const e = Be(t);
906
923
  if (!e) return;
907
- const { data: n, keyLength: r } = e, s = [];
908
- for (let i = 0; i < r; ++i)
909
- s.push(/* @__PURE__ */ new Set());
924
+ const { data: n, keyLength: s } = e, r = [];
925
+ for (let i = 0; i < s; ++i)
926
+ r.push(/* @__PURE__ */ new Set());
910
927
  for (const i of n) {
911
- if (i.length !== r)
928
+ if (i.length !== s)
912
929
  throw new Error("key length does not match partition length");
913
- for (let o = 0; o < r; ++o)
914
- s[o].add(i[o]);
930
+ for (let o = 0; o < s; ++o)
931
+ r[o].add(i[o]);
915
932
  }
916
- return s.map((i) => Array.from(i.values()));
933
+ return r.map((i) => Array.from(i.values()));
917
934
  }
918
- const T = "1.22.97";
919
- function Ve(t) {
935
+ const T = "1.23.0";
936
+ function Ne(t) {
920
937
  return t.__renderLambda === !0;
921
938
  }
922
- function K(t) {
939
+ function q(t) {
923
940
  if (t !== void 0)
924
- return Ve(t) ? t.handle : t;
941
+ return Ne(t) ? t.handle : t;
925
942
  }
926
- function C(t) {
943
+ function P(t) {
927
944
  if (t !== void 0)
928
945
  return typeof t == "string" ? { __renderLambda: !0, handle: t, retentive: !1 } : t;
929
946
  }
930
- function Pt(t) {
947
+ function Tt(t) {
931
948
  if (t.v3 !== void 0) {
932
949
  const {
933
950
  initialArgs: e,
934
951
  initialUiState: n,
935
- inputsValid: r,
936
- outputs: s,
952
+ inputsValid: s,
953
+ outputs: r,
937
954
  renderingMode: i,
938
955
  sdkVersion: o,
939
- sections: a,
940
- title: l
956
+ sections: l,
957
+ title: a
941
958
  } = t.v3, { code: u } = t;
942
959
  return {
943
960
  initialArgs: e,
944
961
  initialUiState: n,
945
- inputsValid: r,
946
- outputs: s,
962
+ inputsValid: s,
963
+ outputs: r,
947
964
  renderingMode: i,
948
965
  sdkVersion: o,
949
- sections: a,
950
- title: l,
966
+ sections: l,
967
+ title: a,
951
968
  code: u
952
969
  };
953
970
  } else if (t.inputsValid !== void 0) {
954
- const { sdkVersion: e, renderingMode: n, outputs: r, inputsValid: s, sections: i, initialArgs: o, code: a } = t, l = Object.keys(t);
955
- if (e === void 0 || n === void 0 || r === void 0 || s === void 0 || i === void 0 || o === void 0)
971
+ const { sdkVersion: e, renderingMode: n, outputs: s, inputsValid: r, sections: i, initialArgs: o, code: l } = t, a = Object.keys(t);
972
+ if (e === void 0 || n === void 0 || s === void 0 || r === void 0 || i === void 0 || o === void 0)
956
973
  throw new Error(
957
- `Malformed config v2. SDK version ${e}; Fields = ${l.join(", ")}`
974
+ `Malformed config v2. SDK version ${e}; Fields = ${a.join(", ")}`
958
975
  );
959
976
  return {
960
977
  sdkVersion: e,
961
978
  renderingMode: n,
962
979
  initialArgs: o,
963
980
  outputs: Object.fromEntries(
964
- Object.entries(r).map(([u, h]) => [u, C(h)])
981
+ Object.entries(s).map(([u, p]) => [u, P(p)])
965
982
  ),
966
- inputsValid: C(s),
967
- sections: C(i),
983
+ inputsValid: P(r),
984
+ sections: P(i),
968
985
  initialUiState: void 0,
969
- code: a
986
+ code: l
970
987
  };
971
988
  } else if (t.renderingMode !== void 0) {
972
- const { sdkVersion: e, canRun: n, renderingMode: r, outputs: s, sections: i, initialArgs: o, code: a } = t, l = Object.keys(t);
973
- if (r === void 0 || s === void 0 || n === void 0 || i === void 0 || o === void 0)
989
+ const { sdkVersion: e, canRun: n, renderingMode: s, outputs: r, sections: i, initialArgs: o, code: l } = t, a = Object.keys(t);
990
+ if (s === void 0 || r === void 0 || n === void 0 || i === void 0 || o === void 0)
974
991
  throw new Error(
975
- `Malformed config v1. SDK version ${e}; Fields = ${l.join(", ")}`
992
+ `Malformed config v1. SDK version ${e}; Fields = ${a.join(", ")}`
976
993
  );
977
994
  return {
978
995
  sdkVersion: e ?? "unknown",
979
- renderingMode: r,
996
+ renderingMode: s,
980
997
  initialArgs: o,
981
998
  outputs: Object.fromEntries(
982
- Object.entries(s).map(([u, h]) => [u, C(h)])
999
+ Object.entries(r).map(([u, p]) => [u, P(p)])
983
1000
  ),
984
- inputsValid: C(n),
985
- sections: C(i),
1001
+ inputsValid: P(n),
1002
+ sections: P(i),
986
1003
  initialUiState: void 0,
987
- code: a
1004
+ code: l
988
1005
  };
989
1006
  } else {
990
1007
  const { sdkVersion: e } = t, n = Object.keys(t);
@@ -994,8 +1011,8 @@ function Pt(t) {
994
1011
  }
995
1012
  }
996
1013
  class _ {
997
- constructor(e, n, r, s, i, o, a) {
998
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i, this._sections = o, this._title = a;
1014
+ constructor(e, n, s, r, i, o, l) {
1015
+ this._renderingMode = e, this._initialArgs = n, this._initialUiState = s, this._outputs = r, this._inputsValid = i, this._sections = o, this._title = l;
999
1016
  }
1000
1017
  static create(e = "Heavy") {
1001
1018
  return new _(
@@ -1008,10 +1025,10 @@ class _ {
1008
1025
  void 0
1009
1026
  );
1010
1027
  }
1011
- output(e, n, r = {}) {
1028
+ output(e, n, s = {}) {
1012
1029
  if (typeof n == "function") {
1013
- const s = `output#${e}`;
1014
- return E(s, () => n(new V())), new _(
1030
+ const r = `output#${e}`;
1031
+ return E(r, () => n(new V())), new _(
1015
1032
  this._renderingMode,
1016
1033
  this._initialArgs,
1017
1034
  this._initialUiState,
@@ -1019,8 +1036,8 @@ class _ {
1019
1036
  ...this._outputs,
1020
1037
  [e]: {
1021
1038
  __renderLambda: !0,
1022
- handle: s,
1023
- ...r
1039
+ handle: r,
1040
+ ...s
1024
1041
  }
1025
1042
  },
1026
1043
  this._inputsValid,
@@ -1157,44 +1174,44 @@ class _ {
1157
1174
  sdkVersion: T,
1158
1175
  renderingMode: this._renderingMode,
1159
1176
  initialArgs: this._initialArgs,
1160
- inputsValid: K(this._inputsValid),
1161
- sections: K(this._sections),
1177
+ inputsValid: q(this._inputsValid),
1178
+ sections: q(this._sections),
1162
1179
  outputs: Object.fromEntries(
1163
- Object.entries(this._outputs).map(([n, r]) => [n, K(r)])
1180
+ Object.entries(this._outputs).map(([n, s]) => [n, q(s)])
1164
1181
  )
1165
1182
  };
1166
- return Ae() ? oe({ sdkVersion: T }) : { config: e };
1183
+ return Re() ? ce({ sdkVersion: T }) : { config: e };
1167
1184
  }
1168
1185
  }
1169
- function Ft(t, e, n, r) {
1170
- var u, h;
1171
- Array.isArray(r) && (r = { filters: r });
1172
- const s = t.resultPool.getData().entries.map((d) => d.obj).filter(N).filter((d) => d.spec.name === "pl7.app/label" && d.spec.axesSpec.length === 1), i = (d, p) => {
1186
+ function Lt(t, e, n, s) {
1187
+ var u, p;
1188
+ Array.isArray(s) && (s = { filters: s });
1189
+ const r = t.resultPool.getData().entries.map((d) => d.obj).filter(N).filter((d) => d.spec.name === "pl7.app/label" && d.spec.axesSpec.length === 1), i = (d, f) => {
1173
1190
  let g = d.toString();
1174
- if (p)
1175
- for (const f in p)
1176
- g += f, g += p[f];
1191
+ if (f)
1192
+ for (const h in f)
1193
+ g += h, g += f[h];
1177
1194
  return g;
1178
1195
  }, o = /* @__PURE__ */ new Map();
1179
1196
  for (const d of e)
1180
- for (const p of d.spec.axesSpec) {
1181
- const g = w(p);
1182
- for (const f of s) {
1183
- const I = f.spec.axesSpec[0], y = w(f.spec.axesSpec[0]);
1184
- if (O(g, y)) {
1185
- const F = Object.keys(g.domain ?? {}).length, D = Object.keys(y.domain ?? {}).length;
1186
- if (F > D) {
1187
- const R = i(f.id, g.domain);
1188
- o.set(R, {
1189
- id: R,
1197
+ for (const f of d.spec.axesSpec) {
1198
+ const g = w(f);
1199
+ for (const h of r) {
1200
+ const I = h.spec.axesSpec[0], y = w(h.spec.axesSpec[0]);
1201
+ if (L(g, y)) {
1202
+ const R = Object.keys(g.domain ?? {}).length, O = Object.keys(y.domain ?? {}).length;
1203
+ if (R > O) {
1204
+ const F = i(h.id, g.domain);
1205
+ o.set(F, {
1206
+ id: F,
1190
1207
  spec: {
1191
- ...f.spec,
1208
+ ...h.spec,
1192
1209
  axesSpec: [{ ...g, annotations: I.annotations }]
1193
1210
  },
1194
- data: f.data
1211
+ data: h.data
1195
1212
  });
1196
1213
  } else
1197
- o.set(i(f.id), f);
1214
+ o.set(i(h.id), h);
1198
1215
  }
1199
1216
  }
1200
1217
  }
@@ -1202,114 +1219,114 @@ function Ft(t, e, n, r) {
1202
1219
  (d) => d.data instanceof v && !d.data.getIsReadyOrError()
1203
1220
  ))
1204
1221
  return;
1205
- let a = e;
1206
- const l = [];
1207
- if (r != null && r.coreColumnPredicate) {
1208
- a = [];
1222
+ let l = e;
1223
+ const a = [];
1224
+ if (s != null && s.coreColumnPredicate) {
1225
+ l = [];
1209
1226
  for (const d of e)
1210
- r.coreColumnPredicate(d.spec) ? a.push(d) : l.push(d);
1227
+ s.coreColumnPredicate(d.spec) ? l.push(d) : a.push(d);
1211
1228
  }
1212
- return l.push(...o.values()), t.createPTable({
1229
+ return a.push(...o.values()), t.createPTable({
1213
1230
  src: {
1214
1231
  type: "outer",
1215
1232
  primary: {
1216
- type: (r == null ? void 0 : r.coreJoinType) ?? "full",
1217
- entries: a.map((d) => ({ type: "column", column: d }))
1233
+ type: (s == null ? void 0 : s.coreJoinType) ?? "full",
1234
+ entries: l.map((d) => ({ type: "column", column: d }))
1218
1235
  },
1219
- secondary: l.map((d) => ({ type: "column", column: d }))
1236
+ secondary: a.map((d) => ({ type: "column", column: d }))
1220
1237
  },
1221
- filters: [...(r == null ? void 0 : r.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []],
1222
- sorting: ((h = n == null ? void 0 : n.pTableParams) == null ? void 0 : h.sorting) ?? []
1238
+ filters: [...(s == null ? void 0 : s.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []],
1239
+ sorting: ((p = n == null ? void 0 : n.pTableParams) == null ? void 0 : p.sorting) ?? []
1223
1240
  });
1224
1241
  }
1225
- function Rt(t, e, n) {
1226
- const r = t.findLabels(e);
1242
+ function kt(t, e, n) {
1243
+ const s = t.findLabels(e);
1227
1244
  return {
1228
1245
  axis: e,
1229
- options: n.map((s) => ({
1230
- value: s,
1231
- label: (r == null ? void 0 : r[s]) ?? s.toString()
1246
+ options: n.map((r) => ({
1247
+ value: r,
1248
+ label: (s == null ? void 0 : s[r]) ?? r.toString()
1232
1249
  })),
1233
1250
  defaultValue: n[0]
1234
1251
  };
1235
1252
  }
1236
- const je = (t, e) => {
1253
+ const Me = (t, e) => {
1237
1254
  let n = t.toString();
1238
- return e == null || e.forEach((r) => {
1239
- if (r)
1240
- for (const [s, i] of Object.entries(r))
1241
- n += s, n += i;
1255
+ return e == null || e.forEach((s) => {
1256
+ if (s)
1257
+ for (const [r, i] of Object.entries(s))
1258
+ n += r, n += i;
1242
1259
  }), n;
1243
1260
  };
1244
- function Ue(t) {
1261
+ function Je(t) {
1245
1262
  if (!t.length)
1246
1263
  return [];
1247
1264
  let e = [[]];
1248
1265
  return t.forEach((n) => {
1249
- const r = [];
1250
- n.forEach((s) => {
1251
- r.push(...e.map((i) => [...i, s]));
1252
- }), e = r;
1266
+ const s = [];
1267
+ n.forEach((r) => {
1268
+ s.push(...e.map((i) => [...i, r]));
1269
+ }), e = s;
1253
1270
  }), e;
1254
1271
  }
1255
- function Be(t, e) {
1272
+ function $e(t, e) {
1256
1273
  const n = t.spec.axesSpec.map(w);
1257
- return e.spec.axesSpec.map(w).every((s) => n.some((i) => O(i, s) && O(s, i)));
1274
+ return e.spec.axesSpec.map(w).every((r) => n.some((i) => L(i, r) && L(r, i)));
1258
1275
  }
1259
- function pe(t, e) {
1276
+ function me(t, e) {
1260
1277
  const n = t.spec.axesSpec.map(w);
1261
- return e.spec.axesSpec.map(w).every((s) => n.some((i) => O(i, s)));
1278
+ return e.spec.axesSpec.map(w).every((r) => n.some((i) => L(i, r)));
1262
1279
  }
1263
- const Ne = "pl7.app/graph/isVirtual";
1264
- function se(t, e) {
1265
- const n = t.spec.axesSpec.map(w), r = e.spec.axesSpec.map(w);
1266
- if (Be(t, e))
1280
+ const Ge = "pl7.app/graph/isVirtual";
1281
+ function le(t, e) {
1282
+ const n = t.spec.axesSpec.map(w), s = e.spec.axesSpec.map(w);
1283
+ if ($e(t, e))
1267
1284
  return [];
1268
- if (!pe(t, e))
1285
+ if (!me(t, e))
1269
1286
  return [];
1270
- const o = r.map((l) => n.filter((u) => O(u, l)));
1271
- return Ue(o).map((l) => ({
1272
- id: je(e.id, l.map((h) => h.domain)),
1287
+ const o = s.map((a) => n.filter((u) => L(u, a)));
1288
+ return Je(o).map((a) => ({
1289
+ id: Me(e.id, a.map((p) => p.domain)),
1273
1290
  spec: {
1274
1291
  ...e.spec,
1275
- axesSpec: l.map((h, d) => ({
1276
- ...h,
1292
+ axesSpec: a.map((p, d) => ({
1293
+ ...p,
1277
1294
  annotations: e.spec.axesSpec[d].annotations
1278
1295
  })),
1279
1296
  annotations: {
1280
1297
  ...e.spec.annotations,
1281
- [Ne]: "true"
1298
+ [Ge]: "true"
1282
1299
  }
1283
1300
  },
1284
1301
  data: e.data
1285
1302
  }));
1286
1303
  }
1287
- function Me(t) {
1304
+ function We(t) {
1288
1305
  const e = [];
1289
1306
  for (let n = 0; n < t.length; n++)
1290
- for (let r = n + 1; r < t.length; r++) {
1291
- const s = t[n], i = t[r];
1307
+ for (let s = n + 1; s < t.length; s++) {
1308
+ const r = t[n], i = t[s];
1292
1309
  e.push(
1293
- ...se(s, i),
1294
- ...se(i, s)
1310
+ ...le(r, i),
1311
+ ...le(i, r)
1295
1312
  );
1296
1313
  }
1297
1314
  return e;
1298
1315
  }
1299
- function Je(t, e) {
1316
+ function Ke(t, e) {
1300
1317
  const n = [...t];
1301
- for (const r of e)
1302
- for (const s of t) {
1303
- if (s.id === r.id)
1318
+ for (const s of e)
1319
+ for (const r of t) {
1320
+ if (r.id === s.id)
1304
1321
  break;
1305
- if (pe(s, r)) {
1306
- n.push(r);
1322
+ if (me(r, s)) {
1323
+ n.push(s);
1307
1324
  break;
1308
1325
  }
1309
1326
  }
1310
1327
  return n;
1311
1328
  }
1312
- const $e = [
1329
+ const He = [
1313
1330
  "Int",
1314
1331
  "Long",
1315
1332
  "Float",
@@ -1317,15 +1334,15 @@ const $e = [
1317
1334
  "String",
1318
1335
  "Bytes"
1319
1336
  ];
1320
- function xt(t, e) {
1337
+ function Dt(t, e) {
1321
1338
  if (e === void 0) return;
1322
- const n = t.resultPool.getData().entries.map((i) => i.obj).filter(N).filter((i) => $e.includes(i.spec.valueType)), r = Je(e, n), s = [...r, ...Me(r)];
1323
- if (!s.some(
1339
+ const n = t.resultPool.getData().entries.map((i) => i.obj).filter(N).filter((i) => He.includes(i.spec.valueType)), s = Ke(e, n), r = [...s, ...We(s)];
1340
+ if (!r.some(
1324
1341
  (i) => i.data instanceof v && !i.data.getIsReadyOrError()
1325
1342
  ))
1326
- return t.createPFrame(s);
1343
+ return t.createPFrame(r);
1327
1344
  }
1328
- class Tt {
1345
+ class Ot {
1329
1346
  constructor(e) {
1330
1347
  this.handle = e;
1331
1348
  }
@@ -1345,100 +1362,100 @@ class Tt {
1345
1362
  return await platforma.pFrameDriver.getUniqueValues(this.handle, e);
1346
1363
  }
1347
1364
  }
1348
- function Ge(t) {
1349
- return ie({
1365
+ function qe(t) {
1366
+ return ue({
1350
1367
  __isRef: !0,
1351
1368
  blockId: B(t, "blockId"),
1352
1369
  name: B(t, "name")
1353
1370
  });
1354
1371
  }
1355
- function Ot(t) {
1356
- return ie({
1357
- ref: Ge(B(t, "ref")),
1372
+ function Et(t) {
1373
+ return ue({
1374
+ ref: qe(B(t, "ref")),
1358
1375
  label: B(t, "label")
1359
1376
  });
1360
1377
  }
1361
- const kt = {
1378
+ const Vt = {
1362
1379
  sdkVersion: T
1363
1380
  };
1364
- function Lt() {
1365
- return oe({ sdkVersion: T });
1381
+ function jt() {
1382
+ return ce({ sdkVersion: T });
1366
1383
  }
1367
- function Dt(t) {
1384
+ function Ut(t) {
1368
1385
  if (typeof globalThis.getEnvironmentValue == "function")
1369
1386
  return globalThis.getEnvironmentValue(t);
1370
1387
  }
1371
1388
  export {
1372
- Ye as Args,
1389
+ et as Args,
1373
1390
  _ as BlockModel,
1374
- kt as CurrentSdkInfo,
1391
+ Vt as CurrentSdkInfo,
1375
1392
  b as FutureRef,
1376
- Ne as IS_VIRTUAL_COLUMN,
1377
- Xe as It,
1378
- wt as JsRenderInternal,
1379
- Qe as MainOutputs,
1380
- _e as OutputError,
1381
- Fe as PAnnotationLabel,
1382
- Re as PAnnotationTrace,
1383
- Tt as PFrameImpl,
1384
- G as RT_BINARY_PARTITIONED,
1385
- W as RT_BINARY_SUPER_PARTITIONED,
1386
- te as RT_JSON_PARTITIONED,
1387
- ne as RT_JSON_SUPER_PARTITIONED,
1388
- Y as RT_RESOURCE_MAP,
1389
- X as RT_RESOURCE_MAP_PARTITIONED,
1393
+ Ge as IS_VIRTUAL_COLUMN,
1394
+ tt as It,
1395
+ Rt as JsRenderInternal,
1396
+ nt as MainOutputs,
1397
+ Pe as OutputError,
1398
+ ke as PAnnotationLabel,
1399
+ De as PAnnotationTrace,
1400
+ Ot as PFrameImpl,
1401
+ K as RT_BINARY_PARTITIONED,
1402
+ H as RT_BINARY_SUPER_PARTITIONED,
1403
+ ie as RT_JSON_PARTITIONED,
1404
+ oe as RT_JSON_SUPER_PARTITIONED,
1405
+ Q as RT_RESOURCE_MAP,
1406
+ Z as RT_RESOURCE_MAP_PARTITIONED,
1390
1407
  V as RenderCtx,
1391
- De as ResultPool,
1392
- Ze as StagingOutputs,
1393
- Te as Trace,
1394
- xe as TraceEntry,
1408
+ Ue as ResultPool,
1409
+ st as StagingOutputs,
1410
+ Ee as Trace,
1411
+ Oe as TraceEntry,
1395
1412
  v as TreeNodeAccessor,
1396
- et as UiState,
1397
- at as and,
1398
- xt as createPFrameForGraphs,
1399
- Ft as createPlDataTable,
1400
- Rt as createPlDataTableSheet,
1401
- Le as deriveLabels,
1402
- K as downgradeCfgOrLambda,
1403
- Je as enrichColumnsWithCompatible,
1404
- yt as extractArchiveAndGetURL,
1405
- Pt as extractConfig,
1406
- st as flatten,
1407
- Ot as fromPlOption,
1408
- Ge as fromPlRef,
1409
- Me as getAdditionalColumns,
1410
- pt as getBlobContent,
1411
- ht as getBlobContentAsJson,
1412
- ft as getBlobContentAsString,
1413
- gt as getDownloadedBlobContent,
1414
- Dt as getEnvironmentValue,
1413
+ rt as UiState,
1414
+ dt as and,
1415
+ Dt as createPFrameForGraphs,
1416
+ Lt as createPlDataTable,
1417
+ kt as createPlDataTableSheet,
1418
+ re as deriveLabels,
1419
+ q as downgradeCfgOrLambda,
1420
+ Ke as enrichColumnsWithCompatible,
1421
+ At as extractArchiveAndGetURL,
1422
+ Tt as extractConfig,
1423
+ lt as flatten,
1424
+ Et as fromPlOption,
1425
+ qe as fromPlRef,
1426
+ We as getAdditionalColumns,
1427
+ mt as getBlobContent,
1428
+ bt as getBlobContentAsJson,
1429
+ yt as getBlobContentAsString,
1430
+ vt as getDownloadedBlobContent,
1431
+ Ut as getEnvironmentValue,
1415
1432
  k as getFromCfg,
1416
1433
  j as getImmediate,
1417
- bt as getImportProgress,
1434
+ St as getImportProgress,
1418
1435
  B as getJsonField,
1419
- vt as getLastLogs,
1420
- At as getLogHandle,
1421
- mt as getOnDemandBlobContent,
1422
- Ee as getPartitionKeysList,
1423
- _t as getProgressLog,
1424
- St as getProgressLogWithInfo,
1425
- Lt as getRawPlatformaInstance,
1426
- ut as getResourceField,
1427
- ct as getResourceValueAsJson,
1428
- Ct as getUniquePartitionKeys,
1429
- H as ifDef,
1430
- Ve as isConfigLambda,
1431
- it as isEmpty,
1432
- ze as isolate,
1433
- tt as makeArray,
1434
- ie as makeObject,
1435
- rt as mapArrayValues,
1436
- nt as mapRecordValues,
1437
- dt as mapResourceFields,
1438
- ot as not,
1439
- lt as or,
1440
- It as parseResourceMap,
1441
- Se as readOutput,
1442
- qe as wrapOutputs
1436
+ wt as getLastLogs,
1437
+ Ct as getLogHandle,
1438
+ _t as getOnDemandBlobContent,
1439
+ Be as getPartitionKeysList,
1440
+ It as getProgressLog,
1441
+ Pt as getProgressLogWithInfo,
1442
+ jt as getRawPlatformaInstance,
1443
+ ft as getResourceField,
1444
+ ht as getResourceValueAsJson,
1445
+ xt as getUniquePartitionKeys,
1446
+ z as ifDef,
1447
+ Ne as isConfigLambda,
1448
+ ut as isEmpty,
1449
+ Ze as isolate,
1450
+ it as makeArray,
1451
+ ue as makeObject,
1452
+ at as mapArrayValues,
1453
+ ot as mapRecordValues,
1454
+ gt as mapResourceFields,
1455
+ ct as not,
1456
+ pt as or,
1457
+ Ft as parseResourceMap,
1458
+ Ce as readOutput,
1459
+ Qe as wrapOutputs
1443
1460
  };
1444
1461
  //# sourceMappingURL=index.mjs.map