@opendatalabs/personal-server-ts-lite 1.37.0 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/account-mode-store.d.ts +11 -0
  2. package/dist/account-mode-store.d.ts.map +1 -0
  3. package/dist/account-mode-store.js +68 -0
  4. package/dist/account-mode-store.js.map +1 -0
  5. package/dist/additions-worker.bundle.js +135 -37
  6. package/dist/browser-runtime.d.ts +88 -1
  7. package/dist/browser-runtime.d.ts.map +1 -1
  8. package/dist/browser-runtime.js +135 -12
  9. package/dist/browser-runtime.js.map +1 -1
  10. package/dist/browser-tls-rustls/browser_tls_rustls_bg.wasm +0 -0
  11. package/dist/client.d.ts +42 -3
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/client.js +130 -115
  14. package/dist/client.js.map +1 -1
  15. package/dist/history-probe-worker.bundle.js +66 -29
  16. package/dist/history-probe.worker.d.ts.map +1 -1
  17. package/dist/history-probe.worker.js +4 -3
  18. package/dist/history-probe.worker.js.map +1 -1
  19. package/dist/index.d.ts +6 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +2 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/localdb-port.d.ts +28 -0
  24. package/dist/localdb-port.d.ts.map +1 -0
  25. package/dist/localdb-port.js +30 -0
  26. package/dist/localdb-port.js.map +1 -0
  27. package/dist/mcp-store.d.ts.map +1 -1
  28. package/dist/mcp-store.js +6 -2
  29. package/dist/mcp-store.js.map +1 -1
  30. package/dist/owner-binding.d.ts +5 -0
  31. package/dist/owner-binding.d.ts.map +1 -1
  32. package/dist/owner-binding.js +4 -8
  33. package/dist/owner-binding.js.map +1 -1
  34. package/dist/owner-request.d.ts +16 -0
  35. package/dist/owner-request.d.ts.map +1 -0
  36. package/dist/owner-request.js +37 -0
  37. package/dist/owner-request.js.map +1 -0
  38. package/dist/pdpp-records.d.ts +18 -0
  39. package/dist/pdpp-records.d.ts.map +1 -0
  40. package/dist/pdpp-records.js +105 -0
  41. package/dist/pdpp-records.js.map +1 -0
  42. package/dist/persistence.d.ts +1 -1
  43. package/dist/persistence.d.ts.map +1 -1
  44. package/dist/persistence.js +2 -2
  45. package/dist/persistence.js.map +1 -1
  46. package/dist/personal-server-client.d.ts +32 -0
  47. package/dist/personal-server-client.d.ts.map +1 -0
  48. package/dist/personal-server-client.js +57 -0
  49. package/dist/personal-server-client.js.map +1 -0
  50. package/dist/pull-signals.d.ts +52 -0
  51. package/dist/pull-signals.d.ts.map +1 -0
  52. package/dist/pull-signals.js +142 -0
  53. package/dist/pull-signals.js.map +1 -0
  54. package/dist/relay.d.ts.map +1 -1
  55. package/dist/relay.js +4 -1
  56. package/dist/relay.js.map +1 -1
  57. package/dist/runtime.d.ts +38 -2
  58. package/dist/runtime.d.ts.map +1 -1
  59. package/dist/runtime.js +327 -16
  60. package/dist/runtime.js.map +1 -1
  61. package/dist/seed-staging.d.ts +8 -0
  62. package/dist/seed-staging.d.ts.map +1 -0
  63. package/dist/seed-staging.js +106 -0
  64. package/dist/seed-staging.js.map +1 -0
  65. package/dist/state.d.ts +9 -1
  66. package/dist/state.d.ts.map +1 -1
  67. package/dist/state.js +10 -4
  68. package/dist/state.js.map +1 -1
  69. package/dist/storage-utils.d.ts.map +1 -1
  70. package/dist/storage-utils.js +1 -1
  71. package/dist/storage-utils.js.map +1 -1
  72. package/dist/storage.d.ts +26 -1
  73. package/dist/storage.d.ts.map +1 -1
  74. package/dist/storage.js +226 -109
  75. package/dist/storage.js.map +1 -1
  76. package/dist/stream-sync-budget.d.ts +3 -0
  77. package/dist/stream-sync-budget.d.ts.map +1 -0
  78. package/dist/stream-sync-budget.js +3 -0
  79. package/dist/stream-sync-budget.js.map +1 -0
  80. package/dist/sync.d.ts +82 -2
  81. package/dist/sync.d.ts.map +1 -1
  82. package/dist/sync.js +295 -57
  83. package/dist/sync.js.map +1 -1
  84. package/dist/wasm-stream-crypto.d.ts +20 -0
  85. package/dist/wasm-stream-crypto.d.ts.map +1 -0
  86. package/dist/wasm-stream-crypto.js +53 -0
  87. package/dist/wasm-stream-crypto.js.map +1 -0
  88. package/package.json +10 -3
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Durable per-owner mode records for Web PS Lite, in their own IndexedDB
3
+ * database, never in the data database: clearing or rebuilding the data store
4
+ * must not unset an owner's On. One object store keyed by owner. A save
5
+ * resolves only when its transaction completes. Only the newest tab runs the
6
+ * server, so there is no cross-tab lock.
7
+ */
8
+ import { type ModeRecordStore } from "@opendatalabs/personal-server-ts-core/sync/account-mode";
9
+ export declare const ACCOUNT_MODE_DB_NAME = "personal-server-lite-account-mode";
10
+ export declare function createIndexedDbModeRecordStore(dbName?: string): ModeRecordStore;
11
+ //# sourceMappingURL=account-mode-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-mode-store.d.ts","sourceRoot":"","sources":["../src/account-mode-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yDAAyD,CAAC;AAEjE,eAAO,MAAM,oBAAoB,sCAAsC,CAAC;AAkBxE,wBAAgB,8BAA8B,CAC5C,MAAM,GAAE,MAA6B,GACpC,eAAe,CAwCjB"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Durable per-owner mode records for Web PS Lite, in their own IndexedDB
3
+ * database, never in the data database: clearing or rebuilding the data store
4
+ * must not unset an owner's On. One object store keyed by owner. A save
5
+ * resolves only when its transaction completes. Only the newest tab runs the
6
+ * server, so there is no cross-tab lock.
7
+ */
8
+ import { parseRecord, } from "@opendatalabs/personal-server-ts-core/sync/account-mode";
9
+ export const ACCOUNT_MODE_DB_NAME = "personal-server-lite-account-mode";
10
+ const STORE = "owners";
11
+ function openDb(dbName) {
12
+ if (typeof indexedDB === "undefined") {
13
+ return Promise.reject(new Error("IndexedDB is not available"));
14
+ }
15
+ return new Promise((resolve, reject) => {
16
+ const request = indexedDB.open(dbName, 1);
17
+ request.onupgradeneeded = () => {
18
+ request.result.createObjectStore(STORE, { keyPath: "owner" });
19
+ };
20
+ request.onsuccess = () => resolve(request.result);
21
+ request.onerror = () => reject(request.error ?? new Error("open failed"));
22
+ request.onblocked = () => reject(new Error("open blocked"));
23
+ });
24
+ }
25
+ export function createIndexedDbModeRecordStore(dbName = ACCOUNT_MODE_DB_NAME) {
26
+ return {
27
+ async load() {
28
+ const db = await openDb(dbName);
29
+ try {
30
+ const rows = await new Promise((resolve, reject) => {
31
+ const request = db
32
+ .transaction(STORE, "readonly")
33
+ .objectStore(STORE)
34
+ .getAll();
35
+ request.onsuccess = () => resolve(request.result);
36
+ request.onerror = () => reject(request.error ?? new Error("read failed"));
37
+ });
38
+ const records = new Map();
39
+ for (const row of rows) {
40
+ const record = parseRecord(row);
41
+ const owner = row.owner;
42
+ if (record && typeof owner === "string")
43
+ records.set(owner, record);
44
+ }
45
+ return records;
46
+ }
47
+ finally {
48
+ db.close();
49
+ }
50
+ },
51
+ async save(owner, record) {
52
+ const db = await openDb(dbName);
53
+ try {
54
+ await new Promise((resolve, reject) => {
55
+ const tx = db.transaction(STORE, "readwrite");
56
+ tx.objectStore(STORE).put({ owner, ...record });
57
+ tx.oncomplete = () => resolve();
58
+ tx.onerror = () => reject(tx.error ?? new Error("write failed"));
59
+ tx.onabort = () => reject(tx.error ?? new Error("write aborted"));
60
+ });
61
+ }
62
+ finally {
63
+ db.close();
64
+ }
65
+ },
66
+ };
67
+ }
68
+ //# sourceMappingURL=account-mode-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-mode-store.js","sourceRoot":"","sources":["../src/account-mode-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,WAAW,GAGZ,MAAM,yDAAyD,CAAC;AAEjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACxE,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,SAAS,MAAM,CAAC,MAAc;IAC5B,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1C,OAAO,CAAC,eAAe,GAAG,GAAG,EAAE;YAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,SAAiB,oBAAoB;IAErC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,IAAI,OAAO,CAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC5D,MAAM,OAAO,GAAG,EAAE;yBACf,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;yBAC9B,WAAW,CAAC,KAAK,CAAC;yBAClB,MAAM,EAAE,CAAC;oBACZ,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBAClD,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CACrB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;gBACtD,CAAC,CAAC,CAAC;gBACH,MAAM,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;gBACrD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;oBACvB,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;oBAChC,MAAM,KAAK,GAAI,GAA2B,CAAC,KAAK,CAAC;oBACjD,IAAI,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ;wBAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACtE,CAAC;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACT,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;YACtB,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC;gBACH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;oBAC9C,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;oBAChD,EAAE,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;oBAChC,EAAE,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;oBACjE,EAAE,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;gBACpE,CAAC,CAAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -7067,8 +7067,8 @@ function Ql(e2, t2, r2) {
7067
7067
  for (var n2 = 0; n2 < 16; n2++) e2[n2] = t2[n2] - r2[n2];
7068
7068
  }
7069
7069
  function Ml(e2, t2, r2) {
7070
- var n2, i2, s2 = 0, a2 = 0, o2 = 0, c2 = 0, u2 = 0, h2 = 0, f2 = 0, l2 = 0, y2 = 0, g2 = 0, p2 = 0, d2 = 0, A2 = 0, w2 = 0, m2 = 0, b2 = 0, k2 = 0, E2 = 0, v2 = 0, I3 = 0, B2 = 0, S2 = 0, K2 = 0, C3 = 0, D2 = 0, U2 = 0, P3 = 0, x2 = 0, Q2 = 0, M3 = 0, R2 = 0, F2 = r2[0], T2 = r2[1], L4 = r2[2], N3 = r2[3], O2 = r2[4], H2 = r2[5], z3 = r2[6], G3 = r2[7], j2 = r2[8], V2 = r2[9], q2 = r2[10], _2 = r2[11], Y2 = r2[12], Z2 = r2[13], J2 = r2[14], W3 = r2[15];
7071
- s2 += (n2 = t2[0]) * F2, a2 += n2 * T2, o2 += n2 * L4, c2 += n2 * N3, u2 += n2 * O2, h2 += n2 * H2, f2 += n2 * z3, l2 += n2 * G3, y2 += n2 * j2, g2 += n2 * V2, p2 += n2 * q2, d2 += n2 * _2, A2 += n2 * Y2, w2 += n2 * Z2, m2 += n2 * J2, b2 += n2 * W3, a2 += (n2 = t2[1]) * F2, o2 += n2 * T2, c2 += n2 * L4, u2 += n2 * N3, h2 += n2 * O2, f2 += n2 * H2, l2 += n2 * z3, y2 += n2 * G3, g2 += n2 * j2, p2 += n2 * V2, d2 += n2 * q2, A2 += n2 * _2, w2 += n2 * Y2, m2 += n2 * Z2, b2 += n2 * J2, k2 += n2 * W3, o2 += (n2 = t2[2]) * F2, c2 += n2 * T2, u2 += n2 * L4, h2 += n2 * N3, f2 += n2 * O2, l2 += n2 * H2, y2 += n2 * z3, g2 += n2 * G3, p2 += n2 * j2, d2 += n2 * V2, A2 += n2 * q2, w2 += n2 * _2, m2 += n2 * Y2, b2 += n2 * Z2, k2 += n2 * J2, E2 += n2 * W3, c2 += (n2 = t2[3]) * F2, u2 += n2 * T2, h2 += n2 * L4, f2 += n2 * N3, l2 += n2 * O2, y2 += n2 * H2, g2 += n2 * z3, p2 += n2 * G3, d2 += n2 * j2, A2 += n2 * V2, w2 += n2 * q2, m2 += n2 * _2, b2 += n2 * Y2, k2 += n2 * Z2, E2 += n2 * J2, v2 += n2 * W3, u2 += (n2 = t2[4]) * F2, h2 += n2 * T2, f2 += n2 * L4, l2 += n2 * N3, y2 += n2 * O2, g2 += n2 * H2, p2 += n2 * z3, d2 += n2 * G3, A2 += n2 * j2, w2 += n2 * V2, m2 += n2 * q2, b2 += n2 * _2, k2 += n2 * Y2, E2 += n2 * Z2, v2 += n2 * J2, I3 += n2 * W3, h2 += (n2 = t2[5]) * F2, f2 += n2 * T2, l2 += n2 * L4, y2 += n2 * N3, g2 += n2 * O2, p2 += n2 * H2, d2 += n2 * z3, A2 += n2 * G3, w2 += n2 * j2, m2 += n2 * V2, b2 += n2 * q2, k2 += n2 * _2, E2 += n2 * Y2, v2 += n2 * Z2, I3 += n2 * J2, B2 += n2 * W3, f2 += (n2 = t2[6]) * F2, l2 += n2 * T2, y2 += n2 * L4, g2 += n2 * N3, p2 += n2 * O2, d2 += n2 * H2, A2 += n2 * z3, w2 += n2 * G3, m2 += n2 * j2, b2 += n2 * V2, k2 += n2 * q2, E2 += n2 * _2, v2 += n2 * Y2, I3 += n2 * Z2, B2 += n2 * J2, S2 += n2 * W3, l2 += (n2 = t2[7]) * F2, y2 += n2 * T2, g2 += n2 * L4, p2 += n2 * N3, d2 += n2 * O2, A2 += n2 * H2, w2 += n2 * z3, m2 += n2 * G3, b2 += n2 * j2, k2 += n2 * V2, E2 += n2 * q2, v2 += n2 * _2, I3 += n2 * Y2, B2 += n2 * Z2, S2 += n2 * J2, K2 += n2 * W3, y2 += (n2 = t2[8]) * F2, g2 += n2 * T2, p2 += n2 * L4, d2 += n2 * N3, A2 += n2 * O2, w2 += n2 * H2, m2 += n2 * z3, b2 += n2 * G3, k2 += n2 * j2, E2 += n2 * V2, v2 += n2 * q2, I3 += n2 * _2, B2 += n2 * Y2, S2 += n2 * Z2, K2 += n2 * J2, C3 += n2 * W3, g2 += (n2 = t2[9]) * F2, p2 += n2 * T2, d2 += n2 * L4, A2 += n2 * N3, w2 += n2 * O2, m2 += n2 * H2, b2 += n2 * z3, k2 += n2 * G3, E2 += n2 * j2, v2 += n2 * V2, I3 += n2 * q2, B2 += n2 * _2, S2 += n2 * Y2, K2 += n2 * Z2, C3 += n2 * J2, D2 += n2 * W3, p2 += (n2 = t2[10]) * F2, d2 += n2 * T2, A2 += n2 * L4, w2 += n2 * N3, m2 += n2 * O2, b2 += n2 * H2, k2 += n2 * z3, E2 += n2 * G3, v2 += n2 * j2, I3 += n2 * V2, B2 += n2 * q2, S2 += n2 * _2, K2 += n2 * Y2, C3 += n2 * Z2, D2 += n2 * J2, U2 += n2 * W3, d2 += (n2 = t2[11]) * F2, A2 += n2 * T2, w2 += n2 * L4, m2 += n2 * N3, b2 += n2 * O2, k2 += n2 * H2, E2 += n2 * z3, v2 += n2 * G3, I3 += n2 * j2, B2 += n2 * V2, S2 += n2 * q2, K2 += n2 * _2, C3 += n2 * Y2, D2 += n2 * Z2, U2 += n2 * J2, P3 += n2 * W3, A2 += (n2 = t2[12]) * F2, w2 += n2 * T2, m2 += n2 * L4, b2 += n2 * N3, k2 += n2 * O2, E2 += n2 * H2, v2 += n2 * z3, I3 += n2 * G3, B2 += n2 * j2, S2 += n2 * V2, K2 += n2 * q2, C3 += n2 * _2, D2 += n2 * Y2, U2 += n2 * Z2, P3 += n2 * J2, x2 += n2 * W3, w2 += (n2 = t2[13]) * F2, m2 += n2 * T2, b2 += n2 * L4, k2 += n2 * N3, E2 += n2 * O2, v2 += n2 * H2, I3 += n2 * z3, B2 += n2 * G3, S2 += n2 * j2, K2 += n2 * V2, C3 += n2 * q2, D2 += n2 * _2, U2 += n2 * Y2, P3 += n2 * Z2, x2 += n2 * J2, Q2 += n2 * W3, m2 += (n2 = t2[14]) * F2, b2 += n2 * T2, k2 += n2 * L4, E2 += n2 * N3, v2 += n2 * O2, I3 += n2 * H2, B2 += n2 * z3, S2 += n2 * G3, K2 += n2 * j2, C3 += n2 * V2, D2 += n2 * q2, U2 += n2 * _2, P3 += n2 * Y2, x2 += n2 * Z2, Q2 += n2 * J2, M3 += n2 * W3, b2 += (n2 = t2[15]) * F2, a2 += 38 * (E2 += n2 * L4), o2 += 38 * (v2 += n2 * N3), c2 += 38 * (I3 += n2 * O2), u2 += 38 * (B2 += n2 * H2), h2 += 38 * (S2 += n2 * z3), f2 += 38 * (K2 += n2 * G3), l2 += 38 * (C3 += n2 * j2), y2 += 38 * (D2 += n2 * V2), g2 += 38 * (U2 += n2 * q2), p2 += 38 * (P3 += n2 * _2), d2 += 38 * (x2 += n2 * Y2), A2 += 38 * (Q2 += n2 * Z2), w2 += 38 * (M3 += n2 * J2), m2 += 38 * (R2 += n2 * W3), s2 = (n2 = (s2 += 38 * (k2 += n2 * T2)) + (i2 = 1) + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), a2 = (n2 = a2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), o2 = (n2 = o2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), c2 = (n2 = c2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), u2 = (n2 = u2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), h2 = (n2 = h2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), f2 = (n2 = f2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), l2 = (n2 = l2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), y2 = (n2 = y2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), g2 = (n2 = g2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), p2 = (n2 = p2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), d2 = (n2 = d2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), A2 = (n2 = A2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), w2 = (n2 = w2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), m2 = (n2 = m2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), b2 = (n2 = b2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), s2 = (n2 = (s2 += i2 - 1 + 37 * (i2 - 1)) + (i2 = 1) + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), a2 = (n2 = a2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), o2 = (n2 = o2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), c2 = (n2 = c2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), u2 = (n2 = u2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), h2 = (n2 = h2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), f2 = (n2 = f2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), l2 = (n2 = l2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), y2 = (n2 = y2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), g2 = (n2 = g2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), p2 = (n2 = p2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), d2 = (n2 = d2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), A2 = (n2 = A2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), w2 = (n2 = w2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), m2 = (n2 = m2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), b2 = (n2 = b2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), s2 += i2 - 1 + 37 * (i2 - 1), e2[0] = s2, e2[1] = a2, e2[2] = o2, e2[3] = c2, e2[4] = u2, e2[5] = h2, e2[6] = f2, e2[7] = l2, e2[8] = y2, e2[9] = g2, e2[10] = p2, e2[11] = d2, e2[12] = A2, e2[13] = w2, e2[14] = m2, e2[15] = b2;
7070
+ var n2, i2, s2 = 0, a2 = 0, o2 = 0, c2 = 0, u2 = 0, h2 = 0, f2 = 0, l2 = 0, y2 = 0, g2 = 0, p2 = 0, d2 = 0, A2 = 0, w2 = 0, m2 = 0, b2 = 0, k2 = 0, E2 = 0, v2 = 0, I3 = 0, B2 = 0, S2 = 0, K2 = 0, C3 = 0, D2 = 0, U2 = 0, P3 = 0, x2 = 0, Q2 = 0, M3 = 0, R2 = 0, F2 = r2[0], T2 = r2[1], L4 = r2[2], N4 = r2[3], O2 = r2[4], H2 = r2[5], z3 = r2[6], G3 = r2[7], j2 = r2[8], V2 = r2[9], q2 = r2[10], _2 = r2[11], Y2 = r2[12], Z2 = r2[13], J2 = r2[14], W3 = r2[15];
7071
+ s2 += (n2 = t2[0]) * F2, a2 += n2 * T2, o2 += n2 * L4, c2 += n2 * N4, u2 += n2 * O2, h2 += n2 * H2, f2 += n2 * z3, l2 += n2 * G3, y2 += n2 * j2, g2 += n2 * V2, p2 += n2 * q2, d2 += n2 * _2, A2 += n2 * Y2, w2 += n2 * Z2, m2 += n2 * J2, b2 += n2 * W3, a2 += (n2 = t2[1]) * F2, o2 += n2 * T2, c2 += n2 * L4, u2 += n2 * N4, h2 += n2 * O2, f2 += n2 * H2, l2 += n2 * z3, y2 += n2 * G3, g2 += n2 * j2, p2 += n2 * V2, d2 += n2 * q2, A2 += n2 * _2, w2 += n2 * Y2, m2 += n2 * Z2, b2 += n2 * J2, k2 += n2 * W3, o2 += (n2 = t2[2]) * F2, c2 += n2 * T2, u2 += n2 * L4, h2 += n2 * N4, f2 += n2 * O2, l2 += n2 * H2, y2 += n2 * z3, g2 += n2 * G3, p2 += n2 * j2, d2 += n2 * V2, A2 += n2 * q2, w2 += n2 * _2, m2 += n2 * Y2, b2 += n2 * Z2, k2 += n2 * J2, E2 += n2 * W3, c2 += (n2 = t2[3]) * F2, u2 += n2 * T2, h2 += n2 * L4, f2 += n2 * N4, l2 += n2 * O2, y2 += n2 * H2, g2 += n2 * z3, p2 += n2 * G3, d2 += n2 * j2, A2 += n2 * V2, w2 += n2 * q2, m2 += n2 * _2, b2 += n2 * Y2, k2 += n2 * Z2, E2 += n2 * J2, v2 += n2 * W3, u2 += (n2 = t2[4]) * F2, h2 += n2 * T2, f2 += n2 * L4, l2 += n2 * N4, y2 += n2 * O2, g2 += n2 * H2, p2 += n2 * z3, d2 += n2 * G3, A2 += n2 * j2, w2 += n2 * V2, m2 += n2 * q2, b2 += n2 * _2, k2 += n2 * Y2, E2 += n2 * Z2, v2 += n2 * J2, I3 += n2 * W3, h2 += (n2 = t2[5]) * F2, f2 += n2 * T2, l2 += n2 * L4, y2 += n2 * N4, g2 += n2 * O2, p2 += n2 * H2, d2 += n2 * z3, A2 += n2 * G3, w2 += n2 * j2, m2 += n2 * V2, b2 += n2 * q2, k2 += n2 * _2, E2 += n2 * Y2, v2 += n2 * Z2, I3 += n2 * J2, B2 += n2 * W3, f2 += (n2 = t2[6]) * F2, l2 += n2 * T2, y2 += n2 * L4, g2 += n2 * N4, p2 += n2 * O2, d2 += n2 * H2, A2 += n2 * z3, w2 += n2 * G3, m2 += n2 * j2, b2 += n2 * V2, k2 += n2 * q2, E2 += n2 * _2, v2 += n2 * Y2, I3 += n2 * Z2, B2 += n2 * J2, S2 += n2 * W3, l2 += (n2 = t2[7]) * F2, y2 += n2 * T2, g2 += n2 * L4, p2 += n2 * N4, d2 += n2 * O2, A2 += n2 * H2, w2 += n2 * z3, m2 += n2 * G3, b2 += n2 * j2, k2 += n2 * V2, E2 += n2 * q2, v2 += n2 * _2, I3 += n2 * Y2, B2 += n2 * Z2, S2 += n2 * J2, K2 += n2 * W3, y2 += (n2 = t2[8]) * F2, g2 += n2 * T2, p2 += n2 * L4, d2 += n2 * N4, A2 += n2 * O2, w2 += n2 * H2, m2 += n2 * z3, b2 += n2 * G3, k2 += n2 * j2, E2 += n2 * V2, v2 += n2 * q2, I3 += n2 * _2, B2 += n2 * Y2, S2 += n2 * Z2, K2 += n2 * J2, C3 += n2 * W3, g2 += (n2 = t2[9]) * F2, p2 += n2 * T2, d2 += n2 * L4, A2 += n2 * N4, w2 += n2 * O2, m2 += n2 * H2, b2 += n2 * z3, k2 += n2 * G3, E2 += n2 * j2, v2 += n2 * V2, I3 += n2 * q2, B2 += n2 * _2, S2 += n2 * Y2, K2 += n2 * Z2, C3 += n2 * J2, D2 += n2 * W3, p2 += (n2 = t2[10]) * F2, d2 += n2 * T2, A2 += n2 * L4, w2 += n2 * N4, m2 += n2 * O2, b2 += n2 * H2, k2 += n2 * z3, E2 += n2 * G3, v2 += n2 * j2, I3 += n2 * V2, B2 += n2 * q2, S2 += n2 * _2, K2 += n2 * Y2, C3 += n2 * Z2, D2 += n2 * J2, U2 += n2 * W3, d2 += (n2 = t2[11]) * F2, A2 += n2 * T2, w2 += n2 * L4, m2 += n2 * N4, b2 += n2 * O2, k2 += n2 * H2, E2 += n2 * z3, v2 += n2 * G3, I3 += n2 * j2, B2 += n2 * V2, S2 += n2 * q2, K2 += n2 * _2, C3 += n2 * Y2, D2 += n2 * Z2, U2 += n2 * J2, P3 += n2 * W3, A2 += (n2 = t2[12]) * F2, w2 += n2 * T2, m2 += n2 * L4, b2 += n2 * N4, k2 += n2 * O2, E2 += n2 * H2, v2 += n2 * z3, I3 += n2 * G3, B2 += n2 * j2, S2 += n2 * V2, K2 += n2 * q2, C3 += n2 * _2, D2 += n2 * Y2, U2 += n2 * Z2, P3 += n2 * J2, x2 += n2 * W3, w2 += (n2 = t2[13]) * F2, m2 += n2 * T2, b2 += n2 * L4, k2 += n2 * N4, E2 += n2 * O2, v2 += n2 * H2, I3 += n2 * z3, B2 += n2 * G3, S2 += n2 * j2, K2 += n2 * V2, C3 += n2 * q2, D2 += n2 * _2, U2 += n2 * Y2, P3 += n2 * Z2, x2 += n2 * J2, Q2 += n2 * W3, m2 += (n2 = t2[14]) * F2, b2 += n2 * T2, k2 += n2 * L4, E2 += n2 * N4, v2 += n2 * O2, I3 += n2 * H2, B2 += n2 * z3, S2 += n2 * G3, K2 += n2 * j2, C3 += n2 * V2, D2 += n2 * q2, U2 += n2 * _2, P3 += n2 * Y2, x2 += n2 * Z2, Q2 += n2 * J2, M3 += n2 * W3, b2 += (n2 = t2[15]) * F2, a2 += 38 * (E2 += n2 * L4), o2 += 38 * (v2 += n2 * N4), c2 += 38 * (I3 += n2 * O2), u2 += 38 * (B2 += n2 * H2), h2 += 38 * (S2 += n2 * z3), f2 += 38 * (K2 += n2 * G3), l2 += 38 * (C3 += n2 * j2), y2 += 38 * (D2 += n2 * V2), g2 += 38 * (U2 += n2 * q2), p2 += 38 * (P3 += n2 * _2), d2 += 38 * (x2 += n2 * Y2), A2 += 38 * (Q2 += n2 * Z2), w2 += 38 * (M3 += n2 * J2), m2 += 38 * (R2 += n2 * W3), s2 = (n2 = (s2 += 38 * (k2 += n2 * T2)) + (i2 = 1) + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), a2 = (n2 = a2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), o2 = (n2 = o2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), c2 = (n2 = c2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), u2 = (n2 = u2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), h2 = (n2 = h2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), f2 = (n2 = f2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), l2 = (n2 = l2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), y2 = (n2 = y2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), g2 = (n2 = g2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), p2 = (n2 = p2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), d2 = (n2 = d2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), A2 = (n2 = A2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), w2 = (n2 = w2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), m2 = (n2 = m2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), b2 = (n2 = b2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), s2 = (n2 = (s2 += i2 - 1 + 37 * (i2 - 1)) + (i2 = 1) + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), a2 = (n2 = a2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), o2 = (n2 = o2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), c2 = (n2 = c2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), u2 = (n2 = u2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), h2 = (n2 = h2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), f2 = (n2 = f2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), l2 = (n2 = l2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), y2 = (n2 = y2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), g2 = (n2 = g2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), p2 = (n2 = p2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), d2 = (n2 = d2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), A2 = (n2 = A2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), w2 = (n2 = w2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), m2 = (n2 = m2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), b2 = (n2 = b2 + i2 + 65535) - 65536 * (i2 = Math.floor(n2 / 65536)), s2 += i2 - 1 + 37 * (i2 - 1), e2[0] = s2, e2[1] = a2, e2[2] = o2, e2[3] = c2, e2[4] = u2, e2[5] = h2, e2[6] = f2, e2[7] = l2, e2[8] = y2, e2[9] = g2, e2[10] = p2, e2[11] = d2, e2[12] = A2, e2[13] = w2, e2[14] = m2, e2[15] = b2;
7072
7072
  }
7073
7073
  function Rl(e2, t2) {
7074
7074
  Ml(e2, t2, t2);
@@ -7092,10 +7092,10 @@ function Ll(e2, t2) {
7092
7092
  return Tl(e2, t2, gl);
7093
7093
  }
7094
7094
  function Ol(e2, t2, r2, n2) {
7095
- for (var i2, s2, a2, o2, c2, u2, h2, f2, l2, y2, g2, p2, d2, A2, w2, m2, b2, k2, E2, v2, I3, B2, S2, K2, C3, D2, U2 = new Int32Array(16), P3 = new Int32Array(16), x2 = e2[0], Q2 = e2[1], M3 = e2[2], R2 = e2[3], F2 = e2[4], T2 = e2[5], L4 = e2[6], N3 = e2[7], O2 = t2[0], H2 = t2[1], z3 = t2[2], G3 = t2[3], j2 = t2[4], V2 = t2[5], q2 = t2[6], _2 = t2[7], Y2 = 0; n2 >= 128; ) {
7095
+ for (var i2, s2, a2, o2, c2, u2, h2, f2, l2, y2, g2, p2, d2, A2, w2, m2, b2, k2, E2, v2, I3, B2, S2, K2, C3, D2, U2 = new Int32Array(16), P3 = new Int32Array(16), x2 = e2[0], Q2 = e2[1], M3 = e2[2], R2 = e2[3], F2 = e2[4], T2 = e2[5], L4 = e2[6], N4 = e2[7], O2 = t2[0], H2 = t2[1], z3 = t2[2], G3 = t2[3], j2 = t2[4], V2 = t2[5], q2 = t2[6], _2 = t2[7], Y2 = 0; n2 >= 128; ) {
7096
7096
  for (E2 = 0; E2 < 16; E2++) v2 = 8 * E2 + Y2, U2[E2] = r2[v2 + 0] << 24 | r2[v2 + 1] << 16 | r2[v2 + 2] << 8 | r2[v2 + 3], P3[E2] = r2[v2 + 4] << 24 | r2[v2 + 5] << 16 | r2[v2 + 6] << 8 | r2[v2 + 7];
7097
- for (E2 = 0; E2 < 80; E2++) if (i2 = x2, s2 = Q2, a2 = M3, o2 = R2, c2 = F2, u2 = T2, h2 = L4, N3, l2 = O2, y2 = H2, g2 = z3, p2 = G3, d2 = j2, A2 = V2, w2 = q2, _2, S2 = 65535 & (B2 = _2), K2 = B2 >>> 16, C3 = 65535 & (I3 = N3), D2 = I3 >>> 16, S2 += 65535 & (B2 = (j2 >>> 14 | F2 << 18) ^ (j2 >>> 18 | F2 << 14) ^ (F2 >>> 9 | j2 << 23)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (F2 >>> 14 | j2 << 18) ^ (F2 >>> 18 | j2 << 14) ^ (j2 >>> 9 | F2 << 23)), D2 += I3 >>> 16, S2 += 65535 & (B2 = j2 & V2 ^ ~j2 & q2), K2 += B2 >>> 16, C3 += 65535 & (I3 = F2 & T2 ^ ~F2 & L4), D2 += I3 >>> 16, S2 += 65535 & (B2 = Nl[2 * E2 + 1]), K2 += B2 >>> 16, C3 += 65535 & (I3 = Nl[2 * E2]), D2 += I3 >>> 16, I3 = U2[E2 % 16], K2 += (B2 = P3[E2 % 16]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16, S2 = 65535 & (B2 = k2 = 65535 & S2 | K2 << 16), K2 = B2 >>> 16, C3 = 65535 & (I3 = b2 = 65535 & C3 | (D2 += C3 >>> 16) << 16), D2 = I3 >>> 16, S2 += 65535 & (B2 = (O2 >>> 28 | x2 << 4) ^ (x2 >>> 2 | O2 << 30) ^ (x2 >>> 7 | O2 << 25)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (x2 >>> 28 | O2 << 4) ^ (O2 >>> 2 | x2 << 30) ^ (O2 >>> 7 | x2 << 25)), D2 += I3 >>> 16, K2 += (B2 = O2 & H2 ^ O2 & z3 ^ H2 & z3) >>> 16, C3 += 65535 & (I3 = x2 & Q2 ^ x2 & M3 ^ Q2 & M3), D2 += I3 >>> 16, f2 = 65535 & (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) | (D2 += C3 >>> 16) << 16, m2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = p2), K2 = B2 >>> 16, C3 = 65535 & (I3 = o2), D2 = I3 >>> 16, K2 += (B2 = k2) >>> 16, C3 += 65535 & (I3 = b2), D2 += I3 >>> 16, Q2 = i2, M3 = s2, R2 = a2, F2 = o2 = 65535 & (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) | (D2 += C3 >>> 16) << 16, T2 = c2, L4 = u2, N3 = h2, x2 = f2, H2 = l2, z3 = y2, G3 = g2, j2 = p2 = 65535 & S2 | K2 << 16, V2 = d2, q2 = A2, _2 = w2, O2 = m2, E2 % 16 == 15) for (v2 = 0; v2 < 16; v2++) I3 = U2[v2], S2 = 65535 & (B2 = P3[v2]), K2 = B2 >>> 16, C3 = 65535 & I3, D2 = I3 >>> 16, I3 = U2[(v2 + 9) % 16], S2 += 65535 & (B2 = P3[(v2 + 9) % 16]), K2 += B2 >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, b2 = U2[(v2 + 1) % 16], S2 += 65535 & (B2 = ((k2 = P3[(v2 + 1) % 16]) >>> 1 | b2 << 31) ^ (k2 >>> 8 | b2 << 24) ^ (k2 >>> 7 | b2 << 25)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (b2 >>> 1 | k2 << 31) ^ (b2 >>> 8 | k2 << 24) ^ b2 >>> 7), D2 += I3 >>> 16, b2 = U2[(v2 + 14) % 16], K2 += (B2 = ((k2 = P3[(v2 + 14) % 16]) >>> 19 | b2 << 13) ^ (b2 >>> 29 | k2 << 3) ^ (k2 >>> 6 | b2 << 26)) >>> 16, C3 += 65535 & (I3 = (b2 >>> 19 | k2 << 13) ^ (k2 >>> 29 | b2 << 3) ^ b2 >>> 6), D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, U2[v2] = 65535 & C3 | D2 << 16, P3[v2] = 65535 & S2 | K2 << 16;
7098
- S2 = 65535 & (B2 = O2), K2 = B2 >>> 16, C3 = 65535 & (I3 = x2), D2 = I3 >>> 16, I3 = e2[0], K2 += (B2 = t2[0]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[0] = x2 = 65535 & C3 | D2 << 16, t2[0] = O2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = H2), K2 = B2 >>> 16, C3 = 65535 & (I3 = Q2), D2 = I3 >>> 16, I3 = e2[1], K2 += (B2 = t2[1]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[1] = Q2 = 65535 & C3 | D2 << 16, t2[1] = H2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = z3), K2 = B2 >>> 16, C3 = 65535 & (I3 = M3), D2 = I3 >>> 16, I3 = e2[2], K2 += (B2 = t2[2]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[2] = M3 = 65535 & C3 | D2 << 16, t2[2] = z3 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = G3), K2 = B2 >>> 16, C3 = 65535 & (I3 = R2), D2 = I3 >>> 16, I3 = e2[3], K2 += (B2 = t2[3]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[3] = R2 = 65535 & C3 | D2 << 16, t2[3] = G3 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = j2), K2 = B2 >>> 16, C3 = 65535 & (I3 = F2), D2 = I3 >>> 16, I3 = e2[4], K2 += (B2 = t2[4]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[4] = F2 = 65535 & C3 | D2 << 16, t2[4] = j2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = V2), K2 = B2 >>> 16, C3 = 65535 & (I3 = T2), D2 = I3 >>> 16, I3 = e2[5], K2 += (B2 = t2[5]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[5] = T2 = 65535 & C3 | D2 << 16, t2[5] = V2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = q2), K2 = B2 >>> 16, C3 = 65535 & (I3 = L4), D2 = I3 >>> 16, I3 = e2[6], K2 += (B2 = t2[6]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[6] = L4 = 65535 & C3 | D2 << 16, t2[6] = q2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = _2), K2 = B2 >>> 16, C3 = 65535 & (I3 = N3), D2 = I3 >>> 16, I3 = e2[7], K2 += (B2 = t2[7]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[7] = N3 = 65535 & C3 | D2 << 16, t2[7] = _2 = 65535 & S2 | K2 << 16, Y2 += 128, n2 -= 128;
7097
+ for (E2 = 0; E2 < 80; E2++) if (i2 = x2, s2 = Q2, a2 = M3, o2 = R2, c2 = F2, u2 = T2, h2 = L4, N4, l2 = O2, y2 = H2, g2 = z3, p2 = G3, d2 = j2, A2 = V2, w2 = q2, _2, S2 = 65535 & (B2 = _2), K2 = B2 >>> 16, C3 = 65535 & (I3 = N4), D2 = I3 >>> 16, S2 += 65535 & (B2 = (j2 >>> 14 | F2 << 18) ^ (j2 >>> 18 | F2 << 14) ^ (F2 >>> 9 | j2 << 23)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (F2 >>> 14 | j2 << 18) ^ (F2 >>> 18 | j2 << 14) ^ (j2 >>> 9 | F2 << 23)), D2 += I3 >>> 16, S2 += 65535 & (B2 = j2 & V2 ^ ~j2 & q2), K2 += B2 >>> 16, C3 += 65535 & (I3 = F2 & T2 ^ ~F2 & L4), D2 += I3 >>> 16, S2 += 65535 & (B2 = Nl[2 * E2 + 1]), K2 += B2 >>> 16, C3 += 65535 & (I3 = Nl[2 * E2]), D2 += I3 >>> 16, I3 = U2[E2 % 16], K2 += (B2 = P3[E2 % 16]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16, S2 = 65535 & (B2 = k2 = 65535 & S2 | K2 << 16), K2 = B2 >>> 16, C3 = 65535 & (I3 = b2 = 65535 & C3 | (D2 += C3 >>> 16) << 16), D2 = I3 >>> 16, S2 += 65535 & (B2 = (O2 >>> 28 | x2 << 4) ^ (x2 >>> 2 | O2 << 30) ^ (x2 >>> 7 | O2 << 25)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (x2 >>> 28 | O2 << 4) ^ (O2 >>> 2 | x2 << 30) ^ (O2 >>> 7 | x2 << 25)), D2 += I3 >>> 16, K2 += (B2 = O2 & H2 ^ O2 & z3 ^ H2 & z3) >>> 16, C3 += 65535 & (I3 = x2 & Q2 ^ x2 & M3 ^ Q2 & M3), D2 += I3 >>> 16, f2 = 65535 & (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) | (D2 += C3 >>> 16) << 16, m2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = p2), K2 = B2 >>> 16, C3 = 65535 & (I3 = o2), D2 = I3 >>> 16, K2 += (B2 = k2) >>> 16, C3 += 65535 & (I3 = b2), D2 += I3 >>> 16, Q2 = i2, M3 = s2, R2 = a2, F2 = o2 = 65535 & (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) | (D2 += C3 >>> 16) << 16, T2 = c2, L4 = u2, N4 = h2, x2 = f2, H2 = l2, z3 = y2, G3 = g2, j2 = p2 = 65535 & S2 | K2 << 16, V2 = d2, q2 = A2, _2 = w2, O2 = m2, E2 % 16 == 15) for (v2 = 0; v2 < 16; v2++) I3 = U2[v2], S2 = 65535 & (B2 = P3[v2]), K2 = B2 >>> 16, C3 = 65535 & I3, D2 = I3 >>> 16, I3 = U2[(v2 + 9) % 16], S2 += 65535 & (B2 = P3[(v2 + 9) % 16]), K2 += B2 >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, b2 = U2[(v2 + 1) % 16], S2 += 65535 & (B2 = ((k2 = P3[(v2 + 1) % 16]) >>> 1 | b2 << 31) ^ (k2 >>> 8 | b2 << 24) ^ (k2 >>> 7 | b2 << 25)), K2 += B2 >>> 16, C3 += 65535 & (I3 = (b2 >>> 1 | k2 << 31) ^ (b2 >>> 8 | k2 << 24) ^ b2 >>> 7), D2 += I3 >>> 16, b2 = U2[(v2 + 14) % 16], K2 += (B2 = ((k2 = P3[(v2 + 14) % 16]) >>> 19 | b2 << 13) ^ (b2 >>> 29 | k2 << 3) ^ (k2 >>> 6 | b2 << 26)) >>> 16, C3 += 65535 & (I3 = (b2 >>> 19 | k2 << 13) ^ (k2 >>> 29 | b2 << 3) ^ b2 >>> 6), D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, U2[v2] = 65535 & C3 | D2 << 16, P3[v2] = 65535 & S2 | K2 << 16;
7098
+ S2 = 65535 & (B2 = O2), K2 = B2 >>> 16, C3 = 65535 & (I3 = x2), D2 = I3 >>> 16, I3 = e2[0], K2 += (B2 = t2[0]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[0] = x2 = 65535 & C3 | D2 << 16, t2[0] = O2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = H2), K2 = B2 >>> 16, C3 = 65535 & (I3 = Q2), D2 = I3 >>> 16, I3 = e2[1], K2 += (B2 = t2[1]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[1] = Q2 = 65535 & C3 | D2 << 16, t2[1] = H2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = z3), K2 = B2 >>> 16, C3 = 65535 & (I3 = M3), D2 = I3 >>> 16, I3 = e2[2], K2 += (B2 = t2[2]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[2] = M3 = 65535 & C3 | D2 << 16, t2[2] = z3 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = G3), K2 = B2 >>> 16, C3 = 65535 & (I3 = R2), D2 = I3 >>> 16, I3 = e2[3], K2 += (B2 = t2[3]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[3] = R2 = 65535 & C3 | D2 << 16, t2[3] = G3 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = j2), K2 = B2 >>> 16, C3 = 65535 & (I3 = F2), D2 = I3 >>> 16, I3 = e2[4], K2 += (B2 = t2[4]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[4] = F2 = 65535 & C3 | D2 << 16, t2[4] = j2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = V2), K2 = B2 >>> 16, C3 = 65535 & (I3 = T2), D2 = I3 >>> 16, I3 = e2[5], K2 += (B2 = t2[5]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[5] = T2 = 65535 & C3 | D2 << 16, t2[5] = V2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = q2), K2 = B2 >>> 16, C3 = 65535 & (I3 = L4), D2 = I3 >>> 16, I3 = e2[6], K2 += (B2 = t2[6]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[6] = L4 = 65535 & C3 | D2 << 16, t2[6] = q2 = 65535 & S2 | K2 << 16, S2 = 65535 & (B2 = _2), K2 = B2 >>> 16, C3 = 65535 & (I3 = N4), D2 = I3 >>> 16, I3 = e2[7], K2 += (B2 = t2[7]) >>> 16, C3 += 65535 & I3, D2 += I3 >>> 16, D2 += (C3 += (K2 += (S2 += 65535 & B2) >>> 16) >>> 16) >>> 16, e2[7] = N4 = 65535 & C3 | D2 << 16, t2[7] = _2 = 65535 & S2 | K2 << 16, Y2 += 128, n2 -= 128;
7099
7099
  }
7100
7100
  return n2;
7101
7101
  }
@@ -8815,10 +8815,10 @@ var init_openpgp_min = __esm({
8815
8815
  for (I3 = 0; I3 < C3; ++I3) ys(t2, h2 + 3 * I3, S2[zi[I3]]);
8816
8816
  h2 += 3 * C3;
8817
8817
  for (var T2 = [w2, k2], L4 = 0; L4 < 2; ++L4) {
8818
- var N3 = T2[L4];
8819
- for (I3 = 0; I3 < N3.length; ++I3) {
8820
- var O2 = 31 & N3[I3];
8821
- ys(t2, h2, F2[O2]), h2 += S2[O2], O2 > 15 && (ys(t2, h2, N3[I3] >> 5 & 127), h2 += N3[I3] >> 12);
8818
+ var N4 = T2[L4];
8819
+ for (I3 = 0; I3 < N4.length; ++I3) {
8820
+ var O2 = 31 & N4[I3];
8821
+ ys(t2, h2, F2[O2]), h2 += S2[O2], O2 > 15 && (ys(t2, h2, N4[I3] >> 5 & 127), h2 += N4[I3] >> 12);
8822
8822
  }
8823
8823
  }
8824
8824
  } else D2 = rs, U2 = es, P3 = is, x2 = ts;
@@ -8867,7 +8867,7 @@ var init_openpgp_min = __esm({
8867
8867
  for (Q2 = 0; Q2 < 30; ++Q2) E2[Q2] = 0;
8868
8868
  }
8869
8869
  var M3 = 2, R2 = 0, F2 = y2, T2 = U2 - P3 & 32767;
8870
- if (x2 > 2 && D2 == m2(B2 - T2)) for (var L4 = Math.min(l2, x2) - 1, N3 = Math.min(32767, B2), O2 = Math.min(258, x2); T2 <= N3 && --F2 && U2 != P3; ) {
8870
+ if (x2 > 2 && D2 == m2(B2 - T2)) for (var L4 = Math.min(l2, x2) - 1, N4 = Math.min(32767, B2), O2 = Math.min(258, x2); T2 <= N4 && --F2 && U2 != P3; ) {
8871
8871
  if (e3[B2 + M3] == e3[B2 + M3 - T2]) {
8872
8872
  for (var H2 = 0; H2 < O2 && e3[B2 + H2] == e3[B2 + H2 - T2]; ++H2) ;
8873
8873
  if (H2 > M3) {
@@ -9004,10 +9004,10 @@ var init_openpgp_min = __esm({
9004
9004
  T2 = h2, l2 = null;
9005
9005
  break;
9006
9006
  }
9007
- var N3 = L4 - 254;
9007
+ var N4 = L4 - 254;
9008
9008
  if (L4 > 264) {
9009
9009
  var O2 = Oi[B2 = L4 - 257];
9010
- N3 = os(e4, h2, (1 << O2) - 1) + Vi[B2], h2 += O2;
9010
+ N4 = os(e4, h2, (1 << O2) - 1) + Vi[B2], h2 += O2;
9011
9011
  }
9012
9012
  var H2 = y2[cs(e4, h2) & F2], z3 = H2 >> 4;
9013
9013
  if (H2 || ls(3), h2 += 15 & H2, M3 = Yi[z3], z3 > 3 && (O2 = Hi[z3], M3 += cs(e4, h2) & (1 << O2) - 1, h2 += O2), h2 > d2) {
@@ -9015,7 +9015,7 @@ var init_openpgp_min = __esm({
9015
9015
  break;
9016
9016
  }
9017
9017
  a2 && c2(f2 + 131072);
9018
- var G3 = f2 + N3;
9018
+ var G3 = f2 + N4;
9019
9019
  if (f2 < M3) {
9020
9020
  var j2 = 0 - M3, V2 = Math.min(M3, G3);
9021
9021
  for (j2 + f2 < 0 && ls(3); f2 < V2; ++f2) r3[f2] = n2[j2 + f2];
@@ -24051,12 +24051,12 @@ function describe(description) {
24051
24051
  return ch2;
24052
24052
  }
24053
24053
  // @__NO_SIDE_EFFECTS__
24054
- function meta(metadata2) {
24054
+ function meta(metadata) {
24055
24055
  const ch2 = new $ZodCheck({ check: "meta" });
24056
24056
  ch2._zod.onattach = [
24057
24057
  (inst) => {
24058
24058
  const existing = globalRegistry.get(inst) ?? {};
24059
- globalRegistry.add(inst, { ...existing, ...metadata2 });
24059
+ globalRegistry.add(inst, { ...existing, ...metadata });
24060
24060
  }
24061
24061
  ];
24062
24062
  ch2._zod.check = () => {
@@ -29741,7 +29741,7 @@ var NeedsFencedPublicationError = class extends Error {
29741
29741
  }
29742
29742
  };
29743
29743
  var sameHash = (a2, b2) => a2.toLowerCase() === b2.toLowerCase();
29744
- function metadata(scope, collectedAt, sizeBytes) {
29744
+ function publicationMetadataHash(scope, collectedAt, sizeBytes) {
29745
29745
  return keccak256(stringToHex(JSON.stringify({ scope, collectedAt, sizeBytes })));
29746
29746
  }
29747
29747
  async function publishVersion(options) {
@@ -29753,7 +29753,7 @@ async function publishVersion(options) {
29753
29753
  function candidate(env, bytes, hash3) {
29754
29754
  return {
29755
29755
  dataHash: hash3,
29756
- metadataHash: metadata(scope, env.collectedAt, bytes.byteLength),
29756
+ metadataHash: publicationMetadataHash(scope, env.collectedAt, bytes.byteLength),
29757
29757
  sizeBytes: bytes.byteLength,
29758
29758
  lineage: readStoredLineage(env.data)
29759
29759
  };
@@ -29783,13 +29783,20 @@ async function publishVersion(options) {
29783
29783
  }
29784
29784
  async function publishPreparedVersion(options) {
29785
29785
  const { scope, storageAdapter, fencedPublication, signer } = options;
29786
+ const signal = options.signal;
29787
+ const checkpoint = () => signal?.throwIfAborted();
29788
+ const sig = signal ? [signal] : [];
29789
+ const opts = signal ? [{ signal }] : [];
29790
+ checkpoint();
29786
29791
  const isDeleted = (row) => Boolean(row.deletedAt) || isTombstoneRecord(row);
29787
29792
  let fence = await fencedPublication?.read({
29788
29793
  ownerAddress: options.ownerAddress,
29789
- scope
29794
+ scope,
29795
+ signal
29790
29796
  });
29791
29797
  let head = fence ? fence.head : options.head;
29792
29798
  await options.checkHead?.(head ?? null);
29799
+ const sealed = (write) => options.legacyWriteSeal ? options.legacyWriteSeal.commit(write) : write();
29793
29800
  function requireFence(reason) {
29794
29801
  if (!fence)
29795
29802
  throw new NeedsFencedPublicationError(scope, reason);
@@ -29805,13 +29812,15 @@ async function publishPreparedVersion(options) {
29805
29812
  }
29806
29813
  checkDeletion();
29807
29814
  const { encrypted, wanted, verifyStored } = await options.prepare();
29815
+ checkpoint();
29808
29816
  const wantedHash = wanted.dataHash;
29809
29817
  const keyUrl = (version5) => storageAdapter.urlForKey(`${scope}/${version5}`);
29810
29818
  async function readCandidate(version5) {
29811
- const bytes = await storageAdapter.download(keyUrl(version5));
29819
+ const bytes = await storageAdapter.download(keyUrl(version5), ...sig);
29812
29820
  return verifyStored(bytes);
29813
29821
  }
29814
29822
  async function commit(version5, value, mode) {
29823
+ checkpoint();
29815
29824
  const request = {
29816
29825
  ownerAddress: options.ownerAddress,
29817
29826
  scope,
@@ -29842,15 +29851,17 @@ async function publishPreparedVersion(options) {
29842
29851
  })
29843
29852
  };
29844
29853
  }
29854
+ checkpoint();
29845
29855
  let id;
29846
29856
  if (fencedPublication) {
29847
29857
  const previous = requireFence("registration/adoption");
29848
- const result = await fencedPublication.commit({
29858
+ const result = await sealed(() => fencedPublication.commit({
29849
29859
  ...request,
29850
29860
  ...lineageFields,
29851
29861
  mode,
29852
- fence: previous
29853
- });
29862
+ fence: previous,
29863
+ signal
29864
+ }));
29854
29865
  const registered = result.fence.head;
29855
29866
  if (result.fence.generation !== previous.generation || !registered || isDeleted(registered) || registered.expectedVersion !== String(version5) || !sameHash(registered.dataHash, value.dataHash) || !sameHash(registered.metadataHash, value.metadataHash) || registered.id !== result.dataPointId)
29856
29867
  throw new Error("Gateway returned inconsistent publication evidence");
@@ -29860,10 +29871,7 @@ async function publishPreparedVersion(options) {
29860
29871
  } else if (mode === "adopt") {
29861
29872
  id = head?.id;
29862
29873
  } else {
29863
- const result = lineageFields ? await options.lineageGateway.registerDataPoint({
29864
- ...request,
29865
- ...lineageFields
29866
- }) : await options.gateway.registerDataPoint(request);
29874
+ const result = await sealed(() => lineageFields ? options.lineageGateway.registerDataPoint({ ...request, ...lineageFields }, ...opts) : options.gateway.registerDataPoint(request, ...opts));
29867
29875
  id = result.dataPointId;
29868
29876
  }
29869
29877
  if (!id)
@@ -29880,16 +29888,18 @@ async function publishPreparedVersion(options) {
29880
29888
  let version4 = head === void 0 ? options.preferredVersion : BigInt(head?.expectedVersion ?? "0") + 1n;
29881
29889
  let rebased = false;
29882
29890
  for (let step = 0; step < 4; step++) {
29891
+ checkpoint();
29883
29892
  checkDeletion();
29884
29893
  if (head && !isDeleted(head) && sameHash(head.dataHash, wantedHash)) {
29885
29894
  version4 = BigInt(head.expectedVersion);
29886
29895
  const url2 = keyUrl(version4);
29887
- if (!await storageAdapter.exists(url2)) {
29896
+ if (!await storageAdapter.exists(url2, ...sig)) {
29888
29897
  requireFence("healing a committed version's missing bytes");
29889
29898
  if (!sameHash(wanted.metadataHash, head.metadataHash))
29890
29899
  throw new Error("Missing committed blob cannot be healed: metadata commitment mismatch");
29900
+ checkpoint();
29891
29901
  try {
29892
- await storageAdapter.upload(`${scope}/${version4}`, encrypted);
29902
+ await sealed(() => storageAdapter.upload(`${scope}/${version4}`, encrypted, ...sig));
29893
29903
  } catch (error51) {
29894
29904
  if (!(error51 instanceof StoredBlobConflictError))
29895
29905
  throw error51;
@@ -29906,7 +29916,7 @@ async function publishPreparedVersion(options) {
29906
29916
  version4 = BigInt(head.expectedVersion) + 1n;
29907
29917
  let value = wanted;
29908
29918
  try {
29909
- await storageAdapter.upload(`${scope}/${version4}`, encrypted);
29919
+ await sealed(() => storageAdapter.upload(`${scope}/${version4}`, encrypted, ...sig));
29910
29920
  } catch (error51) {
29911
29921
  if (!(error51 instanceof StoredBlobConflictError))
29912
29922
  throw error51;
@@ -30144,9 +30154,97 @@ function isReplicaScope(scope) {
30144
30154
  return scope === REPLICA_SCOPE_PREFIX || scope.startsWith(`${REPLICA_SCOPE_PREFIX}.`);
30145
30155
  }
30146
30156
 
30157
+ // ../stream-sync/dist/json.js
30158
+ var JSON_CHUNK_UNITS = 32 * 1024;
30159
+
30160
+ // ../stream-sync/dist/bytes.js
30161
+ var encoder3 = new TextEncoder();
30162
+ function utf8Length(text) {
30163
+ let bytes = 0;
30164
+ for (let i2 = 0; i2 < text.length; i2 += 1) {
30165
+ const unit = text.charCodeAt(i2);
30166
+ if (unit < 128)
30167
+ bytes += 1;
30168
+ else if (unit < 2048)
30169
+ bytes += 2;
30170
+ else if (unit >= 55296 && unit <= 56319 && i2 + 1 < text.length) {
30171
+ const next = text.charCodeAt(i2 + 1);
30172
+ if (next >= 56320 && next <= 57343) {
30173
+ bytes += 4;
30174
+ i2 += 1;
30175
+ } else
30176
+ bytes += 3;
30177
+ } else
30178
+ bytes += 3;
30179
+ }
30180
+ return bytes;
30181
+ }
30182
+ var HEX_PAIRS = Array.from({ length: 256 }, (_2, byte) => byte.toString(16).padStart(2, "0"));
30183
+ var HEX16 = /^[0-9a-f]{16}$/;
30184
+ var MiB = 1024 * 1024;
30185
+ var DEFAULT_PART_TARGET_BYTES = 4 * MiB;
30186
+ var HEAD_LIMIT_BYTES = 1 * MiB;
30187
+ var PART_LIMIT_BYTES = 16 * MiB;
30188
+ var NAME_LIMIT_BYTES = 256;
30189
+ var FRAME_SMALL_BYTES = 1 * MiB;
30190
+
30191
+ // ../stream-sync/dist/names.js
30192
+ var SCOPE_PREFIX = "pdpp.";
30193
+ function parseScope(name) {
30194
+ if (!name.startsWith(SCOPE_PREFIX))
30195
+ return null;
30196
+ if (utf8Length(name) > NAME_LIMIT_BYTES)
30197
+ return null;
30198
+ const rest = name.slice(SCOPE_PREFIX.length);
30199
+ const tilde = rest.indexOf("~");
30200
+ if (tilde <= 0)
30201
+ return null;
30202
+ const connector = rest.slice(0, tilde);
30203
+ let tail = rest.slice(tilde + 1);
30204
+ let ns2 = "";
30205
+ const candidate = tail.slice(0, 16);
30206
+ if (HEX16.test(candidate)) {
30207
+ ns2 = candidate;
30208
+ tail = tail.slice(16);
30209
+ }
30210
+ if (tail === "")
30211
+ return { kind: "control", connector, ns: ns2 };
30212
+ if (tail[0] !== "." || tail.length === 1)
30213
+ return null;
30214
+ return { kind: "stream", connector, ns: ns2, stream: tail.slice(1) };
30215
+ }
30216
+
30217
+ // ../stream-sync/dist/master-key.js
30218
+ var N3 = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
30219
+ var HALF_N = N3 >> 1n;
30220
+
30221
+ // ../stream-sync/dist/parts.js
30222
+ var decoder = new TextDecoder("utf-8", { fatal: true });
30223
+
30224
+ // ../stream-sync/dist/head.js
30225
+ var decoder2 = new TextDecoder("utf-8", { fatal: true });
30226
+
30227
+ // ../stream-sync/dist/frames.js
30228
+ var textDecoder2 = new TextDecoder("utf-8", { fatal: true });
30229
+
30230
+ // ../stream-sync/dist/part-frames.js
30231
+ var textDecoder3 = new TextDecoder();
30232
+
30233
+ // ../stream-sync/dist/log.js
30234
+ var BLOB_BYTES_PER_MS = Math.round(4 * 1024 * 1024 / 360);
30235
+ var decoder3 = new TextDecoder("utf-8", { fatal: true });
30236
+
30237
+ // ../core/dist/stream-sync/scope-routing.js
30238
+ function isPhysicalScope(name) {
30239
+ return parseScope(name) !== null || name.includes("~");
30240
+ }
30241
+
30147
30242
  // ../core/dist/policy/reserved-scopes.js
30243
+ function isReservedSystemScope(scope) {
30244
+ return scope.startsWith("vana.system.") || /^pdpp\.vana-system-[^.~]+(?:[.~]|$)/.test(scope);
30245
+ }
30148
30246
  function isSystemScope(scope) {
30149
- return scope.startsWith("vana.system.") || isReplicaScope(scope);
30247
+ return isReservedSystemScope(scope) || isReplicaScope(scope) || isPhysicalScope(scope);
30150
30248
  }
30151
30249
 
30152
30250
  // ../core/dist/additions/durable.js
@@ -30228,7 +30326,7 @@ function sameInventory(a2, b2) {
30228
30326
  function settled(slot) {
30229
30327
  return slot.status === "confirmed" || slot.status === "finalized";
30230
30328
  }
30231
- function eligible(slot) {
30329
+ function eligible2(slot) {
30232
30330
  return !slot.isTombstone && ["confirmed", "finalized", "pending", "submitting"].includes(slot.status);
30233
30331
  }
30234
30332
  function sourceWindow(snapshot) {
@@ -30247,7 +30345,7 @@ function findCheckpointRegistration(snapshot, version4, commitment) {
30247
30345
  const { end, after } = sourceWindow(snapshot);
30248
30346
  if (BigInt(version4) > end || BigInt(version4) <= after)
30249
30347
  return void 0;
30250
- return snapshot.versions.find((row) => row.expectedVersion === version4 && eligible(row) && row.dataHash.toLowerCase() === commitment.dataHash.toLowerCase() && row.metadataHash.toLowerCase() === commitment.metadataHash.toLowerCase());
30348
+ return snapshot.versions.find((row) => row.expectedVersion === version4 && eligible2(row) && row.dataHash.toLowerCase() === commitment.dataHash.toLowerCase() && row.metadataHash.toLowerCase() === commitment.metadataHash.toLowerCase());
30251
30349
  }
30252
30350
  function sourceData(data) {
30253
30351
  if (data === null || typeof data !== "object" || Array.isArray(data))
@@ -30318,7 +30416,7 @@ function createDurableAdditions(options) {
30318
30416
  for (let index = snapshot.versions.length - 1; index >= 0; index--) {
30319
30417
  budget.check();
30320
30418
  const slot = snapshot.versions[index];
30321
- if (BigInt(slot.expectedVersion) <= BigInt(boundary) || BigInt(slot.expectedVersion) > BigInt(snapshot.head.expectedVersion) || search && BigInt(slot.expectedVersion) >= BigInt(search.before) || !eligible(slot))
30419
+ if (BigInt(slot.expectedVersion) <= BigInt(boundary) || BigInt(slot.expectedVersion) > BigInt(snapshot.head.expectedVersion) || search && BigInt(slot.expectedVersion) >= BigInt(search.before) || !eligible2(slot))
30322
30420
  continue;
30323
30421
  const identity = JSON.stringify([
30324
30422
  systemScope,
@@ -30366,7 +30464,7 @@ function createDurableAdditions(options) {
30366
30464
  continue;
30367
30465
  }
30368
30466
  const candidate = { ...parsed.data, ledger };
30369
- if (candidate.slots.length > relevant.length || !candidate.slots.every((row, i2) => eligible(relevant[i2]) && sameCommitment(row, relevant[i2])) || candidate.through !== (candidate.slots.at(-1)?.expectedVersion ?? String(after))) {
30467
+ if (candidate.slots.length > relevant.length || !candidate.slots.every((row, i2) => eligible2(relevant[i2]) && sameCommitment(row, relevant[i2])) || candidate.through !== (candidate.slots.at(-1)?.expectedVersion ?? String(after))) {
30370
30468
  budget.checkpoints.rejected.set(identity, "invalid");
30371
30469
  continue;
30372
30470
  }
@@ -30490,7 +30588,7 @@ function createDurableAdditions(options) {
30490
30588
  unitBudget.check();
30491
30589
  if (BigInt(slot.expectedVersion) !== BigInt(through) + 1n)
30492
30590
  coverage = "partial";
30493
- if (!eligible(slot)) {
30591
+ if (!eligible2(slot)) {
30494
30592
  coverage = "partial";
30495
30593
  break;
30496
30594
  }
@@ -30498,12 +30596,12 @@ function createDurableAdditions(options) {
30498
30596
  const proof = uploaded?.proof;
30499
30597
  const inMemory = proof ? DataFileEnvelopeSchema.safeParse(proof.envelope) : null;
30500
30598
  const bytes = proof ? new TextEncoder().encode(JSON.stringify(proof.envelope)) : null;
30501
- const metadata2 = inMemory?.success && proof ? keccak256(stringToHex(JSON.stringify({
30599
+ const metadata = inMemory?.success && proof ? keccak256(stringToHex(JSON.stringify({
30502
30600
  scope,
30503
30601
  collectedAt: inMemory.data.collectedAt,
30504
30602
  sizeBytes: proof.encryptedSize
30505
30603
  }))) : null;
30506
- if (inMemory?.success && bytes && inMemory.data.scope === scope && keccak256(bytes) === slot.dataHash && metadata2 === slot.metadataHash) {
30604
+ if (inMemory?.success && bytes && inMemory.data.scope === scope && keccak256(bytes) === slot.dataHash && metadata === slot.metadataHash) {
30507
30605
  const data = sourceData(inMemory.data.data);
30508
30606
  if (!data)
30509
30607
  throw new AdditionsRecoveryError("unsupported_source_data");
@@ -1,8 +1,13 @@
1
+ import { type LocalSync, type SeedIntake, type ViewChangeListener } from "@opendatalabs/personal-server-ts-core/localdb";
1
2
  import type { ReplicationDoorStatus } from "@opendatalabs/personal-server-ts-core/replication/door";
2
3
  import type { DeclarationSnapshot } from "@opendatalabs/personal-server-ts-core/pdpp";
4
+ import type { RunIntake } from "@opendatalabs/personal-server-ts-core/stream-sync";
5
+ import type { SyncStatus } from "@opendatalabs/personal-server-ts-core/sync";
3
6
  import { type LiteReplication } from "./replication-host.js";
4
7
  import type { LiteReplicaObjectTransfers, LiteReplicaPersistence, ReplicationBootConfig } from "./replication-ports.js";
5
8
  import type { ServerConfig } from "@opendatalabs/personal-server-ts-core/schemas";
9
+ import { type ImportRunner, type ImportWaker, type ModeAuthority, type ModeRecordStore } from "@opendatalabs/personal-server-ts-core/sync/account-mode";
10
+ import { type LegacyWriteSeal } from "@opendatalabs/personal-server-ts-core/storage/legacy-write-seal";
6
11
  import type { Logger } from "@opendatalabs/personal-server-ts-core/logger";
7
12
  import type { InferenceProvider } from "@opendatalabs/personal-server-ts-core/derivatives";
8
13
  import type { AccessLogReader } from "@opendatalabs/personal-server-ts-core/logging/access-reader";
@@ -15,6 +20,21 @@ import { type PsLiteOwnerSyncSigner, type PsLiteSyncOptions } from "./sync.js";
15
20
  import { type PsLitePersistenceBundle } from "./persistence.js";
16
21
  export interface IndexedDbPsLiteRuntimeOptions extends Omit<PsLiteRuntimeOptions, "accessLogReader" | "accessLogWriter" | "config" | "identity" | "saveConfig" | "stateCapabilities" | "storage" | "tokenStore"> {
17
22
  ownerAddress?: `0x${string}`;
23
+ /** Host-owned local database, shared by stream intake and reads. */
24
+ localDb?: PsLiteSyncOptions["localDb"];
25
+ localDbDeviceId?: PsLiteSyncOptions["localDbDeviceId"];
26
+ /**
27
+ * Where the account-mode module keeps its per-owner records. Default: its
28
+ * own IndexedDB database next to the data store's. A host with another
29
+ * durable place (a native bundle) injects a store.
30
+ */
31
+ accountModeStore?: ModeRecordStore;
32
+ /**
33
+ * The host's legacy importer. The runtime runs it when the Account says On
34
+ * and once at boot when the owner is already switched; what is owed and when
35
+ * it is done is the importer's own record. Without one no import starts.
36
+ */
37
+ legacyImporter?: ImportRunner;
18
38
  /**
19
39
  * Inference provider for the derivative compute layer. Defaults to the
20
40
  * OpenAI-compatible fetch client on `config.inference`; tests inject a
@@ -23,6 +43,8 @@ export interface IndexedDbPsLiteRuntimeOptions extends Omit<PsLiteRuntimeOptions
23
43
  inferenceProvider?: InferenceProvider;
24
44
  ownerSignature: `0x${string}`;
25
45
  ownerSyncSigner?: PsLiteOwnerSyncSigner;
46
+ /** Closed until incoming-server registration commits; initial sync only pulls. */
47
+ registrationReady?: () => boolean;
26
48
  additionsWorkerFactory?: PsLiteSyncOptions["additionsWorkerFactory"];
27
49
  dbName?: string;
28
50
  stateStoreName?: string;
@@ -38,6 +60,20 @@ export interface IndexedDbPsLiteRuntimeOptions extends Omit<PsLiteRuntimeOptions
38
60
  * feed on the configured gateway URL; inject with a mock `gateway` in tests.
39
61
  */
40
62
  dataPointFeed?: DataPointFeedPort;
63
+ /**
64
+ * Artifact digest -> stream declarations, filled by the host after it
65
+ * verified each artifact. The run intake trusts only this table; with none
66
+ * given, every digest answers `unknown_artifact`. Admission follows Account mode.
67
+ */
68
+ streamSyncDeclarations?: PsLiteSyncOptions["streamSyncDeclarations"];
69
+ streamSyncRegistry?: PsLiteSyncOptions["streamSyncRegistry"];
70
+ streamSyncBlobs?: PsLiteSyncOptions["streamSyncBlobs"];
71
+ /** Retained manifest documents for the delete fence; see `PsLiteSyncOptions`. */
72
+ streamSyncRetainedManifests?: PsLiteSyncOptions["streamSyncRetainedManifests"];
73
+ /** Stream-sync design flags, default off; see `PsLiteSyncOptions`. */
74
+ streamSyncPublishWhileCollecting?: PsLiteSyncOptions["streamSyncPublishWhileCollecting"];
75
+ streamSyncProgressiveFirstLoad?: PsLiteSyncOptions["streamSyncProgressiveFirstLoad"];
76
+ streamSyncFlags?: PsLiteSyncOptions["streamSyncFlags"];
41
77
  /**
42
78
  * The host's replication ports (host contract §4): native persistence
43
79
  * with replica support and native object transfers. With the door on and
@@ -59,8 +95,12 @@ export interface IndexedDbPsLiteRuntimeOptions extends Omit<PsLiteRuntimeOptions
59
95
  * identity/config/sync/auth/signer composition. This is all-or-nothing:
60
96
  * either omit it for the default Web IndexedDB/OPFS path, or provide every
61
97
  * port for a host-owned persistence implementation.
98
+ *
99
+ * A host may supply storageFactory to construct storage using the runtime seal.
62
100
  */
63
- persistence?: PsLitePersistenceBundle;
101
+ persistence?: Omit<PsLitePersistenceBundle, "storage"> & Partial<Pick<PsLitePersistenceBundle, "storage">>;
102
+ /** Constructs host storage with the runtime's account-mode seal. */
103
+ storageFactory?: (seal: LegacyWriteSeal) => DataStoragePort | Promise<DataStoragePort>;
64
104
  }
65
105
  export interface IndexedDbPsLiteRuntime {
66
106
  runtime: PsLiteRuntime;
@@ -71,12 +111,59 @@ export interface IndexedDbPsLiteRuntime {
71
111
  tokenStore: PsLiteRuntimeOptions["tokenStore"];
72
112
  accessLogStore: AccessLogReader & AccessLogWriter;
73
113
  syncManager: PsLiteRuntimeOptions["syncManager"];
114
+ /**
115
+ * Calls `listener` with the new sync status after each change of it: a cycle
116
+ * starting or ending, the first sync finishing with no data, an error, the
117
+ * pending count moving. Pass it what `syncManager.getStatus()` returns, so a
118
+ * host that shows sync state needs no timer. Works before the manager
119
+ * starts; the subscription stays when the manager stops and starts again.
120
+ * Returns the unsubscribe; with no sync manager it hears nothing.
121
+ *
122
+ * Do not call `syncManager.trigger()` on every event: each cycle changes
123
+ * `lastSync`, so each ends with an event that would start the next, and
124
+ * nothing bounds that loop. Trigger only on a change the listener acts on.
125
+ *
126
+ * Unsubscribe before `closeStreamSync`. If the caller forgot, `closeStreamSync`
127
+ * removes every subscription this runtime made from the manager, at its
128
+ * start and before it awaits, and no listener is called after that. A
129
+ * subscribe after close registers nothing. Subscriptions other users made
130
+ * on an injected manager stay.
131
+ */
132
+ subscribeSyncStatus(listener: (status: SyncStatus) => void): () => void;
133
+ /** Database facade when a host driver is supplied and available. */
134
+ localSync?: LocalSync | null;
135
+ /** Lazily open the database after Account mode is known. */
136
+ getLocalSync?(): Promise<LocalSync>;
137
+ /**
138
+ * Calls `listener` once after each operation that changed what the local
139
+ * database serves: records applied, purged or deleted, connections added
140
+ * or removed, control state moved. An operation that changed nothing
141
+ * (an idle cycle, a publish) is silent. The event names the changed
142
+ * connection ids and carries no record data; re-read what you show. Works
143
+ * before the database opens. Returns the unsubscribe.
144
+ */
145
+ subscribeViewChanges(listener: ViewChangeListener): () => void;
146
+ /** Stop the sync manager before releasing its owner/network database. */
147
+ closeStreamSync?(): Promise<void>;
148
+ /**
149
+ * The database run intake for host code; admission follows Account mode.
150
+ */
151
+ streamSyncIntake: RunIntake | null;
152
+ streamSyncSeed: SeedIntake | null;
74
153
  /** The compute layer; hosts call `scheduler.stop()` on teardown. */
75
154
  derivatives: PsLiteRuntimeOptions["derivatives"];
76
155
  /** This boot's replication door, from `resolveLiteReplication`. */
77
156
  replication: ReplicationDoorStatus;
78
157
  /** Replication built over `replicaHost`, when the host passed it. */
79
158
  replicationHost?: LiteReplication;
159
+ /**
160
+ * The account-mode module. Web code gives it the Account's answer with
161
+ * `submitEvidence` before it starts the first collection. On teardown call
162
+ * `importWaker.stop()` first, then close the storage, then `close()`.
163
+ */
164
+ accountModeAuthority: ModeAuthority;
165
+ /** Wakes the host's importer; present when the host passed `legacyImporter`. */
166
+ importWaker?: ImportWaker;
80
167
  }
81
168
  export declare function createIndexedDbPsLiteRuntime(options: IndexedDbPsLiteRuntimeOptions): Promise<IndexedDbPsLiteRuntime>;
82
169
  //# sourceMappingURL=browser-runtime.d.ts.map