@milaboratories/milaboratories.monetization-test.model 1.0.3 → 1.0.5

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
@@ -2,6 +2,40 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.model = {}));
3
3
  })(this, function(exports2) {
4
4
  "use strict";
5
+ function getDefaultExportFromCjs(x2) {
6
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
7
+ }
8
+ var canonicalize = function serialize(object) {
9
+ if (typeof object === "number" && isNaN(object)) {
10
+ throw new Error("NaN is not allowed");
11
+ }
12
+ if (typeof object === "number" && !isFinite(object)) {
13
+ throw new Error("Infinity is not allowed");
14
+ }
15
+ if (object === null || typeof object !== "object") {
16
+ return JSON.stringify(object);
17
+ }
18
+ if (object.toJSON instanceof Function) {
19
+ return serialize(object.toJSON());
20
+ }
21
+ if (Array.isArray(object)) {
22
+ const values2 = object.reduce((t, cv, ci) => {
23
+ const comma = ci === 0 ? "" : ",";
24
+ const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
25
+ return `${t}${comma}${serialize(value)}`;
26
+ }, "");
27
+ return `[${values2}]`;
28
+ }
29
+ const values = Object.keys(object).sort().reduce((t, cv) => {
30
+ if (object[cv] === void 0 || typeof object[cv] === "symbol") {
31
+ return t;
32
+ }
33
+ const comma = t.length === 0 ? "" : ",";
34
+ return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
35
+ }, "");
36
+ return `{${values}}`;
37
+ };
38
+ const Pe = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
5
39
  var util;
6
40
  (function(util2) {
7
41
  util2.assertEqual = (val) => val;
@@ -20,10 +54,10 @@
20
54
  return obj;
21
55
  };
22
56
  util2.getValidEnumValues = (obj) => {
23
- 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");
24
58
  const filtered = {};
25
- for (const k of validKeys) {
26
- filtered[k] = obj[k];
59
+ for (const k2 of validKeys) {
60
+ filtered[k2] = obj[k2];
27
61
  }
28
62
  return util2.objectValues(filtered);
29
63
  };
@@ -194,10 +228,10 @@
194
228
  fieldErrors._errors.push(mapper(issue));
195
229
  } else {
196
230
  let curr = fieldErrors;
197
- let i2 = 0;
198
- while (i2 < issue.path.length) {
199
- const el = issue.path[i2];
200
- const terminal = i2 === issue.path.length - 1;
231
+ let i = 0;
232
+ while (i < issue.path.length) {
233
+ const el = issue.path[i];
234
+ const terminal = i === issue.path.length - 1;
201
235
  if (!terminal) {
202
236
  curr[el] = curr[el] || { _errors: [] };
203
237
  } else {
@@ -205,7 +239,7 @@
205
239
  curr[el]._errors.push(mapper(issue));
206
240
  }
207
241
  curr = curr[el];
208
- i2++;
242
+ i++;
209
243
  }
210
244
  }
211
245
  }
@@ -368,7 +402,7 @@
368
402
  };
369
403
  }
370
404
  let errorMessage = "";
371
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
405
+ const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
372
406
  for (const map of maps) {
373
407
  errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
374
408
  }
@@ -391,7 +425,7 @@
391
425
  overrideMap,
392
426
  overrideMap === errorMap ? void 0 : errorMap
393
427
  // then global default map
394
- ].filter((x) => !!x)
428
+ ].filter((x2) => !!x2)
395
429
  });
396
430
  ctx.common.issues.push(issue);
397
431
  }
@@ -409,12 +443,12 @@
409
443
  }
410
444
  static mergeArray(status, results) {
411
445
  const arrayValue = [];
412
- for (const s of results) {
413
- if (s.status === "aborted")
446
+ for (const s2 of results) {
447
+ if (s2.status === "aborted")
414
448
  return INVALID;
415
- if (s.status === "dirty")
449
+ if (s2.status === "dirty")
416
450
  status.dirty();
417
- arrayValue.push(s.value);
451
+ arrayValue.push(s2.value);
418
452
  }
419
453
  return { status: status.value, value: arrayValue };
420
454
  }
@@ -454,10 +488,10 @@
454
488
  });
455
489
  const DIRTY = (value) => ({ status: "dirty", value });
456
490
  const OK = (value) => ({ status: "valid", value });
457
- const isAborted = (x) => x.status === "aborted";
458
- const isDirty = (x) => x.status === "dirty";
459
- const isValid = (x) => x.status === "valid";
460
- const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
491
+ const isAborted = (x2) => x2.status === "aborted";
492
+ const isDirty = (x2) => x2.status === "dirty";
493
+ const isValid = (x2) => x2.status === "valid";
494
+ const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
461
495
  function __classPrivateFieldGet(receiver, state, kind, f2) {
462
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");
463
497
  return state.get(receiver);
@@ -2051,14 +2085,14 @@
2051
2085
  }
2052
2086
  }
2053
2087
  if (ctx.common.async) {
2054
- return Promise.all([...ctx.data].map((item, i2) => {
2055
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
2088
+ return Promise.all([...ctx.data].map((item, i) => {
2089
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2056
2090
  })).then((result2) => {
2057
2091
  return ParseStatus.mergeArray(status, result2);
2058
2092
  });
2059
2093
  }
2060
- const result = [...ctx.data].map((item, i2) => {
2061
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
2094
+ const result = [...ctx.data].map((item, i) => {
2095
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2062
2096
  });
2063
2097
  return ParseStatus.mergeArray(status, result);
2064
2098
  }
@@ -2659,17 +2693,17 @@
2659
2693
  });
2660
2694
  }
2661
2695
  }
2662
- function mergeValues(a, b2) {
2696
+ function mergeValues(a, b) {
2663
2697
  const aType = getParsedType(a);
2664
- const bType = getParsedType(b2);
2665
- if (a === b2) {
2698
+ const bType = getParsedType(b);
2699
+ if (a === b) {
2666
2700
  return { valid: true, data: a };
2667
2701
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2668
- const bKeys = util.objectKeys(b2);
2702
+ const bKeys = util.objectKeys(b);
2669
2703
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2670
- const newObj = { ...a, ...b2 };
2704
+ const newObj = { ...a, ...b };
2671
2705
  for (const key of sharedKeys) {
2672
- const sharedValue = mergeValues(a[key], b2[key]);
2706
+ const sharedValue = mergeValues(a[key], b[key]);
2673
2707
  if (!sharedValue.valid) {
2674
2708
  return { valid: false };
2675
2709
  }
@@ -2677,13 +2711,13 @@
2677
2711
  }
2678
2712
  return { valid: true, data: newObj };
2679
2713
  } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2680
- if (a.length !== b2.length) {
2714
+ if (a.length !== b.length) {
2681
2715
  return { valid: false };
2682
2716
  }
2683
2717
  const newArray = [];
2684
2718
  for (let index = 0; index < a.length; index++) {
2685
2719
  const itemA = a[index];
2686
- const itemB = b2[index];
2720
+ const itemB = b[index];
2687
2721
  const sharedValue = mergeValues(itemA, itemB);
2688
2722
  if (!sharedValue.valid) {
2689
2723
  return { valid: false };
@@ -2691,7 +2725,7 @@
2691
2725
  newArray.push(sharedValue.data);
2692
2726
  }
2693
2727
  return { valid: true, data: newArray };
2694
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
2728
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2695
2729
  return { valid: true, data: a };
2696
2730
  } else {
2697
2731
  return { valid: false };
@@ -2787,7 +2821,7 @@
2787
2821
  if (!schema)
2788
2822
  return null;
2789
2823
  return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2790
- }).filter((x) => !!x);
2824
+ }).filter((x2) => !!x2);
2791
2825
  if (ctx.common.async) {
2792
2826
  return Promise.all(items).then((results) => {
2793
2827
  return ParseStatus.mergeArray(status, results);
@@ -2986,7 +3020,7 @@
2986
3020
  }
2987
3021
  return { status: status.value, value: parsedSet };
2988
3022
  }
2989
- const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
3023
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2990
3024
  if (ctx.common.async) {
2991
3025
  return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2992
3026
  } else {
@@ -3045,7 +3079,7 @@
3045
3079
  ctx.schemaErrorMap,
3046
3080
  getErrorMap(),
3047
3081
  errorMap
3048
- ].filter((x) => !!x),
3082
+ ].filter((x2) => !!x2),
3049
3083
  issueData: {
3050
3084
  code: ZodIssueCode.invalid_arguments,
3051
3085
  argumentsError: error
@@ -3061,7 +3095,7 @@
3061
3095
  ctx.schemaErrorMap,
3062
3096
  getErrorMap(),
3063
3097
  errorMap
3064
- ].filter((x) => !!x),
3098
+ ].filter((x2) => !!x2),
3065
3099
  issueData: {
3066
3100
  code: ZodIssueCode.invalid_return_type,
3067
3101
  returnTypeError: error
@@ -3662,10 +3696,10 @@
3662
3696
  }
3663
3697
  }
3664
3698
  }
3665
- static create(a, b2) {
3699
+ static create(a, b) {
3666
3700
  return new ZodPipeline({
3667
3701
  in: a,
3668
- out: b2,
3702
+ out: b,
3669
3703
  typeName: ZodFirstPartyTypeKind.ZodPipeline
3670
3704
  });
3671
3705
  }
@@ -3697,10 +3731,10 @@
3697
3731
  return ZodAny.create().superRefine((data, ctx) => {
3698
3732
  var _a, _b;
3699
3733
  if (!check(data)) {
3700
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3701
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3702
- const p2 = typeof p === "string" ? { message: p } : p;
3703
- 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 });
3704
3738
  }
3705
3739
  });
3706
3740
  return ZodAny.create();
@@ -3914,63 +3948,375 @@
3914
3948
  quotelessJson,
3915
3949
  ZodError
3916
3950
  });
3917
- function b$1(t) {
3918
- throw new Error("Unexpected object: " + t);
3951
+ var $ = Object.defineProperty;
3952
+ var D = (n2, t, e) => t in n2 ? $(n2, t, { enumerable: true, configurable: true, writable: true, value: e }) : n2[t] = e;
3953
+ var m$2 = (n2, t, e) => D(n2, typeof t != "symbol" ? t + "" : t, e);
3954
+ function w(n2) {
3955
+ throw new Error("Unexpected object: " + n2);
3919
3956
  }
3920
- function it(t, n) {
3921
- return { ...t, src: f(t.src, n) };
3957
+ function pn(n2) {
3958
+ if (!n2 || typeof n2 != "object")
3959
+ return false;
3960
+ const t = n2;
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
+ }
3922
3973
  }
3923
- function f(t, n) {
3974
+ function mn(n2, t) {
3975
+ if (n2 !== void 0)
3976
+ switch (n2.type) {
3977
+ case "Json":
3978
+ return n2;
3979
+ case "JsonPartitioned": {
3980
+ const e = {};
3981
+ for (const [r, o] of Object.entries(n2.parts))
3982
+ e[r] = t(o);
3983
+ return {
3984
+ ...n2,
3985
+ parts: e
3986
+ };
3987
+ }
3988
+ case "BinaryPartitioned": {
3989
+ const e = {};
3990
+ for (const [r, o] of Object.entries(n2.parts))
3991
+ e[r] = {
3992
+ index: t(o.index),
3993
+ values: t(o.values)
3994
+ };
3995
+ return {
3996
+ ...n2,
3997
+ parts: e
3998
+ };
3999
+ }
4000
+ }
4001
+ }
4002
+ function j(n2) {
4003
+ if (!n2 || typeof n2 != "object")
4004
+ return false;
4005
+ const t = n2;
4006
+ if (!("type" in t))
4007
+ return false;
3924
4008
  switch (t.type) {
4009
+ case "Json":
4010
+ return typeof t.keyLength == "number" && Array.isArray(t.data);
4011
+ case "JsonPartitioned":
4012
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4013
+ case "BinaryPartitioned":
4014
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4015
+ default:
4016
+ return false;
4017
+ }
4018
+ }
4019
+ function yn(n2) {
4020
+ return j(n2) ? n2.type === "JsonPartitioned" || n2.type === "BinaryPartitioned" : false;
4021
+ }
4022
+ function ln(n2) {
4023
+ switch (n2.type) {
4024
+ case "Json": {
4025
+ const t = Object.entries(n2.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4026
+ return {
4027
+ type: "Json",
4028
+ keyLength: n2.keyLength,
4029
+ data: t
4030
+ };
4031
+ }
4032
+ case "JsonPartitioned": {
4033
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4034
+ return {
4035
+ type: "JsonPartitioned",
4036
+ partitionKeyLength: n2.partitionKeyLength,
4037
+ parts: t
4038
+ };
4039
+ }
4040
+ case "BinaryPartitioned": {
4041
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4042
+ return {
4043
+ type: "BinaryPartitioned",
4044
+ partitionKeyLength: n2.partitionKeyLength,
4045
+ parts: t
4046
+ };
4047
+ }
4048
+ }
4049
+ }
4050
+ function hn(n2) {
4051
+ switch (n2.type) {
4052
+ case "Json": {
4053
+ const t = {};
4054
+ for (const e of n2.data)
4055
+ t[JSON.stringify(e.key)] = e.value;
4056
+ return {
4057
+ type: "Json",
4058
+ keyLength: n2.keyLength,
4059
+ data: t
4060
+ };
4061
+ }
4062
+ case "JsonPartitioned": {
4063
+ const t = {};
4064
+ for (const e of n2.parts)
4065
+ t[JSON.stringify(e.key)] = e.value;
4066
+ return {
4067
+ type: "JsonPartitioned",
4068
+ partitionKeyLength: n2.partitionKeyLength,
4069
+ parts: t
4070
+ };
4071
+ }
4072
+ case "BinaryPartitioned": {
4073
+ const t = {};
4074
+ for (const e of n2.parts)
4075
+ t[JSON.stringify(e.key)] = e.value;
4076
+ return {
4077
+ type: "BinaryPartitioned",
4078
+ partitionKeyLength: n2.partitionKeyLength,
4079
+ parts: t
4080
+ };
4081
+ }
4082
+ }
4083
+ }
4084
+ function p$1(n2) {
4085
+ const { type: t, name: e, domain: r } = n2;
4086
+ return { type: t, name: e, ...r && { domain: r } };
4087
+ }
4088
+ function En(n2) {
4089
+ return Pe(p$1(n2));
4090
+ }
4091
+ function X$1(n2, t) {
4092
+ if (n2 === void 0) return t === void 0;
4093
+ if (t === void 0) return true;
4094
+ for (const e in t)
4095
+ if (n2[e] !== t[e]) return false;
4096
+ return true;
4097
+ }
4098
+ function z(n2, t) {
4099
+ return n2.name === t.name && X$1(n2.domain, t.domain);
4100
+ }
4101
+ function Cn(n2, t) {
4102
+ return { ...n2, src: l$1(n2.src, t) };
4103
+ }
4104
+ function l$1(n2, t) {
4105
+ switch (n2.type) {
3925
4106
  case "column":
3926
4107
  return {
3927
4108
  type: "column",
3928
- column: n(t.column)
4109
+ column: t(n2.column)
4110
+ };
4111
+ case "slicedColumn":
4112
+ return {
4113
+ type: "slicedColumn",
4114
+ column: t(n2.column),
4115
+ newId: n2.newId,
4116
+ axisFilters: n2.axisFilters
3929
4117
  };
3930
4118
  case "inner":
3931
4119
  case "full":
3932
4120
  return {
3933
- type: t.type,
3934
- entries: t.entries.map((e) => f(e, n))
4121
+ type: n2.type,
4122
+ entries: n2.entries.map((e) => l$1(e, t))
3935
4123
  };
3936
4124
  case "outer":
3937
4125
  return {
3938
4126
  type: "outer",
3939
- primary: f(t.primary, n),
3940
- secondary: t.secondary.map((e) => f(e, n))
4127
+ primary: l$1(n2.primary, t),
4128
+ secondary: n2.secondary.map((e) => l$1(e, t))
3941
4129
  };
3942
4130
  default:
3943
- b$1(t);
4131
+ w(n2);
3944
4132
  }
3945
4133
  }
3946
- z$1.object({
3947
- __isRef: z$1.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
3948
- blockId: z$1.string().describe("Upstream block id"),
3949
- name: z$1.string().describe("Name of the output provided to the upstream block's output context")
3950
- }).describe(
3951
- "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
3952
- ).strict().readonly();
3953
- function i(t) {
3954
- return t.kind === "PColumn";
4134
+ function G(n2) {
4135
+ return Pe(n2);
3955
4136
  }
3956
- function W(t) {
3957
- return i(t.spec);
4137
+ function A(n2) {
4138
+ return Pe(p$1(n2));
3958
4139
  }
3959
- function dt(t) {
3960
- if (!W(t)) throw new Error(`not a PColumn (kind = ${t.spec.kind})`);
3961
- return t;
4140
+ function x(n2, t) {
4141
+ return JSON.stringify([n2, t]);
3962
4142
  }
3963
- function lt(t, n) {
3964
- return t === void 0 ? void 0 : {
3965
- ...t,
3966
- data: n(t.data)
4143
+ class On {
4144
+ /**
4145
+ * Creates a new anchor context from a set of anchor column specifications
4146
+ * @param anchors Record of anchor column specifications indexed by anchor ID
4147
+ */
4148
+ constructor(t) {
4149
+ m$2(this, "domains", /* @__PURE__ */ new Map());
4150
+ m$2(this, "axes", /* @__PURE__ */ new Map());
4151
+ m$2(this, "domainPacks", []);
4152
+ m$2(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
4153
+ this.anchors = t;
4154
+ const e = Object.entries(t);
4155
+ e.sort((r, o) => r[0].localeCompare(o[0]));
4156
+ for (const [r, o] of e) {
4157
+ for (let s2 = 0; s2 < o.axesSpec.length; s2++) {
4158
+ const a = o.axesSpec[s2], i = A(a);
4159
+ this.axes.set(i, { anchor: r, idx: s2 });
4160
+ }
4161
+ if (o.domain !== void 0) {
4162
+ const s2 = Object.entries(o.domain);
4163
+ s2.sort((a, i) => a[0].localeCompare(i[0])), this.domainPackToAnchor.set(JSON.stringify(s2), r), this.domainPacks.push(s2.map(([a]) => a));
4164
+ for (const [a, i] of s2) {
4165
+ const u2 = x(a, i);
4166
+ this.domains.set(u2, r);
4167
+ }
4168
+ }
4169
+ }
4170
+ }
4171
+ /**
4172
+ * Implementation of derive method
4173
+ */
4174
+ derive(t, e) {
4175
+ const r = {
4176
+ name: t.name,
4177
+ axes: []
4178
+ };
4179
+ let o;
4180
+ if (t.domain !== void 0)
4181
+ n:
4182
+ for (const a of this.domainPacks) {
4183
+ const i = [];
4184
+ for (const c2 of a) {
4185
+ const d = t.domain[c2];
4186
+ if (d !== void 0)
4187
+ i.push([c2, d]);
4188
+ else
4189
+ break n;
4190
+ }
4191
+ const u2 = this.domainPackToAnchor.get(JSON.stringify(i));
4192
+ if (u2 !== void 0) {
4193
+ r.domainAnchor = u2, o = new Set(a);
4194
+ break;
4195
+ }
4196
+ }
4197
+ for (const [a, i] of Object.entries(t.domain ?? {})) {
4198
+ if (o !== void 0 && o.has(a))
4199
+ continue;
4200
+ const u2 = x(a, i), c2 = this.domains.get(u2);
4201
+ r.domain ?? (r.domain = {}), r.domain[a] = c2 ? { anchor: c2 } : i;
4202
+ }
4203
+ if (r.axes = t.axesSpec.map((a) => {
4204
+ const i = A(a), u2 = this.axes.get(i);
4205
+ return u2 === void 0 ? p$1(a) : u2;
4206
+ }), !e || e.length === 0)
4207
+ return r;
4208
+ const s2 = [];
4209
+ for (const a of e) {
4210
+ const [i, u2] = a;
4211
+ if (typeof i == "number") {
4212
+ if (i < 0 || i >= t.axesSpec.length)
4213
+ throw new Error(`Axis index ${i} is out of bounds (0-${t.axesSpec.length - 1})`);
4214
+ s2.push([i, u2]);
4215
+ } else {
4216
+ const c2 = t.axesSpec.findIndex((d) => d.name === i);
4217
+ if (c2 === -1)
4218
+ throw new Error(`Axis with name "${i}" not found in the column specification`);
4219
+ s2.push([c2, u2]);
4220
+ }
4221
+ }
4222
+ return s2.sort((a, i) => a[0] - i[0]), {
4223
+ source: r,
4224
+ axisFilters: s2
4225
+ };
4226
+ }
4227
+ /**
4228
+ * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
4229
+ * @param spec Column specification to anchor
4230
+ * @param axisFilters Optional axis filters to apply to the column
4231
+ * @returns A canonicalized string representation of the anchored column identifier
4232
+ */
4233
+ deriveS(t, e) {
4234
+ return G(this.derive(t, e));
4235
+ }
4236
+ }
4237
+ function $n(n2, t, e) {
4238
+ const r = { ...t }, o = (e == null ? void 0 : e.ignoreMissingDomains) ?? false;
4239
+ if (r.domainAnchor !== void 0) {
4240
+ const s2 = n2[r.domainAnchor];
4241
+ if (!s2)
4242
+ throw new Error(`Anchor "${r.domainAnchor}" not found`);
4243
+ const a = s2.domain || {};
4244
+ r.domain = { ...a, ...r.domain }, delete r.domainAnchor;
4245
+ }
4246
+ if (r.domain) {
4247
+ const s2 = {};
4248
+ for (const [a, i] of Object.entries(r.domain))
4249
+ if (typeof i == "string")
4250
+ s2[a] = i;
4251
+ else {
4252
+ const u2 = n2[i.anchor];
4253
+ if (!u2)
4254
+ throw new Error(`Anchor "${i.anchor}" not found for domain key "${a}"`);
4255
+ if (!u2.domain || u2.domain[a] === void 0) {
4256
+ if (!o)
4257
+ throw new Error(`Domain key "${a}" not found in anchor "${i.anchor}"`);
4258
+ continue;
4259
+ }
4260
+ s2[a] = u2.domain[a];
4261
+ }
4262
+ r.domain = s2;
4263
+ }
4264
+ return r.axes && (r.axes = r.axes.map((s2) => Q(n2, s2))), r;
4265
+ }
4266
+ function Q(n2, t) {
4267
+ if (!Y$1(t))
4268
+ return t;
4269
+ const e = t.anchor, r = n2[e];
4270
+ if (!r)
4271
+ throw new Error(`Anchor "${e}" not found for axis reference`);
4272
+ if ("idx" in t) {
4273
+ if (t.idx < 0 || t.idx >= r.axesSpec.length)
4274
+ throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);
4275
+ return r.axesSpec[t.idx];
4276
+ } else if ("name" in t) {
4277
+ const o = r.axesSpec.filter((s2) => s2.name === t.name);
4278
+ if (o.length > 1)
4279
+ throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);
4280
+ if (o.length === 0)
4281
+ throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4282
+ return o[0];
4283
+ } else if ("id" in t) {
4284
+ const o = r.axesSpec.filter((s2) => z(t.id, p$1(s2)));
4285
+ if (o.length > 1)
4286
+ throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4287
+ if (o.length === 0)
4288
+ throw new Error(`No matching axis found for matcher in anchor "${e}"`);
4289
+ return o[0];
4290
+ }
4291
+ throw new Error("Unsupported axis reference type");
4292
+ }
4293
+ function Y$1(n2) {
4294
+ return typeof n2 == "object" && "anchor" in n2;
4295
+ }
4296
+ function f(n2) {
4297
+ return n2.kind === "PColumn";
4298
+ }
4299
+ function Z$1(n2) {
4300
+ return f(n2.spec);
4301
+ }
4302
+ function In(n2) {
4303
+ if (!Z$1(n2)) throw new Error(`not a PColumn (kind = ${n2.spec.kind})`);
4304
+ return n2;
4305
+ }
4306
+ function Bn(n2, t) {
4307
+ return n2 === void 0 ? void 0 : {
4308
+ ...n2,
4309
+ data: t(n2.data)
3967
4310
  };
3968
4311
  }
3969
- function pt(t) {
3970
- const n = /* @__PURE__ */ new Map(), e = (r) => {
4312
+ function jn(n2) {
4313
+ const t = /* @__PURE__ */ new Map(), e = (r) => {
3971
4314
  switch (r.type) {
3972
4315
  case "column":
3973
- n.set(r.column.id, r.column);
4316
+ t.set(r.column.id, r.column);
4317
+ return;
4318
+ case "slicedColumn":
4319
+ t.set(r.column.id, r.column);
3974
4320
  return;
3975
4321
  case "full":
3976
4322
  case "inner":
@@ -3981,65 +4327,194 @@
3981
4327
  for (const o of r.secondary) e(o);
3982
4328
  return;
3983
4329
  default:
3984
- b$1(r);
4330
+ w(r);
3985
4331
  }
3986
4332
  };
3987
- return e(t), [...n.values()];
4333
+ return e(n2), [...t.values()];
4334
+ }
4335
+ function k(n2, t) {
4336
+ if (n2.name !== void 0 && n2.name !== t.name)
4337
+ return false;
4338
+ if (n2.type !== void 0) {
4339
+ if (Array.isArray(n2.type)) {
4340
+ if (!n2.type.includes(t.type))
4341
+ return false;
4342
+ } else if (n2.type !== t.type)
4343
+ return false;
4344
+ }
4345
+ if (n2.domain !== void 0) {
4346
+ const e = t.domain || {};
4347
+ for (const [r, o] of Object.entries(n2.domain))
4348
+ if (e[r] !== o)
4349
+ return false;
4350
+ }
4351
+ return true;
3988
4352
  }
3989
- function mt(t, n) {
3990
- return t.ok ? { ok: true, value: n(t.value) } : t;
4353
+ function N(n2, t) {
4354
+ if (t.name !== void 0 && n2.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n2.name))
4355
+ return false;
4356
+ if (t.type !== void 0) {
4357
+ if (Array.isArray(t.type)) {
4358
+ if (!t.type.includes(n2.valueType))
4359
+ return false;
4360
+ } else if (t.type !== n2.valueType)
4361
+ return false;
4362
+ }
4363
+ if (t.domain !== void 0) {
4364
+ const e = n2.domain || {};
4365
+ for (const [r, o] of Object.entries(t.domain))
4366
+ if (e[r] !== o)
4367
+ return false;
4368
+ }
4369
+ if (t.axes !== void 0) {
4370
+ const e = n2.axesSpec.map(p$1);
4371
+ if (t.partialAxesMatch) {
4372
+ for (const r of t.axes)
4373
+ if (!e.some((o) => k(r, o)))
4374
+ return false;
4375
+ } else {
4376
+ if (e.length !== t.axes.length)
4377
+ return false;
4378
+ for (let r = 0; r < t.axes.length; r++)
4379
+ if (!k(t.axes[r], e[r]))
4380
+ return false;
4381
+ }
4382
+ }
4383
+ if (t.annotations !== void 0) {
4384
+ const e = n2.annotations || {};
4385
+ for (const [r, o] of Object.entries(t.annotations))
4386
+ if (e[r] !== o)
4387
+ return false;
4388
+ }
4389
+ if (t.annotationPatterns !== void 0) {
4390
+ const e = n2.annotations || {};
4391
+ for (const [r, o] of Object.entries(t.annotationPatterns)) {
4392
+ const s2 = e[r];
4393
+ if (s2 === void 0 || !new RegExp(o).test(s2))
4394
+ return false;
4395
+ }
4396
+ }
4397
+ return true;
3991
4398
  }
3992
- const Q = 24;
3993
- z$1.string().length(Q).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
3994
- var he = Object.defineProperty;
3995
- var ge = (t, e, n) => e in t ? he(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
3996
- var S = (t, e, n) => ge(t, typeof e != "symbol" ? e + "" : e, n);
3997
- function j(t) {
4399
+ function Fn(n2) {
4400
+ return Array.isArray(n2) ? (t) => n2.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n2);
4401
+ }
4402
+ z$1.object({
4403
+ __isRef: z$1.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4404
+ blockId: z$1.string().describe("Upstream block id"),
4405
+ name: z$1.string().describe("Name of the output provided to the upstream block's output context")
4406
+ }).describe(
4407
+ "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."
4408
+ ).strict().readonly();
4409
+ function Rn(n2) {
4410
+ return typeof n2 == "object" && n2 !== null && "__isRef" in n2 && n2.__isRef === true && "blockId" in n2 && "name" in n2;
4411
+ }
4412
+ function _n(n2, t) {
4413
+ return n2.ok ? { ok: true, value: t(n2.value) } : n2;
4414
+ }
4415
+ const on = 24;
4416
+ z$1.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4417
+ var stringify = { exports: {} };
4418
+ (function(module2, exports3) {
4419
+ exports3 = module2.exports = stringify2;
4420
+ exports3.getSerialize = serializer;
4421
+ function stringify2(obj, replacer, spaces, cycleReplacer) {
4422
+ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
4423
+ }
4424
+ function serializer(replacer, cycleReplacer) {
4425
+ var stack = [], keys = [];
4426
+ if (cycleReplacer == null) cycleReplacer = function(key, value) {
4427
+ if (stack[0] === value) return "[Circular ~]";
4428
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
4429
+ };
4430
+ return function(key, value) {
4431
+ if (stack.length > 0) {
4432
+ var thisPos = stack.indexOf(this);
4433
+ ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
4434
+ ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
4435
+ if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value);
4436
+ } else stack.push(value);
4437
+ return replacer == null ? value : replacer.call(this, key, value);
4438
+ };
4439
+ }
4440
+ })(stringify, stringify.exports);
4441
+ const l = z$1.object({
4442
+ type: z$1.literal("PlError"),
4443
+ name: z$1.string(),
4444
+ message: z$1.string(),
4445
+ /** The message with all details needed for SDK developers. */
4446
+ fullMessage: z$1.string().optional(),
4447
+ stack: z$1.string().optional()
4448
+ }), c = l.extend({
4449
+ cause: z$1.lazy(() => s).optional(),
4450
+ errors: z$1.lazy(() => s.array()).optional()
4451
+ }), m$1 = z$1.object({
4452
+ type: z$1.literal("StandardError"),
4453
+ name: z$1.string(),
4454
+ message: z$1.string(),
4455
+ stack: z$1.string().optional()
4456
+ }), p = m$1.extend({
4457
+ cause: z$1.lazy(() => s).optional(),
4458
+ errors: z$1.lazy(() => s.array()).optional()
4459
+ }), s = z$1.union([p, c]);
4460
+ const u = z$1.object({
4461
+ name: z$1.string(),
4462
+ message: z$1.string(),
4463
+ fullMessage: z$1.string().optional(),
4464
+ stack: z$1.string().optional()
4465
+ }), n = u.extend({
4466
+ cause: z$1.lazy(() => n).optional(),
4467
+ errors: z$1.lazy(() => n.array()).optional()
4468
+ });
4469
+ var je = Object.defineProperty;
4470
+ var Ke = (t, e, n2) => e in t ? je(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
4471
+ var L = (t, e, n2) => Ke(t, typeof e != "symbol" ? e + "" : e, n2);
4472
+ function Z(t) {
3998
4473
  return { type: "Immediate", value: t };
3999
4474
  }
4000
- function Ae() {
4475
+ function Xe() {
4001
4476
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4002
4477
  }
4003
- function oe(t) {
4478
+ function _e(t) {
4004
4479
  if (t && typeof globalThis.getPlatforma == "function")
4005
4480
  return globalThis.getPlatforma(t);
4006
4481
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4007
4482
  throw new Error("Can't get platforma instance.");
4008
4483
  }
4009
- function we() {
4484
+ function Qe() {
4010
4485
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4011
4486
  }
4012
- function c() {
4487
+ function m() {
4013
4488
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4014
4489
  throw new Error("Not in config rendering context");
4015
4490
  }
4016
- function E(t, e) {
4017
- const n = we();
4018
- if (n === void 0) return false;
4019
- if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4020
- return n.callbackRegistry[t] = e, true;
4491
+ function Y(t, e) {
4492
+ const n2 = Qe();
4493
+ if (n2 === void 0) return false;
4494
+ if (t in n2.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4495
+ return n2.callbackRegistry[t] = e, true;
4021
4496
  }
4022
- const $ = /* @__PURE__ */ new Map();
4023
- function Ie(t, e) {
4024
- t in c().callbackRegistry || (c().callbackRegistry[t] = (n) => {
4025
- for (const r of $.get(t))
4026
- r(n);
4027
- }, $.set(t, [])), $.get(t).push(e);
4497
+ const ae = /* @__PURE__ */ new Map();
4498
+ function Ze(t, e) {
4499
+ t in m().callbackRegistry || (m().callbackRegistry[t] = (n2) => {
4500
+ for (const r of ae.get(t))
4501
+ r(n2);
4502
+ }, ae.set(t, [])), ae.get(t).push(e);
4028
4503
  }
4029
- class b {
4030
- constructor(e, n = (r) => r) {
4031
- S(this, "isResolved", false);
4032
- S(this, "resolvedValue");
4033
- this.handle = e, this.postProcess = n, Ie(e, (r) => {
4034
- this.resolvedValue = n(r), this.isResolved = true;
4504
+ class C {
4505
+ constructor(e, n2 = (r) => r) {
4506
+ L(this, "isResolved", false);
4507
+ L(this, "resolvedValue");
4508
+ this.handle = e, this.postProcess = n2, Ze(e, (r) => {
4509
+ this.resolvedValue = n2(r), this.isResolved = true;
4035
4510
  });
4036
4511
  }
4037
4512
  map(e) {
4038
- return new b(this.handle, (n) => e(this.postProcess(n)));
4513
+ return new C(this.handle, (n2) => e(this.postProcess(n2)));
4039
4514
  }
4040
4515
  mapDefined(e) {
4041
- return new b(this.handle, (n) => {
4042
- const r = this.postProcess(n);
4516
+ return new C(this.handle, (n2) => {
4517
+ const r = this.postProcess(n2);
4043
4518
  return r ? e(r) : void 0;
4044
4519
  });
4045
4520
  }
@@ -4047,100 +4522,100 @@
4047
4522
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4048
4523
  }
4049
4524
  }
4050
- function H(t, e) {
4525
+ function pe(t, e) {
4051
4526
  return t === void 0 ? void 0 : e(t);
4052
4527
  }
4053
- class v {
4054
- constructor(e, n) {
4055
- this.handle = e, this.resolvePath = n;
4528
+ class _ {
4529
+ constructor(e, n2) {
4530
+ this.handle = e, this.resolvePath = n2;
4056
4531
  }
4057
4532
  resolve(...e) {
4058
- const n = e.map(
4533
+ const n2 = e.map(
4059
4534
  (r) => ({
4060
4535
  assertFieldType: "Input",
4061
4536
  ...typeof r == "string" ? { field: r } : r
4062
4537
  })
4063
4538
  );
4064
- return this.resolveWithCommon({}, ...n);
4539
+ return this.resolveWithCommon({}, ...n2);
4065
4540
  }
4066
4541
  resolveOutput(...e) {
4067
- const n = e.map(
4542
+ const n2 = e.map(
4068
4543
  (r) => ({
4069
4544
  assertFieldType: "Output",
4070
4545
  ...typeof r == "string" ? { field: r } : r
4071
4546
  })
4072
4547
  );
4073
- return this.resolveWithCommon({}, ...n);
4548
+ return this.resolveWithCommon({}, ...n2);
4074
4549
  }
4075
4550
  resolveInput(...e) {
4076
- const n = e.map(
4551
+ const n2 = e.map(
4077
4552
  (r) => ({
4078
4553
  assertFieldType: "Input",
4079
4554
  ...typeof r == "string" ? { field: r } : r
4080
4555
  })
4081
4556
  );
4082
- return this.resolveWithCommon({}, ...n);
4557
+ return this.resolveWithCommon({}, ...n2);
4083
4558
  }
4084
4559
  resolveAny(...e) {
4085
4560
  return this.resolveWithCommon({}, ...e);
4086
4561
  }
4087
- resolveWithCommon(e, ...n) {
4562
+ resolveWithCommon(e, ...n2) {
4088
4563
  const r = [
4089
4564
  ...this.resolvePath,
4090
- ...n.map((s) => typeof s == "string" ? s : s.field)
4565
+ ...n2.map((i) => typeof i == "string" ? i : i.field)
4091
4566
  ];
4092
- return H(
4093
- c().resolveWithCommon(this.handle, e, ...n),
4094
- (s) => new v(s, r)
4567
+ return pe(
4568
+ m().resolveWithCommon(this.handle, e, ...n2),
4569
+ (i) => new _(i, r)
4095
4570
  );
4096
4571
  }
4097
4572
  get resourceType() {
4098
- return c().getResourceType(this.handle);
4573
+ return m().getResourceType(this.handle);
4099
4574
  }
4100
4575
  getInputsLocked() {
4101
- return c().getInputsLocked(this.handle);
4576
+ return m().getInputsLocked(this.handle);
4102
4577
  }
4103
4578
  getOutputsLocked() {
4104
- return c().getOutputsLocked(this.handle);
4579
+ return m().getOutputsLocked(this.handle);
4105
4580
  }
4106
4581
  getIsReadyOrError() {
4107
- return c().getIsReadyOrError(this.handle);
4582
+ return m().getIsReadyOrError(this.handle);
4108
4583
  }
4109
4584
  getIsFinal() {
4110
- return c().getIsFinal(this.handle);
4585
+ return m().getIsFinal(this.handle);
4111
4586
  }
4112
4587
  getError() {
4113
4588
  const e = [...this.resolvePath, "error"];
4114
- return H(
4115
- c().getError(this.handle),
4116
- (n) => new v(n, e)
4589
+ return pe(
4590
+ m().getError(this.handle),
4591
+ (n2) => new _(n2, e)
4117
4592
  );
4118
4593
  }
4119
4594
  listInputFields() {
4120
- return c().listInputFields(this.handle);
4595
+ return m().listInputFields(this.handle);
4121
4596
  }
4122
4597
  listOutputFields() {
4123
- return c().listOutputFields(this.handle);
4598
+ return m().listOutputFields(this.handle);
4124
4599
  }
4125
4600
  listDynamicFields() {
4126
- return c().listDynamicFields(this.handle);
4601
+ return m().listDynamicFields(this.handle);
4127
4602
  }
4128
4603
  getKeyValueBase64(e) {
4129
- return c().getKeyValueBase64(this.handle, e);
4604
+ return m().getKeyValueBase64(this.handle, e);
4130
4605
  }
4131
4606
  getKeyValueAsString(e) {
4132
- return c().getKeyValueAsString(this.handle, e);
4607
+ return m().getKeyValueAsString(this.handle, e);
4133
4608
  }
4134
4609
  getKeyValueAsJson(e) {
4135
- const n = this.getKeyValueAsString(e);
4136
- if (n == null) throw new Error("Resource has no content.");
4137
- return JSON.parse(n);
4610
+ const n2 = this.getKeyValueAsString(e);
4611
+ if (n2 == null) throw new Error("Resource has no content.");
4612
+ return JSON.parse(n2);
4138
4613
  }
4139
4614
  getDataBase64() {
4140
- return c().getDataBase64(this.handle);
4615
+ return m().getDataBase64(this.handle);
4141
4616
  }
4142
4617
  getDataAsString() {
4143
- return c().getDataAsString(this.handle);
4618
+ return m().getDataAsString(this.handle);
4144
4619
  }
4145
4620
  getDataAsJson() {
4146
4621
  const e = this.getDataAsString();
@@ -4150,40 +4625,40 @@
4150
4625
  /**
4151
4626
  *
4152
4627
  */
4153
- getPColumns(e = false, n = "") {
4154
- const r = this.parsePObjectCollection(e, n);
4155
- return r === void 0 ? void 0 : Object.entries(r).map(([, i2]) => {
4156
- if (!W(i2)) throw new Error(`not a PColumn (kind = ${i2.spec.kind})`);
4157
- return i2;
4628
+ getPColumns(e = false, n2 = "") {
4629
+ const r = this.parsePObjectCollection(e, n2);
4630
+ return r === void 0 ? void 0 : Object.entries(r).map(([, s2]) => {
4631
+ if (!Z$1(s2)) throw new Error(`not a PColumn (kind = ${s2.spec.kind})`);
4632
+ return s2;
4158
4633
  });
4159
4634
  }
4160
4635
  /**
4161
4636
  *
4162
4637
  */
4163
- parsePObjectCollection(e = false, n = "") {
4164
- const r = c().parsePObjectCollection(
4638
+ parsePObjectCollection(e = false, n2 = "") {
4639
+ const r = m().parsePObjectCollection(
4165
4640
  this.handle,
4166
4641
  e,
4167
- n,
4642
+ n2,
4168
4643
  ...this.resolvePath
4169
4644
  );
4170
4645
  if (r === void 0) return;
4171
- const s = {};
4172
- for (const [i2, o] of Object.entries(r)) {
4173
- const a = [...this.resolvePath, i2];
4174
- s[i2] = lt(o, (l) => new v(l, a));
4646
+ const i = {};
4647
+ for (const [s2, o] of Object.entries(r)) {
4648
+ const a = [...this.resolvePath, s2];
4649
+ i[s2] = Bn(o, (l2) => new _(l2, a));
4175
4650
  }
4176
- return s;
4651
+ return i;
4177
4652
  }
4178
4653
  getFileContentAsBase64() {
4179
- return new b(c().getBlobContentAsBase64(this.handle));
4654
+ return new C(m().getBlobContentAsBase64(this.handle));
4180
4655
  }
4181
4656
  getFileContentAsString() {
4182
- return new b(c().getBlobContentAsString(this.handle));
4657
+ return new C(m().getBlobContentAsString(this.handle));
4183
4658
  }
4184
4659
  getFileContentAsJson() {
4185
- return new b(
4186
- c().getBlobContentAsString(this.handle)
4660
+ return new C(
4661
+ m().getBlobContentAsString(this.handle)
4187
4662
  ).mapDefined((e) => JSON.parse(e));
4188
4663
  }
4189
4664
  /**
@@ -4202,7 +4677,7 @@
4202
4677
  * @returns downloaded file handle
4203
4678
  */
4204
4679
  getFileHandle() {
4205
- return new b(c().getDownloadedBlobContentHandle(this.handle));
4680
+ return new C(m().getDownloadedBlobContentHandle(this.handle));
4206
4681
  }
4207
4682
  /**
4208
4683
  * @deprecated use getFileHandle
@@ -4214,7 +4689,7 @@
4214
4689
  * @returns downloaded file handle
4215
4690
  */
4216
4691
  getRemoteFileHandle() {
4217
- return new b(c().getOnDemandBlobContentHandle(this.handle));
4692
+ return new C(m().getOnDemandBlobContentHandle(this.handle));
4218
4693
  }
4219
4694
  /**
4220
4695
  * @deprecated use getRemoteFileHandle
@@ -4226,118 +4701,599 @@
4226
4701
  * @returns the url to the extracted folder
4227
4702
  */
4228
4703
  extractArchiveAndGetURL(e) {
4229
- return new b(c().extractArchiveAndGetURL(this.handle, e));
4704
+ return new C(m().extractArchiveAndGetURL(this.handle, e));
4230
4705
  }
4231
4706
  getImportProgress() {
4232
- return new b(c().getImportProgress(this.handle));
4707
+ return new C(m().getImportProgress(this.handle));
4233
4708
  }
4234
4709
  getLastLogs(e) {
4235
- return new b(c().getLastLogs(this.handle, e));
4710
+ return new C(m().getLastLogs(this.handle, e));
4236
4711
  }
4237
4712
  getProgressLog(e) {
4238
- return new b(c().getProgressLog(this.handle, e));
4713
+ return new C(m().getProgressLog(this.handle, e));
4239
4714
  }
4240
4715
  getProgressLogWithInfo(e) {
4241
- return new b(c().getProgressLogWithInfo(this.handle, e));
4716
+ return new C(m().getProgressLogWithInfo(this.handle, e));
4242
4717
  }
4243
4718
  getLogHandle() {
4244
- return new b(c().getLogHandle(this.handle));
4719
+ return new C(m().getLogHandle(this.handle));
4245
4720
  }
4246
4721
  allFieldsResolved(e = "Input") {
4247
4722
  switch (e) {
4248
4723
  case "Input":
4249
4724
  return this.getInputsLocked() && this.listInputFields().every(
4250
- (n) => this.resolve({ field: n, assertFieldType: "Input" }) !== void 0
4725
+ (n2) => this.resolve({ field: n2, assertFieldType: "Input" }) !== void 0
4251
4726
  );
4252
4727
  case "Output":
4253
4728
  return this.getOutputsLocked() && this.listOutputFields().every(
4254
- (n) => this.resolve({ field: n, assertFieldType: "Output" }) !== void 0
4729
+ (n2) => this.resolve({ field: n2, assertFieldType: "Output" }) !== void 0
4255
4730
  );
4256
4731
  }
4257
4732
  }
4258
- mapFields(e, n) {
4259
- const { fieldType: r, requireLocked: s, skipUnresolved: i2 } = {
4733
+ mapFields(e, n2) {
4734
+ const { fieldType: r, requireLocked: i, skipUnresolved: s2 } = {
4260
4735
  fieldType: "Input",
4261
4736
  requireLocked: true,
4262
4737
  skipUnresolved: false,
4263
- ...n
4738
+ ...n2
4264
4739
  }, o = e;
4265
- if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4740
+ if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4266
4741
  return;
4267
- let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4268
- (u) => [u, this.resolve({ field: u, assertFieldType: r })]
4742
+ let l2 = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4743
+ (u2) => [u2, this.resolve({ field: u2, assertFieldType: r })]
4269
4744
  );
4270
- return i2 && (l = l.filter((u) => u[1] !== void 0)), l.map(([u, h]) => o(u, h));
4745
+ return s2 && (l2 = l2.filter((u2) => u2[1] !== void 0)), l2.map(([u2, S]) => o(u2, S));
4271
4746
  }
4272
4747
  }
4273
- const ae = "staging", le = "main";
4274
- const Fe = "pl7.app/label", Re = "pl7.app/trace", xe = z$1.object({
4748
+ const Ie = "staging", Le = "main";
4749
+ const nt = "pl7.app/label", rt = "pl7.app/trace", it = z$1.object({
4275
4750
  type: z$1.string(),
4276
4751
  importance: z$1.number().optional(),
4277
4752
  id: z$1.string().optional(),
4278
4753
  label: z$1.string()
4279
- }), Te = z$1.array(xe), Oe = 1e-3, ke = "__LABEL__", ee = "__LABEL__@1";
4280
- function Le(t, e, n = {}) {
4281
- const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i2 = t.map((p) => {
4282
- var R, Q2;
4283
- const g = e(p), f2 = (R = g.annotations) == null ? void 0 : R[Fe], I = (Q2 = g.annotations) == null ? void 0 : Q2[Re], y = (I ? Te.safeParse(JSON.parse(I)).data : void 0) ?? [];
4284
- if (f2) {
4285
- const A = { label: f2, type: ke, importance: -2 };
4286
- n.addLabelAsSuffix ? y.push(A) : y.splice(0, 0, A);
4287
- }
4288
- const F = [], D = /* @__PURE__ */ new Map();
4289
- for (let A = y.length - 1; A >= 0; --A) {
4290
- const { type: M } = y[A], fe = y[A].importance ?? 0, J = (D.get(M) ?? 0) + 1;
4291
- D.set(M, J);
4292
- const x = `${M}@${J}`;
4293
- s.set(x, (s.get(x) ?? 0) + 1), r.set(
4294
- x,
4754
+ }), st = z$1.array(it), ot = 1e-3, at = "__LABEL__", ve = "__LABEL__@1";
4755
+ function Ee(t, e, n2 = {}) {
4756
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((p2) => {
4757
+ var q, F;
4758
+ const c2 = e(p2);
4759
+ let h, A2, y;
4760
+ "spec" in c2 && typeof c2.spec == "object" ? (h = c2.spec, A2 = c2.prefixTrace, y = c2.suffixTrace) : h = c2;
4761
+ const v = (q = h.annotations) == null ? void 0 : q[nt], g = (F = h.annotations) == null ? void 0 : F[rt], P = (g ? st.safeParse(JSON.parse(g)).data : void 0) ?? [], b = [
4762
+ ...A2 ?? [],
4763
+ ...P,
4764
+ ...y ?? []
4765
+ ];
4766
+ if (v) {
4767
+ const I = { label: v, type: at, importance: -2 };
4768
+ n2.addLabelAsSuffix ? b.push(I) : b.splice(0, 0, I);
4769
+ }
4770
+ const k2 = [], $2 = /* @__PURE__ */ new Map();
4771
+ for (let I = b.length - 1; I >= 0; --I) {
4772
+ const { type: R } = b[I], se = b[I].importance ?? 0, J = ($2.get(R) ?? 0) + 1;
4773
+ $2.set(R, J);
4774
+ const w2 = `${R}@${J}`;
4775
+ i.set(w2, (i.get(w2) ?? 0) + 1), r.set(
4776
+ w2,
4295
4777
  Math.max(
4296
- r.get(x) ?? Number.NEGATIVE_INFINITY,
4297
- fe - (y.length - A) * Oe
4778
+ r.get(w2) ?? Number.NEGATIVE_INFINITY,
4779
+ se - (b.length - I) * ot
4298
4780
  )
4299
- ), F.push({ ...y[A], fullType: x, occurenceIndex: J });
4781
+ ), k2.push({ ...b[I], fullType: w2, occurenceIndex: J });
4300
4782
  }
4301
- return F.reverse(), {
4302
- value: p,
4303
- spec: g,
4304
- label: f2,
4305
- fullTrace: F
4783
+ return k2.reverse(), {
4784
+ value: p2,
4785
+ spec: h,
4786
+ label: v,
4787
+ fullTrace: k2
4306
4788
  };
4307
- }), o = [], a = [], l = [...r];
4308
- l.sort(([, p], [, g]) => g - p);
4309
- for (const [p] of l)
4310
- p.endsWith("@1") || s.get(p) === t.length ? o.push(p) : a.push(p);
4311
- const u = (p) => i2.map((g) => {
4312
- const f2 = g.fullTrace.filter((y) => p.has(y.fullType)).map((y) => y.label), I = n.separator ?? " / ";
4313
- return {
4314
- label: f2.join(I),
4315
- value: g.value
4316
- };
4317
- });
4789
+ }), o = [], a = [], l2 = [...r];
4790
+ l2.sort(([, p2], [, c2]) => c2 - p2);
4791
+ for (const [p2] of l2)
4792
+ p2.endsWith("@1") || i.get(p2) === t.length ? o.push(p2) : a.push(p2);
4793
+ const u2 = (p2) => {
4794
+ const c2 = [];
4795
+ for (let h = 0; h < s2.length; h++) {
4796
+ const A2 = s2[h], y = A2.fullTrace.filter((P) => p2.has(P.fullType));
4797
+ if (y.length === 0)
4798
+ return;
4799
+ const v = y.map((P) => P.label), g = n2.separator ?? " / ";
4800
+ c2.push({
4801
+ label: v.join(g),
4802
+ value: A2.value
4803
+ });
4804
+ }
4805
+ return c2;
4806
+ };
4318
4807
  if (o.length === 0) {
4319
4808
  if (a.length !== 0) throw new Error("Assertion error.");
4320
- return u(new Set(ee));
4321
- }
4322
- let h = 0, d = 0;
4323
- for (; h < o.length; ) {
4324
- const p = /* @__PURE__ */ new Set();
4325
- n.includeNativeLabel && p.add(ee);
4326
- for (let f2 = 0; f2 < h; ++f2) p.add(o[f2]);
4327
- p.add(o[d]);
4328
- const g = u(p);
4329
- if (new Set(g.map((f2) => f2.label)).size === t.length) return g;
4330
- d++, d == o.length && (h++, d = h);
4331
- }
4332
- return u(/* @__PURE__ */ new Set([...o, ...a]));
4809
+ const p2 = u2(new Set(ve));
4810
+ if (p2 === void 0) throw new Error("Assertion error.");
4811
+ return p2;
4812
+ }
4813
+ let S = 0, d = 0;
4814
+ for (; S < o.length; ) {
4815
+ const p2 = /* @__PURE__ */ new Set();
4816
+ n2.includeNativeLabel && p2.add(ve);
4817
+ for (let h = 0; h < S; ++h) p2.add(o[h]);
4818
+ p2.add(o[d]);
4819
+ const c2 = u2(p2);
4820
+ if (c2 !== void 0 && new Set(c2.map((h) => h.label)).size === t.length) return c2;
4821
+ d++, d >= o.length && (S++, d = S);
4822
+ }
4823
+ const f2 = u2(/* @__PURE__ */ new Set([...o, ...a]));
4824
+ if (f2 === void 0) throw new Error("Assertion error.");
4825
+ return f2;
4826
+ }
4827
+ const H = "PColumnData/", te = H + "ResourceMap", ne = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", V = H + "BinaryPartitioned", Fe = H + "Partitioned/", re = Fe + "JsonPartitioned", B = Fe + "BinaryPartitioned";
4828
+ const fe = (t) => {
4829
+ if (t.endsWith(".index"))
4830
+ return { baseKey: t.substring(0, t.length - 6), type: "index" };
4831
+ if (t.endsWith(".values"))
4832
+ return { baseKey: t.substring(0, t.length - 7), type: "values" };
4833
+ throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4834
+ };
4835
+ function lt(t) {
4836
+ if (!t) return;
4837
+ const e = t.resourceType.name, n2 = t.getDataAsJson(), r = [];
4838
+ let i = 0;
4839
+ switch (e) {
4840
+ case te:
4841
+ i = n2.keyLength;
4842
+ break;
4843
+ case ne:
4844
+ i = n2.partitionKeyLength + n2.keyLength;
4845
+ break;
4846
+ case U:
4847
+ case V:
4848
+ i = n2.partitionKeyLength;
4849
+ break;
4850
+ case B:
4851
+ case re:
4852
+ i = n2.superPartitionKeyLength + n2.partitionKeyLength;
4853
+ break;
4854
+ }
4855
+ switch (e) {
4856
+ case te:
4857
+ case U:
4858
+ case V:
4859
+ for (let s2 of t.listInputFields()) {
4860
+ e === V && (s2 = fe(s2).baseKey);
4861
+ const o = [...JSON.parse(s2)];
4862
+ r.push(o);
4863
+ }
4864
+ break;
4865
+ case ne:
4866
+ case B:
4867
+ case re:
4868
+ for (const s2 of t.listInputFields()) {
4869
+ const o = [...JSON.parse(s2)], a = t.resolve({ field: s2, assertFieldType: "Input" });
4870
+ if (a !== void 0)
4871
+ for (let l2 of a.listInputFields()) {
4872
+ e === B && (l2 = fe(l2).baseKey);
4873
+ const u2 = [...o, ...JSON.parse(l2)];
4874
+ r.push(u2);
4875
+ }
4876
+ }
4877
+ break;
4878
+ }
4879
+ return { data: r, keyLength: i };
4333
4880
  }
4334
- class De {
4881
+ function ut(t) {
4882
+ if (t.type !== "JsonPartitioned" && t.type !== "BinaryPartitioned")
4883
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);
4884
+ const { parts: e, partitionKeyLength: n2 } = t, r = [];
4885
+ for (let i = 0; i < n2; ++i)
4886
+ r.push(/* @__PURE__ */ new Set());
4887
+ for (const i of e) {
4888
+ const s2 = i.key;
4889
+ if (s2.length !== n2)
4890
+ throw new Error(
4891
+ `Key length (${s2.length}) does not match partition length (${n2}) for key: ${JSON.stringify(
4892
+ s2
4893
+ )}`
4894
+ );
4895
+ for (let o = 0; o < n2; ++o)
4896
+ r[o].add(s2[o]);
4897
+ }
4898
+ return r.map((i) => Array.from(i.values()));
4899
+ }
4900
+ function ct(t) {
4901
+ if (t === void 0) return;
4902
+ if (j(t))
4903
+ return ut(t);
4904
+ const e = lt(t);
4905
+ if (!e) return;
4906
+ const { data: n2, keyLength: r } = e, i = [];
4907
+ for (let s2 = 0; s2 < r; ++s2)
4908
+ i.push(/* @__PURE__ */ new Set());
4909
+ for (const s2 of n2) {
4910
+ if (s2.length !== r)
4911
+ throw new Error("key length does not match partition length");
4912
+ for (let o = 0; o < r; ++o)
4913
+ i[o].add(s2[o]);
4914
+ }
4915
+ return i.map((s2) => Array.from(s2.values()));
4916
+ }
4917
+ function he(t, e = []) {
4918
+ if (t === void 0 || !t.getIsReadyOrError()) return;
4919
+ const n2 = t.resourceType.name, r = t.getDataAsJson();
4920
+ if (e.length > 0 && (n2 === re || n2 === B))
4921
+ throw new Error(`Unexpected nested super-partitioned resource: ${n2}`);
4922
+ switch (n2) {
4923
+ case te:
4924
+ case ne:
4925
+ throw new Error(`Only data columns are supported, got: ${n2}`);
4926
+ case U: {
4927
+ if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4928
+ throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4929
+ const i = [];
4930
+ for (const s2 of t.listInputFields()) {
4931
+ const o = t.resolve({ field: s2, assertFieldType: "Input" });
4932
+ if (o === void 0) return;
4933
+ const a = [...e, ...JSON.parse(s2)];
4934
+ i.push({ key: a, value: o });
4935
+ }
4936
+ return {
4937
+ type: "JsonPartitioned",
4938
+ partitionKeyLength: r.partitionKeyLength,
4939
+ parts: i
4940
+ };
4941
+ }
4942
+ case V: {
4943
+ if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4944
+ throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4945
+ const i = [], s2 = /* @__PURE__ */ new Map();
4946
+ for (const o of t.listInputFields()) {
4947
+ const a = fe(o), l2 = t.resolve({ field: o, assertFieldType: "Input" });
4948
+ if (l2 === void 0) return;
4949
+ let u2 = s2.get(a.baseKey);
4950
+ u2 || (u2 = {}, s2.set(a.baseKey, u2)), a.type === "index" ? u2.index = l2 : u2.values = l2;
4951
+ }
4952
+ for (const [o, a] of s2.entries()) {
4953
+ if (!a.index || !a.values) return;
4954
+ const l2 = [...e, ...JSON.parse(o)];
4955
+ i.push({
4956
+ key: l2,
4957
+ value: {
4958
+ index: a.index,
4959
+ values: a.values
4960
+ }
4961
+ });
4962
+ }
4963
+ return {
4964
+ type: "BinaryPartitioned",
4965
+ partitionKeyLength: r.partitionKeyLength,
4966
+ parts: i
4967
+ };
4968
+ }
4969
+ case re: {
4970
+ if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4971
+ throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n2}`);
4972
+ const i = r.superPartitionKeyLength + r.partitionKeyLength, s2 = [];
4973
+ for (const o of t.listInputFields()) {
4974
+ const a = t.resolve({ field: o, assertFieldType: "Input" });
4975
+ if (a === void 0) return;
4976
+ if (a.resourceType.name !== U)
4977
+ throw new Error(`Expected ${U} inside ${n2}, but got ${a.resourceType.name}`);
4978
+ const l2 = he(a, JSON.parse(o));
4979
+ if (l2 === void 0) return;
4980
+ if (l2.type !== "JsonPartitioned")
4981
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
4982
+ s2.push(...l2.parts);
4983
+ }
4984
+ return {
4985
+ type: "JsonPartitioned",
4986
+ partitionKeyLength: i,
4987
+ parts: s2
4988
+ };
4989
+ }
4990
+ case B: {
4991
+ if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4992
+ throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n2}`);
4993
+ const i = r.superPartitionKeyLength + r.partitionKeyLength, s2 = [];
4994
+ for (const o of t.listInputFields()) {
4995
+ const a = t.resolve({ field: o, assertFieldType: "Input" });
4996
+ if (a === void 0) return;
4997
+ if (a.resourceType.name !== V)
4998
+ throw new Error(`Expected ${V} inside ${n2}, but got ${a.resourceType.name}`);
4999
+ const l2 = he(a, JSON.parse(o));
5000
+ if (l2 === void 0) return;
5001
+ if (l2.type !== "BinaryPartitioned")
5002
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
5003
+ s2.push(...l2.parts);
5004
+ }
5005
+ return {
5006
+ type: "BinaryPartitioned",
5007
+ partitionKeyLength: i,
5008
+ parts: s2
5009
+ };
5010
+ }
5011
+ default:
5012
+ throw new Error(`Unknown resource type: ${n2}`);
5013
+ }
5014
+ }
5015
+ function pt(t) {
5016
+ if (t !== void 0) {
5017
+ if (j(t)) return t;
5018
+ if (pn(t)) return ln(t);
5019
+ if (t instanceof _) return he(t);
5020
+ throw new Error(`Unexpected input type: ${typeof t}`);
5021
+ }
5022
+ }
5023
+ function dt(t, e) {
5024
+ const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
5025
+ if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
5026
+ const { partitionKeyLength: s2 } = t;
5027
+ for (const [o] of e)
5028
+ if (o >= s2)
5029
+ throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s2}`);
5030
+ } else if (t.type === "Json") {
5031
+ const { keyLength: s2 } = t;
5032
+ for (const [o] of e)
5033
+ if (o >= s2)
5034
+ throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s2}`);
5035
+ }
5036
+ const r = (s2) => {
5037
+ for (const [o, a] of n2)
5038
+ if (s2[o] !== a)
5039
+ return false;
5040
+ return true;
5041
+ }, i = (s2) => {
5042
+ const o = [...s2];
5043
+ for (const [a] of n2)
5044
+ o.splice(a, 1);
5045
+ return o;
5046
+ };
5047
+ switch (t.type) {
5048
+ case "Json": {
5049
+ const s2 = t.data.filter((o) => r(o.key)).map((o) => ({
5050
+ key: i(o.key),
5051
+ value: o.value
5052
+ }));
5053
+ return {
5054
+ type: "Json",
5055
+ keyLength: t.keyLength - e.length,
5056
+ data: s2
5057
+ };
5058
+ }
5059
+ case "JsonPartitioned": {
5060
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5061
+ key: i(o.key),
5062
+ value: o.value
5063
+ }));
5064
+ return {
5065
+ type: "JsonPartitioned",
5066
+ partitionKeyLength: t.partitionKeyLength - e.length,
5067
+ parts: s2
5068
+ };
5069
+ }
5070
+ case "BinaryPartitioned": {
5071
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5072
+ key: i(o.key),
5073
+ value: o.value
5074
+ }));
5075
+ return {
5076
+ type: "BinaryPartitioned",
5077
+ partitionKeyLength: t.partitionKeyLength - e.length,
5078
+ parts: s2
5079
+ };
5080
+ }
5081
+ }
5082
+ }
5083
+ class ft {
5084
+ constructor(e) {
5085
+ this.columns = e;
5086
+ }
5087
+ selectColumns(e) {
5088
+ const n2 = typeof e == "function" ? e : Fn(e);
5089
+ return this.columns.filter((r) => n2(r.spec));
5090
+ }
5091
+ }
5092
+ function ht(t) {
5093
+ if (t)
5094
+ return t.map((e) => ({
5095
+ type: `split:${En(e.axisId)}`,
5096
+ label: e.label,
5097
+ importance: 1e6
5098
+ // High importance for split filters in labels
5099
+ }));
5100
+ }
5101
+ function gt(t) {
5102
+ if (t)
5103
+ return t.map((e) => [e.axisIdx, e.value]);
5104
+ }
5105
+ function mt(t, e) {
5106
+ if (!e || e.length === 0) return t;
5107
+ const n2 = [...e].sort((r, i) => r[0] - i[0]);
5108
+ return Pe({ id: t, axisFilters: n2 });
5109
+ }
5110
+ function yt(t) {
5111
+ if (!t || typeof t != "object") return false;
5112
+ const e = t, n2 = e.domain && typeof e.domain == "object" && Object.values(e.domain).some((i) => typeof i == "object" && i !== null && "anchor" in i), r = e.axes && Array.isArray(e.axes) && e.axes.some((i) => typeof i == "object" && i !== null && "anchor" in i);
5113
+ return !!e.domainAnchor || n2 || r;
5114
+ }
5115
+ function vt(t) {
5116
+ if (typeof t != "object" || !("axes" in t) || t.axes === void 0)
5117
+ return [];
5118
+ const e = t.axes.map((n2, r) => typeof n2 == "object" && "split" in n2 && n2.split === true ? r : -1).filter((n2) => n2 !== -1);
5119
+ if (e.length > 0 && t.partialAxesMatch !== void 0)
5120
+ throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
5121
+ return e.sort((n2, r) => n2 - r), e;
5122
+ }
5123
+ class be {
4335
5124
  constructor() {
4336
- S(this, "ctx", c());
4337
- S(this, "defaultLabelFn", (e, n) => {
4338
- var r;
4339
- return ((r = e.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
5125
+ L(this, "defaultProviderStore", []);
5126
+ L(this, "providers", [new ft(this.defaultProviderStore)]);
5127
+ L(this, "axisLabelProviders", []);
5128
+ }
5129
+ addColumnProvider(e) {
5130
+ return this.providers.push(e), this;
5131
+ }
5132
+ addAxisLabelProvider(e) {
5133
+ return this.axisLabelProviders.push(e), this;
5134
+ }
5135
+ addColumns(e) {
5136
+ return this.defaultProviderStore.push(...e), this;
5137
+ }
5138
+ addColumn(e) {
5139
+ return this.defaultProviderStore.push(e), this;
5140
+ }
5141
+ /** Fetches labels for a given axis from the registered providers */
5142
+ findLabels(e) {
5143
+ for (const n2 of this.axisLabelProviders) {
5144
+ const r = n2.findLabels(e);
5145
+ if (r) return r;
5146
+ }
5147
+ }
5148
+ getUniversalEntries(e, n2) {
5149
+ const { anchorCtx: r, labelOps: i, dontWaitAllData: s2 = false, overrideLabelAnnotation: o = false } = n2 ?? {}, a = {
5150
+ ...o && (i == null ? void 0 : i.includeNativeLabel) !== false ? { includeNativeLabel: true } : {},
5151
+ ...i ?? {}
5152
+ }, l2 = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], u2 = [];
5153
+ for (const f$1 of l2) {
5154
+ const p2 = yt(f$1);
5155
+ let c2;
5156
+ if (p2) {
5157
+ if (!r)
5158
+ throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
5159
+ c2 = $n(r.anchors, f$1, n2);
5160
+ } else
5161
+ c2 = f$1;
5162
+ const h = /* @__PURE__ */ new Set(), A2 = [];
5163
+ for (const g of this.providers) {
5164
+ const P = g.selectColumns(c2);
5165
+ for (const b of P) {
5166
+ if (h.has(b.id)) throw new Error(`Duplicate column id ${b.id} in provider ${g.constructor.name}`);
5167
+ h.add(b.id), A2.push(b);
5168
+ }
5169
+ }
5170
+ if (A2.length === 0) continue;
5171
+ const y = vt(f$1), v = y.length > 0;
5172
+ for (const g of A2) {
5173
+ if (!f(g.spec)) continue;
5174
+ const P = g.spec;
5175
+ if (v) {
5176
+ const b = pt(g.data);
5177
+ if (!b) {
5178
+ if (s2) continue;
5179
+ return;
5180
+ }
5181
+ if (!yn(b))
5182
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${b.type} for column ${g.id}`);
5183
+ const k2 = ct(b), $2 = y[y.length - 1];
5184
+ if ($2 >= b.partitionKeyLength)
5185
+ throw new Error(`Not enough partition keys (${b.partitionKeyLength}) for requested split axes (max index ${$2}) in column ${P.name}`);
5186
+ const q = y.map((w2) => this.findLabels(p$1(P.axesSpec[w2]))), F = [], I = (w2, N2) => {
5187
+ if (N2 >= y.length) {
5188
+ if (F.push([...w2]), F.length > 1e4)
5189
+ throw new Error("Too many key combinations, aborting.");
5190
+ return;
5191
+ }
5192
+ const D2 = y[N2];
5193
+ if (D2 >= k2.length)
5194
+ throw new Error(`Axis index ${D2} out of bounds for unique keys array (length ${k2.length}) during split key generation for column ${g.id}`);
5195
+ const O = k2[D2];
5196
+ if (!O || O.length === 0) {
5197
+ F.length = 0;
5198
+ return;
5199
+ }
5200
+ for (const z2 of O)
5201
+ w2.push(z2), I(w2, N2 + 1), w2.pop();
5202
+ };
5203
+ if (I([], 0), F.length === 0)
5204
+ continue;
5205
+ const R = [...P.axesSpec], se = y.map((w2) => w2);
5206
+ for (let w2 = y.length - 1; w2 >= 0; w2--)
5207
+ R.splice(y[w2], 1);
5208
+ const J = { ...P, axesSpec: R };
5209
+ for (const w2 of F) {
5210
+ const N2 = w2.map((D2, O) => {
5211
+ const z2 = se[O], Re = p$1(P.axesSpec[z2]), oe = q[O], Oe = (oe == null ? void 0 : oe[D2]) ?? String(D2);
5212
+ return { axisIdx: z2, axisId: Re, value: D2, label: Oe };
5213
+ });
5214
+ u2.push({
5215
+ type: "split",
5216
+ originalColumn: g,
5217
+ spec: P,
5218
+ adjustedSpec: J,
5219
+ dataEntries: b,
5220
+ axisFilters: N2
5221
+ });
5222
+ }
5223
+ } else
5224
+ u2.push({
5225
+ type: "direct",
5226
+ originalColumn: g,
5227
+ spec: P,
5228
+ adjustedSpec: P
5229
+ });
5230
+ }
5231
+ }
5232
+ if (u2.length === 0) return [];
5233
+ const S = Ee(
5234
+ u2,
5235
+ (f2) => ({
5236
+ spec: f2.spec,
5237
+ suffixTrace: f2.type === "split" ? ht(f2.axisFilters) : void 0
5238
+ }),
5239
+ a
5240
+ ), d = [];
5241
+ for (const { value: f2, label: p2 } of S) {
5242
+ const { originalColumn: c2, spec: h } = f2, A2 = f2.type === "split" ? f2.axisFilters : void 0, y = gt(A2);
5243
+ let v;
5244
+ r ? v = r.deriveS(h, y) : v = mt(c2.id, y);
5245
+ let g = { ...f2.adjustedSpec };
5246
+ o && (g = {
5247
+ ...g,
5248
+ annotations: {
5249
+ ...g.annotations ?? {},
5250
+ "pl7.app/label": p2
5251
+ }
5252
+ }), d.push({
5253
+ id: v,
5254
+ spec: g,
5255
+ data: () => f2.type === "split" ? hn(dt(f2.dataEntries, y)) : f2.originalColumn.data,
5256
+ label: p2
5257
+ });
5258
+ }
5259
+ return d;
5260
+ }
5261
+ getColumns(e, n2) {
5262
+ const r = this.getUniversalEntries(e, {
5263
+ overrideLabelAnnotation: true,
5264
+ // default for getColumns
5265
+ ...n2 ?? {}
4340
5266
  });
5267
+ if (!r) return;
5268
+ const i = [];
5269
+ for (const s2 of r) {
5270
+ const o = s2.data();
5271
+ if (!o) {
5272
+ if (n2 != null && n2.dontWaitAllData) continue;
5273
+ return;
5274
+ }
5275
+ i.push({
5276
+ id: s2.id,
5277
+ spec: s2.spec,
5278
+ data: o
5279
+ });
5280
+ }
5281
+ return i;
5282
+ }
5283
+ }
5284
+ function le(t, e) {
5285
+ if (t === void 0) return e === void 0;
5286
+ if (e === void 0) return true;
5287
+ for (const n2 in e)
5288
+ if (t[n2] !== e[n2]) return false;
5289
+ return true;
5290
+ }
5291
+ function we(t) {
5292
+ return Bn(t, (e) => e instanceof _ ? e.handle : pn(e) ? mn(e, (n2) => n2.handle) : e);
5293
+ }
5294
+ class bt {
5295
+ constructor() {
5296
+ L(this, "ctx", m());
4341
5297
  }
4342
5298
  /**
4343
5299
  * @deprecated use getOptions()
@@ -4345,16 +5301,87 @@
4345
5301
  calculateOptions(e) {
4346
5302
  return this.ctx.calculateOptions(e);
4347
5303
  }
4348
- getOptions(e, n) {
4349
- const r = this.getSpecs().entries.filter((s) => e(s.obj));
4350
- return typeof n == "object" || typeof n > "u" ? Le(r, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i2 }) => ({
4351
- ref: s,
4352
- label: i2
4353
- })) : r.map((s) => ({
4354
- ref: s.ref,
4355
- label: n(s.obj, s.ref)
5304
+ getOptions(e, n2) {
5305
+ const r = typeof e == "function" ? e : Fn(e), i = this.getSpecs().entries.filter((s2) => r(s2.obj));
5306
+ return typeof n2 == "object" || typeof n2 > "u" ? Ee(i, (s2) => s2.obj, n2 ?? {}).map(({ value: { ref: s2 }, label: o }) => ({
5307
+ ref: s2,
5308
+ label: o
5309
+ })) : i.map((s2) => ({
5310
+ ref: s2.ref,
5311
+ label: n2(s2.obj, s2.ref)
4356
5312
  }));
4357
5313
  }
5314
+ resolveAnchorCtx(e) {
5315
+ if (e instanceof On) return e;
5316
+ const n2 = {};
5317
+ for (const [r, i] of Object.entries(e))
5318
+ if (Rn(i)) {
5319
+ const s2 = this.getPColumnSpecByRef(i);
5320
+ if (!s2)
5321
+ return;
5322
+ n2[r] = s2;
5323
+ } else
5324
+ n2[r] = i;
5325
+ return new On(n2);
5326
+ }
5327
+ /**
5328
+ * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
5329
+ *
5330
+ * @param anchorsOrCtx - Anchor context for column selection (same as in getCanonicalOptions)
5331
+ * @param predicateOrSelectors - Predicate or selectors for filtering columns (same as in getCanonicalOptions)
5332
+ * @param opts - Optional configuration for label generation and data waiting
5333
+ * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
5334
+ */
5335
+ getAnchoredPColumns(e, n2, r) {
5336
+ const i = this.resolveAnchorCtx(e);
5337
+ if (i)
5338
+ return new be().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n2, {
5339
+ ...r,
5340
+ anchorCtx: i
5341
+ });
5342
+ }
5343
+ /**
5344
+ * Calculates anchored identifier options for columns matching a given predicate and returns their
5345
+ * canonicalized representations.
5346
+ *
5347
+ * This function filters column specifications from the result pool that match the provided predicate,
5348
+ * creates a standardized AnchorCtx from the provided anchors, and generates a list of label-value
5349
+ * pairs for UI components (like dropdowns).
5350
+ *
5351
+ * @param anchorsOrCtx - Either:
5352
+ * - An existing AnchorCtx instance
5353
+ * - A record mapping anchor IDs to PColumnSpec objects
5354
+ * - A record mapping anchor IDs to PlRef objects (which will be resolved to PColumnSpec)
5355
+ * @param predicateOrSelectors - Either:
5356
+ * - A predicate function that takes a PColumnSpec and returns a boolean.
5357
+ * Only specs that return true will be included.
5358
+ * - An APColumnSelector object for declarative filtering, which will be
5359
+ * resolved against the provided anchors and matched using matchPColumn.
5360
+ * - An array of APColumnSelector objects - columns matching ANY selector
5361
+ * in the array will be included (OR operation).
5362
+ * @param opts - Optional configuration for label generation:
5363
+ * - labelOps: Optional configuration for label generation:
5364
+ * - includeNativeLabel: Whether to include native column labels
5365
+ * - separator: String to use between label parts (defaults to " / ")
5366
+ * - addLabelAsSuffix: Whether to add labels as suffix instead of prefix
5367
+ * - dontWaitAllData: Whether to skip columns that don't have all data (if not set, will return undefined,
5368
+ * if at least one column that requires splitting is missing data)
5369
+ * @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
5370
+ * or undefined if any PlRef resolution fails.
5371
+ */
5372
+ getCanonicalOptions(e, n2, r) {
5373
+ const i = this.resolveAnchorCtx(e);
5374
+ if (!i) return;
5375
+ const s2 = new be().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n2, {
5376
+ ...r,
5377
+ anchorCtx: i
5378
+ });
5379
+ if (s2)
5380
+ return s2.map((o) => ({
5381
+ value: o.id,
5382
+ label: o.label
5383
+ }));
5384
+ }
4358
5385
  /**
4359
5386
  * @deprecated use getData()
4360
5387
  */
@@ -4365,11 +5392,11 @@
4365
5392
  const e = this.ctx.getDataFromResultPool();
4366
5393
  return {
4367
5394
  isComplete: e.isComplete,
4368
- entries: e.entries.map((n) => ({
4369
- ref: n.ref,
5395
+ entries: e.entries.map((n2) => ({
5396
+ ref: n2.ref,
4370
5397
  obj: {
4371
- ...n.obj,
4372
- data: new v(n.obj.data, [n.ref.blockId, n.ref.name])
5398
+ ...n2.obj,
5399
+ data: new _(n2.obj.data, [n2.ref.blockId, n2.ref.name])
4373
5400
  }
4374
5401
  }))
4375
5402
  };
@@ -4384,13 +5411,13 @@
4384
5411
  const e = this.ctx.getDataWithErrorsFromResultPool();
4385
5412
  return {
4386
5413
  isComplete: e.isComplete,
4387
- entries: e.entries.map((n) => ({
4388
- ref: n.ref,
5414
+ entries: e.entries.map((n2) => ({
5415
+ ref: n2.ref,
4389
5416
  obj: {
4390
- ...n.obj,
4391
- data: mt(
4392
- n.obj.data,
4393
- (r) => new v(r, [n.ref.blockId, n.ref.name])
5417
+ ...n2.obj,
5418
+ data: _n(
5419
+ n2.obj.data,
5420
+ (r) => new _(r, [n2.ref.blockId, n2.ref.name])
4394
5421
  )
4395
5422
  }
4396
5423
  }))
@@ -4410,13 +5437,17 @@
4410
5437
  * @returns data associated with the ref
4411
5438
  */
4412
5439
  getDataByRef(e) {
4413
- var n;
4414
- return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
4415
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4416
- )) == null ? void 0 : n.obj : lt(
4417
- this.ctx.getDataFromResultPoolByRef(e.blockId, e.name),
4418
- (r) => new v(r, [e.blockId, e.name])
4419
- );
5440
+ var r;
5441
+ if (typeof this.ctx.getDataFromResultPoolByRef > "u")
5442
+ return (r = this.getData().entries.find(
5443
+ (i) => i.ref.blockId === e.blockId && i.ref.name === e.name
5444
+ )) == null ? void 0 : r.obj;
5445
+ const n2 = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
5446
+ if (n2)
5447
+ return Bn(
5448
+ n2,
5449
+ (i) => new _(i, [e.blockId, e.name])
5450
+ );
4420
5451
  }
4421
5452
  /**
4422
5453
  * Returns data associated with the ref ensuring that it is a p-column.
@@ -4424,9 +5455,9 @@
4424
5455
  * @returns p-column associated with the ref
4425
5456
  */
4426
5457
  getPColumnByRef(e) {
4427
- const n = this.getDataByRef(e);
4428
- if (n)
4429
- return dt(n);
5458
+ const n2 = this.getDataByRef(e);
5459
+ if (n2)
5460
+ return In(n2);
4430
5461
  }
4431
5462
  /**
4432
5463
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -4434,10 +5465,10 @@
4434
5465
  * @returns p-column spec associated with the ref
4435
5466
  */
4436
5467
  getPColumnSpecByRef(e) {
4437
- const n = this.getSpecByRef(e);
4438
- if (n) {
4439
- if (!i(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
4440
- return n;
5468
+ const n2 = this.getSpecByRef(e);
5469
+ if (n2) {
5470
+ if (!f(n2)) throw new Error(`not a PColumn spec (kind = ${n2.kind})`);
5471
+ return n2;
4441
5472
  }
4442
5473
  }
4443
5474
  /**
@@ -4445,10 +5476,7 @@
4445
5476
  * @returns object spec associated with the ref
4446
5477
  */
4447
5478
  getSpecByRef(e) {
4448
- var n;
4449
- return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
4450
- (r) => r.ref.blockId === e.blockId && r.ref.name === e.name
4451
- )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
5479
+ return this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
4452
5480
  }
4453
5481
  /**
4454
5482
  * @param spec object specification
@@ -4456,38 +5484,89 @@
4456
5484
  * @deprecated delete this method after Jan 1, 2025
4457
5485
  */
4458
5486
  findDataWithCompatibleSpec(e) {
4459
- const n = [];
5487
+ const n2 = [];
4460
5488
  e: for (const r of this.getData().entries) {
4461
- if (!i(r.obj.spec))
5489
+ if (!f(r.obj.spec))
4462
5490
  continue;
4463
- const s = r.obj.spec;
4464
- if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && z(e.domain, s.domain)) {
4465
- for (let i2 = 0; i2 < e.axesSpec.length; ++i2) {
4466
- const o = e.axesSpec[i2], a = s.axesSpec[i2];
4467
- if (o.name !== a.name || o.type !== a.type || !z(o.domain, a.domain))
5491
+ const i = r.obj.spec;
5492
+ if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && le(e.domain, i.domain)) {
5493
+ for (let s2 = 0; s2 < e.axesSpec.length; ++s2) {
5494
+ const o = e.axesSpec[s2], a = i.axesSpec[s2];
5495
+ if (o.name !== a.name || o.type !== a.type || !le(o.domain, a.domain))
4468
5496
  continue e;
4469
5497
  }
4470
- n.push(r.obj);
5498
+ n2.push(r.obj);
4471
5499
  }
4472
5500
  }
4473
- return n;
5501
+ return n2;
5502
+ }
5503
+ /**
5504
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
5505
+ * @returns a map of axis value => label
5506
+ */
5507
+ findLabels(e) {
5508
+ const n2 = this.getData();
5509
+ for (const r of n2.entries) {
5510
+ if (!Z$1(r.obj)) continue;
5511
+ const i = r.obj.spec;
5512
+ if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && le(e.domain, i.axesSpec[0].domain)) {
5513
+ if (r.obj.data.resourceType.name !== "PColumnData/Json")
5514
+ throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
5515
+ return Object.fromEntries(
5516
+ Object.entries(
5517
+ r.obj.data.getDataAsJson().data
5518
+ ).map((o) => [JSON.parse(o[0])[0], o[1]])
5519
+ );
5520
+ }
5521
+ }
5522
+ }
5523
+ /**
5524
+ * Selects columns based on the provided selectors, returning PColumn objects
5525
+ * with lazily loaded data.
5526
+ *
5527
+ * @param selectors - A predicate function, a single selector, or an array of selectors.
5528
+ * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
5529
+ */
5530
+ selectColumns(e) {
5531
+ const n2 = typeof e == "function" ? e : Fn(e);
5532
+ return this.getSpecs().entries.filter(({ obj: i }) => f(i) ? n2(i) : false).map(({ ref: i, obj: s2 }) => {
5533
+ const o = s2;
5534
+ let a = null;
5535
+ const l2 = this;
5536
+ return {
5537
+ id: Pe(i),
5538
+ spec: o,
5539
+ get data() {
5540
+ var u2;
5541
+ return a !== null || (a = (u2 = l2.getPColumnByRef(i)) == null ? void 0 : u2.data), a;
5542
+ }
5543
+ };
5544
+ });
5545
+ }
5546
+ /**
5547
+ * Find labels data for a given axis id of a p-column.
5548
+ * @returns a map of axis value => label
5549
+ */
5550
+ findLabelsForColumnAxis(e, n2) {
5551
+ var s2;
5552
+ const r = this.findLabels(e.axesSpec[n2]);
5553
+ if (!r) return;
5554
+ const i = (s2 = e.annotations) == null ? void 0 : s2["pl7.app/axisKeys/" + n2];
5555
+ if (i !== void 0) {
5556
+ const o = JSON.parse(i);
5557
+ return Object.fromEntries(o.map((a) => [a, r[a] ?? "Unlabelled"]));
5558
+ } else
5559
+ return r;
4474
5560
  }
4475
5561
  }
4476
- function z(t, e) {
4477
- if (t === void 0) return e === void 0;
4478
- if (e === void 0) return true;
4479
- for (const n in e)
4480
- if (t[n] !== e[n]) return false;
4481
- return true;
4482
- }
4483
- class V {
5562
+ class X {
4484
5563
  constructor() {
4485
- S(this, "ctx");
4486
- S(this, "args");
4487
- S(this, "uiState");
4488
- S(this, "_activeArgsCache");
4489
- S(this, "resultPool", new De());
4490
- this.ctx = c(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5564
+ L(this, "ctx");
5565
+ L(this, "args");
5566
+ L(this, "uiState");
5567
+ L(this, "_activeArgsCache");
5568
+ L(this, "resultPool", new bt());
5569
+ this.ctx = m(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
4491
5570
  }
4492
5571
  /**
4493
5572
  * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
@@ -4503,61 +5582,47 @@
4503
5582
  // return this.ctx.featureFlags;
4504
5583
  // }
4505
5584
  getNamedAccessor(e) {
4506
- return H(
5585
+ return pe(
4507
5586
  this.ctx.getAccessorHandleByName(e),
4508
- (n) => new v(n, [e])
5587
+ (n2) => new _(n2, [e])
4509
5588
  );
4510
5589
  }
4511
5590
  get prerun() {
4512
- return this.getNamedAccessor(ae);
5591
+ return this.getNamedAccessor(Ie);
4513
5592
  }
4514
5593
  get outputs() {
4515
- return this.getNamedAccessor(le);
5594
+ return this.getNamedAccessor(Le);
4516
5595
  }
4517
5596
  /**
4518
5597
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
4519
5598
  * @returns a map of axis value => label
5599
+ * @deprecated Use resultPool.findLabels instead
4520
5600
  */
4521
5601
  findLabels(e) {
4522
- const n = this.resultPool.getData();
4523
- for (const r of n.entries) {
4524
- if (!W(r.obj)) continue;
4525
- const s = r.obj.spec;
4526
- if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && z(e.domain, s.axesSpec[0].domain)) {
4527
- if (r.obj.data.resourceType.name !== "PColumnData/Json")
4528
- throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
4529
- return Object.fromEntries(
4530
- Object.entries(
4531
- r.obj.data.getDataAsJson().data
4532
- ).map((o) => [JSON.parse(o[0])[0], o[1]])
4533
- );
4534
- }
4535
- }
5602
+ return this.resultPool.findLabels(e);
4536
5603
  }
4537
- verifyInlineColumnsSupport(e) {
4538
- var s;
4539
- const n = e.some((i2) => !(i2.data instanceof v)), r = ((s = this.ctx.featureFlags) == null ? void 0 : s.inlineColumnsSupport) === true;
4540
- if (n && !r) throw Error("inline columns not supported");
5604
+ verifyInlineAndExplicitColumnsSupport(e) {
5605
+ var i;
5606
+ const n2 = e.some((s2) => !(s2.data instanceof _) || pn(s2.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5607
+ if (n2 && !r) throw Error("Inline or explicit columns not supported");
4541
5608
  }
5609
+ // TODO remove all non-PColumn fields
4542
5610
  createPFrame(e) {
4543
- return this.verifyInlineColumnsSupport(e), this.ctx.createPFrame(
4544
- e.map((n) => lt(n, (r) => r instanceof v ? r.handle : r))
5611
+ return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5612
+ e.map((n2) => we(n2))
4545
5613
  );
4546
5614
  }
4547
5615
  createPTable(e) {
4548
- var n;
4549
- return "columns" in e ? n = {
5616
+ let n2;
5617
+ return "columns" in e ? n2 = {
4550
5618
  src: {
4551
5619
  type: "full",
4552
5620
  entries: e.columns.map((r) => ({ type: "column", column: r }))
4553
5621
  },
4554
5622
  filters: e.filters ?? [],
4555
5623
  sorting: e.sorting ?? []
4556
- } : n = e, this.verifyInlineColumnsSupport(pt(n.src)), this.ctx.createPTable(
4557
- it(
4558
- n,
4559
- (r) => lt(r, (s) => s instanceof v ? s.handle : s)
4560
- )
5624
+ } : n2 = e, this.verifyInlineAndExplicitColumnsSupport(jn(n2.src)), this.ctx.createPTable(
5625
+ Cn(n2, (r) => we(r))
4561
5626
  );
4562
5627
  }
4563
5628
  /** @deprecated scheduled for removal from SDK */
@@ -4569,33 +5634,33 @@
4569
5634
  return this.ctx.getCurrentUnstableMarker();
4570
5635
  }
4571
5636
  }
4572
- const T = "1.22.97";
4573
- function Ve(t) {
5637
+ const M = "1.29.2";
5638
+ function wt(t) {
4574
5639
  return t.__renderLambda === true;
4575
5640
  }
4576
- function K(t) {
5641
+ function ue(t) {
4577
5642
  if (t !== void 0)
4578
- return Ve(t) ? t.handle : t;
5643
+ return wt(t) ? t.handle : t;
4579
5644
  }
4580
- class _ {
4581
- constructor(e, n, r, s, i2, o, a) {
4582
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i2, this._sections = o, this._title = a;
5645
+ class T {
5646
+ constructor(e, n2, r, i, s2, o, a) {
5647
+ this._renderingMode = e, this._initialArgs = n2, this._initialUiState = r, this._outputs = i, this._inputsValid = s2, this._sections = o, this._title = a;
4583
5648
  }
4584
5649
  static create(e = "Heavy") {
4585
- return new _(
5650
+ return new T(
4586
5651
  e,
4587
5652
  void 0,
4588
5653
  {},
4589
5654
  {},
4590
- j(true),
4591
- j([]),
5655
+ Z(true),
5656
+ Z([]),
4592
5657
  void 0
4593
5658
  );
4594
5659
  }
4595
- output(e, n, r = {}) {
4596
- if (typeof n == "function") {
4597
- const s = `output#${e}`;
4598
- return E(s, () => n(new V())), new _(
5660
+ output(e, n2, r = {}) {
5661
+ if (typeof n2 == "function") {
5662
+ const i = `output#${e}`;
5663
+ return Y(i, () => n2(new X())), new T(
4599
5664
  this._renderingMode,
4600
5665
  this._initialArgs,
4601
5666
  this._initialUiState,
@@ -4603,7 +5668,7 @@
4603
5668
  ...this._outputs,
4604
5669
  [e]: {
4605
5670
  __renderLambda: true,
4606
- handle: s,
5671
+ handle: i,
4607
5672
  ...r
4608
5673
  }
4609
5674
  },
@@ -4612,13 +5677,13 @@
4612
5677
  this._title
4613
5678
  );
4614
5679
  } else
4615
- return new _(
5680
+ return new T(
4616
5681
  this._renderingMode,
4617
5682
  this._initialArgs,
4618
5683
  this._initialUiState,
4619
5684
  {
4620
5685
  ...this._outputs,
4621
- [e]: n
5686
+ [e]: n2
4622
5687
  },
4623
5688
  this._inputsValid,
4624
5689
  this._sections,
@@ -4626,11 +5691,11 @@
4626
5691
  );
4627
5692
  }
4628
5693
  /** Shortcut for {@link output} with retentive flag set to true. */
4629
- retentiveOutput(e, n) {
4630
- return this.output(e, n, { retentive: true });
5694
+ retentiveOutput(e, n2) {
5695
+ return this.output(e, n2, { retentive: true });
4631
5696
  }
4632
5697
  argsValid(e) {
4633
- return typeof e == "function" ? (E("inputsValid", () => e(new V())), new _(
5698
+ return typeof e == "function" ? (Y("inputsValid", () => e(new X())), new T(
4634
5699
  this._renderingMode,
4635
5700
  this._initialArgs,
4636
5701
  this._initialUiState,
@@ -4641,7 +5706,7 @@
4641
5706
  },
4642
5707
  this._sections,
4643
5708
  this._title
4644
- )) : new _(
5709
+ )) : new T(
4645
5710
  this._renderingMode,
4646
5711
  this._initialArgs,
4647
5712
  this._initialUiState,
@@ -4652,7 +5717,7 @@
4652
5717
  );
4653
5718
  }
4654
5719
  sections(e) {
4655
- return Array.isArray(e) ? this.sections(j(e)) : typeof e == "function" ? (E("sections", () => e(new V())), new _(
5720
+ return Array.isArray(e) ? this.sections(Z(e)) : typeof e == "function" ? (Y("sections", () => e(new X())), new T(
4656
5721
  this._renderingMode,
4657
5722
  this._initialArgs,
4658
5723
  this._initialUiState,
@@ -4660,7 +5725,7 @@
4660
5725
  this._inputsValid,
4661
5726
  { __renderLambda: true, handle: "sections" },
4662
5727
  this._title
4663
- )) : new _(
5728
+ )) : new T(
4664
5729
  this._renderingMode,
4665
5730
  this._initialArgs,
4666
5731
  this._initialUiState,
@@ -4672,7 +5737,7 @@
4672
5737
  }
4673
5738
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
4674
5739
  title(e) {
4675
- return E("title", () => e(new V())), new _(
5740
+ return Y("title", () => e(new X())), new T(
4676
5741
  this._renderingMode,
4677
5742
  this._initialArgs,
4678
5743
  this._initialUiState,
@@ -4687,7 +5752,7 @@
4687
5752
  * @deprecated use {@link withArgs}
4688
5753
  * */
4689
5754
  initialArgs(e) {
4690
- return new _(
5755
+ return new T(
4691
5756
  this._renderingMode,
4692
5757
  e,
4693
5758
  this._initialUiState,
@@ -4699,7 +5764,7 @@
4699
5764
  }
4700
5765
  /** Sets initial args for the block, this value must be specified. */
4701
5766
  withArgs(e) {
4702
- return new _(
5767
+ return new T(
4703
5768
  this._renderingMode,
4704
5769
  e,
4705
5770
  this._initialUiState,
@@ -4711,7 +5776,7 @@
4711
5776
  }
4712
5777
  /** Defines type and sets initial value for block UiState. */
4713
5778
  withUiState(e) {
4714
- return new _(
5779
+ return new T(
4715
5780
  this._renderingMode,
4716
5781
  this._initialArgs,
4717
5782
  e,
@@ -4728,7 +5793,7 @@
4728
5793
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
4729
5794
  const e = {
4730
5795
  v3: {
4731
- sdkVersion: T,
5796
+ sdkVersion: M,
4732
5797
  renderingMode: this._renderingMode,
4733
5798
  initialArgs: this._initialArgs,
4734
5799
  initialUiState: this._initialUiState,
@@ -4738,19 +5803,19 @@
4738
5803
  outputs: this._outputs
4739
5804
  },
4740
5805
  // fields below are added to allow previous desktop versions read generated configs
4741
- sdkVersion: T,
5806
+ sdkVersion: M,
4742
5807
  renderingMode: this._renderingMode,
4743
5808
  initialArgs: this._initialArgs,
4744
- inputsValid: K(this._inputsValid),
4745
- sections: K(this._sections),
5809
+ inputsValid: ue(this._inputsValid),
5810
+ sections: ue(this._sections),
4746
5811
  outputs: Object.fromEntries(
4747
- Object.entries(this._outputs).map(([n, r]) => [n, K(r)])
5812
+ Object.entries(this._outputs).map(([n2, r]) => [n2, ue(r)])
4748
5813
  )
4749
5814
  };
4750
- return Ae() ? oe({ sdkVersion: T }) : { config: e };
5815
+ return Xe() ? _e({ sdkVersion: M }) : { config: e };
4751
5816
  }
4752
5817
  }
4753
- const model = _.create().withArgs({
5818
+ const model = T.create().withArgs({
4754
5819
  // a fake product key so our mnz client response with a fake response without changing prod db.
4755
5820
  productKey: "MIFAKEMIFAKEMIFAKE",
4756
5821
  inputHandles: [],
@@ -4758,6 +5823,8 @@
4758
5823
  __mnzDate: (/* @__PURE__ */ new Date()).toISOString(),
4759
5824
  // It's OK
4760
5825
  __mnzCanRun: false
5826
+ }).argsValid((ctx) => {
5827
+ return ctx.args.__mnzCanRun;
4761
5828
  }).output("__mnzInfo", (ctx) => {
4762
5829
  var _a, _b;
4763
5830
  return (_b = (_a = ctx.prerun) == null ? void 0 : _a.resolve("info")) == null ? void 0 : _b.getDataAsJson();
@@ -4766,13 +5833,13 @@
4766
5833
  return (_b = (_a = ctx.outputs) == null ? void 0 : _a.resolve("token")) == null ? void 0 : _b.getDataAsString();
4767
5834
  }).output("progresses", (ctx) => {
4768
5835
  var _a;
4769
- const m = (_a = ctx.prerun) == null ? void 0 : _a.resolve("progresses");
4770
- const progresses = m == null ? void 0 : m.mapFields((name, val) => [name, val == null ? void 0 : val.getImportProgress()]);
5836
+ const m2 = (_a = ctx.prerun) == null ? void 0 : _a.resolve("progresses");
5837
+ const progresses = m2 == null ? void 0 : m2.mapFields((name, val) => [name, val == null ? void 0 : val.getImportProgress()]);
4771
5838
  return Object.fromEntries(progresses ?? []);
4772
5839
  }).output("mainProgresses", (ctx) => {
4773
5840
  var _a;
4774
- const m = (_a = ctx.outputs) == null ? void 0 : _a.resolve("progresses");
4775
- const progresses = m == null ? void 0 : m.mapFields((name, val) => [name, val == null ? void 0 : val.getImportProgress()]);
5841
+ const m2 = (_a = ctx.outputs) == null ? void 0 : _a.resolve("progresses");
5842
+ const progresses = m2 == null ? void 0 : m2.mapFields((name, val) => [name, val == null ? void 0 : val.getImportProgress()]);
4776
5843
  return Object.fromEntries(progresses ?? []);
4777
5844
  }).sections((_2) => [{ type: "link", href: "/", label: "Main" }]).done();
4778
5845
  exports2.model = model;