@milaboratories/milaboratories.ui-examples.model 1.0.46 → 1.0.48

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
@@ -194,10 +194,10 @@
194
194
  fieldErrors._errors.push(mapper(issue));
195
195
  } else {
196
196
  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;
197
+ let i = 0;
198
+ while (i < issue.path.length) {
199
+ const el = issue.path[i];
200
+ const terminal = i === issue.path.length - 1;
201
201
  if (!terminal) {
202
202
  curr[el] = curr[el] || { _errors: [] };
203
203
  } else {
@@ -205,7 +205,7 @@
205
205
  curr[el]._errors.push(mapper(issue));
206
206
  }
207
207
  curr = curr[el];
208
- i2++;
208
+ i++;
209
209
  }
210
210
  }
211
211
  }
@@ -409,12 +409,12 @@
409
409
  }
410
410
  static mergeArray(status, results) {
411
411
  const arrayValue = [];
412
- for (const s of results) {
413
- if (s.status === "aborted")
412
+ for (const s2 of results) {
413
+ if (s2.status === "aborted")
414
414
  return INVALID;
415
- if (s.status === "dirty")
415
+ if (s2.status === "dirty")
416
416
  status.dirty();
417
- arrayValue.push(s.value);
417
+ arrayValue.push(s2.value);
418
418
  }
419
419
  return { status: status.value, value: arrayValue };
420
420
  }
@@ -2051,14 +2051,14 @@
2051
2051
  }
2052
2052
  }
2053
2053
  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));
2054
+ return Promise.all([...ctx.data].map((item, i) => {
2055
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2056
2056
  })).then((result2) => {
2057
2057
  return ParseStatus.mergeArray(status, result2);
2058
2058
  });
2059
2059
  }
2060
- const result = [...ctx.data].map((item, i2) => {
2061
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
2060
+ const result = [...ctx.data].map((item, i) => {
2061
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2062
2062
  });
2063
2063
  return ParseStatus.mergeArray(status, result);
2064
2064
  }
@@ -2986,7 +2986,7 @@
2986
2986
  }
2987
2987
  return { status: status.value, value: parsedSet };
2988
2988
  }
2989
- const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
2989
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2990
2990
  if (ctx.common.async) {
2991
2991
  return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2992
2992
  } else {
@@ -3914,33 +3914,47 @@
3914
3914
  quotelessJson,
3915
3915
  ZodError
3916
3916
  });
3917
- function c(n) {
3918
- throw new Error("Unexpected object: " + n);
3917
+ function c(t) {
3918
+ throw new Error("Unexpected object: " + t);
3919
3919
  }
3920
- function D$1(n, t) {
3921
- return { ...n, src: i(n.src, t) };
3920
+ function A(t) {
3921
+ const { type: n, name: r, domain: e } = t;
3922
+ return { type: n, name: r, ...e && { domain: e } };
3922
3923
  }
3923
- function i(n, t) {
3924
- switch (n.type) {
3924
+ function F(t, n) {
3925
+ if (t === void 0) return n === void 0;
3926
+ if (n === void 0) return true;
3927
+ for (const r in n)
3928
+ if (t[r] !== n[r]) return false;
3929
+ return true;
3930
+ }
3931
+ function H(t, n) {
3932
+ return t.name === n.name && F(t.domain, n.domain);
3933
+ }
3934
+ function J(t, n) {
3935
+ return { ...t, src: s(t.src, n) };
3936
+ }
3937
+ function s(t, n) {
3938
+ switch (t.type) {
3925
3939
  case "column":
3926
3940
  return {
3927
3941
  type: "column",
3928
- column: t(n.column)
3942
+ column: n(t.column)
3929
3943
  };
3930
3944
  case "inner":
3931
3945
  case "full":
3932
3946
  return {
3933
- type: n.type,
3934
- entries: n.entries.map((e) => i(e, t))
3947
+ type: t.type,
3948
+ entries: t.entries.map((r) => s(r, n))
3935
3949
  };
3936
3950
  case "outer":
3937
3951
  return {
3938
3952
  type: "outer",
3939
- primary: i(n.primary, t),
3940
- secondary: n.secondary.map((e) => i(e, t))
3953
+ primary: s(t.primary, n),
3954
+ secondary: t.secondary.map((r) => s(r, n))
3941
3955
  };
3942
3956
  default:
3943
- c(n);
3957
+ c(t);
3944
3958
  }
3945
3959
  }
3946
3960
  z.object({
@@ -3950,24 +3964,24 @@
3950
3964
  }).describe(
3951
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."
3952
3966
  ).strict().readonly();
3953
- function r(n) {
3954
- return n.kind === "PColumn";
3967
+ function o(t) {
3968
+ return t.kind === "PColumn";
3955
3969
  }
3956
- function w(n) {
3957
- return r(n.spec);
3970
+ function S$1(t) {
3971
+ return o(t.spec);
3958
3972
  }
3959
- function O$1(n) {
3960
- if (!w(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
3961
- return n;
3973
+ function K$1(t) {
3974
+ if (!S$1(t)) throw new Error(`not a PColumn (kind = ${t.spec.kind})`);
3975
+ return t;
3962
3976
  }
3963
- function J(n, t) {
3964
- return n === void 0 ? void 0 : {
3965
- ...n,
3966
- data: t(n.data)
3977
+ function Q$1(t, n) {
3978
+ return t === void 0 ? void 0 : {
3979
+ ...t,
3980
+ data: n(t.data)
3967
3981
  };
3968
3982
  }
3969
- function W(n, t) {
3970
- return n.ok ? { ok: true, value: t(n.value) } : n;
3983
+ function X$1(t, n) {
3984
+ return t.ok ? { ok: true, value: n(t.value) } : t;
3971
3985
  }
3972
3986
  var ce = Object.defineProperty;
3973
3987
  var de = (t, e, n) => e in t ? ce(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
@@ -4000,16 +4014,16 @@
4000
4014
  const N = /* @__PURE__ */ new Map();
4001
4015
  function we(t, e) {
4002
4016
  t in u().callbackRegistry || (u().callbackRegistry[t] = (n) => {
4003
- for (const r2 of N.get(t))
4004
- r2(n);
4017
+ for (const r of N.get(t))
4018
+ r(n);
4005
4019
  }, N.set(t, [])), N.get(t).push(e);
4006
4020
  }
4007
4021
  class g {
4008
- constructor(e, n = (r2) => r2) {
4022
+ constructor(e, n = (r) => r) {
4009
4023
  v(this, "isResolved", false);
4010
4024
  v(this, "resolvedValue");
4011
- this.handle = e, this.postProcess = n, we(e, (r2) => {
4012
- this.resolvedValue = n(r2), this.isResolved = true;
4025
+ this.handle = e, this.postProcess = n, we(e, (r) => {
4026
+ this.resolvedValue = n(r), this.isResolved = true;
4013
4027
  });
4014
4028
  }
4015
4029
  map(e) {
@@ -4017,8 +4031,8 @@
4017
4031
  }
4018
4032
  mapDefined(e) {
4019
4033
  return new g(this.handle, (n) => {
4020
- const r2 = this.postProcess(n);
4021
- return r2 ? e(r2) : void 0;
4034
+ const r = this.postProcess(n);
4035
+ return r ? e(r) : void 0;
4022
4036
  });
4023
4037
  }
4024
4038
  toJSON() {
@@ -4034,27 +4048,27 @@
4034
4048
  }
4035
4049
  resolve(...e) {
4036
4050
  const n = e.map(
4037
- (r2) => ({
4051
+ (r) => ({
4038
4052
  assertFieldType: "Input",
4039
- ...typeof r2 == "string" ? { field: r2 } : r2
4053
+ ...typeof r == "string" ? { field: r } : r
4040
4054
  })
4041
4055
  );
4042
4056
  return this.resolveWithCommon({}, ...n);
4043
4057
  }
4044
4058
  resolveOutput(...e) {
4045
4059
  const n = e.map(
4046
- (r2) => ({
4060
+ (r) => ({
4047
4061
  assertFieldType: "Output",
4048
- ...typeof r2 == "string" ? { field: r2 } : r2
4062
+ ...typeof r == "string" ? { field: r } : r
4049
4063
  })
4050
4064
  );
4051
4065
  return this.resolveWithCommon({}, ...n);
4052
4066
  }
4053
4067
  resolveInput(...e) {
4054
4068
  const n = e.map(
4055
- (r2) => ({
4069
+ (r) => ({
4056
4070
  assertFieldType: "Input",
4057
- ...typeof r2 == "string" ? { field: r2 } : r2
4071
+ ...typeof r == "string" ? { field: r } : r
4058
4072
  })
4059
4073
  );
4060
4074
  return this.resolveWithCommon({}, ...n);
@@ -4118,26 +4132,26 @@
4118
4132
  *
4119
4133
  */
4120
4134
  getPColumns(e = false, n = "") {
4121
- const r2 = this.parsePObjectCollection(e, n);
4122
- return r2 === void 0 ? void 0 : Object.entries(r2).map(([, i2]) => {
4123
- if (!w(i2)) throw new Error(`not a PColumn (kind = ${i2.spec.kind})`);
4124
- return i2;
4135
+ const r = this.parsePObjectCollection(e, n);
4136
+ return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
4137
+ if (!S$1(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
4138
+ return i;
4125
4139
  });
4126
4140
  }
4127
4141
  /**
4128
4142
  *
4129
4143
  */
4130
4144
  parsePObjectCollection(e = false, n = "") {
4131
- const r2 = u().parsePObjectCollection(
4145
+ const r = u().parsePObjectCollection(
4132
4146
  this.handle,
4133
4147
  e,
4134
4148
  n
4135
4149
  );
4136
- if (r2 === void 0) return;
4137
- const s = {};
4138
- for (const [i2, o] of Object.entries(r2))
4139
- s[i2] = J(o, (a) => new S(a));
4140
- return s;
4150
+ if (r === void 0) return;
4151
+ const s2 = {};
4152
+ for (const [i, o2] of Object.entries(r))
4153
+ s2[i] = Q$1(o2, (a) => new S(a));
4154
+ return s2;
4141
4155
  }
4142
4156
  getFileContentAsBase64() {
4143
4157
  return new g(u().getBlobContentAsBase64(this.handle));
@@ -4211,18 +4225,18 @@
4211
4225
  }
4212
4226
  }
4213
4227
  mapFields(e, n) {
4214
- const { fieldType: r2, requireLocked: s, skipUnresolved: i2 } = {
4228
+ const { fieldType: r, requireLocked: s2, skipUnresolved: i } = {
4215
4229
  fieldType: "Input",
4216
4230
  requireLocked: true,
4217
4231
  skipUnresolved: false,
4218
4232
  ...n
4219
- }, o = e;
4220
- if (s && (r2 === "Input" && !this.getInputsLocked() || r2 === "Output" && !this.getOutputsLocked()))
4233
+ }, o2 = e;
4234
+ if (s2 && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4221
4235
  return;
4222
- let l = (r2 === "Input" ? this.listInputFields() : r2 === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4223
- (c2) => [c2, this.resolve({ field: c2, assertFieldType: r2 })]
4236
+ let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4237
+ (c2) => [c2, this.resolve({ field: c2, assertFieldType: r })]
4224
4238
  );
4225
- return i2 && (l = l.filter((c2) => c2[1] !== void 0)), l.map(([c2, f]) => o(c2, f));
4239
+ return i && (l = l.filter((c2) => c2[1] !== void 0)), l.map(([c2, f]) => o2(c2, f));
4226
4240
  }
4227
4241
  }
4228
4242
  const se = "staging", ie = "main";
@@ -4233,22 +4247,22 @@
4233
4247
  label: z.string()
4234
4248
  }), Ce = z.array(Ie), Re = 1e-3, Te = "__LABEL__", Q = "__LABEL__@1";
4235
4249
  function Fe(t, e, n = {}) {
4236
- const r2 = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i2 = t.map((d) => {
4237
- var z2, Y;
4238
- const m = e(d), y = (z2 = m.annotations) == null ? void 0 : z2[Ae], F = (Y = m.annotations) == null ? void 0 : Y[Pe], b = (F ? Ce.safeParse(JSON.parse(F)).data : void 0) ?? [];
4250
+ const r = /* @__PURE__ */ new Map(), s2 = /* @__PURE__ */ new Map(), i = t.map((d) => {
4251
+ var q, z2;
4252
+ const m = e(d), y = (q = m.annotations) == null ? void 0 : q[Ae], F2 = (z2 = m.annotations) == null ? void 0 : z2[Pe], b = (F2 ? Ce.safeParse(JSON.parse(F2)).data : void 0) ?? [];
4239
4253
  if (y) {
4240
4254
  const _ = { label: y, type: Te, importance: -2 };
4241
4255
  n.addLabelAsSuffix ? b.push(_) : b.splice(0, 0, _);
4242
4256
  }
4243
- const E = [], q = /* @__PURE__ */ new Map();
4257
+ const E = [], W = /* @__PURE__ */ new Map();
4244
4258
  for (let _ = b.length - 1; _ >= 0; --_) {
4245
- const { type: V } = b[_], ue = b[_].importance ?? 0, j = (q.get(V) ?? 0) + 1;
4246
- q.set(V, j);
4259
+ const { type: V } = b[_], ue = b[_].importance ?? 0, j = (W.get(V) ?? 0) + 1;
4260
+ W.set(V, j);
4247
4261
  const I = `${V}@${j}`;
4248
- s.set(I, (s.get(I) ?? 0) + 1), r2.set(
4262
+ s2.set(I, (s2.get(I) ?? 0) + 1), r.set(
4249
4263
  I,
4250
4264
  Math.max(
4251
- r2.get(I) ?? Number.NEGATIVE_INFINITY,
4265
+ r.get(I) ?? Number.NEGATIVE_INFINITY,
4252
4266
  ue - (b.length - _) * Re
4253
4267
  )
4254
4268
  ), E.push({ ...b[_], fullType: I, occurenceIndex: j });
@@ -4259,39 +4273,39 @@
4259
4273
  label: y,
4260
4274
  fullTrace: E
4261
4275
  };
4262
- }), o = [], a = [], l = [...r2];
4276
+ }), o2 = [], a = [], l = [...r];
4263
4277
  l.sort(([, d], [, m]) => m - d);
4264
4278
  for (const [d] of l)
4265
- d.endsWith("@1") || s.get(d) === t.length ? o.push(d) : a.push(d);
4266
- const c2 = (d) => i2.map((m) => {
4267
- const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), F = n.separator ?? " / ";
4279
+ d.endsWith("@1") || s2.get(d) === t.length ? o2.push(d) : a.push(d);
4280
+ const c2 = (d) => i.map((m) => {
4281
+ const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), F2 = n.separator ?? " / ";
4268
4282
  return {
4269
- label: y.join(F),
4283
+ label: y.join(F2),
4270
4284
  value: m.value
4271
4285
  };
4272
4286
  });
4273
- if (o.length === 0) {
4287
+ if (o2.length === 0) {
4274
4288
  if (a.length !== 0) throw new Error("Assertion error.");
4275
4289
  return c2(new Set(Q));
4276
4290
  }
4277
- let f = 0, w2 = 0;
4278
- for (; f < o.length; ) {
4291
+ let f = 0, w = 0;
4292
+ for (; f < o2.length; ) {
4279
4293
  const d = /* @__PURE__ */ new Set();
4280
4294
  n.includeNativeLabel && d.add(Q);
4281
- for (let y = 0; y < f; ++y) d.add(o[y]);
4282
- d.add(o[w2]);
4295
+ for (let y = 0; y < f; ++y) d.add(o2[y]);
4296
+ d.add(o2[w]);
4283
4297
  const m = c2(d);
4284
4298
  if (new Set(m.map((y) => y.label)).size === t.length) return m;
4285
- w2++, w2 == o.length && (f++, w2 = f);
4299
+ w++, w == o2.length && (f++, w = f);
4286
4300
  }
4287
- return c2(/* @__PURE__ */ new Set([...o, ...a]));
4301
+ return c2(/* @__PURE__ */ new Set([...o2, ...a]));
4288
4302
  }
4289
4303
  class Oe {
4290
4304
  constructor() {
4291
4305
  v(this, "ctx", u());
4292
4306
  v(this, "defaultLabelFn", (e, n) => {
4293
- var r2;
4294
- return ((r2 = e.annotations) == null ? void 0 : r2["pl7.app/label"]) ?? "Unlabelled";
4307
+ var r;
4308
+ return ((r = e.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
4295
4309
  });
4296
4310
  }
4297
4311
  /**
@@ -4301,13 +4315,13 @@
4301
4315
  return this.ctx.calculateOptions(e);
4302
4316
  }
4303
4317
  getOptions(e, n) {
4304
- const r2 = this.getSpecs().entries.filter((s) => e(s.obj));
4305
- return typeof n == "object" || typeof n > "u" ? Fe(r2, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i2 }) => ({
4306
- ref: s,
4307
- label: i2
4308
- })) : r2.map((s) => ({
4309
- ref: s.ref,
4310
- label: n(s.obj, s.ref)
4318
+ const r = this.getSpecs().entries.filter((s2) => e(s2.obj));
4319
+ return typeof n == "object" || typeof n > "u" ? Fe(r, (s2) => s2.obj, n ?? {}).map(({ value: { ref: s2 }, label: i }) => ({
4320
+ ref: s2,
4321
+ label: i
4322
+ })) : r.map((s2) => ({
4323
+ ref: s2.ref,
4324
+ label: n(s2.obj, s2.ref)
4311
4325
  }));
4312
4326
  }
4313
4327
  /**
@@ -4343,7 +4357,7 @@
4343
4357
  ref: n.ref,
4344
4358
  obj: {
4345
4359
  ...n.obj,
4346
- data: W(n.obj.data, (r2) => new S(r2))
4360
+ data: X$1(n.obj.data, (r) => new S(r))
4347
4361
  }
4348
4362
  }))
4349
4363
  };
@@ -4364,10 +4378,10 @@
4364
4378
  getDataByRef(e) {
4365
4379
  var n;
4366
4380
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4367
- (r2) => r2.ref.blockId === e.blockId && r2.ref.name === e.name
4368
- )) == null ? void 0 : n.obj : J(
4381
+ (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4382
+ )) == null ? void 0 : n.obj : Q$1(
4369
4383
  this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
4370
- (r2) => new S(r2)
4384
+ (r) => new S(r)
4371
4385
  );
4372
4386
  }
4373
4387
  /**
@@ -4378,7 +4392,7 @@
4378
4392
  getPColumnByRef(e) {
4379
4393
  const n = this.getDataByRef(e);
4380
4394
  if (n)
4381
- return O$1(n);
4395
+ return K$1(n);
4382
4396
  }
4383
4397
  /**
4384
4398
  * @param ref a Ref
@@ -4387,7 +4401,7 @@
4387
4401
  getSpecByRef(e) {
4388
4402
  var n;
4389
4403
  return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
4390
- (r2) => r2.ref.blockId === e.blockId && r2.ref.name === e.name
4404
+ (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4391
4405
  )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
4392
4406
  }
4393
4407
  /**
@@ -4397,23 +4411,23 @@
4397
4411
  */
4398
4412
  findDataWithCompatibleSpec(e) {
4399
4413
  const n = [];
4400
- e: for (const r$1 of this.getData().entries) {
4401
- if (!r(r$1.obj.spec))
4414
+ e: for (const r of this.getData().entries) {
4415
+ if (!o(r.obj.spec))
4402
4416
  continue;
4403
- const s = r$1.obj.spec;
4404
- if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && K(e.domain, s.domain)) {
4405
- for (let i2 = 0; i2 < e.axesSpec.length; ++i2) {
4406
- const o = e.axesSpec[i2], a = s.axesSpec[i2];
4407
- if (o.name !== a.name || o.type !== a.type || !K(o.domain, a.domain))
4417
+ const s2 = r.obj.spec;
4418
+ if (e.name === s2.name && e.valueType === s2.valueType && e.axesSpec.length === s2.axesSpec.length && $(e.domain, s2.domain)) {
4419
+ for (let i = 0; i < e.axesSpec.length; ++i) {
4420
+ const o2 = e.axesSpec[i], a = s2.axesSpec[i];
4421
+ if (o2.name !== a.name || o2.type !== a.type || !$(o2.domain, a.domain))
4408
4422
  continue e;
4409
4423
  }
4410
- n.push(r$1.obj);
4424
+ n.push(r.obj);
4411
4425
  }
4412
4426
  }
4413
4427
  return n;
4414
4428
  }
4415
4429
  }
4416
- function K(t, e) {
4430
+ function $(t, e) {
4417
4431
  if (t === void 0) return e === void 0;
4418
4432
  if (e === void 0) return true;
4419
4433
  for (const n in e)
@@ -4462,33 +4476,33 @@
4462
4476
  */
4463
4477
  findLabels(e) {
4464
4478
  const n = this.resultPool.getData();
4465
- for (const r2 of n.entries) {
4466
- if (!w(r2.obj)) continue;
4467
- const s = r2.obj.spec;
4468
- if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && K(e.domain, s.axesSpec[0].domain)) {
4469
- if (r2.obj.data.resourceType.name !== "PColumnData/Json")
4470
- throw Error(`Expected JSON column for labels, got: ${r2.obj.data.resourceType.name}`);
4479
+ for (const r of n.entries) {
4480
+ if (!S$1(r.obj)) continue;
4481
+ const s2 = r.obj.spec;
4482
+ if (s2.name === "pl7.app/label" && s2.axesSpec.length === 1 && s2.axesSpec[0].name === e.name && s2.axesSpec[0].type === e.type && $(e.domain, s2.axesSpec[0].domain)) {
4483
+ if (r.obj.data.resourceType.name !== "PColumnData/Json")
4484
+ throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
4471
4485
  return new Map(
4472
4486
  Object.entries(
4473
- r2.obj.data.getDataAsJson().data
4474
- ).map((o) => [JSON.parse(o[0])[0], o[1]])
4487
+ r.obj.data.getDataAsJson().data
4488
+ ).map((o2) => [JSON.parse(o2[0])[0], o2[1]])
4475
4489
  );
4476
4490
  }
4477
4491
  }
4478
4492
  }
4479
4493
  createPFrame(e) {
4480
- return this.ctx.createPFrame(e.map((n) => J(n, (r2) => r2.handle)));
4494
+ return this.ctx.createPFrame(e.map((n) => Q$1(n, (r) => r.handle)));
4481
4495
  }
4482
4496
  createPTable(e) {
4483
4497
  var n;
4484
4498
  return "columns" in e ? n = {
4485
4499
  src: {
4486
4500
  type: "full",
4487
- entries: e.columns.map((r2) => ({ type: "column", column: r2 }))
4501
+ entries: e.columns.map((r) => ({ type: "column", column: r }))
4488
4502
  },
4489
4503
  filters: e.filters ?? [],
4490
4504
  sorting: e.sorting ?? []
4491
- } : n = e, this.ctx.createPTable(D$1(n, (r2) => J(r2, (s) => s.handle)));
4505
+ } : n = e, this.ctx.createPTable(J(n, (r) => Q$1(r, (s2) => s2.handle)));
4492
4506
  }
4493
4507
  /** @deprecated scheduled for removal from SDK */
4494
4508
  getBlockLabel(e) {
@@ -4499,7 +4513,83 @@
4499
4513
  return this.ctx.getCurrentUnstableMarker();
4500
4514
  }
4501
4515
  }
4502
- const C = "1.14.1";
4516
+ const T = "PColumnData/", K = T + "ResourceMap", G = T + "Partitioned/ResourceMap", Z = T + "JsonPartitioned", M = T + "BinaryPartitioned", ae = T + "Partitioned/", ee = ae + "JsonPartitioned", B = ae + "BinaryPartitioned";
4517
+ const te = (t) => {
4518
+ if (!t.endsWith(".index")) {
4519
+ if (t.endsWith(".values"))
4520
+ return t.substring(0, t.length - 7);
4521
+ throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4522
+ }
4523
+ };
4524
+ function De(t) {
4525
+ if (!t) return;
4526
+ const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
4527
+ let s2 = 0;
4528
+ switch (e) {
4529
+ case K:
4530
+ s2 = n.keyLength;
4531
+ break;
4532
+ case G:
4533
+ s2 = n.partitionKeyLength + n.keyLength;
4534
+ break;
4535
+ case Z:
4536
+ case M:
4537
+ s2 = n.partitionKeyLength;
4538
+ break;
4539
+ case B:
4540
+ case ee:
4541
+ s2 = n.superPartitionKeyLength + n.partitionKeyLength;
4542
+ break;
4543
+ }
4544
+ switch (e) {
4545
+ case K:
4546
+ case Z:
4547
+ case M:
4548
+ for (let i of t.listInputFields()) {
4549
+ if (e === M) {
4550
+ const a = te(i);
4551
+ if (a) i = a;
4552
+ else continue;
4553
+ }
4554
+ const o2 = [...JSON.parse(i)];
4555
+ r.push(o2);
4556
+ }
4557
+ break;
4558
+ case G:
4559
+ case B:
4560
+ case ee:
4561
+ for (const i of t.listInputFields()) {
4562
+ const o2 = [...JSON.parse(i)], a = t.resolve({ field: i, assertFieldType: "Input" });
4563
+ if (a !== void 0)
4564
+ for (let l of a.listInputFields()) {
4565
+ if (e === B) {
4566
+ const f = te(l);
4567
+ if (f) l = f;
4568
+ else continue;
4569
+ }
4570
+ const c2 = [...o2, ...JSON.parse(l)];
4571
+ r.push(c2);
4572
+ }
4573
+ }
4574
+ break;
4575
+ }
4576
+ return { data: r, keyLength: s2 };
4577
+ }
4578
+ function pt(t) {
4579
+ const e = De(t);
4580
+ if (!e) return;
4581
+ const { data: n, keyLength: r } = e, s2 = [];
4582
+ for (let i = 0; i < r; ++i)
4583
+ s2.push(/* @__PURE__ */ new Set());
4584
+ for (const i of n) {
4585
+ if (i.length !== r)
4586
+ throw new Error("key length does not match partition length");
4587
+ for (let o2 = 0; o2 < r; ++o2)
4588
+ s2[o2].add(i[o2]);
4589
+ }
4590
+ return s2.map((i) => Array.from(i.values()));
4591
+ }
4592
+ const C = "1.17.0";
4503
4593
  function ke(t) {
4504
4594
  return t.__renderLambda === true;
4505
4595
  }
@@ -4508,8 +4598,8 @@
4508
4598
  return ke(t) ? t.handle : t;
4509
4599
  }
4510
4600
  class h {
4511
- constructor(e, n, r2, s, i2, o, a) {
4512
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = r2, this._outputs = s, this._inputsValid = i2, this._sections = o, this._title = a;
4601
+ constructor(e, n, r, s2, i, o2, a) {
4602
+ this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = s2, this._inputsValid = i, this._sections = o2, this._title = a;
4513
4603
  }
4514
4604
  static create(e = "Heavy") {
4515
4605
  return new h(
@@ -4522,10 +4612,10 @@
4522
4612
  void 0
4523
4613
  );
4524
4614
  }
4525
- output(e, n, r2 = {}) {
4615
+ output(e, n, r = {}) {
4526
4616
  if (typeof n == "function") {
4527
- const s = `output#${e}`;
4528
- return O(s, () => n(new D())), new h(
4617
+ const s2 = `output#${e}`;
4618
+ return O(s2, () => n(new D())), new h(
4529
4619
  this._renderingMode,
4530
4620
  this._initialArgs,
4531
4621
  this._initialUiState,
@@ -4533,8 +4623,8 @@
4533
4623
  ...this._outputs,
4534
4624
  [e]: {
4535
4625
  __renderLambda: true,
4536
- handle: s,
4537
- ...r2
4626
+ handle: s2,
4627
+ ...r
4538
4628
  }
4539
4629
  },
4540
4630
  this._inputsValid,
@@ -4680,48 +4770,75 @@
4680
4770
  inputsValid: U(this._inputsValid),
4681
4771
  sections: U(this._sections),
4682
4772
  outputs: Object.fromEntries(
4683
- Object.entries(this._outputs).map(([n, r2]) => [n, U(r2)])
4773
+ Object.entries(this._outputs).map(([n, r]) => [n, U(r)])
4684
4774
  )
4685
4775
  };
4686
4776
  return _e() ? re({ sdkVersion: C }) : { config: e };
4687
4777
  }
4688
4778
  }
4779
+ function ht(t, e, n, r) {
4780
+ var o2, a;
4781
+ const s2 = t.resultPool.getData().entries.map((l) => l.obj).filter(S$1).filter((l) => l.spec.name === "pl7.app/label" && l.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
4782
+ for (const l of e)
4783
+ for (const c2 of l.spec.axesSpec) {
4784
+ const f = A(c2);
4785
+ for (const w of s2)
4786
+ H(f, A(w.spec.axesSpec[0])) && i.set(w.id, w);
4787
+ }
4788
+ if (![...e, ...i.values()].find((l) => !l.data.getIsReadyOrError()))
4789
+ return t.createPTable({
4790
+ src: {
4791
+ type: "outer",
4792
+ primary: {
4793
+ type: "full",
4794
+ entries: e.map((l) => ({ type: "column", column: l }))
4795
+ },
4796
+ secondary: Array.from(i.values()).map((l) => ({ type: "column", column: l }))
4797
+ },
4798
+ filters: [...((o2 = n == null ? void 0 : n.pTableParams) == null ? void 0 : o2.filters) ?? [], ...r ?? []],
4799
+ sorting: ((a = n == null ? void 0 : n.pTableParams) == null ? void 0 : a.sorting) ?? []
4800
+ });
4801
+ }
4802
+ function gt(t, e, n) {
4803
+ const r = t.findLabels(e);
4804
+ return {
4805
+ axis: e,
4806
+ options: n.map((s2) => ({
4807
+ value: s2,
4808
+ label: (r == null ? void 0 : r.get(s2)) ?? s2.toString()
4809
+ })),
4810
+ defaultValue: n[0]
4811
+ };
4812
+ }
4689
4813
  const $BlockArgs = z.object({
4690
4814
  numbers: z.array(z.coerce.number())
4691
4815
  });
4692
4816
  const platforma = h.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => {
4693
4817
  var _a, _b;
4694
4818
  return (_b = (_a = ctx.outputs) == null ? void 0 : _a.resolve("numbers")) == null ? void 0 : _b.getDataAsJson();
4695
- }).output("pFrame", (ctx) => {
4696
- const collection = ctx.resultPool.getData();
4697
- if (collection === void 0 || !collection.isComplete) return void 0;
4698
- const valueTypes = ["Int", "Long", "Float", "Double", "String", "Bytes"];
4699
- const columns = collection.entries.map(({ obj }) => obj).filter(w).filter((column) => valueTypes.find((valueType) => valueType === column.spec.valueType));
4700
- try {
4701
- return ctx.createPFrame(columns);
4702
- } catch (err) {
4819
+ }).retentiveOutput("inputOptions", (ctx) => {
4820
+ return ctx.resultPool.getOptions((spec) => o(spec));
4821
+ }).output("sheets", (ctx) => {
4822
+ var _a, _b;
4823
+ if (!((_b = (_a = ctx.uiState) == null ? void 0 : _a.dataTableState) == null ? void 0 : _b.anchorColumn)) return void 0;
4824
+ const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);
4825
+ if (!anchor) return void 0;
4826
+ const r = pt(anchor.data);
4827
+ if (!r) return void 0;
4828
+ return r.map((values, i) => gt(ctx, anchor.spec.axesSpec[i], values));
4829
+ }).output("pt", (ctx) => {
4830
+ var _a, _b, _c, _d, _e2;
4831
+ if (((_b = (_a = ctx.uiState) == null ? void 0 : _a.dataTableState) == null ? void 0 : _b.anchorColumn) === void 0) return void 0;
4832
+ const anchorColumn = ctx.resultPool.getDataByRef(ctx.uiState.dataTableState.anchorColumn);
4833
+ if (!anchorColumn || !S$1(anchorColumn)) {
4834
+ console.error("Anchor column is undefined or is not PColumn", anchorColumn);
4703
4835
  return void 0;
4704
4836
  }
4705
- }).output("pTable", (ctx) => {
4706
- var _a, _b, _c, _d, _e2, _f, _g;
4707
- const join = (_c = (_b = (_a = ctx.uiState) == null ? void 0 : _a.dataTableState) == null ? void 0 : _b.tableState.pTableParams) == null ? void 0 : _c.join;
4708
- if (!join) return void 0;
4709
- const collection = ctx.resultPool.getData();
4710
- if (!collection || !collection.isComplete) return void 0;
4711
- const columns = collection.entries.map(({ obj }) => obj).filter(w);
4712
- if (columns.length === 0) return void 0;
4713
- let columnMissing = false;
4714
- const src = i(join, (idAndSpec) => {
4715
- const column = columns.find((it) => it.id === idAndSpec.columnId);
4716
- if (!column) columnMissing = true;
4717
- return column;
4718
- });
4719
- if (columnMissing) return void 0;
4720
- return ctx.createPTable({
4721
- src,
4722
- filters: ((_e2 = (_d = ctx.uiState.dataTableState) == null ? void 0 : _d.tableState.pTableParams) == null ? void 0 : _e2.filters) ?? [],
4723
- sorting: ((_g = (_f = ctx.uiState.dataTableState) == null ? void 0 : _f.tableState.pTableParams) == null ? void 0 : _g.sorting) ?? []
4724
- });
4837
+ if (((_c = ctx.uiState.dataTableState.tableState.pTableParams) == null ? void 0 : _c.filters) === void 0) return void 0;
4838
+ return ht(ctx, [anchorColumn], ctx.uiState.dataTableState.tableState, [
4839
+ ...(_d = ctx.uiState.dataTableState.tableState.pTableParams) == null ? void 0 : _d.filters,
4840
+ ...((_e2 = ctx.uiState.dataTableState.filterModel) == null ? void 0 : _e2.filters) ?? []
4841
+ ]);
4725
4842
  }).sections((ctx) => {
4726
4843
  return [
4727
4844
  { type: "link", href: "/", label: "Icons/Masks" },