@katlux/providers 0.1.1-alpha.111 → 0.1.1-alpha.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -239,29 +239,6 @@ class ADataProvider {
239
239
  deduplicate = true;
240
240
  context = null;
241
241
  urlPageParam = "";
242
- _selectedRows = [];
243
- get selectedRows() {
244
- return this._selectedRows;
245
- }
246
- set selectedRows(val) {
247
- this._selectedRows = Array.isArray(val) ? val : [];
248
- this._pendingChangedKeys.add("selectedRows");
249
- this.notify();
250
- }
251
- _selectAll = false;
252
- get selectAll() {
253
- return this._selectAll;
254
- }
255
- set selectAll(val) {
256
- if (this._selectAll !== val) {
257
- this._selectAll = val;
258
- this._pendingChangedKeys.add("selectAll");
259
- this.notify();
260
- }
261
- }
262
- getSelectedRows() {
263
- return this._selectAll ? this.pageData : this._selectedRows;
264
- }
265
242
  _currentPage = 1;
266
243
  _pageSize = 10;
267
244
  _filter = null;
@@ -342,10 +319,6 @@ class ADataProvider {
342
319
  const sortDebounceTime = typeof options?.sortDebounce === "number" ? options.sortDebounce : 200;
343
320
  this._debouncedFilterLoad = useDebounce(() => {
344
321
  this._currentPage = 1;
345
- this._selectAll = false;
346
- this._selectedRows = [];
347
- this._pendingChangedKeys.add("selectAll");
348
- this._pendingChangedKeys.add("selectedRows");
349
322
  this.loadPageData();
350
323
  }, filterDebounceTime);
351
324
  this._debouncedSortLoad = useDebounce(() => {
@@ -356,8 +329,6 @@ class ADataProvider {
356
329
  this.setSortList = this.setSortList.bind(this);
357
330
  this.setCurrentPage = this.setCurrentPage.bind(this);
358
331
  this.setPageSize = this.setPageSize.bind(this);
359
- this.setSelectedRows = this.setSelectedRows.bind(this);
360
- this.setSelectAll = this.setSelectAll.bind(this);
361
332
  this.loadPageData = this.loadPageData.bind(this);
362
333
  this.refresh = this.refresh.bind(this);
363
334
  this.subscribe = this.subscribe.bind(this);
@@ -459,9 +430,7 @@ class ADataProvider {
459
430
  initialLoad: this.initialLoad,
460
431
  error: this.error,
461
432
  filter: this._filter,
462
- sortList: this._sortList,
463
- selectedRows: this.selectedRows,
464
- selectAll: this.selectAll
433
+ sortList: this._sortList
465
434
  };
466
435
  }
467
436
  onFilterUpdated() {
@@ -493,14 +462,6 @@ class ADataProvider {
493
462
  this._pendingChangedKeys.add("currentPage");
494
463
  needsLoad = true;
495
464
  }
496
- if (partial.selectedRows !== void 0) {
497
- this._selectedRows = Array.isArray(partial.selectedRows) ? partial.selectedRows : [];
498
- this._pendingChangedKeys.add("selectedRows");
499
- }
500
- if (partial.selectAll !== void 0 && partial.selectAll !== this._selectAll) {
501
- this._selectAll = partial.selectAll;
502
- this._pendingChangedKeys.add("selectAll");
503
- }
504
465
  if (needsLoad) {
505
466
  if (options?.immediate) {
506
467
  this.cancelPending();
@@ -516,8 +477,7 @@ class ADataProvider {
516
477
  currentPage: this._currentPage,
517
478
  pageSize: this._pageSize,
518
479
  filter: this._filter,
519
- sortList: this._sortList,
520
- selectAll: this._selectAll
480
+ sortList: this._sortList
521
481
  };
522
482
  return JSON.stringify(state);
523
483
  }
@@ -540,12 +500,8 @@ class ADataProvider {
540
500
  this._filter = filter;
541
501
  this.onFilterUpdated();
542
502
  this._currentPage = 1;
543
- this._selectAll = false;
544
- this._selectedRows = [];
545
503
  this._pendingChangedKeys.add("filter");
546
504
  this._pendingChangedKeys.add("currentPage");
547
- this._pendingChangedKeys.add("selectAll");
548
- this._pendingChangedKeys.add("selectedRows");
549
505
  if (immediate) {
550
506
  this._debouncedFilterLoad?.cancel?.();
551
507
  this.loadPageData();
@@ -568,9 +524,7 @@ class ADataProvider {
568
524
  }
569
525
  setCurrentPage(currentPage) {
570
526
  this._currentPage = currentPage;
571
- this._selectAll = false;
572
527
  this._pendingChangedKeys.add("currentPage");
573
- this._pendingChangedKeys.add("selectAll");
574
528
  this.loadPageData();
575
529
  if (typeof window !== "undefined" && this.urlPageParam) {
576
530
  try {
@@ -600,12 +554,6 @@ class ADataProvider {
600
554
  this.loadPageData();
601
555
  this.notify();
602
556
  }
603
- setSelectedRows(rows) {
604
- this.selectedRows = rows;
605
- }
606
- setSelectAll(val) {
607
- this.selectAll = val;
608
- }
609
557
  async refresh(hardRefresh = false) {
610
558
  await this.loadPageData({ disableCache: hardRefresh });
611
559
  }
@@ -699,6 +647,14 @@ function getKeyIdentifier(keyProvider, defaultKey) {
699
647
  const target = keyProvider ?? defaultKey;
700
648
  return getSafeKeyIdentifier(target);
701
649
  }
650
+ function isAuthOrDecryptionError(err) {
651
+ if (!err) return false;
652
+ if (err.name === "OperationError") return true;
653
+ if (err.code === "ERR_CRYPTO_OPERATION_FAILED" || err.code === "ERR_OSSL_EVP_BAD_DECRYPT") return true;
654
+ if (err.cause && isAuthOrDecryptionError(err.cause)) return true;
655
+ const msg = String(err.message || "").toLowerCase();
656
+ return msg.includes("operationerror") || msg.includes("decrypt") || msg.includes("tag") || msg.includes("aad") || msg.includes("authenticated additional data") || msg.includes("authenticate data") || msg.includes("mac");
657
+ }
702
658
 
703
659
  class AEncryptionProvider {
704
660
  defaultKey;
@@ -777,6 +733,57 @@ class AEncryptionProvider {
777
733
  async [Symbol.asyncDispose]() {
778
734
  this.dispose();
779
735
  }
736
+ /**
737
+ * Resolves effective Authenticated Additional Data (AAD) for the operation:
738
+ * 1. If options.bindRequestContextAad is explicitly false, returns options.aad directly without context binding.
739
+ * 2. When encrypting (isDecrypt=false): binds request context `req:${method}:${url}` only if options.bindRequestContextAad === true.
740
+ * 3. When decrypting (isDecrypt=true): derives request context `req:${method}:${url}` if url or method is provided.
741
+ * 4. If explicit options.aad is provided: combines with request context if bound, or returns options.aad directly.
742
+ * 5. Otherwise returns undefined.
743
+ */
744
+ _resolveEffectiveAad(options, isDecrypt = false) {
745
+ if (!options) return void 0;
746
+ if (options.bindRequestContextAad === false) return options.aad;
747
+ const hasReqContext = Boolean(options.url || options.method);
748
+ if (options.aad) {
749
+ if (options.bindRequestContextAad === true && hasReqContext) {
750
+ const m = (options.method || "POST").toUpperCase();
751
+ const u = options.url || "";
752
+ const baseAad = typeof options.aad === "string" ? options.aad : options.aad instanceof Uint8Array || options.aad instanceof ArrayBuffer ? textDecoder.decode(options.aad) : String(options.aad);
753
+ return `${baseAad}|req:${m}:${u}`;
754
+ }
755
+ return options.aad;
756
+ }
757
+ const shouldBindReq = isDecrypt ? hasReqContext : options.bindRequestContextAad === true && hasReqContext;
758
+ if (shouldBindReq) {
759
+ const m = (options.method || "POST").toUpperCase();
760
+ const u = options.url || "";
761
+ return `req:${m}:${u}`;
762
+ }
763
+ return void 0;
764
+ }
765
+ /**
766
+ * Helper to deterministically bind record ID and field name into the AAD
767
+ * to prevent ciphertext swapping between fields or records.
768
+ */
769
+ _bindFieldAad(data, field, options) {
770
+ let baseAad = "";
771
+ if (options?.aad) {
772
+ if (typeof options.aad === "string") baseAad = options.aad;
773
+ else if (options.aad instanceof Uint8Array || options.aad instanceof ArrayBuffer) {
774
+ baseAad = textDecoder.decode(options.aad);
775
+ } else {
776
+ baseAad = String(options.aad);
777
+ }
778
+ }
779
+ const recordId = data && typeof data === "object" && (data.id !== void 0 || data._id !== void 0) ? String(data.id ?? data._id) : "";
780
+ const recordPart = recordId ? `|record:${recordId}` : "";
781
+ const reqPart = options?.bindRequestContextAad === true && (options?.url || options?.method) ? `|req:${(options.method || "POST").toUpperCase()}:${options.url || ""}` : "";
782
+ return {
783
+ ...options,
784
+ aad: `aad:${baseAad}${recordPart}${reqPart}|field:${field}`
785
+ };
786
+ }
780
787
  /**
781
788
  * Top-level polymorphic encryption method.
782
789
  * Automatically performs value-level encryption:
@@ -812,7 +819,10 @@ class AEncryptionProvider {
812
819
  }
813
820
  const result = { ...data };
814
821
  const entries = await Promise.all(
815
- fieldsToEncrypt.map(async (field) => [field, await this.encryptValue(result[field], options)])
822
+ fieldsToEncrypt.map(async (field) => {
823
+ const fieldOptions = this._bindFieldAad(data, field, options);
824
+ return [field, await this.encryptValue(result[field], fieldOptions)];
825
+ })
816
826
  );
817
827
  for (const [field, encryptedVal] of entries) {
818
828
  safeSetProperty(result, field, encryptedVal);
@@ -831,7 +841,10 @@ class AEncryptionProvider {
831
841
  await this.warmupKey(options);
832
842
  }
833
843
  const entries = await Promise.all(
834
- keysToEncrypt.map(async (key) => [key, await this.encryptValue(result[key], options)])
844
+ keysToEncrypt.map(async (key) => {
845
+ const fieldOptions = this._bindFieldAad(data, key, options);
846
+ return [key, await this.encryptValue(result[key], fieldOptions)];
847
+ })
835
848
  );
836
849
  for (const [key, encryptedVal] of entries) {
837
850
  safeSetProperty(result, key, encryptedVal);
@@ -864,7 +877,22 @@ class AEncryptionProvider {
864
877
  return payload;
865
878
  }
866
879
  const entries = await Promise.all(
867
- keysToDecrypt.map(async (key) => [key, await this.decryptValue(result[key], options)])
880
+ keysToDecrypt.map(async (key) => {
881
+ const boundOptions = this._bindFieldAad(payload, key, options);
882
+ const hasBoundAad = boundOptions.aad !== options?.aad;
883
+ try {
884
+ return [key, await this.decryptValue(result[key], boundOptions)];
885
+ } catch (err) {
886
+ if (hasBoundAad && isAuthOrDecryptionError(err)) {
887
+ try {
888
+ return [key, await this.decryptValue(result[key], options)];
889
+ } catch (fallbackErr) {
890
+ throw fallbackErr;
891
+ }
892
+ }
893
+ throw err;
894
+ }
895
+ })
868
896
  );
869
897
  for (const [key, decryptedVal] of entries) {
870
898
  safeSetProperty(result, key, decryptedVal);
@@ -1236,11 +1264,11 @@ ${lines.join("\n")}
1236
1264
  * Generates a high-entropy symmetric AES-GCM Account Data Encryption Key (ADEK).
1237
1265
  * Designed for multi-user table and field-level encryption.
1238
1266
  */
1239
- static async generateAccountDataKey(length = 256) {
1267
+ static async generateAccountDataKey(length = 256, extractable = false) {
1240
1268
  const subtle = getSubtleCrypto();
1241
1269
  return await subtle.generateKey(
1242
1270
  { name: "AES-GCM", length },
1243
- true,
1271
+ extractable,
1244
1272
  ["encrypt", "decrypt"]
1245
1273
  );
1246
1274
  }
@@ -1271,7 +1299,7 @@ ${lines.join("\n")}
1271
1299
  * Unwraps a Base64-encoded Account Data Encryption Key (ADEK) using the user's private key (RSA-OAEP).
1272
1300
  * Returns the restored AES-GCM CryptoKey ready for use in CWebCryptoEncryptionProvider.
1273
1301
  */
1274
- static async unwrapAccountKeyForUser(wrappedKeyBase64, userPrivateKey, unwrappedKeyAlgorithm = { name: "AES-GCM", length: 256 }) {
1302
+ static async unwrapAccountKeyForUser(wrappedKeyBase64, userPrivateKey, unwrappedKeyAlgorithm = { name: "AES-GCM", length: 256 }, extractable = false) {
1275
1303
  const subtle = getSubtleCrypto();
1276
1304
  if (userPrivateKey.algorithm.name === "RSA-OAEP") {
1277
1305
  const wrappedBytes = CKeyManager.fromBase64(wrappedKeyBase64);
@@ -1290,7 +1318,7 @@ ${lines.join("\n")}
1290
1318
  "raw",
1291
1319
  unwrappedRawKey,
1292
1320
  unwrappedKeyAlgorithm,
1293
- true,
1321
+ extractable,
1294
1322
  ["encrypt", "decrypt"]
1295
1323
  );
1296
1324
  } finally {
@@ -1463,12 +1491,13 @@ class CWebCryptoEncryptionProvider extends AEncryptionProvider {
1463
1491
  return options._warmedKey;
1464
1492
  }
1465
1493
  if (saltOverride) {
1494
+ const rawKey = await this.resolveRawKey(keyProvider);
1466
1495
  const saltKey = typeof saltOverride === "string" ? saltOverride : CKeyManager.toBase64(saltOverride);
1467
- const keyId = getKeyIdentifier(keyProvider, this.defaultKey);
1496
+ const keyId = getSafeKeyIdentifier(rawKey);
1468
1497
  const compoundKey = `${keyId}:${kdfOverride || ""}:${iterationsOverride || ""}:${options?.kdfHash || ""}:${saltKey}`;
1469
1498
  let cached = this._decryptSaltCache.get(compoundKey);
1470
1499
  if (!cached) {
1471
- cached = this._resolveCryptoKeyInternal(keyProvider, kdfOverride, saltOverride, options, iterationsOverride).catch((err) => {
1500
+ cached = this._resolveCryptoKeyInternal(rawKey, kdfOverride, saltOverride, options, iterationsOverride).catch((err) => {
1472
1501
  this._decryptSaltCache.delete(compoundKey);
1473
1502
  throw err;
1474
1503
  });
@@ -1525,9 +1554,9 @@ class CWebCryptoEncryptionProvider extends AEncryptionProvider {
1525
1554
  const matchesHash = !targetHash || this._cachedHash !== void 0 && targetHash.toLowerCase() === this._cachedHash.toLowerCase();
1526
1555
  const matchesKdf = this._cachedKdf !== void 0 && kdf === this._cachedKdf.toLowerCase();
1527
1556
  const matchesSalt = !saltOverride || this._cachedSalt !== void 0 && saltOverride === this._cachedSalt;
1528
- const currentKeyId = getKeyIdentifier(keyProvider, this.defaultKey);
1557
+ const currentKeyId = getSafeKeyIdentifier(rawKey);
1529
1558
  if (this._cachedKey && matchesSalt && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
1530
- if (!this._cachedKeyId || this._cachedKeyId === currentKeyId) {
1559
+ if (this._cachedKeyId === currentKeyId) {
1531
1560
  return { cryptoKey: this._cachedKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
1532
1561
  }
1533
1562
  }
@@ -1648,7 +1677,7 @@ class CWebCryptoEncryptionProvider extends AEncryptionProvider {
1648
1677
  name: "AES-GCM",
1649
1678
  iv
1650
1679
  };
1651
- const aad = options?.aad;
1680
+ const aad = this._resolveEffectiveAad(options, false);
1652
1681
  let hasAad = false;
1653
1682
  if (aad) {
1654
1683
  const aadBytes = typeof aad === "string" ? textEncoder$1.encode(aad) : aad instanceof Uint8Array ? aad : new Uint8Array(aad);
@@ -1710,22 +1739,45 @@ class CWebCryptoEncryptionProvider extends AEncryptionProvider {
1710
1739
  name: "AES-GCM",
1711
1740
  iv
1712
1741
  };
1713
- const aad = options?.aad;
1742
+ const aad = this._resolveEffectiveAad(options, true);
1743
+ let hasAad = false;
1714
1744
  if (payload.aad || aad) {
1715
1745
  if (aad) {
1716
1746
  const aadBytes = typeof aad === "string" ? textEncoder$1.encode(aad) : aad instanceof Uint8Array ? aad : new Uint8Array(aad);
1717
1747
  if (aadBytes.byteLength > 0) {
1718
1748
  decryptParams.additionalData = aadBytes;
1749
+ hasAad = true;
1719
1750
  }
1720
1751
  } else if (payload.aad) {
1721
1752
  throw new Error("[CWebCryptoEncryptionProvider] Payload requires Authenticated Additional Data (AAD) for decryption, but none was provided.");
1722
1753
  }
1723
1754
  }
1724
- const decryptedBuffer = await subtle.decrypt(
1725
- decryptParams,
1726
- cryptoKey,
1727
- ciphertextBytes
1728
- );
1755
+ let decryptedBuffer;
1756
+ try {
1757
+ decryptedBuffer = await subtle.decrypt(
1758
+ decryptParams,
1759
+ cryptoKey,
1760
+ ciphertextBytes
1761
+ );
1762
+ } catch (firstErr) {
1763
+ if (!payload.aad && hasAad) {
1764
+ try {
1765
+ const fallbackParams = {
1766
+ name: "AES-GCM",
1767
+ iv
1768
+ };
1769
+ decryptedBuffer = await subtle.decrypt(
1770
+ fallbackParams,
1771
+ cryptoKey,
1772
+ ciphertextBytes
1773
+ );
1774
+ } catch {
1775
+ throw firstErr;
1776
+ }
1777
+ } else {
1778
+ throw firstErr;
1779
+ }
1780
+ }
1729
1781
  try {
1730
1782
  const jsonString = textDecoder.decode(decryptedBuffer);
1731
1783
  return JSON.parse(jsonString);
@@ -1734,7 +1786,12 @@ class CWebCryptoEncryptionProvider extends AEncryptionProvider {
1734
1786
  }
1735
1787
  } catch (err) {
1736
1788
  if (err instanceof SyntaxError) throw err;
1737
- throw new Error(`[CWebCryptoEncryptionProvider] Decryption failed: ${err?.message || "Authentication tag mismatch or corrupted ciphertext"}`);
1789
+ const decryptError = new Error(`[CWebCryptoEncryptionProvider] Decryption failed: ${err?.message || "Authentication tag mismatch or corrupted ciphertext"}`);
1790
+ if (err?.name) {
1791
+ decryptError.name = err.name;
1792
+ }
1793
+ decryptError.cause = err;
1794
+ throw decryptError;
1738
1795
  }
1739
1796
  }
1740
1797
  }
@@ -1747,6 +1804,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1747
1804
  _cachedKdf;
1748
1805
  _cachedIter;
1749
1806
  _cachedHash;
1807
+ _cachedKeyId;
1750
1808
  _configuredKid;
1751
1809
  _kdfOptions;
1752
1810
  _decryptSaltCache = /* @__PURE__ */ new Map();
@@ -1757,9 +1815,9 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1757
1815
  this._configuredKid = options.kid || options.keyId;
1758
1816
  }
1759
1817
  this._defaultKdf = options.kdf || "pbkdf2";
1760
- if (options.kdf && options.kdf !== "none") {
1818
+ if (this._defaultKdf !== "none") {
1761
1819
  this._kdfOptions = {
1762
- kdf: options.kdf,
1820
+ kdf: this._defaultKdf,
1763
1821
  iterations: options.kdfIterations,
1764
1822
  hash: options.kdfHash,
1765
1823
  salt: options.kdfSalt,
@@ -1776,6 +1834,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1776
1834
  this._cachedKdf = void 0;
1777
1835
  this._cachedIter = void 0;
1778
1836
  this._cachedHash = void 0;
1837
+ this._cachedKeyId = void 0;
1779
1838
  this._decryptSaltCache.clear();
1780
1839
  }
1781
1840
  clearKeys() {
@@ -1786,6 +1845,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1786
1845
  this._cachedKdf = void 0;
1787
1846
  this._cachedIter = void 0;
1788
1847
  this._cachedHash = void 0;
1848
+ this._cachedKeyId = void 0;
1789
1849
  this._decryptSaltCache.clear();
1790
1850
  }
1791
1851
  async warmupKey(options) {
@@ -1806,12 +1866,14 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1806
1866
  */
1807
1867
  async resolveCBCKeys(keyProvider, kdfOverride, saltOverride, options, iterationsOverride) {
1808
1868
  if (saltOverride) {
1869
+ const rawKey = await this.resolveRawKey(keyProvider);
1809
1870
  const saltKey = typeof saltOverride === "string" ? saltOverride : CKeyManager.toBase64(saltOverride);
1810
- const keyId = getKeyIdentifier(keyProvider, this.defaultKey);
1811
- const compoundKey = `${keyId}:${kdfOverride || ""}:${iterationsOverride || ""}:${options?.kdfHash || ""}:${saltKey}`;
1871
+ const keyId = getSafeKeyIdentifier(rawKey);
1872
+ const effectiveHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-512";
1873
+ const compoundKey = `${keyId}:${kdfOverride || ""}:${iterationsOverride || ""}:${effectiveHash}:${saltKey}`;
1812
1874
  let cached = this._decryptSaltCache.get(compoundKey);
1813
1875
  if (!cached) {
1814
- cached = this._deriveCBCKeysInternal(keyProvider, kdfOverride, saltOverride, options, iterationsOverride).catch((err) => {
1876
+ cached = this._deriveCBCKeysInternal(rawKey, kdfOverride, saltOverride, options, iterationsOverride).catch((err) => {
1815
1877
  this._decryptSaltCache.delete(compoundKey);
1816
1878
  throw err;
1817
1879
  });
@@ -1831,17 +1893,20 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1831
1893
  return await this._deriveCBCKeysInternal(keyProvider, kdfOverride, saltOverride, options, iterationsOverride);
1832
1894
  }
1833
1895
  async _deriveCBCKeysInternal(keyProvider, kdfOverride, saltOverride, options, iterationsOverride) {
1896
+ const rawKey = await this.resolveRawKey(keyProvider);
1897
+ const currentKeyId = getSafeKeyIdentifier(rawKey);
1834
1898
  const subtle = getSubtleCrypto();
1835
- const targetIter = iterationsOverride || options?.kdfIterations;
1836
- const targetHash = options?.kdfHash;
1899
+ const targetIter = iterationsOverride || options?.kdfIterations || this._kdfOptions?.iterations;
1900
+ const targetHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-512";
1837
1901
  const matchesIter = !targetIter || this._cachedIter !== void 0 && targetIter === this._cachedIter;
1838
- const matchesHash = !targetHash || this._cachedHash !== void 0 && targetHash.toLowerCase() === this._cachedHash.toLowerCase();
1902
+ const matchesHash = this._cachedHash !== void 0 && targetHash.toLowerCase() === this._cachedHash.toLowerCase();
1839
1903
  const effectiveKdf = (kdfOverride || options?.kdf || this._defaultKdf || "none").toLowerCase();
1840
1904
  const matchesKdf = this._cachedKdf === "raw" || this._cachedKdf === "hkdf-direct" || this._cachedKdf !== void 0 && effectiveKdf === this._cachedKdf.toLowerCase();
1841
- if (!keyProvider && this._cachedEncKey && this._cachedMacKey && !saltOverride && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
1842
- return { encKey: this._cachedEncKey, macKey: this._cachedMacKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
1905
+ if (this._cachedEncKey && this._cachedMacKey && !saltOverride && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
1906
+ if (this._cachedKeyId === currentKeyId) {
1907
+ return { encKey: this._cachedEncKey, macKey: this._cachedMacKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
1908
+ }
1843
1909
  }
1844
- const rawKey = await this.resolveRawKey(keyProvider);
1845
1910
  if (typeof rawKey !== "string" && rawKey.algorithm) {
1846
1911
  const cryptoKey = rawKey;
1847
1912
  let rawBits;
@@ -1874,6 +1939,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1874
1939
  this._cachedEncKey = encKey2;
1875
1940
  this._cachedMacKey = macKey2;
1876
1941
  this._cachedKdf = "hkdf-direct";
1942
+ this._cachedKeyId = currentKeyId;
1877
1943
  }
1878
1944
  return { encKey: encKey2, macKey: macKey2, kdf: "hkdf-direct" };
1879
1945
  }
@@ -1907,6 +1973,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1907
1973
  this._cachedEncKey = encKey2;
1908
1974
  this._cachedMacKey = macKey2;
1909
1975
  this._cachedKdf = "raw";
1976
+ this._cachedKeyId = currentKeyId;
1910
1977
  }
1911
1978
  return { encKey: encKey2, macKey: macKey2, kdf: "raw" };
1912
1979
  }
@@ -1937,6 +2004,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
1937
2004
  this._cachedEncKey = encKey2;
1938
2005
  this._cachedMacKey = macKey2;
1939
2006
  this._cachedKdf = "raw";
2007
+ this._cachedKeyId = currentKeyId;
1940
2008
  }
1941
2009
  return { encKey: encKey2, macKey: macKey2, kdf: "raw" };
1942
2010
  }
@@ -2044,6 +2112,7 @@ class CWebCryptoAESCBCProvider extends AEncryptionProvider {
2044
2112
  this._cachedKdf = kdfType || "none";
2045
2113
  this._cachedIter = iterNum;
2046
2114
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-512";
2115
+ this._cachedKeyId = currentKeyId;
2047
2116
  }
2048
2117
  return {
2049
2118
  encKey,
@@ -2944,6 +3013,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
2944
3013
  _cachedKdf;
2945
3014
  _cachedIter;
2946
3015
  _cachedHash;
3016
+ _cachedKeyId;
2947
3017
  _configuredKid;
2948
3018
  setDefaultKey(key) {
2949
3019
  super.setDefaultKey(key);
@@ -2955,6 +3025,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
2955
3025
  this._cachedKdf = void 0;
2956
3026
  this._cachedIter = void 0;
2957
3027
  this._cachedHash = void 0;
3028
+ this._cachedKeyId = void 0;
2958
3029
  }
2959
3030
  clearKeys() {
2960
3031
  super.clearKeys();
@@ -2966,6 +3037,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
2966
3037
  this._cachedKdf = void 0;
2967
3038
  this._cachedIter = void 0;
2968
3039
  this._cachedHash = void 0;
3040
+ this._cachedKeyId = void 0;
2969
3041
  }
2970
3042
  async warmupKey(options) {
2971
3043
  const res = await this.deriveKeyAsync(options?.key, void 0, void 0, options);
@@ -2975,6 +3047,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
2975
3047
  this._cachedKdf = res.kdf;
2976
3048
  this._cachedIter = res.iter;
2977
3049
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3050
+ this._cachedKeyId = getSafeKeyIdentifier(await this.resolveRawKeyAsync(options?.key));
2978
3051
  }
2979
3052
  }
2980
3053
  /**
@@ -2988,6 +3061,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
2988
3061
  this._cachedKdf = res.kdf;
2989
3062
  this._cachedIter = res.iter;
2990
3063
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3064
+ this._cachedKeyId = getSafeKeyIdentifier(this.resolveRawKeySync(options?.key));
2991
3065
  }
2992
3066
  }
2993
3067
  resolveInfoBuffer(infoRaw) {
@@ -3074,12 +3148,14 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3074
3148
  }
3075
3149
  deriveKeySync(keyProvider, kdfOverride, saltOverride, options, iterationsOverride) {
3076
3150
  const raw = this.resolveRawKeySync(keyProvider);
3151
+ const currentKeyId = getSafeKeyIdentifier(raw);
3077
3152
  if (Buffer.isBuffer(raw)) {
3078
3153
  if (raw.length === 32) {
3079
3154
  if (!keyProvider) {
3080
- if (!this._cachedKey) {
3155
+ if (!this._cachedKey || this._cachedKeyId !== currentKeyId) {
3081
3156
  this._cachedKey = Buffer.from(raw);
3082
3157
  this._cachedKdf = "raw";
3158
+ this._cachedKeyId = currentKeyId;
3083
3159
  }
3084
3160
  return { key: this._cachedKey, kdf: "raw" };
3085
3161
  }
@@ -3097,8 +3173,10 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3097
3173
  const matchesHash = !targetHash || this._cachedHash !== void 0 && targetHash.toLowerCase() === this._cachedHash.toLowerCase();
3098
3174
  const matchesKdf = this._cachedKdf !== void 0 && kdf === this._cachedKdf.toLowerCase();
3099
3175
  const matchesSalt = !saltOverride || this._cachedSalt !== void 0 && saltOverride === this._cachedSalt;
3100
- if (!keyProvider && this._cachedKey && matchesSalt && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
3101
- return { key: this._cachedKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
3176
+ if (this._cachedKey && matchesSalt && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
3177
+ if (this._cachedKeyId === currentKeyId) {
3178
+ return { key: this._cachedKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
3179
+ }
3102
3180
  }
3103
3181
  if (kdf === "pbkdf2") {
3104
3182
  const s = saltOverride || options?.kdfSalt || this._kdfOptions?.salt;
@@ -3114,6 +3192,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3114
3192
  this._cachedKdf = "PBKDF2";
3115
3193
  this._cachedIter = iterations;
3116
3194
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3195
+ this._cachedKeyId = currentKeyId;
3117
3196
  }
3118
3197
  return {
3119
3198
  key: key2,
@@ -3139,6 +3218,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3139
3218
  this._cachedSalt = saltBuf.toString("base64");
3140
3219
  this._cachedKdf = "HKDF";
3141
3220
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3221
+ this._cachedKeyId = currentKeyId;
3142
3222
  }
3143
3223
  return {
3144
3224
  key: key2,
@@ -3151,24 +3231,27 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3151
3231
  "[CNodeCryptoEncryptionProvider] WARNING: Decrypting a legacy envelope with no KDF (raw SHA-256 key derivation). This is cryptographically weak. Migrate to pbkdf2 or hkdf."
3152
3232
  );
3153
3233
  }
3154
- if (!keyProvider && this._cachedKey && this._cachedKdf === "none") {
3234
+ if (!keyProvider && this._cachedKey && this._cachedKdf === "none" && this._cachedKeyId === currentKeyId) {
3155
3235
  return { key: this._cachedKey, kdf: "none" };
3156
3236
  }
3157
3237
  const key = crypto$1.createHash("sha256").update(passphrase, "utf8").digest();
3158
3238
  if (!keyProvider) {
3159
3239
  this._cachedKey = key;
3160
3240
  this._cachedKdf = "none";
3241
+ this._cachedKeyId = currentKeyId;
3161
3242
  }
3162
3243
  return { key, kdf: "none" };
3163
3244
  }
3164
3245
  async deriveKeyAsync(keyProvider, kdfOverride, saltOverride, options, iterationsOverride) {
3165
3246
  const raw = await this.resolveRawKeyAsync(keyProvider);
3247
+ const currentKeyId = getSafeKeyIdentifier(raw);
3166
3248
  if (Buffer.isBuffer(raw)) {
3167
3249
  if (raw.length === 32) {
3168
3250
  if (!keyProvider) {
3169
- if (!this._cachedKey) {
3251
+ if (!this._cachedKey || this._cachedKeyId !== currentKeyId) {
3170
3252
  this._cachedKey = Buffer.from(raw);
3171
3253
  this._cachedKdf = "raw";
3254
+ this._cachedKeyId = currentKeyId;
3172
3255
  }
3173
3256
  return { key: this._cachedKey, kdf: "raw" };
3174
3257
  }
@@ -3186,8 +3269,10 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3186
3269
  const matchesHash = !targetHash || this._cachedHash !== void 0 && targetHash.toLowerCase() === this._cachedHash.toLowerCase();
3187
3270
  const matchesKdf = this._cachedKdf !== void 0 && kdf === this._cachedKdf.toLowerCase();
3188
3271
  const matchesSalt = !saltOverride || this._cachedSalt !== void 0 && saltOverride === this._cachedSalt;
3189
- if (!keyProvider && this._cachedKey && matchesSalt && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
3190
- return { key: this._cachedKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
3272
+ if (this._cachedKey && matchesSalt && !options?.kdfSalt && matchesKdf && matchesIter && matchesHash) {
3273
+ if (this._cachedKeyId === currentKeyId) {
3274
+ return { key: this._cachedKey, salt: this._cachedSalt, kdf: this._cachedKdf, iter: this._cachedIter };
3275
+ }
3191
3276
  }
3192
3277
  if (kdf === "pbkdf2") {
3193
3278
  const s = saltOverride || options?.kdfSalt || this._kdfOptions?.salt;
@@ -3208,6 +3293,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3208
3293
  this._cachedKdf = "PBKDF2";
3209
3294
  this._cachedIter = iterations;
3210
3295
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3296
+ this._cachedKeyId = currentKeyId;
3211
3297
  }
3212
3298
  return {
3213
3299
  key: key2,
@@ -3238,6 +3324,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3238
3324
  this._cachedSalt = saltBuf.toString("base64");
3239
3325
  this._cachedKdf = "HKDF";
3240
3326
  this._cachedHash = options?.kdfHash || this._kdfOptions?.hash || "SHA-256";
3327
+ this._cachedKeyId = currentKeyId;
3241
3328
  }
3242
3329
  return {
3243
3330
  key: key2,
@@ -3250,13 +3337,14 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3250
3337
  "[CNodeCryptoEncryptionProvider] WARNING: Decrypting a legacy envelope with no KDF (raw SHA-256 key derivation). This is cryptographically weak. Migrate to pbkdf2 or hkdf."
3251
3338
  );
3252
3339
  }
3253
- if (!keyProvider && this._cachedKey && this._cachedKdf === "none") {
3340
+ if (!keyProvider && this._cachedKey && this._cachedKdf === "none" && this._cachedKeyId === currentKeyId) {
3254
3341
  return { key: this._cachedKey, kdf: "none" };
3255
3342
  }
3256
3343
  const key = crypto$1.createHash("sha256").update(passphrase, "utf8").digest();
3257
3344
  if (!keyProvider) {
3258
3345
  this._cachedKey = key;
3259
3346
  this._cachedKdf = "none";
3347
+ this._cachedKeyId = currentKeyId;
3260
3348
  }
3261
3349
  return { key, kdf: "none" };
3262
3350
  }
@@ -3283,7 +3371,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3283
3371
  const jsonString = JSON.stringify(data);
3284
3372
  const iv = crypto$1.randomBytes(12);
3285
3373
  const cipher = crypto$1.createCipheriv("aes-256-gcm", key, iv);
3286
- const aad = options?.aad;
3374
+ const aad = this._resolveEffectiveAad(options, false);
3287
3375
  let hasAad = false;
3288
3376
  if (aad) {
3289
3377
  const aadBuffer = Buffer.isBuffer(aad) ? aad : Buffer.from(typeof aad === "string" ? aad : new Uint8Array(aad));
@@ -3336,21 +3424,41 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3336
3424
  }
3337
3425
  const decipher = crypto$1.createDecipheriv("aes-256-gcm", key, iv, { authTagLength: 16 });
3338
3426
  decipher.setAuthTag(authTag);
3339
- const aad = options?.aad;
3427
+ const aad = this._resolveEffectiveAad(options, true);
3428
+ let hasAad = false;
3340
3429
  if (payload.aad || aad) {
3341
3430
  if (aad) {
3342
3431
  const aadBuffer = Buffer.isBuffer(aad) ? aad : Buffer.from(typeof aad === "string" ? aad : new Uint8Array(aad));
3343
3432
  if (aadBuffer.length > 0) {
3344
3433
  decipher.setAAD(aadBuffer);
3434
+ hasAad = true;
3345
3435
  }
3346
3436
  } else if (payload.aad) {
3347
3437
  throw new Error("[CNodeCryptoEncryptionProvider] Payload requires Authenticated Additional Data (AAD) for decryption, but none was provided.");
3348
3438
  }
3349
3439
  }
3350
- const decrypted = Buffer.concat([
3351
- decipher.update(ciphertext),
3352
- decipher.final()
3353
- ]);
3440
+ let decrypted;
3441
+ try {
3442
+ decrypted = Buffer.concat([
3443
+ decipher.update(ciphertext),
3444
+ decipher.final()
3445
+ ]);
3446
+ } catch (firstErr) {
3447
+ if (!payload.aad && hasAad) {
3448
+ try {
3449
+ const fallbackDecipher = crypto$1.createDecipheriv("aes-256-gcm", key, iv, { authTagLength: 16 });
3450
+ fallbackDecipher.setAuthTag(authTag);
3451
+ decrypted = Buffer.concat([
3452
+ fallbackDecipher.update(ciphertext),
3453
+ fallbackDecipher.final()
3454
+ ]);
3455
+ } catch {
3456
+ throw firstErr;
3457
+ }
3458
+ } else {
3459
+ throw firstErr;
3460
+ }
3461
+ }
3354
3462
  try {
3355
3463
  const jsonString = decrypted.toString("utf8");
3356
3464
  return JSON.parse(jsonString);
@@ -3403,7 +3511,8 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3403
3511
  if (fieldsToEncrypt.length === 0) return { ...data };
3404
3512
  const result = { ...data };
3405
3513
  for (const field of fieldsToEncrypt) {
3406
- safeSetProperty(result, field, this.encryptValueSync(result[field], options));
3514
+ const fieldOptions = this._bindFieldAad(data, field, options);
3515
+ safeSetProperty(result, field, this.encryptValueSync(result[field], fieldOptions));
3407
3516
  }
3408
3517
  return result;
3409
3518
  }
@@ -3411,7 +3520,8 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3411
3520
  const result = { ...data };
3412
3521
  for (const key of Object.keys(result)) {
3413
3522
  if (result[key] !== void 0 && result[key] !== null && !this.isEncrypted(result[key])) {
3414
- safeSetProperty(result, key, this.encryptValueSync(result[key], options));
3523
+ const fieldOptions = this._bindFieldAad(data, key, options);
3524
+ safeSetProperty(result, key, this.encryptValueSync(result[key], fieldOptions));
3415
3525
  }
3416
3526
  }
3417
3527
  return result;
@@ -3450,7 +3560,21 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3450
3560
  derivedKey = derived.key;
3451
3561
  keyCache.set(salt, derivedKey);
3452
3562
  }
3453
- safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, options));
3563
+ const boundOptions = this._bindFieldAad(payload, key, options);
3564
+ const hasBoundAad = boundOptions.aad !== options?.aad;
3565
+ try {
3566
+ safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, boundOptions));
3567
+ } catch (err) {
3568
+ if (hasBoundAad && isAuthOrDecryptionError(err)) {
3569
+ try {
3570
+ safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, options));
3571
+ } catch (fallbackErr) {
3572
+ throw fallbackErr;
3573
+ }
3574
+ } else {
3575
+ throw err;
3576
+ }
3577
+ }
3454
3578
  mutated = true;
3455
3579
  }
3456
3580
  }
@@ -3490,7 +3614,7 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3490
3614
  const jsonString = JSON.stringify(data);
3491
3615
  const iv = crypto$1.randomBytes(12);
3492
3616
  const cipher = crypto$1.createCipheriv("aes-256-gcm", key, iv);
3493
- const aad = options?.aad;
3617
+ const aad = this._resolveEffectiveAad(options, false);
3494
3618
  let hasAad = false;
3495
3619
  if (aad) {
3496
3620
  const aadBuffer = Buffer.isBuffer(aad) ? aad : Buffer.from(typeof aad === "string" ? aad : new Uint8Array(aad));
@@ -3578,7 +3702,21 @@ class CNodeCryptoEncryptionProvider extends AEncryptionProvider {
3578
3702
  derivedKey = derived.key;
3579
3703
  keyCache.set(salt, derivedKey);
3580
3704
  }
3581
- safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, options));
3705
+ const boundOptions = this._bindFieldAad(payload, key, options);
3706
+ const hasBoundAad = boundOptions.aad !== options?.aad;
3707
+ try {
3708
+ safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, boundOptions));
3709
+ } catch (err) {
3710
+ if (hasBoundAad && isAuthOrDecryptionError(err)) {
3711
+ try {
3712
+ safeSetProperty(result, key, this.decryptCiphertextWithKey(fieldPayload, derivedKey, options));
3713
+ } catch (fallbackErr) {
3714
+ throw fallbackErr;
3715
+ }
3716
+ } else {
3717
+ throw err;
3718
+ }
3719
+ }
3582
3720
  mutated = true;
3583
3721
  }
3584
3722
  }
@@ -4586,12 +4724,6 @@ class CFlatClientDataProvider extends AEncryptedClientProvider {
4586
4724
  }
4587
4725
  });
4588
4726
  }
4589
- getSelectedRows() {
4590
- if (this.selectAll) {
4591
- return this.filteredData && this.filteredData.length > 0 ? this.filteredData : this.allData;
4592
- }
4593
- return this.selectedRows;
4594
- }
4595
4727
  }
4596
4728
 
4597
4729
  class CacheProviderFactory {
@@ -5321,6 +5453,48 @@ function generateId() {
5321
5453
  }
5322
5454
  return Date.now().toString(36) + Math.random().toString(36).slice(2);
5323
5455
  }
5456
+ function uint8ArrayToBase64(bytes) {
5457
+ if (typeof Buffer !== "undefined") {
5458
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64");
5459
+ }
5460
+ let binary = "";
5461
+ const chunkSize = 8192;
5462
+ for (let i = 0; i < bytes.byteLength; i += chunkSize) {
5463
+ const chunk = bytes.subarray(i, i + chunkSize);
5464
+ binary += String.fromCharCode.apply(null, chunk);
5465
+ }
5466
+ return btoa(binary);
5467
+ }
5468
+ function base64ToUint8Array(base64) {
5469
+ if (typeof Buffer !== "undefined") {
5470
+ const buf = Buffer.from(base64, "base64");
5471
+ return new Uint8Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));
5472
+ }
5473
+ const binary = atob(base64);
5474
+ const bytes = new Uint8Array(binary.length);
5475
+ for (let i = 0; i < binary.length; i++) {
5476
+ bytes[i] = binary.charCodeAt(i);
5477
+ }
5478
+ return bytes;
5479
+ }
5480
+ async function readBlobAsUint8Array(blob) {
5481
+ if (typeof blob.arrayBuffer === "function") {
5482
+ const buffer = await blob.arrayBuffer();
5483
+ return new Uint8Array(buffer);
5484
+ }
5485
+ if (typeof FileReader !== "undefined") {
5486
+ return new Promise((resolve, reject) => {
5487
+ const reader = new FileReader();
5488
+ reader.onload = () => {
5489
+ const buffer = reader.result;
5490
+ resolve(new Uint8Array(buffer));
5491
+ };
5492
+ reader.onerror = () => reject(reader.error);
5493
+ reader.readAsArrayBuffer(blob);
5494
+ });
5495
+ }
5496
+ throw new Error("[RequestQueue] Blob binary extraction is not supported in this environment");
5497
+ }
5324
5498
  const SENSITIVE_HEADER_KEYS = ["authorization", "cookie", "set-cookie", "x-csrf-token"];
5325
5499
  class RequestQueue {
5326
5500
  // ── State ──────────────────────────────────────────────────────────────────
@@ -5347,11 +5521,187 @@ class RequestQueue {
5347
5521
  * Sensitive credentials must never be stored in plaintext in browser storage, and are
5348
5522
  * instead regenerated dynamically at execution time.
5349
5523
  */
5350
- static sanitizeOptions(options) {
5524
+ /**
5525
+ * Adapts binary, multipart, and specialized payload types (FormData, Blob, File,
5526
+ * ArrayBuffer, TypedArrays, URLSearchParams) into JSON-serializable structures
5527
+ * to prevent silent payload loss (BUG-014) when persisting to offline storage.
5528
+ */
5529
+ static async serializeBody(body) {
5530
+ if (body === void 0 || body === null) {
5531
+ return body;
5532
+ }
5533
+ const isFormData = typeof FormData !== "undefined" && (body instanceof FormData || Object.prototype.toString.call(body) === "[object FormData]");
5534
+ if (isFormData) {
5535
+ const entries = [];
5536
+ if (typeof body.entries === "function") {
5537
+ for (const [key, val] of body.entries()) {
5538
+ entries.push([key, await RequestQueue.serializeFieldValue(val)]);
5539
+ }
5540
+ } else if (typeof body.forEach === "function") {
5541
+ const raw = [];
5542
+ body.forEach((val, key) => {
5543
+ raw.push([key, val]);
5544
+ });
5545
+ for (const [key, val] of raw) {
5546
+ entries.push([key, await RequestQueue.serializeFieldValue(val)]);
5547
+ }
5548
+ }
5549
+ return {
5550
+ __katlux_type: "FormData",
5551
+ entries
5552
+ };
5553
+ }
5554
+ const isFile = typeof File !== "undefined" && (body instanceof File || Object.prototype.toString.call(body) === "[object File]");
5555
+ if (isFile) {
5556
+ const bytes = await readBlobAsUint8Array(body);
5557
+ return {
5558
+ __katlux_type: "File",
5559
+ name: body.name,
5560
+ type: body.type || "application/octet-stream",
5561
+ lastModified: body.lastModified,
5562
+ data: uint8ArrayToBase64(bytes)
5563
+ };
5564
+ }
5565
+ const isBlob = typeof Blob !== "undefined" && (body instanceof Blob || Object.prototype.toString.call(body) === "[object Blob]");
5566
+ if (isBlob) {
5567
+ const bytes = await readBlobAsUint8Array(body);
5568
+ return {
5569
+ __katlux_type: "Blob",
5570
+ type: body.type || "application/octet-stream",
5571
+ data: uint8ArrayToBase64(bytes)
5572
+ };
5573
+ }
5574
+ const isArrayBuffer = typeof ArrayBuffer !== "undefined" && (body instanceof ArrayBuffer || Object.prototype.toString.call(body) === "[object ArrayBuffer]");
5575
+ if (isArrayBuffer) {
5576
+ const bytes = new Uint8Array(body);
5577
+ return {
5578
+ __katlux_type: "ArrayBuffer",
5579
+ data: uint8ArrayToBase64(bytes)
5580
+ };
5581
+ }
5582
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(body)) {
5583
+ const view = body;
5584
+ const bytes = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
5585
+ return {
5586
+ __katlux_type: "Uint8Array",
5587
+ data: uint8ArrayToBase64(bytes)
5588
+ };
5589
+ }
5590
+ const isURLSearchParams = typeof URLSearchParams !== "undefined" && (body instanceof URLSearchParams || Object.prototype.toString.call(body) === "[object URLSearchParams]");
5591
+ if (isURLSearchParams) {
5592
+ return {
5593
+ __katlux_type: "URLSearchParams",
5594
+ data: body.toString()
5595
+ };
5596
+ }
5597
+ return body;
5598
+ }
5599
+ static async serializeFieldValue(val) {
5600
+ if (typeof File !== "undefined" && (val instanceof File || Object.prototype.toString.call(val) === "[object File]")) {
5601
+ const bytes = await readBlobAsUint8Array(val);
5602
+ return {
5603
+ __katlux_type: "File",
5604
+ name: val.name,
5605
+ type: val.type || "application/octet-stream",
5606
+ lastModified: val.lastModified,
5607
+ data: uint8ArrayToBase64(bytes)
5608
+ };
5609
+ }
5610
+ if (typeof Blob !== "undefined" && (val instanceof Blob || Object.prototype.toString.call(val) === "[object Blob]")) {
5611
+ const bytes = await readBlobAsUint8Array(val);
5612
+ return {
5613
+ __katlux_type: "Blob",
5614
+ type: val.type || "application/octet-stream",
5615
+ data: uint8ArrayToBase64(bytes)
5616
+ };
5617
+ }
5618
+ return typeof val === "string" ? val : String(val);
5619
+ }
5620
+ /**
5621
+ * Reconstitutes serialized offline request bodies back into their live runtime instances
5622
+ * (FormData, Blob, File, ArrayBuffer, Uint8Array, URLSearchParams) before network transmission.
5623
+ */
5624
+ static reconstituteBody(body) {
5625
+ if (!body || typeof body !== "object") {
5626
+ return body;
5627
+ }
5628
+ if (body.__katlux_type === "FormData" && Array.isArray(body.entries)) {
5629
+ if (typeof FormData === "undefined") return body;
5630
+ const fd = new FormData();
5631
+ for (const [key, val] of body.entries) {
5632
+ if (val && typeof val === "object" && val.__katlux_type === "File") {
5633
+ const u8 = base64ToUint8Array(val.data);
5634
+ if (typeof File !== "undefined") {
5635
+ const file = new File([u8], val.name, {
5636
+ type: val.type || "application/octet-stream",
5637
+ lastModified: val.lastModified
5638
+ });
5639
+ fd.append(key, file, val.name);
5640
+ } else if (typeof Blob !== "undefined") {
5641
+ const blob = new Blob([u8], { type: val.type || "application/octet-stream" });
5642
+ fd.append(key, blob, val.name);
5643
+ }
5644
+ } else if (val && typeof val === "object" && val.__katlux_type === "Blob") {
5645
+ if (typeof Blob !== "undefined") {
5646
+ const u8 = base64ToUint8Array(val.data);
5647
+ const blob = new Blob([u8], { type: val.type || "application/octet-stream" });
5648
+ fd.append(key, blob);
5649
+ }
5650
+ } else {
5651
+ fd.append(key, val);
5652
+ }
5653
+ }
5654
+ return fd;
5655
+ }
5656
+ if (body.__katlux_type === "File") {
5657
+ const u8 = base64ToUint8Array(body.data);
5658
+ if (typeof File !== "undefined") {
5659
+ return new File([u8], body.name, {
5660
+ type: body.type || "application/octet-stream",
5661
+ lastModified: body.lastModified
5662
+ });
5663
+ }
5664
+ if (typeof Blob !== "undefined") {
5665
+ return new Blob([u8], { type: body.type || "application/octet-stream" });
5666
+ }
5667
+ return u8;
5668
+ }
5669
+ if (body.__katlux_type === "Blob") {
5670
+ const u8 = base64ToUint8Array(body.data);
5671
+ if (typeof Blob !== "undefined") {
5672
+ return new Blob([u8], { type: body.type || "application/octet-stream" });
5673
+ }
5674
+ return u8;
5675
+ }
5676
+ if (body.__katlux_type === "ArrayBuffer") {
5677
+ const u8 = base64ToUint8Array(body.data);
5678
+ return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
5679
+ }
5680
+ if (body.__katlux_type === "Uint8Array") {
5681
+ return base64ToUint8Array(body.data);
5682
+ }
5683
+ if (body.__katlux_type === "URLSearchParams") {
5684
+ if (typeof URLSearchParams !== "undefined") {
5685
+ return new URLSearchParams(body.data);
5686
+ }
5687
+ return body.data;
5688
+ }
5689
+ return body;
5690
+ }
5691
+ /**
5692
+ * Strips sensitive headers (e.g., authorization, cookie, x-csrf-token) before persisting
5693
+ * request options to persistent storage (IndexedDB / LocalStorage).
5694
+ * Sensitive credentials must never be stored in plaintext in browser storage, and are
5695
+ * instead regenerated dynamically at execution time.
5696
+ */
5697
+ static async sanitizeOptions(options) {
5351
5698
  if (!options) return {};
5352
5699
  const sanitized = {
5353
5700
  method: options.method
5354
5701
  };
5702
+ if (options.credentials) {
5703
+ sanitized.credentials = options.credentials;
5704
+ }
5355
5705
  if (options.headers) {
5356
5706
  const headersObj = {};
5357
5707
  const sensitiveSet = new Set(SENSITIVE_HEADER_KEYS.map((k) => k.toLowerCase()));
@@ -5385,7 +5735,8 @@ class RequestQueue {
5385
5735
  }
5386
5736
  if (options.body !== void 0) {
5387
5737
  try {
5388
- const serialized = JSON.stringify(options.body);
5738
+ const serializedBody = await this.serializeBody(options.body);
5739
+ const serialized = JSON.stringify(serializedBody);
5389
5740
  if (serialized && serialized.length > this.MAX_PAYLOAD_SIZE_BYTES) {
5390
5741
  throw new Error(
5391
5742
  `[RequestQueue] Payload size (${(serialized.length / (1024 * 1024)).toFixed(2)} MB) exceeds maximum allowed size (${(this.MAX_PAYLOAD_SIZE_BYTES / (1024 * 1024)).toFixed(2)} MB)`
@@ -5425,6 +5776,7 @@ class RequestQueue {
5425
5776
  static _onDeadLetter = null;
5426
5777
  static _onFlushComplete = null;
5427
5778
  static _onNetworkError = null;
5779
+ static _onError = null;
5428
5780
  static _headerProvider = null;
5429
5781
  static setHeaderProvider(provider) {
5430
5782
  this._headerProvider = provider;
@@ -5474,6 +5826,12 @@ class RequestQueue {
5474
5826
  static onNetworkError(cb) {
5475
5827
  this._onNetworkError = cb;
5476
5828
  }
5829
+ static onError(cb) {
5830
+ this._onError = cb;
5831
+ }
5832
+ static onQueueFatalError(cb) {
5833
+ this._onError = cb;
5834
+ }
5477
5835
  // ── Enqueue ───────────────────────────────────────────────────────────────
5478
5836
  /**
5479
5837
  * Add an operation to the pending queue and persist it.
@@ -5482,7 +5840,7 @@ class RequestQueue {
5482
5840
  */
5483
5841
  static async enqueue(operation) {
5484
5842
  await this.init();
5485
- const sanitizedOptions = this.sanitizeOptions(operation.options);
5843
+ const sanitizedOptions = await this.sanitizeOptions(operation.options);
5486
5844
  if (this.queue.length >= this.MAX_QUEUE_SIZE) {
5487
5845
  const evicted = this.queue[0];
5488
5846
  await this.moveToDeadLetter(evicted, new Error("Queue capacity exceeded"));
@@ -5545,11 +5903,24 @@ class RequestQueue {
5545
5903
  this.notify();
5546
5904
  this._onNetworkError?.(item);
5547
5905
  } else {
5548
- await this.moveToDeadLetter(item, error, httpStatus);
5906
+ try {
5907
+ await this.moveToDeadLetter(item, error, httpStatus);
5908
+ } catch (dlErr) {
5909
+ await this.persistQueue().catch(() => {
5910
+ });
5911
+ this.notify();
5912
+ const fatalError = dlErr instanceof Error ? dlErr : new Error(String(dlErr));
5913
+ console.error("[RequestQueue] Fatal capacity error moving to dead-letter:", fatalError);
5914
+ this._onError?.(fatalError);
5915
+ }
5549
5916
  }
5550
5917
  break;
5551
5918
  }
5552
5919
  }
5920
+ } catch (topErr) {
5921
+ const fatalError = topErr instanceof Error ? topErr : new Error(String(topErr));
5922
+ console.error("[RequestQueue] flushAll fatal error:", fatalError);
5923
+ this._onError?.(fatalError);
5553
5924
  } finally {
5554
5925
  this.isFlushing = false;
5555
5926
  this.notify();
@@ -5593,7 +5964,16 @@ class RequestQueue {
5593
5964
  this.notify();
5594
5965
  this._onNetworkError?.(item);
5595
5966
  } else {
5596
- await this.moveToDeadLetter(item, error, httpStatus);
5967
+ try {
5968
+ await this.moveToDeadLetter(item, error, httpStatus);
5969
+ } catch (dlErr) {
5970
+ await this.persistQueue().catch(() => {
5971
+ });
5972
+ this.notify();
5973
+ const fatalError = dlErr instanceof Error ? dlErr : new Error(String(dlErr));
5974
+ console.error("[RequestQueue] Fatal capacity error moving to dead-letter:", fatalError);
5975
+ this._onError?.(fatalError);
5976
+ }
5597
5977
  }
5598
5978
  }
5599
5979
  }
@@ -5667,24 +6047,30 @@ class RequestQueue {
5667
6047
  console.error("[RequestQueue] Header provider failed:", err);
5668
6048
  }
5669
6049
  }
5670
- if (typeof document !== "undefined" && document.cookie && !headers["cookie"] && !headers["Cookie"]) {
5671
- headers["cookie"] = document.cookie;
5672
- }
5673
6050
  return headers;
5674
6051
  }
5675
6052
  static async executeRequest(item) {
5676
6053
  const { url, options } = item;
5677
6054
  const headers = await this.regenerateHeaders(options.headers);
6055
+ const body = this.reconstituteBody(options.body);
6056
+ if (typeof FormData !== "undefined" && (body instanceof FormData || Object.prototype.toString.call(body) === "[object FormData]")) {
6057
+ delete headers["content-type"];
6058
+ delete headers["Content-Type"];
6059
+ }
5678
6060
  const fetchOptions = {
5679
6061
  method: item.method,
5680
- body: options.body,
6062
+ body,
5681
6063
  headers,
5682
- query: options.query
6064
+ query: options.query,
6065
+ credentials: options.credentials || "include"
5683
6066
  };
5684
6067
  const fetchFn = globalThis.$fetch || $fetch;
5685
6068
  await fetchFn(url, fetchOptions);
5686
6069
  }
5687
6070
  static async moveToDeadLetter(item, error, httpStatus) {
6071
+ if (this.deadLetterQueue.length >= this.MAX_DEAD_LETTER_SIZE) {
6072
+ throw new Error(`[RequestQueue] Dead-letter queue reached capacity (${this.MAX_DEAD_LETTER_SIZE}). Please clear the queue manually before proceeding to prevent data loss.`);
6073
+ }
5688
6074
  const deadItem = {
5689
6075
  ...item,
5690
6076
  failedAt: Date.now(),
@@ -5692,11 +6078,6 @@ class RequestQueue {
5692
6078
  httpStatus
5693
6079
  };
5694
6080
  this.queue = this.queue.filter((i) => i.id !== item.id);
5695
- if (this.deadLetterQueue.length >= this.MAX_DEAD_LETTER_SIZE) {
5696
- const evicted = this.deadLetterQueue[0];
5697
- console.warn(`[RequestQueue] Dead-letter queue reached capacity (${this.MAX_DEAD_LETTER_SIZE}). Evicting oldest item: ${evicted?.id}`);
5698
- this.deadLetterQueue = this.deadLetterQueue.slice(1);
5699
- }
5700
6081
  this.deadLetterQueue = [...this.deadLetterQueue, deadItem];
5701
6082
  await this.persistQueue();
5702
6083
  await this.persistDeadLetter();
@@ -5718,6 +6099,7 @@ class RequestQueue {
5718
6099
  this._onDeadLetter = null;
5719
6100
  this._onFlushComplete = null;
5720
6101
  this._onNetworkError = null;
6102
+ this._onError = null;
5721
6103
  this._headerProvider = null;
5722
6104
  this.MAX_PAYLOAD_SIZE_BYTES = 5 * 1024 * 1024;
5723
6105
  this.MAX_QUEUE_SIZE = 500;
@@ -6147,6 +6529,8 @@ class RequestProvider {
6147
6529
  url,
6148
6530
  method,
6149
6531
  isServer,
6532
+ aad: encOptions.aad,
6533
+ bindRequestContextAad: encOptions.bindRequestContextAad,
6150
6534
  key: encOptions.key,
6151
6535
  valueEncryption: encOptions.valueEncryption,
6152
6536
  fields: encOptions.fields,
@@ -8072,13 +8456,41 @@ class CCookieCache extends ACacheProvider {
8072
8456
  return this.instance;
8073
8457
  }
8074
8458
  type = "Cookie";
8459
+ sameSite = "lax";
8460
+ secure = void 0;
8461
+ httpOnly = true;
8462
+ path = "/";
8075
8463
  // Exposed constructor for testing & instantiation
8076
- constructor() {
8464
+ constructor(options) {
8077
8465
  super();
8466
+ if (options) {
8467
+ this.configure(options);
8468
+ }
8469
+ }
8470
+ configure(options) {
8471
+ if (options.sameSite !== void 0) this.sameSite = options.sameSite;
8472
+ if (options.secure !== void 0) this.secure = options.secure;
8473
+ if (options.httpOnly !== void 0) this.httpOnly = options.httpOnly;
8474
+ if (options.path !== void 0) this.path = options.path;
8078
8475
  }
8079
8476
  getCookieKey(key) {
8080
8477
  return "cache:" + encodeURIComponent(key);
8081
8478
  }
8479
+ /**
8480
+ * Resolves the `Secure` flag: an explicit option wins, otherwise follow the
8481
+ * actual protocol so cookies are not silently dropped by browsers over plain HTTP.
8482
+ */
8483
+ resolveSecure(getRequestProtocol, event) {
8484
+ if (this.secure !== void 0) return this.secure;
8485
+ if (event && getRequestProtocol) {
8486
+ try {
8487
+ return getRequestProtocol(event) === "https";
8488
+ } catch {
8489
+ return false;
8490
+ }
8491
+ }
8492
+ return typeof location !== "undefined" && location.protocol === "https:";
8493
+ }
8082
8494
  parseKeyFromCookieName(cookieName) {
8083
8495
  const prefix = "cache:";
8084
8496
  const decoded = decodeURIComponent(cookieName);
@@ -8184,20 +8596,23 @@ class CCookieCache extends ACacheProvider {
8184
8596
  return;
8185
8597
  }
8186
8598
  const maxAge = Math.floor(lifetime / 1e3);
8599
+ const sameSiteFormatted = this.sameSite.charAt(0).toUpperCase() + this.sameSite.slice(1).toLowerCase();
8187
8600
  if (this.isClient(context)) {
8188
8601
  if (typeof document !== "undefined") {
8189
- document.cookie = `${cookieKey}=${cookieValue}; Max-Age=${maxAge}; Path=/; SameSite=Lax`;
8602
+ const secureFlag = this.resolveSecure() ? "; Secure" : "";
8603
+ document.cookie = `${cookieKey}=${cookieValue}; Max-Age=${maxAge}; Path=${this.path}; SameSite=${sameSiteFormatted}${secureFlag}`;
8190
8604
  }
8191
8605
  } else if (context) {
8192
8606
  const event = context?.event ?? context?.ssrContext?.event ?? (context?.node ? context : null);
8193
8607
  if (event) {
8194
8608
  try {
8195
- const { setCookie } = await getH3();
8609
+ const { setCookie, getRequestProtocol } = await getH3();
8196
8610
  setCookie(event, cookieKey, serialized, {
8197
8611
  maxAge,
8198
- path: "/",
8199
- sameSite: "lax",
8200
- httpOnly: true
8612
+ path: this.path,
8613
+ sameSite: this.sameSite,
8614
+ httpOnly: this.httpOnly,
8615
+ secure: this.resolveSecure(getRequestProtocol, event)
8201
8616
  });
8202
8617
  } catch {
8203
8618
  }
@@ -8206,16 +8621,18 @@ class CCookieCache extends ACacheProvider {
8206
8621
  }
8207
8622
  async remove(key, context) {
8208
8623
  const cookieKey = this.getCookieKey(key);
8624
+ const sameSiteFormatted = this.sameSite.charAt(0).toUpperCase() + this.sameSite.slice(1).toLowerCase();
8209
8625
  if (this.isClient(context)) {
8210
8626
  if (typeof document !== "undefined") {
8211
- document.cookie = `${cookieKey}=; Max-Age=0; Path=/; SameSite=Lax`;
8627
+ const secureFlag = this.resolveSecure() ? "; Secure" : "";
8628
+ document.cookie = `${cookieKey}=; Max-Age=0; Path=${this.path}; SameSite=${sameSiteFormatted}${secureFlag}`;
8212
8629
  }
8213
8630
  } else if (context) {
8214
8631
  const event = context?.event ?? context?.ssrContext?.event ?? (context?.node ? context : null);
8215
8632
  if (event) {
8216
8633
  try {
8217
- const { deleteCookie } = await getH3();
8218
- deleteCookie(event, cookieKey, { path: "/", sameSite: "lax", httpOnly: true });
8634
+ const { deleteCookie, getRequestProtocol } = await getH3();
8635
+ deleteCookie(event, cookieKey, { path: this.path, sameSite: this.sameSite, httpOnly: this.httpOnly, secure: this.resolveSecure(getRequestProtocol, event) });
8219
8636
  } catch {
8220
8637
  }
8221
8638
  }
@@ -8469,7 +8886,11 @@ class CServerSessionCache extends ACacheProvider {
8469
8886
  CServerSessionCache._opCounter = 0;
8470
8887
  CServerSessionCache.purgeExpiredServerSessions(50);
8471
8888
  } else if (CServerSessionCache.storage.size >= CServerSessionCache.MAX_SERVER_SESSIONS) {
8472
- CServerSessionCache.purgeExpiredServerSessions();
8889
+ CServerSessionCache.purgeExpiredServerSessions(50);
8890
+ if (CServerSessionCache.storage.size >= CServerSessionCache.MAX_SERVER_SESSIONS) {
8891
+ const oldestKey = CServerSessionCache.storage.keys().next().value;
8892
+ if (oldestKey !== void 0) CServerSessionCache.storage.delete(oldestKey);
8893
+ }
8473
8894
  }
8474
8895
  let sessionData = CServerSessionCache.storage.get(sessionId);
8475
8896
  if (sessionData) {
@@ -9453,4 +9874,4 @@ function isEncrypted(payload) {
9453
9874
  return AEncryptionProvider.isEncrypted(payload);
9454
9875
  }
9455
9876
 
9456
- export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder$1 as textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };
9877
+ export { AAPIDataProvider, ADataProvider, AEncryptedClientProvider, AEncryptionProvider, CAPIFlatClientDataProvider, CAPIFlatServerDataProvider, CAPITreeClientDataProvider, CAPITreeServerDataProvider, CApplicationCache, CBrowserSessionCache, CCookieCache, CECDHEncryptionProvider, CFlatClientDataProvider, CFlatServerDataProvider, CIndexedDBCache, CKeyManager, CLocalStorageCache, CMemoryCache, CNodeCryptoEncryptionProvider, CRSAEncryptionProvider, CSearchIndex, CServerSessionCache, CTreeClientDataProvider, CTreeServerDataProvider, CWebCryptoAESCBCProvider, CWebCryptoEncryptionProvider, CacheProviderFactory, DefaultHydrationAdapter, ECacheStrategy, EDataFilterOperator, EQueueStorage, KatluxIndexedDB, QueueStorageFactory, RequestProvider, RequestProviderRegistry, RequestQueue, SENSITIVE_HEADER_KEYS, applyOperator, buildEncryptionContext, clearCachedCipherProvider, clearSSRData, compareAnd, compareEqual, compareIn, compareOr, compareValues, createEncryptionProvider, debounce, decryptPageRows, encryptRows, encryptRowsChunked, evaluateFilter, extractTrigrams, fastKeyHash, fetchWithSSR, filterData, filterTreeData, getAppRoute, getAppRouter, getCipherProvider, getHydrationAdapter, getKeyIdentifier, getPlatformApp, getRandomValues, getSSRData, getSSRPayload, getSafeKeyIdentifier, getSubtleCrypto, isAuthOrDecryptionError, isDataEncrypted, isEncrypted, normalizeIndexTerm, onPlatformReady, resolveInfoBytes, safeSetProperty, setHydrationAdapter, sortData, textDecoder, textEncoder$1 as textEncoder, toBase64, useDebounce, useFilterLogic, useSortLogic };