@milaboratories/milaboratories.ui-examples.model 1.1.36 → 1.1.38

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
@@ -35,7 +35,7 @@
35
35
  }, "");
36
36
  return `{${values}}`;
37
37
  };
38
- const g = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
38
+ const Pe = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
39
39
  var util;
40
40
  (function(util2) {
41
41
  util2.assertEqual = (val) => val;
@@ -3103,7 +3103,7 @@
3103
3103
  });
3104
3104
  }
3105
3105
  const params = { errorMap: ctx.common.contextualErrorMap };
3106
- const fn = ctx.data;
3106
+ const fn2 = ctx.data;
3107
3107
  if (this._def.returns instanceof ZodPromise) {
3108
3108
  const me = this;
3109
3109
  return OK(async function(...args) {
@@ -3112,7 +3112,7 @@
3112
3112
  error.addIssue(makeArgsIssue(args, e));
3113
3113
  throw error;
3114
3114
  });
3115
- const result = await Reflect.apply(fn, this, parsedArgs);
3115
+ const result = await Reflect.apply(fn2, this, parsedArgs);
3116
3116
  const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3117
3117
  error.addIssue(makeReturnsIssue(result, e));
3118
3118
  throw error;
@@ -3126,7 +3126,7 @@
3126
3126
  if (!parsedArgs.success) {
3127
3127
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3128
3128
  }
3129
- const result = Reflect.apply(fn, this, parsedArgs.data);
3129
+ const result = Reflect.apply(fn2, this, parsedArgs.data);
3130
3130
  const parsedReturns = me._def.returns.safeParse(result, params);
3131
3131
  if (!parsedReturns.success) {
3132
3132
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
@@ -3832,7 +3832,7 @@
3832
3832
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3833
3833
  };
3834
3834
  const NEVER = INVALID;
3835
- var z$2 = /* @__PURE__ */ Object.freeze({
3835
+ var z$1 = /* @__PURE__ */ Object.freeze({
3836
3836
  __proto__: null,
3837
3837
  defaultErrorMap: errorMap,
3838
3838
  setErrorMap,
@@ -3949,12 +3949,12 @@
3949
3949
  ZodError
3950
3950
  });
3951
3951
  var $ = Object.defineProperty;
3952
- var L = (n2, t, e) => t in n2 ? $(n2, t, { enumerable: true, configurable: true, writable: true, value: e }) : n2[t] = e;
3953
- var p$1 = (n2, t, e) => L(n2, typeof t != "symbol" ? t + "" : t, e);
3952
+ var L$1 = (n2, t, e) => t in n2 ? $(n2, t, { enumerable: true, configurable: true, writable: true, value: e }) : n2[t] = e;
3953
+ var p$1 = (n2, t, e) => L$1(n2, typeof t != "symbol" ? t + "" : t, e);
3954
3954
  function w(n2) {
3955
3955
  throw new Error("Unexpected object: " + n2);
3956
3956
  }
3957
- function dn(n2) {
3957
+ function pn(n2) {
3958
3958
  if (!n2 || typeof n2 != "object")
3959
3959
  return false;
3960
3960
  const t = n2;
@@ -3971,7 +3971,7 @@
3971
3971
  return false;
3972
3972
  }
3973
3973
  }
3974
- function pn(n2, t) {
3974
+ function mn(n2, t) {
3975
3975
  if (n2 !== void 0)
3976
3976
  switch (n2.type) {
3977
3977
  case "Json":
@@ -3999,7 +3999,55 @@
3999
3999
  }
4000
4000
  }
4001
4001
  }
4002
+ function j(n2) {
4003
+ if (!n2 || typeof n2 != "object")
4004
+ return false;
4005
+ const t = n2;
4006
+ if (!("type" in t))
4007
+ return false;
4008
+ switch (t.type) {
4009
+ case "Json":
4010
+ return typeof t.keyLength == "number" && Array.isArray(t.data);
4011
+ case "JsonPartitioned":
4012
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4013
+ case "BinaryPartitioned":
4014
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4015
+ default:
4016
+ return false;
4017
+ }
4018
+ }
4019
+ function yn(n2) {
4020
+ return j(n2) ? n2.type === "JsonPartitioned" || n2.type === "BinaryPartitioned" : false;
4021
+ }
4002
4022
  function ln(n2) {
4023
+ switch (n2.type) {
4024
+ case "Json": {
4025
+ const t = Object.entries(n2.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4026
+ return {
4027
+ type: "Json",
4028
+ keyLength: n2.keyLength,
4029
+ data: t
4030
+ };
4031
+ }
4032
+ case "JsonPartitioned": {
4033
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4034
+ return {
4035
+ type: "JsonPartitioned",
4036
+ partitionKeyLength: n2.partitionKeyLength,
4037
+ parts: t
4038
+ };
4039
+ }
4040
+ case "BinaryPartitioned": {
4041
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4042
+ return {
4043
+ type: "BinaryPartitioned",
4044
+ partitionKeyLength: n2.partitionKeyLength,
4045
+ parts: t
4046
+ };
4047
+ }
4048
+ }
4049
+ }
4050
+ function hn(n2) {
4003
4051
  switch (n2.type) {
4004
4052
  case "Json": {
4005
4053
  const t = {};
@@ -4037,20 +4085,20 @@
4037
4085
  const { type: t, name: e, domain: r } = n2;
4038
4086
  return { type: t, name: e, ...r && { domain: r } };
4039
4087
  }
4040
- function Sn(n2) {
4041
- return g(y(n2));
4088
+ function En(n2) {
4089
+ return Pe(y(n2));
4042
4090
  }
4043
- function W(n2, t) {
4091
+ function X$1(n2, t) {
4044
4092
  if (n2 === void 0) return t === void 0;
4045
4093
  if (t === void 0) return true;
4046
4094
  for (const e in t)
4047
4095
  if (n2[e] !== t[e]) return false;
4048
4096
  return true;
4049
4097
  }
4050
- function X(n2, t) {
4051
- return n2.name === t.name && W(n2.domain, t.domain);
4098
+ function z(n2, t) {
4099
+ return n2.name === t.name && X$1(n2.domain, t.domain);
4052
4100
  }
4053
- function En(n2, t) {
4101
+ function Cn(n2, t) {
4054
4102
  return { ...n2, src: l$1(n2.src, t) };
4055
4103
  }
4056
4104
  function l$1(n2, t) {
@@ -4083,11 +4131,11 @@
4083
4131
  w(n2);
4084
4132
  }
4085
4133
  }
4086
- function z$1(n2) {
4087
- return g(n2);
4134
+ function G(n2) {
4135
+ return Pe(n2);
4088
4136
  }
4089
- function P(n2) {
4090
- return g(y(n2));
4137
+ function A(n2) {
4138
+ return Pe(y(n2));
4091
4139
  }
4092
4140
  function x(n2, t) {
4093
4141
  return JSON.stringify([n2, t]);
@@ -4107,7 +4155,7 @@
4107
4155
  e.sort((r, o) => r[0].localeCompare(o[0]));
4108
4156
  for (const [r, o] of e) {
4109
4157
  for (let i = 0; i < o.axesSpec.length; i++) {
4110
- const a = o.axesSpec[i], s2 = P(a);
4158
+ const a = o.axesSpec[i], s2 = A(a);
4111
4159
  this.axes.set(s2, { anchor: r, idx: i });
4112
4160
  }
4113
4161
  if (o.domain !== void 0) {
@@ -4153,7 +4201,7 @@
4153
4201
  r.domain ?? (r.domain = {}), r.domain[a] = c2 ? { anchor: c2 } : s2;
4154
4202
  }
4155
4203
  if (r.axes = t.axesSpec.map((a) => {
4156
- const s2 = P(a);
4204
+ const s2 = A(a);
4157
4205
  return this.axes.get(s2) ?? a;
4158
4206
  }), !e || e.length === 0)
4159
4207
  return r;
@@ -4183,10 +4231,10 @@
4183
4231
  * @returns A canonicalized string representation of the anchored column identifier
4184
4232
  */
4185
4233
  deriveS(t, e) {
4186
- return z$1(this.derive(t, e));
4234
+ return G(this.derive(t, e));
4187
4235
  }
4188
4236
  }
4189
- function Jn(n2, t) {
4237
+ function $n(n2, t) {
4190
4238
  const e = { ...t };
4191
4239
  if (e.domainAnchor !== void 0) {
4192
4240
  const r = n2[e.domainAnchor];
@@ -4210,10 +4258,10 @@
4210
4258
  }
4211
4259
  e.domain = r;
4212
4260
  }
4213
- return e.axes && (e.axes = e.axes.map((r) => G(n2, r))), e;
4261
+ return e.axes && (e.axes = e.axes.map((r) => Q$1(n2, r))), e;
4214
4262
  }
4215
- function G(n2, t) {
4216
- if (!Q$1(t))
4263
+ function Q$1(n2, t) {
4264
+ if (!Y(t))
4217
4265
  return t;
4218
4266
  const e = t.anchor, r = n2[e];
4219
4267
  if (!r)
@@ -4230,7 +4278,7 @@
4230
4278
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4231
4279
  return o[0];
4232
4280
  } else if ("id" in t) {
4233
- const o = r.axesSpec.filter((i) => X(t.id, y(i)));
4281
+ const o = r.axesSpec.filter((i) => z(t.id, y(i)));
4234
4282
  if (o.length > 1)
4235
4283
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4236
4284
  if (o.length === 0)
@@ -4239,20 +4287,20 @@
4239
4287
  }
4240
4288
  throw new Error("Unsupported axis reference type");
4241
4289
  }
4242
- function Q$1(n2) {
4290
+ function Y(n2) {
4243
4291
  return typeof n2 == "object" && "anchor" in n2;
4244
4292
  }
4245
4293
  function f(n2) {
4246
4294
  return n2.kind === "PColumn";
4247
4295
  }
4248
- function Y$1(n2) {
4296
+ function Z(n2) {
4249
4297
  return f(n2.spec);
4250
4298
  }
4251
- function Dn(n2) {
4252
- if (!Y$1(n2)) throw new Error(`not a PColumn (kind = ${n2.spec.kind})`);
4299
+ function In(n2) {
4300
+ if (!Z(n2)) throw new Error(`not a PColumn (kind = ${n2.spec.kind})`);
4253
4301
  return n2;
4254
4302
  }
4255
- function In(n2, t) {
4303
+ function Bn(n2, t) {
4256
4304
  return n2 === void 0 ? void 0 : {
4257
4305
  ...n2,
4258
4306
  data: t(n2.data)
@@ -4299,7 +4347,7 @@
4299
4347
  }
4300
4348
  return true;
4301
4349
  }
4302
- function N$1(n2, t) {
4350
+ function N(n2, t) {
4303
4351
  if (t.name !== void 0 && n2.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n2.name))
4304
4352
  return false;
4305
4353
  if (t.type !== void 0) {
@@ -4345,24 +4393,24 @@
4345
4393
  }
4346
4394
  return true;
4347
4395
  }
4348
- function Bn(n2) {
4349
- return Array.isArray(n2) ? (t) => n2.some((e) => f(t) && N$1(t, e)) : (t) => f(t) && N$1(t, n2);
4396
+ function Fn(n2) {
4397
+ return Array.isArray(n2) ? (t) => n2.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n2);
4350
4398
  }
4351
- z$2.object({
4352
- __isRef: z$2.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4353
- blockId: z$2.string().describe("Upstream block id"),
4354
- name: z$2.string().describe("Name of the output provided to the upstream block's output context")
4399
+ z$1.object({
4400
+ __isRef: z$1.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4401
+ blockId: z$1.string().describe("Upstream block id"),
4402
+ name: z$1.string().describe("Name of the output provided to the upstream block's output context")
4355
4403
  }).describe(
4356
4404
  "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."
4357
4405
  ).strict().readonly();
4358
- function Kn(n2) {
4406
+ function Rn(n2) {
4359
4407
  return typeof n2 == "object" && n2 !== null && "__isRef" in n2 && n2.__isRef === true && "blockId" in n2 && "name" in n2;
4360
4408
  }
4361
- function Mn(n2, t) {
4409
+ function _n(n2, t) {
4362
4410
  return n2.ok ? { ok: true, value: t(n2.value) } : n2;
4363
4411
  }
4364
- const rn = 24;
4365
- z$2.string().length(rn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4412
+ const on = 24;
4413
+ z$1.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4366
4414
  var stringify = { exports: {} };
4367
4415
  (function(module2, exports3) {
4368
4416
  exports3 = module2.exports = stringify2;
@@ -4387,82 +4435,82 @@
4387
4435
  };
4388
4436
  }
4389
4437
  })(stringify, stringify.exports);
4390
- const l = z$2.object({
4391
- type: z$2.literal("PlError"),
4392
- name: z$2.string(),
4393
- message: z$2.string(),
4438
+ const l = z$1.object({
4439
+ type: z$1.literal("PlError"),
4440
+ name: z$1.string(),
4441
+ message: z$1.string(),
4394
4442
  /** The message with all details needed for SDK developers. */
4395
- fullMessage: z$2.string().optional(),
4396
- stack: z$2.string().optional()
4443
+ fullMessage: z$1.string().optional(),
4444
+ stack: z$1.string().optional()
4397
4445
  }), c = l.extend({
4398
- cause: z$2.lazy(() => s).optional(),
4399
- errors: z$2.lazy(() => s.array()).optional()
4400
- }), m = z$2.object({
4401
- type: z$2.literal("StandardError"),
4402
- name: z$2.string(),
4403
- message: z$2.string(),
4404
- stack: z$2.string().optional()
4446
+ cause: z$1.lazy(() => s).optional(),
4447
+ errors: z$1.lazy(() => s.array()).optional()
4448
+ }), m = z$1.object({
4449
+ type: z$1.literal("StandardError"),
4450
+ name: z$1.string(),
4451
+ message: z$1.string(),
4452
+ stack: z$1.string().optional()
4405
4453
  }), p = m.extend({
4406
- cause: z$2.lazy(() => s).optional(),
4407
- errors: z$2.lazy(() => s.array()).optional()
4408
- }), s = z$2.union([p, c]);
4409
- const u = z$2.object({
4410
- name: z$2.string(),
4411
- message: z$2.string(),
4412
- fullMessage: z$2.string().optional(),
4413
- stack: z$2.string().optional()
4454
+ cause: z$1.lazy(() => s).optional(),
4455
+ errors: z$1.lazy(() => s.array()).optional()
4456
+ }), s = z$1.union([p, c]);
4457
+ const u = z$1.object({
4458
+ name: z$1.string(),
4459
+ message: z$1.string(),
4460
+ fullMessage: z$1.string().optional(),
4461
+ stack: z$1.string().optional()
4414
4462
  }), n = u.extend({
4415
- cause: z$2.lazy(() => n).optional(),
4416
- errors: z$2.lazy(() => n.array()).optional()
4463
+ cause: z$1.lazy(() => n).optional(),
4464
+ errors: z$1.lazy(() => n.array()).optional()
4417
4465
  });
4418
- var _e = Object.defineProperty;
4419
- var Ie = (t, e, n2) => e in t ? _e(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
4420
- var T = (t, e, n2) => Ie(t, typeof e != "symbol" ? e + "" : e, n2);
4421
- function Y(t) {
4466
+ var je = Object.defineProperty;
4467
+ var Ke = (t, e, n2) => e in t ? je(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
4468
+ var L = (t, e, n2) => Ke(t, typeof e != "symbol" ? e + "" : e, n2);
4469
+ function ee(t) {
4422
4470
  return { type: "Immediate", value: t };
4423
4471
  }
4424
- function Ke() {
4472
+ function Xe() {
4425
4473
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4426
4474
  }
4427
- function be(t) {
4475
+ function _e(t) {
4428
4476
  if (t && typeof globalThis.getPlatforma == "function")
4429
4477
  return globalThis.getPlatforma(t);
4430
4478
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4431
4479
  throw new Error("Can't get platforma instance.");
4432
4480
  }
4433
- function $e() {
4481
+ function Qe() {
4434
4482
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4435
4483
  }
4436
4484
  function h() {
4437
4485
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4438
4486
  throw new Error("Not in config rendering context");
4439
4487
  }
4440
- function q(t, e) {
4441
- const n2 = $e();
4488
+ function X(t, e) {
4489
+ const n2 = Qe();
4442
4490
  if (n2 === void 0) return false;
4443
4491
  if (t in n2.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4444
4492
  return n2.callbackRegistry[t] = e, true;
4445
4493
  }
4446
- const ne = /* @__PURE__ */ new Map();
4447
- function Je(t, e) {
4494
+ const ae = /* @__PURE__ */ new Map();
4495
+ function Ze(t, e) {
4448
4496
  t in h().callbackRegistry || (h().callbackRegistry[t] = (n2) => {
4449
- for (const r of ne.get(t))
4497
+ for (const r of ae.get(t))
4450
4498
  r(n2);
4451
- }, ne.set(t, [])), ne.get(t).push(e);
4499
+ }, ae.set(t, [])), ae.get(t).push(e);
4452
4500
  }
4453
- class S {
4501
+ class _ {
4454
4502
  constructor(e, n2 = (r) => r) {
4455
- T(this, "isResolved", false);
4456
- T(this, "resolvedValue");
4457
- this.handle = e, this.postProcess = n2, Je(e, (r) => {
4503
+ L(this, "isResolved", false);
4504
+ L(this, "resolvedValue");
4505
+ this.handle = e, this.postProcess = n2, Ze(e, (r) => {
4458
4506
  this.resolvedValue = n2(r), this.isResolved = true;
4459
4507
  });
4460
4508
  }
4461
4509
  map(e) {
4462
- return new S(this.handle, (n2) => e(this.postProcess(n2)));
4510
+ return new _(this.handle, (n2) => e(this.postProcess(n2)));
4463
4511
  }
4464
4512
  mapDefined(e) {
4465
- return new S(this.handle, (n2) => {
4513
+ return new _(this.handle, (n2) => {
4466
4514
  const r = this.postProcess(n2);
4467
4515
  return r ? e(r) : void 0;
4468
4516
  });
@@ -4471,7 +4519,7 @@
4471
4519
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4472
4520
  }
4473
4521
  }
4474
- function ie(t, e) {
4522
+ function pe(t, e) {
4475
4523
  return t === void 0 ? void 0 : e(t);
4476
4524
  }
4477
4525
  class I {
@@ -4513,7 +4561,7 @@
4513
4561
  ...this.resolvePath,
4514
4562
  ...n2.map((i) => typeof i == "string" ? i : i.field)
4515
4563
  ];
4516
- return ie(
4564
+ return pe(
4517
4565
  h().resolveWithCommon(this.handle, e, ...n2),
4518
4566
  (i) => new I(i, r)
4519
4567
  );
@@ -4535,7 +4583,7 @@
4535
4583
  }
4536
4584
  getError() {
4537
4585
  const e = [...this.resolvePath, "error"];
4538
- return ie(
4586
+ return pe(
4539
4587
  h().getError(this.handle),
4540
4588
  (n2) => new I(n2, e)
4541
4589
  );
@@ -4577,7 +4625,7 @@
4577
4625
  getPColumns(e = false, n2 = "") {
4578
4626
  const r = this.parsePObjectCollection(e, n2);
4579
4627
  return r === void 0 ? void 0 : Object.entries(r).map(([, s2]) => {
4580
- if (!Y$1(s2)) throw new Error(`not a PColumn (kind = ${s2.spec.kind})`);
4628
+ if (!Z(s2)) throw new Error(`not a PColumn (kind = ${s2.spec.kind})`);
4581
4629
  return s2;
4582
4630
  });
4583
4631
  }
@@ -4595,18 +4643,18 @@
4595
4643
  const i = {};
4596
4644
  for (const [s2, o] of Object.entries(r)) {
4597
4645
  const a = [...this.resolvePath, s2];
4598
- i[s2] = In(o, (c2) => new I(c2, a));
4646
+ i[s2] = Bn(o, (l2) => new I(l2, a));
4599
4647
  }
4600
4648
  return i;
4601
4649
  }
4602
4650
  getFileContentAsBase64() {
4603
- return new S(h().getBlobContentAsBase64(this.handle));
4651
+ return new _(h().getBlobContentAsBase64(this.handle));
4604
4652
  }
4605
4653
  getFileContentAsString() {
4606
- return new S(h().getBlobContentAsString(this.handle));
4654
+ return new _(h().getBlobContentAsString(this.handle));
4607
4655
  }
4608
4656
  getFileContentAsJson() {
4609
- return new S(
4657
+ return new _(
4610
4658
  h().getBlobContentAsString(this.handle)
4611
4659
  ).mapDefined((e) => JSON.parse(e));
4612
4660
  }
@@ -4626,7 +4674,7 @@
4626
4674
  * @returns downloaded file handle
4627
4675
  */
4628
4676
  getFileHandle() {
4629
- return new S(h().getDownloadedBlobContentHandle(this.handle));
4677
+ return new _(h().getDownloadedBlobContentHandle(this.handle));
4630
4678
  }
4631
4679
  /**
4632
4680
  * @deprecated use getFileHandle
@@ -4638,7 +4686,7 @@
4638
4686
  * @returns downloaded file handle
4639
4687
  */
4640
4688
  getRemoteFileHandle() {
4641
- return new S(h().getOnDemandBlobContentHandle(this.handle));
4689
+ return new _(h().getOnDemandBlobContentHandle(this.handle));
4642
4690
  }
4643
4691
  /**
4644
4692
  * @deprecated use getRemoteFileHandle
@@ -4650,22 +4698,22 @@
4650
4698
  * @returns the url to the extracted folder
4651
4699
  */
4652
4700
  extractArchiveAndGetURL(e) {
4653
- return new S(h().extractArchiveAndGetURL(this.handle, e));
4701
+ return new _(h().extractArchiveAndGetURL(this.handle, e));
4654
4702
  }
4655
4703
  getImportProgress() {
4656
- return new S(h().getImportProgress(this.handle));
4704
+ return new _(h().getImportProgress(this.handle));
4657
4705
  }
4658
4706
  getLastLogs(e) {
4659
- return new S(h().getLastLogs(this.handle, e));
4707
+ return new _(h().getLastLogs(this.handle, e));
4660
4708
  }
4661
4709
  getProgressLog(e) {
4662
- return new S(h().getProgressLog(this.handle, e));
4710
+ return new _(h().getProgressLog(this.handle, e));
4663
4711
  }
4664
4712
  getProgressLogWithInfo(e) {
4665
- return new S(h().getProgressLogWithInfo(this.handle, e));
4713
+ return new _(h().getProgressLogWithInfo(this.handle, e));
4666
4714
  }
4667
4715
  getLogHandle() {
4668
- return new S(h().getLogHandle(this.handle));
4716
+ return new _(h().getLogHandle(this.handle));
4669
4717
  }
4670
4718
  allFieldsResolved(e = "Input") {
4671
4719
  switch (e) {
@@ -4688,136 +4736,158 @@
4688
4736
  }, o = e;
4689
4737
  if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4690
4738
  return;
4691
- let c2 = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4692
- (l2) => [l2, this.resolve({ field: l2, assertFieldType: r })]
4739
+ let l2 = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4740
+ (c2) => [c2, this.resolve({ field: c2, assertFieldType: r })]
4693
4741
  );
4694
- return s2 && (c2 = c2.filter((l2) => l2[1] !== void 0)), c2.map(([l2, m2]) => o(l2, m2));
4742
+ return s2 && (l2 = l2.filter((c2) => c2[1] !== void 0)), l2.map(([c2, w2]) => o(c2, w2));
4695
4743
  }
4696
4744
  }
4697
- const ve = "staging", we = "main";
4698
- const Ue = "pl7.app/label", Me = "pl7.app/trace", Ge = z$2.object({
4699
- type: z$2.string(),
4700
- importance: z$2.number().optional(),
4701
- id: z$2.string().optional(),
4702
- label: z$2.string()
4703
- }), We = z$2.array(Ge), He = 1e-3, qe = "__LABEL__", pe = "__LABEL__@1";
4704
- function de(t, e, n2 = {}) {
4705
- const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((f2) => {
4706
- var R, k2;
4707
- const p2 = e(f2);
4708
- let d, y2, g2;
4709
- "spec" in p2 && typeof p2.spec == "object" ? (d = p2.spec, y2 = p2.prefixTrace, g2 = p2.suffixTrace) : d = p2;
4710
- const v = (R = d.annotations) == null ? void 0 : R[Ue], w2 = (k2 = d.annotations) == null ? void 0 : k2[Me], x2 = (w2 ? We.safeParse(JSON.parse(w2)).data : void 0) ?? [], C = [
4745
+ const Ie = "staging", Le = "main";
4746
+ const nt = "pl7.app/label", rt = "pl7.app/trace", it = z$1.object({
4747
+ type: z$1.string(),
4748
+ importance: z$1.number().optional(),
4749
+ id: z$1.string().optional(),
4750
+ label: z$1.string()
4751
+ }), st = z$1.array(it), ot = 1e-3, at = "__LABEL__", ve = "__LABEL__@1";
4752
+ function Fe(t, e, n2 = {}) {
4753
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((u2) => {
4754
+ var $2, q;
4755
+ const f2 = e(u2);
4756
+ let p2, y2, v;
4757
+ "spec" in f2 && typeof f2.spec == "object" ? (p2 = f2.spec, y2 = f2.prefixTrace, v = f2.suffixTrace) : p2 = f2;
4758
+ const m2 = ($2 = p2.annotations) == null ? void 0 : $2[nt], b = (q = p2.annotations) == null ? void 0 : q[rt], g = (b ? st.safeParse(JSON.parse(b)).data : void 0) ?? [], A2 = [
4711
4759
  ...y2 ?? [],
4712
- ...x2,
4713
- ...g2 ?? []
4760
+ ...g,
4761
+ ...v ?? []
4714
4762
  ];
4715
- if (v) {
4716
- const A = { label: v, type: qe, importance: -2 };
4717
- n2.addLabelAsSuffix ? C.push(A) : C.splice(0, 0, A);
4718
- }
4719
- const P2 = [], F = /* @__PURE__ */ new Map();
4720
- for (let A = C.length - 1; A >= 0; --A) {
4721
- const { type: j } = C[A], V = C[A].importance ?? 0, K = (F.get(j) ?? 0) + 1;
4722
- F.set(j, K);
4723
- const $2 = `${j}@${K}`;
4724
- i.set($2, (i.get($2) ?? 0) + 1), r.set(
4725
- $2,
4763
+ if (m2) {
4764
+ const P = { label: m2, type: at, importance: -2 };
4765
+ n2.addLabelAsSuffix ? A2.push(P) : A2.splice(0, 0, P);
4766
+ }
4767
+ const x2 = [], k2 = /* @__PURE__ */ new Map();
4768
+ for (let P = A2.length - 1; P >= 0; --P) {
4769
+ const { type: R } = A2[P], z2 = A2[P].importance ?? 0, J = (k2.get(R) ?? 0) + 1;
4770
+ k2.set(R, J);
4771
+ const E = `${R}@${J}`;
4772
+ i.set(E, (i.get(E) ?? 0) + 1), r.set(
4773
+ E,
4726
4774
  Math.max(
4727
- r.get($2) ?? Number.NEGATIVE_INFINITY,
4728
- V - (C.length - A) * He
4775
+ r.get(E) ?? Number.NEGATIVE_INFINITY,
4776
+ z2 - (A2.length - P) * ot
4729
4777
  )
4730
- ), P2.push({ ...C[A], fullType: $2, occurenceIndex: K });
4778
+ ), x2.push({ ...A2[P], fullType: E, occurenceIndex: J });
4731
4779
  }
4732
- return P2.reverse(), {
4733
- value: f2,
4734
- spec: d,
4735
- label: v,
4736
- fullTrace: P2
4780
+ return x2.reverse(), {
4781
+ value: u2,
4782
+ spec: p2,
4783
+ label: m2,
4784
+ fullTrace: x2
4737
4785
  };
4738
- }), o = [], a = [], c2 = [...r];
4739
- c2.sort(([, f2], [, p2]) => p2 - f2);
4740
- for (const [f2] of c2)
4741
- f2.endsWith("@1") || i.get(f2) === t.length ? o.push(f2) : a.push(f2);
4742
- const l2 = (f2) => s2.map((p2) => {
4743
- const d = p2.fullTrace.filter((g2) => f2.has(g2.fullType)).map((g2) => g2.label), y2 = n2.separator ?? " / ";
4786
+ }), o = [], a = [], l2 = [...r];
4787
+ l2.sort(([, u2], [, f2]) => f2 - u2);
4788
+ for (const [u2] of l2)
4789
+ u2.endsWith("@1") || i.get(u2) === t.length ? o.push(u2) : a.push(u2);
4790
+ const c2 = (u2) => s2.map((f2) => {
4791
+ const p2 = f2.fullTrace.filter((v) => u2.has(v.fullType)).map((v) => v.label), y2 = n2.separator ?? " / ";
4744
4792
  return {
4745
- label: d.join(y2),
4746
- value: p2.value
4793
+ label: p2.join(y2),
4794
+ value: f2.value
4747
4795
  };
4748
4796
  });
4749
4797
  if (o.length === 0) {
4750
4798
  if (a.length !== 0) throw new Error("Assertion error.");
4751
- return l2(new Set(pe));
4752
- }
4753
- let m2 = 0, u2 = 0;
4754
- for (; m2 < o.length; ) {
4755
- const f2 = /* @__PURE__ */ new Set();
4756
- n2.includeNativeLabel && f2.add(pe);
4757
- for (let d = 0; d < m2; ++d) f2.add(o[d]);
4758
- f2.add(o[u2]);
4759
- const p2 = l2(f2);
4760
- if (new Set(p2.map((d) => d.label)).size === t.length) return p2;
4761
- u2++, u2 == o.length && (m2++, u2 = m2);
4762
- }
4763
- return l2(/* @__PURE__ */ new Set([...o, ...a]));
4799
+ return c2(new Set(ve));
4800
+ }
4801
+ let w2 = 0, d = 0;
4802
+ for (; w2 < o.length; ) {
4803
+ const u2 = /* @__PURE__ */ new Set();
4804
+ n2.includeNativeLabel && u2.add(ve);
4805
+ for (let p2 = 0; p2 < w2; ++p2) u2.add(o[p2]);
4806
+ u2.add(o[d]);
4807
+ const f2 = c2(u2);
4808
+ if (new Set(f2.map((p2) => p2.label)).size === t.length) return f2;
4809
+ d++, d == o.length && (w2++, d = w2);
4810
+ }
4811
+ return c2(/* @__PURE__ */ new Set([...o, ...a]));
4764
4812
  }
4765
- const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", N = H + "JsonPartitioned", E = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
4766
- const ae = (t) => {
4813
+ const H = "PColumnData/", ne = H + "ResourceMap", re = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", V = H + "BinaryPartitioned", Ee = H + "Partitioned/", ie = Ee + "JsonPartitioned", B = Ee + "BinaryPartitioned";
4814
+ const fe = (t) => {
4767
4815
  if (t.endsWith(".index"))
4768
4816
  return { baseKey: t.substring(0, t.length - 6), type: "index" };
4769
4817
  if (t.endsWith(".values"))
4770
4818
  return { baseKey: t.substring(0, t.length - 7), type: "values" };
4771
4819
  throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4772
4820
  };
4773
- function ze(t) {
4821
+ function lt(t) {
4774
4822
  if (!t) return;
4775
4823
  const e = t.resourceType.name, n2 = t.getDataAsJson(), r = [];
4776
4824
  let i = 0;
4777
4825
  switch (e) {
4778
- case Q:
4826
+ case ne:
4779
4827
  i = n2.keyLength;
4780
4828
  break;
4781
- case Z:
4829
+ case re:
4782
4830
  i = n2.partitionKeyLength + n2.keyLength;
4783
4831
  break;
4784
- case N:
4785
- case E:
4832
+ case U:
4833
+ case V:
4786
4834
  i = n2.partitionKeyLength;
4787
4835
  break;
4788
4836
  case B:
4789
- case ee:
4837
+ case ie:
4790
4838
  i = n2.superPartitionKeyLength + n2.partitionKeyLength;
4791
4839
  break;
4792
4840
  }
4793
4841
  switch (e) {
4794
- case Q:
4795
- case N:
4796
- case E:
4842
+ case ne:
4843
+ case U:
4844
+ case V:
4797
4845
  for (let s2 of t.listInputFields()) {
4798
- e === E && (s2 = ae(s2).baseKey);
4846
+ e === V && (s2 = fe(s2).baseKey);
4799
4847
  const o = [...JSON.parse(s2)];
4800
4848
  r.push(o);
4801
4849
  }
4802
4850
  break;
4803
- case Z:
4851
+ case re:
4804
4852
  case B:
4805
- case ee:
4853
+ case ie:
4806
4854
  for (const s2 of t.listInputFields()) {
4807
4855
  const o = [...JSON.parse(s2)], a = t.resolve({ field: s2, assertFieldType: "Input" });
4808
4856
  if (a !== void 0)
4809
- for (let c2 of a.listInputFields()) {
4810
- e === B && (c2 = ae(c2).baseKey);
4811
- const l2 = [...o, ...JSON.parse(c2)];
4812
- r.push(l2);
4857
+ for (let l2 of a.listInputFields()) {
4858
+ e === B && (l2 = fe(l2).baseKey);
4859
+ const c2 = [...o, ...JSON.parse(l2)];
4860
+ r.push(c2);
4813
4861
  }
4814
4862
  }
4815
4863
  break;
4816
4864
  }
4817
4865
  return { data: r, keyLength: i };
4818
4866
  }
4819
- function Ye(t) {
4820
- const e = ze(t);
4867
+ function ut(t) {
4868
+ if (t.type !== "JsonPartitioned" && t.type !== "BinaryPartitioned")
4869
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);
4870
+ const { parts: e, partitionKeyLength: n2 } = t, r = [];
4871
+ for (let i = 0; i < n2; ++i)
4872
+ r.push(/* @__PURE__ */ new Set());
4873
+ for (const i of e) {
4874
+ const s2 = i.key;
4875
+ if (s2.length !== n2)
4876
+ throw new Error(
4877
+ `Key length (${s2.length}) does not match partition length (${n2}) for key: ${JSON.stringify(
4878
+ s2
4879
+ )}`
4880
+ );
4881
+ for (let o = 0; o < n2; ++o)
4882
+ r[o].add(s2[o]);
4883
+ }
4884
+ return r.map((i) => Array.from(i.values()));
4885
+ }
4886
+ function ct(t) {
4887
+ if (t === void 0) return;
4888
+ if (j(t))
4889
+ return ut(t);
4890
+ const e = lt(t);
4821
4891
  if (!e) return;
4822
4892
  const { data: n2, keyLength: r } = e, i = [];
4823
4893
  for (let s2 = 0; s2 < r; ++s2)
@@ -4830,16 +4900,16 @@
4830
4900
  }
4831
4901
  return i.map((s2) => Array.from(s2.values()));
4832
4902
  }
4833
- function le(t, e = []) {
4834
- if (t === void 0) return;
4903
+ function he(t, e = []) {
4904
+ if (t === void 0 || !t.getIsReadyOrError()) return;
4835
4905
  const n2 = t.resourceType.name, r = t.getDataAsJson();
4836
- if (e.length > 0 && (n2 === ee || n2 === B))
4906
+ if (e.length > 0 && (n2 === ie || n2 === B))
4837
4907
  throw new Error(`Unexpected nested super-partitioned resource: ${n2}`);
4838
4908
  switch (n2) {
4839
- case Q:
4840
- case Z:
4909
+ case ne:
4910
+ case re:
4841
4911
  throw new Error(`Only data columns are supported, got: ${n2}`);
4842
- case N: {
4912
+ case U: {
4843
4913
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4844
4914
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4845
4915
  const i = [];
@@ -4855,21 +4925,21 @@
4855
4925
  parts: i
4856
4926
  };
4857
4927
  }
4858
- case E: {
4928
+ case V: {
4859
4929
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4860
4930
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4861
4931
  const i = [], s2 = /* @__PURE__ */ new Map();
4862
4932
  for (const o of t.listInputFields()) {
4863
- const a = ae(o), c2 = t.resolve({ field: o, assertFieldType: "Input" });
4864
- if (c2 === void 0) return;
4865
- let l2 = s2.get(a.baseKey);
4866
- l2 || (l2 = {}, s2.set(a.baseKey, l2)), a.type === "index" ? l2.index = c2 : l2.values = c2;
4933
+ const a = fe(o), l2 = t.resolve({ field: o, assertFieldType: "Input" });
4934
+ if (l2 === void 0) return;
4935
+ let c2 = s2.get(a.baseKey);
4936
+ c2 || (c2 = {}, s2.set(a.baseKey, c2)), a.type === "index" ? c2.index = l2 : c2.values = l2;
4867
4937
  }
4868
4938
  for (const [o, a] of s2.entries()) {
4869
4939
  if (!a.index || !a.values) return;
4870
- const c2 = [...e, ...JSON.parse(o)];
4940
+ const l2 = [...e, ...JSON.parse(o)];
4871
4941
  i.push({
4872
- key: c2,
4942
+ key: l2,
4873
4943
  value: {
4874
4944
  index: a.index,
4875
4945
  values: a.values
@@ -4882,20 +4952,20 @@
4882
4952
  parts: i
4883
4953
  };
4884
4954
  }
4885
- case ee: {
4955
+ case ie: {
4886
4956
  if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4887
4957
  throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n2}`);
4888
4958
  const i = r.superPartitionKeyLength + r.partitionKeyLength, s2 = [];
4889
4959
  for (const o of t.listInputFields()) {
4890
4960
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4891
4961
  if (a === void 0) return;
4892
- if (a.resourceType.name !== N)
4893
- throw new Error(`Expected ${N} inside ${n2}, but got ${a.resourceType.name}`);
4894
- const c2 = le(a, JSON.parse(o));
4895
- if (c2 === void 0) return;
4896
- if (c2.type !== "JsonPartitioned")
4897
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4898
- s2.push(...c2.parts);
4962
+ if (a.resourceType.name !== U)
4963
+ throw new Error(`Expected ${U} inside ${n2}, but got ${a.resourceType.name}`);
4964
+ const l2 = he(a, JSON.parse(o));
4965
+ if (l2 === void 0) return;
4966
+ if (l2.type !== "JsonPartitioned")
4967
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
4968
+ s2.push(...l2.parts);
4899
4969
  }
4900
4970
  return {
4901
4971
  type: "JsonPartitioned",
@@ -4910,13 +4980,13 @@
4910
4980
  for (const o of t.listInputFields()) {
4911
4981
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4912
4982
  if (a === void 0) return;
4913
- if (a.resourceType.name !== E)
4914
- throw new Error(`Expected ${E} inside ${n2}, but got ${a.resourceType.name}`);
4915
- const c2 = le(a, JSON.parse(o));
4916
- if (c2 === void 0) return;
4917
- if (c2.type !== "BinaryPartitioned")
4918
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4919
- s2.push(...c2.parts);
4983
+ if (a.resourceType.name !== V)
4984
+ throw new Error(`Expected ${V} inside ${n2}, but got ${a.resourceType.name}`);
4985
+ const l2 = he(a, JSON.parse(o));
4986
+ if (l2 === void 0) return;
4987
+ if (l2.type !== "BinaryPartitioned")
4988
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
4989
+ s2.push(...l2.parts);
4920
4990
  }
4921
4991
  return {
4922
4992
  type: "BinaryPartitioned",
@@ -4928,7 +4998,15 @@
4928
4998
  throw new Error(`Unknown resource type: ${n2}`);
4929
4999
  }
4930
5000
  }
4931
- function Xe(t, e) {
5001
+ function pt(t) {
5002
+ if (t !== void 0) {
5003
+ if (j(t)) return t;
5004
+ if (pn(t)) return ln(t);
5005
+ if (t instanceof I) return he(t);
5006
+ throw new Error(`Unexpected input type: ${typeof t}`);
5007
+ }
5008
+ }
5009
+ function dt(t, e) {
4932
5010
  const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
4933
5011
  if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
4934
5012
  const { partitionKeyLength: s2 } = t;
@@ -4988,32 +5066,219 @@
4988
5066
  }
4989
5067
  }
4990
5068
  }
4991
- function re(t, e) {
4992
- if (t === void 0) return e === void 0;
4993
- if (e === void 0) return true;
4994
- for (const n2 in e)
4995
- if (t[n2] !== e[n2]) return false;
4996
- return true;
4997
- }
4998
- function fe(t) {
4999
- return In(t, (e) => e instanceof I ? e.handle : dn(e) ? pn(e, (n2) => n2.handle) : e);
5069
+ class ft {
5070
+ constructor(e) {
5071
+ this.columns = e;
5072
+ }
5073
+ selectColumns(e) {
5074
+ const n2 = typeof e == "function" ? e : Fn(e);
5075
+ return this.columns.filter((r) => n2(r.spec));
5076
+ }
5000
5077
  }
5001
- function Qe(t) {
5078
+ function ht(t) {
5002
5079
  if (t)
5003
5080
  return t.map((e) => ({
5004
- type: `split:${Sn(e.axisId)}`,
5081
+ type: `split:${En(e.axisId)}`,
5005
5082
  label: e.label,
5006
5083
  importance: 1e6
5007
5084
  // High importance for split filters in labels
5008
5085
  }));
5009
5086
  }
5010
- function Ze(t) {
5087
+ function gt(t) {
5011
5088
  if (t)
5012
5089
  return t.map((e) => [e.axisIdx, e.value]);
5013
5090
  }
5014
- class et {
5091
+ function mt(t, e) {
5092
+ if (!e || e.length === 0) return t;
5093
+ const n2 = [...e].sort((r, i) => r[0] - i[0]);
5094
+ return Pe({ id: t, axisFilters: n2 });
5095
+ }
5096
+ function yt(t) {
5097
+ if (!t || typeof t != "object") return false;
5098
+ const e = t, n2 = e.domain && typeof e.domain == "object" && Object.values(e.domain).some((i) => typeof i == "object" && i !== null && "anchor" in i), r = e.axes && Array.isArray(e.axes) && e.axes.some((i) => typeof i == "object" && i !== null && "anchor" in i);
5099
+ return !!e.domainAnchor || n2 || r;
5100
+ }
5101
+ function vt(t) {
5102
+ if (typeof t != "object" || !("axes" in t) || t.axes === void 0)
5103
+ return [];
5104
+ const e = t.axes.map((n2, r) => typeof n2 == "object" && "split" in n2 && n2.split === true ? r : -1).filter((n2) => n2 !== -1);
5105
+ if (e.length > 0 && t.partialAxesMatch !== void 0)
5106
+ throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
5107
+ return e.sort((n2, r) => n2 - r), e;
5108
+ }
5109
+ class be {
5110
+ constructor() {
5111
+ L(this, "defaultProviderStore", []);
5112
+ L(this, "providers", [new ft(this.defaultProviderStore)]);
5113
+ L(this, "axisLabelProviders", []);
5114
+ }
5115
+ addColumnProvider(e) {
5116
+ return this.providers.push(e), this;
5117
+ }
5118
+ addAxisLabelProvider(e) {
5119
+ return this.axisLabelProviders.push(e), this;
5120
+ }
5121
+ addColumns(e) {
5122
+ return this.defaultProviderStore.push(...e), this;
5123
+ }
5124
+ addColumn(e) {
5125
+ return this.defaultProviderStore.push(e), this;
5126
+ }
5127
+ /** Fetches labels for a given axis from the registered providers */
5128
+ findLabels(e) {
5129
+ for (const n2 of this.axisLabelProviders) {
5130
+ const r = n2.findLabels(e);
5131
+ if (r) return r;
5132
+ }
5133
+ }
5134
+ getUniversalEntries(e, n2) {
5135
+ const { anchorCtx: r, labelOps: i, dontWaitAllData: s2 = false, overrideLabelAnnotation: o = false } = n2 ?? {}, a = {
5136
+ ...o && (i == null ? void 0 : i.includeNativeLabel) !== false ? { includeNativeLabel: true } : {},
5137
+ ...i ?? {}
5138
+ }, l2 = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], c2 = [];
5139
+ for (const u2 of l2) {
5140
+ const f$1 = yt(u2);
5141
+ let p2;
5142
+ if (f$1) {
5143
+ if (!r)
5144
+ throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
5145
+ p2 = $n(r.anchors, u2);
5146
+ } else
5147
+ p2 = u2;
5148
+ const y$1 = /* @__PURE__ */ new Set(), v = [];
5149
+ for (const g of this.providers) {
5150
+ const A2 = g.selectColumns(p2);
5151
+ for (const x2 of A2) {
5152
+ if (y$1.has(x2.id)) throw new Error(`Duplicate column id ${x2.id} in provider ${g.constructor.name}`);
5153
+ y$1.add(x2.id), v.push(x2);
5154
+ }
5155
+ }
5156
+ if (v.length === 0) continue;
5157
+ const m2 = vt(u2), b = m2.length > 0;
5158
+ for (const g of v) {
5159
+ if (!f(g.spec)) continue;
5160
+ const A2 = g.spec;
5161
+ if (b) {
5162
+ const x2 = pt(g.data);
5163
+ if (!x2) {
5164
+ if (s2) continue;
5165
+ return;
5166
+ }
5167
+ if (!yn(x2))
5168
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${x2.type} for column ${g.id}`);
5169
+ const k2 = ct(x2), $2 = m2[m2.length - 1];
5170
+ if ($2 >= x2.partitionKeyLength)
5171
+ throw new Error(`Not enough partition keys (${x2.partitionKeyLength}) for requested split axes (max index ${$2}) in column ${A2.name}`);
5172
+ const q = m2.map((C) => this.findLabels(y(A2.axesSpec[C]))), P = [], R = (C, N2) => {
5173
+ if (N2 >= m2.length) {
5174
+ P.push([...C]);
5175
+ return;
5176
+ }
5177
+ const D = m2[N2];
5178
+ if (D >= k2.length)
5179
+ throw new Error(`Axis index ${D} out of bounds for unique keys array (length ${k2.length}) during split key generation for column ${g.id}`);
5180
+ const O = k2[D];
5181
+ if (!O || O.length === 0) {
5182
+ P.length = 0;
5183
+ return;
5184
+ }
5185
+ for (const Y2 of O)
5186
+ C.push(Y2), R(C, N2 + 1), C.pop();
5187
+ };
5188
+ if (R([], 0), P.length === 0)
5189
+ continue;
5190
+ const z2 = [...A2.axesSpec], J = m2.map((C) => C);
5191
+ for (let C = m2.length - 1; C >= 0; C--)
5192
+ z2.splice(m2[C], 1);
5193
+ const E = { ...A2, axesSpec: z2 };
5194
+ for (const C of P) {
5195
+ const N2 = C.map((D, O) => {
5196
+ const Y2 = J[O], Re = y(A2.axesSpec[Y2]), oe = q[O], Oe = (oe == null ? void 0 : oe[D]) ?? String(D);
5197
+ return { axisIdx: Y2, axisId: Re, value: D, label: Oe };
5198
+ });
5199
+ c2.push({
5200
+ type: "split",
5201
+ originalColumn: g,
5202
+ spec: A2,
5203
+ adjustedSpec: E,
5204
+ dataEntries: x2,
5205
+ axisFilters: N2
5206
+ });
5207
+ }
5208
+ } else
5209
+ c2.push({
5210
+ type: "direct",
5211
+ originalColumn: g,
5212
+ spec: A2,
5213
+ adjustedSpec: A2
5214
+ });
5215
+ }
5216
+ }
5217
+ if (c2.length === 0) return [];
5218
+ const w2 = Fe(
5219
+ c2,
5220
+ (u2) => ({
5221
+ spec: u2.spec,
5222
+ suffixTrace: u2.type === "split" ? ht(u2.axisFilters) : void 0
5223
+ }),
5224
+ a
5225
+ ), d = [];
5226
+ for (const { value: u2, label: f2 } of w2) {
5227
+ const { originalColumn: p2, spec: y2 } = u2, v = u2.type === "split" ? u2.axisFilters : void 0, m2 = gt(v);
5228
+ let b;
5229
+ r ? b = r.deriveS(y2, m2) : b = mt(p2.id, m2);
5230
+ let g = { ...u2.adjustedSpec };
5231
+ o && (g = {
5232
+ ...g,
5233
+ annotations: {
5234
+ ...g.annotations ?? {},
5235
+ "pl7.app/label": f2
5236
+ }
5237
+ }), d.push({
5238
+ id: b,
5239
+ spec: g,
5240
+ data: () => u2.type === "split" ? hn(dt(u2.dataEntries, m2)) : u2.originalColumn.data,
5241
+ label: f2
5242
+ });
5243
+ }
5244
+ return d;
5245
+ }
5246
+ getColumns(e, n2) {
5247
+ const r = this.getUniversalEntries(e, {
5248
+ overrideLabelAnnotation: true,
5249
+ // default for getColumns
5250
+ ...n2 ?? {}
5251
+ });
5252
+ if (!r) return;
5253
+ const i = [];
5254
+ for (const s2 of r) {
5255
+ const o = s2.data();
5256
+ if (!o) {
5257
+ if (n2 != null && n2.dontWaitAllData) continue;
5258
+ return;
5259
+ }
5260
+ i.push({
5261
+ id: s2.id,
5262
+ spec: s2.spec,
5263
+ data: o
5264
+ });
5265
+ }
5266
+ return i;
5267
+ }
5268
+ }
5269
+ function le(t, e) {
5270
+ if (t === void 0) return e === void 0;
5271
+ if (e === void 0) return true;
5272
+ for (const n2 in e)
5273
+ if (t[n2] !== e[n2]) return false;
5274
+ return true;
5275
+ }
5276
+ function we(t) {
5277
+ return Bn(t, (e) => e instanceof I ? e.handle : pn(e) ? mn(e, (n2) => n2.handle) : e);
5278
+ }
5279
+ class bt {
5015
5280
  constructor() {
5016
- T(this, "ctx", h());
5281
+ L(this, "ctx", h());
5017
5282
  }
5018
5283
  /**
5019
5284
  * @deprecated use getOptions()
@@ -5022,8 +5287,8 @@
5022
5287
  return this.ctx.calculateOptions(e);
5023
5288
  }
5024
5289
  getOptions(e, n2) {
5025
- const r = typeof e == "function" ? e : Bn(e), i = this.getSpecs().entries.filter((s2) => r(s2.obj));
5026
- return typeof n2 == "object" || typeof n2 > "u" ? de(i, (s2) => s2.obj, n2 ?? {}).map(({ value: { ref: s2 }, label: o }) => ({
5290
+ const r = typeof e == "function" ? e : Fn(e), i = this.getSpecs().entries.filter((s2) => r(s2.obj));
5291
+ return typeof n2 == "object" || typeof n2 > "u" ? Fe(i, (s2) => s2.obj, n2 ?? {}).map(({ value: { ref: s2 }, label: o }) => ({
5027
5292
  ref: s2,
5028
5293
  label: o
5029
5294
  })) : i.map((s2) => ({
@@ -5031,93 +5296,18 @@
5031
5296
  label: n2(s2.obj, s2.ref)
5032
5297
  }));
5033
5298
  }
5034
- /**
5035
- * Internal implementation that generates UniversalPColumnEntry objects from the provided
5036
- * anchors and selectors.
5037
- */
5038
- getUniversalPColumnEntries(e, n2, r) {
5039
- const i = {};
5040
- if (!(e instanceof On))
5041
- for (const [l2, m2] of Object.entries(e))
5042
- if (Kn(m2)) {
5043
- const u2 = this.getPColumnSpecByRef(m2);
5044
- if (!u2)
5045
- return;
5046
- i[l2] = u2;
5047
- } else
5048
- i[l2] = m2;
5049
- const s2 = typeof n2 == "function" ? [n2] : Array.isArray(n2) ? n2 : [n2], o = e instanceof On ? e : new On(i), a = [];
5050
- for (const l2 of s2) {
5051
- const m2 = typeof l2 == "function" ? l2 : Bn(Jn(i, l2)), u2 = this.getSpecs().entries.filter(({ obj: p2 }) => f(p2) ? m2(p2) : false);
5052
- if (u2.length === 0)
5053
- continue;
5054
- const f$1 = typeof l2 == "object" && "axes" in l2 && l2.axes !== void 0 && l2.partialAxesMatch === void 0 ? l2.axes.map((p2, d) => "split" in p2 && p2.split === true ? d : -1).filter((p2) => p2 !== -1) : [];
5055
- if (f$1.sort((p2, d) => p2 - d), f$1.length > 0) {
5056
- const p2 = f$1[f$1.length - 1];
5057
- for (const { ref: d, obj: y$1 } of u2) {
5058
- if (!f(y$1)) throw new Error(`Assertion failed: expected PColumnSpec, got ${y$1.kind}`);
5059
- const g2 = this.getDataByRef(d);
5060
- if (!g2) {
5061
- if (r != null && r.dontWaitAllData) continue;
5062
- return;
5063
- }
5064
- if (!Y$1(g2)) throw new Error(`Assertion failed: expected PColumn, got ${g2.spec.kind}`);
5065
- const v = Ye(g2.data);
5066
- if (!v) {
5067
- if (r != null && r.dontWaitAllData) continue;
5068
- return;
5069
- }
5070
- if (p2 >= v.length)
5071
- throw new Error(`Not enough partition keys for the requested split axes in column ${y$1.name}`);
5072
- const w2 = f$1.map((P2) => this.findLabels(y(y$1.axesSpec[P2]))), x2 = [], C = (P2, F) => {
5073
- if (F >= f$1.length) {
5074
- x2.push([...P2]);
5075
- return;
5076
- }
5077
- const R = f$1[F], k2 = v[R];
5078
- for (const A of k2)
5079
- P2.push(A), C(P2, F + 1), P2.pop();
5080
- };
5081
- C([], 0);
5082
- for (const P2 of x2) {
5083
- const F = P2.map((R, k2) => {
5084
- const A = f$1[k2], j = y(y$1.axesSpec[A]), V = w2[k2], K = (V == null ? void 0 : V[R]) ?? String(R);
5085
- return { axisIdx: A, axisId: j, value: R, label: K };
5086
- });
5087
- a.push({
5088
- obj: y$1,
5089
- ref: d,
5090
- axisFilters: F
5091
- });
5092
- }
5093
- }
5299
+ resolveAnchorCtx(e) {
5300
+ if (e instanceof On) return e;
5301
+ const n2 = {};
5302
+ for (const [r, i] of Object.entries(e))
5303
+ if (Rn(i)) {
5304
+ const s2 = this.getPColumnSpecByRef(i);
5305
+ if (!s2)
5306
+ return;
5307
+ n2[r] = s2;
5094
5308
  } else
5095
- for (const { ref: p2, obj: d } of u2)
5096
- f(d) && a.push({
5097
- obj: d,
5098
- ref: p2
5099
- // No splitFilters needed here
5100
- });
5101
- }
5102
- return a.length === 0 ? [] : de(
5103
- a,
5104
- (l2) => ({
5105
- spec: l2.obj,
5106
- suffixTrace: Qe(l2.axisFilters)
5107
- // Use helper function
5108
- }),
5109
- (r == null ? void 0 : r.labelOps) ?? {}
5110
- ).map((l2) => ({
5111
- id: o.deriveS(
5112
- l2.value.obj,
5113
- Ze(l2.value.axisFilters)
5114
- // Use helper function
5115
- ),
5116
- obj: l2.value.obj,
5117
- ref: l2.value.ref,
5118
- axisFilters: l2.value.axisFilters,
5119
- label: l2.label
5120
- }));
5309
+ n2[r] = i;
5310
+ return new On(n2);
5121
5311
  }
5122
5312
  /**
5123
5313
  * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
@@ -5128,55 +5318,12 @@
5128
5318
  * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
5129
5319
  */
5130
5320
  getAnchoredPColumns(e, n2, r) {
5131
- const i = {
5132
- ...r,
5133
- labelOps: {
5134
- includeNativeLabel: true,
5135
- ...(r == null ? void 0 : r.labelOps) || {}
5136
- }
5137
- }, s2 = this.getUniversalPColumnEntries(
5138
- e,
5139
- n2,
5140
- i
5141
- );
5142
- if (!s2 || s2.length === 0) return;
5143
- const o = [];
5144
- for (const a of s2) {
5145
- const c2 = this.getPColumnByRef(a.ref);
5146
- if (!c2) return;
5147
- const l2 = le(c2.data);
5148
- if (!l2) return;
5149
- let m2 = l2, u2 = { ...c2.spec };
5150
- if (a.axisFilters && a.axisFilters.length > 0) {
5151
- const p2 = a.axisFilters.map((g2) => [
5152
- g2.axisIdx,
5153
- g2.value
5154
- ]);
5155
- m2 = Xe(l2, p2);
5156
- const d = [...a.axisFilters].map((g2) => g2.axisIdx).sort((g2, v) => v - g2), y2 = [...u2.axesSpec];
5157
- for (const g2 of d)
5158
- y2.splice(g2, 1);
5159
- u2 = { ...u2, axesSpec: y2 };
5160
- }
5161
- const f2 = ln(m2);
5162
- u2.annotations ? u2 = {
5163
- ...u2,
5164
- annotations: {
5165
- ...u2.annotations,
5166
- "pl7.app/label": a.label
5167
- }
5168
- } : u2 = {
5169
- ...u2,
5170
- annotations: {
5171
- "pl7.app/label": a.label
5172
- }
5173
- }, o.push({
5174
- id: a.id,
5175
- spec: u2,
5176
- data: f2
5321
+ const i = this.resolveAnchorCtx(e);
5322
+ if (i)
5323
+ return new be().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n2, {
5324
+ ...r,
5325
+ anchorCtx: i
5177
5326
  });
5178
- }
5179
- return o;
5180
5327
  }
5181
5328
  /**
5182
5329
  * Calculates anchored identifier options for columns matching a given predicate and returns their
@@ -5208,11 +5355,16 @@
5208
5355
  * or undefined if any PlRef resolution fails.
5209
5356
  */
5210
5357
  getCanonicalOptions(e, n2, r) {
5211
- const i = this.getUniversalPColumnEntries(e, n2, r);
5212
- if (i)
5213
- return i.map((s2) => ({
5214
- value: s2.id,
5215
- label: s2.label
5358
+ const i = this.resolveAnchorCtx(e);
5359
+ if (!i) return;
5360
+ const s2 = new be().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n2, {
5361
+ ...r,
5362
+ anchorCtx: i
5363
+ });
5364
+ if (s2)
5365
+ return s2.map((o) => ({
5366
+ value: o.id,
5367
+ label: o.label
5216
5368
  }));
5217
5369
  }
5218
5370
  /**
@@ -5248,7 +5400,7 @@
5248
5400
  ref: n2.ref,
5249
5401
  obj: {
5250
5402
  ...n2.obj,
5251
- data: Mn(
5403
+ data: _n(
5252
5404
  n2.obj.data,
5253
5405
  (r) => new I(r, [n2.ref.blockId, n2.ref.name])
5254
5406
  )
@@ -5277,7 +5429,7 @@
5277
5429
  )) == null ? void 0 : r.obj;
5278
5430
  const n2 = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
5279
5431
  if (n2)
5280
- return In(
5432
+ return Bn(
5281
5433
  n2,
5282
5434
  (i) => new I(i, [e.blockId, e.name])
5283
5435
  );
@@ -5290,7 +5442,7 @@
5290
5442
  getPColumnByRef(e) {
5291
5443
  const n2 = this.getDataByRef(e);
5292
5444
  if (n2)
5293
- return Dn(n2);
5445
+ return In(n2);
5294
5446
  }
5295
5447
  /**
5296
5448
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -5322,10 +5474,10 @@
5322
5474
  if (!f(r.obj.spec))
5323
5475
  continue;
5324
5476
  const i = r.obj.spec;
5325
- if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && re(e.domain, i.domain)) {
5477
+ if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && le(e.domain, i.domain)) {
5326
5478
  for (let s2 = 0; s2 < e.axesSpec.length; ++s2) {
5327
5479
  const o = e.axesSpec[s2], a = i.axesSpec[s2];
5328
- if (o.name !== a.name || o.type !== a.type || !re(o.domain, a.domain))
5480
+ if (o.name !== a.name || o.type !== a.type || !le(o.domain, a.domain))
5329
5481
  continue e;
5330
5482
  }
5331
5483
  n2.push(r.obj);
@@ -5340,9 +5492,9 @@
5340
5492
  findLabels(e) {
5341
5493
  const n2 = this.getData();
5342
5494
  for (const r of n2.entries) {
5343
- if (!Y$1(r.obj)) continue;
5495
+ if (!Z(r.obj)) continue;
5344
5496
  const i = r.obj.spec;
5345
- if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && re(e.domain, i.axesSpec[0].domain)) {
5497
+ if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && le(e.domain, i.axesSpec[0].domain)) {
5346
5498
  if (r.obj.data.resourceType.name !== "PColumnData/Json")
5347
5499
  throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
5348
5500
  return Object.fromEntries(
@@ -5353,14 +5505,49 @@
5353
5505
  }
5354
5506
  }
5355
5507
  }
5508
+ /**
5509
+ * Selects columns based on the provided selectors, returning PColumn objects
5510
+ * with lazily loaded data.
5511
+ *
5512
+ * @param selectors - A predicate function, a single selector, or an array of selectors.
5513
+ * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
5514
+ */
5515
+ selectColumns(e) {
5516
+ const n2 = typeof e == "function" ? e : Fn(e);
5517
+ return this.getSpecs().entries.filter(({ obj: i }) => f(i) ? n2(i) : false).map(({ ref: i, obj: s2 }) => {
5518
+ const o = s2;
5519
+ let a = null;
5520
+ const l2 = this;
5521
+ return {
5522
+ id: Pe(i),
5523
+ spec: o,
5524
+ get data() {
5525
+ var c2;
5526
+ return a !== null || (a = (c2 = l2.getPColumnByRef(i)) == null ? void 0 : c2.data), a;
5527
+ }
5528
+ };
5529
+ });
5530
+ }
5531
+ /**
5532
+ * Find labels data for a given axis id of a p-column.
5533
+ * @returns a map of axis value => label
5534
+ */
5535
+ findLabelsForColumnAxis(e, n2) {
5536
+ const r = this.findLabels(e.spec.axesSpec[n2]);
5537
+ if (r)
5538
+ return Object.fromEntries(e.data.listInputFields().map((i) => {
5539
+ const s2 = JSON.parse(i);
5540
+ return [s2[n2], r[s2[n2]] ?? "Unlabelled"];
5541
+ }));
5542
+ }
5356
5543
  }
5357
- class z {
5544
+ class Q {
5358
5545
  constructor() {
5359
- T(this, "ctx");
5360
- T(this, "args");
5361
- T(this, "uiState");
5362
- T(this, "_activeArgsCache");
5363
- T(this, "resultPool", new et());
5546
+ L(this, "ctx");
5547
+ L(this, "args");
5548
+ L(this, "uiState");
5549
+ L(this, "_activeArgsCache");
5550
+ L(this, "resultPool", new bt());
5364
5551
  this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5365
5552
  }
5366
5553
  /**
@@ -5377,16 +5564,16 @@
5377
5564
  // return this.ctx.featureFlags;
5378
5565
  // }
5379
5566
  getNamedAccessor(e) {
5380
- return ie(
5567
+ return pe(
5381
5568
  this.ctx.getAccessorHandleByName(e),
5382
5569
  (n2) => new I(n2, [e])
5383
5570
  );
5384
5571
  }
5385
5572
  get prerun() {
5386
- return this.getNamedAccessor(ve);
5573
+ return this.getNamedAccessor(Ie);
5387
5574
  }
5388
5575
  get outputs() {
5389
- return this.getNamedAccessor(we);
5576
+ return this.getNamedAccessor(Le);
5390
5577
  }
5391
5578
  /**
5392
5579
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -5398,12 +5585,13 @@
5398
5585
  }
5399
5586
  verifyInlineAndExplicitColumnsSupport(e) {
5400
5587
  var i;
5401
- const n2 = e.some((s2) => !(s2.data instanceof I) || dn(s2.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5588
+ const n2 = e.some((s2) => !(s2.data instanceof I) || pn(s2.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5402
5589
  if (n2 && !r) throw Error("Inline or explicit columns not supported");
5403
5590
  }
5591
+ // TODO remove all non-PColumn fields
5404
5592
  createPFrame(e) {
5405
5593
  return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5406
- e.map((n2) => fe(n2))
5594
+ e.map((n2) => we(n2))
5407
5595
  );
5408
5596
  }
5409
5597
  createPTable(e) {
@@ -5416,7 +5604,7 @@
5416
5604
  filters: e.filters ?? [],
5417
5605
  sorting: e.sorting ?? []
5418
5606
  } : n2 = e, this.verifyInlineAndExplicitColumnsSupport(jn(n2.src)), this.ctx.createPTable(
5419
- En(n2, (r) => fe(r))
5607
+ Cn(n2, (r) => we(r))
5420
5608
  );
5421
5609
  }
5422
5610
  /** @deprecated scheduled for removal from SDK */
@@ -5428,33 +5616,33 @@
5428
5616
  return this.ctx.getCurrentUnstableMarker();
5429
5617
  }
5430
5618
  }
5431
- const U = "1.27.10";
5432
- function tt(t) {
5619
+ const M = "1.28.0";
5620
+ function wt(t) {
5433
5621
  return t.__renderLambda === true;
5434
5622
  }
5435
- function se(t) {
5623
+ function ue(t) {
5436
5624
  if (t !== void 0)
5437
- return tt(t) ? t.handle : t;
5625
+ return wt(t) ? t.handle : t;
5438
5626
  }
5439
- class _ {
5627
+ class T {
5440
5628
  constructor(e, n2, r, i, s2, o, a) {
5441
5629
  this._renderingMode = e, this._initialArgs = n2, this._initialUiState = r, this._outputs = i, this._inputsValid = s2, this._sections = o, this._title = a;
5442
5630
  }
5443
5631
  static create(e = "Heavy") {
5444
- return new _(
5632
+ return new T(
5445
5633
  e,
5446
5634
  void 0,
5447
5635
  {},
5448
5636
  {},
5449
- Y(true),
5450
- Y([]),
5637
+ ee(true),
5638
+ ee([]),
5451
5639
  void 0
5452
5640
  );
5453
5641
  }
5454
5642
  output(e, n2, r = {}) {
5455
5643
  if (typeof n2 == "function") {
5456
5644
  const i = `output#${e}`;
5457
- return q(i, () => n2(new z())), new _(
5645
+ return X(i, () => n2(new Q())), new T(
5458
5646
  this._renderingMode,
5459
5647
  this._initialArgs,
5460
5648
  this._initialUiState,
@@ -5471,7 +5659,7 @@
5471
5659
  this._title
5472
5660
  );
5473
5661
  } else
5474
- return new _(
5662
+ return new T(
5475
5663
  this._renderingMode,
5476
5664
  this._initialArgs,
5477
5665
  this._initialUiState,
@@ -5489,7 +5677,7 @@
5489
5677
  return this.output(e, n2, { retentive: true });
5490
5678
  }
5491
5679
  argsValid(e) {
5492
- return typeof e == "function" ? (q("inputsValid", () => e(new z())), new _(
5680
+ return typeof e == "function" ? (X("inputsValid", () => e(new Q())), new T(
5493
5681
  this._renderingMode,
5494
5682
  this._initialArgs,
5495
5683
  this._initialUiState,
@@ -5500,7 +5688,7 @@
5500
5688
  },
5501
5689
  this._sections,
5502
5690
  this._title
5503
- )) : new _(
5691
+ )) : new T(
5504
5692
  this._renderingMode,
5505
5693
  this._initialArgs,
5506
5694
  this._initialUiState,
@@ -5511,7 +5699,7 @@
5511
5699
  );
5512
5700
  }
5513
5701
  sections(e) {
5514
- return Array.isArray(e) ? this.sections(Y(e)) : typeof e == "function" ? (q("sections", () => e(new z())), new _(
5702
+ return Array.isArray(e) ? this.sections(ee(e)) : typeof e == "function" ? (X("sections", () => e(new Q())), new T(
5515
5703
  this._renderingMode,
5516
5704
  this._initialArgs,
5517
5705
  this._initialUiState,
@@ -5519,7 +5707,7 @@
5519
5707
  this._inputsValid,
5520
5708
  { __renderLambda: true, handle: "sections" },
5521
5709
  this._title
5522
- )) : new _(
5710
+ )) : new T(
5523
5711
  this._renderingMode,
5524
5712
  this._initialArgs,
5525
5713
  this._initialUiState,
@@ -5531,7 +5719,7 @@
5531
5719
  }
5532
5720
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
5533
5721
  title(e) {
5534
- return q("title", () => e(new z())), new _(
5722
+ return X("title", () => e(new Q())), new T(
5535
5723
  this._renderingMode,
5536
5724
  this._initialArgs,
5537
5725
  this._initialUiState,
@@ -5546,7 +5734,7 @@
5546
5734
  * @deprecated use {@link withArgs}
5547
5735
  * */
5548
5736
  initialArgs(e) {
5549
- return new _(
5737
+ return new T(
5550
5738
  this._renderingMode,
5551
5739
  e,
5552
5740
  this._initialUiState,
@@ -5558,7 +5746,7 @@
5558
5746
  }
5559
5747
  /** Sets initial args for the block, this value must be specified. */
5560
5748
  withArgs(e) {
5561
- return new _(
5749
+ return new T(
5562
5750
  this._renderingMode,
5563
5751
  e,
5564
5752
  this._initialUiState,
@@ -5570,7 +5758,7 @@
5570
5758
  }
5571
5759
  /** Defines type and sets initial value for block UiState. */
5572
5760
  withUiState(e) {
5573
- return new _(
5761
+ return new T(
5574
5762
  this._renderingMode,
5575
5763
  this._initialArgs,
5576
5764
  e,
@@ -5587,7 +5775,7 @@
5587
5775
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
5588
5776
  const e = {
5589
5777
  v3: {
5590
- sdkVersion: U,
5778
+ sdkVersion: M,
5591
5779
  renderingMode: this._renderingMode,
5592
5780
  initialArgs: this._initialArgs,
5593
5781
  initialUiState: this._initialUiState,
@@ -5597,75 +5785,75 @@
5597
5785
  outputs: this._outputs
5598
5786
  },
5599
5787
  // fields below are added to allow previous desktop versions read generated configs
5600
- sdkVersion: U,
5788
+ sdkVersion: M,
5601
5789
  renderingMode: this._renderingMode,
5602
5790
  initialArgs: this._initialArgs,
5603
- inputsValid: se(this._inputsValid),
5604
- sections: se(this._sections),
5791
+ inputsValid: ue(this._inputsValid),
5792
+ sections: ue(this._sections),
5605
5793
  outputs: Object.fromEntries(
5606
- Object.entries(this._outputs).map(([n2, r]) => [n2, se(r)])
5794
+ Object.entries(this._outputs).map(([n2, r]) => [n2, ue(r)])
5607
5795
  )
5608
5796
  };
5609
- return Ke() ? be({ sdkVersion: U }) : { config: e };
5797
+ return Xe() ? _e({ sdkVersion: M }) : { config: e };
5610
5798
  }
5611
5799
  }
5612
- function Wt(t, e, n2, r) {
5613
- var l2, m2;
5800
+ function fn(t, e, n2, r) {
5801
+ var c2, w2;
5614
5802
  Array.isArray(r) && (r = { filters: r });
5615
- const i = t.resultPool.getData().entries.map((u2) => u2.obj).filter(Y$1).filter((u2) => u2.spec.name === "pl7.app/label" && u2.spec.axesSpec.length === 1), s2 = (u2, f2) => {
5616
- let p2 = u2.toString();
5617
- if (f2)
5618
- for (const d in f2)
5619
- p2 += d, p2 += f2[d];
5620
- return p2;
5803
+ const i = t.resultPool.getData().entries.map((d) => d.obj).filter(Z).filter((d) => d.spec.name === "pl7.app/label" && d.spec.axesSpec.length === 1), s2 = (d, u2) => {
5804
+ let f2 = d.toString();
5805
+ if (u2)
5806
+ for (const p2 in u2)
5807
+ f2 += p2, f2 += u2[p2];
5808
+ return f2;
5621
5809
  }, o = /* @__PURE__ */ new Map();
5622
- for (const u2 of e)
5623
- for (const f2 of u2.spec.axesSpec) {
5624
- const p2 = y(f2);
5625
- for (const d of i) {
5626
- const y$1 = d.spec.axesSpec[0], g2 = y(d.spec.axesSpec[0]);
5627
- if (X(p2, g2)) {
5628
- const v = Object.keys(p2.domain ?? {}).length, w2 = Object.keys(g2.domain ?? {}).length;
5629
- if (v > w2) {
5630
- const x2 = s2(d.id, p2.domain);
5631
- o.set(x2, {
5632
- id: x2,
5810
+ for (const d of e)
5811
+ for (const u2 of d.spec.axesSpec) {
5812
+ const f2 = y(u2);
5813
+ for (const p2 of i) {
5814
+ const y$1 = p2.spec.axesSpec[0], v = y(p2.spec.axesSpec[0]);
5815
+ if (z(f2, v)) {
5816
+ const m2 = Object.keys(f2.domain ?? {}).length, b = Object.keys(v.domain ?? {}).length;
5817
+ if (m2 > b) {
5818
+ const g = s2(p2.id, f2.domain);
5819
+ o.set(g, {
5820
+ id: g,
5633
5821
  spec: {
5634
- ...d.spec,
5635
- axesSpec: [{ ...p2, annotations: y$1.annotations }]
5822
+ ...p2.spec,
5823
+ axesSpec: [{ ...f2, annotations: y$1.annotations }]
5636
5824
  },
5637
- data: d.data
5825
+ data: p2.data
5638
5826
  });
5639
5827
  } else
5640
- o.set(s2(d.id), d);
5828
+ o.set(s2(p2.id), p2);
5641
5829
  }
5642
5830
  }
5643
5831
  }
5644
5832
  if ([...e, ...o.values()].some(
5645
- (u2) => u2.data instanceof I && !u2.data.getIsReadyOrError()
5833
+ (d) => d.data instanceof I && !d.data.getIsReadyOrError()
5646
5834
  ))
5647
5835
  return;
5648
5836
  let a = e;
5649
- const c2 = [];
5837
+ const l2 = [];
5650
5838
  if (r != null && r.coreColumnPredicate) {
5651
5839
  a = [];
5652
- for (const u2 of e)
5653
- r.coreColumnPredicate(u2.spec) ? a.push(u2) : c2.push(u2);
5840
+ for (const d of e)
5841
+ r.coreColumnPredicate(d.spec) ? a.push(d) : l2.push(d);
5654
5842
  }
5655
- return c2.push(...o.values()), t.createPTable({
5843
+ return l2.push(...o.values()), t.createPTable({
5656
5844
  src: {
5657
5845
  type: "outer",
5658
5846
  primary: {
5659
5847
  type: (r == null ? void 0 : r.coreJoinType) ?? "full",
5660
- entries: a.map((u2) => ({ type: "column", column: u2 }))
5848
+ entries: a.map((d) => ({ type: "column", column: d }))
5661
5849
  },
5662
- secondary: c2.map((u2) => ({ type: "column", column: u2 }))
5850
+ secondary: l2.map((d) => ({ type: "column", column: d }))
5663
5851
  },
5664
- filters: [...(r == null ? void 0 : r.filters) ?? [], ...((l2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : l2.filters) ?? []],
5665
- sorting: ((m2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : m2.sorting) ?? []
5852
+ filters: [...(r == null ? void 0 : r.filters) ?? [], ...((c2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : c2.filters) ?? []],
5853
+ sorting: ((w2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : w2.sorting) ?? []
5666
5854
  });
5667
5855
  }
5668
- const ImportFileHandleSchema = z$2.string().optional().refine(
5856
+ const ImportFileHandleSchema = z$1.string().optional().refine(
5669
5857
  (_a) => true
5670
5858
  );
5671
5859
  function* range(from, to, step = 1) {
@@ -5675,20 +5863,20 @@
5675
5863
  }
5676
5864
  function toList(iterable) {
5677
5865
  const lst = [];
5678
- for (const it of iterable) {
5679
- lst.push(it);
5866
+ for (const it2 of iterable) {
5867
+ lst.push(it2);
5680
5868
  }
5681
5869
  return lst;
5682
5870
  }
5683
5871
  function times(n2, cb) {
5684
5872
  return toList(range(0, n2)).map(cb);
5685
5873
  }
5686
- const $BlockArgs = z$2.object({
5687
- tableNumRows: z$2.number().default(100),
5688
- numbers: z$2.array(z$2.coerce.number()),
5689
- handles: z$2.array(ImportFileHandleSchema)
5874
+ const $BlockArgs = z$1.object({
5875
+ tableNumRows: z$1.number().default(100),
5876
+ numbers: z$1.array(z$1.coerce.number()),
5877
+ handles: z$1.array(ImportFileHandleSchema)
5690
5878
  });
5691
- const platforma = _.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5879
+ const platforma = T.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5692
5880
  if (ctx.args.numbers.length === 5) {
5693
5881
  throw new Error("argsValid: test error");
5694
5882
  }
@@ -5711,7 +5899,7 @@
5711
5899
  val: v.toString()
5712
5900
  };
5713
5901
  });
5714
- return Wt(
5902
+ return fn(
5715
5903
  ctx,
5716
5904
  [
5717
5905
  {
@@ -5760,12 +5948,12 @@
5760
5948
  }
5761
5949
  return "Ui Examples";
5762
5950
  }).sections((ctx) => {
5763
- const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
5951
+ const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it2) => ({
5764
5952
  type: "link",
5765
- href: `/section?id=${it.id}`,
5766
- label: it.label
5953
+ href: `/section?id=${it2.id}`,
5954
+ label: it2.label
5767
5955
  }));
5768
- if (dynamicSections.some((it) => it.label === "Error")) {
5956
+ if (dynamicSections.some((it2) => it2.label === "Error")) {
5769
5957
  throw new Error("sections: test error");
5770
5958
  }
5771
5959
  return [