@milaboratories/milaboratories.ui-examples.model 1.0.39 → 1.0.41

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
@@ -20,10 +20,10 @@
20
20
  return obj;
21
21
  };
22
22
  util2.getValidEnumValues = (obj) => {
23
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
23
+ const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
24
24
  const filtered = {};
25
- for (const k of validKeys) {
26
- filtered[k] = obj[k];
25
+ for (const k2 of validKeys) {
26
+ filtered[k2] = obj[k2];
27
27
  }
28
28
  return util2.objectValues(filtered);
29
29
  };
@@ -391,7 +391,7 @@
391
391
  overrideMap,
392
392
  overrideMap === errorMap ? void 0 : errorMap
393
393
  // then global default map
394
- ].filter((x2) => !!x2)
394
+ ].filter((x) => !!x)
395
395
  });
396
396
  ctx.common.issues.push(issue);
397
397
  }
@@ -454,16 +454,16 @@
454
454
  });
455
455
  const DIRTY = (value) => ({ status: "dirty", value });
456
456
  const OK = (value) => ({ status: "valid", value });
457
- const isAborted = (x2) => x2.status === "aborted";
458
- const isDirty = (x2) => x2.status === "dirty";
459
- const isValid = (x2) => x2.status === "valid";
460
- const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
461
- function __classPrivateFieldGet(receiver, state, kind, f2) {
462
- 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");
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;
461
+ function __classPrivateFieldGet(receiver, state, kind, f) {
462
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
463
463
  return state.get(receiver);
464
464
  }
465
- function __classPrivateFieldSet(receiver, state, value, kind, f2) {
466
- if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
465
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
466
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
467
467
  return state.set(receiver, value), value;
468
468
  }
469
469
  typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
@@ -2787,7 +2787,7 @@
2787
2787
  if (!schema)
2788
2788
  return null;
2789
2789
  return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2790
- }).filter((x2) => !!x2);
2790
+ }).filter((x) => !!x);
2791
2791
  if (ctx.common.async) {
2792
2792
  return Promise.all(items).then((results) => {
2793
2793
  return ParseStatus.mergeArray(status, results);
@@ -3045,7 +3045,7 @@
3045
3045
  ctx.schemaErrorMap,
3046
3046
  getErrorMap(),
3047
3047
  errorMap
3048
- ].filter((x2) => !!x2),
3048
+ ].filter((x) => !!x),
3049
3049
  issueData: {
3050
3050
  code: ZodIssueCode.invalid_arguments,
3051
3051
  argumentsError: error
@@ -3061,7 +3061,7 @@
3061
3061
  ctx.schemaErrorMap,
3062
3062
  getErrorMap(),
3063
3063
  errorMap
3064
- ].filter((x2) => !!x2),
3064
+ ].filter((x) => !!x),
3065
3065
  issueData: {
3066
3066
  code: ZodIssueCode.invalid_return_type,
3067
3067
  returnTypeError: error
@@ -3917,7 +3917,7 @@
3917
3917
  function c(n) {
3918
3918
  throw new Error("Unexpected object: " + n);
3919
3919
  }
3920
- function D(n, t) {
3920
+ function E(n, t) {
3921
3921
  return { ...n, src: i(n.src, t) };
3922
3922
  }
3923
3923
  function i(n, t) {
@@ -3955,59 +3955,63 @@
3955
3955
  function r(n) {
3956
3956
  return n.kind === "PColumn";
3957
3957
  }
3958
- function x(n) {
3958
+ function w$1(n) {
3959
3959
  return r(n.spec);
3960
3960
  }
3961
- function L(n, t) {
3961
+ function L(n) {
3962
+ if (!w$1(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
3963
+ return n;
3964
+ }
3965
+ function O$1(n, t) {
3962
3966
  return n === void 0 ? void 0 : {
3963
3967
  ...n,
3964
3968
  data: t(n.data)
3965
3969
  };
3966
3970
  }
3967
- function O$1(n, t) {
3971
+ function J(n, t) {
3968
3972
  return n.ok ? { ok: true, value: t(n.value) } : n;
3969
3973
  }
3970
- var et = Object.defineProperty;
3971
- var nt = (e, t, n) => t in e ? et(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;
3972
- var _ = (e, t, n) => nt(e, typeof t != "symbol" ? t + "" : t, n);
3973
- function V(e) {
3974
+ var ct = Object.defineProperty;
3975
+ var dt = (e, t, n) => t in e ? ct(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;
3976
+ var _ = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
3977
+ function k(e) {
3974
3978
  return { type: "Immediate", value: e };
3975
3979
  }
3976
- function ut() {
3980
+ function _t() {
3977
3981
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
3978
3982
  }
3979
- function q(e) {
3983
+ function rt(e) {
3980
3984
  if (e && typeof globalThis.getPlatforma == "function")
3981
3985
  return globalThis.getPlatforma(e);
3982
3986
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
3983
3987
  throw new Error("Can't get platforma instance.");
3984
3988
  }
3985
- function ct() {
3989
+ function vt() {
3986
3990
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
3987
3991
  }
3988
- function l() {
3992
+ function u() {
3989
3993
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
3990
3994
  throw new Error("Not in config rendering context");
3991
3995
  }
3992
- function P(e, t) {
3993
- const n = ct();
3996
+ function O(e, t) {
3997
+ const n = vt();
3994
3998
  if (n === void 0) return false;
3995
3999
  if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
3996
4000
  return n.callbackRegistry[e] = t, true;
3997
4001
  }
3998
- const E = /* @__PURE__ */ new Map();
3999
- function dt(e, t) {
4000
- e in l().callbackRegistry || (l().callbackRegistry[e] = (n) => {
4001
- for (const i2 of E.get(e))
4002
- i2(n);
4003
- }, E.set(e, [])), E.get(e).push(t);
4002
+ const N = /* @__PURE__ */ new Map();
4003
+ function wt(e, t) {
4004
+ e in u().callbackRegistry || (u().callbackRegistry[e] = (n) => {
4005
+ for (const r2 of N.get(e))
4006
+ r2(n);
4007
+ }, N.set(e, [])), N.get(e).push(t);
4004
4008
  }
4005
4009
  class g {
4006
- constructor(t, n = (i2) => i2) {
4010
+ constructor(t, n = (r2) => r2) {
4007
4011
  _(this, "isResolved", false);
4008
4012
  _(this, "resolvedValue");
4009
- this.handle = t, this.postProcess = n, dt(t, (i2) => {
4010
- this.resolvedValue = n(i2), this.isResolved = true;
4013
+ this.handle = t, this.postProcess = n, wt(t, (r2) => {
4014
+ this.resolvedValue = n(r2), this.isResolved = true;
4011
4015
  });
4012
4016
  }
4013
4017
  map(t) {
@@ -4015,44 +4019,44 @@
4015
4019
  }
4016
4020
  mapDefined(t) {
4017
4021
  return new g(this.handle, (n) => {
4018
- const i2 = this.postProcess(n);
4019
- return i2 ? t(i2) : void 0;
4022
+ const r2 = this.postProcess(n);
4023
+ return r2 ? t(r2) : void 0;
4020
4024
  });
4021
4025
  }
4022
4026
  toJSON() {
4023
4027
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4024
4028
  }
4025
4029
  }
4026
- function G(e) {
4027
- return e === void 0 ? void 0 : new v(e);
4030
+ function X(e) {
4031
+ return e === void 0 ? void 0 : new w(e);
4028
4032
  }
4029
- class v {
4033
+ class w {
4030
4034
  constructor(t) {
4031
4035
  this.handle = t;
4032
4036
  }
4033
4037
  resolve(...t) {
4034
4038
  const n = t.map(
4035
- (i2) => ({
4039
+ (r2) => ({
4036
4040
  assertFieldType: "Input",
4037
- ...typeof i2 == "string" ? { field: i2 } : i2
4041
+ ...typeof r2 == "string" ? { field: r2 } : r2
4038
4042
  })
4039
4043
  );
4040
4044
  return this.resolveWithCommon({}, ...n);
4041
4045
  }
4042
4046
  resolveOutput(...t) {
4043
4047
  const n = t.map(
4044
- (i2) => ({
4048
+ (r2) => ({
4045
4049
  assertFieldType: "Output",
4046
- ...typeof i2 == "string" ? { field: i2 } : i2
4050
+ ...typeof r2 == "string" ? { field: r2 } : r2
4047
4051
  })
4048
4052
  );
4049
4053
  return this.resolveWithCommon({}, ...n);
4050
4054
  }
4051
4055
  resolveInput(...t) {
4052
4056
  const n = t.map(
4053
- (i2) => ({
4057
+ (r2) => ({
4054
4058
  assertFieldType: "Input",
4055
- ...typeof i2 == "string" ? { field: i2 } : i2
4059
+ ...typeof r2 == "string" ? { field: r2 } : r2
4056
4060
  })
4057
4061
  );
4058
4062
  return this.resolveWithCommon({}, ...n);
@@ -4061,40 +4065,40 @@
4061
4065
  return this.resolveWithCommon({}, ...t);
4062
4066
  }
4063
4067
  resolveWithCommon(t, ...n) {
4064
- return G(l().resolveWithCommon(this.handle, t, ...n));
4068
+ return X(u().resolveWithCommon(this.handle, t, ...n));
4065
4069
  }
4066
4070
  get resourceType() {
4067
- return l().getResourceType(this.handle);
4071
+ return u().getResourceType(this.handle);
4068
4072
  }
4069
4073
  getInputsLocked() {
4070
- return l().getInputsLocked(this.handle);
4074
+ return u().getInputsLocked(this.handle);
4071
4075
  }
4072
4076
  getOutputsLocked() {
4073
- return l().getOutputsLocked(this.handle);
4077
+ return u().getOutputsLocked(this.handle);
4074
4078
  }
4075
4079
  getIsReadyOrError() {
4076
- return l().getIsReadyOrError(this.handle);
4080
+ return u().getIsReadyOrError(this.handle);
4077
4081
  }
4078
4082
  getIsFinal() {
4079
- return l().getIsFinal(this.handle);
4083
+ return u().getIsFinal(this.handle);
4080
4084
  }
4081
4085
  getError() {
4082
- return G(l().getError(this.handle));
4086
+ return X(u().getError(this.handle));
4083
4087
  }
4084
4088
  listInputFields() {
4085
- return l().listInputFields(this.handle);
4089
+ return u().listInputFields(this.handle);
4086
4090
  }
4087
4091
  listOutputFields() {
4088
- return l().listOutputFields(this.handle);
4092
+ return u().listOutputFields(this.handle);
4089
4093
  }
4090
4094
  listDynamicFields() {
4091
- return l().listDynamicFields(this.handle);
4095
+ return u().listDynamicFields(this.handle);
4092
4096
  }
4093
4097
  getKeyValueBase64(t) {
4094
- return l().getKeyValueBase64(this.handle, t);
4098
+ return u().getKeyValueBase64(this.handle, t);
4095
4099
  }
4096
4100
  getKeyValueAsString(t) {
4097
- return l().getKeyValueAsString(this.handle, t);
4101
+ return u().getKeyValueAsString(this.handle, t);
4098
4102
  }
4099
4103
  getKeyValueAsJson(t) {
4100
4104
  const n = this.getKeyValueAsString(t);
@@ -4102,10 +4106,10 @@
4102
4106
  return JSON.parse(n);
4103
4107
  }
4104
4108
  getDataBase64() {
4105
- return l().getDataBase64(this.handle);
4109
+ return u().getDataBase64(this.handle);
4106
4110
  }
4107
4111
  getDataAsString() {
4108
- return l().getDataAsString(this.handle);
4112
+ return u().getDataAsString(this.handle);
4109
4113
  }
4110
4114
  getDataAsJson() {
4111
4115
  const t = this.getDataAsString();
@@ -4116,36 +4120,36 @@
4116
4120
  *
4117
4121
  */
4118
4122
  getPColumns(t = false, n = "") {
4119
- const i2 = this.parsePObjectCollection(t, n);
4120
- return i2 === void 0 ? void 0 : Object.entries(i2).map(([, s]) => {
4121
- if (!x(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
4122
- return s;
4123
+ const r2 = this.parsePObjectCollection(t, n);
4124
+ return r2 === void 0 ? void 0 : Object.entries(r2).map(([, i2]) => {
4125
+ if (!w$1(i2)) throw new Error(`not a PColumn (kind = ${i2.spec.kind})`);
4126
+ return i2;
4123
4127
  });
4124
4128
  }
4125
4129
  /**
4126
4130
  *
4127
4131
  */
4128
4132
  parsePObjectCollection(t = false, n = "") {
4129
- const i2 = l().parsePObjectCollection(
4133
+ const r2 = u().parsePObjectCollection(
4130
4134
  this.handle,
4131
4135
  t,
4132
4136
  n
4133
4137
  );
4134
- if (i2 === void 0) return;
4135
- const r2 = {};
4136
- for (const [s, o] of Object.entries(i2))
4137
- r2[s] = L(o, (a) => new v(a));
4138
- return r2;
4138
+ if (r2 === void 0) return;
4139
+ const s = {};
4140
+ for (const [i2, o] of Object.entries(r2))
4141
+ s[i2] = O$1(o, (a) => new w(a));
4142
+ return s;
4139
4143
  }
4140
4144
  getFileContentAsBase64() {
4141
- return new g(l().getBlobContentAsBase64(this.handle));
4145
+ return new g(u().getBlobContentAsBase64(this.handle));
4142
4146
  }
4143
4147
  getFileContentAsString() {
4144
- return new g(l().getBlobContentAsString(this.handle));
4148
+ return new g(u().getBlobContentAsString(this.handle));
4145
4149
  }
4146
4150
  getFileContentAsJson() {
4147
4151
  return new g(
4148
- l().getBlobContentAsString(this.handle)
4152
+ u().getBlobContentAsString(this.handle)
4149
4153
  ).mapDefined((t) => JSON.parse(t));
4150
4154
  }
4151
4155
  /**
@@ -4164,7 +4168,7 @@
4164
4168
  * @returns downloaded file handle
4165
4169
  */
4166
4170
  getFileHandle() {
4167
- return new g(l().getDownloadedBlobContentHandle(this.handle));
4171
+ return new g(u().getDownloadedBlobContentHandle(this.handle));
4168
4172
  }
4169
4173
  /**
4170
4174
  * @deprecated use getFileHandle
@@ -4176,7 +4180,7 @@
4176
4180
  * @returns downloaded file handle
4177
4181
  */
4178
4182
  getRemoteFileHandle() {
4179
- return new g(l().getOnDemandBlobContentHandle(this.handle));
4183
+ return new g(u().getOnDemandBlobContentHandle(this.handle));
4180
4184
  }
4181
4185
  /**
4182
4186
  * @deprecated use getRemoteFileHandle
@@ -4185,16 +4189,16 @@
4185
4189
  return this.getRemoteFileHandle();
4186
4190
  }
4187
4191
  getImportProgress() {
4188
- return new g(l().getImportProgress(this.handle));
4192
+ return new g(u().getImportProgress(this.handle));
4189
4193
  }
4190
4194
  getLastLogs(t) {
4191
- return new g(l().getLastLogs(this.handle, t));
4195
+ return new g(u().getLastLogs(this.handle, t));
4192
4196
  }
4193
4197
  getProgressLog(t) {
4194
- return new g(l().getProgressLog(this.handle, t));
4198
+ return new g(u().getProgressLog(this.handle, t));
4195
4199
  }
4196
4200
  getLogHandle() {
4197
- return new g(l().getLogHandle(this.handle));
4201
+ return new g(u().getLogHandle(this.handle));
4198
4202
  }
4199
4203
  allFieldsResolved(t = "Input") {
4200
4204
  switch (t) {
@@ -4209,84 +4213,84 @@
4209
4213
  }
4210
4214
  }
4211
4215
  mapFields(t, n) {
4212
- const { fieldType: i2, requireLocked: r2, skipUnresolved: s } = {
4216
+ const { fieldType: r2, requireLocked: s, skipUnresolved: i2 } = {
4213
4217
  fieldType: "Input",
4214
4218
  requireLocked: true,
4215
4219
  skipUnresolved: false,
4216
4220
  ...n
4217
4221
  }, o = t;
4218
- if (r2 && (i2 === "Input" && !this.getInputsLocked() || i2 === "Output" && !this.getOutputsLocked()))
4222
+ if (s && (r2 === "Input" && !this.getInputsLocked() || r2 === "Output" && !this.getOutputsLocked()))
4219
4223
  return;
4220
- let c2 = (i2 === "Input" ? this.listInputFields() : i2 === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4221
- (u) => [u, this.resolve({ field: u, assertFieldType: i2 })]
4224
+ let l = (r2 === "Input" ? this.listInputFields() : r2 === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4225
+ (c2) => [c2, this.resolve({ field: c2, assertFieldType: r2 })]
4222
4226
  );
4223
- return s && (c2 = c2.filter((u) => u[1] !== void 0)), c2.map(([u, h]) => o(u, h));
4227
+ return i2 && (l = l.filter((c2) => c2[1] !== void 0)), l.map(([c2, f]) => o(c2, f));
4224
4228
  }
4225
4229
  }
4226
- const Y = "staging", Q = "main";
4227
- const ht = "pl7.app/label", ft = "pl7.app/trace", gt = z.object({
4230
+ const st = "staging", it = "main";
4231
+ const At = "pl7.app/label", Pt = "pl7.app/trace", It = z.object({
4228
4232
  type: z.string(),
4229
4233
  importance: z.number().optional(),
4230
4234
  id: z.string().optional(),
4231
4235
  label: z.string()
4232
- }), mt = z.array(gt), yt = 1e-3, bt = "__LABEL__", H = "__LABEL__@1";
4233
- function _t(e, t, n = {}) {
4234
- const i2 = /* @__PURE__ */ new Map(), r2 = /* @__PURE__ */ new Map(), s = e.map((d) => {
4235
- var N, $;
4236
- const m = t(d), y = (N = m.annotations) == null ? void 0 : N[ht], R = ($ = m.annotations) == null ? void 0 : $[ft], b = (R ? mt.safeParse(JSON.parse(R)).data : void 0) ?? [];
4237
- y && b.splice(0, 0, { label: y, type: bt, importance: -2 });
4238
- const k = [], U = /* @__PURE__ */ new Map();
4239
- for (let w = b.length - 1; w >= 0; --w) {
4240
- const { type: x2 } = b[w], tt = b[w].importance ?? 0, j = (U.get(x2) ?? 0) + 1;
4241
- U.set(x2, j);
4242
- const C = `${x2}@${j}`;
4243
- r2.set(C, (r2.get(C) ?? 0) + 1), i2.set(
4244
- C,
4236
+ }), Ct = z.array(It), Tt = 1e-3, Rt = "__LABEL__", Q = "__LABEL__@1";
4237
+ function Ft(e, t, n = {}) {
4238
+ const r2 = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i2 = e.map((d) => {
4239
+ var z2, Y;
4240
+ const m = t(d), y = (z2 = m.annotations) == null ? void 0 : z2[At], F = (Y = m.annotations) == null ? void 0 : Y[Pt], b = (F ? Ct.safeParse(JSON.parse(F)).data : void 0) ?? [];
4241
+ y && b.splice(0, 0, { label: y, type: Rt, importance: -2 });
4242
+ const V = [], q = /* @__PURE__ */ new Map();
4243
+ for (let S = b.length - 1; S >= 0; --S) {
4244
+ const { type: E2 } = b[S], ut = b[S].importance ?? 0, j = (q.get(E2) ?? 0) + 1;
4245
+ q.set(E2, j);
4246
+ const I = `${E2}@${j}`;
4247
+ s.set(I, (s.get(I) ?? 0) + 1), r2.set(
4248
+ I,
4245
4249
  Math.max(
4246
- i2.get(C) ?? Number.NEGATIVE_INFINITY,
4247
- tt - (b.length - w) * yt
4250
+ r2.get(I) ?? Number.NEGATIVE_INFINITY,
4251
+ ut - (b.length - S) * Tt
4248
4252
  )
4249
- ), k.push({ ...b[w], fullType: C, occurenceIndex: j });
4253
+ ), V.push({ ...b[S], fullType: I, occurenceIndex: j });
4250
4254
  }
4251
- return k.reverse(), {
4255
+ return V.reverse(), {
4252
4256
  value: d,
4253
4257
  spec: m,
4254
4258
  label: y,
4255
- fullTrace: k
4259
+ fullTrace: V
4256
4260
  };
4257
- }), o = [], a = [], c2 = [...i2];
4258
- c2.sort(([, d], [, m]) => m - d);
4259
- for (const [d] of c2)
4260
- d.endsWith("@1") || r2.get(d) === e.length ? o.push(d) : a.push(d);
4261
- const u = (d) => s.map((m) => {
4262
- const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), R = n.separator ?? " / ";
4261
+ }), o = [], a = [], l = [...r2];
4262
+ l.sort(([, d], [, m]) => m - d);
4263
+ for (const [d] of l)
4264
+ d.endsWith("@1") || s.get(d) === e.length ? o.push(d) : a.push(d);
4265
+ const c2 = (d) => i2.map((m) => {
4266
+ const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), F = n.separator ?? " / ";
4263
4267
  return {
4264
- label: y.join(R),
4268
+ label: y.join(F),
4265
4269
  value: m.value
4266
4270
  };
4267
4271
  });
4268
4272
  if (o.length === 0) {
4269
4273
  if (a.length !== 0) throw new Error("Assertion error.");
4270
- return u(new Set(H));
4274
+ return c2(new Set(Q));
4271
4275
  }
4272
- let h = 0, T = 0;
4273
- for (; h < o.length; ) {
4276
+ let f = 0, v = 0;
4277
+ for (; f < o.length; ) {
4274
4278
  const d = /* @__PURE__ */ new Set();
4275
- for (let y = 0; y < h; ++y) d.add(o[y]);
4276
- d.add(o[T]);
4277
- const m = u(d);
4279
+ for (let y = 0; y < f; ++y) d.add(o[y]);
4280
+ d.add(o[v]);
4281
+ const m = c2(d);
4278
4282
  if (new Set(m.map((y) => y.label)).size === e.length)
4279
- return n.includeNativeLabel ? (d.add(H), u(d)) : m;
4280
- T++, T == o.length && (h++, T = h);
4283
+ return n.includeNativeLabel ? (d.add(Q), c2(d)) : m;
4284
+ v++, v == o.length && (f++, v = f);
4281
4285
  }
4282
- return u(/* @__PURE__ */ new Set([...o, ...a]));
4286
+ return c2(/* @__PURE__ */ new Set([...o, ...a]));
4283
4287
  }
4284
- class vt {
4288
+ class Ot {
4285
4289
  constructor() {
4286
- _(this, "ctx", l());
4290
+ _(this, "ctx", u());
4287
4291
  _(this, "defaultLabelFn", (t, n) => {
4288
- var i2;
4289
- return ((i2 = t.annotations) == null ? void 0 : i2["pl7.app/label"]) ?? "Unlabelled";
4292
+ var r2;
4293
+ return ((r2 = t.annotations) == null ? void 0 : r2["pl7.app/label"]) ?? "Unlabelled";
4290
4294
  });
4291
4295
  }
4292
4296
  /**
@@ -4296,15 +4300,15 @@
4296
4300
  return this.ctx.calculateOptions(t);
4297
4301
  }
4298
4302
  getOptions(t, n) {
4299
- const i2 = this.getSpecs().entries.filter((r2) => t(r2.obj));
4300
- return typeof n == "object" || typeof n > "u" ? _t(i2, (r2) => r2.obj, n ?? {}).map(
4301
- ({ value: { ref: r2 }, label: s }) => ({
4302
- ref: r2,
4303
- label: s
4303
+ const r2 = this.getSpecs().entries.filter((s) => t(s.obj));
4304
+ return typeof n == "object" || typeof n > "u" ? Ft(r2, (s) => s.obj, n ?? {}).map(
4305
+ ({ value: { ref: s }, label: i2 }) => ({
4306
+ ref: s,
4307
+ label: i2
4304
4308
  })
4305
- ) : i2.map((r2) => ({
4306
- ref: r2.ref,
4307
- label: n(r2.obj, r2.ref)
4309
+ ) : r2.map((s) => ({
4310
+ ref: s.ref,
4311
+ label: n(s.obj, s.ref)
4308
4312
  }));
4309
4313
  }
4310
4314
  /**
@@ -4321,7 +4325,7 @@
4321
4325
  ref: n.ref,
4322
4326
  obj: {
4323
4327
  ...n.obj,
4324
- data: new v(n.obj.data)
4328
+ data: new w(n.obj.data)
4325
4329
  }
4326
4330
  }))
4327
4331
  };
@@ -4340,7 +4344,7 @@
4340
4344
  ref: n.ref,
4341
4345
  obj: {
4342
4346
  ...n.obj,
4343
- data: O$1(n.obj.data, (i2) => new v(i2))
4347
+ data: J(n.obj.data, (r2) => new w(r2))
4344
4348
  }
4345
4349
  }))
4346
4350
  };
@@ -4361,12 +4365,22 @@
4361
4365
  getDataByRef(t) {
4362
4366
  var n;
4363
4367
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4364
- (i2) => i2.ref.blockId === t.blockId && i2.ref.name === t.name
4365
- )) == null ? void 0 : n.obj : L(
4368
+ (r2) => r2.ref.blockId === t.blockId && r2.ref.name === t.name
4369
+ )) == null ? void 0 : n.obj : O$1(
4366
4370
  this.ctx.getDataFromResultPoolByRef(t.blockId, t.name),
4367
- (i2) => new v(i2)
4371
+ (r2) => new w(r2)
4368
4372
  );
4369
4373
  }
4374
+ /**
4375
+ * Returns data associated with the ref ensuring that it is a p-column.
4376
+ * @param ref a Ref
4377
+ * @returns p-column associated with the ref
4378
+ */
4379
+ getPColumnByRef(t) {
4380
+ const n = this.getDataByRef(t);
4381
+ if (n)
4382
+ return L(n);
4383
+ }
4370
4384
  /**
4371
4385
  * @param ref a Ref
4372
4386
  * @returns object spec associated with the ref
@@ -4374,52 +4388,53 @@
4374
4388
  getSpecByRef(t) {
4375
4389
  var n;
4376
4390
  return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
4377
- (i2) => i2.ref.blockId === t.blockId && i2.ref.name === t.name
4391
+ (r2) => r2.ref.blockId === t.blockId && r2.ref.name === t.name
4378
4392
  )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(t.blockId, t.name);
4379
4393
  }
4380
4394
  /**
4381
4395
  * @param spec object specification
4382
4396
  * @returns array of data objects with compatible specs
4397
+ * @deprecated delete this method after Jan 1, 2025
4383
4398
  */
4384
4399
  findDataWithCompatibleSpec(t) {
4385
4400
  const n = [];
4386
- t: for (const i2 of this.getData().entries) {
4387
- if (!r(i2.obj.spec))
4401
+ t: for (const r$1 of this.getData().entries) {
4402
+ if (!r(r$1.obj.spec))
4388
4403
  continue;
4389
- const r$1 = i2.obj.spec;
4390
- if (t.name === r$1.name && t.valueType === r$1.valueType && t.axesSpec.length === r$1.axesSpec.length && W(t.domain, r$1.domain)) {
4391
- for (let s = 0; s < t.axesSpec.length; ++s) {
4392
- const o = t.axesSpec[s], a = r$1.axesSpec[s];
4393
- if (o.name !== a.name || o.type !== a.type || !W(o.domain, a.domain))
4404
+ const s = r$1.obj.spec;
4405
+ if (t.name === s.name && t.valueType === s.valueType && t.axesSpec.length === s.axesSpec.length && K(t.domain, s.domain)) {
4406
+ for (let i2 = 0; i2 < t.axesSpec.length; ++i2) {
4407
+ const o = t.axesSpec[i2], a = s.axesSpec[i2];
4408
+ if (o.name !== a.name || o.type !== a.type || !K(o.domain, a.domain))
4394
4409
  continue t;
4395
4410
  }
4396
- n.push(i2.obj);
4411
+ n.push(r$1.obj);
4397
4412
  }
4398
4413
  }
4399
4414
  return n;
4400
4415
  }
4401
4416
  }
4402
- function W(e, t) {
4417
+ function K(e, t) {
4403
4418
  if (e === void 0) return t === void 0;
4404
4419
  if (t === void 0) return true;
4405
4420
  for (const n in t)
4406
4421
  if (e[n] !== t[n]) return false;
4407
4422
  return true;
4408
4423
  }
4409
- class O {
4424
+ class D {
4410
4425
  constructor() {
4411
4426
  _(this, "ctx");
4412
4427
  _(this, "args");
4413
4428
  _(this, "uiState");
4414
- _(this, "resultPool", new vt());
4415
- this.ctx = l(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
4429
+ _(this, "resultPool", new Ot());
4430
+ this.ctx = u(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
4416
4431
  }
4417
4432
  getNamedAccessor(t) {
4418
4433
  const n = this.ctx.getAccessorHandleByName(t);
4419
- return n ? new v(n) : void 0;
4434
+ return n ? new w(n) : void 0;
4420
4435
  }
4421
4436
  get prerun() {
4422
- return this.getNamedAccessor(Y);
4437
+ return this.getNamedAccessor(st);
4423
4438
  }
4424
4439
  /**
4425
4440
  * @deprecated use prerun
@@ -4434,7 +4449,7 @@
4434
4449
  return this.precalc;
4435
4450
  }
4436
4451
  get outputs() {
4437
- return this.getNamedAccessor(Q);
4452
+ return this.getNamedAccessor(it);
4438
4453
  }
4439
4454
  /**
4440
4455
  * @deprecated use outputs
@@ -4442,19 +4457,39 @@
4442
4457
  get mainOutput() {
4443
4458
  return this.outputs;
4444
4459
  }
4460
+ /**
4461
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
4462
+ * @returns a map of axis value => label
4463
+ */
4464
+ findLabels(t) {
4465
+ const n = this.resultPool.getData();
4466
+ for (const r2 of n.entries) {
4467
+ if (!w$1(r2.obj)) continue;
4468
+ const s = r2.obj.spec;
4469
+ if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === t.name && s.axesSpec[0].type === t.type && K(t.domain, s.axesSpec[0].domain)) {
4470
+ if (r2.obj.data.resourceType.name !== "PColumnData/Json")
4471
+ throw Error(`Expected JSON column for labels, got: ${r2.obj.data.resourceType.name}`);
4472
+ return new Map(
4473
+ Object.entries(
4474
+ r2.obj.data.getDataAsJson().data
4475
+ ).map((o) => [JSON.parse(o[0])[0], o[1]])
4476
+ );
4477
+ }
4478
+ }
4479
+ }
4445
4480
  createPFrame(t) {
4446
- return this.ctx.createPFrame(t.map((n) => L(n, (i2) => i2.handle)));
4481
+ return this.ctx.createPFrame(t.map((n) => O$1(n, (r2) => r2.handle)));
4447
4482
  }
4448
4483
  createPTable(t) {
4449
4484
  var n;
4450
4485
  return "columns" in t ? n = {
4451
4486
  src: {
4452
- type: "inner",
4453
- entries: t.columns.map((i2) => ({ type: "column", column: i2 }))
4487
+ type: "full",
4488
+ entries: t.columns.map((r2) => ({ type: "column", column: r2 }))
4454
4489
  },
4455
4490
  filters: t.filters ?? [],
4456
4491
  sorting: t.sorting ?? []
4457
- } : n = t, this.ctx.createPTable(D(n, (i2) => L(i2, (r2) => r2.handle)));
4492
+ } : n = t, this.ctx.createPTable(E(n, (r2) => O$1(r2, (s) => s.handle)));
4458
4493
  }
4459
4494
  /** @deprecated scheduled for removal from SDK */
4460
4495
  getBlockLabel(t) {
@@ -4465,33 +4500,33 @@
4465
4500
  return this.ctx.getCurrentUnstableMarker();
4466
4501
  }
4467
4502
  }
4468
- const F = "1.12.0";
4469
- function At(e) {
4503
+ const C = "1.13.2";
4504
+ function kt(e) {
4470
4505
  return e.__renderLambda === true;
4471
4506
  }
4472
- function M(e) {
4507
+ function U(e) {
4473
4508
  if (e !== void 0)
4474
- return At(e) ? e.handle : e;
4509
+ return kt(e) ? e.handle : e;
4475
4510
  }
4476
- class f {
4477
- constructor(t, n, i2, r2, s, o, a) {
4478
- this._renderingMode = t, this._initialArgs = n, this._initialUiState = i2, this._outputs = r2, this._inputsValid = s, this._sections = o, this._title = a;
4511
+ class h {
4512
+ constructor(t, n, r2, s, i2, o, a) {
4513
+ this._renderingMode = t, this._initialArgs = n, this._initialUiState = r2, this._outputs = s, this._inputsValid = i2, this._sections = o, this._title = a;
4479
4514
  }
4480
4515
  static create(t = "Heavy") {
4481
- return new f(
4516
+ return new h(
4482
4517
  t,
4483
4518
  void 0,
4484
4519
  {},
4485
4520
  {},
4486
- V(true),
4487
- V([]),
4521
+ k(true),
4522
+ k([]),
4488
4523
  void 0
4489
4524
  );
4490
4525
  }
4491
- output(t, n, i2 = {}) {
4526
+ output(t, n, r2 = {}) {
4492
4527
  if (typeof n == "function") {
4493
- const r2 = `output#${t}`;
4494
- return P(r2, () => n(new O())), new f(
4528
+ const s = `output#${t}`;
4529
+ return O(s, () => n(new D())), new h(
4495
4530
  this._renderingMode,
4496
4531
  this._initialArgs,
4497
4532
  this._initialUiState,
@@ -4499,8 +4534,8 @@
4499
4534
  ...this._outputs,
4500
4535
  [t]: {
4501
4536
  __renderLambda: true,
4502
- handle: r2,
4503
- ...i2
4537
+ handle: s,
4538
+ ...r2
4504
4539
  }
4505
4540
  },
4506
4541
  this._inputsValid,
@@ -4508,7 +4543,7 @@
4508
4543
  this._title
4509
4544
  );
4510
4545
  } else
4511
- return new f(
4546
+ return new h(
4512
4547
  this._renderingMode,
4513
4548
  this._initialArgs,
4514
4549
  this._initialUiState,
@@ -4530,7 +4565,7 @@
4530
4565
  return this.inputsValid(t);
4531
4566
  }
4532
4567
  argsValid(t) {
4533
- return typeof t == "function" ? (P("inputsValid", () => t(new O())), new f(
4568
+ return typeof t == "function" ? (O("inputsValid", () => t(new D())), new h(
4534
4569
  this._renderingMode,
4535
4570
  this._initialArgs,
4536
4571
  this._initialUiState,
@@ -4541,7 +4576,7 @@
4541
4576
  },
4542
4577
  this._sections,
4543
4578
  this._title
4544
- )) : new f(
4579
+ )) : new h(
4545
4580
  this._renderingMode,
4546
4581
  this._initialArgs,
4547
4582
  this._initialUiState,
@@ -4555,7 +4590,7 @@
4555
4590
  return this.argsValid(t);
4556
4591
  }
4557
4592
  sections(t) {
4558
- return Array.isArray(t) ? this.sections(V(t)) : typeof t == "function" ? (P("sections", () => t(new O())), new f(
4593
+ return Array.isArray(t) ? this.sections(k(t)) : typeof t == "function" ? (O("sections", () => t(new D())), new h(
4559
4594
  this._renderingMode,
4560
4595
  this._initialArgs,
4561
4596
  this._initialUiState,
@@ -4563,7 +4598,7 @@
4563
4598
  this._inputsValid,
4564
4599
  { __renderLambda: true, handle: "sections" },
4565
4600
  this._title
4566
- )) : new f(
4601
+ )) : new h(
4567
4602
  this._renderingMode,
4568
4603
  this._initialArgs,
4569
4604
  this._initialUiState,
@@ -4574,7 +4609,7 @@
4574
4609
  );
4575
4610
  }
4576
4611
  title(t) {
4577
- return P("title", () => t(new O())), new f(
4612
+ return O("title", () => t(new D())), new h(
4578
4613
  this._renderingMode,
4579
4614
  this._initialArgs,
4580
4615
  this._initialUiState,
@@ -4589,7 +4624,7 @@
4589
4624
  * @deprecated use {@link withArgs}
4590
4625
  * */
4591
4626
  initialArgs(t) {
4592
- return new f(
4627
+ return new h(
4593
4628
  this._renderingMode,
4594
4629
  t,
4595
4630
  this._initialUiState,
@@ -4601,7 +4636,7 @@
4601
4636
  }
4602
4637
  /** Sets initial args for the block, this value must be specified. */
4603
4638
  withArgs(t) {
4604
- return new f(
4639
+ return new h(
4605
4640
  this._renderingMode,
4606
4641
  t,
4607
4642
  this._initialUiState,
@@ -4613,7 +4648,7 @@
4613
4648
  }
4614
4649
  /** Defines type and sets initial value for block UiState. */
4615
4650
  withUiState(t) {
4616
- return new f(
4651
+ return new h(
4617
4652
  this._renderingMode,
4618
4653
  this._initialArgs,
4619
4654
  t,
@@ -4630,7 +4665,7 @@
4630
4665
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
4631
4666
  const t = {
4632
4667
  v3: {
4633
- sdkVersion: F,
4668
+ sdkVersion: C,
4634
4669
  renderingMode: this._renderingMode,
4635
4670
  initialArgs: this._initialArgs,
4636
4671
  initialUiState: this._initialUiState,
@@ -4640,29 +4675,29 @@
4640
4675
  outputs: this._outputs
4641
4676
  },
4642
4677
  // fields below are added to allow previous desktop versions read generated configs
4643
- sdkVersion: F,
4678
+ sdkVersion: C,
4644
4679
  renderingMode: this._renderingMode,
4645
4680
  initialArgs: this._initialArgs,
4646
- inputsValid: M(this._inputsValid),
4647
- sections: M(this._sections),
4681
+ inputsValid: U(this._inputsValid),
4682
+ sections: U(this._sections),
4648
4683
  outputs: Object.fromEntries(
4649
- Object.entries(this._outputs).map(([n, i2]) => [n, M(i2)])
4684
+ Object.entries(this._outputs).map(([n, r2]) => [n, U(r2)])
4650
4685
  )
4651
4686
  };
4652
- return ut() ? q({ sdkVersion: F }) : { config: t };
4687
+ return _t() ? rt({ sdkVersion: C }) : { config: t };
4653
4688
  }
4654
4689
  }
4655
4690
  const $BlockArgs = z.object({
4656
4691
  numbers: z.array(z.coerce.number())
4657
4692
  });
4658
- const platforma = f.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => {
4693
+ const platforma = h.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => {
4659
4694
  var _a, _b;
4660
4695
  return (_b = (_a = ctx.outputs) == null ? void 0 : _a.resolve("numbers")) == null ? void 0 : _b.getDataAsJson();
4661
4696
  }).output("pFrame", (ctx) => {
4662
4697
  const collection = ctx.resultPool.getData();
4663
4698
  if (collection === void 0 || !collection.isComplete) return void 0;
4664
4699
  const valueTypes = ["Int", "Long", "Float", "Double", "String", "Bytes"];
4665
- const columns = collection.entries.map(({ obj }) => obj).filter(x).filter((column) => valueTypes.find((valueType) => valueType === column.spec.valueType));
4700
+ const columns = collection.entries.map(({ obj }) => obj).filter(w$1).filter((column) => valueTypes.find((valueType) => valueType === column.spec.valueType));
4666
4701
  try {
4667
4702
  return ctx.createPFrame(columns);
4668
4703
  } catch (err) {
@@ -4674,11 +4709,11 @@
4674
4709
  if (!join) return void 0;
4675
4710
  const collection = ctx.resultPool.getData();
4676
4711
  if (!collection || !collection.isComplete) return void 0;
4677
- const columns = collection.entries.map(({ obj }) => obj).filter(x);
4712
+ const columns = collection.entries.map(({ obj }) => obj).filter(w$1);
4678
4713
  if (columns.length === 0) return void 0;
4679
4714
  let columnMissing = false;
4680
4715
  const src = i(join, (idAndSpec) => {
4681
- const column = columns.find((it) => it.id === idAndSpec.columnId);
4716
+ const column = columns.find((it2) => it2.id === idAndSpec.columnId);
4682
4717
  if (!column) columnMissing = true;
4683
4718
  return column;
4684
4719
  });