@milaboratories/milaboratories.ui-examples.model 1.1.37 → 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,
@@ -3948,13 +3948,13 @@
3948
3948
  quotelessJson,
3949
3949
  ZodError
3950
3950
  });
3951
- var $$1 = Object.defineProperty;
3952
- var L = (n2, t, e) => t in n2 ? $$1(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);
3951
+ var $ = Object.defineProperty;
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)
@@ -4345,24 +4393,24 @@
4345
4393
  }
4346
4394
  return true;
4347
4395
  }
4348
- function Bn(n2) {
4396
+ function Fn(n2) {
4349
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 F = (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 Je() {
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 = Je();
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 Ne(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
- F(this, "isResolved", false);
4456
- F(this, "resolvedValue");
4457
- this.handle = e, this.postProcess = n2, Ne(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,196 +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));
4695
- }
4696
- }
4697
- const ve = "staging", we = "main";
4698
- function Ue(t, e) {
4699
- const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
4700
- if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
4701
- const { partitionKeyLength: s2 } = t;
4702
- for (const [o] of e)
4703
- if (o >= s2)
4704
- throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s2}`);
4705
- } else if (t.type === "Json") {
4706
- const { keyLength: s2 } = t;
4707
- for (const [o] of e)
4708
- if (o >= s2)
4709
- throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s2}`);
4710
- }
4711
- const r = (s2) => {
4712
- for (const [o, a] of n2)
4713
- if (s2[o] !== a)
4714
- return false;
4715
- return true;
4716
- }, i = (s2) => {
4717
- const o = [...s2];
4718
- for (const [a] of n2)
4719
- o.splice(a, 1);
4720
- return o;
4721
- };
4722
- switch (t.type) {
4723
- case "Json": {
4724
- const s2 = t.data.filter((o) => r(o.key)).map((o) => ({
4725
- key: i(o.key),
4726
- value: o.value
4727
- }));
4728
- return {
4729
- type: "Json",
4730
- keyLength: t.keyLength - e.length,
4731
- data: s2
4732
- };
4733
- }
4734
- case "JsonPartitioned": {
4735
- const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
4736
- key: i(o.key),
4737
- value: o.value
4738
- }));
4739
- return {
4740
- type: "JsonPartitioned",
4741
- partitionKeyLength: t.partitionKeyLength - e.length,
4742
- parts: s2
4743
- };
4744
- }
4745
- case "BinaryPartitioned": {
4746
- const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
4747
- key: i(o.key),
4748
- value: o.value
4749
- }));
4750
- return {
4751
- type: "BinaryPartitioned",
4752
- partitionKeyLength: t.partitionKeyLength - e.length,
4753
- parts: s2
4754
- };
4755
- }
4742
+ return s2 && (l2 = l2.filter((c2) => c2[1] !== void 0)), l2.map(([c2, w2]) => o(c2, w2));
4756
4743
  }
4757
4744
  }
4758
- const Me = "pl7.app/label", Ge = "pl7.app/trace", We = z$2.object({
4759
- type: z$2.string(),
4760
- importance: z$2.number().optional(),
4761
- id: z$2.string().optional(),
4762
- label: z$2.string()
4763
- }), He = z$2.array(We), qe = 1e-3, ze = "__LABEL__", pe = "__LABEL__@1";
4764
- function de(t, e, n2 = {}) {
4765
- const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((f2) => {
4766
- var R, k2;
4767
- const p2 = e(f2);
4768
- let d, y2, g2;
4769
- "spec" in p2 && typeof p2.spec == "object" ? (d = p2.spec, y2 = p2.prefixTrace, g2 = p2.suffixTrace) : d = p2;
4770
- const v = (R = d.annotations) == null ? void 0 : R[Me], w2 = (k2 = d.annotations) == null ? void 0 : k2[Ge], x2 = (w2 ? He.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 = [
4771
4759
  ...y2 ?? [],
4772
- ...x2,
4773
- ...g2 ?? []
4760
+ ...g,
4761
+ ...v ?? []
4774
4762
  ];
4775
- if (v) {
4776
- const A = { label: v, type: ze, importance: -2 };
4777
- n2.addLabelAsSuffix ? C.push(A) : C.splice(0, 0, A);
4778
- }
4779
- const P2 = [], T = /* @__PURE__ */ new Map();
4780
- for (let A = C.length - 1; A >= 0; --A) {
4781
- const { type: j } = C[A], V = C[A].importance ?? 0, K = (T.get(j) ?? 0) + 1;
4782
- T.set(j, K);
4783
- const J = `${j}@${K}`;
4784
- i.set(J, (i.get(J) ?? 0) + 1), r.set(
4785
- J,
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,
4786
4774
  Math.max(
4787
- r.get(J) ?? Number.NEGATIVE_INFINITY,
4788
- V - (C.length - A) * qe
4775
+ r.get(E) ?? Number.NEGATIVE_INFINITY,
4776
+ z2 - (A2.length - P) * ot
4789
4777
  )
4790
- ), P2.push({ ...C[A], fullType: J, occurenceIndex: K });
4778
+ ), x2.push({ ...A2[P], fullType: E, occurenceIndex: J });
4791
4779
  }
4792
- return P2.reverse(), {
4793
- value: f2,
4794
- spec: d,
4795
- label: v,
4796
- fullTrace: P2
4780
+ return x2.reverse(), {
4781
+ value: u2,
4782
+ spec: p2,
4783
+ label: m2,
4784
+ fullTrace: x2
4797
4785
  };
4798
- }), o = [], a = [], c2 = [...r];
4799
- c2.sort(([, f2], [, p2]) => p2 - f2);
4800
- for (const [f2] of c2)
4801
- f2.endsWith("@1") || i.get(f2) === t.length ? o.push(f2) : a.push(f2);
4802
- const l2 = (f2) => s2.map((p2) => {
4803
- 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 ?? " / ";
4804
4792
  return {
4805
- label: d.join(y2),
4806
- value: p2.value
4793
+ label: p2.join(y2),
4794
+ value: f2.value
4807
4795
  };
4808
4796
  });
4809
4797
  if (o.length === 0) {
4810
4798
  if (a.length !== 0) throw new Error("Assertion error.");
4811
- return l2(new Set(pe));
4812
- }
4813
- let m2 = 0, u2 = 0;
4814
- for (; m2 < o.length; ) {
4815
- const f2 = /* @__PURE__ */ new Set();
4816
- n2.includeNativeLabel && f2.add(pe);
4817
- for (let d = 0; d < m2; ++d) f2.add(o[d]);
4818
- f2.add(o[u2]);
4819
- const p2 = l2(f2);
4820
- if (new Set(p2.map((d) => d.label)).size === t.length) return p2;
4821
- u2++, u2 == o.length && (m2++, u2 = m2);
4822
- }
4823
- 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]));
4824
4812
  }
4825
- const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", $ = H + "JsonPartitioned", E = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
4826
- 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) => {
4827
4815
  if (t.endsWith(".index"))
4828
4816
  return { baseKey: t.substring(0, t.length - 6), type: "index" };
4829
4817
  if (t.endsWith(".values"))
4830
4818
  return { baseKey: t.substring(0, t.length - 7), type: "values" };
4831
4819
  throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4832
4820
  };
4833
- function Ye(t) {
4821
+ function lt(t) {
4834
4822
  if (!t) return;
4835
4823
  const e = t.resourceType.name, n2 = t.getDataAsJson(), r = [];
4836
4824
  let i = 0;
4837
4825
  switch (e) {
4838
- case Q:
4826
+ case ne:
4839
4827
  i = n2.keyLength;
4840
4828
  break;
4841
- case Z:
4829
+ case re:
4842
4830
  i = n2.partitionKeyLength + n2.keyLength;
4843
4831
  break;
4844
- case $:
4845
- case E:
4832
+ case U:
4833
+ case V:
4846
4834
  i = n2.partitionKeyLength;
4847
4835
  break;
4848
4836
  case B:
4849
- case ee:
4837
+ case ie:
4850
4838
  i = n2.superPartitionKeyLength + n2.partitionKeyLength;
4851
4839
  break;
4852
4840
  }
4853
4841
  switch (e) {
4854
- case Q:
4855
- case $:
4856
- case E:
4842
+ case ne:
4843
+ case U:
4844
+ case V:
4857
4845
  for (let s2 of t.listInputFields()) {
4858
- e === E && (s2 = ae(s2).baseKey);
4846
+ e === V && (s2 = fe(s2).baseKey);
4859
4847
  const o = [...JSON.parse(s2)];
4860
4848
  r.push(o);
4861
4849
  }
4862
4850
  break;
4863
- case Z:
4851
+ case re:
4864
4852
  case B:
4865
- case ee:
4853
+ case ie:
4866
4854
  for (const s2 of t.listInputFields()) {
4867
4855
  const o = [...JSON.parse(s2)], a = t.resolve({ field: s2, assertFieldType: "Input" });
4868
4856
  if (a !== void 0)
4869
- for (let c2 of a.listInputFields()) {
4870
- e === B && (c2 = ae(c2).baseKey);
4871
- const l2 = [...o, ...JSON.parse(c2)];
4872
- 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);
4873
4861
  }
4874
4862
  }
4875
4863
  break;
4876
4864
  }
4877
4865
  return { data: r, keyLength: i };
4878
4866
  }
4879
- function Xe(t) {
4880
- const e = Ye(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);
4881
4891
  if (!e) return;
4882
4892
  const { data: n2, keyLength: r } = e, i = [];
4883
4893
  for (let s2 = 0; s2 < r; ++s2)
@@ -4890,16 +4900,16 @@
4890
4900
  }
4891
4901
  return i.map((s2) => Array.from(s2.values()));
4892
4902
  }
4893
- function le(t, e = []) {
4894
- if (t === void 0) return;
4903
+ function he(t, e = []) {
4904
+ if (t === void 0 || !t.getIsReadyOrError()) return;
4895
4905
  const n2 = t.resourceType.name, r = t.getDataAsJson();
4896
- if (e.length > 0 && (n2 === ee || n2 === B))
4906
+ if (e.length > 0 && (n2 === ie || n2 === B))
4897
4907
  throw new Error(`Unexpected nested super-partitioned resource: ${n2}`);
4898
4908
  switch (n2) {
4899
- case Q:
4900
- case Z:
4909
+ case ne:
4910
+ case re:
4901
4911
  throw new Error(`Only data columns are supported, got: ${n2}`);
4902
- case $: {
4912
+ case U: {
4903
4913
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4904
4914
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4905
4915
  const i = [];
@@ -4915,21 +4925,21 @@
4915
4925
  parts: i
4916
4926
  };
4917
4927
  }
4918
- case E: {
4928
+ case V: {
4919
4929
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4920
4930
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4921
4931
  const i = [], s2 = /* @__PURE__ */ new Map();
4922
4932
  for (const o of t.listInputFields()) {
4923
- const a = ae(o), c2 = t.resolve({ field: o, assertFieldType: "Input" });
4924
- if (c2 === void 0) return;
4925
- let l2 = s2.get(a.baseKey);
4926
- 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;
4927
4937
  }
4928
4938
  for (const [o, a] of s2.entries()) {
4929
4939
  if (!a.index || !a.values) return;
4930
- const c2 = [...e, ...JSON.parse(o)];
4940
+ const l2 = [...e, ...JSON.parse(o)];
4931
4941
  i.push({
4932
- key: c2,
4942
+ key: l2,
4933
4943
  value: {
4934
4944
  index: a.index,
4935
4945
  values: a.values
@@ -4942,20 +4952,20 @@
4942
4952
  parts: i
4943
4953
  };
4944
4954
  }
4945
- case ee: {
4955
+ case ie: {
4946
4956
  if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4947
4957
  throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n2}`);
4948
4958
  const i = r.superPartitionKeyLength + r.partitionKeyLength, s2 = [];
4949
4959
  for (const o of t.listInputFields()) {
4950
4960
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4951
4961
  if (a === void 0) return;
4952
- if (a.resourceType.name !== $)
4953
- throw new Error(`Expected ${$} inside ${n2}, but got ${a.resourceType.name}`);
4954
- const c2 = le(a, JSON.parse(o));
4955
- if (c2 === void 0) return;
4956
- if (c2.type !== "JsonPartitioned")
4957
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4958
- 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);
4959
4969
  }
4960
4970
  return {
4961
4971
  type: "JsonPartitioned",
@@ -4970,13 +4980,13 @@
4970
4980
  for (const o of t.listInputFields()) {
4971
4981
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4972
4982
  if (a === void 0) return;
4973
- if (a.resourceType.name !== E)
4974
- throw new Error(`Expected ${E} inside ${n2}, but got ${a.resourceType.name}`);
4975
- const c2 = le(a, JSON.parse(o));
4976
- if (c2 === void 0) return;
4977
- if (c2.type !== "BinaryPartitioned")
4978
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4979
- 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);
4980
4990
  }
4981
4991
  return {
4982
4992
  type: "BinaryPartitioned",
@@ -4988,32 +4998,287 @@
4988
4998
  throw new Error(`Unknown resource type: ${n2}`);
4989
4999
  }
4990
5000
  }
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;
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
+ }
4997
5008
  }
4998
- function fe(t) {
4999
- return In(t, (e) => e instanceof I ? e.handle : dn(e) ? pn(e, (n2) => n2.handle) : e);
5009
+ function dt(t, e) {
5010
+ const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
5011
+ if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
5012
+ const { partitionKeyLength: s2 } = t;
5013
+ for (const [o] of e)
5014
+ if (o >= s2)
5015
+ throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s2}`);
5016
+ } else if (t.type === "Json") {
5017
+ const { keyLength: s2 } = t;
5018
+ for (const [o] of e)
5019
+ if (o >= s2)
5020
+ throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s2}`);
5021
+ }
5022
+ const r = (s2) => {
5023
+ for (const [o, a] of n2)
5024
+ if (s2[o] !== a)
5025
+ return false;
5026
+ return true;
5027
+ }, i = (s2) => {
5028
+ const o = [...s2];
5029
+ for (const [a] of n2)
5030
+ o.splice(a, 1);
5031
+ return o;
5032
+ };
5033
+ switch (t.type) {
5034
+ case "Json": {
5035
+ const s2 = t.data.filter((o) => r(o.key)).map((o) => ({
5036
+ key: i(o.key),
5037
+ value: o.value
5038
+ }));
5039
+ return {
5040
+ type: "Json",
5041
+ keyLength: t.keyLength - e.length,
5042
+ data: s2
5043
+ };
5044
+ }
5045
+ case "JsonPartitioned": {
5046
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5047
+ key: i(o.key),
5048
+ value: o.value
5049
+ }));
5050
+ return {
5051
+ type: "JsonPartitioned",
5052
+ partitionKeyLength: t.partitionKeyLength - e.length,
5053
+ parts: s2
5054
+ };
5055
+ }
5056
+ case "BinaryPartitioned": {
5057
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5058
+ key: i(o.key),
5059
+ value: o.value
5060
+ }));
5061
+ return {
5062
+ type: "BinaryPartitioned",
5063
+ partitionKeyLength: t.partitionKeyLength - e.length,
5064
+ parts: s2
5065
+ };
5066
+ }
5067
+ }
5068
+ }
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 {
5015
5110
  constructor() {
5016
- F(this, "ctx", h());
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 {
5280
+ constructor() {
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 = Xe(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, T) => {
5073
- if (T >= f$1.length) {
5074
- x2.push([...P2]);
5075
- return;
5076
- }
5077
- const R = f$1[T], k2 = v[R];
5078
- for (const A of k2)
5079
- P2.push(A), C(P2, T + 1), P2.pop();
5080
- };
5081
- C([], 0);
5082
- for (const P2 of x2) {
5083
- const T = 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: T
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 = Ue(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,6 +5505,29 @@
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
+ }
5356
5531
  /**
5357
5532
  * Find labels data for a given axis id of a p-column.
5358
5533
  * @returns a map of axis value => label
@@ -5366,13 +5541,13 @@
5366
5541
  }));
5367
5542
  }
5368
5543
  }
5369
- class z {
5544
+ class Q {
5370
5545
  constructor() {
5371
- F(this, "ctx");
5372
- F(this, "args");
5373
- F(this, "uiState");
5374
- F(this, "_activeArgsCache");
5375
- F(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());
5376
5551
  this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5377
5552
  }
5378
5553
  /**
@@ -5389,16 +5564,16 @@
5389
5564
  // return this.ctx.featureFlags;
5390
5565
  // }
5391
5566
  getNamedAccessor(e) {
5392
- return ie(
5567
+ return pe(
5393
5568
  this.ctx.getAccessorHandleByName(e),
5394
5569
  (n2) => new I(n2, [e])
5395
5570
  );
5396
5571
  }
5397
5572
  get prerun() {
5398
- return this.getNamedAccessor(ve);
5573
+ return this.getNamedAccessor(Ie);
5399
5574
  }
5400
5575
  get outputs() {
5401
- return this.getNamedAccessor(we);
5576
+ return this.getNamedAccessor(Le);
5402
5577
  }
5403
5578
  /**
5404
5579
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -5410,12 +5585,13 @@
5410
5585
  }
5411
5586
  verifyInlineAndExplicitColumnsSupport(e) {
5412
5587
  var i;
5413
- 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;
5414
5589
  if (n2 && !r) throw Error("Inline or explicit columns not supported");
5415
5590
  }
5591
+ // TODO remove all non-PColumn fields
5416
5592
  createPFrame(e) {
5417
5593
  return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5418
- e.map((n2) => fe(n2))
5594
+ e.map((n2) => we(n2))
5419
5595
  );
5420
5596
  }
5421
5597
  createPTable(e) {
@@ -5428,7 +5604,7 @@
5428
5604
  filters: e.filters ?? [],
5429
5605
  sorting: e.sorting ?? []
5430
5606
  } : n2 = e, this.verifyInlineAndExplicitColumnsSupport(jn(n2.src)), this.ctx.createPTable(
5431
- En(n2, (r) => fe(r))
5607
+ Cn(n2, (r) => we(r))
5432
5608
  );
5433
5609
  }
5434
5610
  /** @deprecated scheduled for removal from SDK */
@@ -5440,33 +5616,33 @@
5440
5616
  return this.ctx.getCurrentUnstableMarker();
5441
5617
  }
5442
5618
  }
5443
- const U = "1.27.17";
5444
- function tt(t) {
5619
+ const M = "1.28.0";
5620
+ function wt(t) {
5445
5621
  return t.__renderLambda === true;
5446
5622
  }
5447
- function se(t) {
5623
+ function ue(t) {
5448
5624
  if (t !== void 0)
5449
- return tt(t) ? t.handle : t;
5625
+ return wt(t) ? t.handle : t;
5450
5626
  }
5451
- class _ {
5627
+ class T {
5452
5628
  constructor(e, n2, r, i, s2, o, a) {
5453
5629
  this._renderingMode = e, this._initialArgs = n2, this._initialUiState = r, this._outputs = i, this._inputsValid = s2, this._sections = o, this._title = a;
5454
5630
  }
5455
5631
  static create(e = "Heavy") {
5456
- return new _(
5632
+ return new T(
5457
5633
  e,
5458
5634
  void 0,
5459
5635
  {},
5460
5636
  {},
5461
- Y(true),
5462
- Y([]),
5637
+ ee(true),
5638
+ ee([]),
5463
5639
  void 0
5464
5640
  );
5465
5641
  }
5466
5642
  output(e, n2, r = {}) {
5467
5643
  if (typeof n2 == "function") {
5468
5644
  const i = `output#${e}`;
5469
- return q(i, () => n2(new z())), new _(
5645
+ return X(i, () => n2(new Q())), new T(
5470
5646
  this._renderingMode,
5471
5647
  this._initialArgs,
5472
5648
  this._initialUiState,
@@ -5483,7 +5659,7 @@
5483
5659
  this._title
5484
5660
  );
5485
5661
  } else
5486
- return new _(
5662
+ return new T(
5487
5663
  this._renderingMode,
5488
5664
  this._initialArgs,
5489
5665
  this._initialUiState,
@@ -5501,7 +5677,7 @@
5501
5677
  return this.output(e, n2, { retentive: true });
5502
5678
  }
5503
5679
  argsValid(e) {
5504
- return typeof e == "function" ? (q("inputsValid", () => e(new z())), new _(
5680
+ return typeof e == "function" ? (X("inputsValid", () => e(new Q())), new T(
5505
5681
  this._renderingMode,
5506
5682
  this._initialArgs,
5507
5683
  this._initialUiState,
@@ -5512,7 +5688,7 @@
5512
5688
  },
5513
5689
  this._sections,
5514
5690
  this._title
5515
- )) : new _(
5691
+ )) : new T(
5516
5692
  this._renderingMode,
5517
5693
  this._initialArgs,
5518
5694
  this._initialUiState,
@@ -5523,7 +5699,7 @@
5523
5699
  );
5524
5700
  }
5525
5701
  sections(e) {
5526
- 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(
5527
5703
  this._renderingMode,
5528
5704
  this._initialArgs,
5529
5705
  this._initialUiState,
@@ -5531,7 +5707,7 @@
5531
5707
  this._inputsValid,
5532
5708
  { __renderLambda: true, handle: "sections" },
5533
5709
  this._title
5534
- )) : new _(
5710
+ )) : new T(
5535
5711
  this._renderingMode,
5536
5712
  this._initialArgs,
5537
5713
  this._initialUiState,
@@ -5543,7 +5719,7 @@
5543
5719
  }
5544
5720
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
5545
5721
  title(e) {
5546
- return q("title", () => e(new z())), new _(
5722
+ return X("title", () => e(new Q())), new T(
5547
5723
  this._renderingMode,
5548
5724
  this._initialArgs,
5549
5725
  this._initialUiState,
@@ -5558,7 +5734,7 @@
5558
5734
  * @deprecated use {@link withArgs}
5559
5735
  * */
5560
5736
  initialArgs(e) {
5561
- return new _(
5737
+ return new T(
5562
5738
  this._renderingMode,
5563
5739
  e,
5564
5740
  this._initialUiState,
@@ -5570,7 +5746,7 @@
5570
5746
  }
5571
5747
  /** Sets initial args for the block, this value must be specified. */
5572
5748
  withArgs(e) {
5573
- return new _(
5749
+ return new T(
5574
5750
  this._renderingMode,
5575
5751
  e,
5576
5752
  this._initialUiState,
@@ -5582,7 +5758,7 @@
5582
5758
  }
5583
5759
  /** Defines type and sets initial value for block UiState. */
5584
5760
  withUiState(e) {
5585
- return new _(
5761
+ return new T(
5586
5762
  this._renderingMode,
5587
5763
  this._initialArgs,
5588
5764
  e,
@@ -5599,7 +5775,7 @@
5599
5775
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
5600
5776
  const e = {
5601
5777
  v3: {
5602
- sdkVersion: U,
5778
+ sdkVersion: M,
5603
5779
  renderingMode: this._renderingMode,
5604
5780
  initialArgs: this._initialArgs,
5605
5781
  initialUiState: this._initialUiState,
@@ -5609,75 +5785,75 @@
5609
5785
  outputs: this._outputs
5610
5786
  },
5611
5787
  // fields below are added to allow previous desktop versions read generated configs
5612
- sdkVersion: U,
5788
+ sdkVersion: M,
5613
5789
  renderingMode: this._renderingMode,
5614
5790
  initialArgs: this._initialArgs,
5615
- inputsValid: se(this._inputsValid),
5616
- sections: se(this._sections),
5791
+ inputsValid: ue(this._inputsValid),
5792
+ sections: ue(this._sections),
5617
5793
  outputs: Object.fromEntries(
5618
- Object.entries(this._outputs).map(([n2, r]) => [n2, se(r)])
5794
+ Object.entries(this._outputs).map(([n2, r]) => [n2, ue(r)])
5619
5795
  )
5620
5796
  };
5621
- return Ke() ? be({ sdkVersion: U }) : { config: e };
5797
+ return Xe() ? _e({ sdkVersion: M }) : { config: e };
5622
5798
  }
5623
5799
  }
5624
- function Wt(t, e, n2, r) {
5625
- var l2, m2;
5800
+ function fn(t, e, n2, r) {
5801
+ var c2, w2;
5626
5802
  Array.isArray(r) && (r = { filters: r });
5627
- 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) => {
5628
- let p2 = u2.toString();
5629
- if (f2)
5630
- for (const d in f2)
5631
- p2 += d, p2 += f2[d];
5632
- 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;
5633
5809
  }, o = /* @__PURE__ */ new Map();
5634
- for (const u2 of e)
5635
- for (const f2 of u2.spec.axesSpec) {
5636
- const p2 = y(f2);
5637
- for (const d of i) {
5638
- const y$1 = d.spec.axesSpec[0], g2 = y(d.spec.axesSpec[0]);
5639
- if (X(p2, g2)) {
5640
- const v = Object.keys(p2.domain ?? {}).length, w2 = Object.keys(g2.domain ?? {}).length;
5641
- if (v > w2) {
5642
- const x2 = s2(d.id, p2.domain);
5643
- o.set(x2, {
5644
- 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,
5645
5821
  spec: {
5646
- ...d.spec,
5647
- axesSpec: [{ ...p2, annotations: y$1.annotations }]
5822
+ ...p2.spec,
5823
+ axesSpec: [{ ...f2, annotations: y$1.annotations }]
5648
5824
  },
5649
- data: d.data
5825
+ data: p2.data
5650
5826
  });
5651
5827
  } else
5652
- o.set(s2(d.id), d);
5828
+ o.set(s2(p2.id), p2);
5653
5829
  }
5654
5830
  }
5655
5831
  }
5656
5832
  if ([...e, ...o.values()].some(
5657
- (u2) => u2.data instanceof I && !u2.data.getIsReadyOrError()
5833
+ (d) => d.data instanceof I && !d.data.getIsReadyOrError()
5658
5834
  ))
5659
5835
  return;
5660
5836
  let a = e;
5661
- const c2 = [];
5837
+ const l2 = [];
5662
5838
  if (r != null && r.coreColumnPredicate) {
5663
5839
  a = [];
5664
- for (const u2 of e)
5665
- 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);
5666
5842
  }
5667
- return c2.push(...o.values()), t.createPTable({
5843
+ return l2.push(...o.values()), t.createPTable({
5668
5844
  src: {
5669
5845
  type: "outer",
5670
5846
  primary: {
5671
5847
  type: (r == null ? void 0 : r.coreJoinType) ?? "full",
5672
- entries: a.map((u2) => ({ type: "column", column: u2 }))
5848
+ entries: a.map((d) => ({ type: "column", column: d }))
5673
5849
  },
5674
- secondary: c2.map((u2) => ({ type: "column", column: u2 }))
5850
+ secondary: l2.map((d) => ({ type: "column", column: d }))
5675
5851
  },
5676
- filters: [...(r == null ? void 0 : r.filters) ?? [], ...((l2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : l2.filters) ?? []],
5677
- 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) ?? []
5678
5854
  });
5679
5855
  }
5680
- const ImportFileHandleSchema = z$2.string().optional().refine(
5856
+ const ImportFileHandleSchema = z$1.string().optional().refine(
5681
5857
  (_a) => true
5682
5858
  );
5683
5859
  function* range(from, to, step = 1) {
@@ -5687,20 +5863,20 @@
5687
5863
  }
5688
5864
  function toList(iterable) {
5689
5865
  const lst = [];
5690
- for (const it of iterable) {
5691
- lst.push(it);
5866
+ for (const it2 of iterable) {
5867
+ lst.push(it2);
5692
5868
  }
5693
5869
  return lst;
5694
5870
  }
5695
5871
  function times(n2, cb) {
5696
5872
  return toList(range(0, n2)).map(cb);
5697
5873
  }
5698
- const $BlockArgs = z$2.object({
5699
- tableNumRows: z$2.number().default(100),
5700
- numbers: z$2.array(z$2.coerce.number()),
5701
- 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)
5702
5878
  });
5703
- 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) => {
5704
5880
  if (ctx.args.numbers.length === 5) {
5705
5881
  throw new Error("argsValid: test error");
5706
5882
  }
@@ -5723,7 +5899,7 @@
5723
5899
  val: v.toString()
5724
5900
  };
5725
5901
  });
5726
- return Wt(
5902
+ return fn(
5727
5903
  ctx,
5728
5904
  [
5729
5905
  {
@@ -5772,12 +5948,12 @@
5772
5948
  }
5773
5949
  return "Ui Examples";
5774
5950
  }).sections((ctx) => {
5775
- const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
5951
+ const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it2) => ({
5776
5952
  type: "link",
5777
- href: `/section?id=${it.id}`,
5778
- label: it.label
5953
+ href: `/section?id=${it2.id}`,
5954
+ label: it2.label
5779
5955
  }));
5780
- if (dynamicSections.some((it) => it.label === "Error")) {
5956
+ if (dynamicSections.some((it2) => it2.label === "Error")) {
5781
5957
  throw new Error("sections: test error");
5782
5958
  }
5783
5959
  return [