@rotorsoft/act 2.2.3 → 2.2.4

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.cjs CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
 
30
30
 
31
- var _chunk62LDEIDMcjs = require('./chunk-62LDEIDM.cjs');
31
+ var _chunkXG3UD63Ycjs = require('./chunk-XG3UD63Y.cjs');
32
32
 
33
33
 
34
34
 
@@ -37,7 +37,7 @@ var _chunk62LDEIDMcjs = require('./chunk-62LDEIDM.cjs');
37
37
 
38
38
 
39
39
 
40
- var _chunkDAVFDMC4cjs = require('./chunk-DAVFDMC4.cjs');
40
+ var _chunkXJZ2PKJHcjs = require('./chunk-XJZ2PKJH.cjs');
41
41
 
42
42
 
43
43
 
@@ -67,26 +67,26 @@ var _chunkDAVFDMC4cjs = require('./chunk-DAVFDMC4.cjs');
67
67
 
68
68
 
69
69
 
70
- var _chunkZI4NSYCDcjs = require('./chunk-ZI4NSYCD.cjs');
70
+ var _chunk4GA3CHQWcjs = require('./chunk-4GA3CHQW.cjs');
71
71
 
72
72
  // src/signals.ts
73
73
  process.once("SIGINT", async (arg) => {
74
- _chunk62LDEIDMcjs.log.call(void 0, ).info(arg, "SIGINT");
75
- await _chunk62LDEIDMcjs.disposeAndExit.call(void 0, "EXIT");
74
+ _chunkXG3UD63Ycjs.log.call(void 0, ).info(arg, "SIGINT");
75
+ await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "EXIT");
76
76
  });
77
77
  process.once("SIGTERM", async (arg) => {
78
- _chunk62LDEIDMcjs.log.call(void 0, ).info(arg, "SIGTERM");
79
- await _chunk62LDEIDMcjs.disposeAndExit.call(void 0, "EXIT");
78
+ _chunkXG3UD63Ycjs.log.call(void 0, ).info(arg, "SIGTERM");
79
+ await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "EXIT");
80
80
  });
81
81
  process.once("uncaughtException", async (arg) => {
82
82
  process.exitCode = 1;
83
- _chunk62LDEIDMcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
84
- await _chunk62LDEIDMcjs.disposeAndExit.call(void 0, "ERROR");
83
+ _chunkXG3UD63Ycjs.log.call(void 0, ).error(arg, "Uncaught Exception");
84
+ await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "ERROR");
85
85
  });
86
86
  process.once("unhandledRejection", async (arg) => {
87
87
  process.exitCode = 1;
88
- _chunk62LDEIDMcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
89
- await _chunk62LDEIDMcjs.disposeAndExit.call(void 0, "ERROR");
88
+ _chunkXG3UD63Ycjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
89
+ await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "ERROR");
90
90
  });
91
91
 
92
92
  // src/act.ts
@@ -102,7 +102,7 @@ function parse(name) {
102
102
  }
103
103
  return { base: name, version: 1 };
104
104
  }
105
- _chunkZI4NSYCDcjs.__name.call(void 0, parse, "parse");
105
+ _chunk4GA3CHQWcjs.__name.call(void 0, parse, "parse");
106
106
  function deprecated_event_names(names) {
107
107
  const groups = /* @__PURE__ */ new Map();
108
108
  for (const name of names) {
@@ -128,7 +128,7 @@ function deprecated_event_names(names) {
128
128
  }
129
129
  return deprecated;
130
130
  }
131
- _chunkZI4NSYCDcjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
131
+ _chunk4GA3CHQWcjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
132
132
  function current_version_of(deprecated_name, all_names) {
133
133
  const target = parse(deprecated_name);
134
134
  let highest;
@@ -139,7 +139,7 @@ function current_version_of(deprecated_name, all_names) {
139
139
  }
140
140
  return highest && highest.version > target.version ? highest.name : void 0;
141
141
  }
142
- _chunkZI4NSYCDcjs.__name.call(void 0, current_version_of, "current_version_of");
142
+ _chunk4GA3CHQWcjs.__name.call(void 0, current_version_of, "current_version_of");
143
143
 
144
144
  // src/internal/walk-streams.ts
145
145
  var DEFAULT_STREAM_PAGE = 500;
@@ -161,7 +161,7 @@ async function walk_streams(store2, callback, query) {
161
161
  after = last;
162
162
  }
163
163
  }
164
- _chunkZI4NSYCDcjs.__name.call(void 0, walk_streams, "walk_streams");
164
+ _chunk4GA3CHQWcjs.__name.call(void 0, walk_streams, "walk_streams");
165
165
 
166
166
  // src/internal/audit.ts
167
167
  var DEFAULTS = {
@@ -198,7 +198,7 @@ async function* audit(deps, categories, options = {}) {
198
198
  if (need_stats) {
199
199
  const stats = await deps.store().query_stats(
200
200
  {},
201
- { count: true, names: true, exclude: [_chunkZI4NSYCDcjs.SNAP_EVENT] }
201
+ { count: true, names: true, exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT] }
202
202
  );
203
203
  for (const [stream, s] of stats) {
204
204
  for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
@@ -226,7 +226,7 @@ async function* audit(deps, categories, options = {}) {
226
226
  for (const f of p.drain()) yield f;
227
227
  }
228
228
  }
229
- _chunkZI4NSYCDcjs.__name.call(void 0, audit, "audit");
229
+ _chunk4GA3CHQWcjs.__name.call(void 0, audit, "audit");
230
230
  async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
231
231
  let cursor = _optionalChain([query, 'optionalAccess', _14 => _14.after]);
232
232
  let remaining = _optionalChain([query, 'optionalAccess', _15 => _15.limit]);
@@ -262,8 +262,8 @@ async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
262
262
  }
263
263
  }
264
264
  }
265
- _chunkZI4NSYCDcjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
266
- var make_schema_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps) => {
265
+ _chunk4GA3CHQWcjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
266
+ var make_schema_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
267
267
  const findings = [];
268
268
  return {
269
269
  category: "schema",
@@ -306,10 +306,10 @@ var make_schema_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (de
306
306
  });
307
307
  }
308
308
  },
309
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
309
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
310
310
  };
311
311
  }, "make_schema_pass");
312
- var classify_deprecated_by_state = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps) => {
312
+ var classify_deprecated_by_state = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
313
313
  const names_by_state = /* @__PURE__ */ new Map();
314
314
  for (const [name, state2] of deps.event_to_state) {
315
315
  let set = names_by_state.get(state2);
@@ -327,7 +327,7 @@ var classify_deprecated_by_state = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call
327
327
  }
328
328
  return deprecated_to_current;
329
329
  }, "classify_deprecated_by_state");
330
- var make_deprecated_load_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps, options) => {
330
+ var make_deprecated_load_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
331
331
  const share_min = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.thresholds, 'optionalAccess', _18 => _18.deprecated_min]), () => ( DEFAULTS.deprecated_min));
332
332
  const totals = /* @__PURE__ */ new Map();
333
333
  const per_stream = /* @__PURE__ */ new Map();
@@ -367,7 +367,7 @@ var make_deprecated_load_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(vo
367
367
  }
368
368
  };
369
369
  }, "make_deprecated_load_pass");
370
- var make_close_candidate_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps, options) => {
370
+ var make_close_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
371
371
  const idle_days = _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.thresholds, 'optionalAccess', _20 => _20.idle_days]), () => ( DEFAULTS.idle_days));
372
372
  const terminal_events = new Set(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.thresholds, 'optionalAccess', _22 => _22.terminal_events]), () => ( [])));
373
373
  const idle_cutoff = Date.now() - idle_days * 24 * 60 * 60 * 1e3;
@@ -390,10 +390,10 @@ var make_close_candidate_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(vo
390
390
  restart_supported: restart_is_supported(deps, head_name)
391
391
  });
392
392
  },
393
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
393
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
394
394
  };
395
395
  }, "make_close_candidate_pass");
396
- var make_restart_candidate_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps, options) => {
396
+ var make_restart_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
397
397
  const threshold = _nullishCoalesce(_optionalChain([options, 'access', _23 => _23.thresholds, 'optionalAccess', _24 => _24.restart_min]), () => ( DEFAULTS.restart_min));
398
398
  const candidates = [];
399
399
  const findings = [];
@@ -416,7 +416,7 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(
416
416
  {
417
417
  stream,
418
418
  stream_exact: true,
419
- names: [_chunkZI4NSYCDcjs.SNAP_EVENT],
419
+ names: [_chunk4GA3CHQWcjs.SNAP_EVENT],
420
420
  with_snaps: true,
421
421
  // From the start: on its own, `with_snaps` resumes at the latest.
422
422
  after: -1
@@ -430,10 +430,10 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(
430
430
  });
431
431
  }
432
432
  },
433
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
433
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
434
434
  };
435
435
  }, "make_restart_candidate_pass");
436
- var make_reaction_health_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (_deps, options) => {
436
+ var make_reaction_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_deps, options) => {
437
437
  const near_block = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.thresholds, 'optionalAccess', _26 => _26.near_block]), () => ( DEFAULTS.near_block));
438
438
  const stuck_minutes = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.thresholds, 'optionalAccess', _28 => _28.stuck_minutes]), () => ( DEFAULTS.stuck_minutes));
439
439
  const stuck_cutoff = Date.now() - stuck_minutes * 60 * 1e3;
@@ -474,10 +474,10 @@ var make_reaction_health_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(vo
474
474
  });
475
475
  }
476
476
  },
477
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
477
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
478
478
  };
479
479
  }, "make_reaction_health_pass");
480
- var make_snapshot_drift_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps, options) => {
480
+ var make_snapshot_drift_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
481
481
  const drift_min = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.thresholds, 'optionalAccess', _30 => _30.drift_min]), () => ( DEFAULTS.drift_min));
482
482
  const candidates = [];
483
483
  const findings = [];
@@ -529,10 +529,10 @@ var make_snapshot_drift_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(voi
529
529
  });
530
530
  }
531
531
  },
532
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
532
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
533
533
  };
534
534
  }, "make_snapshot_drift_pass");
535
- var make_routing_health_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (deps) => {
535
+ var make_routing_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
536
536
  const findings = [];
537
537
  const seen_event_names = /* @__PURE__ */ new Set();
538
538
  return {
@@ -564,10 +564,10 @@ var make_routing_health_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(voi
564
564
  }
565
565
  return Promise.resolve();
566
566
  },
567
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
567
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
568
568
  };
569
569
  }, "make_routing_health_pass");
570
- var make_correlation_gaps_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
570
+ var make_correlation_gaps_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
571
571
  const seen_ids = /* @__PURE__ */ new Set();
572
572
  const checks = [];
573
573
  return {
@@ -576,7 +576,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(v
576
576
  seen_ids.add(e.id);
577
577
  const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
578
578
  const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
579
- if (parent_id !== void 0 && e.name !== _chunkZI4NSYCDcjs.TOMBSTONE_EVENT) {
579
+ if (parent_id !== void 0 && e.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
580
580
  checks.push({ stream: e.stream, id: e.id, parent_id });
581
581
  }
582
582
  },
@@ -596,7 +596,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(v
596
596
  }
597
597
  };
598
598
  }, "make_correlation_gaps_pass");
599
- var make_clock_anomalies_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
599
+ var make_clock_anomalies_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
600
600
  const findings = [];
601
601
  const last_per_stream = /* @__PURE__ */ new Map();
602
602
  return {
@@ -622,14 +622,14 @@ var make_clock_anomalies_pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(vo
622
622
  }
623
623
  last_per_stream.set(e.stream, created);
624
624
  },
625
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
625
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
626
626
  };
627
627
  }, "make_clock_anomalies_pass");
628
628
  function restart_is_supported(deps, head_event_name) {
629
629
  const state2 = deps.event_to_state.get(head_event_name);
630
630
  return _optionalChain([state2, 'optionalAccess', _35 => _35.snap]) !== void 0;
631
631
  }
632
- _chunkZI4NSYCDcjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
632
+ _chunk4GA3CHQWcjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
633
633
  function make_unreadable_events_pass() {
634
634
  const findings = [];
635
635
  return {
@@ -643,10 +643,10 @@ function make_unreadable_events_pass() {
643
643
  error
644
644
  });
645
645
  },
646
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => findings, "drain")
646
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
647
647
  };
648
648
  }
649
- _chunkZI4NSYCDcjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
649
+ _chunk4GA3CHQWcjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
650
650
  var PASS_FACTORIES = {
651
651
  schema: make_schema_pass,
652
652
  "deprecated-load": make_deprecated_load_pass,
@@ -663,7 +663,7 @@ var PASS_FACTORIES = {
663
663
  // src/internal/circuit-breaker.ts
664
664
  var CircuitBreaker = (_class = class {
665
665
  static {
666
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "CircuitBreaker");
666
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "CircuitBreaker");
667
667
  }
668
668
  __init() {this._failures = 0}
669
669
 
@@ -756,7 +756,7 @@ var CircuitBreaker = (_class = class {
756
756
 
757
757
  // src/internal/classify.ts
758
758
  var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
759
- var describe_source = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
759
+ var describe_source = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
760
760
  function classify_registry(registry, states) {
761
761
  const statics = /* @__PURE__ */ new Map();
762
762
  const target_lanes = /* @__PURE__ */ new Map();
@@ -807,43 +807,43 @@ function classify_registry(registry, states) {
807
807
  event_to_lanes
808
808
  };
809
809
  }
810
- _chunkZI4NSYCDcjs.__name.call(void 0, classify_registry, "classify_registry");
810
+ _chunk4GA3CHQWcjs.__name.call(void 0, classify_registry, "classify_registry");
811
811
 
812
812
  // src/internal/autoclose-policy.ts
813
813
  var DAY_MS = 864e5;
814
814
  function days_after(date, days) {
815
815
  return new Date(date.getTime() + days * DAY_MS);
816
816
  }
817
- _chunkZI4NSYCDcjs.__name.call(void 0, days_after, "days_after");
817
+ _chunk4GA3CHQWcjs.__name.call(void 0, days_after, "days_after");
818
818
  function days_before_now(days) {
819
819
  return new Date(Date.now() - days * DAY_MS);
820
820
  }
821
- _chunkZI4NSYCDcjs.__name.call(void 0, days_before_now, "days_before_now");
821
+ _chunk4GA3CHQWcjs.__name.call(void 0, days_before_now, "days_before_now");
822
822
  function compile_after(after) {
823
823
  return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
824
824
  }
825
- _chunkZI4NSYCDcjs.__name.call(void 0, compile_after, "compile_after");
825
+ _chunk4GA3CHQWcjs.__name.call(void 0, compile_after, "compile_after");
826
826
  function compile_is(is) {
827
827
  const set = new Set(typeof is === "string" ? [is] : is);
828
828
  return (_stream, head) => set.has(head.name);
829
829
  }
830
- _chunkZI4NSYCDcjs.__name.call(void 0, compile_is, "compile_is");
830
+ _chunk4GA3CHQWcjs.__name.call(void 0, compile_is, "compile_is");
831
831
  function compile_reaches(reaches) {
832
832
  return (_stream, _head, count) => count >= reaches;
833
833
  }
834
- _chunkZI4NSYCDcjs.__name.call(void 0, compile_reaches, "compile_reaches");
834
+ _chunk4GA3CHQWcjs.__name.call(void 0, compile_reaches, "compile_reaches");
835
835
  function policy_after_windows(options) {
836
- const parsed = _chunk62LDEIDMcjs.check.call(void 0, "autoclose_policy", options);
836
+ const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
837
837
  return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
838
838
  }
839
- _chunkZI4NSYCDcjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
839
+ _chunk4GA3CHQWcjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
840
840
  function policy_keep_days(options) {
841
- const parsed = _chunk62LDEIDMcjs.check.call(void 0, "autoclose_policy", options);
841
+ const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
842
842
  return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
843
843
  }
844
- _chunkZI4NSYCDcjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
844
+ _chunk4GA3CHQWcjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
845
845
  function compile_autoclose_policy(options) {
846
- const parsed = _chunk62LDEIDMcjs.check.call(void 0, "autoclose_policy", options);
846
+ const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
847
847
  const and_preds = [];
848
848
  if (parsed.after) and_preds.push(compile_after(parsed.after));
849
849
  if (parsed.is) and_preds.push(compile_is(parsed.is));
@@ -864,7 +864,7 @@ function compile_autoclose_policy(options) {
864
864
  return false;
865
865
  };
866
866
  }
867
- _chunkZI4NSYCDcjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
867
+ _chunk4GA3CHQWcjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
868
868
 
869
869
  // src/internal/autoclose-window.ts
870
870
  function hour_in_zone(now, timeZone) {
@@ -875,24 +875,24 @@ function hour_in_zone(now, timeZone) {
875
875
  }).formatToParts(now);
876
876
  return Number(_optionalChain([parts, 'access', _46 => _46.find, 'call', _47 => _47((p) => p.type === "hour"), 'optionalAccess', _48 => _48.value]));
877
877
  }
878
- _chunkZI4NSYCDcjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
878
+ _chunk4GA3CHQWcjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
879
879
  function hour_in_range(hour, start, end) {
880
880
  return start < end ? hour >= start && hour < end : hour >= start || hour < end;
881
881
  }
882
- _chunkZI4NSYCDcjs.__name.call(void 0, hour_in_range, "hour_in_range");
882
+ _chunk4GA3CHQWcjs.__name.call(void 0, hour_in_range, "hour_in_range");
883
883
  function is_dst_gap_open(now, timeZone, start) {
884
884
  const hour = hour_in_zone(now, timeZone);
885
885
  if (hour <= start) return false;
886
886
  const prev = hour_in_zone(new Date(now.getTime() - 36e5), timeZone);
887
887
  return prev === start - 1 && hour === start + 1;
888
888
  }
889
- _chunkZI4NSYCDcjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
889
+ _chunk4GA3CHQWcjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
890
890
  function in_autoclose_window(window, now) {
891
891
  if (!window) return true;
892
892
  const hour = hour_in_zone(now, window.timeZone);
893
893
  return hour_in_range(hour, window.start, window.end) || is_dst_gap_open(now, window.timeZone, window.start);
894
894
  }
895
- _chunkZI4NSYCDcjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
895
+ _chunk4GA3CHQWcjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
896
896
  function next_window_open(window, now) {
897
897
  const start_ms = now.getTime();
898
898
  for (let h = 0; h <= 48; h++) {
@@ -907,30 +907,30 @@ function next_window_open(window, now) {
907
907
  }
908
908
  return new Date(start_ms + 864e5);
909
909
  }
910
- _chunkZI4NSYCDcjs.__name.call(void 0, next_window_open, "next_window_open");
910
+ _chunk4GA3CHQWcjs.__name.call(void 0, next_window_open, "next_window_open");
911
911
 
912
912
  // src/internal/defer-config.ts
913
913
  function duration_ms(d) {
914
914
  return (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
915
915
  }
916
- _chunkZI4NSYCDcjs.__name.call(void 0, duration_ms, "duration_ms");
916
+ _chunk4GA3CHQWcjs.__name.call(void 0, duration_ms, "duration_ms");
917
917
  function resolve_defer_at(when, event) {
918
- const parsed = _chunk62LDEIDMcjs.check.call(void 0, "defer", when);
918
+ const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "defer", when);
919
919
  if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
920
920
  return parsed.at.getTime();
921
921
  }
922
- _chunkZI4NSYCDcjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
922
+ _chunk4GA3CHQWcjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
923
923
  function make_deferred(handler, schedule) {
924
924
  const call = handler;
925
- const deferred = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (event, stream, app) => {
925
+ const deferred = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (event, stream, app) => {
926
926
  const when = typeof schedule === "function" ? schedule(event) : schedule;
927
- if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkZI4NSYCDcjs.DeferSignal)(when);
927
+ if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk4GA3CHQWcjs.DeferSignal)(when);
928
928
  return call(event, stream, app);
929
929
  }, "deferred");
930
930
  Object.defineProperty(deferred, "name", { value: handler.name });
931
931
  return deferred;
932
932
  }
933
- _chunkZI4NSYCDcjs.__name.call(void 0, make_deferred, "make_deferred");
933
+ _chunk4GA3CHQWcjs.__name.call(void 0, make_deferred, "make_deferred");
934
934
 
935
935
  // src/internal/drain-cycle.ts
936
936
  var _crypto = require('crypto');
@@ -959,7 +959,7 @@ function compute_backoff_delay(retry, opts) {
959
959
  if (opts.jitter) delay = delay * (0.5 + Math.random());
960
960
  return Math.max(0, Math.floor(delay));
961
961
  }
962
- _chunkZI4NSYCDcjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
962
+ _chunk4GA3CHQWcjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
963
963
 
964
964
  // src/internal/drain-ratio.ts
965
965
  var RATIO_MIN = 0.2;
@@ -978,15 +978,15 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
978
978
  if (total === 0) return RATIO_DEFAULT;
979
979
  return Math.max(RATIO_MIN, Math.min(RATIO_MAX, lagging_avg / total));
980
980
  }
981
- _chunkZI4NSYCDcjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
981
+ _chunk4GA3CHQWcjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
982
982
 
983
983
  // src/internal/report-once.ts
984
984
  function report_once(seen, key, message) {
985
985
  if (seen.has(key)) return;
986
986
  seen.add(key);
987
- _chunk62LDEIDMcjs.log.call(void 0, ).error(new Error(message));
987
+ _chunkXG3UD63Ycjs.log.call(void 0, ).error(new Error(message));
988
988
  }
989
- _chunkZI4NSYCDcjs.__name.call(void 0, report_once, "report_once");
989
+ _chunk4GA3CHQWcjs.__name.call(void 0, report_once, "report_once");
990
990
 
991
991
  // src/internal/correlation-id.ts
992
992
 
@@ -996,8 +996,8 @@ var SEG_SPACE = BASE ** SEG_WIDTH;
996
996
  function seg(n) {
997
997
  return n.toString(BASE).padStart(SEG_WIDTH, "0");
998
998
  }
999
- _chunkZI4NSYCDcjs.__name.call(void 0, seg, "seg");
1000
- var default_correlator = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
999
+ _chunk4GA3CHQWcjs.__name.call(void 0, seg, "seg");
1000
+ var default_correlator = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
1001
1001
  const s = state2.slice(0, SEG_WIDTH).toLowerCase();
1002
1002
  const a = action2.slice(0, SEG_WIDTH).toLowerCase();
1003
1003
  const ts = seg(Date.now() % SEG_SPACE);
@@ -1012,17 +1012,17 @@ function close_correlation(correlator, actor) {
1012
1012
  actor
1013
1013
  });
1014
1014
  }
1015
- _chunkZI4NSYCDcjs.__name.call(void 0, close_correlation, "close_correlation");
1015
+ _chunk4GA3CHQWcjs.__name.call(void 0, close_correlation, "close_correlation");
1016
1016
 
1017
1017
  // src/internal/drain-ops.ts
1018
- var claim = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunk62LDEIDMcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
1018
+ var claim = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunkXG3UD63Ycjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
1019
1019
  async function fetch(leased, eventLimit) {
1020
1020
  return Promise.all(
1021
1021
  leased.map(async ({ stream, source, at, lagging }) => {
1022
1022
  const events = [];
1023
- const stream_exact = source !== void 0 && _chunkDAVFDMC4cjs.isStreamName.call(void 0, source, stream) ? true : void 0;
1023
+ const stream_exact = source !== void 0 && _chunkXJZ2PKJHcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
1024
1024
  try {
1025
- await _chunk62LDEIDMcjs.store.call(void 0, ).query((e) => events.push(e), {
1025
+ await _chunkXG3UD63Ycjs.store.call(void 0, ).query((e) => events.push(e), {
1026
1026
  stream: source,
1027
1027
  stream_exact,
1028
1028
  after: at,
@@ -1042,10 +1042,10 @@ async function fetch(leased, eventLimit) {
1042
1042
  })
1043
1043
  );
1044
1044
  }
1045
- _chunkZI4NSYCDcjs.__name.call(void 0, fetch, "fetch");
1046
- var ack = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (leases) => _chunk62LDEIDMcjs.store.call(void 0, ).ack(leases), "ack");
1047
- var block = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (leases) => _chunk62LDEIDMcjs.store.call(void 0, ).block(leases), "block");
1048
- var subscribe = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunk62LDEIDMcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
1045
+ _chunk4GA3CHQWcjs.__name.call(void 0, fetch, "fetch");
1046
+ var ack = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (leases) => _chunkXG3UD63Ycjs.store.call(void 0, ).ack(leases), "ack");
1047
+ var block = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (leases) => _chunkXG3UD63Ycjs.store.call(void 0, ).block(leases), "block");
1048
+ var subscribe = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunkXG3UD63Ycjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
1049
1049
 
1050
1050
  // src/internal/event-sourcing.ts
1051
1051
  var _actpatch = require('@rotorsoft/act-patch');
@@ -1055,7 +1055,7 @@ var _zod2 = require('zod');
1055
1055
 
1056
1056
 
1057
1057
  // src/internal/zod.ts
1058
- var def_of = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
1058
+ var def_of = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
1059
1059
  var SINGLE_INNER = [
1060
1060
  "optional",
1061
1061
  "nullable",
@@ -1065,7 +1065,7 @@ var SINGLE_INNER = [
1065
1065
  "readonly",
1066
1066
  "catch"
1067
1067
  ];
1068
- var inner_of = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
1068
+ var inner_of = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
1069
1069
  function wrapped(schema) {
1070
1070
  const def = def_of(schema);
1071
1071
  if (!def) return [];
@@ -1074,15 +1074,15 @@ function wrapped(schema) {
1074
1074
  const inner = inner_of(def);
1075
1075
  return inner ? [inner] : [];
1076
1076
  }
1077
- _chunkZI4NSYCDcjs.__name.call(void 0, wrapped, "wrapped");
1077
+ _chunk4GA3CHQWcjs.__name.call(void 0, wrapped, "wrapped");
1078
1078
  function parts_of(schema) {
1079
1079
  const def = def_of(schema);
1080
1080
  return _optionalChain([def, 'optionalAccess', _52 => _52.type]) === "intersection" ? [def.left, def.right] : wrapped(schema);
1081
1081
  }
1082
- _chunkZI4NSYCDcjs.__name.call(void 0, parts_of, "parts_of");
1082
+ _chunk4GA3CHQWcjs.__name.call(void 0, parts_of, "parts_of");
1083
1083
  function some_layer(schema, test) {
1084
1084
  const seen = /* @__PURE__ */ new Set();
1085
- const visit = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (s) => {
1085
+ const visit = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (s) => {
1086
1086
  if (seen.has(s)) return false;
1087
1087
  seen.add(s);
1088
1088
  const def = def_of(s);
@@ -1090,7 +1090,7 @@ function some_layer(schema, test) {
1090
1090
  }, "visit");
1091
1091
  return visit(schema);
1092
1092
  }
1093
- _chunkZI4NSYCDcjs.__name.call(void 0, some_layer, "some_layer");
1093
+ _chunk4GA3CHQWcjs.__name.call(void 0, some_layer, "some_layer");
1094
1094
  function output_of(schema) {
1095
1095
  const seen = /* @__PURE__ */ new Set();
1096
1096
  let cur = schema;
@@ -1104,7 +1104,7 @@ function output_of(schema) {
1104
1104
  }
1105
1105
  return cur;
1106
1106
  }
1107
- _chunkZI4NSYCDcjs.__name.call(void 0, output_of, "output_of");
1107
+ _chunk4GA3CHQWcjs.__name.call(void 0, output_of, "output_of");
1108
1108
 
1109
1109
  // src/internal/date-reviver.ts
1110
1110
  function variant_schema(schema, walk) {
@@ -1122,13 +1122,13 @@ function variant_schema(schema, walk) {
1122
1122
  }
1123
1123
  return { schema: _zod2.z.looseObject(next), dated };
1124
1124
  }
1125
- _chunkZI4NSYCDcjs.__name.call(void 0, variant_schema, "variant_schema");
1125
+ _chunk4GA3CHQWcjs.__name.call(void 0, variant_schema, "variant_schema");
1126
1126
  function date_reviver_schema(schema) {
1127
1127
  let recursive = false;
1128
- const pass = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (tie) => {
1128
+ const pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (tie) => {
1129
1129
  const done = /* @__PURE__ */ new Map();
1130
1130
  const active = /* @__PURE__ */ new Set();
1131
- const walk = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (node) => {
1131
+ const walk = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (node) => {
1132
1132
  if (done.has(node)) return done.get(node);
1133
1133
  if (active.has(node)) {
1134
1134
  recursive = true;
@@ -1145,11 +1145,11 @@ function date_reviver_schema(schema) {
1145
1145
  const first = pass(false);
1146
1146
  return first && recursive ? pass(true) : first;
1147
1147
  }
1148
- _chunkZI4NSYCDcjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
1148
+ _chunk4GA3CHQWcjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
1149
1149
  function build(schema, walk) {
1150
1150
  const def = def_of(schema);
1151
1151
  if (!def) return void 0;
1152
- const inner = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => walk(def.innerType), "inner");
1152
+ const inner = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => walk(def.innerType), "inner");
1153
1153
  switch (def.type) {
1154
1154
  case "date":
1155
1155
  return _zod2.z.coerce.date();
@@ -1196,42 +1196,42 @@ function build(schema, walk) {
1196
1196
  return inner_of(def) ? inner() : void 0;
1197
1197
  }
1198
1198
  }
1199
- _chunkZI4NSYCDcjs.__name.call(void 0, build, "build");
1199
+ _chunk4GA3CHQWcjs.__name.call(void 0, build, "build");
1200
1200
 
1201
1201
  // src/internal/event-sourcing.ts
1202
- var bare_patch = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
1203
- var value_at = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (value, path) => path.reduce(
1202
+ var bare_patch = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
1203
+ var value_at = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (value, path) => path.reduce(
1204
1204
  (at, key) => _optionalChain([at, 'optionalAccess', _58 => _58[key]]),
1205
1205
  value
1206
1206
  ), "value_at");
1207
- var check_invariants = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
1207
+ var check_invariants = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
1208
1208
  let result;
1209
1209
  try {
1210
1210
  result = schema.safeParse(state2);
1211
1211
  } catch (error) {
1212
- throw new (0, _chunkZI4NSYCDcjs.ValidationError)(target, state2, error);
1212
+ throw new (0, _chunk4GA3CHQWcjs.ValidationError)(target, state2, error);
1213
1213
  }
1214
1214
  if (result.success) return;
1215
1215
  const issues = pii_aware ? result.error.issues.filter((issue) => {
1216
1216
  const value = value_at(state2, issue.path);
1217
- return value !== _chunkZI4NSYCDcjs.REDACTED && value !== _chunkZI4NSYCDcjs.SHREDDED;
1217
+ return value !== _chunk4GA3CHQWcjs.REDACTED && value !== _chunk4GA3CHQWcjs.SHREDDED;
1218
1218
  }) : result.error.issues;
1219
1219
  if (issues.length)
1220
- throw new (0, _chunkZI4NSYCDcjs.ValidationError)(
1220
+ throw new (0, _chunk4GA3CHQWcjs.ValidationError)(
1221
1221
  target,
1222
1222
  state2,
1223
1223
  _zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
1224
1224
  );
1225
1225
  }, "check_invariants");
1226
1226
  var DEFAULT_BATCH = 500;
1227
- var cache_put = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (stream, entry) => _chunk62LDEIDMcjs.cache.call(void 0, ).set(stream, entry).catch(
1228
- (err) => _chunk62LDEIDMcjs.log.call(void 0, ).warn(
1227
+ var cache_put = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream, entry) => _chunkXG3UD63Ycjs.cache.call(void 0, ).set(stream, entry).catch(
1228
+ (err) => _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
1229
1229
  err,
1230
1230
  "cache set skipped; the next load re-folds from the store"
1231
1231
  )
1232
1232
  ), "cache_put");
1233
- var cache_drop = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (stream) => _chunk62LDEIDMcjs.cache.call(void 0, ).invalidate(stream).catch(
1234
- (err) => _chunk62LDEIDMcjs.log.call(void 0, ).warn(
1233
+ var cache_drop = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream) => _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream).catch(
1234
+ (err) => _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
1235
1235
  err,
1236
1236
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1237
1237
  )
@@ -1239,11 +1239,11 @@ var cache_drop = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (stream)
1239
1239
  async function snap(snapshot) {
1240
1240
  const { id, stream, name, meta, version } = snapshot.event;
1241
1241
  try {
1242
- const [committed] = await _chunk62LDEIDMcjs.store.call(void 0, ).commit(
1242
+ const [committed] = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
1243
1243
  [
1244
1244
  {
1245
1245
  stream,
1246
- msgs: [{ name: _chunkZI4NSYCDcjs.SNAP_EVENT, data: snapshot.state }],
1246
+ msgs: [{ name: _chunk4GA3CHQWcjs.SNAP_EVENT, data: snapshot.state }],
1247
1247
  // IMPORTANT! - state events are committed right after the snapshot event
1248
1248
  expectedVersion: version
1249
1249
  }
@@ -1256,19 +1256,19 @@ async function snap(snapshot) {
1256
1256
  return committed;
1257
1257
  } catch (error) {
1258
1258
  const reason = error instanceof Error ? error.message : String(error);
1259
- _chunk62LDEIDMcjs.log.call(void 0, ).warn(
1259
+ _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
1260
1260
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1261
1261
  );
1262
1262
  }
1263
1263
  }
1264
- _chunkZI4NSYCDcjs.__name.call(void 0, snap, "snap");
1264
+ _chunk4GA3CHQWcjs.__name.call(void 0, snap, "snap");
1265
1265
  async function tombstone(stream, expectedVersion, correlation) {
1266
1266
  try {
1267
- const [committed] = await _chunk62LDEIDMcjs.store.call(void 0, ).commit(
1267
+ const [committed] = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
1268
1268
  [
1269
1269
  {
1270
1270
  stream,
1271
- msgs: [{ name: _chunkZI4NSYCDcjs.TOMBSTONE_EVENT, data: {} }],
1271
+ msgs: [{ name: _chunk4GA3CHQWcjs.TOMBSTONE_EVENT, data: {} }],
1272
1272
  expectedVersion
1273
1273
  }
1274
1274
  ],
@@ -1276,18 +1276,18 @@ async function tombstone(stream, expectedVersion, correlation) {
1276
1276
  );
1277
1277
  return committed;
1278
1278
  } catch (error) {
1279
- if (error instanceof _chunkZI4NSYCDcjs.ConcurrencyError) return void 0;
1279
+ if (error instanceof _chunk4GA3CHQWcjs.ConcurrencyError) return void 0;
1280
1280
  throw error;
1281
1281
  }
1282
1282
  }
1283
- _chunkZI4NSYCDcjs.__name.call(void 0, tombstone, "tombstone");
1283
+ _chunk4GA3CHQWcjs.__name.call(void 0, tombstone, "tombstone");
1284
1284
  function is_valid(event) {
1285
1285
  if (event.version < 0) return false;
1286
1286
  if (!(event.created instanceof Date) || Number.isNaN(event.created.getTime()))
1287
1287
  return false;
1288
1288
  return true;
1289
1289
  }
1290
- _chunkZI4NSYCDcjs.__name.call(void 0, is_valid, "is_valid");
1290
+ _chunk4GA3CHQWcjs.__name.call(void 0, is_valid, "is_valid");
1291
1291
  async function scan(source, opts = {}, callback) {
1292
1292
  const {
1293
1293
  drop_snapshots = false,
@@ -1315,9 +1315,9 @@ async function scan(source, opts = {}, callback) {
1315
1315
  if (drop_closed_streams) {
1316
1316
  await source.query(
1317
1317
  (e) => {
1318
- if (e.name === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1318
+ if (e.name === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1319
1319
  },
1320
- { names: [_chunkZI4NSYCDcjs.TOMBSTONE_EVENT] }
1320
+ { names: [_chunk4GA3CHQWcjs.TOMBSTONE_EVENT] }
1321
1321
  );
1322
1322
  }
1323
1323
  let max_id;
@@ -1342,11 +1342,11 @@ async function scan(source, opts = {}, callback) {
1342
1342
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1343
1343
  const has_history = started.has(event.stream);
1344
1344
  started.add(event.stream);
1345
- if (drop_snapshots && event.name === _chunkZI4NSYCDcjs.SNAP_EVENT && has_history) {
1345
+ if (drop_snapshots && event.name === _chunk4GA3CHQWcjs.SNAP_EVENT && has_history) {
1346
1346
  dropped_snaps++;
1347
1347
  return;
1348
1348
  }
1349
- if (closed_streams.has(event.stream) && event.name !== _chunkZI4NSYCDcjs.TOMBSTONE_EVENT) {
1349
+ if (closed_streams.has(event.stream) && event.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
1350
1350
  dropped_closed++;
1351
1351
  return;
1352
1352
  }
@@ -1419,23 +1419,23 @@ async function scan(source, opts = {}, callback) {
1419
1419
  }
1420
1420
  };
1421
1421
  }
1422
- _chunkZI4NSYCDcjs.__name.call(void 0, scan, "scan");
1422
+ _chunk4GA3CHQWcjs.__name.call(void 0, scan, "scan");
1423
1423
  async function load(me, target, callback, patch_fn = bare_patch) {
1424
1424
  const { stream, actor, asOf } = target;
1425
1425
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1426
1426
  const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
1427
- const cached = time_travel ? void 0 : await _chunk62LDEIDMcjs.cache.call(void 0, ).get(stream);
1427
+ const cached = time_travel ? void 0 : await _chunkXG3UD63Ycjs.cache.call(void 0, ).get(stream);
1428
1428
  const cache_hit = !!cached;
1429
1429
  let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _67 => _67.state]), () => ( (me.init ? me.init() : {})));
1430
1430
  let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _68 => _68.patches]), () => ( 0));
1431
1431
  let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _69 => _69.snaps]), () => ( 0));
1432
1432
  let replayed = 0;
1433
1433
  let event;
1434
- await _chunk62LDEIDMcjs.store.call(void 0, ).query(
1434
+ await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
1435
1435
  (raw) => {
1436
- if (seeded && raw.name === _chunkZI4NSYCDcjs.SNAP_EVENT && replayed > 0) return;
1436
+ if (seeded && raw.name === _chunk4GA3CHQWcjs.SNAP_EVENT && replayed > 0) return;
1437
1437
  event = me.view(raw, actor);
1438
- if (event.name === _chunkZI4NSYCDcjs.SNAP_EVENT) {
1438
+ if (event.name === _chunk4GA3CHQWcjs.SNAP_EVENT) {
1439
1439
  state2 = event.data;
1440
1440
  snaps++;
1441
1441
  patches = 0;
@@ -1444,8 +1444,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1444
1444
  state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
1445
1445
  patches++;
1446
1446
  replayed++;
1447
- } else if (event.name !== _chunkZI4NSYCDcjs.TOMBSTONE_EVENT) {
1448
- _chunk62LDEIDMcjs.log.call(void 0, ).warn(
1447
+ } else if (event.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
1448
+ _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
1449
1449
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1450
1450
  );
1451
1451
  }
@@ -1473,7 +1473,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1473
1473
  ) : time_travel ? asOf : { with_snaps: true }
1474
1474
  }
1475
1475
  );
1476
- const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT;
1476
+ const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT;
1477
1477
  if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
1478
1478
  await cache_put(stream, {
1479
1479
  stream,
@@ -1496,7 +1496,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1496
1496
  replayed
1497
1497
  };
1498
1498
  }
1499
- _chunkZI4NSYCDcjs.__name.call(void 0, load, "load");
1499
+ _chunk4GA3CHQWcjs.__name.call(void 0, load, "load");
1500
1500
  async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1501
1501
  const streams = loads.map((l) => l.target(payload, own.state));
1502
1502
  streams.forEach((stream, i) => {
@@ -1517,8 +1517,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1517
1517
  void 0,
1518
1518
  patch_fn
1519
1519
  );
1520
- if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT)
1521
- throw new (0, _chunkZI4NSYCDcjs.StreamClosedError)(stream);
1520
+ if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT)
1521
+ throw new (0, _chunk4GA3CHQWcjs.StreamClosedError)(stream);
1522
1522
  return {
1523
1523
  state: l.state,
1524
1524
  stream,
@@ -1529,13 +1529,13 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1529
1529
  })
1530
1530
  );
1531
1531
  }
1532
- _chunkZI4NSYCDcjs.__name.call(void 0, load_others, "load_others");
1532
+ _chunk4GA3CHQWcjs.__name.call(void 0, load_others, "load_others");
1533
1533
  async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
1534
1534
  const { stream, expectedVersion, actor } = target;
1535
1535
  if (!stream) throw new Error("Missing target stream");
1536
1536
  const reactingTo = _optionalChain([options, 'optionalAccess', _78 => _78.reactingTo]);
1537
1537
  const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.correlator]), () => ( default_correlator));
1538
- const validated = _chunk62LDEIDMcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1538
+ const validated = _chunkXG3UD63Ycjs.validate.call(void 0, action2, payload, me.actions[action2]);
1539
1539
  const opts = _optionalChain([me, 'access', _80 => _80.options, 'optionalAccess', _81 => _81[action2]]);
1540
1540
  const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _82 => _82.maxRetries]), () => ( 0));
1541
1541
  const loads = _nullishCoalesce(_optionalChain([me, 'access', _83 => _83.loads, 'optionalAccess', _84 => _84[action2]]), () => ( []));
@@ -1547,8 +1547,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1547
1547
  void 0,
1548
1548
  patch_fn
1549
1549
  );
1550
- if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT)
1551
- throw new (0, _chunkZI4NSYCDcjs.StreamClosedError)(stream);
1550
+ if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT)
1551
+ throw new (0, _chunk4GA3CHQWcjs.StreamClosedError)(stream);
1552
1552
  const own = {
1553
1553
  state: me,
1554
1554
  stream,
@@ -1562,7 +1562,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1562
1562
  { stream, state: snapshot.state },
1563
1563
  target.actor,
1564
1564
  patch_fn,
1565
- (description) => new (0, _chunkZI4NSYCDcjs.PreconditionError)(
1565
+ (description) => new (0, _chunk4GA3CHQWcjs.PreconditionError)(
1566
1566
  action2,
1567
1567
  validated,
1568
1568
  target,
@@ -1575,7 +1575,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1575
1575
  );
1576
1576
  for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.requires, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
1577
1577
  if (!holds(validated, snapshot.state, actor, loaded))
1578
- throw new (0, _chunkZI4NSYCDcjs.PreconditionError)(
1578
+ throw new (0, _chunk4GA3CHQWcjs.PreconditionError)(
1579
1579
  action2,
1580
1580
  validated,
1581
1581
  target,
@@ -1597,7 +1597,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1597
1597
  );
1598
1598
  to.events.push({
1599
1599
  name: event,
1600
- data: _chunk62LDEIDMcjs.validate.call(void 0, event, data, to.state.events[event])
1600
+ data: _chunkXG3UD63Ycjs.validate.call(void 0, event, data, to.state.events[event])
1601
1601
  });
1602
1602
  }
1603
1603
  if (!own.events.length)
@@ -1654,7 +1654,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1654
1654
  });
1655
1655
  let committed;
1656
1656
  try {
1657
- committed = await _chunk62LDEIDMcjs.store.call(void 0, ).commit(
1657
+ committed = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
1658
1658
  appends.map((p) => ({
1659
1659
  stream: p.stream,
1660
1660
  msgs: p.events.map((e) => p.state.message(e)),
@@ -1663,7 +1663,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1663
1663
  meta
1664
1664
  );
1665
1665
  } catch (error) {
1666
- if (error instanceof _chunkZI4NSYCDcjs.ConcurrencyError) void cache_drop(error.stream);
1666
+ if (error instanceof _chunk4GA3CHQWcjs.ConcurrencyError) void cache_drop(error.stream);
1667
1667
  throw error;
1668
1668
  }
1669
1669
  let row = 0;
@@ -1705,20 +1705,20 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1705
1705
  }
1706
1706
  return snapshots;
1707
1707
  } catch (error) {
1708
- if (!(error instanceof _chunkZI4NSYCDcjs.ConcurrencyError)) throw error;
1708
+ if (!(error instanceof _chunk4GA3CHQWcjs.ConcurrencyError)) throw error;
1709
1709
  if (expectedVersion !== void 0 && error.stream === stream) throw error;
1710
1710
  if (attempt >= max_retries) throw error;
1711
1711
  if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
1712
1712
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
1713
- if (delay_ms > 0) await _chunk62LDEIDMcjs.sleep.call(void 0, delay_ms);
1713
+ if (delay_ms > 0) await _chunkXG3UD63Ycjs.sleep.call(void 0, delay_ms);
1714
1714
  }
1715
1715
  }
1716
1716
  }
1717
1717
  }
1718
- _chunkZI4NSYCDcjs.__name.call(void 0, action, "action");
1718
+ _chunk4GA3CHQWcjs.__name.call(void 0, action, "action");
1719
1719
 
1720
1720
  // src/internal/tracing.ts
1721
- var PRETTY = _chunk62LDEIDMcjs.config.call(void 0, ).env !== "production";
1721
+ var PRETTY = _chunkXG3UD63Ycjs.config.call(void 0, ).env !== "production";
1722
1722
  var C_BLUE = "\x1B[38;5;39m";
1723
1723
  var C_ORANGE = "\x1B[38;5;208m";
1724
1724
  var C_GREEN = "\x1B[38;5;42m";
@@ -1727,14 +1727,14 @@ var C_DRAIN = "\x1B[38;5;244m";
1727
1727
  var C_HIT = "\x1B[38;5;82m";
1728
1728
  var C_MISS = "\x1B[38;5;220m";
1729
1729
  var C_RESET = "\x1B[0m";
1730
- var es_caption = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
1730
+ var es_caption = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
1731
1731
  var C_LANE = "\x1B[38;5;183m";
1732
1732
  var C_DIM = "\x1B[38;5;240m";
1733
1733
  var C_ERR = "\x1B[38;5;196m";
1734
1734
  var C_STREAM = "\x1B[38;5;226m";
1735
- var dim = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
1736
- var hue = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
1737
- var drain_caption = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (caption, lane) => {
1735
+ var dim = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
1736
+ var hue = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
1737
+ var drain_caption = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (caption, lane) => {
1738
1738
  const show_lane = lane && lane !== "default";
1739
1739
  if (PRETTY) {
1740
1740
  const tag = `${C_DRAIN}>> ${caption}${C_RESET}`;
@@ -1742,17 +1742,17 @@ var drain_caption = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (capti
1742
1742
  }
1743
1743
  return show_lane ? `>> ${caption} ${lane}` : `>> ${caption}`;
1744
1744
  }, "drain_caption");
1745
- var cache_marker = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (hit) => {
1745
+ var cache_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (hit) => {
1746
1746
  const word = hit ? "hit" : "miss";
1747
1747
  if (!PRETTY) return word;
1748
1748
  return `${hit ? C_HIT : C_MISS}${word}${C_RESET}${C_GREEN}`;
1749
1749
  }, "cache_marker");
1750
- var stats_marker = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (version, replayed, snaps, patches) => {
1750
+ var stats_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (version, replayed, snaps, patches) => {
1751
1751
  const text = `v=${version} replayed=${replayed} snaps=${snaps} patches=${patches}`;
1752
1752
  if (!PRETTY) return text;
1753
1753
  return `${C_DRAIN}${text}${C_RESET}${C_GREEN}`;
1754
1754
  }, "stats_marker");
1755
- var as_of_marker = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (asOf) => {
1755
+ var as_of_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (asOf) => {
1756
1756
  if (!asOf) return "";
1757
1757
  const parts = [];
1758
1758
  if (asOf.before !== void 0) parts.push(`before=${asOf.before}`);
@@ -1763,14 +1763,14 @@ var as_of_marker = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (asOf)
1763
1763
  if (asOf.limit !== void 0) parts.push(`limit=${asOf.limit}`);
1764
1764
  return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
1765
1765
  }, "as_of_marker");
1766
- var traced = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
1766
+ var traced = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
1767
1767
  _optionalChain([entry, 'optionalCall', _100 => _100(...args)]);
1768
1768
  const result = await inner(...args);
1769
1769
  _optionalChain([exit, 'optionalCall', _101 => _101(result, ...args)]);
1770
1770
  return result;
1771
1771
  }), "traced");
1772
1772
  function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
1773
- const bound_action = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
1773
+ const bound_action = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
1774
1774
  me,
1775
1775
  action_name,
1776
1776
  target,
@@ -1778,7 +1778,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
1778
1778
  { ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.correlator]), () => ( correlator)) },
1779
1779
  patch_fn
1780
1780
  ), "bound_action");
1781
- const bound_load = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
1781
+ const bound_load = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
1782
1782
  if (logger.level !== "trace") {
1783
1783
  return {
1784
1784
  snap,
@@ -1840,7 +1840,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
1840
1840
  })
1841
1841
  };
1842
1842
  }
1843
- _chunkZI4NSYCDcjs.__name.call(void 0, build_es, "build_es");
1843
+ _chunk4GA3CHQWcjs.__name.call(void 0, build_es, "build_es");
1844
1844
  function build_drain(logger) {
1845
1845
  return {
1846
1846
  claim,
@@ -1860,7 +1860,7 @@ function build_drain(logger) {
1860
1860
  })
1861
1861
  };
1862
1862
  }
1863
- _chunkZI4NSYCDcjs.__name.call(void 0, build_drain, "build_drain");
1863
+ _chunk4GA3CHQWcjs.__name.call(void 0, build_drain, "build_drain");
1864
1864
  function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1865
1865
  if (logger.level !== "trace" || !leased.length) return;
1866
1866
  const lane = _optionalChain([leased, 'access', _105 => _105[0], 'optionalAccess', _106 => _106.lane]);
@@ -1898,17 +1898,17 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1898
1898
  }).join(", ");
1899
1899
  logger.trace(`${drain_caption("drained", lane)} ${detail}`);
1900
1900
  }
1901
- _chunkZI4NSYCDcjs.__name.call(void 0, trace_cycle, "trace_cycle");
1901
+ _chunk4GA3CHQWcjs.__name.call(void 0, trace_cycle, "trace_cycle");
1902
1902
 
1903
1903
  // src/internal/drain-cycle.ts
1904
1904
  function budget_exhausted(lease, options, store_failing) {
1905
1905
  if (store_failing || !_optionalChain([options, 'optionalAccess', _110 => _110.blockOnError]) || lease.retry <= options.maxRetries)
1906
1906
  return void 0;
1907
1907
  const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
1908
- _chunk62LDEIDMcjs.log.call(void 0, ).error(error);
1908
+ _chunkXG3UD63Ycjs.log.call(void 0, ).error(error);
1909
1909
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
1910
1910
  }
1911
- _chunkZI4NSYCDcjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
1911
+ _chunk4GA3CHQWcjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
1912
1912
  function fetch_failure_policy(registry) {
1913
1913
  let blockOnError = true;
1914
1914
  let maxRetries = 0;
@@ -1919,17 +1919,17 @@ function fetch_failure_policy(registry) {
1919
1919
  }
1920
1920
  return { blockOnError, maxRetries };
1921
1921
  }
1922
- _chunkZI4NSYCDcjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
1922
+ _chunk4GA3CHQWcjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
1923
1923
  function finalize(lease, handled, at, error, options, logger, failed_at) {
1924
1924
  if (!error) return { lease, handled, acked_at: at };
1925
1925
  logger.error(error);
1926
- const non_retryable = error instanceof _chunkZI4NSYCDcjs.NonRetryableError;
1926
+ const non_retryable = error instanceof _chunk4GA3CHQWcjs.NonRetryableError;
1927
1927
  const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
1928
1928
  if (block2)
1929
1929
  logger.error(
1930
1930
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
1931
1931
  );
1932
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunk62LDEIDMcjs.DEFAULT_BACKOFF)));
1932
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkXG3UD63Ycjs.DEFAULT_BACKOFF)));
1933
1933
  return {
1934
1934
  lease,
1935
1935
  handled,
@@ -1940,7 +1940,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
1940
1940
  failed_at
1941
1941
  };
1942
1942
  }
1943
- _chunkZI4NSYCDcjs.__name.call(void 0, finalize, "finalize");
1943
+ _chunk4GA3CHQWcjs.__name.call(void 0, finalize, "finalize");
1944
1944
  function warn_misrouted(seen, stream, handler, event) {
1945
1945
  report_once(
1946
1946
  seen,
@@ -1948,7 +1948,7 @@ function warn_misrouted(seen, stream, handler, event) {
1948
1948
  `Reaction "${handler}" on "${event}" resolved to target "${stream}", which a projection already serves. A target is served by one batch handler or one state projection, so this reaction can never run \u2014 and delivering to it would hand the projection an aggregate from another stream. Skipping it. The equivalent static \`.to({ target })\` is rejected at build; a dynamic resolver's target is only knowable here.`
1949
1949
  );
1950
1950
  }
1951
- _chunkZI4NSYCDcjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
1951
+ _chunk4GA3CHQWcjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
1952
1952
  async function run_drain_cycle(deps, cycle) {
1953
1953
  const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
1954
1954
  const {
@@ -2059,13 +2059,13 @@ async function run_drain_cycle(deps, cycle) {
2059
2059
  const acked = submitted.length ? await ops.ack(submitted) : [];
2060
2060
  const expected = submitted.filter((l) => l.due === void 0).length;
2061
2061
  if (acked.length < expected)
2062
- _chunk62LDEIDMcjs.log.call(void 0, ).warn(
2062
+ _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
2063
2063
  `drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
2064
2064
  );
2065
2065
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
2066
2066
  return { leased, fetched, handled, acked, blocked, closeable };
2067
2067
  }
2068
- _chunkZI4NSYCDcjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
2068
+ _chunk4GA3CHQWcjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
2069
2069
  var EMPTY_DRAIN = {
2070
2070
  fetched: [],
2071
2071
  leased: [],
@@ -2080,11 +2080,11 @@ function merge_drains(drains) {
2080
2080
  blocked: drains.flatMap((d) => d.blocked)
2081
2081
  };
2082
2082
  }
2083
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_drains, "merge_drains");
2083
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_drains, "merge_drains");
2084
2084
  var RETRY = "";
2085
2085
  var DrainController = (_class2 = class {
2086
2086
  static {
2087
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "DrainController");
2087
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "DrainController");
2088
2088
  }
2089
2089
  // Armed while `_raised` is ahead of `_lowered` (the raise count the last
2090
2090
  // empty claim saw), so a claim never lowers over a raise that landed
@@ -2097,7 +2097,7 @@ var DrainController = (_class2 = class {
2097
2097
  // itself is persisted. On an idle app nothing else would drain it. It
2098
2098
  // drains until a pass leases nothing or the controller stops, and an entry
2099
2099
  // stays until handled or until a later pass claims nothing.
2100
- __init5() {this._defer = new (0, _chunk62LDEIDMcjs.DeferTimer)(() => {
2100
+ __init5() {this._defer = new (0, _chunkXG3UD63Ycjs.DeferTimer)(() => {
2101
2101
  this.arm();
2102
2102
  void this._deps.run_scoped(async () => {
2103
2103
  while ((await this.drain()).leased.length > 0) ;
@@ -2139,7 +2139,7 @@ var DrainController = (_class2 = class {
2139
2139
  */
2140
2140
  start(cycleMs) {
2141
2141
  const run = this._deps.run_scoped;
2142
- const tick = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async () => {
2142
+ const tick = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
2143
2143
  if (this.armed) await run(() => this.drain());
2144
2144
  if (this._stopped) return;
2145
2145
  this._worker = setTimeout(tick, cycleMs);
@@ -2160,9 +2160,9 @@ var DrainController = (_class2 = class {
2160
2160
  if (!this.armed || this._stopped || this._inflight)
2161
2161
  return EMPTY_DRAIN;
2162
2162
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
2163
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunk62LDEIDMcjs.DEFAULT_STREAM_LIMIT));
2164
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunk62LDEIDMcjs.DEFAULT_EVENT_LIMIT));
2165
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunk62LDEIDMcjs.DEFAULT_LEASE_MILLIS));
2163
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkXG3UD63Ycjs.DEFAULT_STREAM_LIMIT));
2164
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkXG3UD63Ycjs.DEFAULT_EVENT_LIMIT));
2165
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS));
2166
2166
  if (this._deps.breaker.state(Date.now()) === "open")
2167
2167
  return EMPTY_DRAIN;
2168
2168
  const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
@@ -2223,7 +2223,7 @@ var DrainController = (_class2 = class {
2223
2223
  // src/internal/reaction-dispatch.ts
2224
2224
  var CloseSignal = class extends Error {
2225
2225
  static {
2226
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "CloseSignal");
2226
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "CloseSignal");
2227
2227
  }
2228
2228
  /**
2229
2229
  * Stream to close. Omitted → the reaction's own lease stream (a self-close).
@@ -2291,7 +2291,7 @@ function build_handle(deps) {
2291
2291
  handled++;
2292
2292
  }
2293
2293
  } catch (error) {
2294
- if (error instanceof _chunkZI4NSYCDcjs.DeferSignal) {
2294
+ if (error instanceof _chunk4GA3CHQWcjs.DeferSignal) {
2295
2295
  let defer;
2296
2296
  try {
2297
2297
  defer = resolve_defer_at(error.when, event);
@@ -2340,7 +2340,7 @@ function build_handle(deps) {
2340
2340
  return finalize(lease, handled, at, void 0, payloads[0].options, logger);
2341
2341
  };
2342
2342
  }
2343
- _chunkZI4NSYCDcjs.__name.call(void 0, build_handle, "build_handle");
2343
+ _chunk4GA3CHQWcjs.__name.call(void 0, build_handle, "build_handle");
2344
2344
  function build_handle_batch(logger) {
2345
2345
  return async (lease, payloads, batchHandler) => {
2346
2346
  const stream = lease.stream;
@@ -2369,7 +2369,7 @@ function build_handle_batch(logger) {
2369
2369
  }
2370
2370
  };
2371
2371
  }
2372
- _chunkZI4NSYCDcjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
2372
+ _chunk4GA3CHQWcjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
2373
2373
 
2374
2374
  // src/internal/autoclose-reaction.ts
2375
2375
  var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
@@ -2390,22 +2390,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2390
2390
  // An anchored stream name would read as a pattern, and a store may refuse
2391
2391
  // it at subscribe, stopping every reaction. Such a stream has no
2392
2392
  // autoclose: `app.close` still closes it.
2393
- resolver: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (e) => _chunkDAVFDMC4cjs.isStreamName.call(void 0, e.stream) ? {
2393
+ resolver: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (e) => _chunkXJZ2PKJHcjs.isStreamName.call(void 0, e.stream) ? {
2394
2394
  target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
2395
2395
  source: e.stream
2396
2396
  } : void 0, "resolver"),
2397
2397
  // Never block on autoclose: a transient query/store error should retry,
2398
2398
  // not quarantine the synthetic stream.
2399
- options: { blockOnError: false, maxRetries: _chunk62LDEIDMcjs.DEFAULT_MAX_RETRIES },
2400
- handler: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (event) => {
2399
+ options: { blockOnError: false, maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES },
2400
+ handler: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (event) => {
2401
2401
  const aggregate = event.stream;
2402
2402
  const window = read_window();
2403
2403
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
2404
- throw new (0, _chunkZI4NSYCDcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2405
- const stats = await _chunk62LDEIDMcjs.store.call(void 0, ).query_stats([aggregate], {
2404
+ throw new (0, _chunk4GA3CHQWcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2405
+ const stats = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats([aggregate], {
2406
2406
  count: true,
2407
2407
  tail: keep_days !== void 0 ? true : void 0,
2408
- exclude: [_chunkZI4NSYCDcjs.TOMBSTONE_EVENT, _chunkZI4NSYCDcjs.SNAP_EVENT]
2408
+ exclude: [_chunk4GA3CHQWcjs.TOMBSTONE_EVENT, _chunk4GA3CHQWcjs.SNAP_EVENT]
2409
2409
  });
2410
2410
  const entry = stats.get(aggregate);
2411
2411
  if (!entry) return;
@@ -2443,7 +2443,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2443
2443
  dues.push(days_after(entry.tail.created, keep_days));
2444
2444
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
2445
2445
  if (future.length)
2446
- throw new (0, _chunkZI4NSYCDcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2446
+ throw new (0, _chunk4GA3CHQWcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2447
2447
  }, "handler")
2448
2448
  };
2449
2449
  const key = `__autoclose_${st.name}`;
@@ -2455,7 +2455,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2455
2455
  }
2456
2456
  }
2457
2457
  }
2458
- _chunkZI4NSYCDcjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
2458
+ _chunk4GA3CHQWcjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
2459
2459
 
2460
2460
  // src/internal/close-cycle.ts
2461
2461
  var CLOSE_CATCH_UP_LIMIT = 1e3;
@@ -2469,10 +2469,10 @@ async function catch_up_correlation(cursor, correlate, until) {
2469
2469
  }
2470
2470
  return cursor.checkpoint;
2471
2471
  }
2472
- _chunkZI4NSYCDcjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
2472
+ _chunk4GA3CHQWcjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
2473
2473
  var CloseLock = (_class3 = class {constructor() { _class3.prototype.__init8.call(this); }
2474
2474
  static {
2475
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "CloseLock");
2475
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "CloseLock");
2476
2476
  }
2477
2477
  __init8() {this._tails = /* @__PURE__ */ new Map()}
2478
2478
  /** Run `work` after every earlier close of `stream` has settled. */
@@ -2480,7 +2480,7 @@ var CloseLock = (_class3 = class {constructor() { _class3.prototype.__init8.call
2480
2480
  const prev = _nullishCoalesce(this._tails.get(stream), () => ( Promise.resolve()));
2481
2481
  const next = prev.then(work, work);
2482
2482
  this._tails.set(stream, next);
2483
- const cleanup = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
2483
+ const cleanup = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
2484
2484
  if (this._tails.get(stream) === next) this._tails.delete(stream);
2485
2485
  }, "cleanup");
2486
2486
  next.then(cleanup, cleanup);
@@ -2508,12 +2508,12 @@ async function run_close_cycle(targets, deps) {
2508
2508
  deps,
2509
2509
  () => run_full_closes(full, target_map, deps, skipped)
2510
2510
  );
2511
- const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2511
+ const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2512
2512
  if (retired.length) _optionalChain([deps, 'access', _137 => _137.forget_subscribed, 'optionalCall', _138 => _138(retired)]);
2513
2513
  for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
2514
2514
  return { truncated, skipped };
2515
2515
  }
2516
- _chunkZI4NSYCDcjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
2516
+ _chunk4GA3CHQWcjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
2517
2517
  function with_stream_locks(streams, deps, work) {
2518
2518
  const with_lock = _nullishCoalesce(deps.with_stream_lock, () => ( ((_stream, w) => w())));
2519
2519
  return [...streams].sort().reduceRight(
@@ -2521,7 +2521,7 @@ function with_stream_locks(streams, deps, work) {
2521
2521
  work
2522
2522
  )();
2523
2523
  }
2524
- _chunkZI4NSYCDcjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
2524
+ _chunk4GA3CHQWcjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
2525
2525
  async function run_full_closes(full, target_map, deps, skipped) {
2526
2526
  const none = /* @__PURE__ */ new Map();
2527
2527
  const streams = full.map((t) => t.stream);
@@ -2577,7 +2577,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
2577
2577
  deps.correlation
2578
2578
  );
2579
2579
  }
2580
- _chunkZI4NSYCDcjs.__name.call(void 0, run_full_closes, "run_full_closes");
2580
+ _chunk4GA3CHQWcjs.__name.call(void 0, run_full_closes, "run_full_closes");
2581
2581
  async function run_windowed_closes(windowed, deps, skipped) {
2582
2582
  const checkpoint = deps.reactive ? await deps.catch_up_correlation(Number.MAX_SAFE_INTEGER) : -1;
2583
2583
  const min_at = deps.reactive ? await probe_min_watermarks(
@@ -2593,7 +2593,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
2593
2593
  if (!await windowed_prune_pending(t.stream, t.before, max_id))
2594
2594
  return void 0;
2595
2595
  if (t.archive) await t.archive();
2596
- const result = await _chunk62LDEIDMcjs.store.call(void 0, ).truncate([
2596
+ const result = await _chunkXG3UD63Ycjs.store.call(void 0, ).truncate([
2597
2597
  { stream: t.stream, before: t.before, max_id }
2598
2598
  ]);
2599
2599
  return result.get(t.stream);
@@ -2603,26 +2603,26 @@ async function run_windowed_closes(windowed, deps, skipped) {
2603
2603
  }
2604
2604
  return truncated;
2605
2605
  }
2606
- _chunkZI4NSYCDcjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
2606
+ _chunk4GA3CHQWcjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
2607
2607
  async function windowed_prune_pending(stream, before, max_id) {
2608
2608
  let boundary_id;
2609
2609
  let min_id;
2610
- await _chunk62LDEIDMcjs.store.call(void 0, ).query(
2610
+ await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
2611
2611
  (event) => {
2612
2612
  if (min_id === void 0 || event.id < min_id) min_id = event.id;
2613
- if (event.name === _chunkZI4NSYCDcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2613
+ if (event.name === _chunk4GA3CHQWcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2614
2614
  boundary_id = event.id;
2615
2615
  },
2616
2616
  { stream, stream_exact: true, with_snaps: true, after: -1 }
2617
2617
  );
2618
2618
  return boundary_id !== void 0 && min_id < boundary_id;
2619
2619
  }
2620
- _chunkZI4NSYCDcjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
2620
+ _chunk4GA3CHQWcjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
2621
2621
  async function probe_min_watermarks(streams, page_size, checkpoint) {
2622
2622
  const min_at = /* @__PURE__ */ new Map();
2623
2623
  const matches = source_matcher();
2624
2624
  await walk_streams(
2625
- _chunk62LDEIDMcjs.store.call(void 0, ),
2625
+ _chunkXG3UD63Ycjs.store.call(void 0, ),
2626
2626
  (position) => {
2627
2627
  const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
2628
2628
  const cap = pending ? position.at : Math.max(position.at, checkpoint);
@@ -2637,12 +2637,12 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
2637
2637
  );
2638
2638
  return min_at;
2639
2639
  }
2640
- _chunkZI4NSYCDcjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
2640
+ _chunk4GA3CHQWcjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
2641
2641
  function source_matcher() {
2642
2642
  const compiled = /* @__PURE__ */ new Map();
2643
2643
  return (source, target, stream) => {
2644
2644
  if (!source) return true;
2645
- if (_chunkDAVFDMC4cjs.isStreamName.call(void 0, source, target)) return source === stream;
2645
+ if (_chunkXJZ2PKJHcjs.isStreamName.call(void 0, source, target)) return source === stream;
2646
2646
  let re = compiled.get(source);
2647
2647
  if (!re) {
2648
2648
  re = new RegExp(source);
@@ -2651,19 +2651,19 @@ function source_matcher() {
2651
2651
  return re.test(stream);
2652
2652
  };
2653
2653
  }
2654
- _chunkZI4NSYCDcjs.__name.call(void 0, source_matcher, "source_matcher");
2654
+ _chunk4GA3CHQWcjs.__name.call(void 0, source_matcher, "source_matcher");
2655
2655
  async function scan_stream_heads(streams) {
2656
- const stats = await _chunk62LDEIDMcjs.store.call(void 0, ).query_stats(streams, {
2657
- exclude: [_chunkZI4NSYCDcjs.SNAP_EVENT]
2656
+ const stats = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {
2657
+ exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT]
2658
2658
  });
2659
- const domain_heads = await _chunk62LDEIDMcjs.store.call(void 0, ).query_stats(streams, {
2660
- exclude: [_chunkZI4NSYCDcjs.SNAP_EVENT, _chunkZI4NSYCDcjs.TOMBSTONE_EVENT]
2659
+ const domain_heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {
2660
+ exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT, _chunk4GA3CHQWcjs.TOMBSTONE_EVENT]
2661
2661
  });
2662
- const true_heads = await _chunk62LDEIDMcjs.store.call(void 0, ).query_stats(streams, {});
2662
+ const true_heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {});
2663
2663
  const out = /* @__PURE__ */ new Map();
2664
2664
  for (const [stream, { head }] of domain_heads) {
2665
2665
  const marker_head = _optionalChain([stats, 'access', _140 => _140.get, 'call', _141 => _141(stream), 'optionalAccess', _142 => _142.head]);
2666
- const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) === _chunkZI4NSYCDcjs.TOMBSTONE_EVENT;
2666
+ const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT;
2667
2667
  out.set(stream, {
2668
2668
  max_id: head.id,
2669
2669
  version: true_heads.get(stream).head.version,
@@ -2673,7 +2673,7 @@ async function scan_stream_heads(streams) {
2673
2673
  }
2674
2674
  return out;
2675
2675
  }
2676
- _chunkZI4NSYCDcjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
2676
+ _chunk4GA3CHQWcjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
2677
2677
  async function partition_by_safety(stream_info, reactive, skipped, page_size, catch_up_correlation2) {
2678
2678
  if (!reactive) return [...stream_info.keys()];
2679
2679
  let needed = -1;
@@ -2687,7 +2687,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
2687
2687
  const pending_set = /* @__PURE__ */ new Set();
2688
2688
  const matches = source_matcher();
2689
2689
  await walk_streams(
2690
- _chunk62LDEIDMcjs.store.call(void 0, ),
2690
+ _chunkXG3UD63Ycjs.store.call(void 0, ),
2691
2691
  (position) => {
2692
2692
  const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
2693
2693
  if (!has_work) return;
@@ -2707,7 +2707,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
2707
2707
  }
2708
2708
  return safe;
2709
2709
  }
2710
- _chunkZI4NSYCDcjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
2710
+ _chunk4GA3CHQWcjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
2711
2711
  async function guard_with_tombstones(safe, stream_info, correlation, tombstone2, skipped) {
2712
2712
  const guarded = [];
2713
2713
  const guard_events = /* @__PURE__ */ new Map();
@@ -2730,7 +2730,7 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
2730
2730
  );
2731
2731
  return { guarded, guard_events };
2732
2732
  }
2733
- _chunkZI4NSYCDcjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
2733
+ _chunk4GA3CHQWcjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
2734
2734
  async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
2735
2735
  const seed_states = /* @__PURE__ */ new Map();
2736
2736
  await Promise.all(
@@ -2749,16 +2749,16 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
2749
2749
  );
2750
2750
  return seed_states;
2751
2751
  }
2752
- _chunkZI4NSYCDcjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
2752
+ _chunk4GA3CHQWcjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
2753
2753
  async function run_archive_callbacks(guarded, target_map) {
2754
2754
  for (const stream of guarded) {
2755
2755
  const archive_fn = _optionalChain([target_map, 'access', _147 => _147.get, 'call', _148 => _148(stream), 'optionalAccess', _149 => _149.archive]);
2756
2756
  if (archive_fn) await archive_fn();
2757
2757
  }
2758
2758
  }
2759
- _chunkZI4NSYCDcjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
2759
+ _chunk4GA3CHQWcjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
2760
2760
  async function heads_still_guarded(guarded, guard_events, skipped) {
2761
- const heads = await _chunk62LDEIDMcjs.store.call(void 0, ).query_stats(guarded, {});
2761
+ const heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(guarded, {});
2762
2762
  return guarded.filter((stream) => {
2763
2763
  if (_optionalChain([heads, 'access', _150 => _150.get, 'call', _151 => _151(stream), 'optionalAccess', _152 => _152.head, 'access', _153 => _153.id]) === guard_events.get(stream).id)
2764
2764
  return true;
@@ -2766,7 +2766,7 @@ async function heads_still_guarded(guarded, guard_events, skipped) {
2766
2766
  return false;
2767
2767
  });
2768
2768
  }
2769
- _chunkZI4NSYCDcjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
2769
+ _chunk4GA3CHQWcjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
2770
2770
  async function truncate_and_warm_cache(guarded, seed_states, guard_events, correlation) {
2771
2771
  const trunc_targets = guarded.map((stream) => {
2772
2772
  const snapshot = seed_states.get(stream);
@@ -2777,18 +2777,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2777
2777
  meta: {
2778
2778
  correlation,
2779
2779
  causation: {
2780
- event: { id: guard.id, name: _chunkZI4NSYCDcjs.TOMBSTONE_EVENT, stream: guard.stream }
2780
+ event: { id: guard.id, name: _chunk4GA3CHQWcjs.TOMBSTONE_EVENT, stream: guard.stream }
2781
2781
  }
2782
2782
  }
2783
2783
  };
2784
2784
  });
2785
- const truncated = await _chunk62LDEIDMcjs.store.call(void 0, ).truncate(trunc_targets);
2785
+ const truncated = await _chunkXG3UD63Ycjs.store.call(void 0, ).truncate(trunc_targets);
2786
2786
  await Promise.all(
2787
2787
  guarded.map(async (stream) => {
2788
2788
  const entry = truncated.get(stream);
2789
2789
  const state2 = seed_states.get(stream);
2790
2790
  if (state2 && entry) {
2791
- await _chunk62LDEIDMcjs.cache.call(void 0, ).set(stream, {
2791
+ await _chunkXG3UD63Ycjs.cache.call(void 0, ).set(stream, {
2792
2792
  stream,
2793
2793
  state: state2,
2794
2794
  version: entry.committed.version,
@@ -2797,19 +2797,19 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2797
2797
  snaps: 1
2798
2798
  });
2799
2799
  } else {
2800
- await _chunk62LDEIDMcjs.cache.call(void 0, ).invalidate(stream);
2800
+ await _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream);
2801
2801
  }
2802
2802
  })
2803
2803
  );
2804
2804
  return truncated;
2805
2805
  }
2806
- _chunkZI4NSYCDcjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
2806
+ _chunk4GA3CHQWcjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
2807
2807
 
2808
2808
  // src/internal/correlate-cycle.ts
2809
2809
 
2810
2810
  var COLD_START_BACK_SCAN = 1e4;
2811
2811
  var CORRELATION_LEASE_MS = 5e3;
2812
- var registry_key = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (events) => {
2812
+ var registry_key = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (events) => {
2813
2813
  const shape = Object.keys(events).filter((name) => events[name].reactions.size > 0).sort().map((name) => [name, [...events[name].reactions.keys()].sort()]);
2814
2814
  return _crypto.createHash.call(void 0, "sha256").update(JSON.stringify(shape)).digest("hex").slice(0, 32);
2815
2815
  }, "registry_key");
@@ -2821,7 +2821,7 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
2821
2821
  `Reaction "${handler}" resolved onto undeclared lane "${lane}" \u2014 for example target "${target}". Declared lanes: ${[...declared].map((l) => `"${l}"`).join(", ")}. No controller claims it, so the stream would never drain \u2014 running it on "default" instead. The equivalent static \`.to({ lane })\` is rejected at build; a dynamic resolver's lane is only knowable here.`
2822
2822
  );
2823
2823
  }
2824
- _chunkZI4NSYCDcjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
2824
+ _chunk4GA3CHQWcjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
2825
2825
  function report_bad_priority(seen, handler, target, priority) {
2826
2826
  report_once(
2827
2827
  seen,
@@ -2829,7 +2829,7 @@ function report_bad_priority(seen, handler, target, priority) {
2829
2829
  `Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Running it at priority 0 instead. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
2830
2830
  );
2831
2831
  }
2832
- _chunkZI4NSYCDcjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
2832
+ _chunk4GA3CHQWcjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
2833
2833
  function report_lane_conflict(seen, handler, target, kept, dropped) {
2834
2834
  report_once(
2835
2835
  seen,
@@ -2837,10 +2837,10 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
2837
2837
  `Reaction "${handler}" resolved lane "${dropped}" for a stream already on "${kept}" \u2014 for example "${target}". These are conflicting lane assignments from two dynamic resolutions at equal priority. Keeping "${kept}", the lane it was first discovered on \u2014 re-laning a live stream would move it out from under a worker holding its lease. The reaction resolving "${dropped}" runs inside the "${kept}" lane's budget, and a process restricted to "${dropped}" via onlyLanes never runs it. The equivalent static declaration is rejected at build; align the resolvers, or split the target.`
2838
2838
  );
2839
2839
  }
2840
- _chunkZI4NSYCDcjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
2840
+ _chunk4GA3CHQWcjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
2841
2841
  var CorrelateCycle = (_class4 = class {
2842
2842
  static {
2843
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "CorrelateCycle");
2843
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "CorrelateCycle");
2844
2844
  }
2845
2845
  __init9() {this._checkpoint = -1}
2846
2846
  // Lease holder id; per instance, so a restart never inherits a stale claim.
@@ -2863,7 +2863,7 @@ var CorrelateCycle = (_class4 = class {
2863
2863
  // never lets a resolution re-lane them.
2864
2864
 
2865
2865
  __init17() {this._static_subscriptions = /* @__PURE__ */ new Map()}
2866
- __init18() {this._patterns = new (0, _chunk62LDEIDMcjs.LruMap)(PATTERN_CACHE_SIZE)}
2866
+ __init18() {this._patterns = new (0, _chunkXG3UD63Ycjs.LruMap)(PATTERN_CACHE_SIZE)}
2867
2867
 
2868
2868
 
2869
2869
 
@@ -2881,7 +2881,7 @@ var CorrelateCycle = (_class4 = class {
2881
2881
  on_init
2882
2882
  }) {;_class4.prototype.__init9.call(this);_class4.prototype.__init10.call(this);_class4.prototype.__init11.call(this);_class4.prototype.__init12.call(this);_class4.prototype.__init13.call(this);_class4.prototype.__init14.call(this);_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this);_class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this);
2883
2883
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
2884
- this._dynamic_subscriptions = new (0, _chunk62LDEIDMcjs.LruMap)(max_subscribed_streams);
2884
+ this._dynamic_subscriptions = new (0, _chunkXG3UD63Ycjs.LruMap)(max_subscribed_streams);
2885
2885
  this._registry = registry;
2886
2886
  this._declared_lanes = declared_lanes;
2887
2887
  this._static_targets = static_targets;
@@ -2939,7 +2939,7 @@ var CorrelateCycle = (_class4 = class {
2939
2939
  // Would the target's own `fetch` (filtered by `source`) return this event?
2940
2940
  _in_fetch_window(source, stream) {
2941
2941
  if (source === void 0 || source === stream) return true;
2942
- if (_chunkDAVFDMC4cjs.isStreamName.call(void 0, source)) return false;
2942
+ if (_chunkXJZ2PKJHcjs.isStreamName.call(void 0, source)) return false;
2943
2943
  let pattern = this._patterns.get(source);
2944
2944
  if (!pattern) {
2945
2945
  pattern = new RegExp(source);
@@ -2961,7 +2961,7 @@ var CorrelateCycle = (_class4 = class {
2961
2961
  async _scan(limit, lease) {
2962
2962
  await this._init();
2963
2963
  const epoch = this._epoch;
2964
- const idle = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => ({
2964
+ const idle = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
2965
2965
  kind: "idle",
2966
2966
  last_id: this._checkpoint
2967
2967
  }), "idle");
@@ -2982,7 +2982,7 @@ var CorrelateCycle = (_class4 = class {
2982
2982
  const correlated = /* @__PURE__ */ new Map();
2983
2983
  let last_id = after;
2984
2984
  let stopped = false;
2985
- const found = await _chunk62LDEIDMcjs.store.call(void 0, ).query(
2985
+ const found = await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
2986
2986
  (event) => {
2987
2987
  if (stopped) return;
2988
2988
  const register = this._registry.events[event.name];
@@ -3002,7 +3002,7 @@ var CorrelateCycle = (_class4 = class {
3002
3002
  }
3003
3003
  if (!resolved) continue;
3004
3004
  try {
3005
- _chunk62LDEIDMcjs.check.call(void 0, "target", resolved);
3005
+ _chunkXG3UD63Ycjs.check.call(void 0, "target", resolved);
3006
3006
  } catch (e2) {
3007
3007
  report_bad_priority(
3008
3008
  this._reported,
@@ -3038,9 +3038,9 @@ var CorrelateCycle = (_class4 = class {
3038
3038
  correlated_at: void 0
3039
3039
  };
3040
3040
  const seen_in_scan = correlated.has(resolved.target);
3041
- const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => ( _chunkZI4NSYCDcjs.DEFAULT_LANE));
3041
+ const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
3042
3042
  const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _157 => _157.priority]);
3043
- const resolved_lane = _nullishCoalesce(lane, () => ( _chunkZI4NSYCDcjs.DEFAULT_LANE));
3043
+ const resolved_lane = _nullishCoalesce(lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
3044
3044
  if (held_priority === priority && held_lane !== resolved_lane)
3045
3045
  report_lane_conflict(
3046
3046
  this._reported,
@@ -3114,7 +3114,7 @@ var CorrelateCycle = (_class4 = class {
3114
3114
  await Promise.all(
3115
3115
  missed.map(async ([stream, entry]) => {
3116
3116
  let row;
3117
- await _chunk62LDEIDMcjs.store.call(void 0, ).query_streams(
3117
+ await _chunkXG3UD63Ycjs.store.call(void 0, ).query_streams(
3118
3118
  (position) => {
3119
3119
  row = position;
3120
3120
  },
@@ -3126,8 +3126,8 @@ var CorrelateCycle = (_class4 = class {
3126
3126
  lane: row.lane
3127
3127
  });
3128
3128
  if (entry.priority > row.priority) return;
3129
- const held_lane = _nullishCoalesce(row.lane, () => ( _chunkZI4NSYCDcjs.DEFAULT_LANE));
3130
- const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkZI4NSYCDcjs.DEFAULT_LANE));
3129
+ const held_lane = _nullishCoalesce(row.lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
3130
+ const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
3131
3131
  if (entry.priority === row.priority && held_lane !== resolved_lane)
3132
3132
  report_lane_conflict(
3133
3133
  this._reported,
@@ -3153,7 +3153,7 @@ var CorrelateCycle = (_class4 = class {
3153
3153
  millis: 0
3154
3154
  });
3155
3155
  } catch (error) {
3156
- _chunk62LDEIDMcjs.log.call(void 0, ).warn(
3156
+ _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
3157
3157
  `Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(_nullishCoalesce(error.cause, () => ( error)))}`
3158
3158
  );
3159
3159
  }
@@ -3172,13 +3172,13 @@ function pii_split(emitted, fields) {
3172
3172
  }
3173
3173
  return { name: emitted.name, data, pii };
3174
3174
  }
3175
- _chunkZI4NSYCDcjs.__name.call(void 0, pii_split, "pii_split");
3175
+ _chunk4GA3CHQWcjs.__name.call(void 0, pii_split, "pii_split");
3176
3176
  function pii_gate(event, fields, predicate, actor) {
3177
3177
  const data = event.data;
3178
3178
  const { pii, ...rest } = event;
3179
3179
  if (pii == null) {
3180
3180
  const shredded = { ...data };
3181
- for (const f of fields) shredded[f] = _chunkZI4NSYCDcjs.SHREDDED;
3181
+ for (const f of fields) shredded[f] = _chunk4GA3CHQWcjs.SHREDDED;
3182
3182
  return { ...rest, data: shredded };
3183
3183
  }
3184
3184
  const allowed = !!actor && !!predicate && predicate(event, actor);
@@ -3189,15 +3189,15 @@ function pii_gate(event, fields, predicate, actor) {
3189
3189
  };
3190
3190
  }
3191
3191
  const redacted = { ...data };
3192
- for (const f of fields) redacted[f] = _chunkZI4NSYCDcjs.REDACTED;
3192
+ for (const f of fields) redacted[f] = _chunk4GA3CHQWcjs.REDACTED;
3193
3193
  return { ...rest, data: redacted };
3194
3194
  }
3195
- _chunkZI4NSYCDcjs.__name.call(void 0, pii_gate, "pii_gate");
3196
- var IDENTITY_GATE = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
3195
+ _chunk4GA3CHQWcjs.__name.call(void 0, pii_gate, "pii_gate");
3196
+ var IDENTITY_GATE = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
3197
3197
  function make_gate(fields, predicate) {
3198
3198
  return (event, actor) => pii_gate(event, fields, predicate, actor);
3199
3199
  }
3200
- _chunkZI4NSYCDcjs.__name.call(void 0, make_gate, "make_gate");
3200
+ _chunk4GA3CHQWcjs.__name.call(void 0, make_gate, "make_gate");
3201
3201
  function pii_strip(event, fields) {
3202
3202
  const data = event.data;
3203
3203
  const stripped = {};
@@ -3210,22 +3210,22 @@ function pii_strip(event, fields) {
3210
3210
  data: stripped
3211
3211
  };
3212
3212
  }
3213
- _chunkZI4NSYCDcjs.__name.call(void 0, pii_strip, "pii_strip");
3213
+ _chunk4GA3CHQWcjs.__name.call(void 0, pii_strip, "pii_strip");
3214
3214
 
3215
3215
  // src/internal/projection-fold.ts
3216
3216
  var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
3217
3217
  function make_fold_handler(me, flush, config2, sensitive_fields) {
3218
3218
  const load_me = {
3219
3219
  ...me,
3220
- view: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (raw, actor) => {
3220
+ view: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (raw, actor) => {
3221
3221
  const viewed = me.view(raw, actor);
3222
3222
  const fields = sensitive_fields(viewed.name);
3223
3223
  return fields.length ? pii_strip(viewed, fields) : viewed;
3224
3224
  }, "view")
3225
3225
  };
3226
3226
  const cache2 = /* @__PURE__ */ new Map();
3227
- const row = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
3228
- const flush_dirty = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async () => {
3227
+ const row = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
3228
+ const flush_dirty = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
3229
3229
  const rows = [];
3230
3230
  const flushed = [];
3231
3231
  for (const f of cache2.values())
@@ -3237,7 +3237,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3237
3237
  await flush(rows);
3238
3238
  for (const f of flushed) f.dirty = false;
3239
3239
  }, "flush_dirty");
3240
- const first_sight = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (stream) => {
3240
+ const first_sight = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (stream) => {
3241
3241
  if (cache2.size >= config2.maxCachedStates) {
3242
3242
  const oldest = cache2.keys().next().value;
3243
3243
  const evictee = cache2.get(oldest);
@@ -3257,7 +3257,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3257
3257
  cache2.set(stream, seated);
3258
3258
  return seated;
3259
3259
  }, "first_sight");
3260
- const handler = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (events) => {
3260
+ const handler = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (events) => {
3261
3261
  let folded_since_flush = 0;
3262
3262
  for (const event of events) {
3263
3263
  const stream = event.stream;
@@ -3295,15 +3295,15 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3295
3295
  }
3296
3296
  await flush_dirty();
3297
3297
  }, "handler");
3298
- Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => cache2.clear(), "value") });
3298
+ Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => cache2.clear(), "value") });
3299
3299
  return handler;
3300
3300
  }
3301
- _chunkZI4NSYCDcjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
3301
+ _chunk4GA3CHQWcjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
3302
3302
 
3303
3303
  // src/internal/settle.ts
3304
3304
  var SettleLoop = (_class5 = class {
3305
3305
  static {
3306
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "SettleLoop");
3306
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "SettleLoop");
3307
3307
  }
3308
3308
  __init20() {this._timer = void 0}
3309
3309
  // The cycle in flight, set while one runs. Shutdown waits for it
@@ -3406,7 +3406,7 @@ var SettleLoop = (_class5 = class {
3406
3406
  // src/act.ts
3407
3407
  var Act = (_class6 = class {
3408
3408
  static {
3409
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "Act");
3409
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "Act");
3410
3410
  }
3411
3411
  __init25() {this._emitter = new (0, _events2.default)()}
3412
3412
 
@@ -3494,7 +3494,7 @@ var Act = (_class6 = class {
3494
3494
  // Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
3495
3495
 
3496
3496
 
3497
- __init26() {this._logger = _chunk62LDEIDMcjs.log.call(void 0, )}
3497
+ __init26() {this._logger = _chunkXG3UD63Ycjs.log.call(void 0, )}
3498
3498
  // This Act's ports: its own bag, or the singleton adapters.
3499
3499
 
3500
3500
  // Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
@@ -3523,11 +3523,11 @@ var Act = (_class6 = class {
3523
3523
  throw new Error(
3524
3524
  `ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
3525
3525
  );
3526
- _chunk62LDEIDMcjs.check.call(void 0, "act", options);
3527
- if (options.scoped) _chunk62LDEIDMcjs.check.call(void 0, "store", options.scoped.store);
3528
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunk62LDEIDMcjs.unscoped_ports.call(void 0, )));
3526
+ _chunkXG3UD63Ycjs.check.call(void 0, "act", options);
3527
+ if (options.scoped) _chunkXG3UD63Ycjs.check.call(void 0, "store", options.scoped.store);
3528
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkXG3UD63Ycjs.unscoped_ports.call(void 0, )));
3529
3529
  const ports = this._ports;
3530
- this._scoped = _chunk62LDEIDMcjs.make_run_scoped.call(void 0, {
3530
+ this._scoped = _chunkXG3UD63Ycjs.make_run_scoped.call(void 0, {
3531
3531
  // Getters, not a spread: the singletons resolve lazily, so a later
3532
3532
  // `store(...)` / `cache(...)` still takes effect.
3533
3533
  get store() {
@@ -3537,14 +3537,14 @@ var Act = (_class6 = class {
3537
3537
  return ports.cache;
3538
3538
  },
3539
3539
  // Parsed per build, so a bad window throws on every build.
3540
- autoclose_window: _chunk62LDEIDMcjs.check.call(void 0, "autoclose", options).autocloseWindow
3540
+ autoclose_window: _chunkXG3UD63Ycjs.check.call(void 0, "autoclose", options).autocloseWindow
3541
3541
  });
3542
3542
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3543
3543
  this._es = build_es(this._logger, this._correlator, patch_fn);
3544
3544
  this._cd = build_drain(this._logger);
3545
3545
  const handle = build_handle({
3546
3546
  logger: this._logger,
3547
- reaction_scope: _chunk62LDEIDMcjs.make_reaction_scope.call(void 0, {
3547
+ reaction_scope: _chunkXG3UD63Ycjs.make_reaction_scope.call(void 0, {
3548
3548
  do: this.do.bind(this),
3549
3549
  load: this.load.bind(this),
3550
3550
  query: this.query.bind(this),
@@ -3574,17 +3574,17 @@ var Act = (_class6 = class {
3574
3574
  this._ports.store,
3575
3575
  options.listen !== false
3576
3576
  );
3577
- _chunk62LDEIDMcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3577
+ _chunkXG3UD63Ycjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3578
3578
  }
3579
3579
  // Shared by drain, settle and autoclose; bad knobs throw at build.
3580
3580
  _build_breaker(options) {
3581
3581
  return new CircuitBreaker(
3582
- _chunk62LDEIDMcjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
3582
+ _chunkXG3UD63Ycjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
3583
3583
  {
3584
- on_error: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
3584
+ on_error: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
3585
3585
  // When the cooldown elapses, settle once: its scan or claim is the
3586
3586
  // half-open probe that closes or re-opens the breaker.
3587
- on_retry: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => this._schedule(), "on_retry")
3587
+ on_retry: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => this._schedule(), "on_retry")
3588
3588
  }
3589
3589
  );
3590
3590
  }
@@ -3604,16 +3604,16 @@ var Act = (_class6 = class {
3604
3604
  batch_handlers: this._batch_handlers,
3605
3605
  handle,
3606
3606
  handle_batch,
3607
- on_acked: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
3608
- on_blocked: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
3607
+ on_acked: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
3608
+ on_blocked: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
3609
3609
  // Reaction-requested close: the same machinery as `app.close`.
3610
3610
  // A store failure reaches the breaker; anything else (the archive
3611
3611
  // callback is app code) is logged here, never counted.
3612
- on_close: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (targets) => {
3612
+ on_close: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (targets) => {
3613
3613
  try {
3614
3614
  await this._run_close(targets);
3615
3615
  } catch (error) {
3616
- if (error instanceof _chunkZI4NSYCDcjs.StoreError) throw error;
3616
+ if (error instanceof _chunk4GA3CHQWcjs.StoreError) throw error;
3617
3617
  this._logger.error(
3618
3618
  error,
3619
3619
  `Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed; the policy retries it (a full close the next day, a prune on the stream's next commit), or close it now with app.close(...) once the cause is fixed.`
@@ -3647,7 +3647,7 @@ var Act = (_class6 = class {
3647
3647
  // Audit deps, built after the controllers so the lane set is final.
3648
3648
  _build_audit_deps() {
3649
3649
  return {
3650
- store: _chunk62LDEIDMcjs.store,
3650
+ store: _chunkXG3UD63Ycjs.store,
3651
3651
  event_to_state: this._event_to_state,
3652
3652
  sensitive_fields: this.registry.sensitive_fields,
3653
3653
  // Declared lanes, not this process's controllers: a lane another
@@ -3661,14 +3661,14 @@ var Act = (_class6 = class {
3661
3661
  registry: this.registry,
3662
3662
  static_targets: classification.static_targets,
3663
3663
  cd: this._cd,
3664
- max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkZI4NSYCDcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3664
+ max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk4GA3CHQWcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3665
3665
  // Declared lanes (not active ones): a lane another process claims is
3666
3666
  // still a valid destination.
3667
3667
  declared_lanes: new Set(this._declared_lanes),
3668
3668
  // Built after the controllers, so their keys are the active lanes.
3669
3669
  shard: this._drain_controllers.size < this._declared_lanes.length ? [...this._drain_controllers.keys()] : void 0,
3670
3670
  // Only reached on a draining app: writer-only ones never correlate.
3671
- on_init: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async () => {
3671
+ on_init: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
3672
3672
  this._arm_all();
3673
3673
  await this._seed_persisted_defers();
3674
3674
  }, "on_init")
@@ -3677,7 +3677,7 @@ var Act = (_class6 = class {
3677
3677
  // Cold start: an idle deferred stream still fires on time after a restart.
3678
3678
  async _seed_persisted_defers() {
3679
3679
  const now = Date.now();
3680
- await walk_streams(_chunk62LDEIDMcjs.store.call(void 0, ), (pos) => {
3680
+ await walk_streams(_chunkXG3UD63Ycjs.store.call(void 0, ), (pos) => {
3681
3681
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3682
3682
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3683
3683
  _optionalChain([controller, 'optionalAccess', _165 => _165.seed_defer, 'call', _166 => _166(pos.stream, pos.deferred_at)]);
@@ -3686,14 +3686,14 @@ var Act = (_class6 = class {
3686
3686
  _build_settle(options) {
3687
3687
  return new SettleLoop(
3688
3688
  {
3689
- correlate: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
3689
+ correlate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
3690
3690
  // `settle()` validated the options, and `_schedule` skips writer-only
3691
3691
  // instances, so the loop drains through the internal path.
3692
- drain: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
3693
- on_settled: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
3692
+ drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
3693
+ on_settled: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
3694
3694
  breaker: this._breaker
3695
3695
  },
3696
- _nullishCoalesce(options.settleDebounceMs, () => ( _chunkZI4NSYCDcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3696
+ _nullishCoalesce(options.settleDebounceMs, () => ( _chunk4GA3CHQWcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3697
3697
  );
3698
3698
  }
3699
3699
 
@@ -3713,7 +3713,7 @@ var Act = (_class6 = class {
3713
3713
  */
3714
3714
  shutdown(options) {
3715
3715
  if (!this._shutdown_promise) {
3716
- _chunk62LDEIDMcjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
3716
+ _chunkXG3UD63Ycjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
3717
3717
  this._shutdown_promise = (async () => {
3718
3718
  this.stop_correlations();
3719
3719
  this._settle.stop(true);
@@ -3731,10 +3731,10 @@ var Act = (_class6 = class {
3731
3731
  // The largest `leaseMillis` among lanes with a cycle in flight (the
3732
3732
  // default for none or 0, and for a running settle), capped.
3733
3733
  _derive_grace_ms(running, settling) {
3734
- let max = settling ? _chunk62LDEIDMcjs.DEFAULT_LEASE_MILLIS : 0;
3734
+ let max = settling ? _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS : 0;
3735
3735
  for (const c of running)
3736
- max = Math.max(max, c.lease_millis || _chunk62LDEIDMcjs.DEFAULT_LEASE_MILLIS);
3737
- return Math.min(max, _chunk62LDEIDMcjs.MAX_SHUTDOWN_GRACE_MS);
3736
+ max = Math.max(max, c.lease_millis || _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS);
3737
+ return Math.min(max, _chunkXG3UD63Ycjs.MAX_SHUTDOWN_GRACE_MS);
3738
3738
  }
3739
3739
  async _await_inflight(grace_ms) {
3740
3740
  const running = [...this._drain_controllers.values()].filter(
@@ -3818,7 +3818,7 @@ var Act = (_class6 = class {
3818
3818
  * @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
3819
3819
  */
3820
3820
  async do(action2, target, payload, options) {
3821
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => ( _chunk62LDEIDMcjs.current_reacting.call(void 0, )));
3821
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => ( _chunkXG3UD63Ycjs.current_reacting.call(void 0, )));
3822
3822
  const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _169 => _169.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3823
3823
  return this._scoped(async () => {
3824
3824
  const snapshots = await this._es.action(
@@ -3861,7 +3861,7 @@ var Act = (_class6 = class {
3861
3861
  actor: void 0,
3862
3862
  asOf
3863
3863
  } : streamOrTarget;
3864
- _chunk62LDEIDMcjs.check.call(void 0, "page", _nullishCoalesce(target.asOf, () => ( {})));
3864
+ _chunkXG3UD63Ycjs.check.call(void 0, "page", _nullishCoalesce(target.asOf, () => ( {})));
3865
3865
  return await this._es.load(merged, target, callback);
3866
3866
  });
3867
3867
  }
@@ -3890,11 +3890,11 @@ var Act = (_class6 = class {
3890
3890
  * @see {@link query_array} for loading events into memory
3891
3891
  */
3892
3892
  async query(query, callback) {
3893
- _chunk62LDEIDMcjs.check.call(void 0, "page", query);
3893
+ _chunkXG3UD63Ycjs.check.call(void 0, "page", query);
3894
3894
  return this._scoped(async () => {
3895
3895
  let first;
3896
3896
  let last;
3897
- const count = await _chunk62LDEIDMcjs.store.call(void 0, ).query((e) => {
3897
+ const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).query((e) => {
3898
3898
  const gated = this.registry.query_gate(e.name)(e);
3899
3899
  if (!first) first = gated;
3900
3900
  last = gated;
@@ -3940,14 +3940,14 @@ var Act = (_class6 = class {
3940
3940
  */
3941
3941
  async forget(stream) {
3942
3942
  return this._scoped(async () => {
3943
- const s = _chunk62LDEIDMcjs.store.call(void 0, );
3943
+ const s = _chunkXG3UD63Ycjs.store.call(void 0, );
3944
3944
  if (!s.forget_pii) {
3945
3945
  throw new Error(
3946
3946
  `Store does not implement forget_pii \u2014 adapter cannot comply with sensitive-data erasure. Use an adapter that declares pii_isolation: true (e.g. @rotorsoft/act on the in-memory store).`
3947
3947
  );
3948
3948
  }
3949
3949
  const eventCount = await s.forget_pii(stream);
3950
- await _chunk62LDEIDMcjs.cache.call(void 0, ).invalidate(stream);
3950
+ await _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream);
3951
3951
  if (eventCount > 0) {
3952
3952
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3953
3953
  }
@@ -3981,7 +3981,7 @@ var Act = (_class6 = class {
3981
3981
  * @see {@link correlate} for dynamic stream discovery
3982
3982
  */
3983
3983
  async drain(options = {}) {
3984
- _chunk62LDEIDMcjs.check.call(void 0, "drain", options);
3984
+ _chunkXG3UD63Ycjs.check.call(void 0, "drain", options);
3985
3985
  if (!this._drain)
3986
3986
  return { fetched: [], leased: [], acked: [], blocked: [] };
3987
3987
  return this._scoped(() => this._drain_all(options));
@@ -4058,7 +4058,7 @@ var Act = (_class6 = class {
4058
4058
  * @see {@link start_correlations} for automatic periodic correlation
4059
4059
  */
4060
4060
  async correlate(query = {}) {
4061
- _chunk62LDEIDMcjs.check.call(void 0, "page", query);
4061
+ _chunkXG3UD63Ycjs.check.call(void 0, "page", query);
4062
4062
  const pass = await this._correlate_pass(_nullishCoalesce(query.limit, () => ( 10)));
4063
4063
  return {
4064
4064
  subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
@@ -4104,8 +4104,8 @@ var Act = (_class6 = class {
4104
4104
  * @see {@link stop_correlations} to stop the poll
4105
4105
  */
4106
4106
  start_correlations(query = {}, frequency = 1e4) {
4107
- _chunk62LDEIDMcjs.check.call(void 0, "page", query);
4108
- _chunk62LDEIDMcjs.check.call(void 0, "poll", { frequency });
4107
+ _chunkXG3UD63Ycjs.check.call(void 0, "page", query);
4108
+ _chunkXG3UD63Ycjs.check.call(void 0, "poll", { frequency });
4109
4109
  if (this._poll) return false;
4110
4110
  this._poll_limit = query.limit || void 0;
4111
4111
  this._poll = setInterval(() => {
@@ -4171,7 +4171,7 @@ var Act = (_class6 = class {
4171
4171
  */
4172
4172
  async reset(input) {
4173
4173
  return this._scoped(async () => {
4174
- const count = await _chunk62LDEIDMcjs.store.call(void 0, ).reset(input);
4174
+ const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).reset(input);
4175
4175
  this._reset_folds();
4176
4176
  if (count > 0) {
4177
4177
  this._wake();
@@ -4206,7 +4206,7 @@ var Act = (_class6 = class {
4206
4206
  */
4207
4207
  async unblock(input) {
4208
4208
  return this._scoped(async () => {
4209
- const count = await _chunk62LDEIDMcjs.store.call(void 0, ).unblock(input);
4209
+ const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).unblock(input);
4210
4210
  if (count > 0) {
4211
4211
  this._wake();
4212
4212
  }
@@ -4221,8 +4221,9 @@ var Act = (_class6 = class {
4221
4221
  * lifecycle and per-event insert.
4222
4222
  *
4223
4223
  * Safe in a live process: restoring into this Act's own store waits
4224
- * for its correlate passes in flight, replaces the log, then restarts
4225
- * correlation and settles. A correlate pass that starts meanwhile
4224
+ * for its correlate passes in flight, replaces the log, clears the cache
4225
+ * and the state projections' fold caches, then restarts correlation and
4226
+ * settles. A correlate pass that starts meanwhile
4226
4227
  * reads nothing. Other processes on the same store keep their
4227
4228
  * correlation state and must be restarted.
4228
4229
  *
@@ -4248,13 +4249,12 @@ var Act = (_class6 = class {
4248
4249
  * ```typescript
4249
4250
  * const result = await app.restore(new CsvFile({ path: "./backup.csv" }));
4250
4251
  * console.log(`Restored ${result.kept} events in ${result.duration_ms}ms`);
4251
- * await cache().clear(); // operator's responsibility
4252
4252
  * ```
4253
4253
  *
4254
4254
  * @see {@link Store.restore} for the underlying driver-pattern primitive.
4255
4255
  */
4256
4256
  async restore(source, opts = {}, sink) {
4257
- _chunk62LDEIDMcjs.check.call(void 0, "scan", opts);
4257
+ _chunkXG3UD63Ycjs.check.call(void 0, "scan", opts);
4258
4258
  return this._scoped(async () => {
4259
4259
  const started = Date.now();
4260
4260
  if (opts.dry_run) {
@@ -4262,14 +4262,14 @@ var Act = (_class6 = class {
4262
4262
  return { ...partial, duration_ms: Date.now() - started };
4263
4263
  }
4264
4264
  const target = _nullishCoalesce(sink, () => ( (() => {
4265
- const s = _chunk62LDEIDMcjs.store.call(void 0, );
4265
+ const s = _chunkXG3UD63Ycjs.store.call(void 0, );
4266
4266
  if (!s.restore) throw new Error("adapter has no restore capability");
4267
4267
  return s;
4268
4268
  })()));
4269
4269
  let kept = 0;
4270
4270
  let migrated = 0;
4271
4271
  let dropped = { closed_streams: 0, snapshots: 0 };
4272
- const run = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => target.restore(async (callback) => {
4272
+ const run = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => target.restore(async (callback) => {
4273
4273
  const partial = await scan(source, opts, callback);
4274
4274
  kept = partial.kept;
4275
4275
  migrated = partial.migrated;
@@ -4278,6 +4278,7 @@ var Act = (_class6 = class {
4278
4278
  if (sink) await run();
4279
4279
  else {
4280
4280
  await this._correlate.restart(run);
4281
+ await _chunkXG3UD63Ycjs.cache.call(void 0, ).clear();
4281
4282
  this._reset_folds();
4282
4283
  this._wake();
4283
4284
  }
@@ -4307,10 +4308,10 @@ var Act = (_class6 = class {
4307
4308
  * ```
4308
4309
  */
4309
4310
  async blocked_streams(options) {
4310
- _chunk62LDEIDMcjs.check.call(void 0, "page", { limit: _optionalChain([options, 'optionalAccess', _178 => _178.limit]) });
4311
+ _chunkXG3UD63Ycjs.check.call(void 0, "page", { limit: _optionalChain([options, 'optionalAccess', _178 => _178.limit]) });
4311
4312
  return this._scoped(async () => {
4312
4313
  const positions = [];
4313
- await _chunk62LDEIDMcjs.store.call(void 0, ).query_streams(
4314
+ await _chunkXG3UD63Ycjs.store.call(void 0, ).query_streams(
4314
4315
  (p) => {
4315
4316
  positions.push(p);
4316
4317
  },
@@ -4336,7 +4337,7 @@ var Act = (_class6 = class {
4336
4337
  * ```
4337
4338
  */
4338
4339
  async *audit(categories, options) {
4339
- _chunk62LDEIDMcjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
4340
+ _chunkXG3UD63Ycjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
4340
4341
  const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
4341
4342
  while (true) {
4342
4343
  const { value, done } = await this._scoped(() => it.next());
@@ -4364,15 +4365,15 @@ var Act = (_class6 = class {
4364
4365
  * @see {@link Store.prioritize} for the underlying primitive
4365
4366
  */
4366
4367
  async prioritize(filter, priority) {
4367
- _chunk62LDEIDMcjs.check.call(void 0, "target", { priority });
4368
- return this._scoped(() => _chunk62LDEIDMcjs.store.call(void 0, ).prioritize(filter, priority));
4368
+ _chunkXG3UD63Ycjs.check.call(void 0, "target", { priority });
4369
+ return this._scoped(() => _chunkXG3UD63Ycjs.store.call(void 0, ).prioritize(filter, priority));
4369
4370
  }
4370
4371
  // Shared by `close()` and reaction-requested closes.
4371
4372
  async _run_close(targets) {
4372
4373
  const close_actor = { id: "$close", name: "close" };
4373
4374
  const result = await run_close_cycle(targets, {
4374
4375
  reactive: this._reactive,
4375
- catch_up_correlation: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (until) => catch_up_correlation(
4376
+ catch_up_correlation: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (until) => catch_up_correlation(
4376
4377
  this._correlate,
4377
4378
  (limit) => this.correlate({ limit }),
4378
4379
  until
@@ -4382,8 +4383,8 @@ var Act = (_class6 = class {
4382
4383
  tombstone: this._es.tombstone,
4383
4384
  logger: this._logger,
4384
4385
  correlation: close_correlation(this._correlator, close_actor),
4385
- with_stream_lock: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
4386
- forget_subscribed: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
4386
+ with_stream_lock: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
4387
+ forget_subscribed: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
4387
4388
  });
4388
4389
  this.emit("closed", result);
4389
4390
  return result;
@@ -4445,7 +4446,7 @@ var Act = (_class6 = class {
4445
4446
  * @see {@link correlate} for manual correlation
4446
4447
  */
4447
4448
  settle(options) {
4448
- _chunk62LDEIDMcjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
4449
+ _chunkXG3UD63Ycjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
4449
4450
  this._schedule(options);
4450
4451
  }
4451
4452
  }, _class6);
@@ -4458,7 +4459,7 @@ function base_type_name(schema) {
4458
4459
  def = def_of(inner);
4459
4460
  return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
4460
4461
  }
4461
- _chunkZI4NSYCDcjs.__name.call(void 0, base_type_name, "base_type_name");
4462
+ _chunk4GA3CHQWcjs.__name.call(void 0, base_type_name, "base_type_name");
4462
4463
  function merge_schemas(existing, incoming, state_name) {
4463
4464
  if (existing === incoming) return existing;
4464
4465
  const existing_object = as_object(existing, "existing", state_name);
@@ -4478,18 +4479,18 @@ function merge_schemas(existing, incoming, state_name) {
4478
4479
  }
4479
4480
  return existing_object.extend(incoming_shape);
4480
4481
  }
4481
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_schemas, "merge_schemas");
4482
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_schemas, "merge_schemas");
4482
4483
  function as_object(schema, side, state_name) {
4483
4484
  if (schema instanceof _zod2.ZodObject) return schema;
4484
4485
  throw new Error(
4485
4486
  `Cannot merge state schemas for "${state_name}": the ${side} partial's schema is a ${schema.constructor.name}, not a z.object. Partials of the same state are merged by extending their shapes, so declare every partial's state as a plain z.object({ ... }).`
4486
4487
  );
4487
4488
  }
4488
- _chunkZI4NSYCDcjs.__name.call(void 0, as_object, "as_object");
4489
+ _chunk4GA3CHQWcjs.__name.call(void 0, as_object, "as_object");
4489
4490
  function merge_inits(existing, incoming) {
4490
4491
  return () => ({ ...existing(), ...incoming() });
4491
4492
  }
4492
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_inits, "merge_inits");
4493
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_inits, "merge_inits");
4493
4494
  function register_state(state2, states, actions, events) {
4494
4495
  const existing = states.get(state2.name);
4495
4496
  if (existing) {
@@ -4498,8 +4499,8 @@ function register_state(state2, states, actions, events) {
4498
4499
  register_new_state(state2, states, actions, events);
4499
4500
  }
4500
4501
  }
4501
- _chunkZI4NSYCDcjs.__name.call(void 0, register_state, "register_state");
4502
- var shared_name = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (name) => new Error(
4502
+ _chunk4GA3CHQWcjs.__name.call(void 0, register_state, "register_state");
4503
+ var shared_name = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (name) => new Error(
4503
4504
  `Action and event share the name "${name}" \u2014 action and event names must be unique across the application. Rename one of them.`
4504
4505
  ), "shared_name");
4505
4506
  function register_new_state(state2, states, actions, events) {
@@ -4515,13 +4516,13 @@ function register_new_state(state2, states, actions, events) {
4515
4516
  events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
4516
4517
  }
4517
4518
  }
4518
- _chunkZI4NSYCDcjs.__name.call(void 0, register_new_state, "register_new_state");
4519
+ _chunk4GA3CHQWcjs.__name.call(void 0, register_new_state, "register_new_state");
4519
4520
  function pick_declared(existing, incoming, what, state_name) {
4520
4521
  if (existing && incoming && existing !== incoming)
4521
4522
  throw new Error(`Duplicate ${what} for state "${state_name}"`);
4522
4523
  return _nullishCoalesce(incoming, () => ( existing));
4523
4524
  }
4524
- _chunkZI4NSYCDcjs.__name.call(void 0, pick_declared, "pick_declared");
4525
+ _chunk4GA3CHQWcjs.__name.call(void 0, pick_declared, "pick_declared");
4525
4526
  function autoclose_of(existing, state2) {
4526
4527
  pick_declared(
4527
4528
  existing.autoclose,
@@ -4537,7 +4538,7 @@ function autoclose_of(existing, state2) {
4537
4538
  autoclose_keep_days: owner.autoclose_keep_days
4538
4539
  };
4539
4540
  }
4540
- _chunkZI4NSYCDcjs.__name.call(void 0, autoclose_of, "autoclose_of");
4541
+ _chunk4GA3CHQWcjs.__name.call(void 0, autoclose_of, "autoclose_of");
4541
4542
  function merge_into_existing(state2, existing, states, actions, events) {
4542
4543
  for (const name of Object.keys(state2.actions)) {
4543
4544
  if (existing.on[name] === state2.on[name]) continue;
@@ -4595,7 +4596,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
4595
4596
  events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
4596
4597
  }
4597
4598
  }
4598
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
4599
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
4599
4600
  function merge_patches(existing, incoming, state_name) {
4600
4601
  const merged = { ...existing };
4601
4602
  for (const name of Object.keys(incoming)) {
@@ -4618,7 +4619,7 @@ function merge_patches(existing, incoming, state_name) {
4618
4619
  }
4619
4620
  return merged;
4620
4621
  }
4621
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_patches, "merge_patches");
4622
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_patches, "merge_patches");
4622
4623
  function merge_event_register(target, source) {
4623
4624
  for (const [event_name, source_reg] of Object.entries(source)) {
4624
4625
  const target_reg = target[event_name];
@@ -4633,7 +4634,7 @@ function merge_event_register(target, source) {
4633
4634
  }
4634
4635
  }
4635
4636
  }
4636
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_event_register, "merge_event_register");
4637
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_event_register, "merge_event_register");
4637
4638
  function merge_projection(proj, events) {
4638
4639
  for (const event_name of Object.keys(proj.events)) {
4639
4640
  const proj_register = proj.events[event_name];
@@ -4653,17 +4654,17 @@ function merge_projection(proj, events) {
4653
4654
  }
4654
4655
  }
4655
4656
  }
4656
- _chunkZI4NSYCDcjs.__name.call(void 0, merge_projection, "merge_projection");
4657
- var _this_ = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, ({ stream }) => ({
4657
+ _chunk4GA3CHQWcjs.__name.call(void 0, merge_projection, "merge_projection");
4658
+ var _this_ = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ stream }) => ({
4658
4659
  source: stream,
4659
4660
  target: stream
4660
4661
  }), "_this_");
4661
4662
 
4662
4663
  // src/builders/builder-utils.ts
4663
4664
  function register_lane(config2, lanes) {
4664
- _chunk62LDEIDMcjs.check.call(void 0, "lane", config2);
4665
- if (config2.name === _chunkZI4NSYCDcjs.DEFAULT_LANE)
4666
- throw new Error(`Lane "${_chunkZI4NSYCDcjs.DEFAULT_LANE}" is reserved`);
4665
+ _chunkXG3UD63Ycjs.check.call(void 0, "lane", config2);
4666
+ if (config2.name === _chunk4GA3CHQWcjs.DEFAULT_LANE)
4667
+ throw new Error(`Lane "${_chunk4GA3CHQWcjs.DEFAULT_LANE}" is reserved`);
4667
4668
  const existing = lanes.find((l) => l.name === config2.name);
4668
4669
  if (!existing) return void lanes.push(config2);
4669
4670
  if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
@@ -4671,7 +4672,7 @@ function register_lane(config2, lanes) {
4671
4672
  `Lane "${config2.name}" was already declared with a different config`
4672
4673
  );
4673
4674
  }
4674
- _chunkZI4NSYCDcjs.__name.call(void 0, register_lane, "register_lane");
4675
+ _chunk4GA3CHQWcjs.__name.call(void 0, register_lane, "register_lane");
4675
4676
  function add_reaction(events, event, name, kind, make, builder) {
4676
4677
  if (!name)
4677
4678
  throw new Error(
@@ -4686,31 +4687,31 @@ function add_reaction(events, event, name, kind, make, builder) {
4686
4687
  events[event].reactions.set(name, reaction);
4687
4688
  return Object.assign(builder, {
4688
4689
  to(resolver) {
4689
- if (typeof resolver === "object") _chunk62LDEIDMcjs.check.call(void 0, "target", resolver);
4690
+ if (typeof resolver === "object") _chunkXG3UD63Ycjs.check.call(void 0, "target", resolver);
4690
4691
  reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
4691
4692
  return builder;
4692
4693
  }
4693
4694
  });
4694
4695
  }
4695
- _chunkZI4NSYCDcjs.__name.call(void 0, add_reaction, "add_reaction");
4696
+ _chunk4GA3CHQWcjs.__name.call(void 0, add_reaction, "add_reaction");
4696
4697
  function reaction_on(event, events, builder) {
4697
- const register = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
4698
+ const register = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
4698
4699
  events,
4699
4700
  event,
4700
4701
  handler.name,
4701
4702
  "Reaction",
4702
4703
  () => {
4703
4704
  if (schedule && typeof schedule !== "function")
4704
- _chunk62LDEIDMcjs.check.call(void 0, "defer", schedule);
4705
+ _chunkXG3UD63Ycjs.check.call(void 0, "defer", schedule);
4705
4706
  return {
4706
4707
  handler: schedule ? make_deferred(handler, schedule) : handler,
4707
4708
  resolver: _this_,
4708
4709
  // Validate the whole bag at the declaration site so a bad
4709
4710
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4710
4711
  // not a NaN gate on the first retry.
4711
- options: _chunk62LDEIDMcjs.check.call(void 0, "reaction", {
4712
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => ( _chunk62LDEIDMcjs.DEFAULT_BLOCK_ON_ERROR)),
4713
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => ( _chunk62LDEIDMcjs.DEFAULT_MAX_RETRIES)),
4712
+ options: _chunkXG3UD63Ycjs.check.call(void 0, "reaction", {
4713
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => ( _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR)),
4714
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => ( _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES)),
4714
4715
  backoff: _optionalChain([options, 'optionalAccess', _183 => _183.backoff])
4715
4716
  })
4716
4717
  };
@@ -4718,20 +4719,20 @@ function reaction_on(event, events, builder) {
4718
4719
  builder
4719
4720
  ), "register");
4720
4721
  return {
4721
- do: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
4722
- defer: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (schedule) => ({
4723
- do: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
4722
+ do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
4723
+ defer: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schedule) => ({
4724
+ do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
4724
4725
  }), "defer")
4725
4726
  };
4726
4727
  }
4727
- _chunkZI4NSYCDcjs.__name.call(void 0, reaction_on, "reaction_on");
4728
+ _chunk4GA3CHQWcjs.__name.call(void 0, reaction_on, "reaction_on");
4728
4729
 
4729
4730
  // src/builders/event-builder.ts
4730
4731
 
4731
4732
 
4732
4733
  // src/internal/sensitive.ts
4733
4734
  var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
4734
- var is_pii = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
4735
+ var is_pii = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
4735
4736
  function pii_schemas(schema) {
4736
4737
  const fields = {};
4737
4738
  const shape = schema.shape;
@@ -4747,7 +4748,7 @@ function pii_schemas(schema) {
4747
4748
  fields[key] ??= field;
4748
4749
  return fields;
4749
4750
  }
4750
- _chunkZI4NSYCDcjs.__name.call(void 0, pii_schemas, "pii_schemas");
4751
+ _chunk4GA3CHQWcjs.__name.call(void 0, pii_schemas, "pii_schemas");
4751
4752
 
4752
4753
  // src/builders/event-builder.ts
4753
4754
  function event_tags(schema) {
@@ -4758,7 +4759,7 @@ function event_tags(schema) {
4758
4759
  if (dates) pii_dates[key] = dates.optional();
4759
4760
  }
4760
4761
  const data_reviver_schema = date_reviver_schema(schema);
4761
- const revive = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (schema2) => (data) => {
4762
+ const revive = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema2) => (data) => {
4762
4763
  const revived = schema2.safeParse(data);
4763
4764
  return revived.success ? revived.data : data;
4764
4765
  }, "revive");
@@ -4769,7 +4770,7 @@ function event_tags(schema) {
4769
4770
  pii_date_reviver: dated_pii ? revive(_zod2.z.looseObject(pii_dates)) : void 0
4770
4771
  };
4771
4772
  }
4772
- _chunkZI4NSYCDcjs.__name.call(void 0, event_tags, "event_tags");
4773
+ _chunk4GA3CHQWcjs.__name.call(void 0, event_tags, "event_tags");
4773
4774
  function make_event_reader(tags, disclosure, predicate = null) {
4774
4775
  const { date_reviver, pii_date_reviver } = tags;
4775
4776
  const sensitive2 = Object.keys(tags.sensitive);
@@ -4789,9 +4790,9 @@ function make_event_reader(tags, disclosure, predicate = null) {
4789
4790
  );
4790
4791
  });
4791
4792
  }
4792
- _chunkZI4NSYCDcjs.__name.call(void 0, make_event_reader, "make_event_reader");
4793
+ _chunk4GA3CHQWcjs.__name.call(void 0, make_event_reader, "make_event_reader");
4793
4794
  function build_events(registry, states, lanes, owners) {
4794
- const declared = /* @__PURE__ */ new Set([_chunkZI4NSYCDcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4795
+ const declared = /* @__PURE__ */ new Set([_chunk4GA3CHQWcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4795
4796
  const lane_errors = [];
4796
4797
  const tags = /* @__PURE__ */ new Map();
4797
4798
  const sensitive2 = /* @__PURE__ */ new Map();
@@ -4824,7 +4825,7 @@ function build_events(registry, states, lanes, owners) {
4824
4825
  handler_readers.set(event_name, handler_reader);
4825
4826
  for (const [name, reaction] of def.reactions) {
4826
4827
  const inner = reaction.handler;
4827
- const wrapped2 = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
4828
+ const wrapped2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
4828
4829
  Object.defineProperty(wrapped2, "name", { value: inner.name });
4829
4830
  reaction.handler = wrapped2;
4830
4831
  def.reactions.set(name, reaction);
@@ -4866,7 +4867,7 @@ function build_events(registry, states, lanes, owners) {
4866
4867
  if (reader) readers.set(event_name, reader);
4867
4868
  }
4868
4869
  const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
4869
- if (snap2) readers.set(_chunkZI4NSYCDcjs.SNAP_EVENT, snap2);
4870
+ if (snap2) readers.set(_chunk4GA3CHQWcjs.SNAP_EVENT, snap2);
4870
4871
  if (readers.size === 0) continue;
4871
4872
  state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
4872
4873
  }
@@ -4877,12 +4878,12 @@ function build_events(registry, states, lanes, owners) {
4877
4878
  const advisory = advised.size > 0 ? `Act has ${advised.size} sensitive field(s) whose type isn't a string: ${[...advised].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.` : void 0;
4878
4879
  return { sensitive: sensitive2, advisory, query_readers, handler_readers };
4879
4880
  }
4880
- _chunkZI4NSYCDcjs.__name.call(void 0, build_events, "build_events");
4881
+ _chunk4GA3CHQWcjs.__name.call(void 0, build_events, "build_events");
4881
4882
  function reads_as_string(schema) {
4882
4883
  const type = _optionalChain([def_of, 'call', _184 => _184(output_of(schema)), 'optionalAccess', _185 => _185.type]);
4883
4884
  return type === "string" || type === "transform";
4884
4885
  }
4885
- _chunkZI4NSYCDcjs.__name.call(void 0, reads_as_string, "reads_as_string");
4886
+ _chunk4GA3CHQWcjs.__name.call(void 0, reads_as_string, "reads_as_string");
4886
4887
 
4887
4888
  // src/builders/act-builder.ts
4888
4889
  function register_batch_handler(proj, batch_handlers) {
@@ -4895,7 +4896,7 @@ function register_batch_handler(proj, batch_handlers) {
4895
4896
  }
4896
4897
  batch_handlers.set(proj.target, proj.batchHandler);
4897
4898
  }
4898
- _chunkZI4NSYCDcjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
4899
+ _chunk4GA3CHQWcjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
4899
4900
  function act() {
4900
4901
  const states = /* @__PURE__ */ new Map();
4901
4902
  const _sf = /* @__PURE__ */ new Map();
@@ -4909,16 +4910,16 @@ function act() {
4909
4910
  const registry = {
4910
4911
  actions: {},
4911
4912
  events: {},
4912
- sensitive_fields: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
4913
- query_gate: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
4914
- disclosure_predicate: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
4915
- deprecated_events: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
4916
- autoclose_policy: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
4917
- autoclose_archiver: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
4913
+ sensitive_fields: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
4914
+ query_gate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
4915
+ disclosure_predicate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
4916
+ deprecated_events: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
4917
+ autoclose_policy: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
4918
+ autoclose_archiver: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
4918
4919
  };
4919
4920
  const pending_projections = [];
4920
4921
  const projection_reactions = /* @__PURE__ */ new Set();
4921
- const record_projection_reactions = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (proj) => {
4922
+ const record_projection_reactions = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
4922
4923
  if (!proj.batchHandler && !proj.fold) return;
4923
4924
  for (const register of Object.values(
4924
4925
  proj.events
@@ -4928,7 +4929,7 @@ function act() {
4928
4929
  }, "record_projection_reactions");
4929
4930
  const fold_projections = [];
4930
4931
  const batch_handlers = /* @__PURE__ */ new Map();
4931
- const add_projection = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (proj) => {
4932
+ const add_projection = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
4932
4933
  record_projection_reactions(proj);
4933
4934
  merge_projection(proj, registry.events);
4934
4935
  register_batch_handler(proj, batch_handlers);
@@ -4937,8 +4938,8 @@ function act() {
4937
4938
  const fold_specs = [];
4938
4939
  const lanes = [];
4939
4940
  let _built = false;
4940
- const read_wrap = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (original) => {
4941
- const wrapped2 = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async (events, stream) => {
4941
+ const read_wrap = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (original) => {
4942
+ const wrapped2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (events, stream) => {
4942
4943
  const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _186 => _186.get, 'call', _187 => _187(e.name), 'optionalCall', _188 => _188(e)]), () => ( e)));
4943
4944
  return original(read, stream);
4944
4945
  }, "wrapped");
@@ -4946,7 +4947,7 @@ function act() {
4946
4947
  if (reset) Object.defineProperty(wrapped2, FOLD_RESET, { value: reset });
4947
4948
  return wrapped2;
4948
4949
  }, "read_wrap");
4949
- const make_batch_handlers = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
4950
+ const make_batch_handlers = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
4950
4951
  const handlers = new Map(batch_handlers);
4951
4952
  for (const spec of fold_specs) {
4952
4953
  handlers.set(
@@ -4964,7 +4965,7 @@ function act() {
4964
4965
  }
4965
4966
  return handlers;
4966
4967
  }, "make_batch_handlers");
4967
- const finalize_deprecations = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
4968
+ const finalize_deprecations = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
4968
4969
  const deprecation_summary = [];
4969
4970
  for (const state2 of states.values()) {
4970
4971
  const event_names = Object.keys(state2.events);
@@ -4993,23 +4994,23 @@ function act() {
4993
4994
  const list = deprecation_summary.map(
4994
4995
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4995
4996
  ).join(", ");
4996
- _chunk62LDEIDMcjs.log.call(void 0, ).info(
4997
+ _chunkXG3UD63Ycjs.log.call(void 0, ).info(
4997
4998
  `Act registered ${deprecation_summary.length} deprecated event(s): ${list}. These are legacy versions kept for the read path. Consider truncating closed streams via app.close() when feasible to reduce historical event load. See docs/docs/architecture/event-schema-evolution.md.`
4998
4999
  );
4999
5000
  }
5000
5001
  }, "finalize_deprecations");
5001
- const closed = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (method) => {
5002
+ const closed = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (method) => {
5002
5003
  throw new Error(
5003
5004
  `act().${method}() was called after build(); the registry is already classified. Register everything before build() \u2014 build() itself may be called repeatedly (e.g. once per tenant with ActOptions.scoped).`
5004
5005
  );
5005
5006
  }, "closed");
5006
5007
  const builder = {
5007
- withState: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state2) => {
5008
+ withState: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state2) => {
5008
5009
  if (_built) closed("withState");
5009
5010
  register_state(state2, states, registry.actions, registry.events);
5010
5011
  return builder;
5011
5012
  }, "withState"),
5012
- withSlice: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (input) => {
5013
+ withSlice: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (input) => {
5013
5014
  if (_built) closed("withSlice");
5014
5015
  for (const s of input.states.values()) {
5015
5016
  register_state(s, states, registry.actions, registry.events);
@@ -5019,22 +5020,22 @@ function act() {
5019
5020
  for (const lane of input.lanes) register_lane(lane, lanes);
5020
5021
  return builder;
5021
5022
  }, "withSlice"),
5022
- withProjection: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (proj) => {
5023
+ withProjection: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
5023
5024
  if (_built) closed("withProjection");
5024
5025
  add_projection(proj);
5025
5026
  return builder;
5026
5027
  }, "withProjection"),
5027
- withActor: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => builder, "withActor"),
5028
- withLane: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (config2) => {
5028
+ withActor: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => builder, "withActor"),
5029
+ withLane: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (config2) => {
5029
5030
  if (_built) closed("withLane");
5030
5031
  register_lane(config2, lanes);
5031
5032
  return builder;
5032
5033
  }, "withLane"),
5033
- on: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (event) => {
5034
+ on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => {
5034
5035
  if (_built) closed("on");
5035
5036
  return reaction_on(event, registry.events, builder);
5036
5037
  }, "on"),
5037
- build: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (options) => {
5038
+ build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (options) => {
5038
5039
  if (!_built) {
5039
5040
  for (const proj of pending_projections) add_projection(proj);
5040
5041
  for (const proj of fold_projections) {
@@ -5074,7 +5075,7 @@ function act() {
5074
5075
  for (const [name, gate] of built.query_readers) _qg.set(name, gate);
5075
5076
  for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
5076
5077
  finalize_deprecations();
5077
- if (built.advisory) _chunk62LDEIDMcjs.log.call(void 0, ).warn(built.advisory);
5078
+ if (built.advisory) _chunkXG3UD63Ycjs.log.call(void 0, ).warn(built.advisory);
5078
5079
  for (const [name, state2] of states) {
5079
5080
  if (!state2.loads) continue;
5080
5081
  const resolved = {};
@@ -5118,7 +5119,7 @@ function act() {
5118
5119
  synthesize_autoclose_reactions(
5119
5120
  registry,
5120
5121
  states,
5121
- _chunk62LDEIDMcjs.current_autoclose_window
5122
+ _chunkXG3UD63Ycjs.current_autoclose_window
5122
5123
  );
5123
5124
  Object.freeze(registry.actions);
5124
5125
  Object.freeze(registry.events);
@@ -5137,14 +5138,14 @@ function act() {
5137
5138
  };
5138
5139
  return builder;
5139
5140
  }
5140
- _chunkZI4NSYCDcjs.__name.call(void 0, act, "act");
5141
+ _chunk4GA3CHQWcjs.__name.call(void 0, act, "act");
5141
5142
 
5142
5143
  // src/builders/projection-builder.ts
5143
5144
  function _projection(target) {
5144
5145
  const events = {};
5145
5146
  const default_resolver = typeof target === "string" ? { target } : void 0;
5146
5147
  const base = {
5147
- on: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (entry) => {
5148
+ on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (entry) => {
5148
5149
  const keys = Object.keys(entry);
5149
5150
  if (keys.length !== 1) throw new Error(".on() requires exactly one key");
5150
5151
  const event = keys[0];
@@ -5156,7 +5157,7 @@ function _projection(target) {
5156
5157
  };
5157
5158
  }
5158
5159
  return {
5159
- do: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler) => {
5160
+ do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => {
5160
5161
  const widened = base;
5161
5162
  return add_reaction(
5162
5163
  events,
@@ -5167,8 +5168,8 @@ function _projection(target) {
5167
5168
  handler,
5168
5169
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
5169
5170
  options: {
5170
- blockOnError: _chunk62LDEIDMcjs.DEFAULT_BLOCK_ON_ERROR,
5171
- maxRetries: _chunk62LDEIDMcjs.DEFAULT_MAX_RETRIES
5171
+ blockOnError: _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR,
5172
+ maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES
5172
5173
  }
5173
5174
  }),
5174
5175
  widened
@@ -5176,7 +5177,7 @@ function _projection(target) {
5176
5177
  }, "do")
5177
5178
  };
5178
5179
  }, "on"),
5179
- build: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => ({
5180
+ build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
5180
5181
  _tag: "Projection",
5181
5182
  events,
5182
5183
  ...target !== void 0 && { target }
@@ -5185,20 +5186,20 @@ function _projection(target) {
5185
5186
  };
5186
5187
  if (typeof target === "string") {
5187
5188
  return Object.assign(base, {
5188
- batch: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler) => ({
5189
- build: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => ({
5189
+ batch: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => ({
5190
+ build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
5190
5191
  _tag: "Projection",
5191
5192
  events,
5192
5193
  target,
5193
5194
  batchHandler: handler
5194
5195
  }), "build")
5195
5196
  }), "batch"),
5196
- of: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (...args) => {
5197
+ of: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (...args) => {
5197
5198
  if (Object.keys(events).length > 0)
5198
5199
  throw new Error(
5199
5200
  `Projection "${target}" mixes .of() with .on() handlers \u2014 a projection either folds a state or declares handlers, never both`
5200
5201
  );
5201
- const is_state = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
5202
+ const is_state = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
5202
5203
  const partials = args.filter(is_state);
5203
5204
  const options = _nullishCoalesce(args.find((a) => !is_state(a)), () => ( {}));
5204
5205
  if (partials.length === 0)
@@ -5209,7 +5210,7 @@ function _projection(target) {
5209
5210
  throw new Error(
5210
5211
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
5211
5212
  );
5212
- const config2 = _chunk62LDEIDMcjs.check.call(void 0, "fold", options);
5213
+ const config2 = _chunkXG3UD63Ycjs.check.call(void 0, "fold", options);
5213
5214
  const fold_events = {};
5214
5215
  for (const partial of partials)
5215
5216
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -5227,8 +5228,8 @@ function _projection(target) {
5227
5228
  handler: noop,
5228
5229
  resolver: { target },
5229
5230
  options: {
5230
- blockOnError: _chunk62LDEIDMcjs.DEFAULT_BLOCK_ON_ERROR,
5231
- maxRetries: _chunk62LDEIDMcjs.DEFAULT_MAX_RETRIES
5231
+ blockOnError: _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR,
5232
+ maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES
5232
5233
  }
5233
5234
  }
5234
5235
  ]
@@ -5236,8 +5237,8 @@ function _projection(target) {
5236
5237
  };
5237
5238
  }
5238
5239
  return {
5239
- flush: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (handler) => ({
5240
- build: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => ({
5240
+ flush: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => ({
5241
+ build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
5241
5242
  _tag: "Projection",
5242
5243
  events: fold_events,
5243
5244
  target,
@@ -5250,11 +5251,11 @@ function _projection(target) {
5250
5251
  }
5251
5252
  return base;
5252
5253
  }
5253
- _chunkZI4NSYCDcjs.__name.call(void 0, _projection, "_projection");
5254
+ _chunk4GA3CHQWcjs.__name.call(void 0, _projection, "_projection");
5254
5255
  function projection(target) {
5255
5256
  return _projection(target);
5256
5257
  }
5257
- _chunkZI4NSYCDcjs.__name.call(void 0, projection, "projection");
5258
+ _chunk4GA3CHQWcjs.__name.call(void 0, projection, "projection");
5258
5259
 
5259
5260
  // src/builders/slice-builder.ts
5260
5261
  function slice() {
@@ -5264,20 +5265,20 @@ function slice() {
5264
5265
  const projections = [];
5265
5266
  const lanes = [];
5266
5267
  const builder = {
5267
- withState: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (state2) => {
5268
+ withState: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state2) => {
5268
5269
  register_state(state2, states, actions, events);
5269
5270
  return builder;
5270
5271
  }, "withState"),
5271
- withProjection: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (proj) => {
5272
+ withProjection: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
5272
5273
  projections.push(proj);
5273
5274
  return builder;
5274
5275
  }, "withProjection"),
5275
- withLane: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (config2) => {
5276
+ withLane: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (config2) => {
5276
5277
  register_lane(config2, lanes);
5277
5278
  return builder;
5278
5279
  }, "withLane"),
5279
- on: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
5280
- build: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => ({
5280
+ on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
5281
+ build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
5281
5282
  _tag: "Slice",
5282
5283
  states,
5283
5284
  events,
@@ -5288,7 +5289,7 @@ function slice() {
5288
5289
  };
5289
5290
  return builder;
5290
5291
  }
5291
- _chunkZI4NSYCDcjs.__name.call(void 0, slice, "slice");
5292
+ _chunk4GA3CHQWcjs.__name.call(void 0, slice, "slice");
5292
5293
 
5293
5294
  // src/builders/state-builder.ts
5294
5295
  function state(entry) {
@@ -5320,8 +5321,8 @@ function state(entry) {
5320
5321
  // `act().build()` flips both on states with `sensitive(...)`
5321
5322
  // events to bake in the gate / split and gate the cache write.
5322
5323
  pii_aware: false,
5323
- view: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (event) => event, "view"),
5324
- message: /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (validated) => validated, "message")
5324
+ view: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => event, "view"),
5325
+ message: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (validated) => validated, "message")
5325
5326
  };
5326
5327
  const builder = action_builder(internal);
5327
5328
  return Object.assign(builder, {
@@ -5335,7 +5336,7 @@ function state(entry) {
5335
5336
  }
5336
5337
  };
5337
5338
  }
5338
- _chunkZI4NSYCDcjs.__name.call(void 0, state, "state");
5339
+ _chunk4GA3CHQWcjs.__name.call(void 0, state, "state");
5339
5340
  function action_builder(state2) {
5340
5341
  const internal = state2;
5341
5342
  const builder = {
@@ -5348,7 +5349,7 @@ function action_builder(state2) {
5348
5349
  throw new Error(`Duplicate action "${action2}"`);
5349
5350
  internal.actions[action2] = schema;
5350
5351
  if (options) {
5351
- _chunk62LDEIDMcjs.check.call(void 0, "action", options);
5352
+ _chunkXG3UD63Ycjs.check.call(void 0, "action", options);
5352
5353
  internal.options ??= {};
5353
5354
  internal.options[action2] = options;
5354
5355
  }
@@ -5372,12 +5373,12 @@ function action_builder(state2) {
5372
5373
  (internal.loads ??= {})[action2] = loads;
5373
5374
  return { loads: load2, requires, emit };
5374
5375
  }
5375
- _chunkZI4NSYCDcjs.__name.call(void 0, load2, "load");
5376
+ _chunk4GA3CHQWcjs.__name.call(void 0, load2, "load");
5376
5377
  function requires(rules) {
5377
5378
  (internal.requires ??= {})[action2] = rules;
5378
5379
  return { emit };
5379
5380
  }
5380
- _chunkZI4NSYCDcjs.__name.call(void 0, requires, "requires");
5381
+ _chunk4GA3CHQWcjs.__name.call(void 0, requires, "requires");
5381
5382
  function emit(handler) {
5382
5383
  if (typeof handler === "string") {
5383
5384
  const event_name = handler;
@@ -5393,7 +5394,7 @@ function action_builder(state2) {
5393
5394
  }
5394
5395
  return builder;
5395
5396
  }
5396
- _chunkZI4NSYCDcjs.__name.call(void 0, emit, "emit");
5397
+ _chunk4GA3CHQWcjs.__name.call(void 0, emit, "emit");
5397
5398
  return { loads: load2, requires, emit };
5398
5399
  },
5399
5400
  snap(snap2) {
@@ -5444,7 +5445,7 @@ function action_builder(state2) {
5444
5445
  };
5445
5446
  return builder;
5446
5447
  }
5447
- _chunkZI4NSYCDcjs.__name.call(void 0, action_builder, "action_builder");
5448
+ _chunk4GA3CHQWcjs.__name.call(void 0, action_builder, "action_builder");
5448
5449
 
5449
5450
  // src/csv.ts
5450
5451
  var _fs = require('fs');
@@ -5460,7 +5461,7 @@ var CSV_COLUMNS = [
5460
5461
  ];
5461
5462
  var CsvFile = class {
5462
5463
  static {
5463
- _chunkZI4NSYCDcjs.__name.call(void 0, this, "CsvFile");
5464
+ _chunk4GA3CHQWcjs.__name.call(void 0, this, "CsvFile");
5464
5465
  }
5465
5466
 
5466
5467
 
@@ -5555,7 +5556,7 @@ async function* linesFromFile(path) {
5555
5556
  stream.close();
5556
5557
  }
5557
5558
  }
5558
- _chunkZI4NSYCDcjs.__name.call(void 0, linesFromFile, "linesFromFile");
5559
+ _chunk4GA3CHQWcjs.__name.call(void 0, linesFromFile, "linesFromFile");
5559
5560
  async function* linesFromBlob(blob) {
5560
5561
  let start = 0;
5561
5562
  while (start < blob.length) {
@@ -5566,7 +5567,7 @@ async function* linesFromBlob(blob) {
5566
5567
  await Promise.resolve();
5567
5568
  }
5568
5569
  }
5569
- _chunkZI4NSYCDcjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
5570
+ _chunk4GA3CHQWcjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
5570
5571
  function parse_csv_line(line) {
5571
5572
  const fields = [];
5572
5573
  let i = 0;
@@ -5600,12 +5601,12 @@ function parse_csv_line(line) {
5600
5601
  }
5601
5602
  return fields;
5602
5603
  }
5603
- _chunkZI4NSYCDcjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
5604
+ _chunk4GA3CHQWcjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
5604
5605
  function csv_escape(value) {
5605
5606
  if (/[",\n\r]/.test(value)) return `"${value.replace(/"/g, '""')}"`;
5606
5607
  return value;
5607
5608
  }
5608
- _chunkZI4NSYCDcjs.__name.call(void 0, csv_escape, "csv_escape");
5609
+ _chunk4GA3CHQWcjs.__name.call(void 0, csv_escape, "csv_escape");
5609
5610
  function write_line(writer, line) {
5610
5611
  return new Promise((resolve, reject) => {
5611
5612
  writer.write(`${line}
@@ -5615,38 +5616,38 @@ function write_line(writer, line) {
5615
5616
  });
5616
5617
  });
5617
5618
  }
5618
- _chunkZI4NSYCDcjs.__name.call(void 0, write_line, "write_line");
5619
+ _chunk4GA3CHQWcjs.__name.call(void 0, write_line, "write_line");
5619
5620
 
5620
5621
  // src/deprecated.ts
5621
- var check_appends = _chunkDAVFDMC4cjs.checkAppends;
5622
- var throw_if_stale = _chunkDAVFDMC4cjs.checkVersion;
5623
- var concurrency_error = _chunkDAVFDMC4cjs.concurrencyError;
5624
- var seed_event = _chunkDAVFDMC4cjs.seedEvent;
5625
- var fair_slots = _chunkDAVFDMC4cjs.fairSlots;
5626
- var is_literal_source = _chunkDAVFDMC4cjs.isStreamName;
5627
- var notification_of = _chunkDAVFDMC4cjs.parseNotification;
5628
- var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunkZI4NSYCDcjs.DEFAULT_QUERY_STREAMS_LIMIT;
5629
- var ActorSchema2 = _chunkZI4NSYCDcjs.ActorSchema;
5630
- var TargetSchema2 = _chunkZI4NSYCDcjs.TargetSchema;
5631
- var EventMetaSchema2 = _chunkZI4NSYCDcjs.EventMetaSchema;
5632
- var CausationEventSchema2 = _chunkZI4NSYCDcjs.CausationEventSchema;
5633
- var CommittedMetaSchema2 = _chunkZI4NSYCDcjs.CommittedMetaSchema;
5634
- var QuerySchema2 = _chunkZI4NSYCDcjs.QuerySchema;
5635
- var Environments2 = _chunkZI4NSYCDcjs.Environments;
5636
- var LogLevels2 = _chunkZI4NSYCDcjs.LogLevels;
5637
- var ExitCodes2 = _chunkZI4NSYCDcjs.ExitCodes;
5638
- var DEFAULT_LANE2 = _chunkZI4NSYCDcjs.DEFAULT_LANE;
5639
- var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkZI4NSYCDcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
5640
- var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkZI4NSYCDcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
5641
- var PackageSchema = _chunk62LDEIDMcjs.package_schema;
5642
- var default_scope = _chunk62LDEIDMcjs.unscoped_ports;
5643
- var extend = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunk62LDEIDMcjs.validate.call(void 0, "config", source, schema) }), "extend");
5622
+ var check_appends = _chunkXJZ2PKJHcjs.checkAppends;
5623
+ var throw_if_stale = _chunkXJZ2PKJHcjs.checkVersion;
5624
+ var concurrency_error = _chunkXJZ2PKJHcjs.concurrencyError;
5625
+ var seed_event = _chunkXJZ2PKJHcjs.seedEvent;
5626
+ var fair_slots = _chunkXJZ2PKJHcjs.fairSlots;
5627
+ var is_literal_source = _chunkXJZ2PKJHcjs.isStreamName;
5628
+ var notification_of = _chunkXJZ2PKJHcjs.parseNotification;
5629
+ var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunk4GA3CHQWcjs.DEFAULT_QUERY_STREAMS_LIMIT;
5630
+ var ActorSchema2 = _chunk4GA3CHQWcjs.ActorSchema;
5631
+ var TargetSchema2 = _chunk4GA3CHQWcjs.TargetSchema;
5632
+ var EventMetaSchema2 = _chunk4GA3CHQWcjs.EventMetaSchema;
5633
+ var CausationEventSchema2 = _chunk4GA3CHQWcjs.CausationEventSchema;
5634
+ var CommittedMetaSchema2 = _chunk4GA3CHQWcjs.CommittedMetaSchema;
5635
+ var QuerySchema2 = _chunk4GA3CHQWcjs.QuerySchema;
5636
+ var Environments2 = _chunk4GA3CHQWcjs.Environments;
5637
+ var LogLevels2 = _chunk4GA3CHQWcjs.LogLevels;
5638
+ var ExitCodes2 = _chunk4GA3CHQWcjs.ExitCodes;
5639
+ var DEFAULT_LANE2 = _chunk4GA3CHQWcjs.DEFAULT_LANE;
5640
+ var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunk4GA3CHQWcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
5641
+ var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunk4GA3CHQWcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
5642
+ var PackageSchema = _chunkXG3UD63Ycjs.package_schema;
5643
+ var default_scope = _chunkXG3UD63Ycjs.unscoped_ports;
5644
+ var extend = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunkXG3UD63Ycjs.validate.call(void 0, "config", source, schema) }), "extend");
5644
5645
  var ISO_8601 = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?(Z|[+-][0-2][0-9]:[0-5][0-9])?$/;
5645
- var dateReviver = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
5646
+ var dateReviver = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
5646
5647
  function sensitiveFields(schema) {
5647
5648
  return Object.keys(pii_schemas(schema));
5648
5649
  }
5649
- _chunkZI4NSYCDcjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
5650
+ _chunk4GA3CHQWcjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
5650
5651
  var pii_fields = sensitiveFields;
5651
5652
 
5652
5653
 
@@ -5707,5 +5708,5 @@ var pii_fields = sensitiveFields;
5707
5708
 
5708
5709
 
5709
5710
 
5710
- exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkZI4NSYCDcjs.ConcurrencyError; exports.ConsoleLogger = _chunk62LDEIDMcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkZI4NSYCDcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkZI4NSYCDcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunk62LDEIDMcjs.InMemoryCache; exports.InMemoryStore = _chunk62LDEIDMcjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkZI4NSYCDcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkZI4NSYCDcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkZI4NSYCDcjs.REDACTED; exports.SHREDDED = _chunkZI4NSYCDcjs.SHREDDED; exports.SNAP_EVENT = _chunkZI4NSYCDcjs.SNAP_EVENT; exports.StoreError = _chunkZI4NSYCDcjs.StoreError; exports.StreamClosedError = _chunkZI4NSYCDcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkZI4NSYCDcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkZI4NSYCDcjs.ValidationError; exports.ZodEmpty = _chunkZI4NSYCDcjs.ZodEmpty; exports.act = act; exports.cache = _chunk62LDEIDMcjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunk62LDEIDMcjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunk62LDEIDMcjs.dispose; exports.disposeAndExit = _chunk62LDEIDMcjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunk62LDEIDMcjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunk62LDEIDMcjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunkZI4NSYCDcjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunk62LDEIDMcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunk62LDEIDMcjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunk62LDEIDMcjs.validate;
5711
+ exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunk4GA3CHQWcjs.ConcurrencyError; exports.ConsoleLogger = _chunkXG3UD63Ycjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunk4GA3CHQWcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunk4GA3CHQWcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkXG3UD63Ycjs.InMemoryCache; exports.InMemoryStore = _chunkXG3UD63Ycjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunk4GA3CHQWcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunk4GA3CHQWcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunk4GA3CHQWcjs.REDACTED; exports.SHREDDED = _chunk4GA3CHQWcjs.SHREDDED; exports.SNAP_EVENT = _chunk4GA3CHQWcjs.SNAP_EVENT; exports.StoreError = _chunk4GA3CHQWcjs.StoreError; exports.StreamClosedError = _chunk4GA3CHQWcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk4GA3CHQWcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunk4GA3CHQWcjs.ValidationError; exports.ZodEmpty = _chunk4GA3CHQWcjs.ZodEmpty; exports.act = act; exports.cache = _chunkXG3UD63Ycjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkXG3UD63Ycjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkXG3UD63Ycjs.dispose; exports.disposeAndExit = _chunkXG3UD63Ycjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkXG3UD63Ycjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunkXG3UD63Ycjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunk4GA3CHQWcjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunkXG3UD63Ycjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkXG3UD63Ycjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkXG3UD63Ycjs.validate;
5711
5712
  //# sourceMappingURL=index.cjs.map