@blue-labs/document-processor 3.5.0 → 3.6.0

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { evaluate as wt } from "@blue-quickjs/quickjs-runtime";
2
- import { validateDv as bt, DV_LIMIT_DEFAULTS as kt } from "@blue-quickjs/dv";
2
+ import { validateDv as kt, DV_LIMIT_DEFAULTS as bt } from "@blue-quickjs/dv";
3
3
  import { HOST_V1_MANIFEST as It, HOST_V1_HASH as Tt } from "@blue-quickjs/abi-manifest";
4
- import { BlueNode as p, withTypeBlueId as g, blueNodeField as k, Properties as Te, BlueIdCalculator as Pt, Blue as Mt, MergingProcessors as B } from "@blue-labs/language";
4
+ import { BlueNode as p, withTypeBlueId as g, blueNodeField as b, Properties as Te, BlueIdCalculator as Pt, Blue as Mt, MergingProcessors as B } from "@blue-labs/language";
5
5
  import Pe from "picomatch";
6
6
  import { z as l, ZodError as Ee } from "zod";
7
7
  import { isNullable as de } from "@blue-labs/shared-utils";
@@ -12,28 +12,28 @@ function Nt(i) {
12
12
  function Ot(i) {
13
13
  return { ok: !1, error: i };
14
14
  }
15
- function Qi(i) {
15
+ function Xi(i) {
16
16
  return i.ok;
17
17
  }
18
- function Xi(i) {
18
+ function Zi(i) {
19
19
  return !i.ok;
20
20
  }
21
- function Zi(i, e) {
21
+ function Yi(i, e) {
22
22
  return i.ok ? Nt(e(i.value)) : i;
23
23
  }
24
- function Yi(i, e) {
24
+ function eo(i, e) {
25
25
  return i.ok ? i : Ot(e(i.error));
26
26
  }
27
- function eo(i, e) {
27
+ function to(i, e) {
28
28
  return i.ok ? e(i.value) : i;
29
29
  }
30
- function to(i, e) {
30
+ function no(i, e) {
31
31
  return i.ok ? i.value : e;
32
32
  }
33
- function no(i, e) {
33
+ function ro(i, e) {
34
34
  return i.ok ? i.value : e(i.error);
35
35
  }
36
- function ro(i, e) {
36
+ function io(i, e) {
37
37
  return i.ok ? e.ok(i.value) : e.err(i.error);
38
38
  }
39
39
  const S = {
@@ -116,7 +116,7 @@ function je(i) {
116
116
  i
117
117
  );
118
118
  }
119
- const io = {
119
+ const oo = {
120
120
  KEY_EMBEDDED: We,
121
121
  KEY_INITIALIZED: Ge,
122
122
  KEY_TERMINATED: qe,
@@ -135,7 +135,7 @@ function Ye(i, e) {
135
135
  function et(i, e) {
136
136
  return `${ie(i)}${Ze}/${e}`;
137
137
  }
138
- const oo = {
138
+ const so = {
139
139
  RELATIVE_CONTRACTS: V,
140
140
  RELATIVE_INITIALIZED: pe,
141
141
  RELATIVE_TERMINATED: Je,
@@ -150,7 +150,7 @@ const oo = {
150
150
  function tt(i) {
151
151
  return i == null || i.length === 0;
152
152
  }
153
- function b(i) {
153
+ function k(i) {
154
154
  return tt(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
155
155
  }
156
156
  function P(i) {
@@ -168,16 +168,16 @@ function Me(i) {
168
168
  e = e.substring(0, e.length - 1);
169
169
  return e;
170
170
  }
171
- function so(i, e) {
171
+ function ao(i, e) {
172
172
  const t = Me(i), n = Me(e);
173
173
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
174
174
  }
175
175
  function T(i, e) {
176
- const t = b(i), n = P(e);
176
+ const t = k(i), n = P(e);
177
177
  return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
178
178
  }
179
179
  function Ft(i, e) {
180
- const t = b(i), n = P(e);
180
+ const t = k(i), n = P(e);
181
181
  if (t === "/" || !n.startsWith(t))
182
182
  return n;
183
183
  if (n.length === t.length)
@@ -371,7 +371,7 @@ function Zt(i) {
371
371
  function W(i, e, t) {
372
372
  const n = i === void 0 ? e : i;
373
373
  try {
374
- bt(n, { limits: kt });
374
+ kt(n, { limits: bt });
375
375
  } catch (r) {
376
376
  const o = r instanceof Error ? r.message : String(r);
377
377
  throw new TypeError(
@@ -586,26 +586,26 @@ const oe = g(m["Core/Contract"])(l.object({
586
586
  order: l.number().optional()
587
587
  })), ve = oe, _ = g(m["Core/Channel"])(oe.extend({
588
588
  description: l.string().optional(),
589
- event: k().optional(),
589
+ event: b().optional(),
590
590
  name: l.string().optional()
591
591
  })), L = _.merge(
592
592
  ve
593
593
  ).extend({
594
594
  path: l.string().optional(),
595
- definition: k().optional()
595
+ definition: b().optional()
596
596
  }), lt = g(m["Core/Handler"])(oe.extend({
597
597
  channel: l.string().optional(),
598
598
  description: l.string().optional(),
599
- event: k().optional(),
599
+ event: b().optional(),
600
600
  name: l.string().optional()
601
601
  })), ut = lt.merge(ve), K = g(m["Core/Marker"])(oe.extend({
602
602
  description: l.string().optional(),
603
603
  name: l.string().optional()
604
- })), N = K.merge(ve), ln = l.object({
604
+ })), R = K.merge(ve), ln = l.object({
605
605
  op: l.enum(["ADD", "REPLACE", "REMOVE"]),
606
606
  path: l.string(),
607
- val: k().optional()
608
- }), ao = g("JsonPatch")(
607
+ val: b().optional()
608
+ }), co = g("JsonPatch")(
609
609
  ln
610
610
  ).superRefine((i, e) => {
611
611
  i.op === "REMOVE" && i.val !== void 0 && e.addIssue({
@@ -679,50 +679,50 @@ const oe = g(m["Core/Contract"])(l.object({
679
679
  name: l.string().optional()
680
680
  })), dt = vn.merge(L), wn = g(m["Core/Channel Event Checkpoint"])(K.extend({
681
681
  description: l.string().optional(),
682
- lastEvents: l.record(l.string(), k()).optional(),
682
+ lastEvents: l.record(l.string(), b()).optional(),
683
683
  name: l.string().optional()
684
- })), bn = wn.merge(N).extend({
684
+ })), kn = wn.merge(R).extend({
685
685
  lastSignatures: l.record(l.string()).optional()
686
- }), kn = g(m["Core/Processing Initialized Marker"])(K.extend({
686
+ }), bn = g(m["Core/Processing Initialized Marker"])(K.extend({
687
687
  description: l.string().optional(),
688
688
  documentId: l.string().optional(),
689
689
  name: l.string().optional()
690
- })), In = kn.merge(N), Tn = g(m["Core/Process Embedded"])(K.extend({
690
+ })), In = bn.merge(R), Tn = g(m["Core/Process Embedded"])(K.extend({
691
691
  description: l.string().optional(),
692
692
  name: l.string().optional(),
693
693
  paths: l.array(l.string()).optional()
694
694
  })), Pn = Tn.merge(
695
- N
695
+ R
696
696
  ), Mn = g(m["Core/Processing Terminated Marker"])(K.extend({
697
697
  cause: l.string().optional(),
698
698
  description: l.string().optional(),
699
699
  name: l.string().optional(),
700
700
  reason: l.string().optional()
701
- })), Rn = Mn.merge(N), J = g(w["Conversation/Operation"])(K.extend({
701
+ })), Rn = Mn.merge(R), J = g(w["Conversation/Operation"])(K.extend({
702
702
  channel: l.string().optional(),
703
703
  description: l.string().optional(),
704
704
  name: l.string().optional(),
705
- request: k().optional()
705
+ request: b().optional()
706
706
  })), Nn = J.merge(
707
- N
707
+ R
708
708
  ), On = g(I["MyOS/Document Anchor"])(l.object({
709
709
  description: l.string().optional(),
710
710
  name: l.string().optional(),
711
- template: k().optional()
712
- })), An = g(I["MyOS/Document Anchors"])(l.object({}).catchall(On)), Dn = An.merge(N), Bn = g(I["MyOS/Link"])(l.object({
711
+ template: b().optional()
712
+ })), An = g(I["MyOS/Document Anchors"])(l.object({}).catchall(On)), Dn = An.merge(R), Bn = g(I["MyOS/Link"])(l.object({
713
713
  anchor: l.string().optional(),
714
714
  description: l.string().optional(),
715
715
  name: l.string().optional()
716
716
  })), xn = g(I["MyOS/Document Links"])(l.object({}).catchall(Bn)), _n = xn.merge(
717
- N
717
+ R
718
718
  ), Ln = g(I["MyOS/MyOS Participants Orchestration"])(l.object({
719
719
  name: l.string().optional()
720
- })), Fn = Ln.merge(N), $n = g(I["MyOS/MyOS Session Interaction"])(l.object({
720
+ })), Fn = Ln.merge(R), $n = g(I["MyOS/MyOS Session Interaction"])(l.object({
721
721
  name: l.string().optional()
722
- })), Un = $n.merge(N), zn = g(I["MyOS/MyOS Worker Agency"])(l.object({
722
+ })), Un = $n.merge(R), zn = g(I["MyOS/MyOS Worker Agency"])(l.object({
723
723
  name: l.string().optional()
724
724
  })), Hn = zn.merge(
725
- N
725
+ R
726
726
  ), se = g(w["Conversation/Sequential Workflow Step"])(l.object({
727
727
  description: l.string().optional(),
728
728
  name: l.string().optional()
@@ -730,8 +730,8 @@ const oe = g(m["Core/Contract"])(l.object({
730
730
  description: l.string().optional(),
731
731
  name: l.string().optional(),
732
732
  steps: l.array(se).optional()
733
- })), co = k(), Vn = pt.merge(ut).extend({
734
- steps: l.array(k()).optional()
733
+ })), lo = b(), Vn = pt.merge(ut).extend({
734
+ steps: l.array(b()).optional()
735
735
  }), Kn = g(w["Conversation/Sequential Workflow Operation"])(pt.extend({
736
736
  description: l.string().optional(),
737
737
  name: l.string().optional(),
@@ -739,7 +739,7 @@ const oe = g(m["Core/Contract"])(l.object({
739
739
  })), Wn = Kn.merge(
740
740
  ut
741
741
  ).extend({
742
- steps: l.array(k()).optional()
742
+ steps: l.array(b()).optional()
743
743
  });
744
744
  function Gn(i) {
745
745
  if (!Array.isArray(i.blueIds) || i.blueIds.length === 0)
@@ -907,8 +907,8 @@ class Xn {
907
907
  }, E = h.contract, C = E.event;
908
908
  if (C && !t.blue.isTypeOfNode(v, C) || !await d.matches(E, f))
909
909
  continue;
910
- const D = d.channelize, ke = (D ? D.call(d, E, f) : void 0) ?? v.clone();
911
- this.enrichEvent(ke, u);
910
+ const D = d.channelize, be = (D ? D.call(d, E, f) : void 0) ?? v.clone();
911
+ this.enrichEvent(be, u);
912
912
  const Ie = Jn(
913
913
  t.bindingKey,
914
914
  u
@@ -923,7 +923,7 @@ class Xn {
923
923
  markers: t.markers
924
924
  });
925
925
  c.push({
926
- eventNode: ke,
926
+ eventNode: be,
927
927
  eventId: a,
928
928
  checkpointKey: Ie,
929
929
  shouldProcess: vt
@@ -981,25 +981,25 @@ const Zn = g(w["Conversation/Actor"])(l.object({
981
981
  description: l.string().optional(),
982
982
  name: l.string().optional(),
983
983
  timelineId: l.string().optional()
984
- })), R = g(w["Conversation/Timeline Entry"])(l.object({
984
+ })), N = g(w["Conversation/Timeline Entry"])(l.object({
985
985
  actor: Zn.optional(),
986
986
  description: l.string().optional(),
987
- message: k().optional(),
987
+ message: b().optional(),
988
988
  name: l.string().optional(),
989
- prevEntry: k().optional(),
989
+ prevEntry: b().optional(),
990
990
  timeline: ft.optional(),
991
991
  timestamp: l.number().optional()
992
992
  })), Yn = g(I["MyOS/MyOS Timeline"])(ft.extend({
993
993
  accountId: l.string().optional(),
994
994
  description: l.string().optional(),
995
995
  name: l.string().optional()
996
- })), De = g(I["MyOS/MyOS Timeline Entry"])(R.extend({
996
+ })), De = g(I["MyOS/MyOS Timeline Entry"])(N.extend({
997
997
  description: l.string().optional(),
998
998
  name: l.string().optional(),
999
999
  timeline: Yn.optional()
1000
1000
  }));
1001
1001
  function Be(i, e) {
1002
- return e && i.isTypeOf(e, R, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, R) : null;
1002
+ return e && i.isTypeOf(e, N, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, N) : null;
1003
1003
  }
1004
1004
  function mt(i, e, t) {
1005
1005
  const n = Be(i, e), r = Be(i, t);
@@ -1009,7 +1009,7 @@ function mt(i, e, t) {
1009
1009
  return typeof o != "number" || typeof s != "number" ? !0 : o >= s;
1010
1010
  }
1011
1011
  function xe(i, e) {
1012
- return i.isTypeOf(e, De) ? i.nodeToSchemaOutput(e, De) : i.isTypeOf(e, R) ? i.nodeToSchemaOutput(e, R) : null;
1012
+ return i.isTypeOf(e, De) ? i.nodeToSchemaOutput(e, De) : i.isTypeOf(e, N) ? i.nodeToSchemaOutput(e, N) : null;
1013
1013
  }
1014
1014
  class er {
1015
1015
  kind = "channel";
@@ -1040,14 +1040,14 @@ class tr {
1040
1040
  schema = yn;
1041
1041
  matches(e, t) {
1042
1042
  const { event: n, blue: r } = t;
1043
- if (!n || !r.isTypeOf(n, R))
1043
+ if (!n || !r.isTypeOf(n, N))
1044
1044
  return !1;
1045
- const s = r.nodeToSchemaOutput(n, R).timeline?.timelineId;
1045
+ const s = r.nodeToSchemaOutput(n, N).timeline?.timelineId;
1046
1046
  return !(!s || !e.timelineId || s !== e.timelineId);
1047
1047
  }
1048
1048
  channelize(e, t) {
1049
1049
  const { event: n, blue: r } = t;
1050
- return !n || !r.isTypeOf(n, R) ? null : n.clone();
1050
+ return !n || !r.isTypeOf(n, N) ? null : n.clone();
1051
1051
  }
1052
1052
  isNewerEvent(e, t, n) {
1053
1053
  const { event: r, blue: o } = t;
@@ -1056,7 +1056,7 @@ class tr {
1056
1056
  }
1057
1057
  const _e = g(w["Conversation/Trigger Event"])(se.extend({
1058
1058
  description: l.string().optional(),
1059
- event: k().optional(),
1059
+ event: b().optional(),
1060
1060
  name: l.string().optional()
1061
1061
  }));
1062
1062
  function we(i) {
@@ -1181,7 +1181,7 @@ const cr = g(m["Core/Json Patch Entry"])(l.object({
1181
1181
  name: l.string().optional(),
1182
1182
  op: l.string().optional(),
1183
1183
  path: l.string().optional(),
1184
- val: k().optional()
1184
+ val: b().optional()
1185
1185
  })), Fe = g(w["Conversation/Update Document"])(se.extend({
1186
1186
  changeset: l.array(cr).optional(),
1187
1187
  description: l.string().optional(),
@@ -1234,14 +1234,14 @@ class lr {
1234
1234
  return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
1235
1235
  }
1236
1236
  }
1237
- const be = [
1237
+ const ke = [
1238
1238
  new ir(),
1239
1239
  new ar(),
1240
1240
  new lr()
1241
1241
  ];
1242
1242
  class gt {
1243
1243
  executorIndex;
1244
- constructor(e = be) {
1244
+ constructor(e = ke) {
1245
1245
  const t = /* @__PURE__ */ new Map();
1246
1246
  for (const n of e)
1247
1247
  for (const r of n.supportedBlueIds)
@@ -1294,7 +1294,7 @@ class ur {
1294
1294
  ];
1295
1295
  schema = Vn;
1296
1296
  runner;
1297
- constructor(e = be) {
1297
+ constructor(e = ke) {
1298
1298
  this.runner = new gt(e);
1299
1299
  }
1300
1300
  async matches(e, t) {
@@ -1312,6 +1312,11 @@ class ur {
1312
1312
  }
1313
1313
  }
1314
1314
  class hr {
1315
+ kind = "marker";
1316
+ blueIds = [m["Core/Marker"]];
1317
+ schema = R;
1318
+ }
1319
+ class dr {
1315
1320
  kind = "marker";
1316
1321
  blueIds = [w["Conversation/Operation"]];
1317
1322
  schema = Nn;
@@ -1319,10 +1324,10 @@ class hr {
1319
1324
  const me = g(w["Conversation/Operation Request"])(l.object({
1320
1325
  allowNewerVersion: l.boolean().optional(),
1321
1326
  description: l.string().optional(),
1322
- document: k().optional(),
1327
+ document: b().optional(),
1323
1328
  name: l.string().optional(),
1324
1329
  operation: l.string().optional(),
1325
- request: k().optional()
1330
+ request: b().optional()
1326
1331
  }));
1327
1332
  function Et(i) {
1328
1333
  const e = i.channel;
@@ -1333,19 +1338,19 @@ function Et(i) {
1333
1338
  }
1334
1339
  return null;
1335
1340
  }
1336
- function dr(i, e) {
1341
+ function pr(i, e) {
1337
1342
  const t = i.getProperties()?.document;
1338
1343
  return t instanceof p ? e.blue.calculateBlueIdSync(t) : null;
1339
1344
  }
1340
- function pr(i, e) {
1345
+ function fr(i, e) {
1341
1346
  if (e.isTypeOf(i, me, {
1342
1347
  checkSchemaExtensions: !0
1343
1348
  }))
1344
1349
  return i;
1345
- if (e.isTypeOf(i, R, {
1350
+ if (e.isTypeOf(i, N, {
1346
1351
  checkSchemaExtensions: !0
1347
1352
  })) {
1348
- const n = e.nodeToSchemaOutput(i, R).message;
1353
+ const n = e.nodeToSchemaOutput(i, N).message;
1349
1354
  if (n && e.isTypeOf(n, me, {
1350
1355
  checkSchemaExtensions: !0
1351
1356
  }))
@@ -1353,11 +1358,11 @@ function pr(i, e) {
1353
1358
  }
1354
1359
  return null;
1355
1360
  }
1356
- function fr(i, e, t, n) {
1361
+ function mr(i, e, t, n) {
1357
1362
  const { blue: r } = n, o = i.operation;
1358
1363
  return !(!o || t.operation !== o || i.event && !r.isTypeOfNode(e, i.event));
1359
1364
  }
1360
- function mr(i, e) {
1365
+ function gr(i, e) {
1361
1366
  const t = i.operation;
1362
1367
  if (!t)
1363
1368
  return null;
@@ -1372,10 +1377,10 @@ function mr(i, e) {
1372
1377
  ), s = Et(o);
1373
1378
  return { operationNode: r, operation: o, channelKey: s };
1374
1379
  }
1375
- function gr(i, e) {
1380
+ function Er(i, e) {
1376
1381
  return !(i && e && i !== e);
1377
1382
  }
1378
- function Er(i, e, t) {
1383
+ function yr(i, e, t) {
1379
1384
  const n = i.getProperties()?.request, r = e.getProperties()?.request;
1380
1385
  if (!(n instanceof p) || !(r instanceof p))
1381
1386
  return !1;
@@ -1387,10 +1392,10 @@ function Er(i, e, t) {
1387
1392
  }
1388
1393
  return !0;
1389
1394
  }
1390
- function yr(i, e, t) {
1395
+ function Cr(i, e, t) {
1391
1396
  if (!i || i.allowNewerVersion !== !1)
1392
1397
  return !0;
1393
- const n = dr(e, t);
1398
+ const n = pr(e, t);
1394
1399
  if (!n)
1395
1400
  return !0;
1396
1401
  const r = t.resolvePointer("/"), o = t.documentAt(r);
@@ -1399,14 +1404,14 @@ function yr(i, e, t) {
1399
1404
  const c = (o.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(o);
1400
1405
  return n === u;
1401
1406
  }
1402
- class Cr {
1407
+ class Sr {
1403
1408
  kind = "handler";
1404
1409
  blueIds = [
1405
1410
  w["Conversation/Sequential Workflow Operation"]
1406
1411
  ];
1407
1412
  schema = Wn;
1408
1413
  runner;
1409
- constructor(e = be) {
1414
+ constructor(e = ke) {
1410
1415
  this.runner = new gt(e);
1411
1416
  }
1412
1417
  deriveChannel(e, t) {
@@ -1425,7 +1430,7 @@ class Cr {
1425
1430
  const n = t.event();
1426
1431
  if (!n)
1427
1432
  return !1;
1428
- const r = pr(
1433
+ const r = fr(
1429
1434
  n,
1430
1435
  t.blue
1431
1436
  );
@@ -1435,17 +1440,17 @@ class Cr {
1435
1440
  r,
1436
1441
  me
1437
1442
  );
1438
- if (!o || !fr(e, n, o, t))
1443
+ if (!o || !mr(e, n, o, t))
1439
1444
  return !1;
1440
- const s = mr(e, t);
1445
+ const s = gr(e, t);
1441
1446
  if (!s)
1442
1447
  return !1;
1443
1448
  const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
1444
- return !(!gr(s.channelKey, c) || !Er(
1449
+ return !(!Er(s.channelKey, c) || !yr(
1445
1450
  r,
1446
1451
  s.operationNode,
1447
1452
  t.blue
1448
- ) || o?.allowNewerVersion === !1 && !yr(o, r, t));
1453
+ ) || o?.allowNewerVersion === !1 && !Cr(o, r, t));
1449
1454
  }
1450
1455
  async execute(e, t, n) {
1451
1456
  const r = t.event();
@@ -1467,7 +1472,7 @@ class ae {
1467
1472
  );
1468
1473
  }
1469
1474
  registerDefaults() {
1470
- return this.registry.register(new Xn()), this.registry.register(new er()), this.registry.register(new tr()), this.registry.register(new ur()), this.registry.register(new hr()), this.registry.register(new Cr()), this;
1475
+ return this.registry.register(new Xn()), this.registry.register(new er()), this.registry.register(new tr()), this.registry.register(new ur()), this.registry.register(new dr()), this.registry.register(new hr()), this.registry.register(new Sr()), this;
1471
1476
  }
1472
1477
  register(e) {
1473
1478
  return this.registry.register(e), this;
@@ -1480,7 +1485,7 @@ const ge = m["Core/Channel Event Checkpoint"];
1480
1485
  function yt(i) {
1481
1486
  return typeof i.order == "number" ? i.order : 0;
1482
1487
  }
1483
- class Sr {
1488
+ class vr {
1484
1489
  constructor(e, t, n, r) {
1485
1490
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1486
1491
  }
@@ -1500,7 +1505,7 @@ class Sr {
1500
1505
  return yt(this.bindingContract);
1501
1506
  }
1502
1507
  }
1503
- class vr {
1508
+ class wr {
1504
1509
  constructor(e, t, n, r) {
1505
1510
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1506
1511
  }
@@ -1535,7 +1540,7 @@ class H {
1535
1540
  );
1536
1541
  }
1537
1542
  static builder() {
1538
- return new wr();
1543
+ return new kr();
1539
1544
  }
1540
1545
  static empty() {
1541
1546
  return H.builder().build();
@@ -1577,7 +1582,7 @@ class H {
1577
1582
  handlersFor(e) {
1578
1583
  const t = this.handlersByChannel.get(e);
1579
1584
  return !t || t.length === 0 ? [] : [...t].map(
1580
- (n) => new vr(
1585
+ (n) => new wr(
1581
1586
  n.key,
1582
1587
  n.contract,
1583
1588
  n.blueId,
@@ -1599,7 +1604,7 @@ class H {
1599
1604
  }
1600
1605
  channelsOfType(...e) {
1601
1606
  const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
1602
- (r) => new Sr(
1607
+ (r) => new vr(
1603
1608
  r.key,
1604
1609
  r.contract,
1605
1610
  r.blueId,
@@ -1612,7 +1617,7 @@ class H {
1612
1617
  }), n;
1613
1618
  }
1614
1619
  }
1615
- class wr {
1620
+ class kr {
1616
1621
  channels = /* @__PURE__ */ new Map();
1617
1622
  handlersByChannel = /* @__PURE__ */ new Map();
1618
1623
  markerStore = /* @__PURE__ */ new Map();
@@ -1791,11 +1796,11 @@ class z extends Error {
1791
1796
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1792
1797
  }
1793
1798
  }
1794
- const kr = w["Conversation/Composite Timeline Channel"];
1795
- function Ir(i) {
1799
+ const Ir = w["Conversation/Composite Timeline Channel"];
1800
+ function Tr(i) {
1796
1801
  const { compositeKey: e, contract: t, scopeContracts: n, blueId: r, blue: o } = i, s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), c = [], u = /* @__PURE__ */ new Map([
1797
1802
  [e, t]
1798
- ]), h = (f) => o.isTypeOfBlueId(f.node, kr), d = (f) => {
1803
+ ]), h = (f) => o.isTypeOfBlueId(f.node, Ir), d = (f) => {
1799
1804
  if (u.has(f))
1800
1805
  return u.get(f) ?? null;
1801
1806
  const E = n.get(f);
@@ -1808,7 +1813,7 @@ function Ir(i) {
1808
1813
  );
1809
1814
  return u.set(f, C), C;
1810
1815
  } catch (C) {
1811
- if (Tr(C))
1816
+ if (Pr(C))
1812
1817
  throw new y(
1813
1818
  "Failed to parse channel contract",
1814
1819
  S.invalidContract(
@@ -1849,61 +1854,61 @@ function Ir(i) {
1849
1854
  };
1850
1855
  v(e);
1851
1856
  }
1852
- function Tr(i) {
1857
+ function Pr(i) {
1853
1858
  return i instanceof Ee;
1854
1859
  }
1855
- const Pr = m["Core/Document Update Channel"], Mr = m["Core/Embedded Node Channel"], Rr = m["Core/Lifecycle Event Channel"], Nr = m["Core/Triggered Event Channel"], $e = m["Core/Process Embedded"], Or = m["Core/Processing Initialized Marker"], Ar = m["Core/Processing Terminated Marker"], Dr = m["Core/Channel Event Checkpoint"], Br = I["MyOS/Document Anchors"], xr = I["MyOS/Document Links"], _r = I["MyOS/MyOS Participants Orchestration"], Lr = I["MyOS/MyOS Session Interaction"], Fr = I["MyOS/MyOS Worker Agency"], $r = w["Conversation/Composite Timeline Channel"], le = /* @__PURE__ */ new Map([
1860
+ const Mr = m["Core/Document Update Channel"], Rr = m["Core/Embedded Node Channel"], Nr = m["Core/Lifecycle Event Channel"], Or = m["Core/Triggered Event Channel"], $e = m["Core/Process Embedded"], Ar = m["Core/Processing Initialized Marker"], Dr = m["Core/Processing Terminated Marker"], Br = m["Core/Channel Event Checkpoint"], xr = I["MyOS/Document Anchors"], _r = I["MyOS/Document Links"], Lr = I["MyOS/MyOS Participants Orchestration"], Fr = I["MyOS/MyOS Session Interaction"], $r = I["MyOS/MyOS Worker Agency"], Ur = w["Conversation/Composite Timeline Channel"], le = /* @__PURE__ */ new Map([
1856
1861
  [
1857
- Pr,
1862
+ Mr,
1858
1863
  hn
1859
1864
  ],
1860
1865
  [
1861
- Mr,
1866
+ Rr,
1862
1867
  pn
1863
1868
  ],
1864
1869
  [
1865
- Rr,
1870
+ Nr,
1866
1871
  mn
1867
1872
  ],
1868
1873
  [
1869
- Nr,
1874
+ Or,
1870
1875
  En
1871
1876
  ]
1872
- ]), Ur = /* @__PURE__ */ new Map([
1877
+ ]), zr = /* @__PURE__ */ new Map([
1873
1878
  [
1874
- Or,
1879
+ Ar,
1875
1880
  In
1876
1881
  ],
1877
1882
  [
1878
- Ar,
1883
+ Dr,
1879
1884
  Rn
1880
1885
  ],
1881
1886
  [
1882
- Dr,
1883
- bn
1887
+ Br,
1888
+ kn
1884
1889
  ],
1885
1890
  [
1886
- Br,
1891
+ xr,
1887
1892
  Dn
1888
1893
  ],
1889
1894
  [
1890
- xr,
1895
+ _r,
1891
1896
  _n
1892
1897
  ],
1893
1898
  [
1894
- _r,
1899
+ Lr,
1895
1900
  Fn
1896
1901
  ],
1897
1902
  [
1898
- Lr,
1903
+ Fr,
1899
1904
  Un
1900
1905
  ],
1901
1906
  [
1902
- Fr,
1907
+ $r,
1903
1908
  Hn
1904
1909
  ]
1905
1910
  ]);
1906
- class zr {
1911
+ class Hr {
1907
1912
  constructor(e, t) {
1908
1913
  this.registry = e, this.blue = t, this.handlerRegistration = new br(
1909
1914
  this.blue,
@@ -1945,7 +1950,7 @@ class zr {
1945
1950
  const s = Z(
1946
1951
  this.blue,
1947
1952
  n,
1948
- Ur
1953
+ zr
1949
1954
  );
1950
1955
  if (s) {
1951
1956
  this.handleMarker(e, t, n, s, o);
@@ -2047,7 +2052,7 @@ class zr {
2047
2052
  n,
2048
2053
  r
2049
2054
  );
2050
- this.blue.isTypeOfBlueId(n, $r) && this.validateCompositeChannel(
2055
+ this.blue.isTypeOfBlueId(n, Ur) && this.validateCompositeChannel(
2051
2056
  t,
2052
2057
  a,
2053
2058
  s,
@@ -2097,7 +2102,7 @@ class zr {
2097
2102
  )
2098
2103
  );
2099
2104
  }
2100
- Ir({
2105
+ Tr({
2101
2106
  compositeKey: e,
2102
2107
  contract: t,
2103
2108
  scopeContracts: n,
@@ -2148,15 +2153,15 @@ class zr {
2148
2153
  function ue(i) {
2149
2154
  return i instanceof Ee;
2150
2155
  }
2151
- const Hr = m["Core/Channel Event Checkpoint"];
2152
- function Vr(i) {
2156
+ const Vr = m["Core/Channel Event Checkpoint"];
2157
+ function Kr(i) {
2153
2158
  return i.jsonValueToNode({
2154
- type: { blueId: Hr },
2159
+ type: { blueId: Vr },
2155
2160
  lastEvents: {},
2156
2161
  lastSignatures: {}
2157
2162
  });
2158
2163
  }
2159
- function Kr() {
2164
+ function Wr() {
2160
2165
  return {
2161
2166
  lastEvents: {},
2162
2167
  lastSignatures: {}
@@ -2165,7 +2170,7 @@ function Kr() {
2165
2170
  function Ue(i) {
2166
2171
  return i != null && Object.prototype.hasOwnProperty.call(i, "lastEvents") && Object.prototype.hasOwnProperty.call(i, "lastSignatures");
2167
2172
  }
2168
- class Wr {
2173
+ class Gr {
2169
2174
  constructor(e, t, n, r, o) {
2170
2175
  this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = o;
2171
2176
  }
@@ -2175,15 +2180,15 @@ class Wr {
2175
2180
  return e != null && e === this.lastEventSignature;
2176
2181
  }
2177
2182
  }
2178
- class Gr {
2183
+ class qr {
2179
2184
  constructor(e, t) {
2180
2185
  this.runtime = e, this.signatureFn = t;
2181
2186
  }
2182
2187
  ensureCheckpointMarker(e, t) {
2183
2188
  const n = t.marker(A), r = T(e, Qe);
2184
2189
  if (!n) {
2185
- const o = Vr(this.runtime.blue());
2186
- this.runtime.directWrite(r, o), t.registerCheckpointMarker(Kr());
2190
+ const o = Kr(this.runtime.blue());
2191
+ this.runtime.directWrite(r, o), t.registerCheckpointMarker(Wr());
2187
2192
  return;
2188
2193
  }
2189
2194
  if (!Ue(n))
@@ -2196,7 +2201,7 @@ class Gr {
2196
2201
  if (!Ue(r))
2197
2202
  continue;
2198
2203
  const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
2199
- return new Wr(
2204
+ return new Gr(
2200
2205
  n,
2201
2206
  r,
2202
2207
  t,
@@ -2224,7 +2229,7 @@ class Gr {
2224
2229
  this.runtime.directWrite(c, u), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
2225
2230
  }
2226
2231
  }
2227
- class qr {
2232
+ class jr {
2228
2233
  constructor(e, t, n) {
2229
2234
  this.runtime = e, this.checkpointManager = t, this.deps = n;
2230
2235
  }
@@ -2351,7 +2356,7 @@ class qr {
2351
2356
  );
2352
2357
  }
2353
2358
  }
2354
- function jr(i, e) {
2359
+ function Jr(i, e) {
2355
2360
  return e.isResolved() ? i.createResolvedNode(e) : i.resolve(e);
2356
2361
  }
2357
2362
  class U extends y {
@@ -2364,8 +2369,8 @@ class F extends Error {
2364
2369
  super(e), this.name = "BoundaryViolationException";
2365
2370
  }
2366
2371
  }
2367
- const Jr = m["Core/Document Update Channel"], Qr = m["Core/Embedded Node Channel"], Xr = m["Core/Triggered Event Channel"], Zr = m["Core/Lifecycle Event Channel"], ze = m["Core/Processing Initialized Marker"], Yr = m["Core/Document Processing Initiated"];
2368
- class ei {
2372
+ const Qr = m["Core/Document Update Channel"], Xr = m["Core/Embedded Node Channel"], Zr = m["Core/Triggered Event Channel"], Yr = m["Core/Lifecycle Event Channel"], ze = m["Core/Processing Initialized Marker"], ei = m["Core/Document Processing Initiated"];
2373
+ class ti {
2369
2374
  runtime;
2370
2375
  contractLoader;
2371
2376
  channelRunner;
@@ -2379,7 +2384,7 @@ class ei {
2379
2384
  this.runtime = e.runtime, this.contractLoader = e.contractLoader, this.channelRunner = e.channelRunner, this.bundles = e.bundles, this.hooks = e.hooks, this.blueId = e.blueId, this.nodeAt = e.nodeAt, this.createDocumentUpdateEvent = e.createDocumentUpdateEvent, this.matchesDocumentUpdate = e.matchesDocumentUpdate;
2380
2385
  }
2381
2386
  async initializeScope(e, t) {
2382
- const n = b(e), r = /* @__PURE__ */ new Set();
2387
+ const n = k(e), r = /* @__PURE__ */ new Set();
2383
2388
  let o = null, s = null;
2384
2389
  for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
2385
2390
  const d = this.nodeAt(n);
@@ -2413,7 +2418,7 @@ class ei {
2413
2418
  await this.deliverLifecycle(n, o, u, !0), await this.addInitializationMarker(h, c);
2414
2419
  }
2415
2420
  loadBundles(e) {
2416
- const t = b(e);
2421
+ const t = k(e);
2417
2422
  if (this.bundles.has(t))
2418
2423
  return;
2419
2424
  const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : H.empty();
@@ -2424,11 +2429,11 @@ class ei {
2424
2429
  }
2425
2430
  }
2426
2431
  async processExternalEvent(e, t) {
2427
- const n = jr(this.runtime.blue(), t);
2432
+ const n = Jr(this.runtime.blue(), t);
2428
2433
  await this.processPreparedExternalEvent(e, n);
2429
2434
  }
2430
2435
  async processPreparedExternalEvent(e, t) {
2431
- const n = b(e);
2436
+ const n = k(e);
2432
2437
  if (this.hooks.isScopeInactive(n))
2433
2438
  return;
2434
2439
  this.runtime.gasMeter().chargeScopeEntry(n);
@@ -2491,7 +2496,7 @@ class ei {
2491
2496
  continue;
2492
2497
  const c = this.createDocumentUpdateEvent(o, s), u = this.channelsMatching(
2493
2498
  a,
2494
- Jr
2499
+ Qr
2495
2500
  );
2496
2501
  for (const h of u) {
2497
2502
  const d = h.contract();
@@ -2529,7 +2534,7 @@ class ei {
2529
2534
  return;
2530
2535
  const o = this.channelsMatching(
2531
2536
  t,
2532
- Zr
2537
+ Yr
2533
2538
  );
2534
2539
  for (const s of o)
2535
2540
  if (await this.channelRunner.runHandlers(
@@ -2543,7 +2548,7 @@ class ei {
2543
2548
  r && await this.finalizeScope(e, t);
2544
2549
  }
2545
2550
  async processEmbeddedChildren(e, t) {
2546
- const n = b(e), r = /* @__PURE__ */ new Set();
2551
+ const n = k(e), r = /* @__PURE__ */ new Set();
2547
2552
  let o = this.refreshBundle(n);
2548
2553
  for (; o; ) {
2549
2554
  const s = this.nextEmbeddedPath(o, r);
@@ -2560,7 +2565,7 @@ class ei {
2560
2565
  return null;
2561
2566
  }
2562
2567
  refreshBundle(e) {
2563
- const t = b(e), n = this.nodeAt(t);
2568
+ const t = k(e), n = this.nodeAt(t);
2564
2569
  if (!n)
2565
2570
  return this.bundles.delete(t), null;
2566
2571
  const r = this.loadBundle(n, t);
@@ -2606,7 +2611,7 @@ class ei {
2606
2611
  return;
2607
2612
  const n = this.channelsMatching(
2608
2613
  t,
2609
- Qr
2614
+ Xr
2610
2615
  );
2611
2616
  if (n.length !== 0)
2612
2617
  for (const r of t.embeddedPaths()) {
@@ -2632,7 +2637,7 @@ class ei {
2632
2637
  return;
2633
2638
  const n = this.runtime.scope(e), r = this.channelsMatching(
2634
2639
  t,
2635
- Xr
2640
+ Zr
2636
2641
  );
2637
2642
  if (r.length === 0) {
2638
2643
  n.clearTriggered();
@@ -2678,7 +2683,7 @@ class ei {
2678
2683
  return !1;
2679
2684
  }
2680
2685
  validatePatchBoundary(e, t, n) {
2681
- const r = b(e), o = P(n.path);
2686
+ const r = k(e), o = P(n.path);
2682
2687
  if (o === r)
2683
2688
  throw new F(
2684
2689
  `Self-root mutation is forbidden at scope ${r}`
@@ -2698,7 +2703,7 @@ class ei {
2698
2703
  enforceReservedKeyWriteProtection(e, t, n) {
2699
2704
  if (n)
2700
2705
  return;
2701
- const r = b(e), o = P(t.path);
2706
+ const r = k(e), o = P(t.path);
2702
2707
  for (const s of ye) {
2703
2708
  const a = T(
2704
2709
  r,
@@ -2734,7 +2739,7 @@ class ei {
2734
2739
  return !0;
2735
2740
  }
2736
2741
  createLifecycleEvent(e) {
2737
- return new p().setType(new p().setBlueId(Yr)).setProperties({
2742
+ return new p().setType(new p().setBlueId(ei)).setProperties({
2738
2743
  type: new p().setValue("Core/Document Processing Initiated"),
2739
2744
  documentId: new p().setValue(e)
2740
2745
  });
@@ -2747,8 +2752,8 @@ class ne extends Error {
2747
2752
  ), this.fatal = e, this.name = "RunTerminationError";
2748
2753
  }
2749
2754
  }
2750
- const ti = m["Core/Processing Terminated Marker"], ni = m["Core/Document Processing Terminated"];
2751
- class ri {
2755
+ const ni = m["Core/Processing Terminated Marker"], ri = m["Core/Document Processing Terminated"];
2756
+ class ii {
2752
2757
  constructor(e) {
2753
2758
  this.runtime = e;
2754
2759
  }
@@ -2757,9 +2762,9 @@ class ri {
2757
2762
  const s = e.normalizeScope(t), a = T(s, Je);
2758
2763
  this.runtime.directWrite(
2759
2764
  a,
2760
- ii(this.runtime.blue(), r, o)
2765
+ oi(this.runtime.blue(), r, o)
2761
2766
  ), this.runtime.gasMeter().chargeTerminationMarker();
2762
- const c = n ?? e.bundleForScope(s) ?? null, u = oi(r, o);
2767
+ const c = n ?? e.bundleForScope(s) ?? null, u = si(r, o);
2763
2768
  if (await e.deliverLifecycle(
2764
2769
  s,
2765
2770
  c,
@@ -2771,32 +2776,32 @@ class ri {
2771
2776
  throw this.runtime.markRunTerminated(), new ne(!1);
2772
2777
  }
2773
2778
  }
2774
- function ii(i, e, t) {
2775
- return si(i, {
2776
- type: { blueId: ti },
2779
+ function oi(i, e, t) {
2780
+ return ai(i, {
2781
+ type: { blueId: ni },
2777
2782
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2778
2783
  ...t ? { reason: t } : {}
2779
2784
  });
2780
2785
  }
2781
- function oi(i, e) {
2786
+ function si(i, e) {
2782
2787
  const t = new p().setType(
2783
- new p().setBlueId(ni)
2788
+ new p().setBlueId(ri)
2784
2789
  );
2785
2790
  return t.addProperty(
2786
2791
  "cause",
2787
2792
  new p().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
2788
2793
  ), e && t.addProperty("reason", new p().setValue(e)), t;
2789
2794
  }
2790
- function si(i, e) {
2795
+ function ai(i, e) {
2791
2796
  return i.jsonValueToNode(e);
2792
2797
  }
2793
2798
  const j = "-";
2794
- class ai {
2799
+ class ci {
2795
2800
  constructor(e) {
2796
2801
  this.document = e;
2797
2802
  }
2798
2803
  applyPatch(e, t) {
2799
- const n = b(e), r = P(t.path), o = Ve(r), s = He(this.document, o, "before", r);
2804
+ const n = k(e), r = P(t.path), o = Ve(r), s = He(this.document, o, "before", r);
2800
2805
  switch (t.op) {
2801
2806
  case "ADD":
2802
2807
  this.applyAdd(o, r, t.val ?? null);
@@ -2815,7 +2820,7 @@ class ai {
2815
2820
  after: a,
2816
2821
  op: t.op.toLowerCase(),
2817
2822
  originScope: n,
2818
- cascadeScopes: ci(n)
2823
+ cascadeScopes: li(n)
2819
2824
  };
2820
2825
  }
2821
2826
  directWrite(e, t) {
@@ -3016,7 +3021,7 @@ class ai {
3016
3021
  }
3017
3022
  }
3018
3023
  }
3019
- function ci(i) {
3024
+ function li(i) {
3020
3025
  const e = [];
3021
3026
  let t = i;
3022
3027
  for (; e.push(t), t !== "/"; ) {
@@ -3029,22 +3034,22 @@ function He(i, e, t, n) {
3029
3034
  try {
3030
3035
  if (e.length === 0)
3031
3036
  return i.clone();
3032
- const r = li(i, e, t, n);
3037
+ const r = ui(i, e, t, n);
3033
3038
  return r ? r.clone() : null;
3034
3039
  } catch {
3035
3040
  return null;
3036
3041
  }
3037
3042
  }
3038
- function li(i, e, t, n) {
3043
+ function ui(i, e, t, n) {
3039
3044
  let r = i;
3040
3045
  for (let o = 0; o < e.length; o += 1) {
3041
3046
  const s = e[o] ?? "", a = o === e.length - 1;
3042
- if (r = ui(r, s, a, t, n), !r)
3047
+ if (r = hi(r, s, a, t, n), !r)
3043
3048
  return null;
3044
3049
  }
3045
3050
  return r;
3046
3051
  }
3047
- function ui(i, e, t, n, r) {
3052
+ function hi(i, e, t, n, r) {
3048
3053
  if (!i)
3049
3054
  return null;
3050
3055
  const o = i.getItems();
@@ -3105,7 +3110,7 @@ function $(i) {
3105
3110
  function q(i) {
3106
3111
  return i == null ? new p().setValue(null) : i.clone();
3107
3112
  }
3108
- class hi {
3113
+ class di {
3109
3114
  constructor(e) {
3110
3115
  this.path = e;
3111
3116
  }
@@ -3167,7 +3172,7 @@ class hi {
3167
3172
  return this.cutOff;
3168
3173
  }
3169
3174
  }
3170
- class di {
3175
+ class pi {
3171
3176
  scopesMap = /* @__PURE__ */ new Map();
3172
3177
  rootEmissionList = [];
3173
3178
  scopes() {
@@ -3175,7 +3180,7 @@ class di {
3175
3180
  }
3176
3181
  scope(e) {
3177
3182
  let t = this.scopesMap.get(e);
3178
- return t || (t = new hi(e), this.scopesMap.set(e, t)), t;
3183
+ return t || (t = new di(e), this.scopesMap.set(e, t)), t;
3179
3184
  }
3180
3185
  existingScope(e) {
3181
3186
  return this.scopesMap.get(e);
@@ -3196,30 +3201,30 @@ class di {
3196
3201
  function Ct(i) {
3197
3202
  return Math.floor((i + 99) / 100);
3198
3203
  }
3199
- function pi(i) {
3204
+ function fi(i) {
3200
3205
  const e = P(i);
3201
3206
  return e === "/" ? 0 : e.split("/").length - 1;
3202
3207
  }
3203
- function fi(i) {
3208
+ function mi(i) {
3204
3209
  return 40 + 5 * Math.max(0, i);
3205
3210
  }
3206
- function mi(i, e) {
3207
- return 8 + pi(i) + Ct(e);
3211
+ function gi(i, e) {
3212
+ return 8 + fi(i) + Ct(e);
3208
3213
  }
3209
- const gi = 1e3, Ei = 5, yi = 50, Ci = 2, Si = 10, vi = 10, wi = 10, bi = 20, ki = 20, Ii = 30, Ti = 30, Pi = 100;
3210
- function Mi(i) {
3214
+ const Ei = 1e3, yi = 5, Ci = 50, Si = 2, vi = 10, wi = 10, ki = 10, bi = 20, Ii = 20, Ti = 30, Pi = 30, Mi = 100;
3215
+ function Ri(i) {
3211
3216
  return 50 + 10 * i;
3212
3217
  }
3213
- function Ri(i) {
3218
+ function Ni(i) {
3214
3219
  return 20 + i;
3215
3220
  }
3216
- function Ni(i) {
3221
+ function Oi(i) {
3217
3222
  return 10 * i;
3218
3223
  }
3219
- function Oi(i) {
3224
+ function Ai(i) {
3220
3225
  return 20 + i;
3221
3226
  }
3222
- class Ai {
3227
+ class Di {
3223
3228
  constructor(e) {
3224
3229
  this.blue = e;
3225
3230
  }
@@ -3231,59 +3236,59 @@ class Ai {
3231
3236
  this.total += e;
3232
3237
  }
3233
3238
  chargeScopeEntry(e) {
3234
- this.add(Mi(this.scopeDepth(e)));
3239
+ this.add(Ri(this.scopeDepth(e)));
3235
3240
  }
3236
3241
  chargeInitialization() {
3237
- this.add(gi);
3242
+ this.add(Ei);
3238
3243
  }
3239
3244
  chargeChannelMatchAttempt() {
3240
- this.add(Ei);
3245
+ this.add(yi);
3241
3246
  }
3242
3247
  chargeHandlerOverhead() {
3243
- this.add(yi);
3248
+ this.add(Ci);
3244
3249
  }
3245
3250
  chargeBoundaryCheck() {
3246
- this.add(Ci);
3251
+ this.add(Si);
3247
3252
  }
3248
3253
  chargePatchAddOrReplace(e) {
3249
- this.add(Ri(this.payloadSizeCharge(e)));
3254
+ this.add(Ni(this.payloadSizeCharge(e)));
3250
3255
  }
3251
3256
  chargePatchRemove() {
3252
- this.add(Si);
3257
+ this.add(vi);
3253
3258
  }
3254
3259
  chargeCascadeRouting(e) {
3255
- e > 0 && this.add(Ni(e));
3260
+ e > 0 && this.add(Oi(e));
3256
3261
  }
3257
3262
  chargeEmitEvent(e) {
3258
- this.add(Oi(this.payloadSizeCharge(e)));
3263
+ this.add(Ai(this.payloadSizeCharge(e)));
3259
3264
  }
3260
3265
  chargeBridge() {
3261
- this.add(vi);
3266
+ this.add(wi);
3262
3267
  }
3263
3268
  chargeDrainEvent() {
3264
- this.add(wi);
3269
+ this.add(ki);
3265
3270
  }
3266
3271
  chargeCheckpointUpdate() {
3267
3272
  this.add(bi);
3268
3273
  }
3269
3274
  chargeTerminationMarker() {
3270
- this.add(ki);
3275
+ this.add(Ii);
3271
3276
  }
3272
3277
  chargeLifecycleDelivery() {
3273
- this.add(Ii);
3278
+ this.add(Ti);
3274
3279
  }
3275
3280
  chargeFatalTerminationOverhead() {
3276
- this.add(Pi);
3281
+ this.add(Mi);
3277
3282
  }
3278
3283
  chargeTriggerEventBase() {
3279
- this.add(Ti);
3284
+ this.add(Pi);
3280
3285
  }
3281
3286
  chargeUpdateDocumentBase(e) {
3282
- this.add(fi(e));
3287
+ this.add(mi(e));
3283
3288
  }
3284
3289
  chargeDocumentSnapshot(e, t) {
3285
3290
  const n = t ? Ne(this.blue, t) : 0;
3286
- this.add(mi(e, n));
3291
+ this.add(gi(e, n));
3287
3292
  }
3288
3293
  chargeWasmGas(e) {
3289
3294
  const t = Jt(e);
@@ -3296,7 +3301,7 @@ class Ai {
3296
3301
  return Ct(t);
3297
3302
  }
3298
3303
  scopeDepth(e) {
3299
- const t = b(e);
3304
+ const t = k(e);
3300
3305
  if (t === "/" || t.length <= 1)
3301
3306
  return 0;
3302
3307
  let n = 1;
@@ -3305,12 +3310,12 @@ class Ai {
3305
3310
  return n;
3306
3311
  }
3307
3312
  }
3308
- class Di {
3313
+ class Bi {
3309
3314
  constructor(e, t) {
3310
- this.documentRef = e, this.blueRef = t, this.patchEngine = new ai(this.documentRef), this.meter = new Ai(this.blueRef);
3315
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new ci(this.documentRef), this.meter = new Di(this.blueRef);
3311
3316
  }
3312
3317
  patchEngine;
3313
- emissionRegistry = new di();
3318
+ emissionRegistry = new pi();
3314
3319
  meter;
3315
3320
  runTerminated = !1;
3316
3321
  document() {
@@ -3359,15 +3364,15 @@ class Di {
3359
3364
  return this.patchEngine.applyPatch(e, t);
3360
3365
  }
3361
3366
  }
3362
- const Bi = m["Core/Processing Initialized Marker"], xi = m["Core/Document Update"];
3363
- class _i {
3367
+ const xi = m["Core/Processing Initialized Marker"], _i = m["Core/Document Update"];
3368
+ class Li {
3364
3369
  constructor(e, t, n, r) {
3365
- this.contractLoader = e, this.registry = t, this.runtimeRef = new Di(r, n);
3370
+ this.contractLoader = e, this.registry = t, this.runtimeRef = new Bi(r, n);
3366
3371
  const o = (s) => nt(this.runtimeRef.blue(), s);
3367
- this.checkpointManager = new Gr(
3372
+ this.checkpointManager = new qr(
3368
3373
  this.runtimeRef,
3369
3374
  o
3370
- ), this.terminationService = new ri(this.runtimeRef), this.channelRunner = new qr(
3375
+ ), this.terminationService = new ii(this.runtimeRef), this.channelRunner = new jr(
3371
3376
  this.runtimeRef,
3372
3377
  this.checkpointManager,
3373
3378
  {
@@ -3397,7 +3402,7 @@ class _i {
3397
3402
  canonicalSignature: o,
3398
3403
  channelProcessorFor: (s) => this.lookupChannelProcessor(s)
3399
3404
  }
3400
- ), this.scopeExecutor = new ei({
3405
+ ), this.scopeExecutor = new ti({
3401
3406
  runtime: this.runtimeRef,
3402
3407
  contractLoader: this.contractLoader,
3403
3408
  channelRunner: this.channelRunner,
@@ -3448,7 +3453,7 @@ class _i {
3448
3453
  );
3449
3454
  }
3450
3455
  createContext(e, t, n, r = !1, o = !1) {
3451
- return new Li(
3456
+ return new Fi(
3452
3457
  this,
3453
3458
  t,
3454
3459
  e,
@@ -3469,10 +3474,10 @@ class _i {
3469
3474
  return this.runtimeRef;
3470
3475
  }
3471
3476
  bundleForScope(e) {
3472
- return this.bundles.get(b(e));
3477
+ return this.bundles.get(k(e));
3473
3478
  }
3474
3479
  isScopeInactive(e) {
3475
- const t = b(e);
3480
+ const t = k(e);
3476
3481
  return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
3477
3482
  }
3478
3483
  async enterGracefulTermination(e, t, n) {
@@ -3482,13 +3487,13 @@ class _i {
3482
3487
  await this.terminate(e, t, "FATAL", n);
3483
3488
  }
3484
3489
  recordPendingTermination(e, t, n) {
3485
- this.pendingTerminations.set(b(e), { kind: t, reason: n });
3490
+ this.pendingTerminations.set(k(e), { kind: t, reason: n });
3486
3491
  }
3487
3492
  clearPendingTermination(e) {
3488
- this.pendingTerminations.delete(b(e));
3493
+ this.pendingTerminations.delete(k(e));
3489
3494
  }
3490
3495
  async markCutOff(e) {
3491
- const t = b(e);
3496
+ const t = k(e);
3492
3497
  this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
3493
3498
  }
3494
3499
  async deliverLifecycle(e, t, n, r) {
@@ -3503,13 +3508,13 @@ class _i {
3503
3508
  this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
3504
3509
  }
3505
3510
  normalizeScope(e) {
3506
- return b(e);
3511
+ return k(e);
3507
3512
  }
3508
3513
  resolvePointer(e, t) {
3509
3514
  return T(e, t);
3510
3515
  }
3511
3516
  async terminate(e, t, n, r) {
3512
- const o = b(e);
3517
+ const o = k(e);
3513
3518
  this.pendingTerminations.has(o) || this.runtimeRef.isScopeTerminated(o) || (this.pendingTerminations.set(o, { kind: n, reason: r }), await this.terminationService.terminateScope(
3514
3519
  this,
3515
3520
  e,
@@ -3519,7 +3524,7 @@ class _i {
3519
3524
  ));
3520
3525
  }
3521
3526
  nodeAt(e) {
3522
- const t = b(e);
3527
+ const t = k(e);
3523
3528
  return re.nodeAt(this.runtimeRef.document(), t, {
3524
3529
  calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
3525
3530
  });
@@ -3590,7 +3595,7 @@ class _i {
3590
3595
  }
3591
3596
  createDocumentUpdateEvent(e, t) {
3592
3597
  const n = Ft(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), o = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
3593
- new p().setBlueId(xi)
3598
+ new p().setBlueId(_i)
3594
3599
  );
3595
3600
  return s.setProperties({
3596
3601
  op: new p().setValue(e.op),
@@ -3630,7 +3635,7 @@ class re {
3630
3635
  return this.initializationMarker(e) != null;
3631
3636
  }
3632
3637
  createExecution(e) {
3633
- return new _i(
3638
+ return new Li(
3634
3639
  this.contractLoader,
3635
3640
  this.registry,
3636
3641
  this.blue,
@@ -3665,7 +3670,7 @@ class re {
3665
3670
  "Initialization Marker must be a BlueNode"
3666
3671
  )
3667
3672
  );
3668
- if (n.getType()?.getBlueId() !== Bi)
3673
+ if (n.getType()?.getBlueId() !== xi)
3669
3674
  throw new y(
3670
3675
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3671
3676
  S.illegalState(
@@ -3739,7 +3744,7 @@ class re {
3739
3744
  }
3740
3745
  }
3741
3746
  }
3742
- class Li {
3747
+ class Fi {
3743
3748
  constructor(e, t, n, r, o, s) {
3744
3749
  this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = o, this.allowReservedMutation = s;
3745
3750
  }
@@ -3833,16 +3838,16 @@ class Li {
3833
3838
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
3834
3839
  }
3835
3840
  }
3836
- const Fi = new Mt({
3841
+ const $i = new Mt({
3837
3842
  repositories: [Rt]
3838
3843
  });
3839
- class $i {
3844
+ class Ui {
3840
3845
  blue;
3841
3846
  registryRef;
3842
3847
  contractLoaderRef;
3843
3848
  engine;
3844
3849
  constructor(e) {
3845
- this.registryRef = e?.registry ?? ae.create().registerDefaults().build(), this.blue = e?.blue ?? Fi, this.contractLoaderRef = new zr(this.registryRef, this.blue), this.engine = new re(
3850
+ this.registryRef = e?.registry ?? ae.create().registerDefaults().build(), this.blue = e?.blue ?? $i, this.contractLoaderRef = new Hr(this.registryRef, this.blue), this.engine = new re(
3846
3851
  this.contractLoaderRef,
3847
3852
  this.registryRef,
3848
3853
  this.blue
@@ -3875,10 +3880,10 @@ class $i {
3875
3880
  return this.contractLoaderRef;
3876
3881
  }
3877
3882
  static builder() {
3878
- return new Ui();
3883
+ return new zi();
3879
3884
  }
3880
3885
  }
3881
- class Ui {
3886
+ class zi {
3882
3887
  contractRegistry;
3883
3888
  blueInstance;
3884
3889
  constructor() {
@@ -3894,7 +3899,7 @@ class Ui {
3894
3899
  return this.blueInstance = e, this;
3895
3900
  }
3896
3901
  build() {
3897
- return new $i({
3902
+ return new Ui({
3898
3903
  registry: this.contractRegistry,
3899
3904
  blue: this.blueInstance
3900
3905
  });
@@ -3921,11 +3926,11 @@ class St {
3921
3926
  return e;
3922
3927
  }
3923
3928
  }
3924
- const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3929
+ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3925
3930
  __proto__: null,
3926
3931
  ExpressionPreserver: St
3927
3932
  }, Symbol.toStringTag, { value: "Module" }));
3928
- function uo() {
3933
+ function ho() {
3929
3934
  return new B.SequentialMergingProcessor([
3930
3935
  new B.ValuePropagator(),
3931
3936
  new St(),
@@ -3937,37 +3942,37 @@ function uo() {
3937
3942
  ]);
3938
3943
  }
3939
3944
  export {
3940
- Sr as ChannelBinding,
3941
- qr as ChannelRunner,
3942
- Gr as CheckpointManager,
3943
- Wr as CheckpointRecord,
3945
+ vr as ChannelBinding,
3946
+ jr as ChannelRunner,
3947
+ qr as CheckpointManager,
3948
+ Gr as CheckpointRecord,
3944
3949
  ot as CodeBlockEvaluationError,
3945
3950
  H as ContractBundle,
3946
- wr as ContractBundleBuilder,
3947
- zr as ContractLoader,
3951
+ kr as ContractBundleBuilder,
3952
+ Hr as ContractLoader,
3948
3953
  qn as ContractProcessorRegistry,
3949
3954
  ae as ContractProcessorRegistryBuilder,
3950
3955
  Ke as DocumentProcessingResult,
3951
- Di as DocumentProcessingRuntime,
3952
- $i as DocumentProcessor,
3953
- Ui as DocumentProcessorBuilder,
3954
- di as EmissionRegistry,
3955
- Ai as GasMeter,
3956
- vr as HandlerBinding,
3956
+ Bi as DocumentProcessingRuntime,
3957
+ Ui as DocumentProcessor,
3958
+ zi as DocumentProcessorBuilder,
3959
+ pi as EmissionRegistry,
3960
+ Di as GasMeter,
3961
+ wr as HandlerBinding,
3957
3962
  A as KEY_CHECKPOINT,
3958
3963
  We as KEY_EMBEDDED,
3959
3964
  Ge as KEY_INITIALIZED,
3960
3965
  qe as KEY_TERMINATED,
3961
- lo as MergingProcessors,
3966
+ uo as MergingProcessors,
3962
3967
  Ce as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
3963
- ai as PatchEngine,
3964
- io as ProcessorContractConstants,
3968
+ ci as PatchEngine,
3969
+ oo as ProcessorContractConstants,
3965
3970
  re as ProcessorEngine,
3966
3971
  S as ProcessorErrors,
3967
- _i as ProcessorExecution,
3968
- Li as ProcessorExecutionContext,
3972
+ Li as ProcessorExecution,
3973
+ Fi as ProcessorExecutionContext,
3969
3974
  y as ProcessorFatalError,
3970
- oo as ProcessorPointerConstants,
3975
+ so as ProcessorPointerConstants,
3971
3976
  Se as QuickJSEvaluator,
3972
3977
  Qe as RELATIVE_CHECKPOINT,
3973
3978
  V as RELATIVE_CONTRACTS,
@@ -3976,18 +3981,18 @@ export {
3976
3981
  Je as RELATIVE_TERMINATED,
3977
3982
  ye as RESERVED_CONTRACT_KEYS,
3978
3983
  ne as RunTerminationError,
3979
- ei as ScopeExecutor,
3980
- hi as ScopeRuntimeContext,
3981
- ri as TerminationService,
3982
- eo as andThen,
3984
+ ti as ScopeExecutor,
3985
+ di as ScopeRuntimeContext,
3986
+ ii as TerminationService,
3987
+ to as andThen,
3983
3988
  nt as canonicalSignature,
3984
3989
  Ne as canonicalSize,
3985
3990
  L as channelContractBaseSchema,
3986
- bn as channelEventCheckpointSchema,
3991
+ kn as channelEventCheckpointSchema,
3987
3992
  dt as compositeTimelineChannelSchema,
3988
3993
  sn as containsExpression,
3989
3994
  ve as contractBaseSchema,
3990
- uo as createDefaultMergingProcessor,
3995
+ ho as createDefaultMergingProcessor,
3991
3996
  ct as createPicomatchShouldResolve,
3992
3997
  Dn as documentAnchorsMarkerSchema,
3993
3998
  _n as documentLinksMarkerSchema,
@@ -3998,24 +4003,24 @@ export {
3998
4003
  an as extractExpressionContent,
3999
4004
  ut as handlerContractBaseSchema,
4000
4005
  In as initializationMarkerSchema,
4001
- Xi as isErr,
4006
+ Zi as isErr,
4002
4007
  ee as isExpression,
4003
- Qi as isOk,
4008
+ Xi as isOk,
4004
4009
  je as isProcessorManagedChannelBlueId,
4005
4010
  _t as isReservedContractKey,
4006
- so as joinRelativePointers,
4007
- ao as jsonPatchSchema,
4011
+ ao as joinRelativePointers,
4012
+ co as jsonPatchSchema,
4008
4013
  mn as lifecycleChannelSchema,
4009
- Zi as map,
4010
- Yi as mapErr,
4011
- N as markerContractBaseSchema,
4012
- ro as match,
4014
+ Yi as map,
4015
+ eo as mapErr,
4016
+ R as markerContractBaseSchema,
4017
+ io as match,
4013
4018
  Fn as myosParticipantsOrchestrationMarkerSchema,
4014
4019
  Un as myosSessionInteractionMarkerSchema,
4015
4020
  Sn as myosTimelineChannelSchema,
4016
4021
  Hn as myosWorkerAgencyMarkerSchema,
4017
4022
  P as normalizePointer,
4018
- b as normalizeScope,
4023
+ k as normalizeScope,
4019
4024
  Nt as ok,
4020
4025
  Nn as operationMarkerSchema,
4021
4026
  Pn as processEmbeddedMarkerSchema,
@@ -4029,10 +4034,10 @@ export {
4029
4034
  cn as resolveTemplateString,
4030
4035
  Wn as sequentialWorkflowOperationSchema,
4031
4036
  Vn as sequentialWorkflowSchema,
4032
- co as sequentialWorkflowStepSchema,
4037
+ lo as sequentialWorkflowStepSchema,
4033
4038
  Me as stripSlashes,
4034
4039
  yn as timelineChannelSchema,
4035
4040
  En as triggeredEventChannelSchema,
4036
- to as unwrapOr,
4037
- no as unwrapOrElse
4041
+ no as unwrapOr,
4042
+ ro as unwrapOrElse
4038
4043
  };