@milaboratories/milaboratories.ui-examples.model 1.1.30 → 1.1.32

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$1 = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
38
+ const g = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
39
39
  var util;
40
40
  (function(util2) {
41
41
  util2.assertEqual = (val) => val;
@@ -54,10 +54,10 @@
54
54
  return obj;
55
55
  };
56
56
  util2.getValidEnumValues = (obj) => {
57
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
57
+ const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
58
58
  const filtered = {};
59
- for (const k of validKeys) {
60
- filtered[k] = obj[k];
59
+ for (const k2 of validKeys) {
60
+ filtered[k2] = obj[k2];
61
61
  }
62
62
  return util2.objectValues(filtered);
63
63
  };
@@ -87,7 +87,7 @@
87
87
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
88
88
  }
89
89
  util2.joinValues = joinValues;
90
- util2.jsonStringifyReplacer = (_, value) => {
90
+ util2.jsonStringifyReplacer = (_2, value) => {
91
91
  if (typeof value === "bigint") {
92
92
  return value.toString();
93
93
  }
@@ -492,12 +492,12 @@
492
492
  const isDirty = (x2) => x2.status === "dirty";
493
493
  const isValid = (x2) => x2.status === "valid";
494
494
  const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
495
- function __classPrivateFieldGet(receiver, state, kind, f) {
496
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
495
+ function __classPrivateFieldGet(receiver, state, kind, f2) {
496
+ if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
497
497
  return state.get(receiver);
498
498
  }
499
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
500
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
499
+ function __classPrivateFieldSet(receiver, state, value, kind, f2) {
500
+ if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
501
501
  return state.set(receiver, value), value;
502
502
  }
503
503
  typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
@@ -3105,29 +3105,29 @@
3105
3105
  const params = { errorMap: ctx.common.contextualErrorMap };
3106
3106
  const fn = ctx.data;
3107
3107
  if (this._def.returns instanceof ZodPromise) {
3108
- const me2 = this;
3108
+ const me = this;
3109
3109
  return OK(async function(...args) {
3110
3110
  const error = new ZodError([]);
3111
- const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e) => {
3111
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3112
3112
  error.addIssue(makeArgsIssue(args, e));
3113
3113
  throw error;
3114
3114
  });
3115
3115
  const result = await Reflect.apply(fn, this, parsedArgs);
3116
- const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e) => {
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;
3119
3119
  });
3120
3120
  return parsedReturns;
3121
3121
  });
3122
3122
  } else {
3123
- const me2 = this;
3123
+ const me = this;
3124
3124
  return OK(function(...args) {
3125
- const parsedArgs = me2._def.args.safeParse(args, params);
3125
+ const parsedArgs = me._def.args.safeParse(args, params);
3126
3126
  if (!parsedArgs.success) {
3127
3127
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3128
3128
  }
3129
3129
  const result = Reflect.apply(fn, this, parsedArgs.data);
3130
- const parsedReturns = me2._def.returns.safeParse(result, params);
3130
+ const parsedReturns = me._def.returns.safeParse(result, params);
3131
3131
  if (!parsedReturns.success) {
3132
3132
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3133
3133
  }
@@ -3832,7 +3832,7 @@
3832
3832
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3833
3833
  };
3834
3834
  const NEVER = INVALID;
3835
- var z = /* @__PURE__ */ Object.freeze({
3835
+ var z$2 = /* @__PURE__ */ Object.freeze({
3836
3836
  __proto__: null,
3837
3837
  defaultErrorMap: errorMap,
3838
3838
  setErrorMap,
@@ -3948,33 +3948,112 @@
3948
3948
  quotelessJson,
3949
3949
  ZodError
3950
3950
  });
3951
- var V = Object.defineProperty;
3952
- var F = (n, t, e) => t in n ? V(n, t, { enumerable: true, configurable: true, writable: true, value: e }) : n[t] = e;
3953
- var m = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e);
3951
+ var $ = Object.defineProperty;
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
3954
  function w(n) {
3955
3955
  throw new Error("Unexpected object: " + n);
3956
3956
  }
3957
- function p(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 wn(n) {
3962
- return g$1(p(n));
4040
+ function Sn(n) {
4041
+ return g(m(n));
3963
4042
  }
3964
- function G$1(n, t) {
4043
+ function z$1(n, t) {
3965
4044
  if (n === void 0) return t === void 0;
3966
4045
  if (t === void 0) return true;
3967
4046
  for (const e in t)
3968
4047
  if (n[e] !== t[e]) return false;
3969
4048
  return true;
3970
4049
  }
3971
- function Q$1(n, t) {
3972
- return n.name === t.name && G$1(n.domain, t.domain);
4050
+ function G(n, t) {
4051
+ return n.name === t.name && z$1(n.domain, t.domain);
3973
4052
  }
3974
- function An(n, t) {
3975
- return { ...n, src: h(n.src, t) };
4053
+ function En(n, t) {
4054
+ return { ...n, src: l(n.src, t) };
3976
4055
  }
3977
- function h(n, t) {
4056
+ function l(n, t) {
3978
4057
  switch (n.type) {
3979
4058
  case "column":
3980
4059
  return {
@@ -3985,51 +4064,51 @@
3985
4064
  case "full":
3986
4065
  return {
3987
4066
  type: n.type,
3988
- entries: n.entries.map((e) => h(e, t))
4067
+ entries: n.entries.map((e) => l(e, t))
3989
4068
  };
3990
4069
  case "outer":
3991
4070
  return {
3992
4071
  type: "outer",
3993
- primary: h(n.primary, t),
3994
- secondary: n.secondary.map((e) => h(e, t))
4072
+ primary: l(n.primary, t),
4073
+ secondary: n.secondary.map((e) => l(e, t))
3995
4074
  };
3996
4075
  default:
3997
4076
  w(n);
3998
4077
  }
3999
4078
  }
4000
- function Y(n) {
4001
- return g$1(n);
4079
+ function Q$1(n) {
4080
+ return g(n);
4002
4081
  }
4003
- function x$1(n) {
4004
- return g$1(p(n));
4082
+ function P(n) {
4083
+ return g(m(n));
4005
4084
  }
4006
- function P$1(n, t) {
4085
+ function x(n, t) {
4007
4086
  return JSON.stringify([n, t]);
4008
4087
  }
4009
- class Pn {
4088
+ class On {
4010
4089
  /**
4011
4090
  * Creates a new anchor context from a set of anchor column specifications
4012
4091
  * @param anchors Record of anchor column specifications indexed by anchor ID
4013
4092
  */
4014
4093
  constructor(t) {
4015
- m(this, "domains", /* @__PURE__ */ new Map());
4016
- m(this, "axes", /* @__PURE__ */ new Map());
4017
- m(this, "domainPacks", []);
4018
- m(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());
4019
4098
  this.anchors = t;
4020
4099
  const e = Object.entries(t);
4021
4100
  e.sort((r, o) => r[0].localeCompare(o[0]));
4022
4101
  for (const [r, o] of e) {
4023
4102
  for (let i = 0; i < o.axesSpec.length; i++) {
4024
- const s = o.axesSpec[i], a = x$1(s);
4103
+ const s = o.axesSpec[i], a = P(s);
4025
4104
  this.axes.set(a, { anchor: r, idx: i });
4026
4105
  }
4027
4106
  if (o.domain !== void 0) {
4028
4107
  const i = Object.entries(o.domain);
4029
4108
  i.sort((s, a) => s[0].localeCompare(a[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([s]) => s));
4030
4109
  for (const [s, a] of i) {
4031
- const f = P$1(s, a);
4032
- this.domains.set(f, r);
4110
+ const c = x(s, a);
4111
+ this.domains.set(c, r);
4033
4112
  }
4034
4113
  }
4035
4114
  }
@@ -4054,35 +4133,35 @@
4054
4133
  else
4055
4134
  break n;
4056
4135
  }
4057
- const f = this.domainPackToAnchor.get(JSON.stringify(a));
4058
- if (f !== void 0) {
4059
- r.domainAnchor = f, o = new Set(s);
4136
+ const c = this.domainPackToAnchor.get(JSON.stringify(a));
4137
+ if (c !== void 0) {
4138
+ r.domainAnchor = c, o = new Set(s);
4060
4139
  break;
4061
4140
  }
4062
4141
  }
4063
4142
  for (const [s, a] of Object.entries(t.domain ?? {})) {
4064
4143
  if (o !== void 0 && o.has(s))
4065
4144
  continue;
4066
- const f = P$1(s, a), u = this.domains.get(f);
4145
+ const c = x(s, a), u = this.domains.get(c);
4067
4146
  r.domain ?? (r.domain = {}), r.domain[s] = u ? { anchor: u } : a;
4068
4147
  }
4069
4148
  if (r.axes = t.axesSpec.map((s) => {
4070
- const a = x$1(s);
4149
+ const a = P(s);
4071
4150
  return this.axes.get(a) ?? s;
4072
4151
  }), !e || e.length === 0)
4073
4152
  return r;
4074
4153
  const i = [];
4075
4154
  for (const s of e) {
4076
- const [a, f] = s;
4155
+ const [a, c] = s;
4077
4156
  if (typeof a == "number") {
4078
4157
  if (a < 0 || a >= t.axesSpec.length)
4079
4158
  throw new Error(`Axis index ${a} is out of bounds (0-${t.axesSpec.length - 1})`);
4080
- i.push([a, f]);
4159
+ i.push([a, c]);
4081
4160
  } else {
4082
4161
  const u = t.axesSpec.findIndex((d) => d.name === a);
4083
4162
  if (u === -1)
4084
4163
  throw new Error(`Axis with name "${a}" not found in the column specification`);
4085
- i.push([u, f]);
4164
+ i.push([u, c]);
4086
4165
  }
4087
4166
  }
4088
4167
  return i.sort((s, a) => s[0] - a[0]), {
@@ -4097,10 +4176,10 @@
4097
4176
  * @returns A canonicalized string representation of the anchored column identifier
4098
4177
  */
4099
4178
  deriveS(t, e) {
4100
- return Y(this.derive(t, e));
4179
+ return Q$1(this.derive(t, e));
4101
4180
  }
4102
4181
  }
4103
- function En(n, t) {
4182
+ function Jn(n, t) {
4104
4183
  const e = { ...t };
4105
4184
  if (e.domainAnchor !== void 0) {
4106
4185
  const r = n[e.domainAnchor];
@@ -4124,10 +4203,10 @@
4124
4203
  }
4125
4204
  e.domain = r;
4126
4205
  }
4127
- return e.axes && (e.axes = e.axes.map((r) => Z$1(n, r))), e;
4206
+ return e.axes && (e.axes = e.axes.map((r) => Y$1(n, r))), e;
4128
4207
  }
4129
- function Z$1(n, t) {
4130
- if (!q(t))
4208
+ function Y$1(n, t) {
4209
+ if (!Z$1(t))
4131
4210
  return t;
4132
4211
  const e = t.anchor, r = n[e];
4133
4212
  if (!r)
@@ -4144,7 +4223,7 @@
4144
4223
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4145
4224
  return o[0];
4146
4225
  } else if ("id" in t) {
4147
- const o = r.axesSpec.filter((i) => Q$1(t.id, p(i)));
4226
+ const o = r.axesSpec.filter((i) => G(t.id, m(i)));
4148
4227
  if (o.length > 1)
4149
4228
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4150
4229
  if (o.length === 0)
@@ -4153,26 +4232,26 @@
4153
4232
  }
4154
4233
  throw new Error("Unsupported axis reference type");
4155
4234
  }
4156
- function q(n) {
4235
+ function Z$1(n) {
4157
4236
  return typeof n == "object" && "anchor" in n;
4158
4237
  }
4159
- function c(n) {
4238
+ function f(n) {
4160
4239
  return n.kind === "PColumn";
4161
4240
  }
4162
- function v(n) {
4163
- return c(n.spec);
4241
+ function q$1(n) {
4242
+ return f(n.spec);
4164
4243
  }
4165
- function Sn(n) {
4166
- if (!v(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
4244
+ function Dn(n) {
4245
+ if (!q$1(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
4167
4246
  return n;
4168
4247
  }
4169
- function Cn(n, t) {
4248
+ function jn(n, t) {
4170
4249
  return n === void 0 ? void 0 : {
4171
4250
  ...n,
4172
4251
  data: t(n.data)
4173
4252
  };
4174
4253
  }
4175
- function $n(n) {
4254
+ function Bn(n) {
4176
4255
  const t = /* @__PURE__ */ new Map(), e = (r) => {
4177
4256
  switch (r.type) {
4178
4257
  case "column":
@@ -4192,7 +4271,7 @@
4192
4271
  };
4193
4272
  return e(n), [...t.values()];
4194
4273
  }
4195
- function E(n, t) {
4274
+ function k(n, t) {
4196
4275
  if (n.name !== void 0 && n.name !== t.name)
4197
4276
  return false;
4198
4277
  if (n.type !== void 0) {
@@ -4210,7 +4289,7 @@
4210
4289
  }
4211
4290
  return true;
4212
4291
  }
4213
- function I$1(n, t) {
4292
+ function N$1(n, t) {
4214
4293
  if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
4215
4294
  return false;
4216
4295
  if (t.type !== void 0) {
@@ -4227,16 +4306,16 @@
4227
4306
  return false;
4228
4307
  }
4229
4308
  if (t.axes !== void 0) {
4230
- const e = n.axesSpec.map(p);
4309
+ const e = n.axesSpec.map(m);
4231
4310
  if (t.partialAxesMatch) {
4232
4311
  for (const r of t.axes)
4233
- if (!e.some((o) => E(r, o)))
4312
+ if (!e.some((o) => k(r, o)))
4234
4313
  return false;
4235
4314
  } else {
4236
4315
  if (e.length !== t.axes.length)
4237
4316
  return false;
4238
4317
  for (let r = 0; r < t.axes.length; r++)
4239
- if (!E(t.axes[r], e[r]))
4318
+ if (!k(t.axes[r], e[r]))
4240
4319
  return false;
4241
4320
  }
4242
4321
  }
@@ -4256,65 +4335,65 @@
4256
4335
  }
4257
4336
  return true;
4258
4337
  }
4259
- function Vn(n) {
4260
- return Array.isArray(n) ? (t) => n.some((e) => c(t) && I$1(t, e)) : (t) => c(t) && I$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);
4261
4340
  }
4262
- z.object({
4263
- __isRef: z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4264
- blockId: z.string().describe("Upstream block id"),
4265
- name: z.string().describe("Name of the output provided to the upstream block's output context")
4341
+ z$2.object({
4342
+ __isRef: z$2.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4343
+ blockId: z$2.string().describe("Upstream block id"),
4344
+ name: z$2.string().describe("Name of the output provided to the upstream block's output context")
4266
4345
  }).describe(
4267
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."
4268
4347
  ).strict().readonly();
4269
- function On(n) {
4348
+ function Kn(n) {
4270
4349
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === true && "blockId" in n && "name" in n;
4271
4350
  }
4272
- function Bn(n, t) {
4351
+ function Mn(n, t) {
4273
4352
  return n.ok ? { ok: true, value: t(n.value) } : n;
4274
4353
  }
4275
4354
  const an = 24;
4276
- z.string().length(an).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4277
- var we = Object.defineProperty;
4278
- var Ie = (t, e, n) => e in t ? we(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4279
- var x = (t, e, n) => Ie(t, typeof e != "symbol" ? e + "" : e, n);
4280
- function W(t) {
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) {
4281
4360
  return { type: "Immediate", value: t };
4282
4361
  }
4283
- function ke() {
4362
+ function Ke() {
4284
4363
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4285
4364
  }
4286
- function me(t) {
4365
+ function be(t) {
4287
4366
  if (t && typeof globalThis.getPlatforma == "function")
4288
4367
  return globalThis.getPlatforma(t);
4289
4368
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4290
4369
  throw new Error("Can't get platforma instance.");
4291
4370
  }
4292
- function Ee() {
4371
+ function $e() {
4293
4372
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4294
4373
  }
4295
- function g() {
4374
+ function h() {
4296
4375
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4297
4376
  throw new Error("Not in config rendering context");
4298
4377
  }
4299
- function $(t, e) {
4300
- const n = Ee();
4378
+ function q(t, e) {
4379
+ const n = $e();
4301
4380
  if (n === void 0) return false;
4302
4381
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4303
4382
  return n.callbackRegistry[t] = e, true;
4304
4383
  }
4305
- const X = /* @__PURE__ */ new Map();
4306
- function Oe(t, e) {
4307
- t in g().callbackRegistry || (g().callbackRegistry[t] = (n) => {
4308
- for (const s of X.get(t))
4309
- s(n);
4310
- }, X.set(t, [])), X.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);
4311
4390
  }
4312
4391
  class S {
4313
- constructor(e, n = (s) => s) {
4314
- x(this, "isResolved", false);
4315
- x(this, "resolvedValue");
4316
- this.handle = e, this.postProcess = n, Oe(e, (s) => {
4317
- this.resolvedValue = n(s), this.isResolved = true;
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;
4318
4397
  });
4319
4398
  }
4320
4399
  map(e) {
@@ -4322,15 +4401,15 @@
4322
4401
  }
4323
4402
  mapDefined(e) {
4324
4403
  return new S(this.handle, (n) => {
4325
- const s = this.postProcess(n);
4326
- return s ? e(s) : void 0;
4404
+ const r = this.postProcess(n);
4405
+ return r ? e(r) : void 0;
4327
4406
  });
4328
4407
  }
4329
4408
  toJSON() {
4330
4409
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4331
4410
  }
4332
4411
  }
4333
- function se(t, e) {
4412
+ function ie(t, e) {
4334
4413
  return t === void 0 ? void 0 : e(t);
4335
4414
  }
4336
4415
  class I {
@@ -4339,27 +4418,27 @@
4339
4418
  }
4340
4419
  resolve(...e) {
4341
4420
  const n = e.map(
4342
- (s) => ({
4421
+ (r) => ({
4343
4422
  assertFieldType: "Input",
4344
- ...typeof s == "string" ? { field: s } : s
4423
+ ...typeof r == "string" ? { field: r } : r
4345
4424
  })
4346
4425
  );
4347
4426
  return this.resolveWithCommon({}, ...n);
4348
4427
  }
4349
4428
  resolveOutput(...e) {
4350
4429
  const n = e.map(
4351
- (s) => ({
4430
+ (r) => ({
4352
4431
  assertFieldType: "Output",
4353
- ...typeof s == "string" ? { field: s } : s
4432
+ ...typeof r == "string" ? { field: r } : r
4354
4433
  })
4355
4434
  );
4356
4435
  return this.resolveWithCommon({}, ...n);
4357
4436
  }
4358
4437
  resolveInput(...e) {
4359
4438
  const n = e.map(
4360
- (s) => ({
4439
+ (r) => ({
4361
4440
  assertFieldType: "Input",
4362
- ...typeof s == "string" ? { field: s } : s
4441
+ ...typeof r == "string" ? { field: r } : r
4363
4442
  })
4364
4443
  );
4365
4444
  return this.resolveWithCommon({}, ...n);
@@ -4368,51 +4447,51 @@
4368
4447
  return this.resolveWithCommon({}, ...e);
4369
4448
  }
4370
4449
  resolveWithCommon(e, ...n) {
4371
- const s = [
4450
+ const r = [
4372
4451
  ...this.resolvePath,
4373
4452
  ...n.map((i) => typeof i == "string" ? i : i.field)
4374
4453
  ];
4375
- return se(
4376
- g().resolveWithCommon(this.handle, e, ...n),
4377
- (i) => new I(i, s)
4454
+ return ie(
4455
+ h().resolveWithCommon(this.handle, e, ...n),
4456
+ (i) => new I(i, r)
4378
4457
  );
4379
4458
  }
4380
4459
  get resourceType() {
4381
- return g().getResourceType(this.handle);
4460
+ return h().getResourceType(this.handle);
4382
4461
  }
4383
4462
  getInputsLocked() {
4384
- return g().getInputsLocked(this.handle);
4463
+ return h().getInputsLocked(this.handle);
4385
4464
  }
4386
4465
  getOutputsLocked() {
4387
- return g().getOutputsLocked(this.handle);
4466
+ return h().getOutputsLocked(this.handle);
4388
4467
  }
4389
4468
  getIsReadyOrError() {
4390
- return g().getIsReadyOrError(this.handle);
4469
+ return h().getIsReadyOrError(this.handle);
4391
4470
  }
4392
4471
  getIsFinal() {
4393
- return g().getIsFinal(this.handle);
4472
+ return h().getIsFinal(this.handle);
4394
4473
  }
4395
4474
  getError() {
4396
4475
  const e = [...this.resolvePath, "error"];
4397
- return se(
4398
- g().getError(this.handle),
4476
+ return ie(
4477
+ h().getError(this.handle),
4399
4478
  (n) => new I(n, e)
4400
4479
  );
4401
4480
  }
4402
4481
  listInputFields() {
4403
- return g().listInputFields(this.handle);
4482
+ return h().listInputFields(this.handle);
4404
4483
  }
4405
4484
  listOutputFields() {
4406
- return g().listOutputFields(this.handle);
4485
+ return h().listOutputFields(this.handle);
4407
4486
  }
4408
4487
  listDynamicFields() {
4409
- return g().listDynamicFields(this.handle);
4488
+ return h().listDynamicFields(this.handle);
4410
4489
  }
4411
4490
  getKeyValueBase64(e) {
4412
- return g().getKeyValueBase64(this.handle, e);
4491
+ return h().getKeyValueBase64(this.handle, e);
4413
4492
  }
4414
4493
  getKeyValueAsString(e) {
4415
- return g().getKeyValueAsString(this.handle, e);
4494
+ return h().getKeyValueAsString(this.handle, e);
4416
4495
  }
4417
4496
  getKeyValueAsJson(e) {
4418
4497
  const n = this.getKeyValueAsString(e);
@@ -4420,10 +4499,10 @@
4420
4499
  return JSON.parse(n);
4421
4500
  }
4422
4501
  getDataBase64() {
4423
- return g().getDataBase64(this.handle);
4502
+ return h().getDataBase64(this.handle);
4424
4503
  }
4425
4504
  getDataAsString() {
4426
- return g().getDataAsString(this.handle);
4505
+ return h().getDataAsString(this.handle);
4427
4506
  }
4428
4507
  getDataAsJson() {
4429
4508
  const e = this.getDataAsString();
@@ -4434,39 +4513,39 @@
4434
4513
  *
4435
4514
  */
4436
4515
  getPColumns(e = false, n = "") {
4437
- const s = this.parsePObjectCollection(e, n);
4438
- return s === void 0 ? void 0 : Object.entries(s).map(([, r]) => {
4439
- if (!v(r)) throw new Error(`not a PColumn (kind = ${r.spec.kind})`);
4440
- return r;
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;
4441
4520
  });
4442
4521
  }
4443
4522
  /**
4444
4523
  *
4445
4524
  */
4446
4525
  parsePObjectCollection(e = false, n = "") {
4447
- const s = g().parsePObjectCollection(
4526
+ const r = h().parsePObjectCollection(
4448
4527
  this.handle,
4449
4528
  e,
4450
4529
  n,
4451
4530
  ...this.resolvePath
4452
4531
  );
4453
- if (s === void 0) return;
4532
+ if (r === void 0) return;
4454
4533
  const i = {};
4455
- for (const [r, o] of Object.entries(s)) {
4456
- const u = [...this.resolvePath, r];
4457
- i[r] = Cn(o, (c2) => new I(c2, u));
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));
4458
4537
  }
4459
4538
  return i;
4460
4539
  }
4461
4540
  getFileContentAsBase64() {
4462
- return new S(g().getBlobContentAsBase64(this.handle));
4541
+ return new S(h().getBlobContentAsBase64(this.handle));
4463
4542
  }
4464
4543
  getFileContentAsString() {
4465
- return new S(g().getBlobContentAsString(this.handle));
4544
+ return new S(h().getBlobContentAsString(this.handle));
4466
4545
  }
4467
4546
  getFileContentAsJson() {
4468
4547
  return new S(
4469
- g().getBlobContentAsString(this.handle)
4548
+ h().getBlobContentAsString(this.handle)
4470
4549
  ).mapDefined((e) => JSON.parse(e));
4471
4550
  }
4472
4551
  /**
@@ -4485,7 +4564,7 @@
4485
4564
  * @returns downloaded file handle
4486
4565
  */
4487
4566
  getFileHandle() {
4488
- return new S(g().getDownloadedBlobContentHandle(this.handle));
4567
+ return new S(h().getDownloadedBlobContentHandle(this.handle));
4489
4568
  }
4490
4569
  /**
4491
4570
  * @deprecated use getFileHandle
@@ -4497,7 +4576,7 @@
4497
4576
  * @returns downloaded file handle
4498
4577
  */
4499
4578
  getRemoteFileHandle() {
4500
- return new S(g().getOnDemandBlobContentHandle(this.handle));
4579
+ return new S(h().getOnDemandBlobContentHandle(this.handle));
4501
4580
  }
4502
4581
  /**
4503
4582
  * @deprecated use getRemoteFileHandle
@@ -4509,22 +4588,22 @@
4509
4588
  * @returns the url to the extracted folder
4510
4589
  */
4511
4590
  extractArchiveAndGetURL(e) {
4512
- return new S(g().extractArchiveAndGetURL(this.handle, e));
4591
+ return new S(h().extractArchiveAndGetURL(this.handle, e));
4513
4592
  }
4514
4593
  getImportProgress() {
4515
- return new S(g().getImportProgress(this.handle));
4594
+ return new S(h().getImportProgress(this.handle));
4516
4595
  }
4517
4596
  getLastLogs(e) {
4518
- return new S(g().getLastLogs(this.handle, e));
4597
+ return new S(h().getLastLogs(this.handle, e));
4519
4598
  }
4520
4599
  getProgressLog(e) {
4521
- return new S(g().getProgressLog(this.handle, e));
4600
+ return new S(h().getProgressLog(this.handle, e));
4522
4601
  }
4523
4602
  getProgressLogWithInfo(e) {
4524
- return new S(g().getProgressLogWithInfo(this.handle, e));
4603
+ return new S(h().getProgressLogWithInfo(this.handle, e));
4525
4604
  }
4526
4605
  getLogHandle() {
4527
- return new S(g().getLogHandle(this.handle));
4606
+ return new S(h().getLogHandle(this.handle));
4528
4607
  }
4529
4608
  allFieldsResolved(e = "Input") {
4530
4609
  switch (e) {
@@ -4539,178 +4618,340 @@
4539
4618
  }
4540
4619
  }
4541
4620
  mapFields(e, n) {
4542
- const { fieldType: s, requireLocked: i, skipUnresolved: r } = {
4621
+ const { fieldType: r, requireLocked: i, skipUnresolved: s } = {
4543
4622
  fieldType: "Input",
4544
4623
  requireLocked: true,
4545
4624
  skipUnresolved: false,
4546
4625
  ...n
4547
4626
  }, o = e;
4548
- if (i && (s === "Input" && !this.getInputsLocked() || s === "Output" && !this.getOutputsLocked()))
4627
+ if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4549
4628
  return;
4550
- let c2 = (s === "Input" ? this.listInputFields() : s === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4551
- (a) => [a, this.resolve({ field: a, 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 })]
4552
4631
  );
4553
- return r && (c2 = c2.filter((a) => a[1] !== void 0)), c2.map(([a, h2]) => o(a, h2));
4632
+ return s && (c = c.filter((l2) => l2[1] !== void 0)), c.map(([l2, m2]) => o(l2, m2));
4554
4633
  }
4555
4634
  }
4556
- const ye = "staging", be = "main";
4557
- const Ne = "pl7.app/label", Ue = "pl7.app/trace", Be = z.object({
4558
- type: z.string(),
4559
- importance: z.number().optional(),
4560
- id: z.string().optional(),
4561
- label: z.string()
4562
- }), Me = z.array(Be), Je = 1e-3, $e = "__LABEL__", ue = "__LABEL__@1";
4563
- function Q(t, e, n = {}) {
4564
- const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = t.map((l) => {
4565
- var F2, M;
4566
- const f = e(l);
4567
- let d, y, _;
4568
- "spec" in f && typeof f.spec == "object" ? (d = f.spec, y = f.prefixTrace, _ = f.suffixTrace) : d = f;
4569
- const A = (F2 = d.annotations) == null ? void 0 : F2[Ne], v2 = (M = d.annotations) == null ? void 0 : M[Ue], m2 = (v2 ? Me.safeParse(JSON.parse(v2)).data : void 0) ?? [], w2 = [
4635
+ const ve = "staging", we = "main";
4636
+ const Ue = "pl7.app/label", Me = "pl7.app/trace", Ge = z$2.object({
4637
+ type: z$2.string(),
4638
+ importance: z$2.number().optional(),
4639
+ id: z$2.string().optional(),
4640
+ label: z$2.string()
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 = [
4570
4649
  ...y ?? [],
4571
- ...m2,
4572
- ..._ ?? []
4650
+ ...x2,
4651
+ ...g2 ?? []
4573
4652
  ];
4574
- if (A) {
4575
- const C = { label: A, type: $e, importance: -2 };
4576
- n.addLabelAsSuffix ? w2.push(C) : w2.splice(0, 0, C);
4577
- }
4578
- const L = [], R = /* @__PURE__ */ new Map();
4579
- for (let C = w2.length - 1; C >= 0; --C) {
4580
- const { type: D } = w2[C], q2 = w2[C].importance ?? 0, z2 = (R.get(D) ?? 0) + 1;
4581
- R.set(D, z2);
4582
- const O = `${D}@${z2}`;
4583
- i.set(O, (i.get(O) ?? 0) + 1), s.set(
4584
- O,
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,
4585
4664
  Math.max(
4586
- s.get(O) ?? Number.NEGATIVE_INFINITY,
4587
- q2 - (w2.length - C) * Je
4665
+ r.get($2) ?? Number.NEGATIVE_INFINITY,
4666
+ V - (C.length - A) * He
4588
4667
  )
4589
- ), L.push({ ...w2[C], fullType: O, occurenceIndex: z2 });
4668
+ ), P2.push({ ...C[A], fullType: $2, occurenceIndex: K });
4590
4669
  }
4591
- return L.reverse(), {
4592
- value: l,
4670
+ return P2.reverse(), {
4671
+ value: f2,
4593
4672
  spec: d,
4594
- label: A,
4595
- fullTrace: L
4673
+ label: v,
4674
+ fullTrace: P2
4596
4675
  };
4597
- }), o = [], u = [], c2 = [...s];
4598
- c2.sort(([, l], [, f]) => f - l);
4599
- for (const [l] of c2)
4600
- l.endsWith("@1") || i.get(l) === t.length ? o.push(l) : u.push(l);
4601
- const a = (l) => r.map((f) => {
4602
- const d = f.fullTrace.filter((_) => l.has(_.fullType)).map((_) => _.label), y = 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 ?? " / ";
4603
4682
  return {
4604
4683
  label: d.join(y),
4605
- value: f.value
4684
+ value: p2.value
4606
4685
  };
4607
4686
  });
4608
4687
  if (o.length === 0) {
4609
- if (u.length !== 0) throw new Error("Assertion error.");
4610
- return a(new Set(ue));
4611
- }
4612
- let h2 = 0, p2 = 0;
4613
- for (; h2 < o.length; ) {
4614
- const l = /* @__PURE__ */ new Set();
4615
- n.includeNativeLabel && l.add(ue);
4616
- for (let d = 0; d < h2; ++d) l.add(o[d]);
4617
- l.add(o[p2]);
4618
- const f = a(l);
4619
- if (new Set(f.map((d) => d.label)).size === t.length) return f;
4620
- p2++, p2 == o.length && (h2++, p2 = h2);
4621
- }
4622
- return a(/* @__PURE__ */ new Set([...o, ...u]));
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]));
4623
4702
  }
4624
- const B = "PColumnData/", re = B + "ResourceMap", oe = B + "Partitioned/ResourceMap", ce = B + "JsonPartitioned", Z = B + "BinaryPartitioned", _e = B + "Partitioned/", pe = _e + "JsonPartitioned", ee = _e + "BinaryPartitioned";
4625
- const de = (t) => {
4626
- if (!t.endsWith(".index")) {
4627
- if (t.endsWith(".values"))
4628
- return t.substring(0, t.length - 7);
4629
- throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4630
- }
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}`);
4631
4710
  };
4632
- function Ge(t) {
4711
+ function ze(t) {
4633
4712
  if (!t) return;
4634
- const e = t.resourceType.name, n = t.getDataAsJson(), s = [];
4713
+ const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
4635
4714
  let i = 0;
4636
4715
  switch (e) {
4637
- case re:
4716
+ case Q:
4638
4717
  i = n.keyLength;
4639
4718
  break;
4640
- case oe:
4719
+ case Z:
4641
4720
  i = n.partitionKeyLength + n.keyLength;
4642
4721
  break;
4643
- case ce:
4644
- case Z:
4722
+ case N:
4723
+ case O:
4645
4724
  i = n.partitionKeyLength;
4646
4725
  break;
4726
+ case B:
4647
4727
  case ee:
4648
- case pe:
4649
4728
  i = n.superPartitionKeyLength + n.partitionKeyLength;
4650
4729
  break;
4651
4730
  }
4652
4731
  switch (e) {
4653
- case re:
4654
- case ce:
4655
- case Z:
4656
- for (let r of t.listInputFields()) {
4657
- if (e === Z) {
4658
- const u = de(r);
4659
- if (u) r = u;
4660
- else continue;
4661
- }
4662
- const o = [...JSON.parse(r)];
4663
- s.push(o);
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);
4664
4739
  }
4665
4740
  break;
4666
- case oe:
4741
+ case Z:
4742
+ case B:
4667
4743
  case ee:
4668
- case pe:
4669
- for (const r of t.listInputFields()) {
4670
- const o = [...JSON.parse(r)], u = t.resolve({ field: r, assertFieldType: "Input" });
4671
- if (u !== void 0)
4672
- for (let c2 of u.listInputFields()) {
4673
- if (e === ee) {
4674
- const h2 = de(c2);
4675
- if (h2) c2 = h2;
4676
- else continue;
4677
- }
4678
- const a = [...o, ...JSON.parse(c2)];
4679
- s.push(a);
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);
4680
4751
  }
4681
4752
  }
4682
4753
  break;
4683
4754
  }
4684
- return { data: s, keyLength: i };
4755
+ return { data: r, keyLength: i };
4685
4756
  }
4686
- function We(t) {
4687
- const e = Ge(t);
4757
+ function Ye(t) {
4758
+ const e = ze(t);
4688
4759
  if (!e) return;
4689
- const { data: n, keyLength: s } = e, i = [];
4690
- for (let r = 0; r < s; ++r)
4760
+ const { data: n, keyLength: r } = e, i = [];
4761
+ for (let s = 0; s < r; ++s)
4691
4762
  i.push(/* @__PURE__ */ new Set());
4692
- for (const r of n) {
4693
- if (r.length !== s)
4763
+ for (const s of n) {
4764
+ if (s.length !== r)
4694
4765
  throw new Error("key length does not match partition length");
4695
- for (let o = 0; o < s; ++o)
4696
- i[o].add(r[o]);
4766
+ for (let o = 0; o < r; ++o)
4767
+ i[o].add(s[o]);
4697
4768
  }
4698
- return i.map((r) => Array.from(r.values()));
4769
+ return i.map((s) => Array.from(s.values()));
4699
4770
  }
4700
- function te(t, e) {
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) {
4701
4930
  if (t === void 0) return e === void 0;
4702
4931
  if (e === void 0) return true;
4703
4932
  for (const n in e)
4704
4933
  if (t[n] !== e[n]) return false;
4705
4934
  return true;
4706
4935
  }
4707
- class Ke {
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 {
4708
4953
  constructor() {
4709
- x(this, "ctx", g());
4710
- x(this, "defaultLabelFn", (e, n) => {
4711
- var s;
4712
- return ((s = e.annotations) == null ? void 0 : s["pl7.app/label"]) ?? "Unlabelled";
4713
- });
4954
+ T(this, "ctx", h());
4714
4955
  }
4715
4956
  /**
4716
4957
  * @deprecated use getOptions()
@@ -4719,87 +4960,199 @@
4719
4960
  return this.ctx.calculateOptions(e);
4720
4961
  }
4721
4962
  getOptions(e, n) {
4722
- const s = typeof e == "function" ? e : Vn(e), i = this.getSpecs().entries.filter((r) => s(r.obj));
4723
- return typeof n == "object" || typeof n > "u" ? Q(i, (r) => r.obj, n ?? {}).map(({ value: { ref: r }, label: o }) => ({
4724
- ref: r,
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,
4725
4966
  label: o
4726
- })) : i.map((r) => ({
4727
- ref: r.ref,
4728
- label: n(r.obj, r.ref)
4967
+ })) : i.map((s) => ({
4968
+ ref: s.ref,
4969
+ label: n(s.obj, s.ref)
4729
4970
  }));
4730
4971
  }
4731
- // Implementation
4732
- getCanonicalOptions(e, n, s) {
4972
+ /**
4973
+ * Internal implementation that generates UniversalPColumnEntry objects from the provided
4974
+ * anchors and selectors.
4975
+ */
4976
+ getUniversalPColumnEntries(e, n, r) {
4733
4977
  const i = {};
4734
- if (!(e instanceof Pn))
4735
- for (const [a, h2] of Object.entries(e))
4736
- if (On(h2)) {
4737
- const p2 = this.getPColumnSpecByRef(h2);
4738
- if (!p2)
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)
4739
4983
  return;
4740
- i[a] = p2;
4984
+ i[l2] = u;
4741
4985
  } else
4742
- i[a] = h2;
4743
- const r = typeof n == "function" ? n : Vn(
4744
- Array.isArray(n) ? n.map((a) => En(i, a)) : En(i, n)
4745
- ), o = this.getSpecs().entries.filter(({ obj: a }) => c(a) ? r(a) : false);
4746
- if (o.length === 0)
4747
- return [];
4748
- const u = e instanceof Pn ? e : new Pn(i), c$1 = typeof n == "object" && !Array.isArray(n) && "axes" in n && n.axes !== void 0 && n.partialAxesMatch === void 0 ? n.axes.map((a, h2) => "split" in a && a.split === true ? h2 : -1).filter((a) => a !== -1) : [];
4749
- if (c$1.sort((a, h2) => a - h2), c$1.length > 0) {
4750
- const a = [], h2 = c$1[c$1.length - 1];
4751
- for (const { ref: l, obj: f } of o) {
4752
- if (!c(f)) continue;
4753
- const d = this.getDataByRef(l);
4754
- if (!d || !v(d)) continue;
4755
- const y = We(d.data);
4756
- if (!y) continue;
4757
- if (h2 >= y.length)
4758
- throw new Error(`Not enough partition keys for the requested split axes in column ${f.name}`);
4759
- const _ = c$1.map((m2) => this.findLabels(p(f.axesSpec[m2]))), A = [], v$1 = (m2, w2) => {
4760
- if (w2 >= c$1.length) {
4761
- A.push([...m2]);
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;
4762
5000
  return;
4763
5001
  }
4764
- const L = c$1[w2], R = y[L];
4765
- for (const F2 of R)
4766
- m2.push(F2), v$1(m2, w2 + 1), m2.pop();
4767
- };
4768
- v$1([], 0);
4769
- for (const m2 of A) {
4770
- const w2 = m2.map((R, F2) => {
4771
- const M = c$1[F2], C = wn(p(f.axesSpec[M])), D = _[F2], q2 = (D == null ? void 0 : D[R]) ?? String(R);
4772
- return {
4773
- type: `split:${C}`,
4774
- label: q2,
4775
- importance: 1e6
4776
- };
4777
- }), L = c$1.map((R, F2) => [R, m2[F2]]);
4778
- a.push({
4779
- obj: f,
4780
- ref: l,
4781
- filteringTrace: w2,
4782
- filters: L
4783
- });
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
+ }
4784
5031
  }
4785
- }
4786
- return Q(
4787
- a,
4788
- (l) => ({
4789
- spec: l.obj,
4790
- suffixTrace: l.filteringTrace
4791
- }),
4792
- s ?? {}
4793
- ).map((l) => ({
4794
- value: u.deriveS(l.value.obj, l.value.filters),
4795
- label: l.label
4796
- }));
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
+ });
4797
5039
  }
4798
- return Q(o, (a) => a.obj, s ?? {}).map(({ value: { obj: a }, label: h2 }) => ({
4799
- value: u.deriveS(a),
4800
- label: h2
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
4801
5058
  }));
4802
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
+ }
4803
5156
  /**
4804
5157
  * @deprecated use getData()
4805
5158
  */
@@ -4833,9 +5186,9 @@
4833
5186
  ref: n.ref,
4834
5187
  obj: {
4835
5188
  ...n.obj,
4836
- data: Bn(
5189
+ data: Mn(
4837
5190
  n.obj.data,
4838
- (s) => new I(s, [n.ref.blockId, n.ref.name])
5191
+ (r) => new I(r, [n.ref.blockId, n.ref.name])
4839
5192
  )
4840
5193
  }
4841
5194
  }))
@@ -4855,13 +5208,17 @@
4855
5208
  * @returns data associated with the ref
4856
5209
  */
4857
5210
  getDataByRef(e) {
4858
- var n;
4859
- return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4860
- (s) => s.ref.blockId === e.blockId && s.ref.name === e.name
4861
- )) == null ? void 0 : n.obj : Cn(
4862
- this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
4863
- (s) => new I(s, [e.blockId, e.name])
4864
- );
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
+ );
4865
5222
  }
4866
5223
  /**
4867
5224
  * Returns data associated with the ref ensuring that it is a p-column.
@@ -4871,7 +5228,7 @@
4871
5228
  getPColumnByRef(e) {
4872
5229
  const n = this.getDataByRef(e);
4873
5230
  if (n)
4874
- return Sn(n);
5231
+ return Dn(n);
4875
5232
  }
4876
5233
  /**
4877
5234
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -4881,7 +5238,7 @@
4881
5238
  getPColumnSpecByRef(e) {
4882
5239
  const n = this.getSpecByRef(e);
4883
5240
  if (n) {
4884
- if (!c(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})`);
4885
5242
  return n;
4886
5243
  }
4887
5244
  }
@@ -4899,17 +5256,17 @@
4899
5256
  */
4900
5257
  findDataWithCompatibleSpec(e) {
4901
5258
  const n = [];
4902
- e: for (const s of this.getData().entries) {
4903
- if (!c(s.obj.spec))
5259
+ e: for (const r of this.getData().entries) {
5260
+ if (!f(r.obj.spec))
4904
5261
  continue;
4905
- const i = s.obj.spec;
4906
- if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && te(e.domain, i.domain)) {
4907
- for (let r = 0; r < e.axesSpec.length; ++r) {
4908
- const o = e.axesSpec[r], u = i.axesSpec[r];
4909
- if (o.name !== u.name || o.type !== u.type || !te(o.domain, u.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))
4910
5267
  continue e;
4911
5268
  }
4912
- n.push(s.obj);
5269
+ n.push(r.obj);
4913
5270
  }
4914
5271
  }
4915
5272
  return n;
@@ -4920,29 +5277,29 @@
4920
5277
  */
4921
5278
  findLabels(e) {
4922
5279
  const n = this.getData();
4923
- for (const s of n.entries) {
4924
- if (!v(s.obj)) continue;
4925
- const i = s.obj.spec;
4926
- if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && te(e.domain, i.axesSpec[0].domain)) {
4927
- if (s.obj.data.resourceType.name !== "PColumnData/Json")
4928
- throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);
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}`);
4929
5286
  return Object.fromEntries(
4930
5287
  Object.entries(
4931
- s.obj.data.getDataAsJson().data
5288
+ r.obj.data.getDataAsJson().data
4932
5289
  ).map((o) => [JSON.parse(o[0])[0], o[1]])
4933
5290
  );
4934
5291
  }
4935
5292
  }
4936
5293
  }
4937
5294
  }
4938
- class G {
5295
+ class z {
4939
5296
  constructor() {
4940
- x(this, "ctx");
4941
- x(this, "args");
4942
- x(this, "uiState");
4943
- x(this, "_activeArgsCache");
4944
- x(this, "resultPool", new Ke());
4945
- this.ctx = g(), 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) : {};
4946
5303
  }
4947
5304
  /**
4948
5305
  * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
@@ -4958,16 +5315,16 @@
4958
5315
  // return this.ctx.featureFlags;
4959
5316
  // }
4960
5317
  getNamedAccessor(e) {
4961
- return se(
5318
+ return ie(
4962
5319
  this.ctx.getAccessorHandleByName(e),
4963
5320
  (n) => new I(n, [e])
4964
5321
  );
4965
5322
  }
4966
5323
  get prerun() {
4967
- return this.getNamedAccessor(ye);
5324
+ return this.getNamedAccessor(ve);
4968
5325
  }
4969
5326
  get outputs() {
4970
- return this.getNamedAccessor(be);
5327
+ return this.getNamedAccessor(we);
4971
5328
  }
4972
5329
  /**
4973
5330
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -4977,14 +5334,14 @@
4977
5334
  findLabels(e) {
4978
5335
  return this.resultPool.findLabels(e);
4979
5336
  }
4980
- verifyInlineColumnsSupport(e) {
5337
+ verifyInlineAndExplicitColumnsSupport(e) {
4981
5338
  var i;
4982
- const n = e.some((r) => !(r.data instanceof I)), s = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
4983
- if (n && !s) throw Error("inline columns not supported");
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");
4984
5341
  }
4985
5342
  createPFrame(e) {
4986
- return this.verifyInlineColumnsSupport(e), this.ctx.createPFrame(
4987
- e.map((n) => Cn(n, (s) => s instanceof I ? s.handle : s))
5343
+ return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5344
+ e.map((n) => fe(n))
4988
5345
  );
4989
5346
  }
4990
5347
  createPTable(e) {
@@ -4992,15 +5349,12 @@
4992
5349
  return "columns" in e ? n = {
4993
5350
  src: {
4994
5351
  type: "full",
4995
- entries: e.columns.map((s) => ({ type: "column", column: s }))
5352
+ entries: e.columns.map((r) => ({ type: "column", column: r }))
4996
5353
  },
4997
5354
  filters: e.filters ?? [],
4998
5355
  sorting: e.sorting ?? []
4999
- } : n = e, this.verifyInlineColumnsSupport($n(n.src)), this.ctx.createPTable(
5000
- An(
5001
- n,
5002
- (s) => Cn(s, (i) => i instanceof I ? i.handle : i)
5003
- )
5356
+ } : n = e, this.verifyInlineAndExplicitColumnsSupport(Bn(n.src)), this.ctx.createPTable(
5357
+ En(n, (r) => fe(r))
5004
5358
  );
5005
5359
  }
5006
5360
  /** @deprecated scheduled for removal from SDK */
@@ -5012,33 +5366,33 @@
5012
5366
  return this.ctx.getCurrentUnstableMarker();
5013
5367
  }
5014
5368
  }
5015
- const j = "1.25.0";
5016
- function He(t) {
5369
+ const U = "1.26.0";
5370
+ function tt(t) {
5017
5371
  return t.__renderLambda === true;
5018
5372
  }
5019
- function ne(t) {
5373
+ function se(t) {
5020
5374
  if (t !== void 0)
5021
- return He(t) ? t.handle : t;
5375
+ return tt(t) ? t.handle : t;
5022
5376
  }
5023
- class P {
5024
- constructor(e, n, s, i, r, o, u) {
5025
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = s, this._outputs = i, this._inputsValid = r, this._sections = o, this._title = u;
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;
5026
5380
  }
5027
5381
  static create(e = "Heavy") {
5028
- return new P(
5382
+ return new _(
5029
5383
  e,
5030
5384
  void 0,
5031
5385
  {},
5032
5386
  {},
5033
- W(true),
5034
- W([]),
5387
+ Y(true),
5388
+ Y([]),
5035
5389
  void 0
5036
5390
  );
5037
5391
  }
5038
- output(e, n, s = {}) {
5392
+ output(e, n, r = {}) {
5039
5393
  if (typeof n == "function") {
5040
5394
  const i = `output#${e}`;
5041
- return $(i, () => n(new G())), new P(
5395
+ return q(i, () => n(new z())), new _(
5042
5396
  this._renderingMode,
5043
5397
  this._initialArgs,
5044
5398
  this._initialUiState,
@@ -5047,7 +5401,7 @@
5047
5401
  [e]: {
5048
5402
  __renderLambda: true,
5049
5403
  handle: i,
5050
- ...s
5404
+ ...r
5051
5405
  }
5052
5406
  },
5053
5407
  this._inputsValid,
@@ -5055,7 +5409,7 @@
5055
5409
  this._title
5056
5410
  );
5057
5411
  } else
5058
- return new P(
5412
+ return new _(
5059
5413
  this._renderingMode,
5060
5414
  this._initialArgs,
5061
5415
  this._initialUiState,
@@ -5073,7 +5427,7 @@
5073
5427
  return this.output(e, n, { retentive: true });
5074
5428
  }
5075
5429
  argsValid(e) {
5076
- return typeof e == "function" ? ($("inputsValid", () => e(new G())), new P(
5430
+ return typeof e == "function" ? (q("inputsValid", () => e(new z())), new _(
5077
5431
  this._renderingMode,
5078
5432
  this._initialArgs,
5079
5433
  this._initialUiState,
@@ -5084,7 +5438,7 @@
5084
5438
  },
5085
5439
  this._sections,
5086
5440
  this._title
5087
- )) : new P(
5441
+ )) : new _(
5088
5442
  this._renderingMode,
5089
5443
  this._initialArgs,
5090
5444
  this._initialUiState,
@@ -5095,7 +5449,7 @@
5095
5449
  );
5096
5450
  }
5097
5451
  sections(e) {
5098
- return Array.isArray(e) ? this.sections(W(e)) : typeof e == "function" ? ($("sections", () => e(new G())), new P(
5452
+ return Array.isArray(e) ? this.sections(Y(e)) : typeof e == "function" ? (q("sections", () => e(new z())), new _(
5099
5453
  this._renderingMode,
5100
5454
  this._initialArgs,
5101
5455
  this._initialUiState,
@@ -5103,7 +5457,7 @@
5103
5457
  this._inputsValid,
5104
5458
  { __renderLambda: true, handle: "sections" },
5105
5459
  this._title
5106
- )) : new P(
5460
+ )) : new _(
5107
5461
  this._renderingMode,
5108
5462
  this._initialArgs,
5109
5463
  this._initialUiState,
@@ -5115,7 +5469,7 @@
5115
5469
  }
5116
5470
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
5117
5471
  title(e) {
5118
- return $("title", () => e(new G())), new P(
5472
+ return q("title", () => e(new z())), new _(
5119
5473
  this._renderingMode,
5120
5474
  this._initialArgs,
5121
5475
  this._initialUiState,
@@ -5130,7 +5484,7 @@
5130
5484
  * @deprecated use {@link withArgs}
5131
5485
  * */
5132
5486
  initialArgs(e) {
5133
- return new P(
5487
+ return new _(
5134
5488
  this._renderingMode,
5135
5489
  e,
5136
5490
  this._initialUiState,
@@ -5142,7 +5496,7 @@
5142
5496
  }
5143
5497
  /** Sets initial args for the block, this value must be specified. */
5144
5498
  withArgs(e) {
5145
- return new P(
5499
+ return new _(
5146
5500
  this._renderingMode,
5147
5501
  e,
5148
5502
  this._initialUiState,
@@ -5154,7 +5508,7 @@
5154
5508
  }
5155
5509
  /** Defines type and sets initial value for block UiState. */
5156
5510
  withUiState(e) {
5157
- return new P(
5511
+ return new _(
5158
5512
  this._renderingMode,
5159
5513
  this._initialArgs,
5160
5514
  e,
@@ -5171,7 +5525,7 @@
5171
5525
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
5172
5526
  const e = {
5173
5527
  v3: {
5174
- sdkVersion: j,
5528
+ sdkVersion: U,
5175
5529
  renderingMode: this._renderingMode,
5176
5530
  initialArgs: this._initialArgs,
5177
5531
  initialUiState: this._initialUiState,
@@ -5181,74 +5535,77 @@
5181
5535
  outputs: this._outputs
5182
5536
  },
5183
5537
  // fields below are added to allow previous desktop versions read generated configs
5184
- sdkVersion: j,
5538
+ sdkVersion: U,
5185
5539
  renderingMode: this._renderingMode,
5186
5540
  initialArgs: this._initialArgs,
5187
- inputsValid: ne(this._inputsValid),
5188
- sections: ne(this._sections),
5541
+ inputsValid: se(this._inputsValid),
5542
+ sections: se(this._sections),
5189
5543
  outputs: Object.fromEntries(
5190
- Object.entries(this._outputs).map(([n, s]) => [n, ne(s)])
5544
+ Object.entries(this._outputs).map(([n, r]) => [n, se(r)])
5191
5545
  )
5192
5546
  };
5193
- return ke() ? me({ sdkVersion: j }) : { config: e };
5547
+ return Ke() ? be({ sdkVersion: U }) : { config: e };
5194
5548
  }
5195
5549
  }
5196
- function Vt(t, e, n, s) {
5197
- var a, h2;
5198
- Array.isArray(s) && (s = { filters: s });
5199
- const i = t.resultPool.getData().entries.map((p2) => p2.obj).filter(v).filter((p2) => p2.spec.name === "pl7.app/label" && p2.spec.axesSpec.length === 1), r = (p2, l) => {
5200
- let f = p2.toString();
5201
- if (l)
5202
- for (const d in l)
5203
- f += d, f += l[d];
5204
- return f;
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;
5205
5559
  }, o = /* @__PURE__ */ new Map();
5206
- for (const p$1 of e)
5207
- for (const l of p$1.spec.axesSpec) {
5208
- const f = p(l);
5560
+ for (const u of e)
5561
+ for (const f2 of u.spec.axesSpec) {
5562
+ const p2 = m(f2);
5209
5563
  for (const d of i) {
5210
- const y = d.spec.axesSpec[0], _ = p(d.spec.axesSpec[0]);
5211
- if (Q$1(f, _)) {
5212
- const A = Object.keys(f.domain ?? {}).length, v2 = Object.keys(_.domain ?? {}).length;
5213
- if (A > v2) {
5214
- const m2 = r(d.id, f.domain);
5215
- o.set(m2, {
5216
- id: m2,
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,
5217
5571
  spec: {
5218
5572
  ...d.spec,
5219
- axesSpec: [{ ...f, annotations: y.annotations }]
5573
+ axesSpec: [{ ...p2, annotations: y.annotations }]
5220
5574
  },
5221
5575
  data: d.data
5222
5576
  });
5223
5577
  } else
5224
- o.set(r(d.id), d);
5578
+ o.set(s(d.id), d);
5225
5579
  }
5226
5580
  }
5227
5581
  }
5228
5582
  if ([...e, ...o.values()].some(
5229
- (p2) => p2.data instanceof I && !p2.data.getIsReadyOrError()
5583
+ (u) => u.data instanceof I && !u.data.getIsReadyOrError()
5230
5584
  ))
5231
5585
  return;
5232
- let u = e;
5233
- const c2 = [];
5234
- if (s != null && s.coreColumnPredicate) {
5235
- u = [];
5236
- for (const p2 of e)
5237
- s.coreColumnPredicate(p2.spec) ? u.push(p2) : c2.push(p2);
5238
- }
5239
- return c2.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({
5240
5594
  src: {
5241
5595
  type: "outer",
5242
5596
  primary: {
5243
- type: (s == null ? void 0 : s.coreJoinType) ?? "full",
5244
- entries: u.map((p2) => ({ type: "column", column: p2 }))
5597
+ type: (r == null ? void 0 : r.coreJoinType) ?? "full",
5598
+ entries: a.map((u) => ({ type: "column", column: u }))
5245
5599
  },
5246
- secondary: c2.map((p2) => ({ type: "column", column: p2 }))
5600
+ secondary: c.map((u) => ({ type: "column", column: u }))
5247
5601
  },
5248
- filters: [...(s == null ? void 0 : s.filters) ?? [], ...((a = n == null ? void 0 : n.pTableParams) == null ? void 0 : a.filters) ?? []],
5249
- sorting: ((h2 = n == null ? void 0 : n.pTableParams) == null ? void 0 : h2.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) ?? []
5250
5604
  });
5251
5605
  }
5606
+ const ImportFileHandleSchema = z$2.string().optional().refine(
5607
+ (_a) => true
5608
+ );
5252
5609
  function* range(from, to, step = 1) {
5253
5610
  for (let i = from; i < to; i += step) {
5254
5611
  yield i;
@@ -5264,11 +5621,12 @@
5264
5621
  function times(n, cb) {
5265
5622
  return toList(range(0, n)).map(cb);
5266
5623
  }
5267
- const $BlockArgs = z.object({
5268
- tableNumRows: z.number().default(100),
5269
- numbers: z.array(z.coerce.number())
5624
+ const $BlockArgs = z$2.object({
5625
+ tableNumRows: z$2.number().default(100),
5626
+ numbers: z$2.array(z$2.coerce.number()),
5627
+ handles: z$2.array(ImportFileHandleSchema)
5270
5628
  });
5271
- const platforma = P.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100 }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5629
+ const platforma = _.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5272
5630
  if (ctx.args.numbers.length === 5) {
5273
5631
  throw new Error("argsValid: test error");
5274
5632
  }
@@ -5276,17 +5634,22 @@
5276
5634
  }).output("numbers", (ctx) => {
5277
5635
  var _a, _b;
5278
5636
  return (_b = (_a = ctx.outputs) == null ? void 0 : _a.resolve("numbers")) == null ? void 0 : _b.getDataAsJson();
5637
+ }).output("progresses", (ctx) => {
5638
+ var _a;
5639
+ const m2 = (_a = ctx.outputs) == null ? void 0 : _a.resolve("progresses");
5640
+ const progresses = m2 == null ? void 0 : m2.mapFields((name, val) => [name, val == null ? void 0 : val.getImportProgress()]);
5641
+ return Object.fromEntries(progresses ?? []);
5279
5642
  }).output("pt", (ctx) => {
5280
5643
  var _a, _b, _c, _d, _e2;
5281
5644
  if (!((_c = (_b = (_a = ctx.uiState) == null ? void 0 : _a.dataTableState) == null ? void 0 : _b.tableState.pTableParams) == null ? void 0 : _c.filters)) return void 0;
5282
5645
  const data = times(ctx.args.tableNumRows ?? 0, (i) => {
5283
- const v2 = i + 1;
5646
+ const v = i + 1;
5284
5647
  return {
5285
- key: [v2, v2 + 0.1],
5286
- val: v2.toString()
5648
+ key: [v, v + 0.1],
5649
+ val: v.toString()
5287
5650
  };
5288
5651
  });
5289
- return Vt(
5652
+ return Gt(
5290
5653
  ctx,
5291
5654
  [
5292
5655
  {
@@ -5355,6 +5718,7 @@
5355
5718
  { type: "link", href: "/use-watch-fetch", label: "useWatchFetch" },
5356
5719
  { type: "link", href: "/typography", label: "Typography" },
5357
5720
  { type: "link", href: "/ag-grid-vue", label: "AgGridVue" },
5721
+ { type: "link", href: "/ag-grid-vue-with-builder", label: "AgGridVue with builder" },
5358
5722
  { type: "link", href: "/pl-ag-data-table", label: "PlAgDataTable" },
5359
5723
  { type: "link", href: "/pl-splash-page", label: "PlSplashPage" },
5360
5724
  { type: "link", href: "/errors", label: "Errors" },
@@ -5379,6 +5743,7 @@
5379
5743
  ];
5380
5744
  }).done();
5381
5745
  exports2.$BlockArgs = $BlockArgs;
5746
+ exports2.ImportFileHandleSchema = ImportFileHandleSchema;
5382
5747
  exports2.platforma = platforma;
5383
5748
  exports2.range = range;
5384
5749
  exports2.times = times;