@milaboratories/milaboratories.ui-examples.model 1.1.21 → 1.1.23

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/bundle.js CHANGED
@@ -2,6 +2,40 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.model = {}));
3
3
  })(this, function(exports2) {
4
4
  "use strict";
5
+ function getDefaultExportFromCjs(x2) {
6
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
7
+ }
8
+ var canonicalize = function serialize(object) {
9
+ if (typeof object === "number" && isNaN(object)) {
10
+ throw new Error("NaN is not allowed");
11
+ }
12
+ if (typeof object === "number" && !isFinite(object)) {
13
+ throw new Error("Infinity is not allowed");
14
+ }
15
+ if (object === null || typeof object !== "object") {
16
+ return JSON.stringify(object);
17
+ }
18
+ if (object.toJSON instanceof Function) {
19
+ return serialize(object.toJSON());
20
+ }
21
+ if (Array.isArray(object)) {
22
+ const values2 = object.reduce((t, cv, ci) => {
23
+ const comma = ci === 0 ? "" : ",";
24
+ const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
25
+ return `${t}${comma}${serialize(value)}`;
26
+ }, "");
27
+ return `[${values2}]`;
28
+ }
29
+ const values = Object.keys(object).sort().reduce((t, cv) => {
30
+ if (object[cv] === void 0 || typeof object[cv] === "symbol") {
31
+ return t;
32
+ }
33
+ const comma = t.length === 0 ? "" : ",";
34
+ return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
35
+ }, "");
36
+ return `{${values}}`;
37
+ };
38
+ const k = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
5
39
  var util;
6
40
  (function(util2) {
7
41
  util2.assertEqual = (val) => val;
@@ -20,10 +54,10 @@
20
54
  return obj;
21
55
  };
22
56
  util2.getValidEnumValues = (obj) => {
23
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
57
+ const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
24
58
  const filtered = {};
25
- for (const k of validKeys) {
26
- filtered[k] = obj[k];
59
+ for (const k2 of validKeys) {
60
+ filtered[k2] = obj[k2];
27
61
  }
28
62
  return util2.objectValues(filtered);
29
63
  };
@@ -194,10 +228,10 @@
194
228
  fieldErrors._errors.push(mapper(issue));
195
229
  } else {
196
230
  let curr = fieldErrors;
197
- let i2 = 0;
198
- while (i2 < issue.path.length) {
199
- const el = issue.path[i2];
200
- const terminal = i2 === issue.path.length - 1;
231
+ let i = 0;
232
+ while (i < issue.path.length) {
233
+ const el = issue.path[i];
234
+ const terminal = i === issue.path.length - 1;
201
235
  if (!terminal) {
202
236
  curr[el] = curr[el] || { _errors: [] };
203
237
  } else {
@@ -205,7 +239,7 @@
205
239
  curr[el]._errors.push(mapper(issue));
206
240
  }
207
241
  curr = curr[el];
208
- i2++;
242
+ i++;
209
243
  }
210
244
  }
211
245
  }
@@ -391,7 +425,7 @@
391
425
  overrideMap,
392
426
  overrideMap === errorMap ? void 0 : errorMap
393
427
  // then global default map
394
- ].filter((x) => !!x)
428
+ ].filter((x2) => !!x2)
395
429
  });
396
430
  ctx.common.issues.push(issue);
397
431
  }
@@ -454,10 +488,10 @@
454
488
  });
455
489
  const DIRTY = (value) => ({ status: "dirty", value });
456
490
  const OK = (value) => ({ status: "valid", value });
457
- const isAborted = (x) => x.status === "aborted";
458
- const isDirty = (x) => x.status === "dirty";
459
- const isValid = (x) => x.status === "valid";
460
- const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
491
+ const isAborted = (x2) => x2.status === "aborted";
492
+ const isDirty = (x2) => x2.status === "dirty";
493
+ const isValid = (x2) => x2.status === "valid";
494
+ const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
461
495
  function __classPrivateFieldGet(receiver, state, kind, f2) {
462
496
  if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
463
497
  return state.get(receiver);
@@ -2051,14 +2085,14 @@
2051
2085
  }
2052
2086
  }
2053
2087
  if (ctx.common.async) {
2054
- return Promise.all([...ctx.data].map((item, i2) => {
2055
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
2088
+ return Promise.all([...ctx.data].map((item, i) => {
2089
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2056
2090
  })).then((result2) => {
2057
2091
  return ParseStatus.mergeArray(status, result2);
2058
2092
  });
2059
2093
  }
2060
- const result = [...ctx.data].map((item, i2) => {
2061
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
2094
+ const result = [...ctx.data].map((item, i) => {
2095
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2062
2096
  });
2063
2097
  return ParseStatus.mergeArray(status, result);
2064
2098
  }
@@ -2787,7 +2821,7 @@
2787
2821
  if (!schema)
2788
2822
  return null;
2789
2823
  return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2790
- }).filter((x) => !!x);
2824
+ }).filter((x2) => !!x2);
2791
2825
  if (ctx.common.async) {
2792
2826
  return Promise.all(items).then((results) => {
2793
2827
  return ParseStatus.mergeArray(status, results);
@@ -2986,7 +3020,7 @@
2986
3020
  }
2987
3021
  return { status: status.value, value: parsedSet };
2988
3022
  }
2989
- const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
3023
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2990
3024
  if (ctx.common.async) {
2991
3025
  return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2992
3026
  } else {
@@ -3045,7 +3079,7 @@
3045
3079
  ctx.schemaErrorMap,
3046
3080
  getErrorMap(),
3047
3081
  errorMap
3048
- ].filter((x) => !!x),
3082
+ ].filter((x2) => !!x2),
3049
3083
  issueData: {
3050
3084
  code: ZodIssueCode.invalid_arguments,
3051
3085
  argumentsError: error
@@ -3061,7 +3095,7 @@
3061
3095
  ctx.schemaErrorMap,
3062
3096
  getErrorMap(),
3063
3097
  errorMap
3064
- ].filter((x) => !!x),
3098
+ ].filter((x2) => !!x2),
3065
3099
  issueData: {
3066
3100
  code: ZodIssueCode.invalid_return_type,
3067
3101
  returnTypeError: error
@@ -3798,7 +3832,7 @@
3798
3832
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3799
3833
  };
3800
3834
  const NEVER = INVALID;
3801
- var z = /* @__PURE__ */ Object.freeze({
3835
+ var z$2 = /* @__PURE__ */ Object.freeze({
3802
3836
  __proto__: null,
3803
3837
  defaultErrorMap: errorMap,
3804
3838
  setErrorMap,
@@ -3914,77 +3948,213 @@
3914
3948
  quotelessJson,
3915
3949
  ZodError
3916
3950
  });
3917
- function b$1(t) {
3918
- throw new Error("Unexpected object: " + t);
3951
+ var $ = Object.defineProperty;
3952
+ var F = (n, t, e) => t in n ? $(n, t, { enumerable: true, configurable: true, writable: true, value: e }) : n[t] = e;
3953
+ var d = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e);
3954
+ function g(n) {
3955
+ throw new Error("Unexpected object: " + n);
3919
3956
  }
3920
- function J$1(t) {
3921
- const { type: n, name: e, domain: r } = t;
3922
- return { type: n, name: e, ...r && { domain: r } };
3957
+ function h(n) {
3958
+ const { type: t, name: e, domain: r } = n;
3959
+ return { type: t, name: e, ...r && { domain: r } };
3923
3960
  }
3924
- function _$1(t, n) {
3925
- if (t === void 0) return n === void 0;
3926
- if (n === void 0) return true;
3927
- for (const e in n)
3928
- if (t[e] !== n[e]) return false;
3961
+ function Q(n, t) {
3962
+ if (n === void 0) return t === void 0;
3963
+ if (t === void 0) return true;
3964
+ for (const e in t)
3965
+ if (n[e] !== t[e]) return false;
3929
3966
  return true;
3930
3967
  }
3931
- function ot(t, n) {
3932
- return t.name === n.name && _$1(t.domain, n.domain);
3968
+ function z$1(n, t) {
3969
+ return n.name === t.name && Q(n.domain, t.domain);
3933
3970
  }
3934
- function it(t, n) {
3935
- return { ...t, src: f(t.src, n) };
3971
+ function gn(n, t) {
3972
+ return { ...n, src: l(n.src, t) };
3936
3973
  }
3937
- function f(t, n) {
3938
- switch (t.type) {
3974
+ function l(n, t) {
3975
+ switch (n.type) {
3939
3976
  case "column":
3940
3977
  return {
3941
3978
  type: "column",
3942
- column: n(t.column)
3979
+ column: t(n.column)
3943
3980
  };
3944
3981
  case "inner":
3945
3982
  case "full":
3946
3983
  return {
3947
- type: t.type,
3948
- entries: t.entries.map((e) => f(e, n))
3984
+ type: n.type,
3985
+ entries: n.entries.map((e) => l(e, t))
3949
3986
  };
3950
3987
  case "outer":
3951
3988
  return {
3952
3989
  type: "outer",
3953
- primary: f(t.primary, n),
3954
- secondary: t.secondary.map((e) => f(e, n))
3990
+ primary: l(n.primary, t),
3991
+ secondary: n.secondary.map((e) => l(e, t))
3955
3992
  };
3956
3993
  default:
3957
- b$1(t);
3994
+ g(n);
3958
3995
  }
3959
3996
  }
3960
- z.object({
3961
- __isRef: z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
3962
- blockId: z.string().describe("Upstream block id"),
3963
- name: z.string().describe("Name of the output provided to the upstream block's output context")
3964
- }).describe(
3965
- "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
3966
- ).strict().readonly();
3967
- function i(t) {
3968
- return t.kind === "PColumn";
3997
+ function A$1(n) {
3998
+ return k(h(n));
3999
+ }
4000
+ function x(n, t) {
4001
+ return JSON.stringify([n, t]);
4002
+ }
4003
+ class wn {
4004
+ /**
4005
+ * Creates a new anchor context from a set of anchor column specifications
4006
+ * @param anchors Record of anchor column specifications indexed by anchor ID
4007
+ */
4008
+ constructor(t) {
4009
+ d(this, "domains", /* @__PURE__ */ new Map());
4010
+ d(this, "axes", /* @__PURE__ */ new Map());
4011
+ d(this, "domainPacks", []);
4012
+ d(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
4013
+ this.anchors = t;
4014
+ const e = Object.entries(t);
4015
+ e.sort((r, o) => r[0].localeCompare(o[0]));
4016
+ for (const [r, o] of e) {
4017
+ for (let i = 0; i < o.axesSpec.length; i++) {
4018
+ const a = o.axesSpec[i], s = A$1(a);
4019
+ this.axes.set(s, { anchor: r, idx: i });
4020
+ }
4021
+ if (o.domain !== void 0) {
4022
+ const i = Object.entries(o.domain);
4023
+ i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
4024
+ for (const [a, s] of i) {
4025
+ const c2 = x(a, s);
4026
+ this.domains.set(c2, r);
4027
+ }
4028
+ }
4029
+ }
4030
+ }
4031
+ /**
4032
+ * Derives an anchored column identifier from a column specification
4033
+ * Replaces domain values and axes with anchored references when possible
4034
+ * @param spec Column specification to anchor
4035
+ * @returns An anchored column identifier that can be used to identify columns similar to the input specification
4036
+ */
4037
+ derive(t) {
4038
+ const e = {
4039
+ name: t.name,
4040
+ axes: []
4041
+ };
4042
+ let r;
4043
+ if (t.domain !== void 0)
4044
+ n:
4045
+ for (const o of this.domainPacks) {
4046
+ const i = [];
4047
+ for (const s of o) {
4048
+ const c2 = t.domain[s];
4049
+ if (c2 !== void 0)
4050
+ i.push([s, c2]);
4051
+ else
4052
+ break n;
4053
+ }
4054
+ const a = this.domainPackToAnchor.get(JSON.stringify(i));
4055
+ if (a !== void 0) {
4056
+ e.domainAnchor = a, r = new Set(o);
4057
+ break;
4058
+ }
4059
+ }
4060
+ for (const [o, i] of Object.entries(t.domain ?? {})) {
4061
+ if (r !== void 0 && r.has(o))
4062
+ continue;
4063
+ const a = x(o, i), s = this.domains.get(a);
4064
+ e.domain ?? (e.domain = {}), e.domain[o] = s ? { anchor: s } : i;
4065
+ }
4066
+ return e.axes = t.axesSpec.map((o) => {
4067
+ const i = A$1(o);
4068
+ return this.axes.get(i) ?? o;
4069
+ }), e;
4070
+ }
4071
+ /**
4072
+ * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
4073
+ * @param spec Column specification to anchor
4074
+ * @returns A canonicalized string representation of the anchored column identifier
4075
+ */
4076
+ deriveString(t) {
4077
+ const e = this.derive(t);
4078
+ return k(e);
4079
+ }
4080
+ }
4081
+ function An(n, t) {
4082
+ const e = { ...t };
4083
+ if (e.domainAnchor !== void 0) {
4084
+ const r = n[e.domainAnchor];
4085
+ if (!r)
4086
+ throw new Error(`Anchor "${e.domainAnchor}" not found`);
4087
+ const o = r.domain || {};
4088
+ e.domain = { ...o, ...e.domain }, delete e.domainAnchor;
4089
+ }
4090
+ if (e.domain) {
4091
+ const r = {};
4092
+ for (const [o, i] of Object.entries(e.domain))
4093
+ if (typeof i == "string")
4094
+ r[o] = i;
4095
+ else {
4096
+ const a = n[i.anchor];
4097
+ if (!a)
4098
+ throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);
4099
+ if (!a.domain || a.domain[o] === void 0)
4100
+ throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);
4101
+ r[o] = a.domain[o];
4102
+ }
4103
+ e.domain = r;
4104
+ }
4105
+ return e.axes && (e.axes = e.axes.map((r) => Y(n, r))), e;
4106
+ }
4107
+ function Y(n, t) {
4108
+ if (!Z(t))
4109
+ return t;
4110
+ const e = t.anchor, r = n[e];
4111
+ if (!r)
4112
+ throw new Error(`Anchor "${e}" not found for axis reference`);
4113
+ if ("idx" in t) {
4114
+ if (t.idx < 0 || t.idx >= r.axesSpec.length)
4115
+ throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);
4116
+ return r.axesSpec[t.idx];
4117
+ } else if ("name" in t) {
4118
+ const o = r.axesSpec.filter((i) => i.name === t.name);
4119
+ if (o.length > 1)
4120
+ throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);
4121
+ if (o.length === 0)
4122
+ throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4123
+ return o[0];
4124
+ } else if ("id" in t) {
4125
+ const o = r.axesSpec.filter((i) => z$1(t.id, h(i)));
4126
+ if (o.length > 1)
4127
+ throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4128
+ if (o.length === 0)
4129
+ throw new Error(`No matching axis found for matcher in anchor "${e}"`);
4130
+ return o[0];
4131
+ }
4132
+ throw new Error("Unsupported axis reference type");
3969
4133
  }
3970
- function W$1(t) {
3971
- return i(t.spec);
4134
+ function Z(n) {
4135
+ return typeof n == "object" && "anchor" in n;
3972
4136
  }
3973
- function dt(t) {
3974
- if (!W$1(t)) throw new Error(`not a PColumn (kind = ${t.spec.kind})`);
3975
- return t;
4137
+ function f(n) {
4138
+ return n.kind === "PColumn";
3976
4139
  }
3977
- function lt(t, n) {
3978
- return t === void 0 ? void 0 : {
3979
- ...t,
3980
- data: n(t.data)
4140
+ function q$1(n) {
4141
+ return f(n.spec);
4142
+ }
4143
+ function En(n) {
4144
+ if (!q$1(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
4145
+ return n;
4146
+ }
4147
+ function kn(n, t) {
4148
+ return n === void 0 ? void 0 : {
4149
+ ...n,
4150
+ data: t(n.data)
3981
4151
  };
3982
4152
  }
3983
- function pt(t) {
3984
- const n = /* @__PURE__ */ new Map(), e = (r) => {
4153
+ function In(n) {
4154
+ const t = /* @__PURE__ */ new Map(), e = (r) => {
3985
4155
  switch (r.type) {
3986
4156
  case "column":
3987
- n.set(r.column.id, r.column);
4157
+ t.set(r.column.id, r.column);
3988
4158
  return;
3989
4159
  case "full":
3990
4160
  case "inner":
@@ -3995,57 +4165,134 @@
3995
4165
  for (const o of r.secondary) e(o);
3996
4166
  return;
3997
4167
  default:
3998
- b$1(r);
4168
+ g(r);
3999
4169
  }
4000
4170
  };
4001
- return e(t), [...n.values()];
4171
+ return e(n), [...t.values()];
4172
+ }
4173
+ function P(n, t) {
4174
+ if (n.name !== void 0 && n.name !== t.name)
4175
+ return false;
4176
+ if (n.type !== void 0) {
4177
+ if (Array.isArray(n.type)) {
4178
+ if (!n.type.includes(t.type))
4179
+ return false;
4180
+ } else if (n.type !== t.type)
4181
+ return false;
4182
+ }
4183
+ if (n.domain !== void 0) {
4184
+ const e = t.domain || {};
4185
+ for (const [r, o] of Object.entries(n.domain))
4186
+ if (e[r] !== o)
4187
+ return false;
4188
+ }
4189
+ return true;
4190
+ }
4191
+ function E$1(n, t) {
4192
+ if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
4193
+ return false;
4194
+ if (t.type !== void 0) {
4195
+ if (Array.isArray(t.type)) {
4196
+ if (!t.type.includes(n.valueType))
4197
+ return false;
4198
+ } else if (t.type !== n.valueType)
4199
+ return false;
4200
+ }
4201
+ if (t.domain !== void 0) {
4202
+ const e = n.domain || {};
4203
+ for (const [r, o] of Object.entries(t.domain))
4204
+ if (e[r] !== o)
4205
+ return false;
4206
+ }
4207
+ if (t.axes !== void 0) {
4208
+ const e = n.axesSpec.map(h);
4209
+ if (t.partialAxesMatch) {
4210
+ for (const r of t.axes)
4211
+ if (!e.some((o) => P(r, o)))
4212
+ return false;
4213
+ } else {
4214
+ if (e.length !== t.axes.length)
4215
+ return false;
4216
+ for (let r = 0; r < t.axes.length; r++)
4217
+ if (!P(t.axes[r], e[r]))
4218
+ return false;
4219
+ }
4220
+ }
4221
+ if (t.annotations !== void 0) {
4222
+ const e = n.annotations || {};
4223
+ for (const [r, o] of Object.entries(t.annotations))
4224
+ if (e[r] !== o)
4225
+ return false;
4226
+ }
4227
+ if (t.annotationPatterns !== void 0) {
4228
+ const e = n.annotations || {};
4229
+ for (const [r, o] of Object.entries(t.annotationPatterns)) {
4230
+ const i = e[r];
4231
+ if (i === void 0 || !new RegExp(o).test(i))
4232
+ return false;
4233
+ }
4234
+ }
4235
+ return true;
4236
+ }
4237
+ function Nn(n) {
4238
+ return Array.isArray(n) ? (t) => n.some((e) => f(t) && E$1(t, e)) : (t) => f(t) && E$1(t, n);
4002
4239
  }
4003
- function mt(t, n) {
4004
- return t.ok ? { ok: true, value: n(t.value) } : t;
4240
+ z$2.object({
4241
+ __isRef: z$2.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4242
+ blockId: z$2.string().describe("Upstream block id"),
4243
+ name: z$2.string().describe("Name of the output provided to the upstream block's output context")
4244
+ }).describe(
4245
+ "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
4246
+ ).strict().readonly();
4247
+ function Vn(n) {
4248
+ return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === true && "blockId" in n && "name" in n;
4249
+ }
4250
+ function Fn(n, t) {
4251
+ return n.ok ? { ok: true, value: t(n.value) } : n;
4005
4252
  }
4006
- const Q = 24;
4007
- z.string().length(Q).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4008
- var fe = Object.defineProperty;
4009
- var he = (t, e, n) => e in t ? fe(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4010
- var S = (t, e, n) => he(t, typeof e != "symbol" ? e + "" : e, n);
4011
- function V(t) {
4253
+ const on = 24;
4254
+ z$2.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4255
+ var be = Object.defineProperty;
4256
+ var ve = (t, e, n) => e in t ? be(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4257
+ var A = (t, e, n) => ve(t, typeof e != "symbol" ? e + "" : e, n);
4258
+ function j(t) {
4012
4259
  return { type: "Immediate", value: t };
4013
4260
  }
4014
- function Se() {
4261
+ function Re() {
4015
4262
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4016
4263
  }
4017
- function oe(t) {
4264
+ function ce(t) {
4018
4265
  if (t && typeof globalThis.getPlatforma == "function")
4019
4266
  return globalThis.getPlatforma(t);
4020
4267
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4021
4268
  throw new Error("Can't get platforma instance.");
4022
4269
  }
4023
- function we() {
4270
+ function Fe() {
4024
4271
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4025
4272
  }
4026
4273
  function c() {
4027
4274
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4028
4275
  throw new Error("Not in config rendering context");
4029
4276
  }
4030
- function D(t, e) {
4031
- const n = we();
4277
+ function E(t, e) {
4278
+ const n = Fe();
4032
4279
  if (n === void 0) return false;
4033
4280
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4034
4281
  return n.callbackRegistry[t] = e, true;
4035
4282
  }
4036
- const J = /* @__PURE__ */ new Map();
4037
- function Ae(t, e) {
4283
+ const W = /* @__PURE__ */ new Map();
4284
+ function xe(t, e) {
4038
4285
  t in c().callbackRegistry || (c().callbackRegistry[t] = (n) => {
4039
- for (const r of J.get(t))
4040
- r(n);
4041
- }, J.set(t, [])), J.get(t).push(e);
4286
+ for (const s of W.get(t))
4287
+ s(n);
4288
+ }, W.set(t, [])), W.get(t).push(e);
4042
4289
  }
4043
4290
  class b {
4044
- constructor(e, n = (r) => r) {
4045
- S(this, "isResolved", false);
4046
- S(this, "resolvedValue");
4047
- this.handle = e, this.postProcess = n, Ae(e, (r) => {
4048
- this.resolvedValue = n(r), this.isResolved = true;
4291
+ constructor(e, n = (s) => s) {
4292
+ A(this, "isResolved", false);
4293
+ A(this, "resolvedValue");
4294
+ this.handle = e, this.postProcess = n, xe(e, (s) => {
4295
+ this.resolvedValue = n(s), this.isResolved = true;
4049
4296
  });
4050
4297
  }
4051
4298
  map(e) {
@@ -4053,15 +4300,15 @@
4053
4300
  }
4054
4301
  mapDefined(e) {
4055
4302
  return new b(this.handle, (n) => {
4056
- const r = this.postProcess(n);
4057
- return r ? e(r) : void 0;
4303
+ const s = this.postProcess(n);
4304
+ return s ? e(s) : void 0;
4058
4305
  });
4059
4306
  }
4060
4307
  toJSON() {
4061
4308
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4062
4309
  }
4063
4310
  }
4064
- function W(t, e) {
4311
+ function z(t, e) {
4065
4312
  return t === void 0 ? void 0 : e(t);
4066
4313
  }
4067
4314
  class v {
@@ -4070,27 +4317,27 @@
4070
4317
  }
4071
4318
  resolve(...e) {
4072
4319
  const n = e.map(
4073
- (r) => ({
4320
+ (s) => ({
4074
4321
  assertFieldType: "Input",
4075
- ...typeof r == "string" ? { field: r } : r
4322
+ ...typeof s == "string" ? { field: s } : s
4076
4323
  })
4077
4324
  );
4078
4325
  return this.resolveWithCommon({}, ...n);
4079
4326
  }
4080
4327
  resolveOutput(...e) {
4081
4328
  const n = e.map(
4082
- (r) => ({
4329
+ (s) => ({
4083
4330
  assertFieldType: "Output",
4084
- ...typeof r == "string" ? { field: r } : r
4331
+ ...typeof s == "string" ? { field: s } : s
4085
4332
  })
4086
4333
  );
4087
4334
  return this.resolveWithCommon({}, ...n);
4088
4335
  }
4089
4336
  resolveInput(...e) {
4090
4337
  const n = e.map(
4091
- (r) => ({
4338
+ (s) => ({
4092
4339
  assertFieldType: "Input",
4093
- ...typeof r == "string" ? { field: r } : r
4340
+ ...typeof s == "string" ? { field: s } : s
4094
4341
  })
4095
4342
  );
4096
4343
  return this.resolveWithCommon({}, ...n);
@@ -4099,13 +4346,13 @@
4099
4346
  return this.resolveWithCommon({}, ...e);
4100
4347
  }
4101
4348
  resolveWithCommon(e, ...n) {
4102
- const r = [
4349
+ const s = [
4103
4350
  ...this.resolvePath,
4104
- ...n.map((s) => typeof s == "string" ? s : s.field)
4351
+ ...n.map((r) => typeof r == "string" ? r : r.field)
4105
4352
  ];
4106
- return W(
4353
+ return z(
4107
4354
  c().resolveWithCommon(this.handle, e, ...n),
4108
- (s) => new v(s, r)
4355
+ (r) => new v(r, s)
4109
4356
  );
4110
4357
  }
4111
4358
  get resourceType() {
@@ -4125,7 +4372,7 @@
4125
4372
  }
4126
4373
  getError() {
4127
4374
  const e = [...this.resolvePath, "error"];
4128
- return W(
4375
+ return z(
4129
4376
  c().getError(this.handle),
4130
4377
  (n) => new v(n, e)
4131
4378
  );
@@ -4165,29 +4412,29 @@
4165
4412
  *
4166
4413
  */
4167
4414
  getPColumns(e = false, n = "") {
4168
- const r = this.parsePObjectCollection(e, n);
4169
- return r === void 0 ? void 0 : Object.entries(r).map(([, i2]) => {
4170
- if (!W$1(i2)) throw new Error(`not a PColumn (kind = ${i2.spec.kind})`);
4171
- return i2;
4415
+ const s = this.parsePObjectCollection(e, n);
4416
+ return s === void 0 ? void 0 : Object.entries(s).map(([, i]) => {
4417
+ if (!q$1(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
4418
+ return i;
4172
4419
  });
4173
4420
  }
4174
4421
  /**
4175
4422
  *
4176
4423
  */
4177
4424
  parsePObjectCollection(e = false, n = "") {
4178
- const r = c().parsePObjectCollection(
4425
+ const s = c().parsePObjectCollection(
4179
4426
  this.handle,
4180
4427
  e,
4181
4428
  n,
4182
4429
  ...this.resolvePath
4183
4430
  );
4184
- if (r === void 0) return;
4185
- const s = {};
4186
- for (const [i2, o] of Object.entries(r)) {
4187
- const l = [...this.resolvePath, i2];
4188
- s[i2] = lt(o, (a) => new v(a, l));
4431
+ if (s === void 0) return;
4432
+ const r = {};
4433
+ for (const [i, o] of Object.entries(s)) {
4434
+ const l2 = [...this.resolvePath, i];
4435
+ r[i] = kn(o, (a) => new v(a, l2));
4189
4436
  }
4190
- return s;
4437
+ return r;
4191
4438
  }
4192
4439
  getFileContentAsBase64() {
4193
4440
  return new b(c().getBlobContentAsBase64(this.handle));
@@ -4270,87 +4517,87 @@
4270
4517
  }
4271
4518
  }
4272
4519
  mapFields(e, n) {
4273
- const { fieldType: r, requireLocked: s, skipUnresolved: i2 } = {
4520
+ const { fieldType: s, requireLocked: r, skipUnresolved: i } = {
4274
4521
  fieldType: "Input",
4275
4522
  requireLocked: true,
4276
4523
  skipUnresolved: false,
4277
4524
  ...n
4278
4525
  }, o = e;
4279
- if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4526
+ if (r && (s === "Input" && !this.getInputsLocked() || s === "Output" && !this.getOutputsLocked()))
4280
4527
  return;
4281
- let a = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4282
- (u) => [u, this.resolve({ field: u, assertFieldType: r })]
4528
+ let a = (s === "Input" ? this.listInputFields() : s === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4529
+ (u) => [u, this.resolve({ field: u, assertFieldType: s })]
4283
4530
  );
4284
- return i2 && (a = a.filter((u) => u[1] !== void 0)), a.map(([u, h]) => o(u, h));
4531
+ return i && (a = a.filter((u) => u[1] !== void 0)), a.map(([u, p]) => o(u, p));
4285
4532
  }
4286
4533
  }
4287
- const ae = "staging", le = "main";
4288
- const Ie = "pl7.app/label", Re = "pl7.app/trace", Fe = z.object({
4289
- type: z.string(),
4290
- importance: z.number().optional(),
4291
- id: z.string().optional(),
4292
- label: z.string()
4293
- }), xe = z.array(Fe), Te = 1e-3, Oe = "__LABEL__", ee = "__LABEL__@1";
4294
- function ke(t, e, n = {}) {
4295
- const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i2 = t.map((p) => {
4296
- var R, Q2;
4297
- const g = e(p), f2 = (R = g.annotations) == null ? void 0 : R[Ie], A = (Q2 = g.annotations) == null ? void 0 : Q2[Re], y = (A ? xe.safeParse(JSON.parse(A)).data : void 0) ?? [];
4298
- if (f2) {
4299
- const w = { label: f2, type: Oe, importance: -2 };
4300
- n.addLabelAsSuffix ? y.push(w) : y.splice(0, 0, w);
4534
+ const de = "staging", pe = "main";
4535
+ const ke = "pl7.app/label", De = "pl7.app/trace", Oe = z$2.object({
4536
+ type: z$2.string(),
4537
+ importance: z$2.number().optional(),
4538
+ id: z$2.string().optional(),
4539
+ label: z$2.string()
4540
+ }), Ee = z$2.array(Oe), Ve = 1e-3, je = "__LABEL__", se = "__LABEL__@1";
4541
+ function re(t, e, n = {}) {
4542
+ const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = t.map((f2) => {
4543
+ var F2, ee;
4544
+ const g2 = e(f2), h2 = (F2 = g2.annotations) == null ? void 0 : F2[ke], I = (ee = g2.annotations) == null ? void 0 : ee[De], y = (I ? Ee.safeParse(JSON.parse(I)).data : void 0) ?? [];
4545
+ if (h2) {
4546
+ const S = { label: h2, type: je, importance: -2 };
4547
+ n.addLabelAsSuffix ? y.push(S) : y.splice(0, 0, S);
4301
4548
  }
4302
- const I = [], L = /* @__PURE__ */ new Map();
4303
- for (let w = y.length - 1; w >= 0; --w) {
4304
- const { type: N } = y[w], pe = y[w].importance ?? 0, M = (L.get(N) ?? 0) + 1;
4305
- L.set(N, M);
4306
- const F = `${N}@${M}`;
4307
- s.set(F, (s.get(F) ?? 0) + 1), r.set(
4308
- F,
4549
+ const R = [], O = /* @__PURE__ */ new Map();
4550
+ for (let S = y.length - 1; S >= 0; --S) {
4551
+ const { type: M } = y[S], ye = y[S].importance ?? 0, J = (O.get(M) ?? 0) + 1;
4552
+ O.set(M, J);
4553
+ const x2 = `${M}@${J}`;
4554
+ r.set(x2, (r.get(x2) ?? 0) + 1), s.set(
4555
+ x2,
4309
4556
  Math.max(
4310
- r.get(F) ?? Number.NEGATIVE_INFINITY,
4311
- pe - (y.length - w) * Te
4557
+ s.get(x2) ?? Number.NEGATIVE_INFINITY,
4558
+ ye - (y.length - S) * Ve
4312
4559
  )
4313
- ), I.push({ ...y[w], fullType: F, occurenceIndex: M });
4560
+ ), R.push({ ...y[S], fullType: x2, occurenceIndex: J });
4314
4561
  }
4315
- return I.reverse(), {
4316
- value: p,
4317
- spec: g,
4318
- label: f2,
4319
- fullTrace: I
4562
+ return R.reverse(), {
4563
+ value: f2,
4564
+ spec: g2,
4565
+ label: h2,
4566
+ fullTrace: R
4320
4567
  };
4321
- }), o = [], l = [], a = [...r];
4322
- a.sort(([, p], [, g]) => g - p);
4323
- for (const [p] of a)
4324
- p.endsWith("@1") || s.get(p) === t.length ? o.push(p) : l.push(p);
4325
- const u = (p) => i2.map((g) => {
4326
- const f2 = g.fullTrace.filter((y) => p.has(y.fullType)).map((y) => y.label), A = n.separator ?? " / ";
4568
+ }), o = [], l2 = [], a = [...s];
4569
+ a.sort(([, f2], [, g2]) => g2 - f2);
4570
+ for (const [f2] of a)
4571
+ f2.endsWith("@1") || r.get(f2) === t.length ? o.push(f2) : l2.push(f2);
4572
+ const u = (f2) => i.map((g2) => {
4573
+ const h2 = g2.fullTrace.filter((y) => f2.has(y.fullType)).map((y) => y.label), I = n.separator ?? " / ";
4327
4574
  return {
4328
- label: f2.join(A),
4329
- value: g.value
4575
+ label: h2.join(I),
4576
+ value: g2.value
4330
4577
  };
4331
4578
  });
4332
4579
  if (o.length === 0) {
4333
- if (l.length !== 0) throw new Error("Assertion error.");
4334
- return u(new Set(ee));
4335
- }
4336
- let h = 0, d = 0;
4337
- for (; h < o.length; ) {
4338
- const p = /* @__PURE__ */ new Set();
4339
- n.includeNativeLabel && p.add(ee);
4340
- for (let f2 = 0; f2 < h; ++f2) p.add(o[f2]);
4341
- p.add(o[d]);
4342
- const g = u(p);
4343
- if (new Set(g.map((f2) => f2.label)).size === t.length) return g;
4344
- d++, d == o.length && (h++, d = h);
4345
- }
4346
- return u(/* @__PURE__ */ new Set([...o, ...l]));
4580
+ if (l2.length !== 0) throw new Error("Assertion error.");
4581
+ return u(new Set(se));
4582
+ }
4583
+ let p = 0, d2 = 0;
4584
+ for (; p < o.length; ) {
4585
+ const f2 = /* @__PURE__ */ new Set();
4586
+ n.includeNativeLabel && f2.add(se);
4587
+ for (let h2 = 0; h2 < p; ++h2) f2.add(o[h2]);
4588
+ f2.add(o[d2]);
4589
+ const g2 = u(f2);
4590
+ if (new Set(g2.map((h2) => h2.label)).size === t.length) return g2;
4591
+ d2++, d2 == o.length && (p++, d2 = p);
4592
+ }
4593
+ return u(/* @__PURE__ */ new Set([...o, ...l2]));
4347
4594
  }
4348
- class Le {
4595
+ class Ue {
4349
4596
  constructor() {
4350
- S(this, "ctx", c());
4351
- S(this, "defaultLabelFn", (e, n) => {
4352
- var r;
4353
- return ((r = e.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
4597
+ A(this, "ctx", c());
4598
+ A(this, "defaultLabelFn", (e, n) => {
4599
+ var s;
4600
+ return ((s = e.annotations) == null ? void 0 : s["pl7.app/label"]) ?? "Unlabelled";
4354
4601
  });
4355
4602
  }
4356
4603
  /**
@@ -4360,13 +4607,33 @@
4360
4607
  return this.ctx.calculateOptions(e);
4361
4608
  }
4362
4609
  getOptions(e, n) {
4363
- const r = this.getSpecs().entries.filter((s) => e(s.obj));
4364
- return typeof n == "object" || typeof n > "u" ? ke(r, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i2 }) => ({
4365
- ref: s,
4366
- label: i2
4367
- })) : r.map((s) => ({
4368
- ref: s.ref,
4369
- label: n(s.obj, s.ref)
4610
+ const s = typeof e == "function" ? e : Nn(e), r = this.getSpecs().entries.filter((i) => s(i.obj));
4611
+ return typeof n == "object" || typeof n > "u" ? re(r, (i) => i.obj, n ?? {}).map(({ value: { ref: i }, label: o }) => ({
4612
+ ref: i,
4613
+ label: o
4614
+ })) : r.map((i) => ({
4615
+ ref: i.ref,
4616
+ label: n(i.obj, i.ref)
4617
+ }));
4618
+ }
4619
+ // Implementation
4620
+ getAnchoredOptions(e, n, s) {
4621
+ const r = {};
4622
+ if (!(e instanceof wn))
4623
+ for (const [a, u] of Object.entries(e))
4624
+ if (Vn(u)) {
4625
+ const p = this.getPColumnSpecByRef(u);
4626
+ if (!p)
4627
+ return;
4628
+ r[a] = p;
4629
+ } else
4630
+ r[a] = u;
4631
+ const i = typeof n == "function" ? n : Nn(
4632
+ Array.isArray(n) ? n.map((a) => An(r, a)) : An(r, n)
4633
+ ), o = this.getSpecs().entries.filter(({ obj: a }) => f(a) ? i(a) : false), l2 = e instanceof wn ? e : new wn(r);
4634
+ return re(o, (a) => a.obj, s ?? {}).map(({ value: { obj: a }, label: u }) => ({
4635
+ value: l2.deriveString(a),
4636
+ label: u
4370
4637
  }));
4371
4638
  }
4372
4639
  /**
@@ -4402,9 +4669,9 @@
4402
4669
  ref: n.ref,
4403
4670
  obj: {
4404
4671
  ...n.obj,
4405
- data: mt(
4672
+ data: Fn(
4406
4673
  n.obj.data,
4407
- (r) => new v(r, [n.ref.blockId, n.ref.name])
4674
+ (s) => new v(s, [n.ref.blockId, n.ref.name])
4408
4675
  )
4409
4676
  }
4410
4677
  }))
@@ -4426,10 +4693,10 @@
4426
4693
  getDataByRef(e) {
4427
4694
  var n;
4428
4695
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4429
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4430
- )) == null ? void 0 : n.obj : lt(
4696
+ (s) => s.ref.blockId === e.blockId && s.ref.name === e.name
4697
+ )) == null ? void 0 : n.obj : kn(
4431
4698
  this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
4432
- (r) => new v(r, [e.blockId, e.name])
4699
+ (s) => new v(s, [e.blockId, e.name])
4433
4700
  );
4434
4701
  }
4435
4702
  /**
@@ -4440,7 +4707,7 @@
4440
4707
  getPColumnByRef(e) {
4441
4708
  const n = this.getDataByRef(e);
4442
4709
  if (n)
4443
- return dt(n);
4710
+ return En(n);
4444
4711
  }
4445
4712
  /**
4446
4713
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -4450,7 +4717,7 @@
4450
4717
  getPColumnSpecByRef(e) {
4451
4718
  const n = this.getSpecByRef(e);
4452
4719
  if (n) {
4453
- if (!i(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
4720
+ if (!f(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
4454
4721
  return n;
4455
4722
  }
4456
4723
  }
@@ -4459,10 +4726,7 @@
4459
4726
  * @returns object spec associated with the ref
4460
4727
  */
4461
4728
  getSpecByRef(e) {
4462
- var n;
4463
- return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
4464
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4465
- )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
4729
+ return this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
4466
4730
  }
4467
4731
  /**
4468
4732
  * @param spec object specification
@@ -4471,36 +4735,36 @@
4471
4735
  */
4472
4736
  findDataWithCompatibleSpec(e) {
4473
4737
  const n = [];
4474
- e: for (const r of this.getData().entries) {
4475
- if (!i(r.obj.spec))
4738
+ e: for (const s of this.getData().entries) {
4739
+ if (!f(s.obj.spec))
4476
4740
  continue;
4477
- const s = r.obj.spec;
4478
- if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && q(e.domain, s.domain)) {
4479
- for (let i2 = 0; i2 < e.axesSpec.length; ++i2) {
4480
- const o = e.axesSpec[i2], l = s.axesSpec[i2];
4481
- if (o.name !== l.name || o.type !== l.type || !q(o.domain, l.domain))
4741
+ const r = s.obj.spec;
4742
+ if (e.name === r.name && e.valueType === r.valueType && e.axesSpec.length === r.axesSpec.length && X(e.domain, r.domain)) {
4743
+ for (let i = 0; i < e.axesSpec.length; ++i) {
4744
+ const o = e.axesSpec[i], l2 = r.axesSpec[i];
4745
+ if (o.name !== l2.name || o.type !== l2.type || !X(o.domain, l2.domain))
4482
4746
  continue e;
4483
4747
  }
4484
- n.push(r.obj);
4748
+ n.push(s.obj);
4485
4749
  }
4486
4750
  }
4487
4751
  return n;
4488
4752
  }
4489
4753
  }
4490
- function q(t, e) {
4754
+ function X(t, e) {
4491
4755
  if (t === void 0) return e === void 0;
4492
4756
  if (e === void 0) return true;
4493
4757
  for (const n in e)
4494
4758
  if (t[n] !== e[n]) return false;
4495
4759
  return true;
4496
4760
  }
4497
- class E {
4761
+ class V {
4498
4762
  constructor() {
4499
- S(this, "ctx");
4500
- S(this, "args");
4501
- S(this, "uiState");
4502
- S(this, "_activeArgsCache");
4503
- S(this, "resultPool", new Le());
4763
+ A(this, "ctx");
4764
+ A(this, "args");
4765
+ A(this, "uiState");
4766
+ A(this, "_activeArgsCache");
4767
+ A(this, "resultPool", new Ue());
4504
4768
  this.ctx = c(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
4505
4769
  }
4506
4770
  /**
@@ -4517,16 +4781,16 @@
4517
4781
  // return this.ctx.featureFlags;
4518
4782
  // }
4519
4783
  getNamedAccessor(e) {
4520
- return W(
4784
+ return z(
4521
4785
  this.ctx.getAccessorHandleByName(e),
4522
4786
  (n) => new v(n, [e])
4523
4787
  );
4524
4788
  }
4525
4789
  get prerun() {
4526
- return this.getNamedAccessor(ae);
4790
+ return this.getNamedAccessor(de);
4527
4791
  }
4528
4792
  get outputs() {
4529
- return this.getNamedAccessor(le);
4793
+ return this.getNamedAccessor(pe);
4530
4794
  }
4531
4795
  /**
4532
4796
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -4534,43 +4798,43 @@
4534
4798
  */
4535
4799
  findLabels(e) {
4536
4800
  const n = this.resultPool.getData();
4537
- for (const r of n.entries) {
4538
- if (!W$1(r.obj)) continue;
4539
- const s = r.obj.spec;
4540
- if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && q(e.domain, s.axesSpec[0].domain)) {
4541
- if (r.obj.data.resourceType.name !== "PColumnData/Json")
4542
- throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
4801
+ for (const s of n.entries) {
4802
+ if (!q$1(s.obj)) continue;
4803
+ const r = s.obj.spec;
4804
+ 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)) {
4805
+ if (s.obj.data.resourceType.name !== "PColumnData/Json")
4806
+ throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);
4543
4807
  return Object.fromEntries(
4544
4808
  Object.entries(
4545
- r.obj.data.getDataAsJson().data
4809
+ s.obj.data.getDataAsJson().data
4546
4810
  ).map((o) => [JSON.parse(o[0])[0], o[1]])
4547
4811
  );
4548
4812
  }
4549
4813
  }
4550
4814
  }
4551
4815
  verifyInlineColumnsSupport(e) {
4552
- var s;
4553
- const n = e.some((i2) => !(i2.data instanceof v)), r = ((s = this.ctx.featureFlags) == null ? void 0 : s.inlineColumnsSupport) === true;
4554
- if (n && !r) throw Error("inline columns not supported");
4816
+ var r;
4817
+ const n = e.some((i) => !(i.data instanceof v)), s = ((r = this.ctx.featureFlags) == null ? void 0 : r.inlineColumnsSupport) === true;
4818
+ if (n && !s) throw Error("inline columns not supported");
4555
4819
  }
4556
4820
  createPFrame(e) {
4557
4821
  return this.verifyInlineColumnsSupport(e), this.ctx.createPFrame(
4558
- e.map((n) => lt(n, (r) => r instanceof v ? r.handle : r))
4822
+ e.map((n) => kn(n, (s) => s instanceof v ? s.handle : s))
4559
4823
  );
4560
4824
  }
4561
4825
  createPTable(e) {
4562
- var n;
4826
+ let n;
4563
4827
  return "columns" in e ? n = {
4564
4828
  src: {
4565
4829
  type: "full",
4566
- entries: e.columns.map((r) => ({ type: "column", column: r }))
4830
+ entries: e.columns.map((s) => ({ type: "column", column: s }))
4567
4831
  },
4568
4832
  filters: e.filters ?? [],
4569
4833
  sorting: e.sorting ?? []
4570
- } : n = e, this.verifyInlineColumnsSupport(pt(n.src)), this.ctx.createPTable(
4571
- it(
4834
+ } : n = e, this.verifyInlineColumnsSupport(In(n.src)), this.ctx.createPTable(
4835
+ gn(
4572
4836
  n,
4573
- (r) => lt(r, (s) => s instanceof v ? s.handle : s)
4837
+ (s) => kn(s, (r) => r instanceof v ? r.handle : r)
4574
4838
  )
4575
4839
  );
4576
4840
  }
@@ -4583,17 +4847,17 @@
4583
4847
  return this.ctx.getCurrentUnstableMarker();
4584
4848
  }
4585
4849
  }
4586
- const T = "1.22.59";
4587
- function Ee(t) {
4850
+ const T = "1.23.0";
4851
+ function Ne(t) {
4588
4852
  return t.__renderLambda === true;
4589
4853
  }
4590
- function K(t) {
4854
+ function q(t) {
4591
4855
  if (t !== void 0)
4592
- return Ee(t) ? t.handle : t;
4856
+ return Ne(t) ? t.handle : t;
4593
4857
  }
4594
4858
  class _ {
4595
- constructor(e, n, r, s, i2, o, l) {
4596
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i2, this._sections = o, this._title = l;
4859
+ constructor(e, n, s, r, i, o, l2) {
4860
+ this._renderingMode = e, this._initialArgs = n, this._initialUiState = s, this._outputs = r, this._inputsValid = i, this._sections = o, this._title = l2;
4597
4861
  }
4598
4862
  static create(e = "Heavy") {
4599
4863
  return new _(
@@ -4601,15 +4865,15 @@
4601
4865
  void 0,
4602
4866
  {},
4603
4867
  {},
4604
- V(true),
4605
- V([]),
4868
+ j(true),
4869
+ j([]),
4606
4870
  void 0
4607
4871
  );
4608
4872
  }
4609
- output(e, n, r = {}) {
4873
+ output(e, n, s = {}) {
4610
4874
  if (typeof n == "function") {
4611
- const s = `output#${e}`;
4612
- return D(s, () => n(new E())), new _(
4875
+ const r = `output#${e}`;
4876
+ return E(r, () => n(new V())), new _(
4613
4877
  this._renderingMode,
4614
4878
  this._initialArgs,
4615
4879
  this._initialUiState,
@@ -4617,8 +4881,8 @@
4617
4881
  ...this._outputs,
4618
4882
  [e]: {
4619
4883
  __renderLambda: true,
4620
- handle: s,
4621
- ...r
4884
+ handle: r,
4885
+ ...s
4622
4886
  }
4623
4887
  },
4624
4888
  this._inputsValid,
@@ -4644,7 +4908,7 @@
4644
4908
  return this.output(e, n, { retentive: true });
4645
4909
  }
4646
4910
  argsValid(e) {
4647
- return typeof e == "function" ? (D("inputsValid", () => e(new E())), new _(
4911
+ return typeof e == "function" ? (E("inputsValid", () => e(new V())), new _(
4648
4912
  this._renderingMode,
4649
4913
  this._initialArgs,
4650
4914
  this._initialUiState,
@@ -4666,7 +4930,7 @@
4666
4930
  );
4667
4931
  }
4668
4932
  sections(e) {
4669
- return Array.isArray(e) ? this.sections(V(e)) : typeof e == "function" ? (D("sections", () => e(new E())), new _(
4933
+ return Array.isArray(e) ? this.sections(j(e)) : typeof e == "function" ? (E("sections", () => e(new V())), new _(
4670
4934
  this._renderingMode,
4671
4935
  this._initialArgs,
4672
4936
  this._initialUiState,
@@ -4686,7 +4950,7 @@
4686
4950
  }
4687
4951
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
4688
4952
  title(e) {
4689
- return D("title", () => e(new E())), new _(
4953
+ return E("title", () => e(new V())), new _(
4690
4954
  this._renderingMode,
4691
4955
  this._initialArgs,
4692
4956
  this._initialUiState,
@@ -4755,73 +5019,73 @@
4755
5019
  sdkVersion: T,
4756
5020
  renderingMode: this._renderingMode,
4757
5021
  initialArgs: this._initialArgs,
4758
- inputsValid: K(this._inputsValid),
4759
- sections: K(this._sections),
5022
+ inputsValid: q(this._inputsValid),
5023
+ sections: q(this._sections),
4760
5024
  outputs: Object.fromEntries(
4761
- Object.entries(this._outputs).map(([n, r]) => [n, K(r)])
5025
+ Object.entries(this._outputs).map(([n, s]) => [n, q(s)])
4762
5026
  )
4763
5027
  };
4764
- return Se() ? oe({ sdkVersion: T }) : { config: e };
5028
+ return Re() ? ce({ sdkVersion: T }) : { config: e };
4765
5029
  }
4766
5030
  }
4767
- function wt(t, e, n, r) {
4768
- var u, h;
4769
- Array.isArray(r) && (r = { filters: r });
4770
- const s = t.resultPool.getData().entries.map((d) => d.obj).filter(W$1).filter((d) => d.spec.name === "pl7.app/label" && d.spec.axesSpec.length === 1), i2 = (d, p) => {
4771
- let g = d.toString();
4772
- if (p)
4773
- for (const f2 in p)
4774
- g += f2, g += p[f2];
4775
- return g;
5031
+ function Lt(t, e, n, s) {
5032
+ var u, p;
5033
+ Array.isArray(s) && (s = { filters: s });
5034
+ const r = t.resultPool.getData().entries.map((d2) => d2.obj).filter(q$1).filter((d2) => d2.spec.name === "pl7.app/label" && d2.spec.axesSpec.length === 1), i = (d2, f2) => {
5035
+ let g2 = d2.toString();
5036
+ if (f2)
5037
+ for (const h2 in f2)
5038
+ g2 += h2, g2 += f2[h2];
5039
+ return g2;
4776
5040
  }, o = /* @__PURE__ */ new Map();
4777
- for (const d of e)
4778
- for (const p of d.spec.axesSpec) {
4779
- const g = J$1(p);
4780
- for (const f2 of s) {
4781
- const A = f2.spec.axesSpec[0], y = J$1(f2.spec.axesSpec[0]);
4782
- if (ot(g, y)) {
4783
- const I = Object.keys(g.domain ?? {}).length, L = Object.keys(y.domain ?? {}).length;
4784
- if (I > L) {
4785
- const R = i2(f2.id, g.domain);
4786
- o.set(R, {
4787
- id: R,
5041
+ for (const d2 of e)
5042
+ for (const f2 of d2.spec.axesSpec) {
5043
+ const g2 = h(f2);
5044
+ for (const h$1 of r) {
5045
+ const I = h$1.spec.axesSpec[0], y = h(h$1.spec.axesSpec[0]);
5046
+ if (z$1(g2, y)) {
5047
+ const R = Object.keys(g2.domain ?? {}).length, O = Object.keys(y.domain ?? {}).length;
5048
+ if (R > O) {
5049
+ const F2 = i(h$1.id, g2.domain);
5050
+ o.set(F2, {
5051
+ id: F2,
4788
5052
  spec: {
4789
- ...f2.spec,
4790
- axesSpec: [{ ...g, annotations: A.annotations }]
5053
+ ...h$1.spec,
5054
+ axesSpec: [{ ...g2, annotations: I.annotations }]
4791
5055
  },
4792
- data: f2.data
5056
+ data: h$1.data
4793
5057
  });
4794
5058
  } else
4795
- o.set(i2(f2.id), f2);
5059
+ o.set(i(h$1.id), h$1);
4796
5060
  }
4797
5061
  }
4798
5062
  }
4799
5063
  if ([...e, ...o.values()].some(
4800
- (d) => d.data instanceof v && !d.data.getIsReadyOrError()
5064
+ (d2) => d2.data instanceof v && !d2.data.getIsReadyOrError()
4801
5065
  ))
4802
5066
  return;
4803
- let l = e;
5067
+ let l2 = e;
4804
5068
  const a = [];
4805
- if (r != null && r.coreColumnPredicate) {
4806
- l = [];
4807
- for (const d of e)
4808
- r.coreColumnPredicate(d.spec) ? l.push(d) : a.push(d);
5069
+ if (s != null && s.coreColumnPredicate) {
5070
+ l2 = [];
5071
+ for (const d2 of e)
5072
+ s.coreColumnPredicate(d2.spec) ? l2.push(d2) : a.push(d2);
4809
5073
  }
4810
5074
  return a.push(...o.values()), t.createPTable({
4811
5075
  src: {
4812
5076
  type: "outer",
4813
5077
  primary: {
4814
- type: (r == null ? void 0 : r.coreJoinType) ?? "full",
4815
- entries: l.map((d) => ({ type: "column", column: d }))
5078
+ type: (s == null ? void 0 : s.coreJoinType) ?? "full",
5079
+ entries: l2.map((d2) => ({ type: "column", column: d2 }))
4816
5080
  },
4817
- secondary: a.map((d) => ({ type: "column", column: d }))
5081
+ secondary: a.map((d2) => ({ type: "column", column: d2 }))
4818
5082
  },
4819
- filters: [...(r == null ? void 0 : r.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []],
4820
- sorting: ((h = n == null ? void 0 : n.pTableParams) == null ? void 0 : h.sorting) ?? []
5083
+ filters: [...(s == null ? void 0 : s.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []],
5084
+ sorting: ((p = n == null ? void 0 : n.pTableParams) == null ? void 0 : p.sorting) ?? []
4821
5085
  });
4822
5086
  }
4823
- const $BlockArgs = z.object({
4824
- numbers: z.array(z.coerce.number())
5087
+ const $BlockArgs = z$2.object({
5088
+ numbers: z$2.array(z$2.coerce.number())
4825
5089
  });
4826
5090
  const platforma = _.create("Heavy").withArgs({ numbers: [1, 2, 3, 4] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
4827
5091
  if (ctx.args.numbers.length === 5) {
@@ -4834,7 +5098,7 @@
4834
5098
  }).output("pt", (ctx) => {
4835
5099
  var _a, _b, _c, _d, _e;
4836
5100
  if (!((_c = (_b = (_a = ctx.uiState) == null ? void 0 : _a.dataTableState) == null ? void 0 : _b.tableState.pTableParams) == null ? void 0 : _c.filters)) return void 0;
4837
- return wt(
5101
+ return Lt(
4838
5102
  ctx,
4839
5103
  [
4840
5104
  {
@@ -4885,12 +5149,12 @@
4885
5149
  }
4886
5150
  return "Ui Examples";
4887
5151
  }).sections((ctx) => {
4888
- const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it2) => ({
5152
+ const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
4889
5153
  type: "link",
4890
- href: `/section?id=${it2.id}`,
4891
- label: it2.label
5154
+ href: `/section?id=${it.id}`,
5155
+ label: it.label
4892
5156
  }));
4893
- if (dynamicSections.some((it2) => it2.label === "Error")) {
5157
+ if (dynamicSections.some((it) => it.label === "Error")) {
4894
5158
  throw new Error("sections: test error");
4895
5159
  }
4896
5160
  return [