@milaboratories/pl-middle-layer 1.10.49 → 1.11.1

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/index.mjs CHANGED
@@ -1,69 +1,69 @@
1
- var Mt = Object.defineProperty;
2
- var Ut = (o, e, t) => e in o ? Mt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var d = (o, e, t) => Ut(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { executePSpecPredicate as $t, mapPObjectData as q, mapValueInVOE as Gt, mapPTableDef as ut, isFunctionHandle as lt, normalizeBlockConfig as Te, DefaultNavigationState as Ht } from "@platforma-sdk/model";
1
+ var $t = Object.defineProperty;
2
+ var Gt = (o, e, t) => e in o ? $t(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var d = (o, e, t) => Gt(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { executePSpecPredicate as Ht, mapPObjectData as Q, mapValueInVOE as _t, mapPTableDef as dt, isFunctionHandle as pt, normalizeBlockConfig as Ee, DefaultNavigationState as Wt } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
- import { blockPackIdEquals as me } from "@milaboratories/pl-model-middle-layer";
6
+ import { blockPackIdEquals as ve } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
- import { request as G, RetryAgent as _t } from "undici";
9
- import { RegistryV1 as H, tryLoadPackDescription as dt, BlockPackMetaEmbedAbsoluteBytes as Wt, RegistryV2Reader as zt, folderReaderByUrl as Yt, loadPackDescription as _e } from "@platforma-sdk/block-tools";
8
+ import { request as G, RetryAgent as zt } from "undici";
9
+ import { RegistryV1 as H, tryLoadPackDescription as gt, BlockPackMetaEmbedAbsoluteBytes as Yt, RegistryV2Reader as qt, folderReaderByUrl as Qt, loadPackDescription as ze } from "@platforma-sdk/block-tools";
10
10
  import E from "node:fs";
11
11
  import I from "node:path";
12
- import qt from "yaml";
13
- import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as Qt, HmacSha256Signer as pt } from "@milaboratories/ts-helpers";
14
- import * as Zt from "node:fs/promises";
15
- import { tryResolve as Xt } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as U, field as S, Pl as b, PlClient as er, isNullResourceId as ce, ensureResourceIdNotNull as Se, isResource as tr, isResourceRef as rr, isNotNullResourceId as We, resourceType as te, resourceTypeToString as or, resourceIdToString as gt, isNotFoundError as sr, isTimeoutOrCancelError as ir, toGlobalResourceId as nr } from "@milaboratories/pl-client";
12
+ import Zt from "yaml";
13
+ import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as Xt, HmacSha256Signer as ht } from "@milaboratories/ts-helpers";
14
+ import * as er from "node:fs/promises";
15
+ import { tryResolve as tr } from "@milaboratories/resolve-helper";
16
+ import { resourceTypesEqual as U, field as S, Pl as b, PlClient as rr, isNullResourceId as Y, ensureResourceIdNotNull as ke, isResource as or, isResourceRef as sr, isNotNullResourceId as ue, resourceType as re, resourceTypeToString as ir, resourceIdToString as ft, isNotFoundError as nr, isTimeoutOrCancelError as ar, toGlobalResourceId as cr } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
- import { SynchronizedTreeState as ht, PlError as ar } from "@milaboratories/pl-tree";
19
- import { Computable as P, ChangeSource as ze, PollComputablePool as cr, WatchableValue as ur } from "@milaboratories/computable";
20
- import { randomUUID as Z, createHash as ge } from "node:crypto";
21
- import ft from "denque";
22
- import { Templates as lr } from "@platforma-sdk/workflow-tengo";
23
- import je from "canonicalize";
24
- import dr from "node:assert";
25
- import { Scope as ke, getQuickJS as pr } from "quickjs-emscripten";
26
- import { setTimeout as gr } from "node:timers/promises";
27
- import * as mt from "node:os";
28
- import { createDownloadClient as hr, createLogsClient as fr, createUploadBlobClient as mr, createUploadProgressClient as vr, createLsFilesClient as yr, DownloadDriver as br, UploadDriver as wr, LogsStreamDriver as Sr, LogsDriver as kr, LsDriver as Cr, DownloadUrlDriver as Pr } from "@milaboratories/pl-drivers";
29
- import { PFrame as Fr } from "@milaboratories/pframes-node";
30
- async function Ye(o) {
18
+ import { SynchronizedTreeState as mt, PlError as ur } from "@milaboratories/pl-tree";
19
+ import { Computable as P, ChangeSource as Ye, PollComputablePool as lr, WatchableValue as dr } from "@milaboratories/computable";
20
+ import { randomUUID as X, createHash as he } from "node:crypto";
21
+ import vt from "denque";
22
+ import { Templates as pr } from "@platforma-sdk/workflow-tengo";
23
+ import Ae from "canonicalize";
24
+ import gr from "node:assert";
25
+ import { Scope as Ce, getQuickJS as hr } from "quickjs-emscripten";
26
+ import { setTimeout as fr } from "node:timers/promises";
27
+ import * as yt from "node:os";
28
+ import { createDownloadClient as mr, createLogsClient as vr, createUploadBlobClient as yr, createUploadProgressClient as br, createLsFilesClient as wr, DownloadDriver as Sr, UploadDriver as kr, LogsStreamDriver as Cr, LogsDriver as Pr, LsDriver as Fr, DownloadUrlDriver as Br } from "@milaboratories/pl-drivers";
29
+ import { PFrame as Rr } from "@milaboratories/pframes-node";
30
+ async function qe(o) {
31
31
  try {
32
- return await Zt.stat(o, { bigint: !0 });
32
+ return await er.stat(o, { bigint: !0 });
33
33
  } catch (e) {
34
34
  if (e.code === "ENOENT")
35
35
  return;
36
36
  throw e;
37
37
  }
38
38
  }
39
- const Rr = [H.PlPackageYamlConfigFile], Br = [H.PlPackageJsonConfigFile], Ee = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ae = ["config", "dist", "config.json"], vt = ["frontend", "dist"], qe = "block-model/dist/config.json", Or = "block-ui/package.json", Dr = [
40
- Ee,
41
- Ae,
42
- Rr,
43
- Br,
44
- vt
39
+ const Or = [H.PlPackageYamlConfigFile], Dr = [H.PlPackageJsonConfigFile], Ie = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ne = ["config", "dist", "config.json"], bt = ["frontend", "dist"], Qe = "block-model/dist/config.json", xr = "block-ui/package.json", jr = [
40
+ Ie,
41
+ Ne,
42
+ Or,
43
+ Dr,
44
+ bt
45
45
  ];
46
- async function xr(o) {
47
- return await Ye(I.join(o, ...Ae)) !== void 0 || await Ye(I.join(o, ...Ee)) !== void 0;
46
+ async function Tr(o) {
47
+ return await qe(I.join(o, ...Ne)) !== void 0 || await qe(I.join(o, ...Ie)) !== void 0;
48
48
  }
49
- function ve(o, e) {
50
- const t = Xt(o, e);
49
+ function ye(o, e) {
50
+ const t = tr(o, e);
51
51
  if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
52
52
  return t;
53
53
  }
54
- async function Qe(o, e) {
55
- if (I.isAbsolute(o) || (o = I.resolve(o)), await xr(o))
54
+ async function Ze(o, e) {
55
+ if (I.isAbsolute(o) || (o = I.resolve(o)), await Tr(o))
56
56
  return {
57
- workflow: I.join(o, ...Ee),
58
- config: I.join(o, ...Ae),
59
- ui: I.join(o, ...vt)
57
+ workflow: I.join(o, ...Ie),
58
+ config: I.join(o, ...Ne),
59
+ ui: I.join(o, ...bt)
60
60
  };
61
61
  {
62
- const t = ve(o, qe), r = ve(o, qe), s = ve(o, Or);
62
+ const t = ye(o, Qe), r = ye(o, Qe), s = ye(o, xr);
63
63
  return { workflow: t, config: r, ui: I.resolve(s, "..", "dist") };
64
64
  }
65
65
  }
66
- async function Tr(o) {
66
+ async function Er(o) {
67
67
  try {
68
68
  return await E.promises.readFile(o, "utf8");
69
69
  } catch (e) {
@@ -72,7 +72,7 @@ async function Tr(o) {
72
72
  throw e;
73
73
  }
74
74
  }
75
- async function jr(o) {
75
+ async function Ar(o) {
76
76
  try {
77
77
  return await E.promises.stat(o, { bigint: !0 });
78
78
  } catch (e) {
@@ -81,21 +81,21 @@ async function jr(o) {
81
81
  throw e;
82
82
  }
83
83
  }
84
- async function yt(o) {
84
+ async function wt(o) {
85
85
  let e = 0n;
86
- for (const t of Dr) {
87
- const r = I.join(o, ...t), s = await jr(r);
86
+ for (const t of jr) {
87
+ const r = I.join(o, ...t), s = await Ar(r);
88
88
  s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
89
89
  }
90
90
  return e.toString();
91
91
  }
92
- async function Ie(o) {
92
+ async function Ve(o) {
93
93
  const e = await E.promises.stat(o.components.workflow.main.file, {
94
94
  bigint: !0
95
95
  }), t = await E.promises.stat(o.components.model.file, { bigint: !0 });
96
96
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
97
97
  }
98
- class ei {
98
+ class ii {
99
99
  constructor(e, t, r) {
100
100
  this.v2Provider = e, this.registries = t, this.http = r;
101
101
  }
@@ -141,11 +141,11 @@ class ei {
141
141
  case "local-dev":
142
142
  for (const a of await E.promises.readdir(r.path, { withFileTypes: !0 })) {
143
143
  if (!a.isDirectory()) continue;
144
- const c = I.join(r.path, a.name), u = await Tr(
144
+ const c = I.join(r.path, a.name), u = await Er(
145
145
  I.join(c, H.PlPackageYamlConfigFile)
146
146
  );
147
147
  if (u !== void 0) {
148
- const l = H.PlPackageConfigData.parse(qt.parse(u)), p = await yt(c), g = {
148
+ const l = H.PlPackageConfigData.parse(Zt.parse(u)), p = await wt(c), g = {
149
149
  organization: l.organization,
150
150
  name: l.package,
151
151
  version: "DEV"
@@ -169,13 +169,13 @@ class ei {
169
169
  otherVersions: []
170
170
  });
171
171
  } else {
172
- const l = await dt(c);
172
+ const l = await gt(c);
173
173
  if (l !== void 0) {
174
- const p = await Ie(l);
174
+ const p = await Ve(l);
175
175
  t.push({
176
176
  registryId: e.id,
177
177
  id: l.id,
178
- meta: await Wt.parseAsync(l.meta),
178
+ meta: await Yt.parseAsync(l.meta),
179
179
  spec: {
180
180
  type: "dev-v2",
181
181
  folder: c,
@@ -198,7 +198,7 @@ class ei {
198
198
  return { registries: t, blockPacks: e };
199
199
  }
200
200
  }
201
- class Er {
201
+ class Ir {
202
202
  constructor(e) {
203
203
  d(this, "registries", /* @__PURE__ */ new Map());
204
204
  this.http = e;
@@ -206,62 +206,62 @@ class Er {
206
206
  getRegistry(e) {
207
207
  const t = this.registries.get(e);
208
208
  if (t) return t;
209
- const r = new zt(Yt(e, this.http));
209
+ const r = new qt(Qt(e, this.http));
210
210
  return this.registries.set(e, r), r;
211
211
  }
212
212
  }
213
- const ti = {
213
+ const ni = {
214
214
  type: "remote-v2",
215
215
  url: "https://blocks.pl-open.science/"
216
- }, ri = {
216
+ }, ai = {
217
217
  type: "remote-v1",
218
218
  url: "https://block.registry.platforma.bio/releases"
219
- }, oi = {
219
+ }, ci = {
220
220
  type: "remote-v1",
221
221
  url: "https://block.registry.platforma.bio/dev"
222
- }, Ar = {
222
+ }, Nr = {
223
223
  groups: [{ id: "default", label: "Default", blocks: [] }]
224
- }, Ir = {
224
+ }, Vr = {
225
225
  stagingRefreshTimestamp: 0,
226
226
  blocksInLimbo: []
227
- }, Nr = {
227
+ }, Lr = {
228
228
  label: "New Project"
229
- }, Vr = { name: "UserProject", version: "2" }, bt = "SchemaVersion", wt = "1", Ne = "ProjectCreated", X = "ProjectLastModified", ee = "ProjectMeta", _ = "ProjectStructure", ue = "BlockRenderingState", Lr = "BlockFrontendState/", Jr = /^BlockFrontendState\/(?<blockid>.*)$/;
230
- function Ce(o) {
231
- return `${Lr}${o}`;
232
- }
233
- const Kr = "BlockArgsAuthor/";
229
+ }, Jr = { name: "UserProject", version: "2" }, St = "SchemaVersion", kt = "1", Le = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", _ = "ProjectStructure", le = "BlockRenderingState", Mr = "BlockFrontendState/", Kr = /^BlockFrontendState\/(?<blockid>.*)$/;
234
230
  function Pe(o) {
235
- return `${Kr}${o}`;
231
+ return `${Mr}${o}`;
236
232
  }
237
- const Fe = "ProjectStructureAuthor";
238
- function Mr(o) {
239
- const e = o.match(Jr);
233
+ const Ur = "BlockArgsAuthor/";
234
+ function Fe(o) {
235
+ return `${Ur}${o}`;
236
+ }
237
+ const Be = "ProjectStructureAuthor";
238
+ function $r(o) {
239
+ const e = o.match(Kr);
240
240
  if (e !== null)
241
241
  return e.groups.blockid;
242
242
  }
243
- const Ur = "__serviceTemplate_";
243
+ const Gr = "__serviceTemplate_";
244
244
  function Re(o) {
245
- return `${Ur}${o}`;
245
+ return `${Gr}${o}`;
246
246
  }
247
247
  function C(o, e) {
248
248
  return `${o}-${e}`;
249
249
  }
250
- const $r = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
251
- function Gr(o) {
252
- const e = o.match($r);
250
+ const Hr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
251
+ function _r(o) {
252
+ const e = o.match(Hr);
253
253
  if (e === null) return;
254
254
  const { blockId: t, fieldName: r } = e.groups;
255
255
  return { blockId: t, fieldName: r };
256
256
  }
257
- const Hr = "projects", St = { name: "Projects", version: "1" }, _r = (o) => U(o.type, St) ? o.fields : [];
258
- async function Wr(o, e, t, r) {
259
- const s = await ht.init(
257
+ const Wr = "projects", Ct = { name: "Projects", version: "1" }, zr = (o) => U(o.type, Ct) ? o.fields : [];
258
+ async function Yr(o, e, t, r) {
259
+ const s = await mt.init(
260
260
  o,
261
261
  e,
262
262
  {
263
263
  ...r.ops.defaultTreeOptions,
264
- pruning: _r
264
+ pruning: zr
265
265
  },
266
266
  r.logger
267
267
  );
@@ -272,7 +272,7 @@ async function Wr(o, e, t, r) {
272
272
  for (const l of a.listDynamicFields()) {
273
273
  const p = a.traverse(l);
274
274
  if (p === void 0) continue;
275
- const g = w(p.getKeyValueAsJson(ee)), f = w(p.getKeyValueAsJson(Ne)), v = w(p.getKeyValueAsJson(X));
275
+ const g = w(p.getKeyValueAsJson(te)), f = w(p.getKeyValueAsJson(Le)), v = w(p.getKeyValueAsJson(ee));
276
276
  u.push({
277
277
  id: l,
278
278
  rid: p.id,
@@ -285,40 +285,40 @@ async function Wr(o, e, t, r) {
285
285
  return u.sort((l) => -l.lastModified.valueOf()), u;
286
286
  }).withStableType(), tree: s };
287
287
  }
288
- const zr = {
288
+ const qr = {
289
289
  name: "EphRenderTemplate",
290
290
  version: "1"
291
- }, Yr = {
291
+ }, Qr = {
292
292
  name: "RenderTemplate",
293
293
  version: "1"
294
294
  };
295
- function kt(o, e, t, r, s) {
295
+ function Pt(o, e, t, r, s) {
296
296
  if (s.length === 0) throw new Error("Zero output names provided");
297
- const i = t ? o.createEphemeral(zr) : o.createStruct(Yr), n = S(i, "template"), a = S(i, "inputs");
297
+ const i = t ? o.createEphemeral(qr) : o.createStruct(Qr), n = S(i, "template"), a = S(i, "inputs");
298
298
  return o.createField(n, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(i), b.futureRecord(o, i, s, "Output", "outputs/");
299
299
  }
300
- const qr = { name: "BContextEnd", version: "1" }, Qr = { name: "BContext", version: "1" }, Zr = "id", Xr = "parent/", eo = ["context", "result"];
301
- function Ze(o, e, t) {
302
- return kt(o, e, !0, t, eo);
300
+ const Zr = { name: "BContextEnd", version: "1" }, Xr = { name: "BContext", version: "1" }, eo = "id", to = "parent/", ro = ["context", "result"];
301
+ function Xe(o, e, t) {
302
+ return Pt(o, e, !0, t, ro);
303
303
  }
304
- function to(o) {
305
- const e = o.createEphemeral(qr);
304
+ function oo(o) {
305
+ const e = o.createEphemeral(Zr);
306
306
  return o.lock(e), e;
307
307
  }
308
- function ro(o, e) {
309
- if (e.length === 0) return to(o);
308
+ function so(o, e) {
309
+ if (e.length === 0) return oo(o);
310
310
  if (e.length === 1) return e[0];
311
- const t = o.createEphemeral(Qr);
312
- o.createField(S(t, Zr), "Input", b.createPlString(o, Z()));
311
+ const t = o.createEphemeral(Xr);
312
+ o.createField(S(t, eo), "Input", b.createPlString(o, X()));
313
313
  for (let r = 0; r < e.length; r++)
314
- o.createField(S(t, `${Xr}${r}`), "Input", e[r]);
314
+ o.createField(S(t, `${to}${r}`), "Input", e[r]);
315
315
  return o.lock(t), t;
316
316
  }
317
- const oo = { name: "TengoTemplateGet", version: "1" }, so = "registry", io = "templateURI", no = "template", ao = { name: "TengoTemplatePack", version: "1" }, co = {
317
+ const io = { name: "TengoTemplateGet", version: "1" }, no = "registry", ao = "templateURI", co = "template", uo = { name: "TengoTemplatePack", version: "1" }, lo = {
318
318
  name: "TengoTemplatePackConvert",
319
319
  version: "1"
320
- }, uo = "templatePack", lo = "template";
321
- async function po(o) {
320
+ }, po = "templatePack", go = "template";
321
+ async function ho(o) {
322
322
  switch (o.type) {
323
323
  case "from-file":
324
324
  return {
@@ -332,38 +332,38 @@ async function po(o) {
332
332
  return O(o);
333
333
  }
334
334
  }
335
- function go(o, e) {
336
- const t = o.createStruct(oo), r = S(t, so), s = S(t, io), i = S(t, no);
335
+ function fo(o, e) {
336
+ const t = o.createStruct(io), r = S(t, no), s = S(t, ao), i = S(t, co);
337
337
  return o.setField(r, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), o.setField(s, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), i;
338
338
  }
339
- function ho(o, e) {
340
- const t = o.createValue(ao, e.content), r = o.createStruct(co), s = S(r, uo), i = S(r, lo);
339
+ function mo(o, e) {
340
+ const t = o.createValue(uo, e.content), r = o.createStruct(lo), s = S(r, po), i = S(r, go);
341
341
  return o.setField(s, t), i;
342
342
  }
343
- function Ve(o, e) {
343
+ function Je(o, e) {
344
344
  switch (e.type) {
345
345
  case "from-registry":
346
- return go(o, e);
346
+ return fo(o, e);
347
347
  case "explicit":
348
- return ho(o, e);
348
+ return mo(o, e);
349
349
  default:
350
350
  return O(e);
351
351
  }
352
352
  }
353
- const Ct = { name: "Frontend/FromUrl", version: "1" }, Pt = {
353
+ const Ft = { name: "Frontend/FromUrl", version: "1" }, Bt = {
354
354
  name: "Frontend/FromFolder",
355
355
  version: "1"
356
356
  };
357
- function fo(o, e) {
357
+ function vo(o, e) {
358
358
  switch (e.type) {
359
359
  case "url":
360
360
  return o.createValue(
361
- Ct,
361
+ Ft,
362
362
  JSON.stringify({ url: e.url })
363
363
  );
364
364
  case "local":
365
365
  return o.createValue(
366
- Pt,
366
+ Bt,
367
367
  JSON.stringify({
368
368
  path: e.path,
369
369
  signature: e.signature
@@ -373,11 +373,11 @@ function fo(o, e) {
373
373
  return O(e);
374
374
  }
375
375
  }
376
- const mo = { name: "BlockPackCustom", version: "1" }, Ft = "template", Rt = "frontend";
377
- function Xe(o) {
376
+ const yo = { name: "BlockPackCustom", version: "1" }, Rt = "template", Ot = "frontend";
377
+ function et(o) {
378
378
  return o.endsWith("/") ? o : `${o}/`;
379
379
  }
380
- class vo {
380
+ class bo {
381
381
  constructor(e, t, r) {
382
382
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
383
383
  }
@@ -386,17 +386,17 @@ class vo {
386
386
  case "explicit":
387
387
  return e.config;
388
388
  case "dev-v1": {
389
- const t = await Qe(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
389
+ const t = await Ze(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
390
390
  return JSON.parse(r);
391
391
  }
392
392
  case "dev-v2": {
393
- const t = await _e(e.folder), r = await E.promises.readFile(t.components.model.file, {
393
+ const t = await ze(e.folder), r = await E.promises.readFile(t.components.model.file, {
394
394
  encoding: "utf-8"
395
395
  });
396
396
  return JSON.parse(r);
397
397
  }
398
398
  case "from-registry-v1": {
399
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
399
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${et(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
400
400
  return await (await G(`${r}/config.json`, t)).body.json();
401
401
  }
402
402
  case "from-registry-v2": {
@@ -412,7 +412,7 @@ class vo {
412
412
  case "explicit":
413
413
  return e;
414
414
  case "dev-v1": {
415
- const t = await Qe(e.folder), r = await E.promises.readFile(t.workflow), s = JSON.parse(
415
+ const t = await Ze(e.folder), r = await E.promises.readFile(t.workflow), s = JSON.parse(
416
416
  await E.promises.readFile(t.config, "utf-8")
417
417
  ), i = t.ui;
418
418
  return {
@@ -431,14 +431,14 @@ class vo {
431
431
  };
432
432
  }
433
433
  case "dev-v2": {
434
- const t = await _e(e.folder), r = JSON.parse(
434
+ const t = await ze(e.folder), r = JSON.parse(
435
435
  await E.promises.readFile(t.components.model.file, {
436
436
  encoding: "utf-8"
437
437
  })
438
438
  ), s = await E.promises.readFile(
439
439
  t.components.workflow.main.file
440
440
  ), i = t.components.ui.folder, n = { ...e };
441
- return e.mtime === void 0 && (n.mtime = await Ie(t)), {
441
+ return e.mtime === void 0 && (n.mtime = await Ve(t)), {
442
442
  type: "explicit",
443
443
  template: {
444
444
  type: "explicit",
@@ -454,7 +454,7 @@ class vo {
454
454
  };
455
455
  }
456
456
  case "from-registry-v1": {
457
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await G(s, t);
457
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${et(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await G(s, t);
458
458
  if (i.statusCode !== 200)
459
459
  throw new Error(
460
460
  `Block not found in registry (url = ${s} ; code = ${i.statusCode}): ` + JSON.stringify(e)
@@ -495,25 +495,25 @@ class vo {
495
495
  }
496
496
  }
497
497
  }
498
- function yo(o, e) {
499
- const t = { config: e.config, source: e.source }, r = o.createStruct(mo, JSON.stringify(t));
500
- return o.createField(S(r, Ft), "Input", Ve(o, e.template)), o.createField(S(r, Rt), "Input", fo(o, e.frontend)), o.lock(r), r;
498
+ function wo(o, e) {
499
+ const t = { config: e.config, source: e.source }, r = o.createStruct(yo, JSON.stringify(t));
500
+ return o.createField(S(r, Rt), "Input", Je(o, e.template)), o.createField(S(r, Ot), "Input", vo(o, e.frontend)), o.lock(r), r;
501
501
  }
502
- function et(o, e) {
502
+ function tt(o, e) {
503
503
  switch (e.type) {
504
504
  case "explicit":
505
- return yo(o, e);
505
+ return wo(o, e);
506
506
  default:
507
507
  return O(e.type);
508
508
  }
509
509
  }
510
- function ie(o, e) {
510
+ function ne(o, e) {
511
511
  return { __isRef: !0, blockId: o, name: e };
512
512
  }
513
- function bo(o) {
513
+ function So(o) {
514
514
  return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
515
515
  }
516
- function Be(o, e, t) {
516
+ function Oe(o, e, t) {
517
517
  const r = typeof e;
518
518
  switch (r) {
519
519
  case "function":
@@ -526,21 +526,21 @@ function Be(o, e, t) {
526
526
  return;
527
527
  case "object":
528
528
  if (e === null) return;
529
- if (bo(e))
529
+ if (So(e))
530
530
  t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
531
531
  else if (Array.isArray(e))
532
- for (const s of e) Be(o, s, t);
532
+ for (const s of e) Oe(o, s, t);
533
533
  else
534
534
  for (const [, s] of Object.entries(e))
535
- Be(o, s, t);
535
+ Oe(o, s, t);
536
536
  return;
537
537
  default:
538
538
  O(r);
539
539
  }
540
540
  }
541
- function wo(o, e) {
541
+ function ko(o, e) {
542
542
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
543
- return Be(t, o, e), t;
543
+ return Oe(t, o, e), t;
544
544
  }
545
545
  function N(o) {
546
546
  return {
@@ -549,7 +549,7 @@ function N(o) {
549
549
  }
550
550
  };
551
551
  }
552
- class Bt {
552
+ class Dt {
553
553
  constructor(e) {
554
554
  /** Nodes are stored in the map in topological order */
555
555
  d(this, "nodes");
@@ -579,7 +579,7 @@ class Bt {
579
579
  }
580
580
  }
581
581
  }
582
- function Oe(o) {
582
+ function De(o) {
583
583
  const e = /* @__PURE__ */ new Map();
584
584
  let t;
585
585
  for (const { id: r } of N(o)) {
@@ -589,14 +589,14 @@ function Oe(o) {
589
589
  };
590
590
  e.set(r, s), t === void 0 ? s.upstream = /* @__PURE__ */ new Set() : (s.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([s.id])), t = s;
591
591
  }
592
- return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Bt(e);
592
+ return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Dt(e);
593
593
  }
594
- function ne(o, e) {
594
+ function ae(o, e) {
595
595
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
596
596
  for (const { id: s } of N(o)) {
597
597
  const i = e(s);
598
598
  if (i === void 0) continue;
599
- const n = wo(i, r), a = {
599
+ const n = ko(i, r), a = {
600
600
  id: s,
601
601
  missingReferences: n.missingReferences,
602
602
  upstream: n.upstreams,
@@ -605,41 +605,41 @@ function ne(o, e) {
605
605
  };
606
606
  t.set(s, a), n.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
607
607
  }
608
- return new Bt(t);
608
+ return new Dt(t);
609
609
  }
610
- function So(o, e) {
610
+ function Co(o, e) {
611
611
  if (o.size !== e.size) return !1;
612
612
  for (const t of o) if (!e.has(t)) return !1;
613
613
  return !0;
614
614
  }
615
- function De(o, e) {
616
- if (o.size > e.size) return De(e, o);
615
+ function xe(o, e) {
616
+ if (o.size > e.size) return xe(e, o);
617
617
  for (const t of o) if (e.has(t)) return !0;
618
618
  return !1;
619
619
  }
620
- function tt(o, e) {
620
+ function rt(o, e) {
621
621
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
622
622
  return o.nodes.forEach((i) => {
623
623
  const n = e.nodes.get(i.id);
624
- n === void 0 ? t.add(i.id) : (!So(i.upstream, n.upstream) || De(i.upstream, s)) && s.add(i.id);
624
+ n === void 0 ? t.add(i.id) : (!Co(i.upstream, n.upstream) || xe(i.upstream, s)) && s.add(i.id);
625
625
  }), e.nodes.forEach((i) => {
626
- o.nodes.has(i.id) ? De(i.upstream, s) && s.add(i.id) : r.add(i.id);
626
+ o.nodes.has(i.id) ? xe(i.upstream, s) && s.add(i.id) : r.add(i.id);
627
627
  }), { onlyInA: t, onlyInB: r, different: s };
628
628
  }
629
- let ye;
630
- async function Ot() {
631
- if (ye === void 0) {
632
- const o = await po(lr["pframes.export-pframe"]);
629
+ let be;
630
+ async function xt() {
631
+ if (be === void 0) {
632
+ const o = await ho(pr["pframes.export-pframe"]);
633
633
  if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
634
- const e = ge("sha256").update(o.content).digest("hex");
635
- ye = { spec: o, hash: e };
634
+ const e = he("sha256").update(o.content).digest("hex");
635
+ be = { spec: o, hash: e };
636
636
  }
637
- return ye;
637
+ return be;
638
638
  }
639
- function ko(o, e, t) {
640
- return kt(o, e, !0, { pf: t }, ["result"]).result;
639
+ function Po(o, e, t) {
640
+ return Pt(o, e, !0, { pf: t }, ["result"]).result;
641
641
  }
642
- function be(o, e) {
642
+ function we(o, e) {
643
643
  let t = !1, r, s;
644
644
  return () => {
645
645
  if (!t)
@@ -648,13 +648,13 @@ function be(o, e) {
648
648
  return r !== i && (r = i, s = e()), e();
649
649
  };
650
650
  }
651
- class rt {
651
+ class ot {
652
652
  constructor(e, t) {
653
- d(this, "currentInputsC", be(
653
+ d(this, "currentInputsC", we(
654
654
  () => this.fields.currentArgs.modCount,
655
655
  () => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
656
656
  ));
657
- d(this, "actualProductionInputsC", be(
657
+ d(this, "actualProductionInputsC", we(
658
658
  () => {
659
659
  var e;
660
660
  return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
@@ -666,7 +666,7 @@ class rt {
666
666
  return JSON.parse(Buffer.from(e).toString());
667
667
  }
668
668
  ));
669
- d(this, "productionStaleC", be(
669
+ d(this, "productionStaleC", we(
670
670
  () => {
671
671
  var e;
672
672
  return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
@@ -708,15 +708,15 @@ class rt {
708
708
  getTemplate(e) {
709
709
  return e.getFutureFieldValue(
710
710
  b.unwrapHolder(e, this.fields.blockPack.ref),
711
- Ft,
711
+ Rt,
712
712
  "Input"
713
713
  );
714
714
  }
715
715
  }
716
- const Co = (o) => {
716
+ const Fo = (o) => {
717
717
  throw new Error(`No new block info for ${o}`);
718
718
  };
719
- class le {
719
+ class de {
720
720
  constructor(e, t, r, s, i, n, a, c, u, l, p, g) {
721
721
  d(this, "globalModCount", 0);
722
722
  d(this, "fieldsChanged", !1);
@@ -750,16 +750,16 @@ class le {
750
750
  return JSON.parse(JSON.stringify(this.struct));
751
751
  }
752
752
  getStagingGraph() {
753
- return this.stagingGraph === void 0 && (this.stagingGraph = Oe(this.struct)), this.stagingGraph;
753
+ return this.stagingGraph === void 0 && (this.stagingGraph = De(this.struct)), this.stagingGraph;
754
754
  }
755
755
  getPendingProductionGraph() {
756
- return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ne(
756
+ return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ae(
757
757
  this.struct,
758
758
  (e) => this.getBlockInfo(e).currentInputs
759
759
  )), this.pendingProductionGraph;
760
760
  }
761
761
  getActualProductionGraph() {
762
- return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ne(
762
+ return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ae(
763
763
  this.struct,
764
764
  (e) => this.getBlockInfo(e).actualProductionInputs
765
765
  )), this.actualProductionGraph;
@@ -856,16 +856,16 @@ class le {
856
856
  if (i.fields[t] === void 0 || i.fields[t].ref === void 0)
857
857
  throw new Error("One of the upstreams staging is not rendered.");
858
858
  r.push(b.unwrapHolder(this.tx, i.fields[t].ref));
859
- }), ro(this.tx, r);
859
+ }), so(this.tx, r);
860
860
  }
861
861
  exportCtx(e) {
862
- return ko(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
862
+ return Po(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
863
863
  }
864
864
  renderStagingFor(e) {
865
865
  this.resetStaging(e);
866
866
  const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
867
867
  if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
868
- const s = t.getTemplate(this.tx), i = Ze(this.tx, s, {
868
+ const s = t.getTemplate(this.tx), i = Xe(this.tx, s, {
869
869
  args: t.fields.currentArgs.ref,
870
870
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
871
871
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
@@ -886,7 +886,7 @@ class le {
886
886
  );
887
887
  if (this.getBlock(e).renderingMode === "Light")
888
888
  throw new Error("Can't render production for light block.");
889
- const s = t.getTemplate(this.tx), i = Ze(this.tx, s, {
889
+ const s = t.getTemplate(this.tx), i = Xe(this.tx, s, {
890
890
  args: t.fields.currentArgs.ref,
891
891
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
892
892
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
@@ -903,22 +903,22 @@ class le {
903
903
  // Structure changes
904
904
  //
905
905
  /** Very generic method, better check for more specialized case-specific methods first. */
906
- updateStructure(e, t = Co) {
907
- const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Oe(e), n = ne(
906
+ updateStructure(e, t = Fo) {
907
+ const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = De(e), n = ae(
908
908
  e,
909
909
  (u) => {
910
910
  var l;
911
911
  return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
912
912
  }
913
- ), a = tt(r, i), c = tt(s, n);
913
+ ), a = rt(r, i), c = rt(s, n);
914
914
  for (const u of a.onlyInA) {
915
915
  const { fields: l } = this.getBlockInfo(u);
916
916
  this.deleteBlockFields(u, ...Object.keys(l)), this.blockInfos.delete(u), this.blocksInLimbo.delete(u) && (this.renderingStateChanged = !0), this.blockFrontendStates.delete(u) && this.changedBlockFrontendStates.add(u);
917
917
  }
918
918
  for (const u of a.onlyInB) {
919
- const l = new rt(u, {});
919
+ const l = new ot(u, {});
920
920
  this.blockInfos.set(u, l);
921
- const p = t(u), g = et(this.tx, p.blockPack);
921
+ const p = t(u), g = tt(this.tx, p.blockPack);
922
922
  this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
923
923
  const f = Buffer.from(p.args), v = this.tx.createValue(b.JsonObject, f);
924
924
  this.setBlockField(u, "currentArgs", v, "Ready", f), l.check();
@@ -972,7 +972,7 @@ class le {
972
972
  this.setBlockField(
973
973
  e,
974
974
  "blockPack",
975
- b.wrapInHolder(this.tx, et(this.tx, t)),
975
+ b.wrapInHolder(this.tx, tt(this.tx, t)),
976
976
  "NotReady"
977
977
  ), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)), s.productionRendered && this.getActualProductionGraph().traverse(
978
978
  "downstream",
@@ -1018,7 +1018,7 @@ class le {
1018
1018
  * accordingly */
1019
1019
  stopProduction(...e) {
1020
1020
  var n, a;
1021
- const t = this.getActualProductionGraph(), r = new ft(e), s = new Set(e), i = [];
1021
+ const t = this.getActualProductionGraph(), r = new vt(e), s = new Set(e), i = [];
1022
1022
  for (; !r.isEmpty(); ) {
1023
1023
  const c = r.shift(), u = this.getBlockInfo(c).fields;
1024
1024
  if (!(((n = u.prodOutput) == null ? void 0 : n.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
@@ -1078,35 +1078,35 @@ class le {
1078
1078
  assignAuthorMarkers() {
1079
1079
  const e = this.author ? JSON.stringify(this.author) : void 0;
1080
1080
  for (const t of this.blocksWithChangedInputs)
1081
- e === void 0 ? this.tx.deleteKValue(this.rid, Pe(t)) : this.tx.setKValue(this.rid, Pe(t), e);
1082
- (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Fe) : this.tx.setKValue(this.rid, Fe, e));
1081
+ e === void 0 ? this.tx.deleteKValue(this.rid, Fe(t)) : this.tx.setKValue(this.rid, Fe(t), e);
1082
+ (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Be) : this.tx.setKValue(this.rid, Be, e));
1083
1083
  }
1084
1084
  save() {
1085
1085
  if (this.wasModified) {
1086
- this.lastModifiedChanged && this.tx.setKValue(this.rid, X, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, _, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1086
+ this.lastModifiedChanged && this.tx.setKValue(this.rid, ee, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, _, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1087
1087
  this.rid,
1088
- ue,
1088
+ le,
1089
1089
  JSON.stringify({
1090
1090
  ...this.renderingState,
1091
1091
  blocksInLimbo: [...this.blocksInLimbo]
1092
1092
  })
1093
- ), this.metaChanged && this.tx.setKValue(this.rid, ee, JSON.stringify(this.meta));
1093
+ ), this.metaChanged && this.tx.setKValue(this.rid, te, JSON.stringify(this.meta));
1094
1094
  for (const e of this.changedBlockFrontendStates) {
1095
1095
  const t = this.blockFrontendStates.get(e);
1096
- t === void 0 ? this.tx.deleteKValue(this.rid, Ce(e)) : this.tx.setKValue(this.rid, Ce(e), t);
1096
+ t === void 0 ? this.tx.deleteKValue(this.rid, Pe(e)) : this.tx.setKValue(this.rid, Pe(e), t);
1097
1097
  }
1098
1098
  this.assignAuthorMarkers();
1099
1099
  }
1100
1100
  }
1101
1101
  static async load(e, t, r) {
1102
- const s = e.getResourceData(t, !0), i = e.getKValueJson(t, bt), n = e.getKValueJson(t, X), a = e.getKValueJson(t, ee), c = e.getKValueJson(t, _), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
1102
+ const s = e.getResourceData(t, !0), i = e.getKValueJson(t, St), n = e.getKValueJson(t, ee), a = e.getKValueJson(t, te), c = e.getKValueJson(t, _), u = e.getKValueJson(t, le), l = e.listKeyValuesString(t), [
1103
1103
  p,
1104
1104
  g,
1105
1105
  f,
1106
1106
  v,
1107
1107
  D,
1108
- { stagingRefreshTimestamp: V, blocksInLimbo: K },
1109
- re
1108
+ { stagingRefreshTimestamp: V, blocksInLimbo: M },
1109
+ oe
1110
1110
  ] = await Promise.all([
1111
1111
  s,
1112
1112
  i,
@@ -1116,61 +1116,61 @@ class le {
1116
1116
  u,
1117
1117
  l
1118
1118
  ]);
1119
- if (g !== wt)
1119
+ if (g !== kt)
1120
1120
  throw new Error(
1121
1121
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1122
1122
  );
1123
1123
  const $ = /* @__PURE__ */ new Map();
1124
1124
  for (const y of p.fields) {
1125
- const B = Gr(y.name);
1126
- if (B === void 0) continue;
1127
- let F = $.get(B.blockId);
1125
+ const R = _r(y.name);
1126
+ if (R === void 0) continue;
1127
+ let F = $.get(R.blockId);
1128
1128
  F === void 0 && (F = {
1129
- id: B.blockId,
1129
+ id: R.blockId,
1130
1130
  fields: {}
1131
- }, $.set(B.blockId, F)), F.fields[B.fieldName] = ce(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1131
+ }, $.set(R.blockId, F)), F.fields[R.fieldName] = Y(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1132
1132
  }
1133
- const W = await Ot(), oe = Re(W.hash), k = p.fields.find(
1134
- (y) => y.name === oe
1133
+ const W = await xt(), se = Re(W.hash), k = p.fields.find(
1134
+ (y) => y.name === se
1135
1135
  );
1136
1136
  let J;
1137
- k !== void 0 ? J = Se(k.value) : (J = b.wrapInHolder(e, Ve(e, W.spec)), e.createField(
1137
+ k !== void 0 ? J = ke(k.value) : (J = b.wrapInHolder(e, Je(e, W.spec)), e.createField(
1138
1138
  S(t, Re(W.hash)),
1139
1139
  "Dynamic",
1140
1140
  J
1141
1141
  ));
1142
- const z = { stagingRefreshTimestamp: V }, j = new Set(K), x = /* @__PURE__ */ new Map();
1143
- for (const y of re) {
1144
- const B = Mr(y.key);
1145
- B !== void 0 && x.set(B, y.value);
1142
+ const z = { stagingRefreshTimestamp: V }, T = new Set(M), x = /* @__PURE__ */ new Map();
1143
+ for (const y of oe) {
1144
+ const R = $r(y.key);
1145
+ R !== void 0 && x.set(R, y.value);
1146
1146
  }
1147
- const R = [];
1148
- $.forEach(({ id: y, fields: B }) => {
1149
- for (const [, F] of Object.entries(B))
1147
+ const B = [];
1148
+ $.forEach(({ id: y, fields: R }) => {
1149
+ for (const [, F] of Object.entries(R))
1150
1150
  if (F.ref !== void 0) {
1151
- if (!tr(F.ref) || rr(F.ref))
1151
+ if (!or(F.ref) || sr(F.ref))
1152
1152
  throw new Error("unexpected behaviour");
1153
- R.push([F, e.getResourceData(F.ref, !1)]);
1153
+ B.push([F, e.getResourceData(F.ref, !1)]);
1154
1154
  }
1155
1155
  });
1156
- for (const [y, B] of R) {
1157
- const F = await B;
1158
- y.value = F.data, We(F.error) ? y.status = "Error" : F.resourceReady || We(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1156
+ for (const [y, R] of B) {
1157
+ const F = await R;
1158
+ y.value = F.data, ue(F.error) ? y.status = "Error" : F.resourceReady || ue(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1159
1159
  }
1160
- const M = /* @__PURE__ */ new Map();
1161
- $.forEach(({ id: y, fields: B }) => M.set(y, new rt(y, B)));
1160
+ const K = /* @__PURE__ */ new Map();
1161
+ $.forEach(({ id: y, fields: R }) => K.set(y, new ot(y, R)));
1162
1162
  const L = /* @__PURE__ */ new Set();
1163
1163
  for (const y of N(D)) {
1164
- if (!M.has(y.id))
1164
+ if (!K.has(y.id))
1165
1165
  throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1166
1166
  L.add(y.id);
1167
1167
  }
1168
- M.forEach((y) => {
1168
+ K.forEach((y) => {
1169
1169
  if (!L.has(y.id))
1170
1170
  throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
1171
1171
  y.check();
1172
1172
  });
1173
- const se = new le(
1173
+ const ie = new de(
1174
1174
  t,
1175
1175
  e,
1176
1176
  r,
@@ -1179,41 +1179,41 @@ class le {
1179
1179
  v,
1180
1180
  D,
1181
1181
  z,
1182
- j,
1183
- M,
1182
+ T,
1183
+ K,
1184
1184
  x,
1185
1185
  J
1186
1186
  );
1187
- return se.fixProblems(), se;
1187
+ return ie.fixProblems(), ie;
1188
1188
  }
1189
1189
  }
1190
- async function Po(o, e = Nr) {
1191
- const t = o.createEphemeral(Vr);
1190
+ async function Bo(o, e = Lr) {
1191
+ const t = o.createEphemeral(Jr);
1192
1192
  o.lock(t);
1193
1193
  const r = String(Date.now());
1194
- o.setKValue(t, bt, JSON.stringify(wt)), o.setKValue(t, Ne, r), o.setKValue(t, X, r), o.setKValue(t, ee, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Ar)), o.setKValue(t, ue, JSON.stringify(Ir));
1195
- const s = await Ot();
1194
+ o.setKValue(t, St, JSON.stringify(kt)), o.setKValue(t, Le, r), o.setKValue(t, ee, r), o.setKValue(t, te, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Nr)), o.setKValue(t, le, JSON.stringify(Vr));
1195
+ const s = await xt();
1196
1196
  return o.createField(
1197
1197
  S(t, Re(s.hash)),
1198
1198
  "Dynamic",
1199
- b.wrapInHolder(o, Ve(o, s.spec))
1199
+ b.wrapInHolder(o, Je(o, s.spec))
1200
1200
  ), t;
1201
1201
  }
1202
- async function we(o, e, t) {
1202
+ async function Se(o, e, t) {
1203
1203
  return A(o, e, void 0, t);
1204
1204
  }
1205
1205
  async function A(o, e, t, r) {
1206
- if (o instanceof er)
1206
+ if (o instanceof rr)
1207
1207
  return await o.withWriteTx("ProjectAction", async (s) => {
1208
- const i = await le.load(s, e, t), n = await r(i);
1208
+ const i = await de.load(s, e, t), n = await r(i);
1209
1209
  return i.wasModified && (i.save(), await s.commit()), n;
1210
1210
  });
1211
1211
  {
1212
- const s = await le.load(o, e, t), i = await r(s);
1212
+ const s = await de.load(o, e, t), i = await r(s);
1213
1213
  return s.save(), i;
1214
1214
  }
1215
1215
  }
1216
- function* Fo(o) {
1216
+ function* Ro(o) {
1217
1217
  switch (o.type) {
1218
1218
  case "Json":
1219
1219
  return;
@@ -1228,21 +1228,21 @@ function* Fo(o) {
1228
1228
  O(o);
1229
1229
  }
1230
1230
  }
1231
- function ot(o, e) {
1231
+ function st(o, e) {
1232
1232
  return Object.fromEntries(
1233
1233
  Object.entries(o).map(([t, r]) => [t, e(r, t)])
1234
1234
  );
1235
1235
  }
1236
- function Ro(o, e) {
1236
+ function Oo(o, e) {
1237
1237
  switch (o.type) {
1238
1238
  case "Json":
1239
1239
  return { ...o };
1240
1240
  case "JsonPartitioned":
1241
- return { ...o, parts: ot(o.parts, e) };
1241
+ return { ...o, parts: st(o.parts, e) };
1242
1242
  case "BinaryPartitioned":
1243
1243
  return {
1244
1244
  ...o,
1245
- parts: ot(o.parts, (t) => ({
1245
+ parts: st(o.parts, (t) => ({
1246
1246
  index: e(t.index),
1247
1247
  values: e(t.values)
1248
1248
  }))
@@ -1251,26 +1251,26 @@ function Ro(o, e) {
1251
1251
  O(o);
1252
1252
  }
1253
1253
  }
1254
- const Bo = te("PColumnData/JsonPartitioned", "1"), Oo = te(
1254
+ const Do = re("PColumnData/JsonPartitioned", "1"), xo = re(
1255
1255
  "PColumnData/Partitioned/JsonPartitioned",
1256
1256
  "1"
1257
- ), Do = te("PColumnData/BinaryPartitioned", "1"), xo = te(
1257
+ ), jo = re("PColumnData/BinaryPartitioned", "1"), To = re(
1258
1258
  "PColumnData/Partitioned/BinaryPartitioned",
1259
1259
  "1"
1260
- ), To = te("PColumnData/Json", "1");
1261
- function jo(o) {
1260
+ ), Eo = re("PColumnData/Json", "1");
1261
+ function Ao(o) {
1262
1262
  if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
1263
1263
  const e = o.getDataAsJson();
1264
1264
  if (e === void 0)
1265
1265
  throw new Error("unexpected data info structure, no resource data");
1266
- if (U(o.resourceType, To)) {
1266
+ if (U(o.resourceType, Eo)) {
1267
1267
  const t = e;
1268
1268
  return {
1269
1269
  type: "Json",
1270
1270
  keyLength: t.keyLength,
1271
1271
  data: t.data
1272
1272
  };
1273
- } else if (U(o.resourceType, Bo)) {
1273
+ } else if (U(o.resourceType, Do)) {
1274
1274
  const t = e, r = Object.fromEntries(
1275
1275
  o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
1276
1276
  );
@@ -1279,7 +1279,7 @@ function jo(o) {
1279
1279
  partitionKeyLength: t.partitionKeyLength,
1280
1280
  parts: r
1281
1281
  };
1282
- } else if (U(o.resourceType, Oo)) {
1282
+ } else if (U(o.resourceType, xo)) {
1283
1283
  const t = e, r = {};
1284
1284
  for (const s of o.listInputFields()) {
1285
1285
  const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
@@ -1294,7 +1294,7 @@ function jo(o) {
1294
1294
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1295
1295
  parts: r
1296
1296
  };
1297
- } else if (U(o.resourceType, Do)) {
1297
+ } else if (U(o.resourceType, jo)) {
1298
1298
  const t = e, r = {};
1299
1299
  for (const s of o.listInputFields())
1300
1300
  if (s.endsWith(".index")) {
@@ -1315,7 +1315,7 @@ function jo(o) {
1315
1315
  partitionKeyLength: t.partitionKeyLength,
1316
1316
  parts: r
1317
1317
  };
1318
- } else if (U(o.resourceType, xo)) {
1318
+ } else if (U(o.resourceType, To)) {
1319
1319
  const t = e, r = {};
1320
1320
  for (const s of o.listInputFields()) {
1321
1321
  const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
@@ -1343,13 +1343,13 @@ function jo(o) {
1343
1343
  parts: r
1344
1344
  };
1345
1345
  }
1346
- throw new Error(`unsupported resource type: ${or(o.resourceType)}`);
1346
+ throw new Error(`unsupported resource type: ${ir(o.resourceType)}`);
1347
1347
  }
1348
- function Dt(o, e) {
1349
- const t = ge("sha256");
1350
- return t.update(je(o)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1348
+ function jt(o, e) {
1349
+ const t = he("sha256");
1350
+ return t.update(Ae(o)), t.update(String(Y(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1351
1351
  }
1352
- function xt(o, e = !0, t = !1, r = "") {
1352
+ function Tt(o, e = !0, t = !1, r = "") {
1353
1353
  var a, c, u;
1354
1354
  const s = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
1355
1355
  for (const l of o.listInputFields()) {
@@ -1388,10 +1388,10 @@ function xt(o, e = !0, t = !1, r = "") {
1388
1388
  for (const [, l] of i) l.data === void 0 && (l.hasData = !1);
1389
1389
  return { locked: n, results: i };
1390
1390
  }
1391
- function Eo(o, e = !0, t = "") {
1391
+ function Io(o, e = !0, t = "") {
1392
1392
  if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1393
- const r = xt(o, e, !1, t);
1394
- dr(r.locked);
1393
+ const r = Tt(o, e, !1, t);
1394
+ gr(r.locked);
1395
1395
  const s = {};
1396
1396
  for (const [i, n] of r.results) {
1397
1397
  if (n.spec === void 0) throw new Error(`no spec for key ${i}`);
@@ -1399,16 +1399,16 @@ function Eo(o, e = !0, t = "") {
1399
1399
  throw new Error(`no data for key ${i}`);
1400
1400
  const a = n.data();
1401
1401
  if (a === void 0) throw new Error(`no data for key ${i}`);
1402
- if (!a.ok) throw new ar(a.error);
1402
+ if (!a.ok) throw new ur(a.error);
1403
1403
  s[i] = {
1404
- id: Dt(n.spec, a.value),
1404
+ id: jt(n.spec, a.value),
1405
1405
  spec: n.spec,
1406
1406
  data: a.value
1407
1407
  };
1408
1408
  }
1409
1409
  return s;
1410
1410
  }
1411
- class Le {
1411
+ class Me {
1412
1412
  constructor(e, t) {
1413
1413
  d(this, "allSpecsAvailable");
1414
1414
  this.ctx = e, this.blocks = t;
@@ -1458,9 +1458,9 @@ class Le {
1458
1458
  if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
1459
1459
  const u = c.data();
1460
1460
  u !== void 0 ? e.push({
1461
- ref: ie(n, a),
1461
+ ref: ne(n, a),
1462
1462
  obj: {
1463
- id: u.ok ? Dt(c.spec, u.value) : void 0,
1463
+ id: u.ok ? jt(c.spec, u.value) : void 0,
1464
1464
  spec: c.spec,
1465
1465
  data: u
1466
1466
  }
@@ -1494,7 +1494,7 @@ class Le {
1494
1494
  n.staging.locked || s(`staging_not_locked:${i}`);
1495
1495
  for (const [c, u] of n.staging.results)
1496
1496
  u.spec !== void 0 && (e.push({
1497
- ref: ie(i, c),
1497
+ ref: ne(i, c),
1498
1498
  obj: u.spec
1499
1499
  }), a.add(c));
1500
1500
  } else s(`staging_not_rendered:${i}`);
@@ -1502,7 +1502,7 @@ class Le {
1502
1502
  n.prod.locked || s(`prod_not_locked:${i}`);
1503
1503
  for (const [c, u] of n.prod.results)
1504
1504
  a.has(c) || u.spec !== void 0 && e.push({
1505
- ref: ie(i, c),
1505
+ ref: ne(i, c),
1506
1506
  obj: u.spec
1507
1507
  });
1508
1508
  }
@@ -1514,9 +1514,9 @@ class Le {
1514
1514
  for (const r of this.blocks.values()) {
1515
1515
  const s = /* @__PURE__ */ new Set(), i = (n) => {
1516
1516
  for (const [a, c] of n.results)
1517
- s.has(a) || c.spec === void 0 || (s.add(a), $t(e, c.spec) && t.push({
1517
+ s.has(a) || c.spec === void 0 || (s.add(a), Ht(e, c.spec) && t.push({
1518
1518
  label: r.info.label + " / " + a,
1519
- ref: ie(r.info.id, a),
1519
+ ref: ne(r.info.id, a),
1520
1520
  spec: c.spec
1521
1521
  }));
1522
1522
  };
@@ -1525,10 +1525,10 @@ class Le {
1525
1525
  return t;
1526
1526
  }
1527
1527
  static create(e, t, r) {
1528
- const s = e.accessor(t).node(), i = w(s.getKeyValueAsJson(_)), a = Oe(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1528
+ const s = e.accessor(t).node(), i = w(s.getKeyValueAsJson(_)), a = De(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1529
1529
  for (const u of N(i)) {
1530
1530
  if (!a.has(u.id)) continue;
1531
- const l = st(
1531
+ const l = it(
1532
1532
  s.traverse({
1533
1533
  field: C(u.id, "prodCtx"),
1534
1534
  ignoreError: !0,
@@ -1539,7 +1539,7 @@ class Le {
1539
1539
  field: C(u.id, "prodUiCtx"),
1540
1540
  stableIfNotFound: !0
1541
1541
  })
1542
- ), p = st(
1542
+ ), p = it(
1543
1543
  s.traverse({
1544
1544
  field: C(u.id, "stagingCtx"),
1545
1545
  ignoreError: !0,
@@ -1551,21 +1551,21 @@ class Le {
1551
1551
  );
1552
1552
  c.set(u.id, { info: u, prod: l, staging: p });
1553
1553
  }
1554
- return new Le(e, c);
1554
+ return new Me(e, c);
1555
1555
  }
1556
1556
  }
1557
- function st(o, e) {
1557
+ function it(o, e) {
1558
1558
  if (e === void 0)
1559
1559
  return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1560
- if (e.ok) return xt(e.value, !1, !0);
1560
+ if (e.ok) return Tt(e.value, !1, !0);
1561
1561
  }
1562
- function Je(o, e) {
1562
+ function Ke(o, e) {
1563
1563
  const t = o.persist(), r = w(
1564
1564
  o.traverse({
1565
1565
  field: C(e, "currentArgs"),
1566
1566
  errorIfFieldNotSet: !0
1567
1567
  }).getDataAsString()
1568
- ), s = o.getKeyValueAsString(Ce(e));
1568
+ ), s = o.getKeyValueAsString(Pe(e));
1569
1569
  return {
1570
1570
  blockId: e,
1571
1571
  args: r,
@@ -1577,10 +1577,10 @@ function Je(o, e) {
1577
1577
  }
1578
1578
  };
1579
1579
  }
1580
- function Tt(o, e) {
1580
+ function Et(o, e) {
1581
1581
  const t = o.persist();
1582
1582
  return {
1583
- ...Je(o, e),
1583
+ ...Ke(o, e),
1584
1584
  prod: (r) => {
1585
1585
  var s;
1586
1586
  return (s = r.accessor(t).node({ ignoreError: !0 }).traverse({
@@ -1597,31 +1597,31 @@ function Tt(o, e) {
1597
1597
  })) == null ? void 0 : i.persist();
1598
1598
  return s === void 0 && r.markUnstable("staging_not_rendered"), s;
1599
1599
  },
1600
- getResultsPool: (r) => Le.create(r, t, e)
1600
+ getResultsPool: (r) => Me.create(r, t, e)
1601
1601
  };
1602
1602
  }
1603
- function* T(o, e) {
1603
+ function* j(o, e) {
1604
1604
  switch (yield o, o.type) {
1605
1605
  case "GetFromCtx":
1606
1606
  case "Immediate":
1607
1607
  return;
1608
1608
  case "Isolate":
1609
- yield* T(o.cfg);
1609
+ yield* j(o.cfg);
1610
1610
  return;
1611
1611
  case "MakeObject":
1612
- for (const [, t] of Object.entries(o.template)) yield* T(t);
1612
+ for (const [, t] of Object.entries(o.template)) yield* j(t);
1613
1613
  return;
1614
1614
  case "MakeArray":
1615
- for (const t of o.template) yield* T(t);
1615
+ for (const t of o.template) yield* j(t);
1616
1616
  return;
1617
1617
  case "GetJsonField":
1618
1618
  case "GetResourceField":
1619
- yield* T(o.source), yield* T(o.field);
1619
+ yield* j(o.source), yield* j(o.field);
1620
1620
  return;
1621
1621
  case "MapRecordValues":
1622
1622
  case "MapArrayValues":
1623
1623
  case "MapResourceFields":
1624
- yield* T(o.source), yield* T(o.mapping);
1624
+ yield* j(o.source), yield* j(o.mapping);
1625
1625
  return;
1626
1626
  case "Flatten":
1627
1627
  case "GetResourceValueAsJson":
@@ -1634,31 +1634,31 @@ function* T(o, e) {
1634
1634
  case "GetLastLogs":
1635
1635
  case "GetProgressLog":
1636
1636
  case "GetLogHandle":
1637
- yield* T(o.source);
1637
+ yield* j(o.source);
1638
1638
  return;
1639
1639
  case "IsEmpty":
1640
- yield* T(o.arg);
1640
+ yield* j(o.arg);
1641
1641
  return;
1642
1642
  case "Not":
1643
- yield* T(o.operand);
1643
+ yield* j(o.operand);
1644
1644
  return;
1645
1645
  case "And":
1646
1646
  case "Or":
1647
- yield* T(o.operand1), yield* T(o.operand2);
1647
+ yield* j(o.operand1), yield* j(o.operand2);
1648
1648
  return;
1649
1649
  default:
1650
1650
  O(o);
1651
1651
  }
1652
1652
  }
1653
- function Ao(o, e) {
1653
+ function No(o, e) {
1654
1654
  const t = {};
1655
1655
  for (const [r, s] of Object.entries(o)) t[r] = e(s);
1656
1656
  return t;
1657
1657
  }
1658
- function de(o, e) {
1658
+ function pe(o, e) {
1659
1659
  return o === void 0 ? void 0 : e(o);
1660
1660
  }
1661
- function Io(o) {
1661
+ function Vo(o) {
1662
1662
  switch (o.type) {
1663
1663
  case "GetImportProgress":
1664
1664
  return !0;
@@ -1666,60 +1666,60 @@ function Io(o) {
1666
1666
  return !1;
1667
1667
  }
1668
1668
  }
1669
- function No(o) {
1670
- for (const e of T(o)) if (Io(e)) return !0;
1669
+ function Lo(o) {
1670
+ for (const e of j(o)) if (Vo(e)) return !0;
1671
1671
  return !1;
1672
1672
  }
1673
- function he(o) {
1673
+ function fe(o) {
1674
1674
  return {
1675
1675
  type: "ReturnResult",
1676
1676
  result: o
1677
1677
  };
1678
1678
  }
1679
1679
  function h(o) {
1680
- return () => he(o);
1680
+ return () => fe(o);
1681
1681
  }
1682
- const Vo = (o) => {
1682
+ const Jo = (o) => {
1683
1683
  const e = {};
1684
1684
  for (const [t, r] of Object.entries(o)) e[t] = r;
1685
1685
  return h(e);
1686
- }, Lo = (o) => {
1686
+ }, Mo = (o) => {
1687
1687
  const e = o.source;
1688
1688
  if (e === void 0) return h(void 0);
1689
1689
  const t = [];
1690
1690
  for (const r of e)
1691
1691
  r instanceof Array ? t.push(...r) : t.push(r);
1692
1692
  return h(t);
1693
- }, Jo = (o) => {
1693
+ }, Ko = (o) => {
1694
1694
  const e = o.source, t = o.field;
1695
1695
  return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
1696
1696
  var s;
1697
- return he((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1697
+ return fe((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1698
1698
  };
1699
1699
  };
1700
- function jt(o, e) {
1700
+ function At(o, e) {
1701
1701
  const t = {}, r = o.length;
1702
1702
  for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
1703
1703
  return t;
1704
1704
  }
1705
- function Ko(o, e) {
1705
+ function Uo(o, e) {
1706
1706
  return (t) => {
1707
1707
  const r = t.source;
1708
1708
  return r === void 0 ? h(void 0) : () => ({
1709
1709
  type: "ScheduleSubroutine",
1710
- subroutine: Et(r.length),
1711
- args: jt(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
1710
+ subroutine: It(r.length),
1711
+ args: At(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
1712
1712
  });
1713
1713
  };
1714
1714
  }
1715
- function Et(o) {
1715
+ function It(o) {
1716
1716
  return (e) => {
1717
1717
  const t = [];
1718
1718
  for (let r = 0; r < o; r++) t.push(e[String(r)]);
1719
1719
  return h(t);
1720
1720
  };
1721
1721
  }
1722
- function Mo(o, e) {
1722
+ function $o(o, e) {
1723
1723
  return (t) => {
1724
1724
  const r = t.source;
1725
1725
  if (r === void 0) return h(void 0);
@@ -1730,34 +1730,34 @@ function Mo(o, e) {
1730
1730
  }
1731
1731
  return () => ({
1732
1732
  type: "ScheduleSubroutine",
1733
- subroutine: Uo,
1733
+ subroutine: Go,
1734
1734
  args: s
1735
1735
  });
1736
1736
  };
1737
1737
  }
1738
- const Uo = (o) => h(o), $o = (o) => {
1738
+ const Go = (o) => h(o), Ho = (o) => {
1739
1739
  const e = o.arg;
1740
1740
  return h(e === void 0 ? void 0 : e.length === 0);
1741
- }, Go = (o) => {
1741
+ }, _o = (o) => {
1742
1742
  const e = o.operand;
1743
1743
  return h(e === void 0 ? void 0 : !e);
1744
- }, Ho = (o) => {
1744
+ }, Wo = (o) => {
1745
1745
  const e = o.operand1, t = o.operand2;
1746
1746
  return h(e === void 0 || t === void 0 ? void 0 : e && t);
1747
- }, _o = (o) => {
1747
+ }, zo = (o) => {
1748
1748
  const e = o.operand1, t = o.operand2;
1749
1749
  return h(e === void 0 || t === void 0 ? void 0 : e || t);
1750
- }, Wo = (o) => {
1750
+ }, Yo = (o) => {
1751
1751
  const e = o.source;
1752
1752
  return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
1753
1753
  var r;
1754
- return he((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1754
+ return fe((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1755
1755
  };
1756
- }, zo = (o) => {
1756
+ }, qo = (o) => {
1757
1757
  const e = o.source, t = o.field;
1758
1758
  return h(e === void 0 || t === void 0 ? void 0 : e[t]);
1759
1759
  };
1760
- function Yo(o, e) {
1760
+ function Qo(o, e) {
1761
1761
  return (t) => {
1762
1762
  const r = t.source;
1763
1763
  return r === void 0 ? h(void 0) : ({ cCtx: s }) => {
@@ -1772,13 +1772,13 @@ function Yo(o, e) {
1772
1772
  }
1773
1773
  return {
1774
1774
  type: "ScheduleSubroutine",
1775
- subroutine: qo,
1775
+ subroutine: Zo,
1776
1776
  args: n
1777
1777
  };
1778
1778
  };
1779
1779
  };
1780
1780
  }
1781
- const qo = (o) => h(o), Qo = (o) => {
1781
+ const Zo = (o) => h(o), Xo = (o) => {
1782
1782
  const e = o.source;
1783
1783
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1784
1784
  type: "ScheduleComputable",
@@ -1792,7 +1792,7 @@ const qo = (o) => h(o), Qo = (o) => {
1792
1792
  }
1793
1793
  )
1794
1794
  });
1795
- }, Zo = (o) => {
1795
+ }, es = (o) => {
1796
1796
  const e = o.source;
1797
1797
  return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
1798
1798
  const s = t.accessor(e).node().resourceInfo;
@@ -1803,7 +1803,7 @@ const qo = (o) => h(o), Qo = (o) => {
1803
1803
  })
1804
1804
  };
1805
1805
  };
1806
- }, Xo = (o) => {
1806
+ }, ts = (o) => {
1807
1807
  const e = o.source;
1808
1808
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1809
1809
  type: "ScheduleComputable",
@@ -1819,37 +1819,37 @@ const qo = (o) => h(o), Qo = (o) => {
1819
1819
  }
1820
1820
  )
1821
1821
  });
1822
- }, es = (o) => {
1822
+ }, rs = (o) => {
1823
1823
  const e = o.source;
1824
1824
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1825
1825
  type: "ScheduleComputable",
1826
1826
  computable: t.blobDriver.getDownloadedBlob(e)
1827
1827
  });
1828
- }, ts = (o) => {
1828
+ }, os = (o) => {
1829
1829
  const e = o.source;
1830
1830
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1831
1831
  type: "ScheduleComputable",
1832
1832
  computable: t.blobDriver.getOnDemandBlob(e)
1833
1833
  });
1834
- }, rs = (o) => {
1834
+ }, ss = (o) => {
1835
1835
  const e = o.source;
1836
1836
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1837
1837
  type: "ScheduleComputable",
1838
1838
  computable: t.uploadDriver.getProgressId(e)
1839
1839
  });
1840
- }, os = (o) => (e) => {
1840
+ }, is = (o) => (e) => {
1841
1841
  const t = e.source;
1842
1842
  return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1843
1843
  type: "ScheduleComputable",
1844
1844
  computable: r.logDriver.getLastLogs(t, o)
1845
1845
  });
1846
- }, ss = (o) => (e) => {
1846
+ }, ns = (o) => (e) => {
1847
1847
  const t = e.source;
1848
1848
  return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1849
1849
  type: "ScheduleComputable",
1850
1850
  computable: r.logDriver.getProgressLog(t, o)
1851
1851
  });
1852
- }, is = (o) => {
1852
+ }, as = (o) => {
1853
1853
  const e = o.source;
1854
1854
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1855
1855
  type: "ScheduleComputable",
@@ -1860,18 +1860,18 @@ function m(o, e) {
1860
1860
  switch (e.type) {
1861
1861
  case "GetFromCtx":
1862
1862
  const t = o[e.variable];
1863
- return typeof t == "function" ? (r) => he(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
1863
+ return typeof t == "function" ? (r) => fe(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
1864
1864
  case "Isolate":
1865
1865
  return ({ drivers: r }) => ({
1866
1866
  type: "ScheduleComputable",
1867
- computable: Vt(r, o, e.cfg)
1867
+ computable: Jt(r, o, e.cfg)
1868
1868
  });
1869
1869
  case "Immediate":
1870
1870
  return h(e.value);
1871
1871
  case "GetJsonField":
1872
1872
  return () => ({
1873
1873
  type: "ScheduleSubroutine",
1874
- subroutine: zo,
1874
+ subroutine: qo,
1875
1875
  args: {
1876
1876
  source: m(o, e.source),
1877
1877
  field: m(o, e.field)
@@ -1880,7 +1880,7 @@ function m(o, e) {
1880
1880
  case "MapArrayValues":
1881
1881
  return () => ({
1882
1882
  type: "ScheduleSubroutine",
1883
- subroutine: Ko(o, e),
1883
+ subroutine: Uo(o, e),
1884
1884
  args: {
1885
1885
  source: m(o, e.source)
1886
1886
  }
@@ -1888,7 +1888,7 @@ function m(o, e) {
1888
1888
  case "MapRecordValues":
1889
1889
  return () => ({
1890
1890
  type: "ScheduleSubroutine",
1891
- subroutine: Mo(o, e),
1891
+ subroutine: $o(o, e),
1892
1892
  args: {
1893
1893
  source: m(o, e.source)
1894
1894
  }
@@ -1896,19 +1896,19 @@ function m(o, e) {
1896
1896
  case "MakeObject":
1897
1897
  return () => ({
1898
1898
  type: "ScheduleSubroutine",
1899
- subroutine: Vo,
1900
- args: Ao(e.template, (r) => m(o, r))
1899
+ subroutine: Jo,
1900
+ args: No(e.template, (r) => m(o, r))
1901
1901
  });
1902
1902
  case "MakeArray":
1903
1903
  return () => ({
1904
1904
  type: "ScheduleSubroutine",
1905
- subroutine: Et(e.template.length),
1906
- args: jt(e.template, (r) => m(o, r))
1905
+ subroutine: It(e.template.length),
1906
+ args: At(e.template, (r) => m(o, r))
1907
1907
  });
1908
1908
  case "Flatten":
1909
1909
  return () => ({
1910
1910
  type: "ScheduleSubroutine",
1911
- subroutine: Lo,
1911
+ subroutine: Mo,
1912
1912
  args: {
1913
1913
  source: m(o, e.source)
1914
1914
  }
@@ -1916,7 +1916,7 @@ function m(o, e) {
1916
1916
  case "IsEmpty":
1917
1917
  return () => ({
1918
1918
  type: "ScheduleSubroutine",
1919
- subroutine: $o,
1919
+ subroutine: Ho,
1920
1920
  args: {
1921
1921
  arg: m(o, e.arg)
1922
1922
  }
@@ -1924,7 +1924,7 @@ function m(o, e) {
1924
1924
  case "Not":
1925
1925
  return () => ({
1926
1926
  type: "ScheduleSubroutine",
1927
- subroutine: Go,
1927
+ subroutine: _o,
1928
1928
  args: {
1929
1929
  operand: m(o, e.operand)
1930
1930
  }
@@ -1932,7 +1932,7 @@ function m(o, e) {
1932
1932
  case "And":
1933
1933
  return () => ({
1934
1934
  type: "ScheduleSubroutine",
1935
- subroutine: Ho,
1935
+ subroutine: Wo,
1936
1936
  args: {
1937
1937
  operand1: m(o, e.operand1),
1938
1938
  operand2: m(o, e.operand2)
@@ -1941,7 +1941,7 @@ function m(o, e) {
1941
1941
  case "Or":
1942
1942
  return () => ({
1943
1943
  type: "ScheduleSubroutine",
1944
- subroutine: _o,
1944
+ subroutine: zo,
1945
1945
  args: {
1946
1946
  operand1: m(o, e.operand1),
1947
1947
  operand2: m(o, e.operand2)
@@ -1950,7 +1950,7 @@ function m(o, e) {
1950
1950
  case "MapResourceFields":
1951
1951
  return () => ({
1952
1952
  type: "ScheduleSubroutine",
1953
- subroutine: Yo(o, e),
1953
+ subroutine: Qo(o, e),
1954
1954
  args: {
1955
1955
  source: m(o, e.source)
1956
1956
  }
@@ -1958,7 +1958,7 @@ function m(o, e) {
1958
1958
  case "GetResourceField":
1959
1959
  return () => ({
1960
1960
  type: "ScheduleSubroutine",
1961
- subroutine: Jo,
1961
+ subroutine: Ko,
1962
1962
  args: {
1963
1963
  source: m(o, e.source),
1964
1964
  field: m(o, e.field)
@@ -1967,7 +1967,7 @@ function m(o, e) {
1967
1967
  case "GetResourceValueAsJson":
1968
1968
  return () => ({
1969
1969
  type: "ScheduleSubroutine",
1970
- subroutine: Wo,
1970
+ subroutine: Yo,
1971
1971
  args: {
1972
1972
  source: m(o, e.source)
1973
1973
  }
@@ -1975,7 +1975,7 @@ function m(o, e) {
1975
1975
  case "GetBlobContent":
1976
1976
  return () => ({
1977
1977
  type: "ScheduleSubroutine",
1978
- subroutine: Qo,
1978
+ subroutine: Xo,
1979
1979
  args: {
1980
1980
  source: m(o, e.source)
1981
1981
  }
@@ -1983,7 +1983,7 @@ function m(o, e) {
1983
1983
  case "GetBlobContentAsString":
1984
1984
  return () => ({
1985
1985
  type: "ScheduleSubroutine",
1986
- subroutine: Zo,
1986
+ subroutine: es,
1987
1987
  args: {
1988
1988
  source: m(o, e.source)
1989
1989
  }
@@ -1991,7 +1991,7 @@ function m(o, e) {
1991
1991
  case "GetBlobContentAsJson":
1992
1992
  return () => ({
1993
1993
  type: "ScheduleSubroutine",
1994
- subroutine: Xo,
1994
+ subroutine: ts,
1995
1995
  args: {
1996
1996
  source: m(o, e.source)
1997
1997
  }
@@ -1999,7 +1999,7 @@ function m(o, e) {
1999
1999
  case "GetDownloadedBlobContent":
2000
2000
  return () => ({
2001
2001
  type: "ScheduleSubroutine",
2002
- subroutine: es,
2002
+ subroutine: rs,
2003
2003
  args: {
2004
2004
  source: m(o, e.source)
2005
2005
  }
@@ -2007,7 +2007,7 @@ function m(o, e) {
2007
2007
  case "GetOnDemandBlobContent":
2008
2008
  return () => ({
2009
2009
  type: "ScheduleSubroutine",
2010
- subroutine: ts,
2010
+ subroutine: os,
2011
2011
  args: {
2012
2012
  source: m(o, e.source)
2013
2013
  }
@@ -2015,7 +2015,7 @@ function m(o, e) {
2015
2015
  case "GetImportProgress":
2016
2016
  return () => ({
2017
2017
  type: "ScheduleSubroutine",
2018
- subroutine: rs,
2018
+ subroutine: ss,
2019
2019
  args: {
2020
2020
  source: m(o, e.source)
2021
2021
  }
@@ -2023,7 +2023,7 @@ function m(o, e) {
2023
2023
  case "GetLastLogs":
2024
2024
  return () => ({
2025
2025
  type: "ScheduleSubroutine",
2026
- subroutine: os(e.lines),
2026
+ subroutine: is(e.lines),
2027
2027
  args: {
2028
2028
  source: m(o, e.source)
2029
2029
  }
@@ -2031,7 +2031,7 @@ function m(o, e) {
2031
2031
  case "GetProgressLog":
2032
2032
  return () => ({
2033
2033
  type: "ScheduleSubroutine",
2034
- subroutine: ss(e.patternToSearch),
2034
+ subroutine: ns(e.patternToSearch),
2035
2035
  args: {
2036
2036
  source: m(o, e.source)
2037
2037
  }
@@ -2039,7 +2039,7 @@ function m(o, e) {
2039
2039
  case "GetLogHandle":
2040
2040
  return () => ({
2041
2041
  type: "ScheduleSubroutine",
2042
- subroutine: is,
2042
+ subroutine: as,
2043
2043
  args: {
2044
2044
  source: m(o, e.source)
2045
2045
  }
@@ -2048,8 +2048,8 @@ function m(o, e) {
2048
2048
  return O(e);
2049
2049
  }
2050
2050
  }
2051
- const ns = ["$prod", "$staging"];
2052
- function as(o) {
2051
+ const cs = ["$prod", "$staging"];
2052
+ function us(o) {
2053
2053
  return {
2054
2054
  $blockId: o.blockId,
2055
2055
  $args: JSON.parse(o.args),
@@ -2058,16 +2058,16 @@ function as(o) {
2058
2058
  $staging: o.staging
2059
2059
  };
2060
2060
  }
2061
- const At = Symbol(), It = "return", cs = { op: At, arg: It };
2062
- function us(o) {
2063
- return o.op == At && o.arg == It;
2061
+ const Nt = Symbol(), Vt = "return", ls = { op: Nt, arg: Vt };
2062
+ function ds(o) {
2063
+ return o.op == Nt && o.arg == Vt;
2064
2064
  }
2065
- function ls() {
2065
+ function ps() {
2066
2066
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2067
2067
  }
2068
- function it(o, e, t, r) {
2069
- const s = new ft(t), i = (a, c) => {
2070
- if (us(a))
2068
+ function nt(o, e, t, r) {
2069
+ const s = new vt(t), i = (a, c) => {
2070
+ if (ds(a))
2071
2071
  return e.result = c, !1;
2072
2072
  const u = w(e.pendingSubroutines.get(a.op));
2073
2073
  if (a.arg in u.args) throw new Error("argument already set");
@@ -2117,24 +2117,24 @@ function it(o, e, t, r) {
2117
2117
  }
2118
2118
  return n;
2119
2119
  }
2120
- function Nt(o, e, t, r = {}) {
2121
- return Vt(o, as(e), t, r);
2120
+ function Lt(o, e, t, r = {}) {
2121
+ return Jt(o, us(e), t, r);
2122
2122
  }
2123
- function Vt(o, e, t, r = {}) {
2124
- const s = je({
2125
- ctx: Object.fromEntries(Object.entries(e).filter(([i]) => ns.indexOf(i) === -1)),
2123
+ function Jt(o, e, t, r = {}) {
2124
+ const s = Ae({
2125
+ ctx: Object.fromEntries(Object.entries(e).filter(([i]) => cs.indexOf(i) === -1)),
2126
2126
  cfg: t
2127
2127
  });
2128
2128
  return P.makeRaw(
2129
2129
  (i) => {
2130
- const n = { drivers: o, cCtx: i }, a = ls();
2130
+ const n = { drivers: o, cCtx: i }, a = ps();
2131
2131
  return {
2132
- ir: it(
2132
+ ir: nt(
2133
2133
  n,
2134
2134
  a,
2135
2135
  [
2136
2136
  {
2137
- destination: cs,
2137
+ destination: ls,
2138
2138
  operation: m(e, t)
2139
2139
  }
2140
2140
  ],
@@ -2156,7 +2156,7 @@ function Vt(o, e, t, r = {}) {
2156
2156
  result: a.result,
2157
2157
  pendingSubroutines: f
2158
2158
  };
2159
- if (it(g, v, p, !1), !("result" in v))
2159
+ if (nt(g, v, p, !1), !("result" in v))
2160
2160
  throw new Error("illegal cfg rendering stack state, no result");
2161
2161
  return v.result;
2162
2162
  }
@@ -2165,13 +2165,13 @@ function Vt(o, e, t, r = {}) {
2165
2165
  { ...r, key: s }
2166
2166
  );
2167
2167
  }
2168
- function ds(o) {
2168
+ function gs(o) {
2169
2169
  return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
2170
2170
  }
2171
- function nt(o) {
2171
+ function at(o) {
2172
2172
  return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
2173
2173
  }
2174
- class pe {
2174
+ class ge {
2175
2175
  constructor(e, t, r, s, i) {
2176
2176
  d(this, "callbackRegistry");
2177
2177
  d(this, "fnJSONStringify");
@@ -2203,12 +2203,12 @@ class pe {
2203
2203
  try {
2204
2204
  this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
2205
2205
  } catch (t) {
2206
- throw pe.cleanErrorContext(t), t;
2206
+ throw ge.cleanErrorContext(t), t;
2207
2207
  }
2208
2208
  }
2209
2209
  runCallback(e, ...t) {
2210
2210
  try {
2211
- return ke.withScope((r) => {
2211
+ return Ce.withScope((r) => {
2212
2212
  const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
2213
2213
  if (this.vm.typeof(s) !== "function")
2214
2214
  throw new Error(`No such callback: ${e}`);
@@ -2223,7 +2223,7 @@ class pe {
2223
2223
  );
2224
2224
  });
2225
2225
  } catch (r) {
2226
- throw pe.cleanErrorContext(r), r;
2226
+ throw ge.cleanErrorContext(r), r;
2227
2227
  }
2228
2228
  }
2229
2229
  //
@@ -2278,13 +2278,13 @@ class pe {
2278
2278
  return this.getAccessor(e).listDynamicFields();
2279
2279
  }
2280
2280
  getKeyValueBase64(e, t) {
2281
- return nt(this.getAccessor(e).getKeyValue(t));
2281
+ return at(this.getAccessor(e).getKeyValue(t));
2282
2282
  }
2283
2283
  getKeyValueAsString(e, t) {
2284
2284
  return this.getAccessor(e).getKeyValueAsString(t);
2285
2285
  }
2286
2286
  getDataBase64(e) {
2287
- return nt(this.getAccessor(e).getData());
2287
+ return at(this.getAccessor(e).getData());
2288
2288
  }
2289
2289
  getDataAsString(e) {
2290
2290
  return this.getAccessor(e).getDataAsString();
@@ -2295,16 +2295,16 @@ class pe {
2295
2295
  parsePObjectCollection(e, t, r) {
2296
2296
  const s = this.getAccessor(e);
2297
2297
  if (!s.getIsReadyOrError()) return;
2298
- const i = Eo(s, t, r), n = {};
2298
+ const i = Io(s, t, r), n = {};
2299
2299
  for (const [a, c] of Object.entries(i))
2300
- n[a] = q(c, (u) => this.wrapAccessor(u));
2300
+ n[a] = Q(c, (u) => this.wrapAccessor(u));
2301
2301
  return n;
2302
2302
  }
2303
2303
  //
2304
2304
  // Blobs
2305
2305
  //
2306
2306
  registerComputable(e, t) {
2307
- const r = `${e}_${Z()}`;
2307
+ const r = `${e}_${X()}`;
2308
2308
  return this.computablesToResolve[r] = t, r;
2309
2309
  }
2310
2310
  getBlobContentAsString(e) {
@@ -2413,7 +2413,7 @@ class pe {
2413
2413
  isComplete: e.isComplete,
2414
2414
  entries: e.entries.map((t) => ({
2415
2415
  ref: t.ref,
2416
- obj: q(t.obj, (r) => this.wrapAccessor(r))
2416
+ obj: Q(t.obj, (r) => this.wrapAccessor(r))
2417
2417
  }))
2418
2418
  };
2419
2419
  }
@@ -2426,7 +2426,7 @@ class pe {
2426
2426
  obj: {
2427
2427
  id: t.obj.id,
2428
2428
  spec: t.obj.spec,
2429
- data: Gt(t.obj.data, (r) => this.wrapAccessor(r))
2429
+ data: _t(t.obj.data, (r) => this.wrapAccessor(r))
2430
2430
  }
2431
2431
  }))
2432
2432
  };
@@ -2444,7 +2444,7 @@ class pe {
2444
2444
  "can't instantiate PFrames from this context (most porbably called from the future mapper)"
2445
2445
  );
2446
2446
  return this.env.driverKit.pFrameDriver.createPFrame(
2447
- e.map((t) => q(t, (r) => this.getAccessor(r))),
2447
+ e.map((t) => Q(t, (r) => this.getAccessor(r))),
2448
2448
  this.computableCtx
2449
2449
  );
2450
2450
  }
@@ -2454,7 +2454,7 @@ class pe {
2454
2454
  "can't instantiate PTable from this context (most porbably called from the future mapper)"
2455
2455
  );
2456
2456
  return this.env.driverKit.pFrameDriver.createPTable(
2457
- ut(e, (t) => q(t, (r) => this.getAccessor(r))),
2457
+ dt(e, (t) => Q(t, (r) => this.getAccessor(r))),
2458
2458
  this.computableCtx
2459
2459
  );
2460
2460
  }
@@ -2468,7 +2468,7 @@ class pe {
2468
2468
  }
2469
2469
  wrapAccessor(e) {
2470
2470
  if (e !== void 0) {
2471
- const t = Z();
2471
+ const t = X();
2472
2472
  return this.accessors.set(t, e), t;
2473
2473
  }
2474
2474
  }
@@ -2500,7 +2500,7 @@ class pe {
2500
2500
  r = this.vm.null;
2501
2501
  break;
2502
2502
  }
2503
- if (ds(e)) {
2503
+ if (gs(e)) {
2504
2504
  r = this.vm.newArrayBuffer(e), s = !0;
2505
2505
  break;
2506
2506
  }
@@ -2536,7 +2536,7 @@ class pe {
2536
2536
  return JSON.parse(t);
2537
2537
  }
2538
2538
  injectCtx() {
2539
- ke.withScope((e) => {
2539
+ Ce.withScope((e) => {
2540
2540
  const t = e.manage(this.vm.newObject());
2541
2541
  this.vm.setProp(t, "args", e.manage(this.vm.newString(this.blockCtx.args))), this.blockCtx.uiState !== void 0 && this.vm.setProp(
2542
2542
  t,
@@ -2602,13 +2602,13 @@ class pe {
2602
2602
  });
2603
2603
  }
2604
2604
  }
2605
- function ps(o, e, t, r, s = {}) {
2605
+ function hs(o, e, t, r, s = {}) {
2606
2606
  return P.makeRaw((i) => {
2607
- const n = new ke();
2607
+ const n = new Ce();
2608
2608
  i.addOnDestroy(() => n.dispose());
2609
2609
  const a = n.manage(o.quickJs.newRuntime());
2610
2610
  a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
2611
- const c = n.manage(a.newContext()), u = new pe(n, c, e, o, i);
2611
+ const c = n.manage(a.newContext()), u = new ge(n, c, e, o, i);
2612
2612
  u.evaluateBundle(r.content);
2613
2613
  const l = u.runCallback(t);
2614
2614
  return u.resetComputableCtx(), {
@@ -2620,18 +2620,18 @@ function ps(o, e, t, r, s = {}) {
2620
2620
  };
2621
2621
  }, s);
2622
2622
  }
2623
- function xe(o, e, t, r, s = {}) {
2624
- if (lt(t)) {
2623
+ function je(o, e, t, r, s = {}) {
2624
+ if (pt(t)) {
2625
2625
  if (r === void 0) throw new Error("No code bundle.");
2626
- return ps(o, e, t, r, s);
2627
- } else return Nt(o.driverKit, e, t, s);
2626
+ return hs(o, e, t, r, s);
2627
+ } else return Lt(o.driverKit, e, t, s);
2628
2628
  }
2629
- function gs(o, e, t) {
2629
+ function fs(o, e, t) {
2630
2630
  return P.make(
2631
2631
  (r) => {
2632
- var v, D, V, K, re, $, W, oe;
2633
- const s = r.accessor(o).node(), i = w(s.getKeyValueAsJson(Ne)), n = w(s.getKeyValueAsJson(X)), a = w(s.getKeyValueAsJson(ee)), c = w(s.getKeyValueAsJson(_)), u = w(
2634
- s.getKeyValueAsJson(ue)
2632
+ var v, D, V, M, oe, $, W, se;
2633
+ const s = r.accessor(o).node(), i = w(s.getKeyValueAsJson(Le)), n = w(s.getKeyValueAsJson(ee)), a = w(s.getKeyValueAsJson(te)), c = w(s.getKeyValueAsJson(_)), u = w(
2634
+ s.getKeyValueAsJson(le)
2635
2635
  ), l = /* @__PURE__ */ new Map();
2636
2636
  for (const { id: k } of N(c)) {
2637
2637
  const J = s.traverse({
@@ -2640,82 +2640,82 @@ function gs(o, e, t) {
2640
2640
  errorIfFieldNotSet: !0
2641
2641
  });
2642
2642
  let z;
2643
- const j = s.traverse({
2643
+ const T = s.traverse({
2644
2644
  field: C(k, "prodArgs"),
2645
2645
  assertFieldType: "Dynamic",
2646
2646
  stableIfNotFound: !0
2647
2647
  });
2648
- if (j !== void 0) {
2648
+ if (T !== void 0) {
2649
2649
  const x = s.getField({
2650
2650
  field: C(k, "prodOutput"),
2651
2651
  assertFieldType: "Dynamic",
2652
2652
  errorIfFieldNotFound: !0
2653
- }), R = s.getField({
2653
+ }), B = s.getField({
2654
2654
  field: C(k, "prodUiCtx"),
2655
2655
  assertFieldType: "Dynamic",
2656
2656
  errorIfFieldNotFound: !0
2657
2657
  });
2658
2658
  z = {
2659
- arguments: j.getDataAsJson(),
2660
- stale: J.id !== j.id,
2661
- outputError: x.error !== void 0 || R.error !== void 0 || ((v = x.value) == null ? void 0 : v.getError()) !== void 0 || ((D = R.value) == null ? void 0 : D.getError()) !== void 0,
2662
- outputsError: ((V = x.error) == null ? void 0 : V.getDataAsString()) ?? ((re = (K = x.value) == null ? void 0 : K.getError()) == null ? void 0 : re.getDataAsString()),
2663
- exportsError: (($ = R.error) == null ? void 0 : $.getDataAsString()) ?? ((oe = (W = R.value) == null ? void 0 : W.getError()) == null ? void 0 : oe.getDataAsString()),
2664
- finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (R.value !== void 0 && R.value.getIsReadyOrError() || R.error !== void 0 && R.error.getIsReadyOrError())
2659
+ arguments: T.getDataAsJson(),
2660
+ stale: J.id !== T.id,
2661
+ outputError: x.error !== void 0 || B.error !== void 0 || ((v = x.value) == null ? void 0 : v.getError()) !== void 0 || ((D = B.value) == null ? void 0 : D.getError()) !== void 0,
2662
+ outputsError: ((V = x.error) == null ? void 0 : V.getDataAsString()) ?? ((oe = (M = x.value) == null ? void 0 : M.getError()) == null ? void 0 : oe.getDataAsString()),
2663
+ exportsError: (($ = B.error) == null ? void 0 : $.getDataAsString()) ?? ((se = (W = B.value) == null ? void 0 : W.getError()) == null ? void 0 : se.getDataAsString()),
2664
+ finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2665
2665
  };
2666
2666
  }
2667
2667
  l.set(k, { currentArguments: J.getDataAsJson(), prod: z });
2668
2668
  }
2669
- const p = ne(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: z }) => {
2670
- var Me, Ue, $e, Ge;
2671
- const j = w(l.get(k)), x = w(p.nodes.get(k));
2672
- let R = "NotCalculated";
2673
- j.prod !== void 0 && (g.has(k) ? R = "Limbo" : R = j.prod.finished ? "Done" : "Running");
2674
- const M = s.traverse(
2669
+ const p = ae(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: z }) => {
2670
+ var $e, Ge, He, _e;
2671
+ const T = w(l.get(k)), x = w(p.nodes.get(k));
2672
+ let B = "NotCalculated";
2673
+ T.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = T.prod.finished ? "Done" : "Running");
2674
+ const K = s.traverse(
2675
2675
  {
2676
2676
  field: C(k, "blockPack"),
2677
2677
  assertFieldType: "Dynamic",
2678
2678
  errorIfFieldNotSet: !0
2679
2679
  },
2680
2680
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2681
- ), L = M == null ? void 0 : M.getDataAsJson(), { sections: se, inputsValid: y, sdkVersion: B } = de(L == null ? void 0 : L.config, (fe) => {
2682
- const Y = Te(fe), He = Je(s, k);
2681
+ ), L = K == null ? void 0 : K.getDataAsJson(), { sections: ie, inputsValid: y, sdkVersion: R } = pe(L == null ? void 0 : L.config, (me) => {
2682
+ const q = Ee(me), We = Ke(s, k);
2683
2683
  return {
2684
- sections: xe(
2684
+ sections: je(
2685
2685
  t,
2686
- He,
2687
- Y.sections,
2688
- Y.code
2686
+ We,
2687
+ q.sections,
2688
+ q.code
2689
2689
  ),
2690
- inputsValid: xe(
2690
+ inputsValid: je(
2691
2691
  t,
2692
- He,
2693
- Y.inputsValid,
2694
- Y.code
2692
+ We,
2693
+ q.inputsValid,
2694
+ q.code
2695
2695
  ),
2696
- sdkVersion: Y.sdkVersion
2696
+ sdkVersion: q.sdkVersion
2697
2697
  };
2698
- }) || {}, F = de(
2698
+ }) || {}, F = pe(
2699
2699
  L,
2700
- (fe) => t.blockUpdateWatcher.get(fe.source)
2700
+ (me) => t.blockUpdateWatcher.get(me.source)
2701
2701
  );
2702
2702
  return {
2703
2703
  id: k,
2704
2704
  label: J,
2705
2705
  renderingMode: z,
2706
- stale: ((Me = j.prod) == null ? void 0 : Me.stale) !== !1 || R === "Limbo",
2706
+ stale: (($e = T.prod) == null ? void 0 : $e.stale) !== !1 || B === "Limbo",
2707
2707
  missingReference: x.missingReferences,
2708
2708
  upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
2709
2709
  downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
2710
- calculationStatus: R,
2711
- outputErrors: ((Ue = j.prod) == null ? void 0 : Ue.outputError) === !0,
2712
- outputsError: ($e = j.prod) == null ? void 0 : $e.outputsError,
2713
- exportsError: (Ge = j.prod) == null ? void 0 : Ge.exportsError,
2714
- sections: se,
2710
+ calculationStatus: B,
2711
+ outputErrors: ((Ge = T.prod) == null ? void 0 : Ge.outputError) === !0,
2712
+ outputsError: (He = T.prod) == null ? void 0 : He.outputsError,
2713
+ exportsError: (_e = T.prod) == null ? void 0 : _e.exportsError,
2714
+ sections: ie,
2715
2715
  inputsValid: y,
2716
2716
  currentBlockPack: L == null ? void 0 : L.source,
2717
2717
  updatedBlockPack: F,
2718
- sdkVersion: B,
2718
+ sdkVersion: R,
2719
2719
  navigationState: e.getState(k)
2720
2720
  };
2721
2721
  });
@@ -2723,7 +2723,7 @@ function gs(o, e, t) {
2723
2723
  meta: a,
2724
2724
  created: new Date(i),
2725
2725
  lastModified: new Date(n),
2726
- authorMarker: s.getKeyValueAsJson(Fe),
2726
+ authorMarker: s.getKeyValueAsJson(Be),
2727
2727
  blocks: f
2728
2728
  };
2729
2729
  },
@@ -2742,9 +2742,9 @@ function gs(o, e, t) {
2742
2742
  }
2743
2743
  ).withStableType();
2744
2744
  }
2745
- function Lt(o, e) {
2745
+ function Mt(o, e) {
2746
2746
  var t, r;
2747
- return de(
2747
+ return pe(
2748
2748
  (r = (t = o.traverse(
2749
2749
  {
2750
2750
  field: C(e, "blockPack"),
@@ -2753,16 +2753,16 @@ function Lt(o, e) {
2753
2753
  },
2754
2754
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2755
2755
  )) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
2756
- (s) => Te(s)
2756
+ (s) => Ee(s)
2757
2757
  );
2758
2758
  }
2759
- function hs(o, e) {
2759
+ function ms(o, e) {
2760
2760
  const t = o.node();
2761
- if (U(t.resourceType, Ct)) {
2761
+ if (U(t.resourceType, Ft)) {
2762
2762
  const r = t.getDataAsJson();
2763
2763
  if (r === void 0) throw new Error("No resource data.");
2764
2764
  return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
2765
- } else if (U(t.resourceType, Pt)) {
2765
+ } else if (U(t.resourceType, Bt)) {
2766
2766
  const r = t.getDataAsJson();
2767
2767
  if (r === void 0) throw new Error("No resource data.");
2768
2768
  return e.signer.verify(
@@ -2773,10 +2773,10 @@ function hs(o, e) {
2773
2773
  } else
2774
2774
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2775
2775
  }
2776
- function fs(o, e) {
2776
+ function vs(o, e) {
2777
2777
  if (o !== void 0)
2778
2778
  return P.make(
2779
- (t) => hs(t.accessor(o), e),
2779
+ (t) => ms(t.accessor(o), e),
2780
2780
  {
2781
2781
  postprocessValue: (t) => {
2782
2782
  if (t !== void 0) {
@@ -2788,53 +2788,53 @@ function fs(o, e) {
2788
2788
  }
2789
2789
  ).withStableType();
2790
2790
  }
2791
- function ms(o, e, t) {
2791
+ function ys(o, e, t) {
2792
2792
  return P.make(
2793
2793
  (r) => {
2794
2794
  var a;
2795
- const s = r.accessor(o).node(), i = Lt(s, e), n = (a = s.traverse(
2795
+ const s = r.accessor(o).node(), i = Mt(s, e), n = (a = s.traverse(
2796
2796
  {
2797
2797
  field: C(e, "blockPack"),
2798
2798
  assertFieldType: "Dynamic"
2799
2799
  },
2800
2800
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2801
- { field: Rt, assertFieldType: "Input" }
2801
+ { field: Ot, assertFieldType: "Input" }
2802
2802
  )) == null ? void 0 : a.persist();
2803
- return { path: fs(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
2803
+ return { path: vs(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
2804
2804
  },
2805
2805
  { mode: "StableOnlyLive" }
2806
2806
  );
2807
2807
  }
2808
- function vs(o, e, t) {
2808
+ function bs(o, e, t) {
2809
2809
  return P.make(
2810
2810
  (r) => {
2811
- const s = r.accessor(o).node(), i = Je(s, e);
2811
+ const s = r.accessor(o).node(), i = Ke(s, e);
2812
2812
  return {
2813
- author: s.getKeyValueAsJson(Pe(e)),
2813
+ author: s.getKeyValueAsJson(Fe(e)),
2814
2814
  args: JSON.parse(i.args),
2815
2815
  ui: i.uiState !== void 0 ? JSON.parse(i.uiState) : void 0
2816
2816
  };
2817
2817
  },
2818
- { key: "inputs#" + gt(o.rid) + e }
2818
+ { key: "inputs#" + ft(o.rid) + e }
2819
2819
  );
2820
2820
  }
2821
- function ys(o, e, t) {
2821
+ function ws(o, e, t) {
2822
2822
  return P.make(
2823
2823
  (r) => {
2824
- const s = r.accessor(o).node(), i = Tt(s, e), n = Lt(s, e);
2825
- return de(n, (a) => {
2824
+ const s = r.accessor(o).node(), i = Et(s, e), n = Mt(s, e);
2825
+ return pe(n, (a) => {
2826
2826
  const c = {};
2827
2827
  for (const [u, l] of Object.entries(a.outputs))
2828
2828
  c[u] = P.wrapError(
2829
- xe(t, i, l, a.code)
2829
+ je(t, i, l, a.code)
2830
2830
  );
2831
2831
  return c;
2832
2832
  });
2833
2833
  },
2834
- { key: "outputs#" + gt(o.rid) + e }
2834
+ { key: "outputs#" + ft(o.rid) + e }
2835
2835
  ).withStableType();
2836
2836
  }
2837
- function bs(o, e) {
2837
+ function Ss(o, e) {
2838
2838
  return P.make((t) => {
2839
2839
  const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(_)), i = [];
2840
2840
  for (const { id: n, renderingMode: a } of N(s)) {
@@ -2847,30 +2847,30 @@ function bs(o, e) {
2847
2847
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2848
2848
  ), u = c == null ? void 0 : c.getDataAsJson();
2849
2849
  if ((u == null ? void 0 : u.config) === void 0) continue;
2850
- const l = Te(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !lt(f) && No(f)).map((f) => f);
2850
+ const l = Ee(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !pt(f) && Lo(f)).map((f) => f);
2851
2851
  if (p.length === 0) continue;
2852
- const g = Tt(r, n);
2852
+ const g = Et(r, n);
2853
2853
  for (const f of p)
2854
- i.push(P.wrapError(Nt(e.driverKit, g, f)));
2854
+ i.push(P.wrapError(Lt(e.driverKit, g, f)));
2855
2855
  }
2856
2856
  return i;
2857
2857
  });
2858
2858
  }
2859
- class ws {
2859
+ class ks {
2860
2860
  constructor() {
2861
2861
  d(this, "states", /* @__PURE__ */ new Map());
2862
2862
  }
2863
2863
  setState(e, t) {
2864
2864
  const r = this.states.get(e);
2865
2865
  if (r === void 0) {
2866
- this.states.set(e, { state: t, change: new ze() });
2866
+ this.states.set(e, { state: t, change: new Ye() });
2867
2867
  return;
2868
2868
  }
2869
2869
  r.state = { ...t }, r.change.markChanged();
2870
2870
  }
2871
2871
  readState(e, t) {
2872
2872
  let r = this.states.get(t);
2873
- return r === void 0 && (r = { state: { ...Ht }, change: new ze() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2873
+ return r === void 0 && (r = { state: { ...Wt }, change: new Ye() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2874
2874
  }
2875
2875
  getState(e) {
2876
2876
  return P.make(
@@ -2883,38 +2883,38 @@ class ws {
2883
2883
  t !== void 0 && (this.states.delete(e), t.change.markChanged());
2884
2884
  }
2885
2885
  }
2886
- class Ke {
2886
+ class Ue {
2887
2887
  constructor(e, t, r) {
2888
2888
  /** Underlying pl resource id */
2889
2889
  d(this, "rid");
2890
2890
  /** Data for the left panel, contain basic information about block status. */
2891
2891
  d(this, "overview");
2892
- d(this, "navigationStates", new ws());
2892
+ d(this, "navigationStates", new ks());
2893
2893
  d(this, "blockComputables", /* @__PURE__ */ new Map());
2894
2894
  d(this, "blockFrontends", /* @__PURE__ */ new Map());
2895
2895
  d(this, "activeConfigs");
2896
2896
  d(this, "refreshLoopResult");
2897
2897
  d(this, "abortController", new AbortController());
2898
2898
  d(this, "destroyed", !1);
2899
- this.env = e, this.projectTree = r, this.overview = gs(
2899
+ this.env = e, this.projectTree = r, this.overview = fs(
2900
2900
  r.entry(),
2901
2901
  this.navigationStates,
2902
2902
  e
2903
- ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = bs(r.entry(), e);
2903
+ ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Ss(r.entry(), e);
2904
2904
  }
2905
2905
  async refreshLoop() {
2906
2906
  for (; !this.destroyed; )
2907
2907
  try {
2908
- await we(this.env.pl, this.rid, (e) => {
2908
+ await Se(this.env.pl, this.rid, (e) => {
2909
2909
  e.doRefresh(this.env.ops.stagingRenderingRate);
2910
- }), await this.activeConfigs.getValue(), await gr(this.env.ops.projectRefreshInterval, this.abortController.signal);
2910
+ }), await this.activeConfigs.getValue(), await fr(this.env.ops.projectRefreshInterval, this.abortController.signal);
2911
2911
  } catch (e) {
2912
- if (sr(e)) {
2912
+ if (nr(e)) {
2913
2913
  console.warn(
2914
2914
  "project refresh routine terminated, because project was externally deleted"
2915
2915
  );
2916
2916
  break;
2917
- } else if (!ir(e))
2917
+ } else if (!ar(e))
2918
2918
  throw new Error("Unexpected exception", { cause: e });
2919
2919
  }
2920
2920
  }
@@ -2929,7 +2929,7 @@ class Ke {
2929
2929
  *
2930
2930
  * @return returns newly created block id
2931
2931
  * */
2932
- async addBlock(e, t, r, s = void 0, i = Z()) {
2932
+ async addBlock(e, t, r, s = void 0, i = X()) {
2933
2933
  const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfig(t);
2934
2934
  return await A(
2935
2935
  this.env.pl,
@@ -3007,7 +3007,7 @@ class Ke {
3007
3007
  * stale state.
3008
3008
  * */
3009
3009
  async runBlock(e) {
3010
- await we(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3010
+ await Se(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3011
3011
  }
3012
3012
  /**
3013
3013
  * Stops the block if it is running by destroying its production state. All
@@ -3015,7 +3015,7 @@ class Ke {
3015
3015
  * calculated.
3016
3016
  * */
3017
3017
  async stopBlock(e) {
3018
- await we(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3018
+ await Se(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3019
3019
  }
3020
3020
  /** Update block label. */
3021
3021
  async setBlockLabel(e, t, r) {
@@ -3071,9 +3071,9 @@ class Ke {
3071
3071
  /** Resets arguments and ui state of the block to initial state */
3072
3072
  async resetBlockArgsAndUiState(e, t) {
3073
3073
  await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
3074
- const s = Se(
3074
+ const s = ke(
3075
3075
  (await r.getField(S(this.rid, C(e, "blockPack")))).value
3076
- ), i = Se(
3076
+ ), i = ke(
3077
3077
  (await r.getField(S(s, b.HolderRefField))).value
3078
3078
  ), n = await r.getResourceData(i, !1), a = JSON.parse(
3079
3079
  Buffer.from(w(n.data)).toString("utf-8")
@@ -3086,10 +3086,10 @@ class Ke {
3086
3086
  getBlockComputables(e) {
3087
3087
  const t = this.blockComputables.get(e);
3088
3088
  if (t === void 0) {
3089
- const r = ys(this.projectTree.entry(), e, this.env), i = {
3089
+ const r = ws(this.projectTree.entry(), e, this.env), i = {
3090
3090
  fullState: P.make(
3091
3091
  (n) => ({
3092
- argsAndUiState: vs(this.projectTree.entry(), e),
3092
+ argsAndUiState: bs(this.projectTree.entry(), e),
3093
3093
  outputs: r,
3094
3094
  navigationState: this.navigationStates.getState(e)
3095
3095
  }),
@@ -3120,7 +3120,7 @@ class Ke {
3120
3120
  getBlockFrontend(e) {
3121
3121
  const t = this.blockFrontends.get(e);
3122
3122
  if (t === void 0) {
3123
- const r = ms(
3123
+ const r = ys(
3124
3124
  this.projectTree.entry(),
3125
3125
  e,
3126
3126
  this.env
@@ -3140,19 +3140,87 @@ class Ke {
3140
3140
  await this.destroy();
3141
3141
  }
3142
3142
  static async init(e, t) {
3143
- const r = await ht.init(
3143
+ const r = await mt.init(
3144
3144
  e.pl,
3145
3145
  t,
3146
- e.ops.defaultTreeOptions,
3146
+ {
3147
+ ...e.ops.defaultTreeOptions,
3148
+ finalPredicate: Fs,
3149
+ pruning: Cs
3150
+ },
3147
3151
  e.logger
3148
3152
  );
3149
- return new Ke(e, t, r);
3153
+ return new Ue(e, t, r);
3154
+ }
3155
+ }
3156
+ function Cs(o) {
3157
+ switch (o.type.name) {
3158
+ case "BlockPackCustom":
3159
+ return o.fields.filter((e) => e.name !== "template");
3160
+ case "UserProject":
3161
+ return o.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
3162
+ case "Blob":
3163
+ return [];
3164
+ default:
3165
+ return o.fields;
3150
3166
  }
3151
3167
  }
3152
- const Jt = {
3153
- logger: new Qt(),
3168
+ function Te(o) {
3169
+ return o.resourceReady || ue(o.originalResourceId) || ue(o.error);
3170
+ }
3171
+ function Ps(o) {
3172
+ if (!Te(o) || !o.outputsLocked) return !1;
3173
+ for (const [, e] of o.fields)
3174
+ if (Y(e.error) && Y(e.value)) return !1;
3175
+ return !0;
3176
+ }
3177
+ const ct = /* @__PURE__ */ new Set();
3178
+ function Fs(o) {
3179
+ switch (o.type.name) {
3180
+ case "StdMap":
3181
+ case "std/map":
3182
+ case "EphStdMap":
3183
+ case "PFrame":
3184
+ case "BContext":
3185
+ case "BlockPackCustom":
3186
+ case "BinaryMap":
3187
+ case "BinaryValue":
3188
+ case "BlobMap":
3189
+ case "BResolveSingle":
3190
+ case "BResolveSingleNoResult":
3191
+ case "BQueryResult":
3192
+ case "TengoTemplate":
3193
+ case "TengoLib":
3194
+ case "SoftwareInfo":
3195
+ case "Dummy":
3196
+ return Te(o);
3197
+ case "json/resourceError":
3198
+ return o.type.version === "1";
3199
+ case "json/object":
3200
+ case "json/string":
3201
+ case "json/array":
3202
+ case "json/number":
3203
+ case "BContextEnd":
3204
+ case "Frontend/FromUrl":
3205
+ case "Frontend/FromFolder":
3206
+ case "BObjectSpec":
3207
+ return !0;
3208
+ case "UserProject":
3209
+ return !1;
3210
+ default:
3211
+ if (o.type.name.startsWith("Blob/")) return !0;
3212
+ if (o.type.name.startsWith("BlobUpload/"))
3213
+ return Ps(o);
3214
+ if (o.type.name.startsWith("PColumnData/"))
3215
+ return Te(o);
3216
+ ct.has(o.type.name) || (console.log("UNKNOWN RESOURCE TYPE: " + o.type.name), ct.add(o.type.name));
3217
+ }
3218
+ return !1;
3219
+ }
3220
+ const Kt = {
3221
+ logger: new Xt(),
3154
3222
  platformLocalStorageNameToPath: {},
3155
- localStorageNameToPath: { local: mt.homedir() },
3223
+ localStorageNameToPath: { local: yt.homedir() },
3156
3224
  blobDriverOps: {
3157
3225
  cacheSoftSizeBytes: 100 * 1024 * 1024,
3158
3226
  // 100MB
@@ -3169,8 +3237,8 @@ const Jt = {
3169
3237
  pollingInterval: 1e3,
3170
3238
  stopPollingDelay: 1e3
3171
3239
  }
3172
- }, Ss = {
3173
- ...Jt,
3240
+ }, Bs = {
3241
+ ...Kt,
3174
3242
  defaultTreeOptions: {
3175
3243
  pollingInterval: 350,
3176
3244
  stopPollingDelay: 2500
@@ -3178,12 +3246,12 @@ const Jt = {
3178
3246
  devBlockUpdateRecheckInterval: 1e3,
3179
3247
  projectRefreshInterval: 700,
3180
3248
  stagingRenderingRate: 5
3181
- }, ks = {
3249
+ }, Rs = {
3182
3250
  minDelay: 1500
3183
- }, Cs = "__no_updates__";
3184
- class Ps extends cr {
3251
+ }, Os = "__no_updates__";
3252
+ class Ds extends lr {
3185
3253
  constructor(t, r, s = {}) {
3186
- super({ ...s, ...ks }, r);
3254
+ super({ ...s, ...Rs }, r);
3187
3255
  d(this, "http");
3188
3256
  this.registryProvider = t, this.http = s.http;
3189
3257
  }
@@ -3196,7 +3264,7 @@ class Ps extends cr {
3196
3264
  case "from-registry-v2":
3197
3265
  return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3198
3266
  default:
3199
- return Cs;
3267
+ return Os;
3200
3268
  }
3201
3269
  }
3202
3270
  async readValue(t) {
@@ -3205,7 +3273,7 @@ class Ps extends cr {
3205
3273
  switch (t.type) {
3206
3274
  case "dev-v1":
3207
3275
  try {
3208
- const s = await yt(t.folder);
3276
+ const s = await wt(t.folder);
3209
3277
  return s === t.mtime ? void 0 : { ...t, mtime: s };
3210
3278
  } catch (s) {
3211
3279
  this.logger.warn(s);
@@ -3213,9 +3281,9 @@ class Ps extends cr {
3213
3281
  }
3214
3282
  case "dev-v2":
3215
3283
  try {
3216
- const s = await dt(t.folder, this.logger);
3284
+ const s = await gt(t.folder, this.logger);
3217
3285
  if (s === void 0) return;
3218
- const i = await Ie(s);
3286
+ const i = await Ve(s);
3219
3287
  return i === t.mtime ? void 0 : { ...t, mtime: i };
3220
3288
  } catch (s) {
3221
3289
  this.logger.warn(s);
@@ -3225,7 +3293,7 @@ class Ps extends cr {
3225
3293
  try {
3226
3294
  const i = (r = await this.registryProvider.getRegistry(t.registryUrl).getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3227
3295
  if ((i == null ? void 0 : i.type) !== "from-registry-v2") throw new Error("Unexpected");
3228
- return me(i.id, t.id) ? void 0 : i;
3296
+ return ve(i.id, t.id) ? void 0 : i;
3229
3297
  } catch (s) {
3230
3298
  this.logger.warn(s);
3231
3299
  return;
@@ -3243,9 +3311,9 @@ class Ps extends cr {
3243
3311
  if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
3244
3312
  switch (t.type) {
3245
3313
  case "from-registry-v1":
3246
- return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3314
+ return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
3247
3315
  case "from-registry-v2":
3248
- return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3316
+ return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
3249
3317
  case "dev-v1":
3250
3318
  return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3251
3319
  case "dev-v2":
@@ -3255,7 +3323,7 @@ class Ps extends cr {
3255
3323
  }
3256
3324
  }
3257
3325
  }
3258
- class at {
3326
+ class ut {
3259
3327
  constructor() {
3260
3328
  d(this, "resources", /* @__PURE__ */ new Map());
3261
3329
  }
@@ -3290,12 +3358,12 @@ class at {
3290
3358
  return (t = this.resources.get(e)) == null ? void 0 : t.resource;
3291
3359
  }
3292
3360
  }
3293
- function ct(o) {
3361
+ function lt(o) {
3294
3362
  return String(o.id);
3295
3363
  }
3296
- class Fs {
3364
+ class xs {
3297
3365
  constructor(e, t) {
3298
- d(this, "pFrame", new Fr());
3366
+ d(this, "pFrame", new Rr());
3299
3367
  d(this, "blobIdToResource", /* @__PURE__ */ new Map());
3300
3368
  d(this, "blobHandleComputables", /* @__PURE__ */ new Map());
3301
3369
  d(this, "preloadBlob", async (e) => {
@@ -3308,8 +3376,8 @@ class Fs {
3308
3376
  });
3309
3377
  this.blobDriver = e, this.columns = t, this.pFrame.setDataSource(this);
3310
3378
  for (const r of t) {
3311
- for (const i of Fo(r.data)) this.blobIdToResource.set(ct(i), i);
3312
- const s = Ro(r.data, ct);
3379
+ for (const i of Ro(r.data)) this.blobIdToResource.set(lt(i), i);
3380
+ const s = Oo(r.data, lt);
3313
3381
  try {
3314
3382
  this.pFrame.addColumnSpec(r.id, r.spec), this.pFrame.setColumnData(r.id, s);
3315
3383
  } catch (i) {
@@ -3331,33 +3399,33 @@ class Fs {
3331
3399
  this.pFrame.dispose();
3332
3400
  }
3333
3401
  }
3334
- class Rs {
3402
+ class js {
3335
3403
  constructor(e) {
3336
3404
  d(this, "pFrames");
3337
3405
  d(this, "pTables");
3338
- this.blobDriver = e, this.pFrames = new class extends at {
3406
+ this.blobDriver = e, this.pFrames = new class extends ut {
3339
3407
  constructor(t) {
3340
3408
  super(), this.blobDriver = t;
3341
3409
  }
3342
3410
  createNewResource(t) {
3343
- return new Fs(this.blobDriver, t);
3411
+ return new xs(this.blobDriver, t);
3344
3412
  }
3345
3413
  calculateParamsKey(t) {
3346
- return Os(t);
3414
+ return Es(t);
3347
3415
  }
3348
- }(this.blobDriver), this.pTables = new class extends at {
3416
+ }(this.blobDriver), this.pTables = new class extends ut {
3349
3417
  constructor(t) {
3350
3418
  super(), this.pFrames = t;
3351
3419
  }
3352
3420
  async createNewResource(t) {
3353
3421
  const s = await this.pFrames.getByKey(t.pFrameHandle).pFrame.createTable({
3354
- src: Q(t.def.src),
3422
+ src: Z(t.def.src),
3355
3423
  filters: t.def.filters
3356
3424
  });
3357
3425
  return t.def.sorting.length !== 0 ? s.sort(t.def.sorting) : s;
3358
3426
  }
3359
3427
  calculateParamsKey(t) {
3360
- return Bs(t);
3428
+ return Ts(t);
3361
3429
  }
3362
3430
  }(this.pFrames);
3363
3431
  }
@@ -3365,11 +3433,11 @@ class Rs {
3365
3433
  // Internal / Config API Methods
3366
3434
  //
3367
3435
  createPFrame(e, t) {
3368
- const r = e.map((i) => q(i, (n) => jo(n))), s = this.pFrames.acquire(r);
3436
+ const r = e.map((i) => Q(i, (n) => Ao(n))), s = this.pFrames.acquire(r);
3369
3437
  return t.addOnDestroy(s.unref), s.key;
3370
3438
  }
3371
3439
  createPTable(e, t) {
3372
- const r = this.createPFrame(Ds(e.src), t), s = ut(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3440
+ const r = this.createPFrame(As(e.src), t), s = dt(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3373
3441
  return t.addOnDestroy(i.unref), i.key;
3374
3442
  }
3375
3443
  //
@@ -3394,7 +3462,7 @@ class Rs {
3394
3462
  }
3395
3463
  async calculateTableData(e, t) {
3396
3464
  let r = await this.pFrames.getByKey(e).pFrame.createTable({
3397
- src: Q(t.src),
3465
+ src: Z(t.src),
3398
3466
  filters: t.filters
3399
3467
  });
3400
3468
  if (t.sorting.length > 0) {
@@ -3423,7 +3491,7 @@ class Rs {
3423
3491
  return (await this.pTables.getByKey(e)).getData(t, r);
3424
3492
  }
3425
3493
  }
3426
- function Q(o) {
3494
+ function Z(o) {
3427
3495
  switch (o.type) {
3428
3496
  case "column":
3429
3497
  return {
@@ -3435,67 +3503,67 @@ function Q(o) {
3435
3503
  case "full":
3436
3504
  return {
3437
3505
  type: o.type,
3438
- entries: o.entries.map((e) => Q(e))
3506
+ entries: o.entries.map((e) => Z(e))
3439
3507
  };
3440
3508
  case "outer":
3441
3509
  return {
3442
3510
  type: "outer",
3443
- primary: Q(o.primary),
3444
- secondary: o.secondary.map((e) => Q(e))
3511
+ primary: Z(o.primary),
3512
+ secondary: o.secondary.map((e) => Z(e))
3445
3513
  };
3446
3514
  default:
3447
3515
  O(o);
3448
3516
  }
3449
3517
  }
3450
- function Bs(o) {
3451
- const e = ge("sha256");
3452
- return e.update(o.pFrameHandle), e.update(je(o.def)), e.digest().toString("hex");
3518
+ function Ts(o) {
3519
+ const e = he("sha256");
3520
+ return e.update(o.pFrameHandle), e.update(Ae(o.def)), e.digest().toString("hex");
3453
3521
  }
3454
- function Os(o) {
3455
- const e = o.map((s) => s.id).sort(), t = ge("sha256");
3522
+ function Es(o) {
3523
+ const e = o.map((s) => s.id).sort(), t = he("sha256");
3456
3524
  let r = "";
3457
3525
  for (const s of e)
3458
3526
  r !== s && (t.update(s), r = s);
3459
3527
  return t.digest().toString("hex");
3460
3528
  }
3461
- function Ds(o) {
3529
+ function As(o) {
3462
3530
  const e = /* @__PURE__ */ new Map();
3463
- return ae(o, e), [...e.values()];
3531
+ return ce(o, e), [...e.values()];
3464
3532
  }
3465
- function ae(o, e) {
3533
+ function ce(o, e) {
3466
3534
  switch (o.type) {
3467
3535
  case "column":
3468
3536
  e.set(o.column.id, o.column);
3469
3537
  return;
3470
3538
  case "full":
3471
3539
  case "inner":
3472
- for (const t of o.entries) ae(t, e);
3540
+ for (const t of o.entries) ce(t, e);
3473
3541
  return;
3474
3542
  case "outer":
3475
- ae(o.primary, e);
3476
- for (const t of o.secondary) ae(t, e);
3543
+ ce(o.primary, e);
3544
+ for (const t of o.secondary) ce(t, e);
3477
3545
  return;
3478
3546
  default:
3479
3547
  O(o);
3480
3548
  }
3481
3549
  }
3482
- async function xs(o, e) {
3483
- const t = { ...Jt, ...e };
3484
- Ts(t.logger, t);
3485
- const r = new pt(t.localSecret), s = hr(t.logger, o, t.platformLocalStorageNameToPath), i = fr(o, t.logger), n = mr(o, t.logger), a = vr(o, t.logger), c = yr(o, t.logger), u = new br(
3550
+ async function Is(o, e) {
3551
+ const t = { ...Kt, ...e };
3552
+ Ns(t.logger, t);
3553
+ const r = new ht(t.localSecret), s = mr(t.logger, o, t.platformLocalStorageNameToPath), i = vr(o, t.logger), n = yr(o, t.logger), a = br(o, t.logger), c = wr(o, t.logger), u = new Sr(
3486
3554
  t.logger,
3487
3555
  s,
3488
3556
  i,
3489
3557
  t.blobDownloadPath,
3490
3558
  r,
3491
3559
  t.blobDriverOps
3492
- ), l = new wr(
3560
+ ), l = new kr(
3493
3561
  t.logger,
3494
3562
  r,
3495
3563
  n,
3496
3564
  a,
3497
3565
  t.uploadDriverOps
3498
- ), p = new Sr(i, t.logStreamDriverOps), g = new kr(p, u), f = new Cr(t.logger, c, o, r, t.localStorageNameToPath), v = new Rs(u);
3566
+ ), p = new Cr(i, t.logStreamDriverOps), g = new Pr(p, u), f = new Fr(t.logger, c, o, r, t.localStorageNameToPath), v = new js(u);
3499
3567
  return {
3500
3568
  blobDriver: u,
3501
3569
  logDriver: g,
@@ -3505,8 +3573,8 @@ async function xs(o, e) {
3505
3573
  pFrameDriver: v
3506
3574
  };
3507
3575
  }
3508
- function Ts(o, e) {
3509
- e.localStorageNameToPath.local != mt.homedir() && o.info(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3576
+ function Ns(o, e) {
3577
+ e.localStorageNameToPath.local != yt.homedir() && o.info(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3510
3578
  const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
3511
3579
  (s) => t.includes(s)
3512
3580
  );
@@ -3515,7 +3583,7 @@ function Ts(o, e) {
3515
3583
  `Platform local storages include one or more local storages: ${r}. Note that we automatically included 'local' storage with user's home directory.`
3516
3584
  );
3517
3585
  }
3518
- class Kt {
3586
+ class Ut {
3519
3587
  constructor(e, t, r, s, i, n, a, c) {
3520
3588
  d(this, "pl");
3521
3589
  /** Contains a reactive list of projects along with their meta information. */
@@ -3534,10 +3602,10 @@ class Kt {
3534
3602
  // Project List Manipulation
3535
3603
  //
3536
3604
  /** Creates a project with initial state and adds it to project list. */
3537
- async createProject(e, t = Z()) {
3605
+ async createProject(e, t = X()) {
3538
3606
  const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
3539
- const i = await Po(s, e);
3540
- return s.createField(S(this.projectListResourceId, t), "Dynamic", i), await s.commit(), await nr(i);
3607
+ const i = await Bo(s, e);
3608
+ return s.createField(S(this.projectListResourceId, t), "Dynamic", i), await s.commit(), await cr(i);
3541
3609
  });
3542
3610
  return await this.projectListTree.refreshState(), r;
3543
3611
  }
@@ -3557,7 +3625,7 @@ class Kt {
3557
3625
  async projectIdToResourceId(e) {
3558
3626
  return await this.pl.withReadTx("Project id to resource id", async (t) => {
3559
3627
  const r = (await t.getField(S(this.projectListResourceId, e))).value;
3560
- if (ce(r)) throw new Error("Unexpected project list structure.");
3628
+ if (Y(r)) throw new Error("Unexpected project list structure.");
3561
3629
  return r;
3562
3630
  });
3563
3631
  }
@@ -3568,7 +3636,7 @@ class Kt {
3568
3636
  async openProject(e) {
3569
3637
  const t = await this.ensureProjectRid(e);
3570
3638
  if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
3571
- this.openedProjectsByRid.set(t, await Ke.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3639
+ this.openedProjectsByRid.set(t, await Ue.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3572
3640
  }
3573
3641
  /** Closes the project, and deallocate all corresponding resources. */
3574
3642
  async closeProject(e) {
@@ -3596,29 +3664,29 @@ class Kt {
3596
3664
  /** Generates sufficiently random string to be used as local secret for the
3597
3665
  * middle layer */
3598
3666
  static generateLocalSecret() {
3599
- return pt.generateSecret();
3667
+ return ht.generateSecret();
3600
3668
  }
3601
3669
  /** Initialize middle layer */
3602
3670
  static async init(e, t) {
3603
- const r = { ...Ss, ...t };
3671
+ const r = { ...Bs, ...t };
3604
3672
  process.env.MI_LOG_TREE_STAT && (r.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3605
3673
  const s = await e.withWriteTx("MLInitialization", async (v) => {
3606
- const D = S(v.clientRoot, Hr);
3674
+ const D = S(v.clientRoot, Wr);
3607
3675
  v.createField(D, "Dynamic");
3608
3676
  const V = await v.getField(D);
3609
- if (ce(V.value)) {
3610
- const K = v.createEphemeral(St);
3611
- return v.lock(K), v.setField(D, K), await v.commit(), await K.globalId;
3677
+ if (Y(V.value)) {
3678
+ const M = v.createEphemeral(Ct);
3679
+ return v.lock(M), v.setField(D, M), await v.commit(), await M.globalId;
3612
3680
  } else
3613
3681
  return V.value;
3614
- }), i = r.logger, n = await xs(e, r), a = new _t(e.httpDispatcher, {
3682
+ }), i = r.logger, n = await Is(e, r), a = new zt(e.httpDispatcher, {
3615
3683
  minTimeout: 250,
3616
3684
  maxRetries: 4
3617
- }), c = new Er(a), u = new vo(
3685
+ }), c = new Ir(a), u = new bo(
3618
3686
  c,
3619
3687
  n.signer,
3620
3688
  a
3621
- ), l = new Pr(
3689
+ ), l = new Br(
3622
3690
  i,
3623
3691
  e.httpDispatcher,
3624
3692
  r.frontendDownloadPath
@@ -3632,13 +3700,13 @@ class Kt {
3632
3700
  bpPreparer: u,
3633
3701
  frontendDownloadDriver: l,
3634
3702
  driverKit: n,
3635
- blockUpdateWatcher: new Ps(c, i, {
3703
+ blockUpdateWatcher: new Ds(c, i, {
3636
3704
  minDelay: r.devBlockUpdateRecheckInterval,
3637
3705
  http: a
3638
3706
  }),
3639
- quickJs: await pr()
3640
- }, g = new ur([]), f = await Wr(e, s, g, p);
3641
- return new Kt(
3707
+ quickJs: await hr()
3708
+ }, g = new dr([]), f = await Yr(e, s, g, p);
3709
+ return new Ut(
3642
3710
  p,
3643
3711
  n,
3644
3712
  n.signer,
@@ -3651,30 +3719,30 @@ class Kt {
3651
3719
  }
3652
3720
  }
3653
3721
  export {
3654
- ei as BlockPackRegistry,
3655
- ti as CentralBlockRegistry,
3656
- Jt as DefaultDriverKitOps,
3657
- Ss as DefaultMiddleLayerOps,
3658
- Pt as FrontendFromFolderResourceType,
3659
- Ct as FrontendFromUrlResourceType,
3660
- Kt as MiddleLayer,
3661
- Ke as Project,
3662
- oo as TengoTemplateGet,
3663
- so as TengoTemplateGetRegistry,
3664
- no as TengoTemplateGetTemplate,
3665
- io as TengoTemplateGetTemplateURI,
3666
- ao as TengoTemplatePack,
3667
- co as TengoTemplatePackConvert,
3668
- lo as TengoTemplatePackConvertTemplate,
3669
- uo as TengoTemplatePackConvertTemplatePack,
3670
- oi as V1CentralDevSnapshotRegistry,
3671
- ri as V1CentralRegistry,
3672
- Er as V2RegistryProvider,
3673
- kt as createRenderTemplate,
3674
- yt as getDevV1PacketMtime,
3675
- Ie as getDevV2PacketMtime,
3676
- xs as initDriverKit,
3677
- Ve as loadTemplate,
3678
- po as prepareTemplateSpec
3722
+ ii as BlockPackRegistry,
3723
+ ni as CentralBlockRegistry,
3724
+ Kt as DefaultDriverKitOps,
3725
+ Bs as DefaultMiddleLayerOps,
3726
+ Bt as FrontendFromFolderResourceType,
3727
+ Ft as FrontendFromUrlResourceType,
3728
+ Ut as MiddleLayer,
3729
+ Ue as Project,
3730
+ io as TengoTemplateGet,
3731
+ no as TengoTemplateGetRegistry,
3732
+ co as TengoTemplateGetTemplate,
3733
+ ao as TengoTemplateGetTemplateURI,
3734
+ uo as TengoTemplatePack,
3735
+ lo as TengoTemplatePackConvert,
3736
+ go as TengoTemplatePackConvertTemplate,
3737
+ po as TengoTemplatePackConvertTemplatePack,
3738
+ ci as V1CentralDevSnapshotRegistry,
3739
+ ai as V1CentralRegistry,
3740
+ Ir as V2RegistryProvider,
3741
+ Pt as createRenderTemplate,
3742
+ wt as getDevV1PacketMtime,
3743
+ Ve as getDevV2PacketMtime,
3744
+ Is as initDriverKit,
3745
+ Je as loadTemplate,
3746
+ ho as prepareTemplateSpec
3679
3747
  };
3680
3748
  //# sourceMappingURL=index.mjs.map