@milaboratories/milaboratories.ui-examples.model 1.1.29 → 1.1.31

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 k = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
38
+ const g = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
39
39
  var util;
40
40
  (function(util2) {
41
41
  util2.assertEqual = (val) => val;
@@ -402,7 +402,7 @@
402
402
  };
403
403
  }
404
404
  let errorMessage = "";
405
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
405
+ const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
406
406
  for (const map of maps) {
407
407
  errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
408
408
  }
@@ -3731,10 +3731,10 @@
3731
3731
  return ZodAny.create().superRefine((data, ctx) => {
3732
3732
  var _a, _b;
3733
3733
  if (!check(data)) {
3734
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3735
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3736
- const p2 = typeof p === "string" ? { message: p } : p;
3737
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3734
+ const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3735
+ const _fatal = (_b = (_a = p2.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3736
+ const p22 = typeof p2 === "string" ? { message: p2 } : p2;
3737
+ ctx.addIssue({ code: "custom", ...p22, fatal: _fatal });
3738
3738
  }
3739
3739
  });
3740
3740
  return ZodAny.create();
@@ -3949,26 +3949,108 @@
3949
3949
  ZodError
3950
3950
  });
3951
3951
  var $ = Object.defineProperty;
3952
- var F = (n, t, e) => t in n ? $(n, t, { enumerable: true, configurable: true, writable: true, value: e }) : n[t] = e;
3953
- var d = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e);
3954
- function g(n) {
3952
+ var L = (n, t, e) => t in n ? $(n, t, { enumerable: true, configurable: true, writable: true, value: e }) : n[t] = e;
3953
+ var p = (n, t, e) => L(n, typeof t != "symbol" ? t + "" : t, e);
3954
+ function w(n) {
3955
3955
  throw new Error("Unexpected object: " + n);
3956
3956
  }
3957
- function h(n) {
3957
+ function yn(n) {
3958
+ if (!n || typeof n != "object")
3959
+ return false;
3960
+ const t = n;
3961
+ if (!("type" in t))
3962
+ return false;
3963
+ switch (t.type) {
3964
+ case "Json":
3965
+ return typeof t.keyLength == "number" && t.data !== void 0 && typeof t.data == "object";
3966
+ case "JsonPartitioned":
3967
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
3968
+ case "BinaryPartitioned":
3969
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
3970
+ default:
3971
+ return false;
3972
+ }
3973
+ }
3974
+ function mn(n, t) {
3975
+ if (n !== void 0)
3976
+ switch (n.type) {
3977
+ case "Json":
3978
+ return n;
3979
+ case "JsonPartitioned": {
3980
+ const e = {};
3981
+ for (const [r, o] of Object.entries(n.parts))
3982
+ e[r] = t(o);
3983
+ return {
3984
+ ...n,
3985
+ parts: e
3986
+ };
3987
+ }
3988
+ case "BinaryPartitioned": {
3989
+ const e = {};
3990
+ for (const [r, o] of Object.entries(n.parts))
3991
+ e[r] = {
3992
+ index: t(o.index),
3993
+ values: t(o.values)
3994
+ };
3995
+ return {
3996
+ ...n,
3997
+ parts: e
3998
+ };
3999
+ }
4000
+ }
4001
+ }
4002
+ function bn(n) {
4003
+ switch (n.type) {
4004
+ case "Json": {
4005
+ const t = {};
4006
+ for (const e of n.data)
4007
+ t[JSON.stringify(e.key)] = e.value;
4008
+ return {
4009
+ type: "Json",
4010
+ keyLength: n.keyLength,
4011
+ data: t
4012
+ };
4013
+ }
4014
+ case "JsonPartitioned": {
4015
+ const t = {};
4016
+ for (const e of n.parts)
4017
+ t[JSON.stringify(e.key)] = e.value;
4018
+ return {
4019
+ type: "JsonPartitioned",
4020
+ partitionKeyLength: n.partitionKeyLength,
4021
+ parts: t
4022
+ };
4023
+ }
4024
+ case "BinaryPartitioned": {
4025
+ const t = {};
4026
+ for (const e of n.parts)
4027
+ t[JSON.stringify(e.key)] = e.value;
4028
+ return {
4029
+ type: "BinaryPartitioned",
4030
+ partitionKeyLength: n.partitionKeyLength,
4031
+ parts: t
4032
+ };
4033
+ }
4034
+ }
4035
+ }
4036
+ function m(n) {
3958
4037
  const { type: t, name: e, domain: r } = n;
3959
4038
  return { type: t, name: e, ...r && { domain: r } };
3960
4039
  }
3961
- function Q(n, t) {
4040
+ function Sn(n) {
4041
+ return g(m(n));
4042
+ }
4043
+ function z$1(n, t) {
3962
4044
  if (n === void 0) return t === void 0;
3963
4045
  if (t === void 0) return true;
3964
4046
  for (const e in t)
3965
4047
  if (n[e] !== t[e]) return false;
3966
4048
  return true;
3967
4049
  }
3968
- function z$1(n, t) {
3969
- return n.name === t.name && Q(n.domain, t.domain);
4050
+ function G(n, t) {
4051
+ return n.name === t.name && z$1(n.domain, t.domain);
3970
4052
  }
3971
- function gn(n, t) {
4053
+ function En(n, t) {
3972
4054
  return { ...n, src: l(n.src, t) };
3973
4055
  }
3974
4056
  function l(n, t) {
@@ -3991,94 +4073,113 @@
3991
4073
  secondary: n.secondary.map((e) => l(e, t))
3992
4074
  };
3993
4075
  default:
3994
- g(n);
4076
+ w(n);
3995
4077
  }
3996
4078
  }
3997
- function A(n) {
3998
- return k(h(n));
4079
+ function Q$1(n) {
4080
+ return g(n);
4081
+ }
4082
+ function P(n) {
4083
+ return g(m(n));
3999
4084
  }
4000
4085
  function x(n, t) {
4001
4086
  return JSON.stringify([n, t]);
4002
4087
  }
4003
- class wn {
4088
+ class On {
4004
4089
  /**
4005
4090
  * Creates a new anchor context from a set of anchor column specifications
4006
4091
  * @param anchors Record of anchor column specifications indexed by anchor ID
4007
4092
  */
4008
4093
  constructor(t) {
4009
- d(this, "domains", /* @__PURE__ */ new Map());
4010
- d(this, "axes", /* @__PURE__ */ new Map());
4011
- d(this, "domainPacks", []);
4012
- d(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
4094
+ p(this, "domains", /* @__PURE__ */ new Map());
4095
+ p(this, "axes", /* @__PURE__ */ new Map());
4096
+ p(this, "domainPacks", []);
4097
+ p(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
4013
4098
  this.anchors = t;
4014
4099
  const e = Object.entries(t);
4015
4100
  e.sort((r, o) => r[0].localeCompare(o[0]));
4016
4101
  for (const [r, o] of e) {
4017
4102
  for (let i = 0; i < o.axesSpec.length; i++) {
4018
- const a = o.axesSpec[i], s = A(a);
4019
- this.axes.set(s, { anchor: r, idx: i });
4103
+ const s = o.axesSpec[i], a = P(s);
4104
+ this.axes.set(a, { anchor: r, idx: i });
4020
4105
  }
4021
4106
  if (o.domain !== void 0) {
4022
4107
  const i = Object.entries(o.domain);
4023
- i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
4024
- for (const [a, s] of i) {
4025
- const c = x(a, s);
4108
+ i.sort((s, a) => s[0].localeCompare(a[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([s]) => s));
4109
+ for (const [s, a] of i) {
4110
+ const c = x(s, a);
4026
4111
  this.domains.set(c, r);
4027
4112
  }
4028
4113
  }
4029
4114
  }
4030
4115
  }
4031
4116
  /**
4032
- * Derives an anchored column identifier from a column specification
4033
- * Replaces domain values and axes with anchored references when possible
4034
- * @param spec Column specification to anchor
4035
- * @returns An anchored column identifier that can be used to identify columns similar to the input specification
4117
+ * Implementation of derive method
4036
4118
  */
4037
- derive(t) {
4038
- const e = {
4119
+ derive(t, e) {
4120
+ const r = {
4039
4121
  name: t.name,
4040
4122
  axes: []
4041
4123
  };
4042
- let r;
4124
+ let o;
4043
4125
  if (t.domain !== void 0)
4044
4126
  n:
4045
- for (const o of this.domainPacks) {
4046
- const i = [];
4047
- for (const s of o) {
4048
- const c = t.domain[s];
4049
- if (c !== void 0)
4050
- i.push([s, c]);
4127
+ for (const s of this.domainPacks) {
4128
+ const a = [];
4129
+ for (const u of s) {
4130
+ const d = t.domain[u];
4131
+ if (d !== void 0)
4132
+ a.push([u, d]);
4051
4133
  else
4052
4134
  break n;
4053
4135
  }
4054
- const a = this.domainPackToAnchor.get(JSON.stringify(i));
4055
- if (a !== void 0) {
4056
- e.domainAnchor = a, r = new Set(o);
4136
+ const c = this.domainPackToAnchor.get(JSON.stringify(a));
4137
+ if (c !== void 0) {
4138
+ r.domainAnchor = c, o = new Set(s);
4057
4139
  break;
4058
4140
  }
4059
4141
  }
4060
- for (const [o, i] of Object.entries(t.domain ?? {})) {
4061
- if (r !== void 0 && r.has(o))
4142
+ for (const [s, a] of Object.entries(t.domain ?? {})) {
4143
+ if (o !== void 0 && o.has(s))
4062
4144
  continue;
4063
- const a = x(o, i), s = this.domains.get(a);
4064
- e.domain ?? (e.domain = {}), e.domain[o] = s ? { anchor: s } : i;
4145
+ const c = x(s, a), u = this.domains.get(c);
4146
+ r.domain ?? (r.domain = {}), r.domain[s] = u ? { anchor: u } : a;
4065
4147
  }
4066
- return e.axes = t.axesSpec.map((o) => {
4067
- const i = A(o);
4068
- return this.axes.get(i) ?? o;
4069
- }), e;
4148
+ if (r.axes = t.axesSpec.map((s) => {
4149
+ const a = P(s);
4150
+ return this.axes.get(a) ?? s;
4151
+ }), !e || e.length === 0)
4152
+ return r;
4153
+ const i = [];
4154
+ for (const s of e) {
4155
+ const [a, c] = s;
4156
+ if (typeof a == "number") {
4157
+ if (a < 0 || a >= t.axesSpec.length)
4158
+ throw new Error(`Axis index ${a} is out of bounds (0-${t.axesSpec.length - 1})`);
4159
+ i.push([a, c]);
4160
+ } else {
4161
+ const u = t.axesSpec.findIndex((d) => d.name === a);
4162
+ if (u === -1)
4163
+ throw new Error(`Axis with name "${a}" not found in the column specification`);
4164
+ i.push([u, c]);
4165
+ }
4166
+ }
4167
+ return i.sort((s, a) => s[0] - a[0]), {
4168
+ source: r,
4169
+ axisFilters: i
4170
+ };
4070
4171
  }
4071
4172
  /**
4072
4173
  * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
4073
4174
  * @param spec Column specification to anchor
4175
+ * @param axisFilters Optional axis filters to apply to the column
4074
4176
  * @returns A canonicalized string representation of the anchored column identifier
4075
4177
  */
4076
- deriveCanonical(t) {
4077
- const e = this.derive(t);
4078
- return k(e);
4178
+ deriveS(t, e) {
4179
+ return Q$1(this.derive(t, e));
4079
4180
  }
4080
4181
  }
4081
- function An(n, t) {
4182
+ function Jn(n, t) {
4082
4183
  const e = { ...t };
4083
4184
  if (e.domainAnchor !== void 0) {
4084
4185
  const r = n[e.domainAnchor];
@@ -4093,19 +4194,19 @@
4093
4194
  if (typeof i == "string")
4094
4195
  r[o] = i;
4095
4196
  else {
4096
- const a = n[i.anchor];
4097
- if (!a)
4197
+ const s = n[i.anchor];
4198
+ if (!s)
4098
4199
  throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);
4099
- if (!a.domain || a.domain[o] === void 0)
4200
+ if (!s.domain || s.domain[o] === void 0)
4100
4201
  throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);
4101
- r[o] = a.domain[o];
4202
+ r[o] = s.domain[o];
4102
4203
  }
4103
4204
  e.domain = r;
4104
4205
  }
4105
- return e.axes && (e.axes = e.axes.map((r) => Y(n, r))), e;
4206
+ return e.axes && (e.axes = e.axes.map((r) => Y$1(n, r))), e;
4106
4207
  }
4107
- function Y(n, t) {
4108
- if (!Z(t))
4208
+ function Y$1(n, t) {
4209
+ if (!Z$1(t))
4109
4210
  return t;
4110
4211
  const e = t.anchor, r = n[e];
4111
4212
  if (!r)
@@ -4122,7 +4223,7 @@
4122
4223
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4123
4224
  return o[0];
4124
4225
  } else if ("id" in t) {
4125
- const o = r.axesSpec.filter((i) => z$1(t.id, h(i)));
4226
+ const o = r.axesSpec.filter((i) => G(t.id, m(i)));
4126
4227
  if (o.length > 1)
4127
4228
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4128
4229
  if (o.length === 0)
@@ -4131,26 +4232,26 @@
4131
4232
  }
4132
4233
  throw new Error("Unsupported axis reference type");
4133
4234
  }
4134
- function Z(n) {
4235
+ function Z$1(n) {
4135
4236
  return typeof n == "object" && "anchor" in n;
4136
4237
  }
4137
- function f$1(n) {
4238
+ function f(n) {
4138
4239
  return n.kind === "PColumn";
4139
4240
  }
4140
4241
  function q$1(n) {
4141
- return f$1(n.spec);
4242
+ return f(n.spec);
4142
4243
  }
4143
- function En(n) {
4244
+ function Dn(n) {
4144
4245
  if (!q$1(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
4145
4246
  return n;
4146
4247
  }
4147
- function kn(n, t) {
4248
+ function jn(n, t) {
4148
4249
  return n === void 0 ? void 0 : {
4149
4250
  ...n,
4150
4251
  data: t(n.data)
4151
4252
  };
4152
4253
  }
4153
- function In(n) {
4254
+ function Bn(n) {
4154
4255
  const t = /* @__PURE__ */ new Map(), e = (r) => {
4155
4256
  switch (r.type) {
4156
4257
  case "column":
@@ -4165,12 +4266,12 @@
4165
4266
  for (const o of r.secondary) e(o);
4166
4267
  return;
4167
4268
  default:
4168
- g(r);
4269
+ w(r);
4169
4270
  }
4170
4271
  };
4171
4272
  return e(n), [...t.values()];
4172
4273
  }
4173
- function P$1(n, t) {
4274
+ function k(n, t) {
4174
4275
  if (n.name !== void 0 && n.name !== t.name)
4175
4276
  return false;
4176
4277
  if (n.type !== void 0) {
@@ -4188,7 +4289,7 @@
4188
4289
  }
4189
4290
  return true;
4190
4291
  }
4191
- function E$1(n, t) {
4292
+ function N$1(n, t) {
4192
4293
  if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
4193
4294
  return false;
4194
4295
  if (t.type !== void 0) {
@@ -4205,16 +4306,16 @@
4205
4306
  return false;
4206
4307
  }
4207
4308
  if (t.axes !== void 0) {
4208
- const e = n.axesSpec.map(h);
4309
+ const e = n.axesSpec.map(m);
4209
4310
  if (t.partialAxesMatch) {
4210
4311
  for (const r of t.axes)
4211
- if (!e.some((o) => P$1(r, o)))
4312
+ if (!e.some((o) => k(r, o)))
4212
4313
  return false;
4213
4314
  } else {
4214
4315
  if (e.length !== t.axes.length)
4215
4316
  return false;
4216
4317
  for (let r = 0; r < t.axes.length; r++)
4217
- if (!P$1(t.axes[r], e[r]))
4318
+ if (!k(t.axes[r], e[r]))
4218
4319
  return false;
4219
4320
  }
4220
4321
  }
@@ -4234,8 +4335,8 @@
4234
4335
  }
4235
4336
  return true;
4236
4337
  }
4237
- function Nn(n) {
4238
- return Array.isArray(n) ? (t) => n.some((e) => f$1(t) && E$1(t, e)) : (t) => f$1(t) && E$1(t, n);
4338
+ function In(n) {
4339
+ return Array.isArray(n) ? (t) => n.some((e) => f(t) && N$1(t, e)) : (t) => f(t) && N$1(t, n);
4239
4340
  }
4240
4341
  z$2.object({
4241
4342
  __isRef: z$2.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
@@ -4244,100 +4345,100 @@
4244
4345
  }).describe(
4245
4346
  "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
4246
4347
  ).strict().readonly();
4247
- function Vn(n) {
4348
+ function Kn(n) {
4248
4349
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === true && "blockId" in n && "name" in n;
4249
4350
  }
4250
- function Fn(n, t) {
4351
+ function Mn(n, t) {
4251
4352
  return n.ok ? { ok: true, value: t(n.value) } : n;
4252
4353
  }
4253
- const on = 24;
4254
- z$2.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4255
- var ve = Object.defineProperty;
4256
- var _e = (t, e, n) => e in t ? ve(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4257
- var P = (t, e, n) => _e(t, typeof e != "symbol" ? e + "" : e, n);
4258
- function j(t) {
4354
+ const an = 24;
4355
+ z$2.string().length(an).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4356
+ var _e = Object.defineProperty;
4357
+ var Ie = (t, e, n) => e in t ? _e(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4358
+ var T = (t, e, n) => Ie(t, typeof e != "symbol" ? e + "" : e, n);
4359
+ function Y(t) {
4259
4360
  return { type: "Immediate", value: t };
4260
4361
  }
4261
- function Fe() {
4362
+ function Ke() {
4262
4363
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4263
4364
  }
4264
- function de(t) {
4365
+ function be(t) {
4265
4366
  if (t && typeof globalThis.getPlatforma == "function")
4266
4367
  return globalThis.getPlatforma(t);
4267
4368
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4268
4369
  throw new Error("Can't get platforma instance.");
4269
4370
  }
4270
- function Te() {
4371
+ function $e() {
4271
4372
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4272
4373
  }
4273
- function f() {
4374
+ function h() {
4274
4375
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4275
4376
  throw new Error("Not in config rendering context");
4276
4377
  }
4277
- function E(t, e) {
4278
- const n = Te();
4378
+ function q(t, e) {
4379
+ const n = $e();
4279
4380
  if (n === void 0) return false;
4280
4381
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4281
4382
  return n.callbackRegistry[t] = e, true;
4282
4383
  }
4283
- const W = /* @__PURE__ */ new Map();
4284
- function xe(t, e) {
4285
- t in f().callbackRegistry || (f().callbackRegistry[t] = (n) => {
4286
- for (const s of W.get(t))
4287
- s(n);
4288
- }, W.set(t, [])), W.get(t).push(e);
4384
+ const ne = /* @__PURE__ */ new Map();
4385
+ function Je(t, e) {
4386
+ t in h().callbackRegistry || (h().callbackRegistry[t] = (n) => {
4387
+ for (const r of ne.get(t))
4388
+ r(n);
4389
+ }, ne.set(t, [])), ne.get(t).push(e);
4289
4390
  }
4290
- class _ {
4291
- constructor(e, n = (s) => s) {
4292
- P(this, "isResolved", false);
4293
- P(this, "resolvedValue");
4294
- this.handle = e, this.postProcess = n, xe(e, (s) => {
4295
- this.resolvedValue = n(s), this.isResolved = true;
4391
+ class S {
4392
+ constructor(e, n = (r) => r) {
4393
+ T(this, "isResolved", false);
4394
+ T(this, "resolvedValue");
4395
+ this.handle = e, this.postProcess = n, Je(e, (r) => {
4396
+ this.resolvedValue = n(r), this.isResolved = true;
4296
4397
  });
4297
4398
  }
4298
4399
  map(e) {
4299
- return new _(this.handle, (n) => e(this.postProcess(n)));
4400
+ return new S(this.handle, (n) => e(this.postProcess(n)));
4300
4401
  }
4301
4402
  mapDefined(e) {
4302
- return new _(this.handle, (n) => {
4303
- const s = this.postProcess(n);
4304
- return s ? e(s) : void 0;
4403
+ return new S(this.handle, (n) => {
4404
+ const r = this.postProcess(n);
4405
+ return r ? e(r) : void 0;
4305
4406
  });
4306
4407
  }
4307
4408
  toJSON() {
4308
4409
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4309
4410
  }
4310
4411
  }
4311
- function z(t, e) {
4412
+ function ie(t, e) {
4312
4413
  return t === void 0 ? void 0 : e(t);
4313
4414
  }
4314
- class S {
4415
+ class I {
4315
4416
  constructor(e, n) {
4316
4417
  this.handle = e, this.resolvePath = n;
4317
4418
  }
4318
4419
  resolve(...e) {
4319
4420
  const n = e.map(
4320
- (s) => ({
4421
+ (r) => ({
4321
4422
  assertFieldType: "Input",
4322
- ...typeof s == "string" ? { field: s } : s
4423
+ ...typeof r == "string" ? { field: r } : r
4323
4424
  })
4324
4425
  );
4325
4426
  return this.resolveWithCommon({}, ...n);
4326
4427
  }
4327
4428
  resolveOutput(...e) {
4328
4429
  const n = e.map(
4329
- (s) => ({
4430
+ (r) => ({
4330
4431
  assertFieldType: "Output",
4331
- ...typeof s == "string" ? { field: s } : s
4432
+ ...typeof r == "string" ? { field: r } : r
4332
4433
  })
4333
4434
  );
4334
4435
  return this.resolveWithCommon({}, ...n);
4335
4436
  }
4336
4437
  resolveInput(...e) {
4337
4438
  const n = e.map(
4338
- (s) => ({
4439
+ (r) => ({
4339
4440
  assertFieldType: "Input",
4340
- ...typeof s == "string" ? { field: s } : s
4441
+ ...typeof r == "string" ? { field: r } : r
4341
4442
  })
4342
4443
  );
4343
4444
  return this.resolveWithCommon({}, ...n);
@@ -4346,51 +4447,51 @@
4346
4447
  return this.resolveWithCommon({}, ...e);
4347
4448
  }
4348
4449
  resolveWithCommon(e, ...n) {
4349
- const s = [
4450
+ const r = [
4350
4451
  ...this.resolvePath,
4351
- ...n.map((r) => typeof r == "string" ? r : r.field)
4452
+ ...n.map((i) => typeof i == "string" ? i : i.field)
4352
4453
  ];
4353
- return z(
4354
- f().resolveWithCommon(this.handle, e, ...n),
4355
- (r) => new S(r, s)
4454
+ return ie(
4455
+ h().resolveWithCommon(this.handle, e, ...n),
4456
+ (i) => new I(i, r)
4356
4457
  );
4357
4458
  }
4358
4459
  get resourceType() {
4359
- return f().getResourceType(this.handle);
4460
+ return h().getResourceType(this.handle);
4360
4461
  }
4361
4462
  getInputsLocked() {
4362
- return f().getInputsLocked(this.handle);
4463
+ return h().getInputsLocked(this.handle);
4363
4464
  }
4364
4465
  getOutputsLocked() {
4365
- return f().getOutputsLocked(this.handle);
4466
+ return h().getOutputsLocked(this.handle);
4366
4467
  }
4367
4468
  getIsReadyOrError() {
4368
- return f().getIsReadyOrError(this.handle);
4469
+ return h().getIsReadyOrError(this.handle);
4369
4470
  }
4370
4471
  getIsFinal() {
4371
- return f().getIsFinal(this.handle);
4472
+ return h().getIsFinal(this.handle);
4372
4473
  }
4373
4474
  getError() {
4374
4475
  const e = [...this.resolvePath, "error"];
4375
- return z(
4376
- f().getError(this.handle),
4377
- (n) => new S(n, e)
4476
+ return ie(
4477
+ h().getError(this.handle),
4478
+ (n) => new I(n, e)
4378
4479
  );
4379
4480
  }
4380
4481
  listInputFields() {
4381
- return f().listInputFields(this.handle);
4482
+ return h().listInputFields(this.handle);
4382
4483
  }
4383
4484
  listOutputFields() {
4384
- return f().listOutputFields(this.handle);
4485
+ return h().listOutputFields(this.handle);
4385
4486
  }
4386
4487
  listDynamicFields() {
4387
- return f().listDynamicFields(this.handle);
4488
+ return h().listDynamicFields(this.handle);
4388
4489
  }
4389
4490
  getKeyValueBase64(e) {
4390
- return f().getKeyValueBase64(this.handle, e);
4491
+ return h().getKeyValueBase64(this.handle, e);
4391
4492
  }
4392
4493
  getKeyValueAsString(e) {
4393
- return f().getKeyValueAsString(this.handle, e);
4494
+ return h().getKeyValueAsString(this.handle, e);
4394
4495
  }
4395
4496
  getKeyValueAsJson(e) {
4396
4497
  const n = this.getKeyValueAsString(e);
@@ -4398,10 +4499,10 @@
4398
4499
  return JSON.parse(n);
4399
4500
  }
4400
4501
  getDataBase64() {
4401
- return f().getDataBase64(this.handle);
4502
+ return h().getDataBase64(this.handle);
4402
4503
  }
4403
4504
  getDataAsString() {
4404
- return f().getDataAsString(this.handle);
4505
+ return h().getDataAsString(this.handle);
4405
4506
  }
4406
4507
  getDataAsJson() {
4407
4508
  const e = this.getDataAsString();
@@ -4412,39 +4513,39 @@
4412
4513
  *
4413
4514
  */
4414
4515
  getPColumns(e = false, n = "") {
4415
- const s = this.parsePObjectCollection(e, n);
4416
- return s === void 0 ? void 0 : Object.entries(s).map(([, i]) => {
4417
- if (!q$1(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
4418
- return i;
4516
+ const r = this.parsePObjectCollection(e, n);
4517
+ return r === void 0 ? void 0 : Object.entries(r).map(([, s]) => {
4518
+ if (!q$1(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
4519
+ return s;
4419
4520
  });
4420
4521
  }
4421
4522
  /**
4422
4523
  *
4423
4524
  */
4424
4525
  parsePObjectCollection(e = false, n = "") {
4425
- const s = f().parsePObjectCollection(
4526
+ const r = h().parsePObjectCollection(
4426
4527
  this.handle,
4427
4528
  e,
4428
4529
  n,
4429
4530
  ...this.resolvePath
4430
4531
  );
4431
- if (s === void 0) return;
4432
- const r = {};
4433
- for (const [i, o] of Object.entries(s)) {
4434
- const l2 = [...this.resolvePath, i];
4435
- r[i] = kn(o, (a) => new S(a, l2));
4532
+ if (r === void 0) return;
4533
+ const i = {};
4534
+ for (const [s, o] of Object.entries(r)) {
4535
+ const a = [...this.resolvePath, s];
4536
+ i[s] = jn(o, (c) => new I(c, a));
4436
4537
  }
4437
- return r;
4538
+ return i;
4438
4539
  }
4439
4540
  getFileContentAsBase64() {
4440
- return new _(f().getBlobContentAsBase64(this.handle));
4541
+ return new S(h().getBlobContentAsBase64(this.handle));
4441
4542
  }
4442
4543
  getFileContentAsString() {
4443
- return new _(f().getBlobContentAsString(this.handle));
4544
+ return new S(h().getBlobContentAsString(this.handle));
4444
4545
  }
4445
4546
  getFileContentAsJson() {
4446
- return new _(
4447
- f().getBlobContentAsString(this.handle)
4547
+ return new S(
4548
+ h().getBlobContentAsString(this.handle)
4448
4549
  ).mapDefined((e) => JSON.parse(e));
4449
4550
  }
4450
4551
  /**
@@ -4463,7 +4564,7 @@
4463
4564
  * @returns downloaded file handle
4464
4565
  */
4465
4566
  getFileHandle() {
4466
- return new _(f().getDownloadedBlobContentHandle(this.handle));
4567
+ return new S(h().getDownloadedBlobContentHandle(this.handle));
4467
4568
  }
4468
4569
  /**
4469
4570
  * @deprecated use getFileHandle
@@ -4475,7 +4576,7 @@
4475
4576
  * @returns downloaded file handle
4476
4577
  */
4477
4578
  getRemoteFileHandle() {
4478
- return new _(f().getOnDemandBlobContentHandle(this.handle));
4579
+ return new S(h().getOnDemandBlobContentHandle(this.handle));
4479
4580
  }
4480
4581
  /**
4481
4582
  * @deprecated use getRemoteFileHandle
@@ -4487,22 +4588,22 @@
4487
4588
  * @returns the url to the extracted folder
4488
4589
  */
4489
4590
  extractArchiveAndGetURL(e) {
4490
- return new _(f().extractArchiveAndGetURL(this.handle, e));
4591
+ return new S(h().extractArchiveAndGetURL(this.handle, e));
4491
4592
  }
4492
4593
  getImportProgress() {
4493
- return new _(f().getImportProgress(this.handle));
4594
+ return new S(h().getImportProgress(this.handle));
4494
4595
  }
4495
4596
  getLastLogs(e) {
4496
- return new _(f().getLastLogs(this.handle, e));
4597
+ return new S(h().getLastLogs(this.handle, e));
4497
4598
  }
4498
4599
  getProgressLog(e) {
4499
- return new _(f().getProgressLog(this.handle, e));
4600
+ return new S(h().getProgressLog(this.handle, e));
4500
4601
  }
4501
4602
  getProgressLogWithInfo(e) {
4502
- return new _(f().getProgressLogWithInfo(this.handle, e));
4603
+ return new S(h().getProgressLogWithInfo(this.handle, e));
4503
4604
  }
4504
4605
  getLogHandle() {
4505
- return new _(f().getLogHandle(this.handle));
4606
+ return new S(h().getLogHandle(this.handle));
4506
4607
  }
4507
4608
  allFieldsResolved(e = "Input") {
4508
4609
  switch (e) {
@@ -4517,88 +4618,340 @@
4517
4618
  }
4518
4619
  }
4519
4620
  mapFields(e, n) {
4520
- const { fieldType: s, requireLocked: r, skipUnresolved: i } = {
4621
+ const { fieldType: r, requireLocked: i, skipUnresolved: s } = {
4521
4622
  fieldType: "Input",
4522
4623
  requireLocked: true,
4523
4624
  skipUnresolved: false,
4524
4625
  ...n
4525
4626
  }, o = e;
4526
- if (r && (s === "Input" && !this.getInputsLocked() || s === "Output" && !this.getOutputsLocked()))
4627
+ if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4527
4628
  return;
4528
- let a = (s === "Input" ? this.listInputFields() : s === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4529
- (u) => [u, this.resolve({ field: u, assertFieldType: s })]
4629
+ let c = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4630
+ (l2) => [l2, this.resolve({ field: l2, assertFieldType: r })]
4530
4631
  );
4531
- return i && (a = a.filter((u) => u[1] !== void 0)), a.map(([u, g2]) => o(u, g2));
4632
+ return s && (c = c.filter((l2) => l2[1] !== void 0)), c.map(([l2, m2]) => o(l2, m2));
4532
4633
  }
4533
4634
  }
4534
- const pe = "staging", fe = "main";
4535
- const Oe = "pl7.app/label", ke = "pl7.app/trace", Ee = z$2.object({
4635
+ const ve = "staging", we = "main";
4636
+ const Ue = "pl7.app/label", Me = "pl7.app/trace", Ge = z$2.object({
4536
4637
  type: z$2.string(),
4537
4638
  importance: z$2.number().optional(),
4538
4639
  id: z$2.string().optional(),
4539
4640
  label: z$2.string()
4540
- }), Ve = z$2.array(Ee), je = 1e-3, Ne = "__LABEL__", se = "__LABEL__@1";
4541
- function re(t, e, n = {}) {
4542
- const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = t.map((d2) => {
4543
- var A2, ee;
4544
- const h2 = e(d2), p = (A2 = h2.annotations) == null ? void 0 : A2[Oe], b = (ee = h2.annotations) == null ? void 0 : ee[ke], m = (b ? Ve.safeParse(JSON.parse(b)).data : void 0) ?? [];
4545
- if (p) {
4546
- const C = { label: p, type: Ne, importance: -2 };
4547
- n.addLabelAsSuffix ? m.push(C) : m.splice(0, 0, C);
4548
- }
4549
- const I = [], v = /* @__PURE__ */ new Map();
4550
- for (let C = m.length - 1; C >= 0; --C) {
4551
- const { type: J } = m[C], be = m[C].importance ?? 0, M = (v.get(J) ?? 0) + 1;
4552
- v.set(J, M);
4553
- const x2 = `${J}@${M}`;
4554
- r.set(x2, (r.get(x2) ?? 0) + 1), s.set(
4555
- x2,
4641
+ }), We = z$2.array(Ge), He = 1e-3, qe = "__LABEL__", pe = "__LABEL__@1";
4642
+ function de(t, e, n = {}) {
4643
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = t.map((f2) => {
4644
+ var R, k2;
4645
+ const p2 = e(f2);
4646
+ let d, y, g2;
4647
+ "spec" in p2 && typeof p2.spec == "object" ? (d = p2.spec, y = p2.prefixTrace, g2 = p2.suffixTrace) : d = p2;
4648
+ 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 = [
4649
+ ...y ?? [],
4650
+ ...x2,
4651
+ ...g2 ?? []
4652
+ ];
4653
+ if (v) {
4654
+ const A = { label: v, type: qe, importance: -2 };
4655
+ n.addLabelAsSuffix ? C.push(A) : C.splice(0, 0, A);
4656
+ }
4657
+ const P2 = [], F = /* @__PURE__ */ new Map();
4658
+ for (let A = C.length - 1; A >= 0; --A) {
4659
+ const { type: j } = C[A], V = C[A].importance ?? 0, K = (F.get(j) ?? 0) + 1;
4660
+ F.set(j, K);
4661
+ const $2 = `${j}@${K}`;
4662
+ i.set($2, (i.get($2) ?? 0) + 1), r.set(
4663
+ $2,
4556
4664
  Math.max(
4557
- s.get(x2) ?? Number.NEGATIVE_INFINITY,
4558
- be - (m.length - C) * je
4665
+ r.get($2) ?? Number.NEGATIVE_INFINITY,
4666
+ V - (C.length - A) * He
4559
4667
  )
4560
- ), I.push({ ...m[C], fullType: x2, occurenceIndex: M });
4668
+ ), P2.push({ ...C[A], fullType: $2, occurenceIndex: K });
4561
4669
  }
4562
- return I.reverse(), {
4563
- value: d2,
4564
- spec: h2,
4565
- label: p,
4566
- fullTrace: I
4670
+ return P2.reverse(), {
4671
+ value: f2,
4672
+ spec: d,
4673
+ label: v,
4674
+ fullTrace: P2
4567
4675
  };
4568
- }), o = [], l2 = [], a = [...s];
4569
- a.sort(([, d2], [, h2]) => h2 - d2);
4570
- for (const [d2] of a)
4571
- d2.endsWith("@1") || r.get(d2) === t.length ? o.push(d2) : l2.push(d2);
4572
- const u = (d2) => i.map((h2) => {
4573
- const p = h2.fullTrace.filter((m) => d2.has(m.fullType)).map((m) => m.label), b = n.separator ?? " / ";
4676
+ }), o = [], a = [], c = [...r];
4677
+ c.sort(([, f2], [, p2]) => p2 - f2);
4678
+ for (const [f2] of c)
4679
+ f2.endsWith("@1") || i.get(f2) === t.length ? o.push(f2) : a.push(f2);
4680
+ const l2 = (f2) => s.map((p2) => {
4681
+ const d = p2.fullTrace.filter((g2) => f2.has(g2.fullType)).map((g2) => g2.label), y = n.separator ?? " / ";
4574
4682
  return {
4575
- label: p.join(b),
4576
- value: h2.value
4683
+ label: d.join(y),
4684
+ value: p2.value
4577
4685
  };
4578
4686
  });
4579
4687
  if (o.length === 0) {
4580
- if (l2.length !== 0) throw new Error("Assertion error.");
4581
- return u(new Set(se));
4582
- }
4583
- let g2 = 0, c = 0;
4584
- for (; g2 < o.length; ) {
4585
- const d2 = /* @__PURE__ */ new Set();
4586
- n.includeNativeLabel && d2.add(se);
4587
- for (let p = 0; p < g2; ++p) d2.add(o[p]);
4588
- d2.add(o[c]);
4589
- const h2 = u(d2);
4590
- if (new Set(h2.map((p) => p.label)).size === t.length) return h2;
4591
- c++, c == o.length && (g2++, c = g2);
4592
- }
4593
- return u(/* @__PURE__ */ new Set([...o, ...l2]));
4688
+ if (a.length !== 0) throw new Error("Assertion error.");
4689
+ return l2(new Set(pe));
4690
+ }
4691
+ let m2 = 0, u = 0;
4692
+ for (; m2 < o.length; ) {
4693
+ const f2 = /* @__PURE__ */ new Set();
4694
+ n.includeNativeLabel && f2.add(pe);
4695
+ for (let d = 0; d < m2; ++d) f2.add(o[d]);
4696
+ f2.add(o[u]);
4697
+ const p2 = l2(f2);
4698
+ if (new Set(p2.map((d) => d.label)).size === t.length) return p2;
4699
+ u++, u == o.length && (m2++, u = m2);
4700
+ }
4701
+ return l2(/* @__PURE__ */ new Set([...o, ...a]));
4594
4702
  }
4595
- class Ue {
4703
+ const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", N = H + "JsonPartitioned", O = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
4704
+ const ae = (t) => {
4705
+ if (t.endsWith(".index"))
4706
+ return { baseKey: t.substring(0, t.length - 6), type: "index" };
4707
+ if (t.endsWith(".values"))
4708
+ return { baseKey: t.substring(0, t.length - 7), type: "values" };
4709
+ throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4710
+ };
4711
+ function ze(t) {
4712
+ if (!t) return;
4713
+ const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
4714
+ let i = 0;
4715
+ switch (e) {
4716
+ case Q:
4717
+ i = n.keyLength;
4718
+ break;
4719
+ case Z:
4720
+ i = n.partitionKeyLength + n.keyLength;
4721
+ break;
4722
+ case N:
4723
+ case O:
4724
+ i = n.partitionKeyLength;
4725
+ break;
4726
+ case B:
4727
+ case ee:
4728
+ i = n.superPartitionKeyLength + n.partitionKeyLength;
4729
+ break;
4730
+ }
4731
+ switch (e) {
4732
+ case Q:
4733
+ case N:
4734
+ case O:
4735
+ for (let s of t.listInputFields()) {
4736
+ e === O && (s = ae(s).baseKey);
4737
+ const o = [...JSON.parse(s)];
4738
+ r.push(o);
4739
+ }
4740
+ break;
4741
+ case Z:
4742
+ case B:
4743
+ case ee:
4744
+ for (const s of t.listInputFields()) {
4745
+ const o = [...JSON.parse(s)], a = t.resolve({ field: s, assertFieldType: "Input" });
4746
+ if (a !== void 0)
4747
+ for (let c of a.listInputFields()) {
4748
+ e === B && (c = ae(c).baseKey);
4749
+ const l2 = [...o, ...JSON.parse(c)];
4750
+ r.push(l2);
4751
+ }
4752
+ }
4753
+ break;
4754
+ }
4755
+ return { data: r, keyLength: i };
4756
+ }
4757
+ function Ye(t) {
4758
+ const e = ze(t);
4759
+ if (!e) return;
4760
+ const { data: n, keyLength: r } = e, i = [];
4761
+ for (let s = 0; s < r; ++s)
4762
+ i.push(/* @__PURE__ */ new Set());
4763
+ for (const s of n) {
4764
+ if (s.length !== r)
4765
+ throw new Error("key length does not match partition length");
4766
+ for (let o = 0; o < r; ++o)
4767
+ i[o].add(s[o]);
4768
+ }
4769
+ return i.map((s) => Array.from(s.values()));
4770
+ }
4771
+ function le(t, e = []) {
4772
+ if (t === void 0) return;
4773
+ const n = t.resourceType.name, r = t.getDataAsJson();
4774
+ if (e.length > 0 && (n === ee || n === B))
4775
+ throw new Error(`Unexpected nested super-partitioned resource: ${n}`);
4776
+ switch (n) {
4777
+ case Q:
4778
+ case Z:
4779
+ throw new Error(`Only data columns are supported, got: ${n}`);
4780
+ case N: {
4781
+ if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4782
+ throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
4783
+ const i = [];
4784
+ for (const s of t.listInputFields()) {
4785
+ const o = t.resolve({ field: s, assertFieldType: "Input" });
4786
+ if (o === void 0) return;
4787
+ const a = [...e, ...JSON.parse(s)];
4788
+ i.push({ key: a, value: o });
4789
+ }
4790
+ return {
4791
+ type: "JsonPartitioned",
4792
+ partitionKeyLength: r.partitionKeyLength,
4793
+ parts: i
4794
+ };
4795
+ }
4796
+ case O: {
4797
+ if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4798
+ throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
4799
+ const i = [], s = /* @__PURE__ */ new Map();
4800
+ for (const o of t.listInputFields()) {
4801
+ const a = ae(o), c = t.resolve({ field: o, assertFieldType: "Input" });
4802
+ if (c === void 0) return;
4803
+ let l2 = s.get(a.baseKey);
4804
+ l2 || (l2 = {}, s.set(a.baseKey, l2)), a.type === "index" ? l2.index = c : l2.values = c;
4805
+ }
4806
+ for (const [o, a] of s.entries()) {
4807
+ if (!a.index || !a.values) return;
4808
+ const c = [...e, ...JSON.parse(o)];
4809
+ i.push({
4810
+ key: c,
4811
+ value: {
4812
+ index: a.index,
4813
+ values: a.values
4814
+ }
4815
+ });
4816
+ }
4817
+ return {
4818
+ type: "BinaryPartitioned",
4819
+ partitionKeyLength: r.partitionKeyLength,
4820
+ parts: i
4821
+ };
4822
+ }
4823
+ case ee: {
4824
+ if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4825
+ throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);
4826
+ const i = r.superPartitionKeyLength + r.partitionKeyLength, s = [];
4827
+ for (const o of t.listInputFields()) {
4828
+ const a = t.resolve({ field: o, assertFieldType: "Input" });
4829
+ if (a === void 0) return;
4830
+ if (a.resourceType.name !== N)
4831
+ throw new Error(`Expected ${N} inside ${n}, but got ${a.resourceType.name}`);
4832
+ const c = le(a, JSON.parse(o));
4833
+ if (c === void 0) return;
4834
+ if (c.type !== "JsonPartitioned")
4835
+ throw new Error(`Unexpected inner result type for ${n}: ${c.type}`);
4836
+ s.push(...c.parts);
4837
+ }
4838
+ return {
4839
+ type: "JsonPartitioned",
4840
+ partitionKeyLength: i,
4841
+ parts: s
4842
+ };
4843
+ }
4844
+ case B: {
4845
+ if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4846
+ throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);
4847
+ const i = r.superPartitionKeyLength + r.partitionKeyLength, s = [];
4848
+ for (const o of t.listInputFields()) {
4849
+ const a = t.resolve({ field: o, assertFieldType: "Input" });
4850
+ if (a === void 0) return;
4851
+ if (a.resourceType.name !== O)
4852
+ throw new Error(`Expected ${O} inside ${n}, but got ${a.resourceType.name}`);
4853
+ const c = le(a, JSON.parse(o));
4854
+ if (c === void 0) return;
4855
+ if (c.type !== "BinaryPartitioned")
4856
+ throw new Error(`Unexpected inner result type for ${n}: ${c.type}`);
4857
+ s.push(...c.parts);
4858
+ }
4859
+ return {
4860
+ type: "BinaryPartitioned",
4861
+ partitionKeyLength: i,
4862
+ parts: s
4863
+ };
4864
+ }
4865
+ default:
4866
+ throw new Error(`Unknown resource type: ${n}`);
4867
+ }
4868
+ }
4869
+ function Xe(t, e) {
4870
+ const n = [...e].sort((s, o) => o[0] - s[0]);
4871
+ if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
4872
+ const { partitionKeyLength: s } = t;
4873
+ for (const [o] of e)
4874
+ if (o >= s)
4875
+ throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`);
4876
+ } else if (t.type === "Json") {
4877
+ const { keyLength: s } = t;
4878
+ for (const [o] of e)
4879
+ if (o >= s)
4880
+ throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`);
4881
+ }
4882
+ const r = (s) => {
4883
+ for (const [o, a] of n)
4884
+ if (s[o] !== a)
4885
+ return false;
4886
+ return true;
4887
+ }, i = (s) => {
4888
+ const o = [...s];
4889
+ for (const [a] of n)
4890
+ o.splice(a, 1);
4891
+ return o;
4892
+ };
4893
+ switch (t.type) {
4894
+ case "Json": {
4895
+ const s = t.data.filter((o) => r(o.key)).map((o) => ({
4896
+ key: i(o.key),
4897
+ value: o.value
4898
+ }));
4899
+ return {
4900
+ type: "Json",
4901
+ keyLength: t.keyLength - e.length,
4902
+ data: s
4903
+ };
4904
+ }
4905
+ case "JsonPartitioned": {
4906
+ const s = t.parts.filter((o) => r(o.key)).map((o) => ({
4907
+ key: i(o.key),
4908
+ value: o.value
4909
+ }));
4910
+ return {
4911
+ type: "JsonPartitioned",
4912
+ partitionKeyLength: t.partitionKeyLength - e.length,
4913
+ parts: s
4914
+ };
4915
+ }
4916
+ case "BinaryPartitioned": {
4917
+ const s = t.parts.filter((o) => r(o.key)).map((o) => ({
4918
+ key: i(o.key),
4919
+ value: o.value
4920
+ }));
4921
+ return {
4922
+ type: "BinaryPartitioned",
4923
+ partitionKeyLength: t.partitionKeyLength - e.length,
4924
+ parts: s
4925
+ };
4926
+ }
4927
+ }
4928
+ }
4929
+ function re(t, e) {
4930
+ if (t === void 0) return e === void 0;
4931
+ if (e === void 0) return true;
4932
+ for (const n in e)
4933
+ if (t[n] !== e[n]) return false;
4934
+ return true;
4935
+ }
4936
+ function fe(t) {
4937
+ return jn(t, (e) => e instanceof I ? e.handle : yn(e) ? mn(e, (n) => n.handle) : e);
4938
+ }
4939
+ function Qe(t) {
4940
+ if (t)
4941
+ return t.map((e) => ({
4942
+ type: `split:${Sn(e.axisId)}`,
4943
+ label: e.label,
4944
+ importance: 1e6
4945
+ // High importance for split filters in labels
4946
+ }));
4947
+ }
4948
+ function Ze(t) {
4949
+ if (t)
4950
+ return t.map((e) => [e.axisIdx, e.value]);
4951
+ }
4952
+ class et {
4596
4953
  constructor() {
4597
- P(this, "ctx", f());
4598
- P(this, "defaultLabelFn", (e, n) => {
4599
- var s;
4600
- return ((s = e.annotations) == null ? void 0 : s["pl7.app/label"]) ?? "Unlabelled";
4601
- });
4954
+ T(this, "ctx", h());
4602
4955
  }
4603
4956
  /**
4604
4957
  * @deprecated use getOptions()
@@ -4607,35 +4960,199 @@
4607
4960
  return this.ctx.calculateOptions(e);
4608
4961
  }
4609
4962
  getOptions(e, n) {
4610
- const s = typeof e == "function" ? e : Nn(e), r = this.getSpecs().entries.filter((i) => s(i.obj));
4611
- return typeof n == "object" || typeof n > "u" ? re(r, (i) => i.obj, n ?? {}).map(({ value: { ref: i }, label: o }) => ({
4612
- ref: i,
4963
+ const r = typeof e == "function" ? e : In(e), i = this.getSpecs().entries.filter((s) => r(s.obj));
4964
+ return typeof n == "object" || typeof n > "u" ? de(i, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: o }) => ({
4965
+ ref: s,
4613
4966
  label: o
4614
- })) : r.map((i) => ({
4615
- ref: i.ref,
4616
- label: n(i.obj, i.ref)
4967
+ })) : i.map((s) => ({
4968
+ ref: s.ref,
4969
+ label: n(s.obj, s.ref)
4617
4970
  }));
4618
4971
  }
4619
- // Implementation
4620
- getCanonicalOptions(e, n, s) {
4621
- const r = {};
4622
- if (!(e instanceof wn))
4623
- for (const [a, u] of Object.entries(e))
4624
- if (Vn(u)) {
4625
- const g2 = this.getPColumnSpecByRef(u);
4626
- if (!g2)
4972
+ /**
4973
+ * Internal implementation that generates UniversalPColumnEntry objects from the provided
4974
+ * anchors and selectors.
4975
+ */
4976
+ getUniversalPColumnEntries(e, n, r) {
4977
+ const i = {};
4978
+ if (!(e instanceof On))
4979
+ for (const [l2, m2] of Object.entries(e))
4980
+ if (Kn(m2)) {
4981
+ const u = this.getPColumnSpecByRef(m2);
4982
+ if (!u)
4627
4983
  return;
4628
- r[a] = g2;
4984
+ i[l2] = u;
4629
4985
  } else
4630
- r[a] = u;
4631
- const i = typeof n == "function" ? n : Nn(
4632
- Array.isArray(n) ? n.map((a) => An(r, a)) : An(r, n)
4633
- ), o = this.getSpecs().entries.filter(({ obj: a }) => f$1(a) ? i(a) : false), l2 = e instanceof wn ? e : new wn(r);
4634
- return re(o, (a) => a.obj, s ?? {}).map(({ value: { obj: a }, label: u }) => ({
4635
- value: l2.deriveCanonical(a),
4636
- label: u
4986
+ i[l2] = m2;
4987
+ const s = typeof n == "function" ? [n] : Array.isArray(n) ? n : [n], o = e instanceof On ? e : new On(i), a = [];
4988
+ for (const l2 of s) {
4989
+ const m$1 = typeof l2 == "function" ? l2 : In(Jn(i, l2)), u = this.getSpecs().entries.filter(({ obj: p2 }) => f(p2) ? m$1(p2) : false);
4990
+ if (u.length === 0)
4991
+ continue;
4992
+ 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) : [];
4993
+ if (f$1.sort((p2, d) => p2 - d), f$1.length > 0) {
4994
+ const p2 = f$1[f$1.length - 1];
4995
+ for (const { ref: d, obj: y } of u) {
4996
+ if (!f(y)) throw new Error(`Assertion failed: expected PColumnSpec, got ${y.kind}`);
4997
+ const g2 = this.getDataByRef(d);
4998
+ if (!g2) {
4999
+ if (r != null && r.dontWaitAllData) continue;
5000
+ return;
5001
+ }
5002
+ if (!q$1(g2)) throw new Error(`Assertion failed: expected PColumn, got ${g2.spec.kind}`);
5003
+ const v = Ye(g2.data);
5004
+ if (!v) {
5005
+ if (r != null && r.dontWaitAllData) continue;
5006
+ return;
5007
+ }
5008
+ if (p2 >= v.length)
5009
+ throw new Error(`Not enough partition keys for the requested split axes in column ${y.name}`);
5010
+ const w2 = f$1.map((P2) => this.findLabels(m(y.axesSpec[P2]))), x2 = [], C = (P2, F) => {
5011
+ if (F >= f$1.length) {
5012
+ x2.push([...P2]);
5013
+ return;
5014
+ }
5015
+ const R = f$1[F], k2 = v[R];
5016
+ for (const A of k2)
5017
+ P2.push(A), C(P2, F + 1), P2.pop();
5018
+ };
5019
+ C([], 0);
5020
+ for (const P2 of x2) {
5021
+ const F = P2.map((R, k2) => {
5022
+ const A = f$1[k2], j = m(y.axesSpec[A]), V = w2[k2], K = (V == null ? void 0 : V[R]) ?? String(R);
5023
+ return { axisIdx: A, axisId: j, value: R, label: K };
5024
+ });
5025
+ a.push({
5026
+ obj: y,
5027
+ ref: d,
5028
+ axisFilters: F
5029
+ });
5030
+ }
5031
+ }
5032
+ } else
5033
+ for (const { ref: p2, obj: d } of u)
5034
+ f(d) && a.push({
5035
+ obj: d,
5036
+ ref: p2
5037
+ // No splitFilters needed here
5038
+ });
5039
+ }
5040
+ return a.length === 0 ? [] : de(
5041
+ a,
5042
+ (l2) => ({
5043
+ spec: l2.obj,
5044
+ suffixTrace: Qe(l2.axisFilters)
5045
+ // Use helper function
5046
+ }),
5047
+ (r == null ? void 0 : r.labelOps) ?? {}
5048
+ ).map((l2) => ({
5049
+ id: o.deriveS(
5050
+ l2.value.obj,
5051
+ Ze(l2.value.axisFilters)
5052
+ // Use helper function
5053
+ ),
5054
+ obj: l2.value.obj,
5055
+ ref: l2.value.ref,
5056
+ axisFilters: l2.value.axisFilters,
5057
+ label: l2.label
4637
5058
  }));
4638
5059
  }
5060
+ /**
5061
+ * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
5062
+ *
5063
+ * @param anchorsOrCtx - Anchor context for column selection (same as in getCanonicalOptions)
5064
+ * @param predicateOrSelectors - Predicate or selectors for filtering columns (same as in getCanonicalOptions)
5065
+ * @param opts - Optional configuration for label generation and data waiting
5066
+ * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
5067
+ */
5068
+ getAnchoredPColumns(e, n, r) {
5069
+ const i = {
5070
+ ...r,
5071
+ labelOps: {
5072
+ includeNativeLabel: true,
5073
+ ...(r == null ? void 0 : r.labelOps) || {}
5074
+ }
5075
+ }, s = this.getUniversalPColumnEntries(
5076
+ e,
5077
+ n,
5078
+ i
5079
+ );
5080
+ if (!s || s.length === 0) return;
5081
+ const o = [];
5082
+ for (const a of s) {
5083
+ const c = this.getPColumnByRef(a.ref);
5084
+ if (!c) return;
5085
+ const l2 = le(c.data);
5086
+ if (!l2) return;
5087
+ let m2 = l2, u = { ...c.spec };
5088
+ if (a.axisFilters && a.axisFilters.length > 0) {
5089
+ const p2 = a.axisFilters.map((g2) => [
5090
+ g2.axisIdx,
5091
+ g2.value
5092
+ ]);
5093
+ m2 = Xe(l2, p2);
5094
+ const d = [...a.axisFilters].map((g2) => g2.axisIdx).sort((g2, v) => v - g2), y = [...u.axesSpec];
5095
+ for (const g2 of d)
5096
+ y.splice(g2, 1);
5097
+ u = { ...u, axesSpec: y };
5098
+ }
5099
+ const f2 = bn(m2);
5100
+ u.annotations ? u = {
5101
+ ...u,
5102
+ annotations: {
5103
+ ...u.annotations,
5104
+ "pl7.app/label": a.label
5105
+ }
5106
+ } : u = {
5107
+ ...u,
5108
+ annotations: {
5109
+ "pl7.app/label": a.label
5110
+ }
5111
+ }, o.push({
5112
+ id: a.id,
5113
+ spec: u,
5114
+ data: f2
5115
+ });
5116
+ }
5117
+ return o;
5118
+ }
5119
+ /**
5120
+ * Calculates anchored identifier options for columns matching a given predicate and returns their
5121
+ * canonicalized representations.
5122
+ *
5123
+ * This function filters column specifications from the result pool that match the provided predicate,
5124
+ * creates a standardized AnchorCtx from the provided anchors, and generates a list of label-value
5125
+ * pairs for UI components (like dropdowns).
5126
+ *
5127
+ * @param anchorsOrCtx - Either:
5128
+ * - An existing AnchorCtx instance
5129
+ * - A record mapping anchor IDs to PColumnSpec objects
5130
+ * - A record mapping anchor IDs to PlRef objects (which will be resolved to PColumnSpec)
5131
+ * @param predicateOrSelectors - Either:
5132
+ * - A predicate function that takes a PColumnSpec and returns a boolean.
5133
+ * Only specs that return true will be included.
5134
+ * - An APColumnSelector object for declarative filtering, which will be
5135
+ * resolved against the provided anchors and matched using matchPColumn.
5136
+ * - An array of APColumnSelector objects - columns matching ANY selector
5137
+ * in the array will be included (OR operation).
5138
+ * @param opts - Optional configuration for label generation:
5139
+ * - labelOps: Optional configuration for label generation:
5140
+ * - includeNativeLabel: Whether to include native column labels
5141
+ * - separator: String to use between label parts (defaults to " / ")
5142
+ * - addLabelAsSuffix: Whether to add labels as suffix instead of prefix
5143
+ * - dontWaitAllData: Whether to skip columns that don't have all data (if not set, will return undefined,
5144
+ * if at least one column that requires splitting is missing data)
5145
+ * @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
5146
+ * or undefined if any PlRef resolution fails.
5147
+ */
5148
+ getCanonicalOptions(e, n, r) {
5149
+ const i = this.getUniversalPColumnEntries(e, n, r);
5150
+ if (i)
5151
+ return i.map((s) => ({
5152
+ value: s.id,
5153
+ label: s.label
5154
+ }));
5155
+ }
4639
5156
  /**
4640
5157
  * @deprecated use getData()
4641
5158
  */
@@ -4650,7 +5167,7 @@
4650
5167
  ref: n.ref,
4651
5168
  obj: {
4652
5169
  ...n.obj,
4653
- data: new S(n.obj.data, [n.ref.blockId, n.ref.name])
5170
+ data: new I(n.obj.data, [n.ref.blockId, n.ref.name])
4654
5171
  }
4655
5172
  }))
4656
5173
  };
@@ -4669,9 +5186,9 @@
4669
5186
  ref: n.ref,
4670
5187
  obj: {
4671
5188
  ...n.obj,
4672
- data: Fn(
5189
+ data: Mn(
4673
5190
  n.obj.data,
4674
- (s) => new S(s, [n.ref.blockId, n.ref.name])
5191
+ (r) => new I(r, [n.ref.blockId, n.ref.name])
4675
5192
  )
4676
5193
  }
4677
5194
  }))
@@ -4691,13 +5208,17 @@
4691
5208
  * @returns data associated with the ref
4692
5209
  */
4693
5210
  getDataByRef(e) {
4694
- var n;
4695
- return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4696
- (s) => s.ref.blockId === e.blockId && s.ref.name === e.name
4697
- )) == null ? void 0 : n.obj : kn(
4698
- this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
4699
- (s) => new S(s, [e.blockId, e.name])
4700
- );
5211
+ var r;
5212
+ if (typeof this.ctx.getDataFromResultPoolByRef > "u")
5213
+ return (r = this.getData().entries.find(
5214
+ (i) => i.ref.blockId === e.blockId && i.ref.name === e.name
5215
+ )) == null ? void 0 : r.obj;
5216
+ const n = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
5217
+ if (n)
5218
+ return jn(
5219
+ n,
5220
+ (i) => new I(i, [e.blockId, e.name])
5221
+ );
4701
5222
  }
4702
5223
  /**
4703
5224
  * Returns data associated with the ref ensuring that it is a p-column.
@@ -4707,7 +5228,7 @@
4707
5228
  getPColumnByRef(e) {
4708
5229
  const n = this.getDataByRef(e);
4709
5230
  if (n)
4710
- return En(n);
5231
+ return Dn(n);
4711
5232
  }
4712
5233
  /**
4713
5234
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -4717,7 +5238,7 @@
4717
5238
  getPColumnSpecByRef(e) {
4718
5239
  const n = this.getSpecByRef(e);
4719
5240
  if (n) {
4720
- if (!f$1(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
5241
+ if (!f(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
4721
5242
  return n;
4722
5243
  }
4723
5244
  }
@@ -4735,37 +5256,50 @@
4735
5256
  */
4736
5257
  findDataWithCompatibleSpec(e) {
4737
5258
  const n = [];
4738
- e: for (const s of this.getData().entries) {
4739
- if (!f$1(s.obj.spec))
5259
+ e: for (const r of this.getData().entries) {
5260
+ if (!f(r.obj.spec))
4740
5261
  continue;
4741
- const r = s.obj.spec;
4742
- if (e.name === r.name && e.valueType === r.valueType && e.axesSpec.length === r.axesSpec.length && X(e.domain, r.domain)) {
4743
- for (let i = 0; i < e.axesSpec.length; ++i) {
4744
- const o = e.axesSpec[i], l2 = r.axesSpec[i];
4745
- if (o.name !== l2.name || o.type !== l2.type || !X(o.domain, l2.domain))
5262
+ const i = r.obj.spec;
5263
+ if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && re(e.domain, i.domain)) {
5264
+ for (let s = 0; s < e.axesSpec.length; ++s) {
5265
+ const o = e.axesSpec[s], a = i.axesSpec[s];
5266
+ if (o.name !== a.name || o.type !== a.type || !re(o.domain, a.domain))
4746
5267
  continue e;
4747
5268
  }
4748
- n.push(s.obj);
5269
+ n.push(r.obj);
4749
5270
  }
4750
5271
  }
4751
5272
  return n;
4752
5273
  }
5274
+ /**
5275
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
5276
+ * @returns a map of axis value => label
5277
+ */
5278
+ findLabels(e) {
5279
+ const n = this.getData();
5280
+ for (const r of n.entries) {
5281
+ if (!q$1(r.obj)) continue;
5282
+ const i = r.obj.spec;
5283
+ 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)) {
5284
+ if (r.obj.data.resourceType.name !== "PColumnData/Json")
5285
+ throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
5286
+ return Object.fromEntries(
5287
+ Object.entries(
5288
+ r.obj.data.getDataAsJson().data
5289
+ ).map((o) => [JSON.parse(o[0])[0], o[1]])
5290
+ );
5291
+ }
5292
+ }
5293
+ }
4753
5294
  }
4754
- function X(t, e) {
4755
- if (t === void 0) return e === void 0;
4756
- if (e === void 0) return true;
4757
- for (const n in e)
4758
- if (t[n] !== e[n]) return false;
4759
- return true;
4760
- }
4761
- class V {
5295
+ class z {
4762
5296
  constructor() {
4763
- P(this, "ctx");
4764
- P(this, "args");
4765
- P(this, "uiState");
4766
- P(this, "_activeArgsCache");
4767
- P(this, "resultPool", new Ue());
4768
- this.ctx = f(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5297
+ T(this, "ctx");
5298
+ T(this, "args");
5299
+ T(this, "uiState");
5300
+ T(this, "_activeArgsCache");
5301
+ T(this, "resultPool", new et());
5302
+ this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
4769
5303
  }
4770
5304
  /**
4771
5305
  * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
@@ -4781,45 +5315,33 @@
4781
5315
  // return this.ctx.featureFlags;
4782
5316
  // }
4783
5317
  getNamedAccessor(e) {
4784
- return z(
5318
+ return ie(
4785
5319
  this.ctx.getAccessorHandleByName(e),
4786
- (n) => new S(n, [e])
5320
+ (n) => new I(n, [e])
4787
5321
  );
4788
5322
  }
4789
5323
  get prerun() {
4790
- return this.getNamedAccessor(pe);
5324
+ return this.getNamedAccessor(ve);
4791
5325
  }
4792
5326
  get outputs() {
4793
- return this.getNamedAccessor(fe);
5327
+ return this.getNamedAccessor(we);
4794
5328
  }
4795
5329
  /**
4796
5330
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
4797
5331
  * @returns a map of axis value => label
5332
+ * @deprecated Use resultPool.findLabels instead
4798
5333
  */
4799
5334
  findLabels(e) {
4800
- const n = this.resultPool.getData();
4801
- for (const s of n.entries) {
4802
- if (!q$1(s.obj)) continue;
4803
- const r = s.obj.spec;
4804
- if (r.name === "pl7.app/label" && r.axesSpec.length === 1 && r.axesSpec[0].name === e.name && r.axesSpec[0].type === e.type && X(e.domain, r.axesSpec[0].domain)) {
4805
- if (s.obj.data.resourceType.name !== "PColumnData/Json")
4806
- throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);
4807
- return Object.fromEntries(
4808
- Object.entries(
4809
- s.obj.data.getDataAsJson().data
4810
- ).map((o) => [JSON.parse(o[0])[0], o[1]])
4811
- );
4812
- }
4813
- }
5335
+ return this.resultPool.findLabels(e);
4814
5336
  }
4815
- verifyInlineColumnsSupport(e) {
4816
- var r;
4817
- const n = e.some((i) => !(i.data instanceof S)), s = ((r = this.ctx.featureFlags) == null ? void 0 : r.inlineColumnsSupport) === true;
4818
- if (n && !s) throw Error("inline columns not supported");
5337
+ verifyInlineAndExplicitColumnsSupport(e) {
5338
+ var i;
5339
+ const n = e.some((s) => !(s.data instanceof I) || yn(s.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5340
+ if (n && !r) throw Error("Inline or explicit columns not supported");
4819
5341
  }
4820
5342
  createPFrame(e) {
4821
- return this.verifyInlineColumnsSupport(e), this.ctx.createPFrame(
4822
- e.map((n) => kn(n, (s) => s instanceof S ? s.handle : s))
5343
+ return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5344
+ e.map((n) => fe(n))
4823
5345
  );
4824
5346
  }
4825
5347
  createPTable(e) {
@@ -4827,15 +5349,12 @@
4827
5349
  return "columns" in e ? n = {
4828
5350
  src: {
4829
5351
  type: "full",
4830
- entries: e.columns.map((s) => ({ type: "column", column: s }))
5352
+ entries: e.columns.map((r) => ({ type: "column", column: r }))
4831
5353
  },
4832
5354
  filters: e.filters ?? [],
4833
5355
  sorting: e.sorting ?? []
4834
- } : n = e, this.verifyInlineColumnsSupport(In(n.src)), this.ctx.createPTable(
4835
- gn(
4836
- n,
4837
- (s) => kn(s, (r) => r instanceof S ? r.handle : r)
4838
- )
5356
+ } : n = e, this.verifyInlineAndExplicitColumnsSupport(Bn(n.src)), this.ctx.createPTable(
5357
+ En(n, (r) => fe(r))
4839
5358
  );
4840
5359
  }
4841
5360
  /** @deprecated scheduled for removal from SDK */
@@ -4847,33 +5366,33 @@
4847
5366
  return this.ctx.getCurrentUnstableMarker();
4848
5367
  }
4849
5368
  }
4850
- const L = "1.24.11";
4851
- function Je(t) {
5369
+ const U = "1.26.0";
5370
+ function tt(t) {
4852
5371
  return t.__renderLambda === true;
4853
5372
  }
4854
- function q(t) {
5373
+ function se(t) {
4855
5374
  if (t !== void 0)
4856
- return Je(t) ? t.handle : t;
5375
+ return tt(t) ? t.handle : t;
4857
5376
  }
4858
- class w {
4859
- constructor(e, n, s, r, i, o, l2) {
4860
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = s, this._outputs = r, this._inputsValid = i, this._sections = o, this._title = l2;
5377
+ class _ {
5378
+ constructor(e, n, r, i, s, o, a) {
5379
+ this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = i, this._inputsValid = s, this._sections = o, this._title = a;
4861
5380
  }
4862
5381
  static create(e = "Heavy") {
4863
- return new w(
5382
+ return new _(
4864
5383
  e,
4865
5384
  void 0,
4866
5385
  {},
4867
5386
  {},
4868
- j(true),
4869
- j([]),
5387
+ Y(true),
5388
+ Y([]),
4870
5389
  void 0
4871
5390
  );
4872
5391
  }
4873
- output(e, n, s = {}) {
5392
+ output(e, n, r = {}) {
4874
5393
  if (typeof n == "function") {
4875
- const r = `output#${e}`;
4876
- return E(r, () => n(new V())), new w(
5394
+ const i = `output#${e}`;
5395
+ return q(i, () => n(new z())), new _(
4877
5396
  this._renderingMode,
4878
5397
  this._initialArgs,
4879
5398
  this._initialUiState,
@@ -4881,8 +5400,8 @@
4881
5400
  ...this._outputs,
4882
5401
  [e]: {
4883
5402
  __renderLambda: true,
4884
- handle: r,
4885
- ...s
5403
+ handle: i,
5404
+ ...r
4886
5405
  }
4887
5406
  },
4888
5407
  this._inputsValid,
@@ -4890,7 +5409,7 @@
4890
5409
  this._title
4891
5410
  );
4892
5411
  } else
4893
- return new w(
5412
+ return new _(
4894
5413
  this._renderingMode,
4895
5414
  this._initialArgs,
4896
5415
  this._initialUiState,
@@ -4908,7 +5427,7 @@
4908
5427
  return this.output(e, n, { retentive: true });
4909
5428
  }
4910
5429
  argsValid(e) {
4911
- return typeof e == "function" ? (E("inputsValid", () => e(new V())), new w(
5430
+ return typeof e == "function" ? (q("inputsValid", () => e(new z())), new _(
4912
5431
  this._renderingMode,
4913
5432
  this._initialArgs,
4914
5433
  this._initialUiState,
@@ -4919,7 +5438,7 @@
4919
5438
  },
4920
5439
  this._sections,
4921
5440
  this._title
4922
- )) : new w(
5441
+ )) : new _(
4923
5442
  this._renderingMode,
4924
5443
  this._initialArgs,
4925
5444
  this._initialUiState,
@@ -4930,7 +5449,7 @@
4930
5449
  );
4931
5450
  }
4932
5451
  sections(e) {
4933
- return Array.isArray(e) ? this.sections(j(e)) : typeof e == "function" ? (E("sections", () => e(new V())), new w(
5452
+ return Array.isArray(e) ? this.sections(Y(e)) : typeof e == "function" ? (q("sections", () => e(new z())), new _(
4934
5453
  this._renderingMode,
4935
5454
  this._initialArgs,
4936
5455
  this._initialUiState,
@@ -4938,7 +5457,7 @@
4938
5457
  this._inputsValid,
4939
5458
  { __renderLambda: true, handle: "sections" },
4940
5459
  this._title
4941
- )) : new w(
5460
+ )) : new _(
4942
5461
  this._renderingMode,
4943
5462
  this._initialArgs,
4944
5463
  this._initialUiState,
@@ -4950,7 +5469,7 @@
4950
5469
  }
4951
5470
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
4952
5471
  title(e) {
4953
- return E("title", () => e(new V())), new w(
5472
+ return q("title", () => e(new z())), new _(
4954
5473
  this._renderingMode,
4955
5474
  this._initialArgs,
4956
5475
  this._initialUiState,
@@ -4965,7 +5484,7 @@
4965
5484
  * @deprecated use {@link withArgs}
4966
5485
  * */
4967
5486
  initialArgs(e) {
4968
- return new w(
5487
+ return new _(
4969
5488
  this._renderingMode,
4970
5489
  e,
4971
5490
  this._initialUiState,
@@ -4977,7 +5496,7 @@
4977
5496
  }
4978
5497
  /** Sets initial args for the block, this value must be specified. */
4979
5498
  withArgs(e) {
4980
- return new w(
5499
+ return new _(
4981
5500
  this._renderingMode,
4982
5501
  e,
4983
5502
  this._initialUiState,
@@ -4989,7 +5508,7 @@
4989
5508
  }
4990
5509
  /** Defines type and sets initial value for block UiState. */
4991
5510
  withUiState(e) {
4992
- return new w(
5511
+ return new _(
4993
5512
  this._renderingMode,
4994
5513
  this._initialArgs,
4995
5514
  e,
@@ -5006,7 +5525,7 @@
5006
5525
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
5007
5526
  const e = {
5008
5527
  v3: {
5009
- sdkVersion: L,
5528
+ sdkVersion: U,
5010
5529
  renderingMode: this._renderingMode,
5011
5530
  initialArgs: this._initialArgs,
5012
5531
  initialUiState: this._initialUiState,
@@ -5016,72 +5535,72 @@
5016
5535
  outputs: this._outputs
5017
5536
  },
5018
5537
  // fields below are added to allow previous desktop versions read generated configs
5019
- sdkVersion: L,
5538
+ sdkVersion: U,
5020
5539
  renderingMode: this._renderingMode,
5021
5540
  initialArgs: this._initialArgs,
5022
- inputsValid: q(this._inputsValid),
5023
- sections: q(this._sections),
5541
+ inputsValid: se(this._inputsValid),
5542
+ sections: se(this._sections),
5024
5543
  outputs: Object.fromEntries(
5025
- Object.entries(this._outputs).map(([n, s]) => [n, q(s)])
5544
+ Object.entries(this._outputs).map(([n, r]) => [n, se(r)])
5026
5545
  )
5027
5546
  };
5028
- return Fe() ? de({ sdkVersion: L }) : { config: e };
5547
+ return Ke() ? be({ sdkVersion: U }) : { config: e };
5029
5548
  }
5030
5549
  }
5031
- function Dt(t, e, n, s) {
5032
- var u, g2;
5033
- Array.isArray(s) && (s = { filters: s });
5034
- const r = t.resultPool.getData().entries.map((c) => c.obj).filter(q$1).filter((c) => c.spec.name === "pl7.app/label" && c.spec.axesSpec.length === 1), i = (c, d2) => {
5035
- let h2 = c.toString();
5036
- if (d2)
5037
- for (const p in d2)
5038
- h2 += p, h2 += d2[p];
5039
- return h2;
5550
+ function Gt(t, e, n, r) {
5551
+ var l2, m$1;
5552
+ Array.isArray(r) && (r = { filters: r });
5553
+ const i = t.resultPool.getData().entries.map((u) => u.obj).filter(q$1).filter((u) => u.spec.name === "pl7.app/label" && u.spec.axesSpec.length === 1), s = (u, f2) => {
5554
+ let p2 = u.toString();
5555
+ if (f2)
5556
+ for (const d in f2)
5557
+ p2 += d, p2 += f2[d];
5558
+ return p2;
5040
5559
  }, o = /* @__PURE__ */ new Map();
5041
- for (const c of e)
5042
- for (const d2 of c.spec.axesSpec) {
5043
- const h$1 = h(d2);
5044
- for (const p of r) {
5045
- const b = p.spec.axesSpec[0], m = h(p.spec.axesSpec[0]);
5046
- if (z$1(h$1, m)) {
5047
- const I = Object.keys(h$1.domain ?? {}).length, v = Object.keys(m.domain ?? {}).length;
5048
- if (I > v) {
5049
- const A2 = i(p.id, h$1.domain);
5050
- o.set(A2, {
5051
- id: A2,
5560
+ for (const u of e)
5561
+ for (const f2 of u.spec.axesSpec) {
5562
+ const p2 = m(f2);
5563
+ for (const d of i) {
5564
+ const y = d.spec.axesSpec[0], g2 = m(d.spec.axesSpec[0]);
5565
+ if (G(p2, g2)) {
5566
+ const v = Object.keys(p2.domain ?? {}).length, w2 = Object.keys(g2.domain ?? {}).length;
5567
+ if (v > w2) {
5568
+ const x2 = s(d.id, p2.domain);
5569
+ o.set(x2, {
5570
+ id: x2,
5052
5571
  spec: {
5053
- ...p.spec,
5054
- axesSpec: [{ ...h$1, annotations: b.annotations }]
5572
+ ...d.spec,
5573
+ axesSpec: [{ ...p2, annotations: y.annotations }]
5055
5574
  },
5056
- data: p.data
5575
+ data: d.data
5057
5576
  });
5058
5577
  } else
5059
- o.set(i(p.id), p);
5578
+ o.set(s(d.id), d);
5060
5579
  }
5061
5580
  }
5062
5581
  }
5063
5582
  if ([...e, ...o.values()].some(
5064
- (c) => c.data instanceof S && !c.data.getIsReadyOrError()
5583
+ (u) => u.data instanceof I && !u.data.getIsReadyOrError()
5065
5584
  ))
5066
5585
  return;
5067
- let l2 = e;
5068
- const a = [];
5069
- if (s != null && s.coreColumnPredicate) {
5070
- l2 = [];
5071
- for (const c of e)
5072
- s.coreColumnPredicate(c.spec) ? l2.push(c) : a.push(c);
5073
- }
5074
- return a.push(...o.values()), t.createPTable({
5586
+ let a = e;
5587
+ const c = [];
5588
+ if (r != null && r.coreColumnPredicate) {
5589
+ a = [];
5590
+ for (const u of e)
5591
+ r.coreColumnPredicate(u.spec) ? a.push(u) : c.push(u);
5592
+ }
5593
+ return c.push(...o.values()), t.createPTable({
5075
5594
  src: {
5076
5595
  type: "outer",
5077
5596
  primary: {
5078
- type: (s == null ? void 0 : s.coreJoinType) ?? "full",
5079
- entries: l2.map((c) => ({ type: "column", column: c }))
5597
+ type: (r == null ? void 0 : r.coreJoinType) ?? "full",
5598
+ entries: a.map((u) => ({ type: "column", column: u }))
5080
5599
  },
5081
- secondary: a.map((c) => ({ type: "column", column: c }))
5600
+ secondary: c.map((u) => ({ type: "column", column: u }))
5082
5601
  },
5083
- filters: [...(s == null ? void 0 : s.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []],
5084
- sorting: ((g2 = n == null ? void 0 : n.pTableParams) == null ? void 0 : g2.sorting) ?? []
5602
+ filters: [...(r == null ? void 0 : r.filters) ?? [], ...((l2 = n == null ? void 0 : n.pTableParams) == null ? void 0 : l2.filters) ?? []],
5603
+ sorting: ((m$1 = n == null ? void 0 : n.pTableParams) == null ? void 0 : m$1.sorting) ?? []
5085
5604
  });
5086
5605
  }
5087
5606
  function* range(from, to, step = 1) {
@@ -5103,7 +5622,7 @@
5103
5622
  tableNumRows: z$2.number().default(100),
5104
5623
  numbers: z$2.array(z$2.coerce.number())
5105
5624
  });
5106
- const platforma = w.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100 }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5625
+ const platforma = _.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100 }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5107
5626
  if (ctx.args.numbers.length === 5) {
5108
5627
  throw new Error("argsValid: test error");
5109
5628
  }
@@ -5121,7 +5640,7 @@
5121
5640
  val: v.toString()
5122
5641
  };
5123
5642
  });
5124
- return Dt(
5643
+ return Gt(
5125
5644
  ctx,
5126
5645
  [
5127
5646
  {