@ddunigma/node 4.0.1 → 5.0.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 (46) hide show
  1. package/README.md +105 -313
  2. package/dist/BrowserAdapter-HORDDCOE.js +2 -0
  3. package/dist/BrowserAdapter-PB4J6FHX.cjs +2 -0
  4. package/dist/NodeAdapter-5FBNCJSG.js +2 -0
  5. package/dist/NodeAdapter-EQ73FGEJ.cjs +2 -0
  6. package/dist/{ObfuscationLayer-BRiyE5xu.d.cts → ObfuscationLayer-BDr-0s1M.d.ts} +22 -4
  7. package/dist/{ObfuscationLayer-DZiQGHMw.d.ts → ObfuscationLayer-BgL73E5F.d.cts} +22 -4
  8. package/dist/browser.cjs +1 -1
  9. package/dist/browser.d.cts +4 -4
  10. package/dist/browser.d.ts +4 -4
  11. package/dist/browser.js +1 -1
  12. package/dist/chunk-5NSHXTMN.cjs +2 -0
  13. package/dist/chunk-7RWUNW5S.js +2 -0
  14. package/dist/chunk-AMOZHHMB.cjs +2 -0
  15. package/dist/chunk-CQATQOBZ.js +2 -0
  16. package/dist/chunk-HTZT725P.js +10 -0
  17. package/dist/chunk-HZJ7PU7X.cjs +2 -0
  18. package/dist/chunk-KS6PRP5Y.js +2 -0
  19. package/dist/chunk-OQXMQIE3.js +2 -0
  20. package/dist/chunk-UMA4JEN4.cjs +10 -0
  21. package/dist/{chunk-WS6GB27C.cjs → chunk-WCXD5LRF.cjs} +2 -2
  22. package/dist/core.cjs +1 -1
  23. package/dist/core.d.cts +2 -2
  24. package/dist/core.d.ts +2 -2
  25. package/dist/core.js +1 -1
  26. package/dist/{errors-DxOlTuHc.d.cts → errors-DNICpo4L.d.cts} +96 -60
  27. package/dist/{errors-DxOlTuHc.d.ts → errors-DNICpo4L.d.ts} +96 -60
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +3 -3
  30. package/dist/index.d.ts +3 -3
  31. package/dist/index.js +1 -1
  32. package/dist/wasm/codec.wasm +0 -0
  33. package/package.json +7 -3
  34. package/dist/BrowserAdapter-G4XORUQJ.js +0 -2
  35. package/dist/BrowserAdapter-LIUL744V.cjs +0 -2
  36. package/dist/NodeAdapter-AHALQ4DQ.js +0 -2
  37. package/dist/NodeAdapter-DS44MI5D.cjs +0 -2
  38. package/dist/chunk-342X2QEY.js +0 -2
  39. package/dist/chunk-65RDFQV7.js +0 -10
  40. package/dist/chunk-FACJ5LAG.cjs +0 -10
  41. package/dist/chunk-M7526IW7.js +0 -2
  42. package/dist/chunk-NY4FGVF3.cjs +0 -2
  43. package/dist/chunk-P7WJ2LOQ.js +0 -2
  44. package/dist/chunk-QR43FNIY.js +0 -2
  45. package/dist/chunk-RFBXQWSA.cjs +0 -2
  46. package/dist/chunk-RHVBUC4T.cjs +0 -2
package/dist/browser.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as BrowserAdapter } from './ObfuscationLayer-DZiQGHMw.js';
2
- export { H as HangulObfuscationLayer, c as createObfuscationLayer, a as createReadableDecodeStream, b as createReadableEncodeStream, d as detectRuntime } from './ObfuscationLayer-DZiQGHMw.js';
3
- import { D as Ddu64Core, a as DduConstructorOptions } from './errors-DxOlTuHc.js';
4
- export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, W as WasmCodec, z as isDdu64Error } from './errors-DxOlTuHc.js';
1
+ import { B as BrowserAdapter } from './ObfuscationLayer-BDr-0s1M.js';
2
+ export { H as HangulObfuscationLayer, c as createEncoderObfuscationLayer, a as createObfuscationLayer, b as createReadableDecodeStream, d as createReadableEncodeStream, e as detectRuntime } from './ObfuscationLayer-BDr-0s1M.js';
3
+ import { D as Ddu64Core, a as DduConstructorOptions } from './errors-DNICpo4L.js';
4
+ export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, W as WasmCodec, z as isDdu64Error } from './errors-DNICpo4L.js';
5
5
  export { getWasmCodec, getWasmCodecSync, preloadWasm } from './core.js';
6
6
 
7
7
  /**
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- export{c as createReadableDecodeStream,b as createReadableEncodeStream,a as detectRuntime}from'./chunk-M7526IW7.js';import {B,x}from'./chunk-65RDFQV7.js';export{C as CharsetBuilder,s as Ddu64AdapterError,q as Ddu64CharsetError,p as Ddu64ChecksumError,l as Ddu64CompressionError,B as Ddu64Core,k as Ddu64DecodeError,m as Ddu64DecompressionError,o as Ddu64DecryptionError,j as Ddu64EncodeError,n as Ddu64EncryptionError,i as Ddu64Error,h as Ddu64ErrorCode,r as Ddu64LimitError,t as Ddu64ObfuscationError,u as Ddu64StreamError,a as DduSetSymbol,b as HangulObfuscationLayer,c as createObfuscationLayer,e as getWasmCodec,f as getWasmCodecSync,v as isDdu64Error,d as preloadWasm}from'./chunk-65RDFQV7.js';import {a}from'./chunk-P7WJ2LOQ.js';export{a as BrowserAdapter}from'./chunk-P7WJ2LOQ.js';import'./chunk-QR43FNIY.js';var e=class extends B{constructor(s,n,p){let o=x(s,n,p),u={...o.dduOptions,adapter:o.dduOptions?.adapter??new a};super(o.dduChar,o.paddingChar,u);}};async function z(){return new a}export{e as Ddu64,e as Ddu64Browser,z as getAdapter};//# sourceMappingURL=browser.js.map
1
+ export{c as createReadableDecodeStream,b as createReadableEncodeStream,a as detectRuntime}from'./chunk-KS6PRP5Y.js';import {C,B}from'./chunk-HTZT725P.js';export{D as CharsetBuilder,w as Ddu64AdapterError,u as Ddu64CharsetError,t as Ddu64ChecksumError,p as Ddu64CompressionError,C as Ddu64Core,o as Ddu64DecodeError,q as Ddu64DecompressionError,s as Ddu64DecryptionError,n as Ddu64EncodeError,r as Ddu64EncryptionError,m as Ddu64Error,l as Ddu64ErrorCode,v as Ddu64LimitError,x as Ddu64ObfuscationError,y as Ddu64StreamError,a as DduSetSymbol,e as HangulObfuscationLayer,g as createEncoderObfuscationLayer,f as createObfuscationLayer,i as getWasmCodec,j as getWasmCodecSync,z as isDdu64Error,h as preloadWasm}from'./chunk-HTZT725P.js';import {a}from'./chunk-CQATQOBZ.js';export{a as BrowserAdapter}from'./chunk-CQATQOBZ.js';import'./chunk-OQXMQIE3.js';var e=class extends C{constructor(n,s,a$1){let r=B(n,s,a$1),u={...r.dduOptions,...r.dduChar!==void 0?{dduChar:r.dduChar}:{},...r.paddingChar!==void 0?{paddingChar:r.paddingChar}:{},adapter:r.dduOptions?.adapter??new a};super(u);}};async function F(){return new a}export{e as Ddu64,e as Ddu64Browser,F as getAdapter};//# sourceMappingURL=browser.js.map
2
2
  //# sourceMappingURL=browser.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var n="ddunigma:pbkdf2:v1";function r(e){return e?.algorithm??"pbkdf2"}function o(e){return e===void 0||!Number.isFinite(e)||e<=0?21e4:Math.max(1e4,Math.floor(e))}function t(e){return (e??"SHA-256").toLowerCase().replace("-","")}function i(e){return e??"SHA-256"}function d(e){return e===void 0?new TextEncoder().encode(n):typeof e=="string"?new TextEncoder().encode(e):e}exports.a=r;exports.b=o;exports.c=t;exports.d=i;exports.e=d;//# sourceMappingURL=chunk-5NSHXTMN.cjs.map
2
+ //# sourceMappingURL=chunk-5NSHXTMN.cjs.map
@@ -0,0 +1,2 @@
1
+ import {a,e,b,c}from'./chunk-OQXMQIE3.js';import {pbkdf2,pbkdf2Sync,createHash,randomBytes,createCipheriv,createDecipheriv}from'crypto';import {deflateRaw,inflateRaw,brotliCompress,brotliDecompress,deflateRawSync,inflateRawSync,constants,brotliCompressSync,brotliDecompressSync}from'zlib';import {promisify}from'util';var N=promisify(deflateRaw),h=promisify(inflateRaw),E=promisify(brotliCompress),g=promisify(brotliDecompress),_=promisify(pbkdf2);function z(e){let n=e,r=String(n?.message??"").toLowerCase();return String(n?.code??"")==="ERR_BUFFER_TOO_LARGE"||r.includes("output length")||r.includes("buffer too large")||r.includes("cannot create a buffer larger")}function f(e,n,r){throw z(e)?new Error(`[Ddu64 ${r}] Decompressed data exceeds limit. Limit: ${n} bytes`,{cause:e}):e}function s(e){return Buffer.isBuffer(e)?e:e.buffer instanceof SharedArrayBuffer?Buffer.from(e):Buffer.from(e.buffer,e.byteOffset,e.byteLength)}var S=class{supportsSyncCrypto=true;supportsSyncCompression=true;supportsBrotli=true;runtime="node";async deriveKey(n,r){if(a(r)==="pbkdf2"){let t=await _(n,e(r?.salt),b(r?.iterations),32,c(r?.hash));return new Uint8Array(t)}return this.deriveKeySync(n,r)}deriveKeySync(n,r){return a(r)==="pbkdf2"?new Uint8Array(pbkdf2Sync(n,e(r?.salt),b(r?.iterations),32,c(r?.hash))):new Uint8Array(createHash("sha256").update(n).digest())}async encrypt(n,r,t){return this.encryptSync(n,r,t)}encryptSync(n,r,t){let i=randomBytes(12),o=createCipheriv("aes-256-gcm",r,i);t&&t.length>0&&o.setAAD(s(t));let u=Buffer.concat([o.update(n),o.final()]),a=o.getAuthTag(),c=new Uint8Array(28+u.length);return c.set(i,0),c.set(a,12),c.set(u,28),c}async decrypt(n,r,t){return this.decryptSync(n,r,t)}decryptSync(n,r,t){if(n.length<28)throw new Error("[Ddu64 decrypt] Invalid encrypted data: too short");let i=n.subarray(0,12),o=n.subarray(12,28),u=n.subarray(28),a=createDecipheriv("aes-256-gcm",r,i);t&&t.length>0&&a.setAAD(s(t)),a.setAuthTag(o);let c=Buffer.concat([a.update(u),a.final()]);return new Uint8Array(c)}randomBytes(n){return new Uint8Array(randomBytes(n))}async deflate(n,r){let t={};r!==void 0&&(t.level=r);let i=await N(s(n),t);return new Uint8Array(i)}deflateSync(n,r){let t={};return r!==void 0&&(t.level=r),new Uint8Array(deflateRawSync(s(n),t))}async inflate(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY){let i=await h(s(n));return new Uint8Array(i)}let t={maxOutputLength:r};try{let i=await h(s(n),t);return new Uint8Array(i)}catch(i){f(i,r,"inflate");}}inflateSync(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY)return new Uint8Array(inflateRawSync(s(n)));try{return new Uint8Array(inflateRawSync(s(n),{maxOutputLength:r}))}catch(t){f(t,r,"inflate");}}async brotliCompress(n,r){let t={};r!==void 0&&(t.params={[constants.BROTLI_PARAM_QUALITY]:Math.max(0,Math.min(11,r))});let i=await E(s(n),t);return new Uint8Array(i)}brotliCompressSync(n,r){let t={};return r!==void 0&&(t.params={[constants.BROTLI_PARAM_QUALITY]:Math.max(0,Math.min(11,r))}),new Uint8Array(brotliCompressSync(s(n),t))}async brotliDecompress(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY){let t=await g(s(n));return new Uint8Array(t)}try{let t=await g(s(n),{maxOutputLength:r});return new Uint8Array(t)}catch(t){f(t,r,"brotli");}}brotliDecompressSync(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY)return new Uint8Array(brotliDecompressSync(s(n)));try{return new Uint8Array(brotliDecompressSync(s(n),{maxOutputLength:r}))}catch(t){f(t,r,"brotli");}}};export{S as a};//# sourceMappingURL=chunk-7RWUNW5S.js.map
2
+ //# sourceMappingURL=chunk-7RWUNW5S.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk5NSHXTMN_cjs=require('./chunk-5NSHXTMN.cjs');var b=new Map;function m(t){if(t.buffer instanceof ArrayBuffer)return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);let e=new Uint8Array(t.byteLength);return e.set(t),e.buffer}function g(t){let e=b.get(t);if(e!==void 0)return e;if(typeof CompressionStream>"u"||typeof DecompressionStream>"u")return false;try{return new CompressionStream(t),new DecompressionStream(t),b.set(t,!0),!0}catch{return false}}function l(t,e){if(!g(t)){let n=t==="brotli"?"Brotli":"Deflate raw";throw new Error(`[Ddu64 ${e}] ${n} ${e}ion is unsupported in the current runtime. CompressionStream/DecompressionStream does not support "${t}".`)}return t}var A=class{supportsSyncCrypto=false;supportsSyncCompression=false;runtime;constructor(e="browser"){this.runtime=e;}get supportsBrotli(){return g("brotli")}async deriveKey(e,n){let r=new TextEncoder().encode(e);if(chunk5NSHXTMN_cjs.a(n)==="pbkdf2"){let a=await crypto.subtle.importKey("raw",r,"PBKDF2",false,["deriveBits"]),i=await crypto.subtle.deriveBits({name:"PBKDF2",salt:chunk5NSHXTMN_cjs.e(n?.salt),iterations:chunk5NSHXTMN_cjs.b(n?.iterations),hash:chunk5NSHXTMN_cjs.d(n?.hash)},a,256);return new Uint8Array(i)}let c=await crypto.subtle.digest("SHA-256",r);return new Uint8Array(c)}async encrypt(e,n,s){let r=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["encrypt"]),a={name:"AES-GCM",iv:r,tagLength:128};s&&s.length>0&&(a.additionalData=m(s));let i=await crypto.subtle.encrypt(a,c,m(e)),o=new Uint8Array(i),p=o.slice(0,o.length-16),u=o.slice(o.length-16),y=new Uint8Array(28+p.length);return y.set(r,0),y.set(u,12),y.set(p,28),y}async decrypt(e,n,s){if(e.length<28)throw new Error("[Ddu64 decrypt] Encrypted data is invalid. Payload must be at least 28 bytes (12 IV + 16 authTag + ciphertext).");let r=e.slice(0,12),c=e.slice(12,28),a=e.slice(28),i=new Uint8Array(a.length+16);i.set(a,0),i.set(c,a.length);let o=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["decrypt"]);try{let p={name:"AES-GCM",iv:r,tagLength:128};s&&s.length>0&&(p.additionalData=m(s));let u=await crypto.subtle.decrypt(p,o,m(i));return new Uint8Array(u)}catch{throw new Error("[Ddu64 decrypt] Decryption failed: data tampering or incorrect key.")}}randomBytes(e){return crypto.getRandomValues(new Uint8Array(e))}async deflate(e,n){if(typeof CompressionStream>"u")throw new Error("[Ddu64 compress] Deflate compression is unsupported in the current runtime. CompressionStream API is not available.");let s=this.getDeflateFormat("compress"),r=new CompressionStream(s);return this.writeAndReadStream(r,e)}async inflate(e,n){if(typeof DecompressionStream>"u")throw new Error("[Ddu64 decompress] Deflate decompression is unsupported in the current runtime. DecompressionStream API is not available.");let s=this.getDeflateFormat("decompress"),r=new DecompressionStream(s);return this.writeAndReadStream(r,e,n)}async brotliCompress(e,n){let s=l("brotli","compress"),r=new CompressionStream(s);return this.writeAndReadStream(r,e)}async brotliDecompress(e,n){let s=l("brotli","decompress"),r=new DecompressionStream(s);return this.writeAndReadStream(r,e,n)}getDeflateFormat(e){return l("deflate-raw",e)}async writeAndReadStream(e,n,s){let r=e.writable.getWriter(),c=e.readable.getReader(),a=(async()=>{await r.write(new Uint8Array(m(n))),await r.close();})(),i=this.readAllChunks(c,s);try{let[o]=await Promise.all([i,a]);return o}catch(o){throw await c.cancel(o).catch(()=>{}),await r.abort(o).catch(()=>{}),o}}async readAllChunks(e,n){let s=[],r=0;for(;;){let{done:i,value:o}=await e.read();if(i)break;if(r+=o.length,n!==void 0&&r>n)throw new Error(`[Ddu64 decompress] Decompressed size exceeds limit. Estimated ${r}+ bytes exceeds maximum of ${n} bytes.`);s.push(o);}let c=new Uint8Array(r),a=0;for(let i of s)c.set(i,a),a+=i.length;return c}};exports.a=A;//# sourceMappingURL=chunk-AMOZHHMB.cjs.map
2
+ //# sourceMappingURL=chunk-AMOZHHMB.cjs.map
@@ -0,0 +1,2 @@
1
+ import {a,d,b as b$1,e}from'./chunk-OQXMQIE3.js';var b=new Map;function m(t){if(t.buffer instanceof ArrayBuffer)return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);let e=new Uint8Array(t.byteLength);return e.set(t),e.buffer}function g(t){let e=b.get(t);if(e!==void 0)return e;if(typeof CompressionStream>"u"||typeof DecompressionStream>"u")return false;try{return new CompressionStream(t),new DecompressionStream(t),b.set(t,!0),!0}catch{return false}}function l(t,e){if(!g(t)){let n=t==="brotli"?"Brotli":"Deflate raw";throw new Error(`[Ddu64 ${e}] ${n} ${e}ion is unsupported in the current runtime. CompressionStream/DecompressionStream does not support "${t}".`)}return t}var A=class{supportsSyncCrypto=false;supportsSyncCompression=false;runtime;constructor(e="browser"){this.runtime=e;}get supportsBrotli(){return g("brotli")}async deriveKey(e$1,n){let r=new TextEncoder().encode(e$1);if(a(n)==="pbkdf2"){let a=await crypto.subtle.importKey("raw",r,"PBKDF2",false,["deriveBits"]),i=await crypto.subtle.deriveBits({name:"PBKDF2",salt:e(n?.salt),iterations:b$1(n?.iterations),hash:d(n?.hash)},a,256);return new Uint8Array(i)}let c=await crypto.subtle.digest("SHA-256",r);return new Uint8Array(c)}async encrypt(e,n,s){let r=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["encrypt"]),a={name:"AES-GCM",iv:r,tagLength:128};s&&s.length>0&&(a.additionalData=m(s));let i=await crypto.subtle.encrypt(a,c,m(e)),o=new Uint8Array(i),p=o.slice(0,o.length-16),u=o.slice(o.length-16),y=new Uint8Array(28+p.length);return y.set(r,0),y.set(u,12),y.set(p,28),y}async decrypt(e,n,s){if(e.length<28)throw new Error("[Ddu64 decrypt] Encrypted data is invalid. Payload must be at least 28 bytes (12 IV + 16 authTag + ciphertext).");let r=e.slice(0,12),c=e.slice(12,28),a=e.slice(28),i=new Uint8Array(a.length+16);i.set(a,0),i.set(c,a.length);let o=await crypto.subtle.importKey("raw",m(n),{name:"AES-GCM"},false,["decrypt"]);try{let p={name:"AES-GCM",iv:r,tagLength:128};s&&s.length>0&&(p.additionalData=m(s));let u=await crypto.subtle.decrypt(p,o,m(i));return new Uint8Array(u)}catch{throw new Error("[Ddu64 decrypt] Decryption failed: data tampering or incorrect key.")}}randomBytes(e){return crypto.getRandomValues(new Uint8Array(e))}async deflate(e,n){if(typeof CompressionStream>"u")throw new Error("[Ddu64 compress] Deflate compression is unsupported in the current runtime. CompressionStream API is not available.");let s=this.getDeflateFormat("compress"),r=new CompressionStream(s);return this.writeAndReadStream(r,e)}async inflate(e,n){if(typeof DecompressionStream>"u")throw new Error("[Ddu64 decompress] Deflate decompression is unsupported in the current runtime. DecompressionStream API is not available.");let s=this.getDeflateFormat("decompress"),r=new DecompressionStream(s);return this.writeAndReadStream(r,e,n)}async brotliCompress(e,n){let s=l("brotli","compress"),r=new CompressionStream(s);return this.writeAndReadStream(r,e)}async brotliDecompress(e,n){let s=l("brotli","decompress"),r=new DecompressionStream(s);return this.writeAndReadStream(r,e,n)}getDeflateFormat(e){return l("deflate-raw",e)}async writeAndReadStream(e,n,s){let r=e.writable.getWriter(),c=e.readable.getReader(),a=(async()=>{await r.write(new Uint8Array(m(n))),await r.close();})(),i=this.readAllChunks(c,s);try{let[o]=await Promise.all([i,a]);return o}catch(o){throw await c.cancel(o).catch(()=>{}),await r.abort(o).catch(()=>{}),o}}async readAllChunks(e,n){let s=[],r=0;for(;;){let{done:i,value:o}=await e.read();if(i)break;if(r+=o.length,n!==void 0&&r>n)throw new Error(`[Ddu64 decompress] Decompressed size exceeds limit. Estimated ${r}+ bytes exceeds maximum of ${n} bytes.`);s.push(o);}let c=new Uint8Array(r),a=0;for(let i of s)c.set(i,a),a+=i.length;return c}};export{A as a};//# sourceMappingURL=chunk-CQATQOBZ.js.map
2
+ //# sourceMappingURL=chunk-CQATQOBZ.js.map
@@ -0,0 +1,10 @@
1
+ var fe=(n=>(n.DDU="ddu",n.DDU_V1="ddu_v1",n.ONECHARSET="oneCharSet",n))(fe||{}),ee={dduSetSymbol:"ddu",usePowerOfTwo:true,requiredLength:64};function me(e){if(e.length===0)throw new Error("[Ddu64 obfuscation] Alphabet must not be empty.");if(e.length>11172)throw new Error(`[Ddu64 obfuscation] Alphabet size (${e.length}) exceeds available Hangul syllables (11172).`);let t=Math.floor(11172/e.length),r=new Map;for(let n=0;n<e.length;n++)r.set(e[n],n);return {alphabet:e,syllablesPerChar:t,charToIndex:r}}function ye(e,t,r){let n=44032+e*r.syllablesPerChar,o=t%r.syllablesPerChar;return n+o}function ge(e,t){if(e<44032||e>55203)return -1;let r=e-44032,n=Math.floor(r/t.syllablesPerChar);return n>=t.alphabet.length?-1:n}var N="DDS1",K="ELYSIA",H="GRISEO";var Ut=new TextEncoder;function k(e,t,r){let n=r-t.length;if(n<0)return false;for(let o=0;o<t.length;o++)if(e.charCodeAt(n+o)!==t.charCodeAt(o))return false;return true}function be(e,t,r,n=2){let o=e.length,i=t.length,s={cleanedInput:e,paddingBits:0,isEncrypted:false,pipelineVersion:2};if(i===0||o<i)return s;let c=Math.max(0,r-1).toString().length;for(let d=Math.min(c,o);d>=1;d--){let u=o-d,p=true;for(let A=u;A<o;A++){let x=e.charCodeAt(A);if(x<48||x>57){p=false;break}}if(!p||d>1&&e.charCodeAt(u)===48)continue;let h=0;for(let A=u;A<o;A++)h=h*10+(e.charCodeAt(A)-48);if(h>=r)continue;let l=u,m=false,f,y=2;l>=2&&k(e,"V4",l)?(y=4,l-=2):l>=2&&k(e,"V3",l)&&(y=3,l-=2),l>=3&&k(e,"ENC",l)&&(m=true,l-=3),l>=K.length&&k(e,K,l)?(f="deflate",l-=K.length):l>=H.length&&k(e,H,l)&&(f="brotli",l-=H.length);let b=l-i;if(b>=0&&k(e,t,l))return {cleanedInput:e.substring(0,b),paddingBits:h,compressionAlgorithm:f,isEncrypted:m,pipelineVersion:y}}if(k(e,t,o)){let d=0,u=o;for(;u>=i&&k(e,t,u);)d++,u-=i;if(d>0){let p=d*n;if(p<r)return {cleanedInput:e.substring(0,u),paddingBits:p,isEncrypted:false,pipelineVersion:2}}}return s}function Lt(e){let t=e.lastIndexOf("CHK");if(t===-1)return {data:e,checksum:null};let r=e.slice(t+3);return r.length!==8||!/^[0-9a-f]+$/i.test(r)?{data:e,checksum:null}:{data:e.slice(0,t),checksum:r.toLowerCase()}}var vt=/^[0-9a-f]{8}$/i;function Ce(e){let t=e.length;if(t>=11){let n=e.charCodeAt(t-11),o=e.charCodeAt(t-10),i=e[t-9];if(n===67&&o===75&&(i==="P"||i==="O")){let s=e.slice(t-8);if(vt.test(s))return {data:e.slice(0,t-11),checksum:s.toLowerCase(),scope:i==="P"?"plaintext":"output"}}}let r=Lt(e);return {data:r.data,checksum:r.checksum,scope:null}}function Bt(e){return e.length*2+N.length+2}function ur(e,t){let r=t.compressionAlgorithm==="brotli"?"B":t.compressionAlgorithm==="deflate"?"D":"N",n=t.encrypted?"1":"0";return `${e}${N}${r}${n}${e}`}function lr(e,t){let r=Bt(t);if(e.length<r||!e.startsWith(t))return null;let n=t.length;if(e.slice(n,n+N.length)!==N)throw new Error("[wireFormat] Invalid stream header magic");let i=e[n+N.length],s=e[n+N.length+1];if(e.slice(r-t.length,r)!==t)throw new Error("[wireFormat] Invalid stream header terminator");let c=i==="B"?"brotli":i==="D"?"deflate":i==="N"?void 0:null;if(c===null)throw new Error("[wireFormat] Invalid stream header compression flag");if(s!=="0"&&s!=="1")throw new Error("[wireFormat] Invalid stream header encryption flag");return {compressionAlgorithm:c,encrypted:s==="1"}}function Ae(e){let{paddingBits:t,compressionAlgorithm:r,isEncrypted:n,paddingChar:o,useRepeatPadding:i,bitsPerPadChar:s=2,pipelineVersion:a=2}=e;if(!n&&a!==2)throw new Error("[wireFormat] Pipeline version markers require encryption");if(t===0&&!r&&!n&&a===2)return "";if(i&&!r&&!n&&a===2&&t>0&&t%s===0){let d=t/s;return o.repeat(d)}return o+(r==="deflate"?K:r==="brotli"?H:"")+(n?"ENC":"")+(a===4?"V4":a===3?"V3":"")+t.toString()}function G(e){return Ut.encode(`ddunigma:wire:v4;enc=1;compress=${e.compressionAlgorithm??"none"}`)}function $(e,t){let r=new Set(e);r.add(t);let n=K+H+"ENC"+"V3"+"V4";for(let o of n)r.add(o);for(let o of "0123456789")r.add(o);return [...r]}var z=class{config;constructor(t){this.config=me(t);}obfuscate(t){if(t.length===0)return "";let r=new Array(t.length);for(let n=0;n<t.length;n++){let o=t[n],i=this.config.charToIndex.get(o);if(i===void 0)throw new Error(`[Ddu64 obfuscation] Character "${o}" (U+${o.charCodeAt(0).toString(16).padStart(4,"0").toUpperCase()}) not found in obfuscation alphabet.`);let s=ye(i,n,this.config);r[n]=String.fromCharCode(s);}return r.join("")}deobfuscate(t){if(t.length===0)return "";let r=new Array(t.length);for(let n=0;n<t.length;n++){let o=t.charCodeAt(n),i=ge(o,this.config);if(i===-1)throw new Error(`[Ddu64 obfuscation] Invalid syllable at position ${n}: U+${o.toString(16).padStart(4,"0").toUpperCase()} is not in the mapped range.`);r[n]=this.config.alphabet[i];}return r.join("")}};function gr(e,t){let r=new Set(e);r.add(t);let n=[...r];return new z(n)}function br(e,t){return new z($(e,t))}var I=null,Y=false,P=false,S=null,we=Rt,te=class{exports;constructor(t){this.exports=t;}get ready(){return true}encode(t,r){let{exports:n}=this;if(t.length===0)return {indices:new Uint16Array(0),paddingBits:0};let o=n.alloc(t.length);new Uint8Array(n.memory.buffer).set(t,o);let s=1<<r,a=1;try{let c=n.encode(o,t.length,r,s,a),d=n.get_result_ptr(),u=new Uint16Array(n.memory.buffer,d,c),p=new Uint16Array(c);return p.set(u),{indices:p,paddingBits:n.get_padding_bits()}}finally{n.dealloc(o,t.length);}}decode(t,r,n){let{exports:o}=this;if(t.length===0)return new Uint8Array(0);let i=t.length*2,s=o.alloc(i);new Uint16Array(o.memory.buffer,s,t.length).set(t);let c=1<<r,d=1;try{let u=o.decode(s,t.length,r,c,d,n);if(u===4294967295)throw new Error("[WasmCodec decode] Invalid index in input");let p=o.get_result_ptr(),h=new Uint8Array(o.memory.buffer,p,u),l=new Uint8Array(u);return l.set(h),l}finally{o.dealloc(s,i);}}};async function Rt(){try{if(typeof fetch!="function")return null;let e=await fetch(new URL("./wasm/codec.wasm",import.meta.url));return e.ok?await e.arrayBuffer():null}catch{return null}}async function _t(e){try{if(e.byteLength<16)return null;let t=new Uint8Array(e,0,4);if(t[0]!==0||t[1]!==97||t[2]!==115||t[3]!==109)return null;let r;try{r=await WebAssembly.compile(e);}catch{return null}let o=(await WebAssembly.instantiate(r,{})).exports;return typeof o.alloc!="function"||typeof o.dealloc!="function"||typeof o.encode!="function"||typeof o.decode!="function"||typeof o.get_result_ptr!="function"||typeof o.get_padding_bits!="function"||!o.memory?null:o}catch{return null}}async function Se(){try{if(I)return !0;if(P)return !1;let e=await we();if(!e)return P=!0,!1;let t=await _t(e);return t?(I=new te(t),!0):(P=!0,!1)}catch{return P=true,false}}function Mt(e,t){let r;return {promise:new Promise((i,s)=>{r=setTimeout(()=>s(new Error(t)),e);}),clear:()=>clearTimeout(r)}}async function Ar(){if(I)return;if(S)return S;let e=Mt(1e4,"[Ddu64 wasm] WASM initialization timed out (10s)"),t=async()=>{try{if(!await Se())throw new Error("[Ddu64 wasm] WASM initialization failed")}finally{e.clear();}};return S=Promise.race([t(),e.promise]).finally(()=>{S=null,Y=true;}),S}function wr(){if(I)return I;if(P)return null;if(!Y&&!S){Y=true;let e;S=new Promise(t=>{e=setTimeout(()=>{P=true,t();},5e3),Se().then(r=>{r||(P=true);}).catch(()=>{P=true;}).finally(()=>{e!==void 0&&clearTimeout(e),t();});}).finally(()=>{S=null;});}return null}function re(){return I}function Pe(e){if(e===Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(!Number.isFinite(e))throw new Error(`[Ddu64 config] wasmThreshold must be a finite number or Infinity, got ${e}`);return Math.max(1024,Math.min(1048576,Math.round(e)))}function Sr(e){we=e,!I&&!S&&(Y=false,P=false);}function D(e){let t=e.toLowerCase();return t.includes("[ddu64 adapter]")||t.includes("no platform adapter available")||t.includes("sync encryption unavailable")||t.includes("sync decryption unavailable")||t.includes("sync compression unavailable")||t.includes("sync decompression unavailable")||t.includes("sync key derivation unavailable")||t.includes("brotli compression is unavailable")||t.includes("brotli decompression is unavailable")||t.includes("compressionstream/decompressionstream does not support")||t.includes("crypto provider unavailable")}var Nt=(l=>(l.EncodeFailed="DDU64_ENCODE_FAILED",l.DecodeFailed="DDU64_DECODE_FAILED",l.CompressionFailed="DDU64_COMPRESSION_FAILED",l.DecompressionFailed="DDU64_DECOMPRESSION_FAILED",l.EncryptionFailed="DDU64_ENCRYPTION_FAILED",l.DecryptionFailed="DDU64_DECRYPTION_FAILED",l.ChecksumMismatch="DDU64_CHECKSUM_MISMATCH",l.InvalidCharset="DDU64_INVALID_CHARSET",l.InvalidInput="DDU64_INVALID_INPUT",l.LimitExceeded="DDU64_LIMIT_EXCEEDED",l.AdapterUnavailable="DDU64_ADAPTER_UNAVAILABLE",l.ObfuscationFailed="DDU64_OBFUSCATION_FAILED",l.StreamFailed="DDU64_STREAM_FAILED",l))(Nt||{}),C=class extends Error{code;operation;constructor(t,r){super(t,{cause:r.cause}),this.name=new.target.name,this.code=r.code,this.operation=r.operation;}},ne=class extends C{constructor(t,r){super(t,{code:"DDU64_ENCODE_FAILED",operation:"encode",cause:r});}},oe=class extends C{constructor(t,r){super(t,{code:"DDU64_DECODE_FAILED",operation:"decode",cause:r});}},R=class extends C{constructor(t,r){super(t,{code:"DDU64_COMPRESSION_FAILED",operation:"compress",cause:r});}},_=class extends C{constructor(t,r){super(t,{code:"DDU64_DECOMPRESSION_FAILED",operation:"decompress",cause:r});}},U=class extends C{constructor(t,r){super(t,{code:"DDU64_ENCRYPTION_FAILED",operation:"encrypt",cause:r});}},L=class extends C{constructor(t,r){super(t,{code:"DDU64_DECRYPTION_FAILED",operation:"decrypt",cause:r});}},v=class extends C{constructor(t,r){super(t,{code:"DDU64_CHECKSUM_MISMATCH",operation:"checksum",cause:r});}},ie=class extends C{constructor(t,r){super(t,{code:"DDU64_INVALID_CHARSET",operation:"charset",cause:r});}},se=class extends C{constructor(t,r,n){super(t,{code:"DDU64_LIMIT_EXCEEDED",operation:r,cause:n});}},g=class extends C{constructor(t,r,n){super(t,{code:"DDU64_ADAPTER_UNAVAILABLE",operation:r,cause:n});}},F=class extends C{constructor(t,r){super(t,{code:"DDU64_OBFUSCATION_FAILED",operation:"obfuscation",cause:r});}},ae=class extends C{constructor(t,r){super(t,{code:"DDU64_STREAM_FAILED",operation:"stream",cause:r});}};function B(e){return e instanceof C}function T(e){return e instanceof Error&&e.message?e.message:String(e)}function w(e,t){if(B(e))return e;let r=T(e),n=r.toLowerCase();if(n.startsWith("[ddu64")||n.startsWith("[bitpack")){if(n.includes("checksum"))return new v(r,e);if(n.includes("obfuscation"))return new F(r,e);if(D(r))return new g(r,t,e);if(n.includes("encryptionkey")||n.includes("encrypted payload requires"))return t==="encode"?new U(r,e):new L(r,e);if(n.includes("decrypt")||n.includes("decryption")||n.includes("incorrect key"))return new L(r,e);if(n.includes("encrypt"))return new U(r,e);if(n.includes("decompress")||n.includes("inflate"))return new _(r,e);if(n.includes("compress")||n.includes("brotli"))return new R(r,e);if(n.includes("limit")||n.includes("exceeds"))return new se(r,t,e);if(n.includes("charset")||n.includes("character")||n.includes("invalid"))return new ie(r,e)}return t==="stream"?new ae(r,e):t==="encode"?new ne(r,e):new oe(r,e)}function De(e,t){let{bitLength:r,usePowerOfTwo:n,charsetSize:o}=t,i=e.length;if(i===0)return {indices:[],paddingBits:0};if(n){if(r===6)return Kt(e);if(r===8)return Ht(e)}let s=i*8,a=Math.ceil(s/r),c=n?a:a*2,d=new Array(c),u=0,p=0,h=0;if(n){let m=(1<<r)-1;for(let f=0;f<i;f++)for(p=p<<8|e[f],h+=8;h>=r;)h-=r,d[u++]=p>>h&m,p&=(1<<h)-1;}else for(let m=0;m<i;m++)for(p=p<<8|e[m],h+=8;h>=r;){h-=r;let f=p>>h,y=f/o|0;d[u++]=y,d[u++]=f-y*o,p&=(1<<h)-1;}let l=0;if(h>0){l=r-h;let m=p<<l;if(n)d[u++]=m;else {let f=m/o|0;d[u++]=f,d[u++]=m-f*o;}}return u!==c&&(d.length=u),{indices:d,paddingBits:l}}function Kt(e){let t=e.length,r=t/3|0,n=t-r*3,o=new Array(r*4+(n===0?0:n+1)),i=0,s=0;for(;s+2<t;s+=3){let c=e[s],d=e[s+1],u=e[s+2];o[i++]=c>>>2,o[i++]=(c&3)<<4|d>>>4,o[i++]=(d&15)<<2|u>>>6,o[i++]=u&63;}let a=0;if(n===1){let c=e[s];o[i++]=c>>>2,o[i]=(c&3)<<4,a=4;}else if(n===2){let c=e[s],d=e[s+1];o[i++]=c>>>2,o[i++]=(c&3)<<4|d>>>4,o[i]=(d&15)<<2,a=2;}return {indices:o,paddingBits:a}}function Ht(e){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return {indices:t,paddingBits:0}}function Ee(e,t,r){let{bitLength:n,usePowerOfTwo:o,charsetSize:i}=r,s=e.length;if(s===0)return new Uint8Array(0);let a=o?1:2,c=Math.ceil(s/a),d=Math.ceil((c*n-t)/8),u=new Uint8Array(d+1),p=0,h=0,l=0;if(o)for(let m=0;m<s;m+=a){let f=e[m];if(f<0||f>=i)throw new Error(`[BitPack decode] Invalid index ${f} at position ${m}`);for(h=h<<n|f,l+=n,m+a>=s&&t>0&&(h>>=t,l-=t);l>=8;)l-=8,u[p++]=h>>l&255,h&=(1<<l)-1;}else {let m=n<31?1<<n:Math.pow(2,n);for(let f=0;f<s;f+=a){let y=e[f],b=e[f+1];if(y<0||y>=i)throw new Error(`[BitPack decode] Invalid index ${y} at position ${f}`);if(b===void 0||b<0||b>=i)throw new Error(`[BitPack decode] Invalid index ${b} at position ${f+1}`);let A=y*i+b;if(A>=m)throw new Error(`[BitPack decode] Value ${A} exceeds range at position ${f}`);for(h=h<<n|A,l+=n,f+a>=s&&t>0&&(h>>=t,l-=t);l>=8;)l-=8,u[p++]=h>>l&255,h&=(1<<l)-1;}}return u.subarray(0,p)}function xe(e,t){return e<=1?0:t?Math.floor(Math.log2(e)):Math.ceil(Math.log2(e))}function ke(e){return e>0&&(e&e-1)===0}var zt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let n=0;n<8;n++)r=r>>>1^(r&1?3988292384:0);e[t]=r;}return e})();function O(e){let t=4294967295;for(let r=0;r<e.length;r++)t=t>>>8^zt[(t^e[r])&255];return ((t^4294967295)>>>0).toString(16).padStart(8,"0")}function ce(e,t){let r=Math.max(e.length,t.length),n=e.length^t.length;for(let o=0;o<r;o++){let i=o<e.length?e.charCodeAt(o):0,s=o<t.length?t.charCodeAt(o):0;n|=i^s;}return n===0}var Ue=["-","_","."];function Le(e){return e.length===0?e:e.replaceAll("+","-").replaceAll("/","_").replaceAll("=",".")}function ve(e){return e.length===0?e:e.replaceAll("-","+").replaceAll("_","/").replaceAll(".","=")}function Be(e,t,r){if(t<=0||e.length<=t)return e;let n=Math.ceil(e.length/t),o=new Array(n*2-1),i=0;for(let s=0;s<e.length;s+=t)o[i++]=e.slice(s,s+t),s+t<e.length&&(o[i++]=r);return o.join("")}function Te(e,t){if(e.length===0)return e;let r=t&&t!==`
2
+ `&&t!==`\r
3
+ `&&t!=="\r"?t:"",n=e.includes(`
4
+ `)||e.includes("\r"),o=r.length>0&&e.includes(r);if(!n&&!o)return e;let i=n?e.replace(/[\r\n]/g,""):e;return o&&(i=i.replaceAll(r,"")),i}var Oe={"":0,\u3131:1,\u3132:2,\u3133:3,\u3134:4,\u3135:5,\u3136:6,\u3137:7,\u3139:8,\u313A:9,\u313B:10,\u313C:11,\u313D:12,\u313E:13,\u313F:14,\u3140:15,\u3141:16,\u3142:17,\u3144:18,\u3145:19,\u3146:20,\u3147:21,\u3148:22,\u314A:23,\u314B:24,\u314C:25,\u314D:26,\u314E:27};function Ie(e){return Object.prototype.hasOwnProperty.call(Oe,e)}function Ft(e,t){let r=e.charCodeAt(0);if(r<44032||r>55203)return e;let n=r-(r-44032)%28,o=Oe[t]??0;return String.fromCharCode(n+o)}function q(e,t){let r=new Array(e.length*t.length),n=0;for(let o of e)for(let i of t)r[n++]=Ft(o,i);return r}function j(e,t){let n=e===void 0||!Number.isFinite(e)?6:Math.floor(e);return Math.min(t==="brotli"?11:9,Math.max(0,n))}var Vt=new TextEncoder,Wt=new TextDecoder;function V(e){return Vt.encode(e)}function de(e){return Wt.decode(e)}var Gt={symbol:"ddu",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","\uB4C0","\uB31C","\uB3A8"],codaChar:["","\u3131","\u3132","\u3137","\u3148","\u3147","\u3145","\u3146"],maxRequiredLength:64,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true},$t={symbol:"ddu_v1",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","!","?","."],maxRequiredLength:8,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true,usePowerOfTwo:false,encodingProfile:{bitLength:6,usePowerOfTwo:false,bitsPerPadChar:2}},Yt={symbol:"oneCharSet",charSet:["A","s","q","r","0","z","3","t","y","1","5","2","4","E","B","C","Q","F","R","T","U","W","V","X","Y","Z","b","a","c","d","D","G","L","H","I","-","J","K","M","O","N","f","e","h","g","P","i","S","k","l","m","u","j","v","n","o","p","9","w","6","7","8","x","_"],paddingChar:"=",maxRequiredLength:64,bitLength:6};function Z(e){switch(e){case "ddu":return Gt;case "ddu_v1":return $t;case "oneCharSet":return Yt;default:return}}var qt=65536;function Re(e,t,r,n){let o=(i,s,a,c,d)=>{if(jt(a,r?.usePowerOfTwo)&&a>0){let h=Math.floor(Math.log2(a)),l=1<<h;return {charSet:i.length===l?i:i.slice(0,l),padding:s,requiredLength:l,bitLength:h,isPredefined:c,useRepeatPadding:d}}return {charSet:i.length===a?i:i.slice(0,a),padding:s,requiredLength:a,bitLength:a>0?Math.ceil(Math.log2(a)):0,isPredefined:c,useRepeatPadding:d}};try{let i=e??r?.dduChar,s=t??r?.paddingChar;if(i){if(!s)throw new Error("[Ddu64 Constructor] paddingChar is required when dduChar is provided.");let h=typeof i=="string"?[...i]:[...i],l=r?.codaChar,m=l?!0:r?.useRepeatPadding??!1;if(l&&l.length>0){if(n){let y=l.filter(b=>!Ie(b));if(y.length>0)throw new Error(`[Ddu64 Constructor] Unknown coda character(s): [${y.join(", ")}]. Coda must be empty ("") or a Hangul jongseong jamo (\u3131, \u3132, \u3133, \u2026 \u314E). Unknown coda collapses to no-coda and can create duplicate symbols.`)}h=q(h,l);}if(n&&new Set(h).size!==h.length){let b=h.filter((A,x)=>h.indexOf(A)!==x);throw new Error(`[Ddu64 Constructor] Character set contains duplicate characters: [${[...new Set(b)].join(", ")}]`)}let f=r?.requiredLength??h.length;if(h.length<f)throw new Error("[Ddu64 Constructor] Insufficient characters.");return o(h,s,f,!1,m)}let a=r?.dduSetSymbol??ee.dduSetSymbol??"ddu",c=Zt(a),d=c.codaChar?q(c.charSet,c.codaChar):c.charSet,u=o(d,c.paddingChar,c.maxRequiredLength,!0,c.useRepeatPadding),p=c.encodingProfile;return p?(u.encodingProfile=p,u.bitLength=p.bitLength,u.usePowerOfTwo=p.usePowerOfTwo,u.bitsPerPadChar=p.bitsPerPadChar):(u.bitsPerPadChar=c.bitsPerPadChar,u.usePowerOfTwo=c.usePowerOfTwo,c.usePowerOfTwo===!1&&(u.bitLength=c.bitLength)),u}catch(i){if(n)throw i;return ue(r)}}function _e(e,t,r){let n=[e,null];for(let i of n){let s=i?{...i}:ue(r);try{let a=s.charSet,c=s.requiredLength,d=Array.from(new Set(a));if(d.length!==a.length){if(t){let h=a.filter((l,m)=>a.indexOf(l)!==m);throw new Error(`[Ddu64 normalizeCharSet] Character set contains duplicate characters: [${[...new Set(h)].join(", ")}]`)}a=d,s.isPredefined||(c=a.length);}if(a.length<c)throw new Error(`[Ddu64 normalizeCharSet] Insufficient characters. Required: ${c}, Has: ${a.length}`);if(c<2)throw new Error("[Ddu64 normalizeCharSet] At least 2 unique characters required.");if(a.length===0)throw new Error("[Ddu64 normalizeCharSet] Empty charset.");if(a.find(h=>h.length!==1)){if(t)throw new Error("[Ddu64 normalizeCharSet] Multi-character symbols are not supported.");continue}if(a.length>qt){if(t)throw new Error("[Ddu64 normalizeCharSet] Charset size exceeds maximum supported size of 65536.");continue}if(s.padding.length!==1)throw new Error(`[Ddu64 normalizeCharSet] Padding length mismatch. Expected 1, got ${s.padding.length}`);if(a.includes(s.padding)){if(t)throw new Error(`[Ddu64 normalizeCharSet] Padding character "${s.padding}" conflicts with charset.`);a=a.filter(h=>h!==s.padding);}for(let h of a)if(h.includes(`
5
+ `)||h.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");if(s.padding.includes(`
6
+ `)||s.padding.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");return {charSet:a.length===c?a:a.slice(0,c),padding:s.padding,isPredefined:s.isPredefined}}catch(a){if(t)throw a}}let o=ue(r);return {charSet:o.charSet.slice(0,o.requiredLength),padding:o.padding,isPredefined:true}}function Me(e,t,r){for(let n of Ue){for(let o of e)if(o.includes(n)){let i=`[Ddu64 Constructor] URL-Safe mode conflict: charset character "${o}" contains "${n}".`;if(r)throw new Error(i);return false}if(t.includes(n)){let o=`[Ddu64 Constructor] URL-Safe mode conflict: padding character "${t}" contains "${n}".`;if(r)throw new Error(o);return false}}return true}function Ne(e,t,r){if(r>256)return;let n=Math.min(e.length,r),o=e.slice(0,n),i=new Set;for(let a=0;a<o.length;a++)i.add(o[a]);i.add(t);for(let a=0;a<o.length;a++){let c=o[a];for(let p=0;p<o.length;p++){let h=c+o[p];if(i.has(h))throw new Error(`Combination conflict: "${c}" + "${o[p]}"`);i.add(h);}let d=c+t;if(i.has(d))throw new Error(`Combination conflict: "${c}" + padding`);i.add(d);let u=t+c;if(i.has(u))throw new Error(`Combination conflict: padding + "${c}"`);i.add(u);}let s=t+t;if(i.has(s))throw new Error("Combination conflict: double padding");i.add(s);}function jt(e,t){return t!==void 0?t?e>0:false:e>0&&(e&e-1)===0}function Zt(e){let t=Z(e);if(!t)throw new Error(`CharSet with symbol ${e} not found`);return t}function ue(e){let t=e?.dduSetSymbol??ee.dduSetSymbol??"oneCharSet",r=Z(t)??Z("oneCharSet");if(!r)throw new Error("Critical: No fallback CharSet available");return {charSet:r.codaChar?q(r.charSet,r.codaChar):r.charSet,padding:r.paddingChar,requiredLength:r.maxRequiredLength,bitLength:r.encodingProfile?.bitLength??r.bitLength,isPredefined:true,useRepeatPadding:r.useRepeatPadding,bitsPerPadChar:r.encodingProfile?.bitsPerPadChar??r.bitsPerPadChar,usePowerOfTwo:r.encodingProfile?.usePowerOfTwo??r.usePowerOfTwo,encodingProfile:r.encodingProfile}}var Xt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ke(e,t,r,n){return r&&n===6&&t==="="&&e.join("")===Xt}function He(e){let t=Jt(e);if(t===null)return null;let r=0,n=t.length;for(;n>0&&t[n-1]==="=";)r++,n--;return {payload:t.slice(0,n),paddingBits:r===2?4:r===1?2:0}}function ze(e,t,r){let n=t===4?2:t===2?1:t===0?0:-1;if(n<0)return null;for(let o=0;o<e.length;o++)if(!r(e.charCodeAt(o)))return null;return Qt(e+"=".repeat(n))}function Jt(e){let t=e.toBase64;if(typeof t=="function")return t.call(e);let r=globalThis.Buffer;return r?.from?r.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"):null}function Qt(e){let t=Uint8Array;if(typeof t.fromBase64=="function")return t.fromBase64(e);let r=globalThis.Buffer;if(r?.from){let n=r.from(e,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}return null}function X(e,t){if(!e)throw new g("[Ddu64 adapter] No platform adapter available. Use encodeAsync()/decodeAsync() in browser environments, or provide an adapter via options.adapter.",t);return e}function Fe(e,t,r){let n=X(e.adapter,"encode");if(!n.encryptSync)throw new g("[Ddu64 encrypt] Sync encryption unavailable. Use encodeAsync() in browser environments.","encode");let o=$e(e,n,"encrypt","encode");return n.encryptSync(t,o,r)}function Ve(e,t,r){let n=X(e.adapter,"decode");if(!n.decryptSync)throw new g("[Ddu64 decrypt] Sync decryption unavailable. Use decodeAsync() in browser environments.","decode");let o=$e(e,n,"decrypt","decode");return n.decryptSync(t,o,r)}function We(e,t,r,n){let o=X(e,"encode");if(r==="brotli"){if(!o.brotliCompressSync)throw new g("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return o.brotliCompressSync(t,n)}if(!o.deflateSync)throw new g("[Ddu64 compress] Sync compression unavailable. Use encodeAsync() in browser environments.","encode");return o.deflateSync(t,n)}function Ge(e,t,r,n){let o=X(e,"decode");if(r==="brotli"){if(!o.brotliDecompressSync)throw new g("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return o.brotliDecompressSync(t,n)}if(!o.inflateSync)throw new g("[Ddu64 decompress] Sync decompression unavailable. Use decodeAsync() in browser environments.","decode");return o.inflateSync(t,n)}function $e(e,t,r,n){if(e.encryptionKeyHash)return e.encryptionKeyHash;if(!t.deriveKeySync){let i=r==="encrypt"?"encodeAsync":"decodeAsync";throw new g(`[Ddu64 ${r}] Sync key derivation unavailable. Use ${i}() in browser environments.`,n)}let o=t.deriveKeySync(e.encryptionKey,e.keyDerivation);return e.setEncryptionKeyHash(o),o}async function Ye(e,t,r){try{let n=J(e.adapter,"encode"),o=await Ze(e,n);return await n.encrypt(t,o,r)}catch(n){throw Q(n,"encode","encrypt")}}async function qe(e,t,r){try{let n=J(e.adapter,"decode"),o=await Ze(e,n);return await n.decrypt(t,o,r)}catch(n){throw Q(n,"decode","decrypt")}}async function le(e,t,r,n){try{let o=J(e,"encode");if(r==="brotli"){if(!o.brotliCompress)throw new g("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return await o.brotliCompress(t,n)}return await o.deflate(t,n)}catch(o){throw Q(o,"encode","compress")}}async function je(e,t,r,n){try{let o=J(e,"decode");if(r==="brotli"){if(!o.brotliDecompress)throw new g("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return await o.brotliDecompress(t,n)}return await o.inflate(t,n)}catch(o){throw Q(o,"decode","decompress")}}function J(e,t){if(!e)throw new g("[Ddu64 adapter] No platform adapter available. Use @ddunigma/node or @ddunigma/node/browser, or provide an adapter via options.adapter.",t);return e}async function Ze(e,t){if(e.encryptionKeyHash)return e.encryptionKeyHash;let r=await t.deriveKey(e.encryptionKey,e.keyDerivation);return e.setEncryptionKeyHash(r),r}function Q(e,t,r){if(B(e))return e;let n=T(e);if(D(n))return new g(n,t,e);switch(r){case "compress":return new R(n,e);case "decompress":return new _(n,e);case "encrypt":return new U(n,e);case "decrypt":return new L(n,e)}}function Xe(e,t,r){return e!=null&&typeof e=="object"&&!Array.isArray(e)?{dduChar:void 0,paddingChar:void 0,dduOptions:e}:{dduChar:e,paddingChar:t,dduOptions:r}}function Je(e){let t=new Uint16Array(e.length),r=0;for(let o=0;o<e.length;o++){let i=e[o].charCodeAt(0);t[o]=i,i>r&&(r=i);}let n=new Int32Array(r+1);n.fill(-1);for(let o=0;o<e.length;o++)n[t[o]]=o;return {charCodeLookup:n,charCodes:t}}function W(e,t){return t<e.length?e[t]:-1}var Qe=8;function M(e,t,r,n){if(e===void 0)return t;if(e===Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(!Number.isFinite(e)||e<=0){if(r)throw new Error(`[Ddu64 options] Invalid ${n}. Must be a positive finite number or Infinity.`);return t}return Math.floor(e)}function et(e,t,r,n){if(e===0)return 0;if(t<0||t>=r)throw new Error(`[Ddu64 decode] Invalid padding bits: ${t}`);let s=Math.ceil(e/(n?1:2))*r-t;if(s<0)throw new Error("[Ddu64 decode] Invalid decoded bit length");return Math.ceil(s/Qe)}function tt(e,t){if(!t&&e.length%2!==0)throw new Error(`[Ddu64 decode] Invalid encoded length for variable charset. Expected multiple of 2, got ${e.length}`)}function rt(e,t,r,n){if(e.length===0)return;let o=n?1:2,s=e.length/o*r-t;if(s<0||s%Qe!==0)throw new Error(`[Ddu64 decode] Invalid encoded bit length. Expected a whole number of bytes, got ${s} bits.`)}function nt(e,t,r,n,o){if(t===0)return;if(e.length===0)throw new Error("[Ddu64 decode] Invalid padding bits without payload");let i=(1<<t)-1,s;if(r){let a=e[e.length-1],c=W(n,a.charCodeAt(0));if(c<0)throw new Error(`[Ddu64 decode] Invalid character "${a}" at ${e.length-1}`);s=c;}else {let a=e[e.length-2],c=e[e.length-1],d=W(n,a.charCodeAt(0)),u=W(n,c.charCodeAt(0));if(d<0||u<0)throw new Error("[Ddu64 decode] Invalid character in final encoded chunk");s=d*o+u;}if((s&i)!==0)throw new Error("[Ddu64 decode] Invalid non-zero padding bits in final symbol")}function ot(e,t,r){let n=t?.checksum??r.defaultChecksum,o=t?.compress!==false,i=t?.encrypt!==false,s=e;r.reportDecodeStart(e.length);let a=t?.chunkSeparator??r.defaultChunkSeparator;s=Te(s,a),r.urlSafe&&(s=ve(s));let c=null,d=null;if(n){let x=Ce(s);if(c=x.checksum,d=x.scope,s=x.data,!c)throw new v("[Ddu64 checksum] Checksum verification requested, but no checksum marker was found.")}r.shouldObfuscate(t)&&(s=r.deobfuscate(s));let{cleanedInput:u,paddingBits:p,compressionAlgorithm:h,isEncrypted:l,pipelineVersion:m}=be(s,r.paddingChar,r.bitLength,r.bitsPerPadChar);if(l&&i&&!r.encryptionKey)throw new Error("[Ddu64 decode] Encrypted payload requires an encryptionKey");let f=l&&m===4?G({compressionAlgorithm:h}):void 0;tt(u,r.usePowerOfTwo),nt(u,p,r.usePowerOfTwo,r.dduCharCodeLookup,r.charSetSize),rt(u,p,r.bitLength,r.usePowerOfTwo);let y=M(t?.maxDecodedBytes,r.defaultMaxDecodedBytes,true,"maxDecodedBytes"),b=et(u.length,p,r.bitLength,r.usePowerOfTwo);if(b>y)throw new Error(`[Ddu64 decode] Decoded output exceeds limit. Estimated: ${b} bytes, Limit: ${y} bytes`);return r.reportBitpackDecode(u.length,e.length),{decoded:r.decodeChars(u,p),extractedChecksum:c,extractedChecksumScope:d,compressionAlgorithm:h,isEncrypted:l,pipelineVersion:m,encryptionAAD:f,allowInternalDecompress:o,allowInternalDecrypt:i}}function it(e){return e.omitFooter?"":Ae({paddingBits:e.paddingBits,compressionAlgorithm:e.compressionAlgorithm,isEncrypted:e.isEncrypted,paddingChar:e.paddingChar,useRepeatPadding:e.useRepeatPadding&&!e.compressionAlgorithm&&!e.isEncrypted,bitsPerPadChar:e.bitsPerPadChar,pipelineVersion:e.isEncrypted?e.pipelineVersion:2})}function st(e){let t=e.encoded;if(e.shouldObfuscate(e.options)&&(t=e.getObfuscationLayer().obfuscate(t)),e.shouldChecksum&&e.checksum){let r=e.checksumScope==="plaintext"?"P":"O";t=t+"CK"+r+e.checksum;}return e.urlSafe&&(t=Le(t)),e.chunkSize&&e.chunkSize>0&&(e.assertSafeChunkSeparator(t,e.chunkSeparator),t=Be(t,e.chunkSize,e.chunkSeparator)),t}function at(e,t){let r=e.length;if(r<=4096){let s=new Array(r);for(let a=0;a<r;a++)s[a]=t[e[a]];return String.fromCharCode.apply(null,s)}if(r<=8192){let s=new Uint16Array(r);for(let a=0;a<r;a++)s[a]=t[e[a]];return String.fromCharCode.apply(null,s)}let n=new Array(Math.ceil(r/8192)),o=new Uint16Array(8192),i=0;for(let s=0;s<r;s+=8192){let a=Math.min(8192,r-s);for(let d=0;d<a;d++)o[d]=t[e[s+d]];let c=o.subarray(0,a);n[i++]=String.fromCharCode.apply(null,c);}return n.join("")}function ct(e,t,r,n,o){if(e.length===0)return "";let i=o.canUseNativeBase64?He(e):null,s,a;if(i)s=i.paddingBits,a=i.payload;else {let d=tr(e,o);s=d.paddingBits,a=at(d.indices,o.dduCharCodes);}let c=it({paddingBits:s,compressionAlgorithm:t,isEncrypted:r,paddingChar:o.paddingChar,useRepeatPadding:o.useRepeatPadding,bitsPerPadChar:o.bitsPerPadChar,pipelineVersion:o.encryptedPipelineVersion,omitFooter:n?.omitFooter});return a+c}function dt(e,t,r){let n=e.length;if(n===0)return new Uint8Array(0);let o=r.canUseNativeBase64?ze(e,t,u=>W(r.dduCharCodeLookup,u)>=0):null;if(o)return o;let s=n>=r.wasmThreshold?new Uint16Array(n):new Array(n),a=r.dduCharCodeLookup,c=a.length;for(let u=0;u<n;u++){let p=e.charCodeAt(u),h=p<c?a[p]:-1;if(h<0)throw new Error(`[Ddu64 decode] Invalid character "${e[u]}" at ${u}`);s[u]=h;}let d=ut(n,r)?re():null;if(d?.ready&&r.usePowerOfTwo){let u=s instanceof Uint16Array?s:Uint16Array.from(s);return d.decode(u,r.bitLength,t)}return Ee(s,t,r.bitPackConfig)}function tr(e,t){let r=ut(e.length,t)?re():null;return r?.ready&&t.usePowerOfTwo?r.encode(e,t.bitLength):De(e,t.bitPackConfig)}function ut(e,t){return e>=t.wasmThreshold}function lt(e,t,r){let n=e.decoded,o=e.extractedChecksumScope??t?.checksumScope??"plaintext";return o==="output"&&yt(e,r),n=rr(e,r,n),n=nr(e,t,r,n),o==="plaintext"&&gt(e,r,t,n),n=or(e,r,n),Ct(r,n),n}async function ht(e,t,r){let n=e.decoded,o=e.extractedChecksumScope??t?.checksumScope??"plaintext";if(o==="output"&&yt(e,r),pt(e,r)&&(E(r,n.length,55,"decrypt"),n=await r.decrypt(n,e.encryptionAAD)),mt(e)){let i=bt(t,r);E(r,n.length,70,"decompress"),n=await r.decompress(n,e.compressionAlgorithm,i);}return o==="plaintext"&&gt(e,r,t,n),ft(e,r)&&(E(r,n.length,90,"decrypt"),n=await r.decrypt(n,e.encryptionAAD)),Ct(r,n),n}function rr(e,t,r){return pt(e,t)?(E(t,r.length,55,"decrypt"),t.decrypt(r,e.encryptionAAD)):r}function nr(e,t,r,n){if(!mt(e))return n;let o=bt(t,r);return E(r,n.length,70,"decompress"),r.decompress(n,e.compressionAlgorithm,o)}function or(e,t,r){return ft(e,t)?(E(t,r.length,90,"decrypt"),t.decrypt(r,e.encryptionAAD)):r}function pt(e,t){return (e.pipelineVersion===3||e.pipelineVersion===4)&&e.isEncrypted&&!!t.encryptionKey&&e.allowInternalDecrypt}function ft(e,t){return e.pipelineVersion===2&&e.isEncrypted&&!!t.encryptionKey&&e.allowInternalDecrypt}function mt(e){return !!e.compressionAlgorithm&&e.allowInternalDecompress&&(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt)}function yt(e,t){if(!e.extractedChecksum)return;E(t,e.decoded.length,85,"checksum");let r=O(e.decoded);if(!ce(r,e.extractedChecksum))throw new v(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${r}`)}function gt(e,t,r,n){if(!e.extractedChecksum||!(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt))return;E(t,n.length,85,"checksum");let o=O(n);if(!ce(o,e.extractedChecksum))throw new v(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${o}`)}function bt(e,t){return M(e?.maxDecompressedBytes,t.defaultMaxDecompressedBytes,true,"maxDecompressedBytes")}function E(e,t,r,n){e.reportProgress({processedBytes:t,totalBytes:t,percent:r,stage:n});}function Ct(e,t){E(e,t.length,100,"done");}function he(e,t,r){let n=wt(t,r),o=typeof e=="string"?V(e):e;St(r,o.length);let i="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(i=O(o));let s,a;if(n.shouldCompress){let{algo:d,level:u}=At(t,r);Pt(r,o.length);let p=r.compress(o,d,u);p.length<o.length&&(a=p.length,o=p,s=d);}let c=false;return n.shouldEncrypt&&(Dt(r,o.length),o=r.encrypt(o,r.getEncryptionAAD(s)),c=true),n.shouldChecksum&&n.checksumScope==="output"&&(i=O(o)),{encoded:r.finalize(o,s,c,i,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:a}}async function pe(e,t,r){let n=wt(t,r),o=typeof e=="string"?V(e):e;St(r,o.length);let i="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(i=O(o));let s,a;if(n.shouldCompress){let{algo:d,level:u}=At(t,r);Pt(r,o.length);let p=await r.compress(o,d,u);p.length<o.length&&(a=p.length,o=p,s=d);}let c=false;return n.shouldEncrypt&&(Dt(r,o.length),o=await r.encrypt(o,r.getEncryptionAAD(s)),c=true),n.shouldChecksum&&n.checksumScope==="output"&&(i=O(o)),{encoded:r.finalize(o,s,c,i,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:a}}function At(e,t){let r=e?.compressionAlgorithm??t.defaultCompressionAlgorithm,n=j(e?.compressionLevel??t.defaultCompressionLevel,r);return {algo:r,level:n}}function wt(e,t){return {shouldCompress:e?.compress??t.defaultCompress,shouldChecksum:e?.checksum??t.defaultChecksum,checksumScope:e?.checksumScope??t.defaultChecksumScope,shouldEncrypt:(e?.encrypt??true)&&t.hasEncryptionKey,chunkSize:e?.chunkSize??t.defaultChunkSize,chunkSeparator:e?.chunkSeparator??t.defaultChunkSeparator}}function St(e,t){e.reportProgress({processedBytes:0,totalBytes:t,percent:0,stage:"start"});}function Pt(e,t){e.reportProgress({processedBytes:t,totalBytes:t,percent:20,stage:"compress"});}function Dt(e,t){e.reportProgress({processedBytes:t,totalBytes:t,percent:45,stage:"encrypt"});}var sr=64*1024*1024,ar=64*1024*1024,Et=28,xt=class{dduChar;dduCharCodes;paddingChar;bitLength;usePowerOfTwo;dduCharCodeLookup;defaultCompress;defaultMaxDecodedBytes;defaultMaxDecompressedBytes;urlSafe;encryptionKey;keyDerivation;encryptionKeyHash;syncGatewayContext;defaultChecksum;defaultChecksumScope;defaultChunkSize;defaultChunkSeparator;defaultCompressionLevel;defaultCompressionAlgorithm;useRepeatPadding;bitsPerPadChar;bitPackConfig;wasmThreshold;canUseNativeBase64;payloadCodecContext;adapter;defaultObfuscate;obfuscationLayer;constructor(t,r,n){let o=Xe(t,r,n);t=o.dduChar,r=o.paddingChar,n=o.dduOptions;let i=n?.throwOnError??true;n?.adapter?this.adapter=n.adapter:this.adapter=void 0;let s=Re(t,r,n,i),a=_e(s,i,n);this.dduChar=a.charSet,this.paddingChar=a.padding;let c=a.isPredefined;this.defaultCompress=n?.compress??false,this.defaultMaxDecodedBytes=M(n?.maxDecodedBytes,sr,i,"maxDecodedBytes"),this.defaultMaxDecompressedBytes=M(n?.maxDecompressedBytes,ar,i,"maxDecompressedBytes");let d=this.dduChar.length,u=ke(d),p=n?.usePowerOfTwo,h=s.encodingProfile;this.usePowerOfTwo=h?.usePowerOfTwo??s.usePowerOfTwo??(p!==void 0?p&&u:u);let l=h?.bitLength??(s.isPredefined&&s.usePowerOfTwo!==void 0?s.bitLength:void 0);this.bitLength=l??xe(d,this.usePowerOfTwo);let m=Je(this.dduChar);this.dduCharCodeLookup=m.charCodeLookup,this.dduCharCodes=m.charCodes,c||Ne(this.dduChar,this.paddingChar,d);let f=n?.urlSafe??false;if(this.urlSafe=f?Me(this.dduChar,this.paddingChar,i):false,this.encryptionKey=n?.encryptionKey,this.keyDerivation=n?.keyDerivation,this.defaultChecksum=n?.checksum??false,this.defaultChecksumScope=n?.checksumScope??"output",this.defaultChunkSize=n?.chunkSize,this.defaultChunkSeparator=n?.chunkSeparator??`
7
+ `,this.defaultCompressionAlgorithm=n?.compressionAlgorithm??"deflate",this.defaultCompressionLevel=j(n?.compressionLevel,this.defaultCompressionAlgorithm),this.useRepeatPadding=n?.useRepeatPadding??s.useRepeatPadding??false,this.bitsPerPadChar=h?.bitsPerPadChar??s.bitsPerPadChar??2,this.defaultObfuscate=n?.obfuscate??false,this.defaultObfuscate&&!this.encryptionKey)throw new F("[Ddu64 obfuscation] Obfuscation requires encryption to be enabled.");this.bitPackConfig={bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,charsetSize:d},this.wasmThreshold=Pe(n?.wasmThreshold??16384),this.canUseNativeBase64=Ke(this.dduChar,this.paddingChar,this.usePowerOfTwo,this.bitLength),this.payloadCodecContext={bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,bitPackConfig:this.bitPackConfig,wasmThreshold:this.wasmThreshold,canUseNativeBase64:this.canUseNativeBase64,dduCharCodes:this.dduCharCodes,dduCharCodeLookup:this.dduCharCodeLookup,paddingChar:this.paddingChar,useRepeatPadding:this.useRepeatPadding,bitsPerPadChar:this.bitsPerPadChar,encryptedPipelineVersion:4};}encode(t,r){try{return this.encodeInternal(t,r).encoded}catch(n){throw w(n,"encode")}}decode(t,r){try{let n=this.decodeToUint8Array(t,r);return de(n)}catch(n){throw w(n,"decode")}}decodeToUint8Array(t,r){try{return this.decodeToUint8ArrayInternal(t,r)}catch(n){throw w(n,"decode")}}decodeToUint8ArrayInternal(t,r){let n=this.decodePrelude(t,r);return lt(n,r,{...this.buildDecodeBaseContext(r),decrypt:(o,i)=>this.decryptSync(o,i),decompress:(o,i,s)=>this.decompressSync(o,i,s)})}async encodeAsync(t,r){try{return await this.encodeAsyncInternal(t,r)}catch(n){throw w(n,"encode")}}async encodeAsyncInternal(t,r){return (await pe(t,r,{...this.buildEncodeBaseContext(r),compress:(o,i,s)=>le(this.adapter,o,i,s),encrypt:(o,i)=>Ye(this.getSyncGatewayContext(),o,i)})).encoded}async decodeAsync(t,r){try{let n=await this.decodeToUint8ArrayAsync(t,r);return de(n)}catch(n){throw w(n,"decode")}}async decodeToUint8ArrayAsync(t,r){try{return await this.decodeToUint8ArrayAsyncInternal(t,r)}catch(n){throw w(n,"decode")}}async decodeToUint8ArrayAsyncInternal(t,r){let n=this.decodePrelude(t,r);return ht(n,r,{...this.buildDecodeBaseContext(r),decrypt:(o,i)=>qe(this.getSyncGatewayContext(),o,i),decompress:(o,i,s)=>je(this.adapter,o,i,s)})}buildDecodeBaseContext(t){return {encryptionKey:this.encryptionKey,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,reportProgress:r=>this.reportProgress(t,r)}}getCharSetInfo(){return {charSet:[...this.dduChar],paddingChar:this.paddingChar,bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,encoding:"utf-8",defaultCompress:this.defaultCompress,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,urlSafe:this.urlSafe,hasEncryptionKey:!!this.encryptionKey,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultObfuscate:this.defaultObfuscate,wasmThreshold:this.wasmThreshold,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm}}getStats(t,r){let n=typeof t=="string"?V(t):t,{encoded:o,compressedSize:i}=this.encodeStatsInternal(n,r);return this.buildEncodeStats(n.length,o.length,i,r)}async getStatsAsync(t,r){let n=typeof t=="string"?V(t):t,{encoded:o,compressedSize:i}=await this.encodeStatsAsyncInternal(n,r);return this.buildEncodeStats(n.length,o.length,i,r)}buildEncodeStats(t,r,n,o){let i=t>0?r/t:0,a=(o?.compress??this.defaultCompress)&&n!==void 0&&t>0?n/t:void 0;return {originalSize:t,encodedSize:r,compressedSize:n,compressionRatio:a,expansionRatio:i,charsetSize:this.dduChar.length,bitLength:this.bitLength}}encodeInternal(t,r){return he(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>this.compressSync(n,o,i),encrypt:(n,o)=>this.encryptSync(n,o)})}encodeStatsInternal(t,r){return he(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>this.compressSync(n,o,i),encrypt:n=>new Uint8Array(n.length+Et)})}async encodeStatsAsyncInternal(t,r){return pe(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>le(this.adapter,n,o,i),encrypt:async n=>new Uint8Array(n.length+Et)})}buildEncodeBaseContext(t){return {defaultCompress:this.defaultCompress,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm,hasEncryptionKey:!!this.encryptionKey,reportProgress:r=>this.reportProgress(t,r),getEncryptionAAD:r=>G({compressionAlgorithm:r}),finalize:(r,n,o,i,s,a,c,d)=>this.finalizeEncode(r,n,o,i,s,a,c,d,t)}}finalizeEncode(t,r,n,o,i,s,a,c,d){this.reportProgress(d,{processedBytes:t.length,totalBytes:t.length,percent:70,stage:"encode"});let u=ct(t,r,n,d,this.getPayloadCodecContext());return u=this.applyPostEncoding(u,d,o,i,s,a,c),this.reportProgress(d,{processedBytes:t.length,totalBytes:t.length,percent:100,stage:"done"}),u}applyPostEncoding(t,r,n,o,i,s,a){return st({encoded:t,options:r,checksum:n,shouldChecksum:o,checksumScope:i,chunkSize:s,chunkSeparator:a,urlSafe:this.urlSafe,shouldObfuscate:c=>this.shouldObfuscate(c),getObfuscationLayer:()=>this.getObfuscationLayer(),assertSafeChunkSeparator:(c,d)=>this.assertSafeChunkSeparator(c,d)})}decodePrelude(t,r){return ot(t,r,{defaultChecksum:this.defaultChecksum,defaultChunkSeparator:this.defaultChunkSeparator,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,urlSafe:this.urlSafe,paddingChar:this.paddingChar,bitLength:this.bitLength,bitsPerPadChar:this.bitsPerPadChar,usePowerOfTwo:this.usePowerOfTwo,dduCharCodeLookup:this.dduCharCodeLookup,charSetSize:this.dduChar.length,encryptionKey:this.encryptionKey,shouldObfuscate:n=>this.shouldObfuscate(n),deobfuscate:n=>this.getObfuscationLayer().deobfuscate(n),decodeChars:(n,o)=>dt(n,o,this.getPayloadCodecContext()),reportDecodeStart:n=>{this.reportProgress(r,{processedBytes:0,totalBytes:n,percent:0,stage:"start"});},reportBitpackDecode:(n,o)=>{this.reportProgress(r,{processedBytes:n,totalBytes:o,percent:30,stage:"decode"});}})}getPayloadCodecContext(){return this.payloadCodecContext}reportProgress(t,r){t?.onProgress?.(r);}encryptSync(t,r){try{return Fe(this.getSyncGatewayContext(),t,r)}catch(n){if(B(n))throw n;let o=T(n);throw D(o)?w(n,"encode"):new U(o,n)}}decryptSync(t,r){try{return Ve(this.getSyncGatewayContext(),t,r)}catch(n){if(B(n))throw n;let o=T(n);throw D(o)?w(n,"decode"):new L(o,n)}}compressSync(t,r,n){try{return We(this.adapter,t,r,n)}catch(o){if(B(o))throw o;let i=T(o);throw D(i)?w(o,"encode"):new R(i,o)}}decompressSync(t,r,n){try{return Ge(this.adapter,t,r,n)}catch(o){if(B(o))throw o;let i=T(o);throw D(i)?w(o,"decode"):new _(i,o)}}getSyncGatewayContext(){if(!this.syncGatewayContext){let t={adapter:this.adapter,encryptionKey:this.encryptionKey,keyDerivation:this.keyDerivation,encryptionKeyHash:this.encryptionKeyHash,setEncryptionKeyHash:r=>{this.encryptionKeyHash=r,t.encryptionKeyHash=r;}};this.syncGatewayContext=t;}return this.syncGatewayContext}getObfuscationLayer(){return this.obfuscationLayer||(this.obfuscationLayer=new z($(this.dduChar,this.paddingChar))),this.obfuscationLayer}shouldObfuscate(t){if(!(t?.obfuscate??this.defaultObfuscate))return false;if(!this.encryptionKey||t?.encrypt===false)throw new F("[Ddu64 obfuscation] Obfuscation requires encryption to be enabled.");return true}assertSafeChunkSeparator(t,r){if(!(r.length===0||this.isLineBreakSeparator(r))&&t.includes(r))throw new Error(`[Ddu64 chunking] Unsafe chunkSeparator "${r}" appears in encoded output. Use a separator that cannot be produced by the charset, footer, checksum, or URL-safe output.`)}isLineBreakSeparator(t){return t===`
8
+ `||t===`\r
9
+ `||t==="\r"}};var kt=class e{chars=[];constructor(){}static create(){return new e}static fromUnicodeRange(t,r){return new e().addUnicodeRange(t,r)}static fromString(t){return new e().addString(t)}static base64(){return new e().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")}static base32(){return new e().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")}static uppercase(){return e.fromUnicodeRange(65,90)}static lowercase(){return e.fromUnicodeRange(97,122)}static digits(){return e.fromUnicodeRange(48,57)}static hangulJamo(){return new e().addUnicodeRange(4352,4370).addUnicodeRange(4449,4469).addUnicodeRange(4520,4546)}addUnicodeRange(t,r){for(let n=t;n<=r;n++)this.chars.push(String.fromCodePoint(n));return this}addString(t){return typeof t=="string"?this.chars.push(...t):this.chars.push(...t),this}add(...t){return this.chars.push(...t),this}excludeConfusing(){let t=new Set(["0","O","o","1","l","I","i","|","L"]);return this.chars=this.chars.filter(r=>!t.has(r)),this}exclude(...t){let r=new Set(t);return this.chars=this.chars.filter(n=>!r.has(n)),this}excludeUrlUnsafe(){let t=new Set(["+","/","=","?","&","#","%"," "]);return this.chars=this.chars.filter(r=>!t.has(r)),this}unique(){return this.chars=[...new Set(this.chars)],this}shuffle(t){let r=t!==void 0?this.seededRandom(t):Math.random;for(let n=this.chars.length-1;n>0;n--){let o=Math.floor(r()*(n+1));[this.chars[n],this.chars[o]]=[this.chars[o],this.chars[n]];}return this}seededRandom(t){let r=t|0||1;return ()=>(r^=r<<13,r^=r>>17,r^=r<<5,(r>>>0)/4294967296)}limit(t){return this.chars=this.chars.slice(0,t),this}limitToPowerOfTwo(){let t=this.chars.length;if(t===0)return this;let r=1<<Math.floor(Math.log2(t));return this.chars=this.chars.slice(0,r),this}sort(){return this.chars.sort(),this}reverse(){return this.chars.reverse(),this}get length(){return this.chars.length}buildString(){return this.chars.join("")}build(){return [...this.chars]}buildWithPadding(t){let r=[...this.chars],n=t;if(!n){let o=["=",".","_","-","~","!"];for(let i of o)if(!r.includes(i)){n=i;break}if(!n)throw new Error("Cannot find suitable padding character")}return {charset:r,padding:n}}};export{w as A,Xe as B,xt as C,kt as D,fe as a,Bt as b,ur as c,lr as d,z as e,gr as f,br as g,Ar as h,wr as i,re as j,Sr as k,Nt as l,C as m,ne as n,oe as o,R as p,_ as q,U as r,L as s,v as t,ie as u,se as v,g as w,F as x,ae as y,B as z};//# sourceMappingURL=chunk-HTZT725P.js.map
10
+ //# sourceMappingURL=chunk-HTZT725P.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk5NSHXTMN_cjs=require('./chunk-5NSHXTMN.cjs'),crypto=require('crypto'),zlib=require('zlib'),util=require('util');var N=util.promisify(zlib.deflateRaw),h=util.promisify(zlib.inflateRaw),E=util.promisify(zlib.brotliCompress),g=util.promisify(zlib.brotliDecompress),_=util.promisify(crypto.pbkdf2);function z(e){let n=e,r=String(n?.message??"").toLowerCase();return String(n?.code??"")==="ERR_BUFFER_TOO_LARGE"||r.includes("output length")||r.includes("buffer too large")||r.includes("cannot create a buffer larger")}function f(e,n,r){throw z(e)?new Error(`[Ddu64 ${r}] Decompressed data exceeds limit. Limit: ${n} bytes`,{cause:e}):e}function s(e){return Buffer.isBuffer(e)?e:e.buffer instanceof SharedArrayBuffer?Buffer.from(e):Buffer.from(e.buffer,e.byteOffset,e.byteLength)}var S=class{supportsSyncCrypto=true;supportsSyncCompression=true;supportsBrotli=true;runtime="node";async deriveKey(n,r){if(chunk5NSHXTMN_cjs.a(r)==="pbkdf2"){let t=await _(n,chunk5NSHXTMN_cjs.e(r?.salt),chunk5NSHXTMN_cjs.b(r?.iterations),32,chunk5NSHXTMN_cjs.c(r?.hash));return new Uint8Array(t)}return this.deriveKeySync(n,r)}deriveKeySync(n,r){return chunk5NSHXTMN_cjs.a(r)==="pbkdf2"?new Uint8Array(crypto.pbkdf2Sync(n,chunk5NSHXTMN_cjs.e(r?.salt),chunk5NSHXTMN_cjs.b(r?.iterations),32,chunk5NSHXTMN_cjs.c(r?.hash))):new Uint8Array(crypto.createHash("sha256").update(n).digest())}async encrypt(n,r,t){return this.encryptSync(n,r,t)}encryptSync(n,r,t){let i=crypto.randomBytes(12),o=crypto.createCipheriv("aes-256-gcm",r,i);t&&t.length>0&&o.setAAD(s(t));let u=Buffer.concat([o.update(n),o.final()]),a=o.getAuthTag(),c=new Uint8Array(28+u.length);return c.set(i,0),c.set(a,12),c.set(u,28),c}async decrypt(n,r,t){return this.decryptSync(n,r,t)}decryptSync(n,r,t){if(n.length<28)throw new Error("[Ddu64 decrypt] Invalid encrypted data: too short");let i=n.subarray(0,12),o=n.subarray(12,28),u=n.subarray(28),a=crypto.createDecipheriv("aes-256-gcm",r,i);t&&t.length>0&&a.setAAD(s(t)),a.setAuthTag(o);let c=Buffer.concat([a.update(u),a.final()]);return new Uint8Array(c)}randomBytes(n){return new Uint8Array(crypto.randomBytes(n))}async deflate(n,r){let t={};r!==void 0&&(t.level=r);let i=await N(s(n),t);return new Uint8Array(i)}deflateSync(n,r){let t={};return r!==void 0&&(t.level=r),new Uint8Array(zlib.deflateRawSync(s(n),t))}async inflate(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY){let i=await h(s(n));return new Uint8Array(i)}let t={maxOutputLength:r};try{let i=await h(s(n),t);return new Uint8Array(i)}catch(i){f(i,r,"inflate");}}inflateSync(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY)return new Uint8Array(zlib.inflateRawSync(s(n)));try{return new Uint8Array(zlib.inflateRawSync(s(n),{maxOutputLength:r}))}catch(t){f(t,r,"inflate");}}async brotliCompress(n,r){let t={};r!==void 0&&(t.params={[zlib.constants.BROTLI_PARAM_QUALITY]:Math.max(0,Math.min(11,r))});let i=await E(s(n),t);return new Uint8Array(i)}brotliCompressSync(n,r){let t={};return r!==void 0&&(t.params={[zlib.constants.BROTLI_PARAM_QUALITY]:Math.max(0,Math.min(11,r))}),new Uint8Array(zlib.brotliCompressSync(s(n),t))}async brotliDecompress(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY){let t=await g(s(n));return new Uint8Array(t)}try{let t=await g(s(n),{maxOutputLength:r});return new Uint8Array(t)}catch(t){f(t,r,"brotli");}}brotliDecompressSync(n,r){if(r===void 0||r===Number.POSITIVE_INFINITY)return new Uint8Array(zlib.brotliDecompressSync(s(n)));try{return new Uint8Array(zlib.brotliDecompressSync(s(n),{maxOutputLength:r}))}catch(t){f(t,r,"brotli");}}};exports.a=S;//# sourceMappingURL=chunk-HZJ7PU7X.cjs.map
2
+ //# sourceMappingURL=chunk-HZJ7PU7X.cjs.map
@@ -0,0 +1,2 @@
1
+ import {c,A,b,d}from'./chunk-HTZT725P.js';function R(){let e=globalThis;return e.Deno?.version?.deno?"deno":e.Bun?.version?"bun":e.process?.versions?.node?"node":typeof e.EdgeRuntime=="string"||typeof e.WebSocketPair<"u"&&e.crypto?.subtle?"edge":typeof e.crypto<"u"&&e.crypto?.subtle?"browser":"unknown"}function W(e,n){let r=e.getCharSetInfo(),d=n?.compress??r.defaultCompress,p=(n?.encrypt??true)&&r.hasEncryptionKey,y=n?.checksum??r.defaultChecksum,t=d?n?.compressionAlgorithm??r.defaultCompressionAlgorithm:void 0,m=r.paddingChar,f=D(r,{compressed:d,encrypted:p,checksum:y}),c$1=false,s=[],h=0,o=null;return new TransformStream({async transform(a,u){if(f){if(!c$1){let k=c(m,{compressionAlgorithm:void 0,encrypted:false});u.enqueue(k),c$1=true;}let i;o&&o.length>0?(i=new Uint8Array(o.length+a.length),i.set(o,0),i.set(a,o.length)):i=a;let g=r.bitLength,S=U(g,8)/8,l=Math.floor(i.length/S)*S;if(l>0){let k=i.subarray(0,l),E=await e.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:void 0,chunkSeparator:void 0,omitFooter:true});u.enqueue(E);}l<i.length?o=i.slice(l):o=null;}else s.push(a),h+=a.length;},async flush(a){try{if(f){if(!c$1){let u=c(m,{compressionAlgorithm:void 0,encrypted:!1});a.enqueue(u);}if(o&&o.length>0){let u=await e.encodeAsync(o,{compress:!1,encrypt:!1,checksum:!1,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(u);}o=null;}else {let u=c(m,{compressionAlgorithm:t,encrypted:p});if(a.enqueue(u),h>0){let i=new Uint8Array(h),g=0;for(let l of s)i.set(l,g),g+=l.length;let S=await e.encodeAsync(i,{...n,compress:d,encrypt:p,checksum:y,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(S);}s=[],h=0;}}catch(u){a.error(A(u,"stream"));}}})}function L(e,n){let r=e.getCharSetInfo(),d$1=r.paddingChar,p=b(d$1),y=n?.checksum??r.defaultChecksum,t="",m=false,f=null;return new TransformStream({async transform(c,s){if(t+=c,!m&&t.length>=p){if(!t.startsWith(d$1)){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f=d(t,d$1),f===null){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f.encrypted&&!r.hasEncryptionKey){s.error(new Error("[WebStreams decode] Encrypted stream requires an encryptionKey"));return}m=true,t=t.slice(p);}},async flush(c){try{if(!m){if(t.length===0)return;c.error(new Error("[WebStreams decode] Incomplete stream header"));return}if(t.length===0)return;let s=f.compressionAlgorithm,h=await e.decodeToUint8ArrayAsync(t,{...n,compress:n?.compress,compressionAlgorithm:s,encrypt:n?.encrypt,checksum:y,chunkSize:void 0,chunkSeparator:void 0});h.length>0&&c.enqueue(h),t="";}catch(s){c.error(A(s,"stream"));}}})}function D(e,n){return e.usePowerOfTwo&&!n.compressed&&!n.encrypted&&!n.checksum}function U(e,n){return e*n/I(e,n)}function I(e,n){for(;n!==0;){let r=n;n=e%n,e=r;}return e}export{R as a,W as b,L as c};//# sourceMappingURL=chunk-KS6PRP5Y.js.map
2
+ //# sourceMappingURL=chunk-KS6PRP5Y.js.map
@@ -0,0 +1,2 @@
1
+ var n="ddunigma:pbkdf2:v1";function r(e){return e?.algorithm??"pbkdf2"}function o(e){return e===void 0||!Number.isFinite(e)||e<=0?21e4:Math.max(1e4,Math.floor(e))}function t(e){return (e??"SHA-256").toLowerCase().replace("-","")}function i(e){return e??"SHA-256"}function d(e){return e===void 0?new TextEncoder().encode(n):typeof e=="string"?new TextEncoder().encode(e):e}export{r as a,o as b,t as c,i as d,d as e};//# sourceMappingURL=chunk-OQXMQIE3.js.map
2
+ //# sourceMappingURL=chunk-OQXMQIE3.js.map
@@ -0,0 +1,10 @@
1
+ 'use strict';var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var fe=(n=>(n.DDU="ddu",n.DDU_V1="ddu_v1",n.ONECHARSET="oneCharSet",n))(fe||{}),ee={dduSetSymbol:"ddu",usePowerOfTwo:true,requiredLength:64};function me(e){if(e.length===0)throw new Error("[Ddu64 obfuscation] Alphabet must not be empty.");if(e.length>11172)throw new Error(`[Ddu64 obfuscation] Alphabet size (${e.length}) exceeds available Hangul syllables (11172).`);let t=Math.floor(11172/e.length),r=new Map;for(let n=0;n<e.length;n++)r.set(e[n],n);return {alphabet:e,syllablesPerChar:t,charToIndex:r}}function ye(e,t,r){let n=44032+e*r.syllablesPerChar,o=t%r.syllablesPerChar;return n+o}function ge(e,t){if(e<44032||e>55203)return -1;let r=e-44032,n=Math.floor(r/t.syllablesPerChar);return n>=t.alphabet.length?-1:n}var N="DDS1",K="ELYSIA",H="GRISEO";var Ut=new TextEncoder;function k(e,t,r){let n=r-t.length;if(n<0)return false;for(let o=0;o<t.length;o++)if(e.charCodeAt(n+o)!==t.charCodeAt(o))return false;return true}function be(e,t,r,n=2){let o=e.length,i=t.length,s={cleanedInput:e,paddingBits:0,isEncrypted:false,pipelineVersion:2};if(i===0||o<i)return s;let c=Math.max(0,r-1).toString().length;for(let d=Math.min(c,o);d>=1;d--){let u=o-d,p=true;for(let A=u;A<o;A++){let x=e.charCodeAt(A);if(x<48||x>57){p=false;break}}if(!p||d>1&&e.charCodeAt(u)===48)continue;let h=0;for(let A=u;A<o;A++)h=h*10+(e.charCodeAt(A)-48);if(h>=r)continue;let l=u,m=false,f,y=2;l>=2&&k(e,"V4",l)?(y=4,l-=2):l>=2&&k(e,"V3",l)&&(y=3,l-=2),l>=3&&k(e,"ENC",l)&&(m=true,l-=3),l>=K.length&&k(e,K,l)?(f="deflate",l-=K.length):l>=H.length&&k(e,H,l)&&(f="brotli",l-=H.length);let b=l-i;if(b>=0&&k(e,t,l))return {cleanedInput:e.substring(0,b),paddingBits:h,compressionAlgorithm:f,isEncrypted:m,pipelineVersion:y}}if(k(e,t,o)){let d=0,u=o;for(;u>=i&&k(e,t,u);)d++,u-=i;if(d>0){let p=d*n;if(p<r)return {cleanedInput:e.substring(0,u),paddingBits:p,isEncrypted:false,pipelineVersion:2}}}return s}function Lt(e){let t=e.lastIndexOf("CHK");if(t===-1)return {data:e,checksum:null};let r=e.slice(t+3);return r.length!==8||!/^[0-9a-f]+$/i.test(r)?{data:e,checksum:null}:{data:e.slice(0,t),checksum:r.toLowerCase()}}var vt=/^[0-9a-f]{8}$/i;function Ce(e){let t=e.length;if(t>=11){let n=e.charCodeAt(t-11),o=e.charCodeAt(t-10),i=e[t-9];if(n===67&&o===75&&(i==="P"||i==="O")){let s=e.slice(t-8);if(vt.test(s))return {data:e.slice(0,t-11),checksum:s.toLowerCase(),scope:i==="P"?"plaintext":"output"}}}let r=Lt(e);return {data:r.data,checksum:r.checksum,scope:null}}function Bt(e){return e.length*2+N.length+2}function ur(e,t){let r=t.compressionAlgorithm==="brotli"?"B":t.compressionAlgorithm==="deflate"?"D":"N",n=t.encrypted?"1":"0";return `${e}${N}${r}${n}${e}`}function lr(e,t){let r=Bt(t);if(e.length<r||!e.startsWith(t))return null;let n=t.length;if(e.slice(n,n+N.length)!==N)throw new Error("[wireFormat] Invalid stream header magic");let i=e[n+N.length],s=e[n+N.length+1];if(e.slice(r-t.length,r)!==t)throw new Error("[wireFormat] Invalid stream header terminator");let c=i==="B"?"brotli":i==="D"?"deflate":i==="N"?void 0:null;if(c===null)throw new Error("[wireFormat] Invalid stream header compression flag");if(s!=="0"&&s!=="1")throw new Error("[wireFormat] Invalid stream header encryption flag");return {compressionAlgorithm:c,encrypted:s==="1"}}function Ae(e){let{paddingBits:t,compressionAlgorithm:r,isEncrypted:n,paddingChar:o,useRepeatPadding:i,bitsPerPadChar:s=2,pipelineVersion:a=2}=e;if(!n&&a!==2)throw new Error("[wireFormat] Pipeline version markers require encryption");if(t===0&&!r&&!n&&a===2)return "";if(i&&!r&&!n&&a===2&&t>0&&t%s===0){let d=t/s;return o.repeat(d)}return o+(r==="deflate"?K:r==="brotli"?H:"")+(n?"ENC":"")+(a===4?"V4":a===3?"V3":"")+t.toString()}function G(e){return Ut.encode(`ddunigma:wire:v4;enc=1;compress=${e.compressionAlgorithm??"none"}`)}function $(e,t){let r=new Set(e);r.add(t);let n=K+H+"ENC"+"V3"+"V4";for(let o of n)r.add(o);for(let o of "0123456789")r.add(o);return [...r]}var z=class{config;constructor(t){this.config=me(t);}obfuscate(t){if(t.length===0)return "";let r=new Array(t.length);for(let n=0;n<t.length;n++){let o=t[n],i=this.config.charToIndex.get(o);if(i===void 0)throw new Error(`[Ddu64 obfuscation] Character "${o}" (U+${o.charCodeAt(0).toString(16).padStart(4,"0").toUpperCase()}) not found in obfuscation alphabet.`);let s=ye(i,n,this.config);r[n]=String.fromCharCode(s);}return r.join("")}deobfuscate(t){if(t.length===0)return "";let r=new Array(t.length);for(let n=0;n<t.length;n++){let o=t.charCodeAt(n),i=ge(o,this.config);if(i===-1)throw new Error(`[Ddu64 obfuscation] Invalid syllable at position ${n}: U+${o.toString(16).padStart(4,"0").toUpperCase()} is not in the mapped range.`);r[n]=this.config.alphabet[i];}return r.join("")}};function gr(e,t){let r=new Set(e);r.add(t);let n=[...r];return new z(n)}function br(e,t){return new z($(e,t))}var I=null,Y=false,P=false,S=null,we=Rt,te=class{exports;constructor(t){this.exports=t;}get ready(){return true}encode(t,r){let{exports:n}=this;if(t.length===0)return {indices:new Uint16Array(0),paddingBits:0};let o=n.alloc(t.length);new Uint8Array(n.memory.buffer).set(t,o);let s=1<<r,a=1;try{let c=n.encode(o,t.length,r,s,a),d=n.get_result_ptr(),u=new Uint16Array(n.memory.buffer,d,c),p=new Uint16Array(c);return p.set(u),{indices:p,paddingBits:n.get_padding_bits()}}finally{n.dealloc(o,t.length);}}decode(t,r,n){let{exports:o}=this;if(t.length===0)return new Uint8Array(0);let i=t.length*2,s=o.alloc(i);new Uint16Array(o.memory.buffer,s,t.length).set(t);let c=1<<r,d=1;try{let u=o.decode(s,t.length,r,c,d,n);if(u===4294967295)throw new Error("[WasmCodec decode] Invalid index in input");let p=o.get_result_ptr(),h=new Uint8Array(o.memory.buffer,p,u),l=new Uint8Array(u);return l.set(h),l}finally{o.dealloc(s,i);}}};async function Rt(){try{if(typeof fetch!="function")return null;let e=await fetch(new URL("./wasm/codec.wasm",(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-UMA4JEN4.cjs', document.baseURI).href))));return e.ok?await e.arrayBuffer():null}catch{return null}}async function _t(e){try{if(e.byteLength<16)return null;let t=new Uint8Array(e,0,4);if(t[0]!==0||t[1]!==97||t[2]!==115||t[3]!==109)return null;let r;try{r=await WebAssembly.compile(e);}catch{return null}let o=(await WebAssembly.instantiate(r,{})).exports;return typeof o.alloc!="function"||typeof o.dealloc!="function"||typeof o.encode!="function"||typeof o.decode!="function"||typeof o.get_result_ptr!="function"||typeof o.get_padding_bits!="function"||!o.memory?null:o}catch{return null}}async function Se(){try{if(I)return !0;if(P)return !1;let e=await we();if(!e)return P=!0,!1;let t=await _t(e);return t?(I=new te(t),!0):(P=!0,!1)}catch{return P=true,false}}function Mt(e,t){let r;return {promise:new Promise((i,s)=>{r=setTimeout(()=>s(new Error(t)),e);}),clear:()=>clearTimeout(r)}}async function Ar(){if(I)return;if(S)return S;let e=Mt(1e4,"[Ddu64 wasm] WASM initialization timed out (10s)"),t=async()=>{try{if(!await Se())throw new Error("[Ddu64 wasm] WASM initialization failed")}finally{e.clear();}};return S=Promise.race([t(),e.promise]).finally(()=>{S=null,Y=true;}),S}function wr(){if(I)return I;if(P)return null;if(!Y&&!S){Y=true;let e;S=new Promise(t=>{e=setTimeout(()=>{P=true,t();},5e3),Se().then(r=>{r||(P=true);}).catch(()=>{P=true;}).finally(()=>{e!==void 0&&clearTimeout(e),t();});}).finally(()=>{S=null;});}return null}function re(){return I}function Pe(e){if(e===Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(!Number.isFinite(e))throw new Error(`[Ddu64 config] wasmThreshold must be a finite number or Infinity, got ${e}`);return Math.max(1024,Math.min(1048576,Math.round(e)))}function Sr(e){we=e,!I&&!S&&(Y=false,P=false);}function D(e){let t=e.toLowerCase();return t.includes("[ddu64 adapter]")||t.includes("no platform adapter available")||t.includes("sync encryption unavailable")||t.includes("sync decryption unavailable")||t.includes("sync compression unavailable")||t.includes("sync decompression unavailable")||t.includes("sync key derivation unavailable")||t.includes("brotli compression is unavailable")||t.includes("brotli decompression is unavailable")||t.includes("compressionstream/decompressionstream does not support")||t.includes("crypto provider unavailable")}var Nt=(l=>(l.EncodeFailed="DDU64_ENCODE_FAILED",l.DecodeFailed="DDU64_DECODE_FAILED",l.CompressionFailed="DDU64_COMPRESSION_FAILED",l.DecompressionFailed="DDU64_DECOMPRESSION_FAILED",l.EncryptionFailed="DDU64_ENCRYPTION_FAILED",l.DecryptionFailed="DDU64_DECRYPTION_FAILED",l.ChecksumMismatch="DDU64_CHECKSUM_MISMATCH",l.InvalidCharset="DDU64_INVALID_CHARSET",l.InvalidInput="DDU64_INVALID_INPUT",l.LimitExceeded="DDU64_LIMIT_EXCEEDED",l.AdapterUnavailable="DDU64_ADAPTER_UNAVAILABLE",l.ObfuscationFailed="DDU64_OBFUSCATION_FAILED",l.StreamFailed="DDU64_STREAM_FAILED",l))(Nt||{}),C=class extends Error{code;operation;constructor(t,r){super(t,{cause:r.cause}),this.name=new.target.name,this.code=r.code,this.operation=r.operation;}},ne=class extends C{constructor(t,r){super(t,{code:"DDU64_ENCODE_FAILED",operation:"encode",cause:r});}},oe=class extends C{constructor(t,r){super(t,{code:"DDU64_DECODE_FAILED",operation:"decode",cause:r});}},R=class extends C{constructor(t,r){super(t,{code:"DDU64_COMPRESSION_FAILED",operation:"compress",cause:r});}},_=class extends C{constructor(t,r){super(t,{code:"DDU64_DECOMPRESSION_FAILED",operation:"decompress",cause:r});}},U=class extends C{constructor(t,r){super(t,{code:"DDU64_ENCRYPTION_FAILED",operation:"encrypt",cause:r});}},L=class extends C{constructor(t,r){super(t,{code:"DDU64_DECRYPTION_FAILED",operation:"decrypt",cause:r});}},v=class extends C{constructor(t,r){super(t,{code:"DDU64_CHECKSUM_MISMATCH",operation:"checksum",cause:r});}},ie=class extends C{constructor(t,r){super(t,{code:"DDU64_INVALID_CHARSET",operation:"charset",cause:r});}},se=class extends C{constructor(t,r,n){super(t,{code:"DDU64_LIMIT_EXCEEDED",operation:r,cause:n});}},g=class extends C{constructor(t,r,n){super(t,{code:"DDU64_ADAPTER_UNAVAILABLE",operation:r,cause:n});}},F=class extends C{constructor(t,r){super(t,{code:"DDU64_OBFUSCATION_FAILED",operation:"obfuscation",cause:r});}},ae=class extends C{constructor(t,r){super(t,{code:"DDU64_STREAM_FAILED",operation:"stream",cause:r});}};function B(e){return e instanceof C}function T(e){return e instanceof Error&&e.message?e.message:String(e)}function w(e,t){if(B(e))return e;let r=T(e),n=r.toLowerCase();if(n.startsWith("[ddu64")||n.startsWith("[bitpack")){if(n.includes("checksum"))return new v(r,e);if(n.includes("obfuscation"))return new F(r,e);if(D(r))return new g(r,t,e);if(n.includes("encryptionkey")||n.includes("encrypted payload requires"))return t==="encode"?new U(r,e):new L(r,e);if(n.includes("decrypt")||n.includes("decryption")||n.includes("incorrect key"))return new L(r,e);if(n.includes("encrypt"))return new U(r,e);if(n.includes("decompress")||n.includes("inflate"))return new _(r,e);if(n.includes("compress")||n.includes("brotli"))return new R(r,e);if(n.includes("limit")||n.includes("exceeds"))return new se(r,t,e);if(n.includes("charset")||n.includes("character")||n.includes("invalid"))return new ie(r,e)}return t==="stream"?new ae(r,e):t==="encode"?new ne(r,e):new oe(r,e)}function De(e,t){let{bitLength:r,usePowerOfTwo:n,charsetSize:o}=t,i=e.length;if(i===0)return {indices:[],paddingBits:0};if(n){if(r===6)return Kt(e);if(r===8)return Ht(e)}let s=i*8,a=Math.ceil(s/r),c=n?a:a*2,d=new Array(c),u=0,p=0,h=0;if(n){let m=(1<<r)-1;for(let f=0;f<i;f++)for(p=p<<8|e[f],h+=8;h>=r;)h-=r,d[u++]=p>>h&m,p&=(1<<h)-1;}else for(let m=0;m<i;m++)for(p=p<<8|e[m],h+=8;h>=r;){h-=r;let f=p>>h,y=f/o|0;d[u++]=y,d[u++]=f-y*o,p&=(1<<h)-1;}let l=0;if(h>0){l=r-h;let m=p<<l;if(n)d[u++]=m;else {let f=m/o|0;d[u++]=f,d[u++]=m-f*o;}}return u!==c&&(d.length=u),{indices:d,paddingBits:l}}function Kt(e){let t=e.length,r=t/3|0,n=t-r*3,o=new Array(r*4+(n===0?0:n+1)),i=0,s=0;for(;s+2<t;s+=3){let c=e[s],d=e[s+1],u=e[s+2];o[i++]=c>>>2,o[i++]=(c&3)<<4|d>>>4,o[i++]=(d&15)<<2|u>>>6,o[i++]=u&63;}let a=0;if(n===1){let c=e[s];o[i++]=c>>>2,o[i]=(c&3)<<4,a=4;}else if(n===2){let c=e[s],d=e[s+1];o[i++]=c>>>2,o[i++]=(c&3)<<4|d>>>4,o[i]=(d&15)<<2,a=2;}return {indices:o,paddingBits:a}}function Ht(e){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return {indices:t,paddingBits:0}}function Ee(e,t,r){let{bitLength:n,usePowerOfTwo:o,charsetSize:i}=r,s=e.length;if(s===0)return new Uint8Array(0);let a=o?1:2,c=Math.ceil(s/a),d=Math.ceil((c*n-t)/8),u=new Uint8Array(d+1),p=0,h=0,l=0;if(o)for(let m=0;m<s;m+=a){let f=e[m];if(f<0||f>=i)throw new Error(`[BitPack decode] Invalid index ${f} at position ${m}`);for(h=h<<n|f,l+=n,m+a>=s&&t>0&&(h>>=t,l-=t);l>=8;)l-=8,u[p++]=h>>l&255,h&=(1<<l)-1;}else {let m=n<31?1<<n:Math.pow(2,n);for(let f=0;f<s;f+=a){let y=e[f],b=e[f+1];if(y<0||y>=i)throw new Error(`[BitPack decode] Invalid index ${y} at position ${f}`);if(b===void 0||b<0||b>=i)throw new Error(`[BitPack decode] Invalid index ${b} at position ${f+1}`);let A=y*i+b;if(A>=m)throw new Error(`[BitPack decode] Value ${A} exceeds range at position ${f}`);for(h=h<<n|A,l+=n,f+a>=s&&t>0&&(h>>=t,l-=t);l>=8;)l-=8,u[p++]=h>>l&255,h&=(1<<l)-1;}}return u.subarray(0,p)}function xe(e,t){return e<=1?0:t?Math.floor(Math.log2(e)):Math.ceil(Math.log2(e))}function ke(e){return e>0&&(e&e-1)===0}var zt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let n=0;n<8;n++)r=r>>>1^(r&1?3988292384:0);e[t]=r;}return e})();function O(e){let t=4294967295;for(let r=0;r<e.length;r++)t=t>>>8^zt[(t^e[r])&255];return ((t^4294967295)>>>0).toString(16).padStart(8,"0")}function ce(e,t){let r=Math.max(e.length,t.length),n=e.length^t.length;for(let o=0;o<r;o++){let i=o<e.length?e.charCodeAt(o):0,s=o<t.length?t.charCodeAt(o):0;n|=i^s;}return n===0}var Ue=["-","_","."];function Le(e){return e.length===0?e:e.replaceAll("+","-").replaceAll("/","_").replaceAll("=",".")}function ve(e){return e.length===0?e:e.replaceAll("-","+").replaceAll("_","/").replaceAll(".","=")}function Be(e,t,r){if(t<=0||e.length<=t)return e;let n=Math.ceil(e.length/t),o=new Array(n*2-1),i=0;for(let s=0;s<e.length;s+=t)o[i++]=e.slice(s,s+t),s+t<e.length&&(o[i++]=r);return o.join("")}function Te(e,t){if(e.length===0)return e;let r=t&&t!==`
2
+ `&&t!==`\r
3
+ `&&t!=="\r"?t:"",n=e.includes(`
4
+ `)||e.includes("\r"),o=r.length>0&&e.includes(r);if(!n&&!o)return e;let i=n?e.replace(/[\r\n]/g,""):e;return o&&(i=i.replaceAll(r,"")),i}var Oe={"":0,\u3131:1,\u3132:2,\u3133:3,\u3134:4,\u3135:5,\u3136:6,\u3137:7,\u3139:8,\u313A:9,\u313B:10,\u313C:11,\u313D:12,\u313E:13,\u313F:14,\u3140:15,\u3141:16,\u3142:17,\u3144:18,\u3145:19,\u3146:20,\u3147:21,\u3148:22,\u314A:23,\u314B:24,\u314C:25,\u314D:26,\u314E:27};function Ie(e){return Object.prototype.hasOwnProperty.call(Oe,e)}function Ft(e,t){let r=e.charCodeAt(0);if(r<44032||r>55203)return e;let n=r-(r-44032)%28,o=Oe[t]??0;return String.fromCharCode(n+o)}function q(e,t){let r=new Array(e.length*t.length),n=0;for(let o of e)for(let i of t)r[n++]=Ft(o,i);return r}function j(e,t){let n=e===void 0||!Number.isFinite(e)?6:Math.floor(e);return Math.min(t==="brotli"?11:9,Math.max(0,n))}var Vt=new TextEncoder,Wt=new TextDecoder;function V(e){return Vt.encode(e)}function de(e){return Wt.decode(e)}var Gt={symbol:"ddu",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","\uB4C0","\uB31C","\uB3A8"],codaChar:["","\u3131","\u3132","\u3137","\u3148","\u3147","\u3145","\u3146"],maxRequiredLength:64,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true},$t={symbol:"ddu_v1",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","!","?","."],maxRequiredLength:8,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true,usePowerOfTwo:false,encodingProfile:{bitLength:6,usePowerOfTwo:false,bitsPerPadChar:2}},Yt={symbol:"oneCharSet",charSet:["A","s","q","r","0","z","3","t","y","1","5","2","4","E","B","C","Q","F","R","T","U","W","V","X","Y","Z","b","a","c","d","D","G","L","H","I","-","J","K","M","O","N","f","e","h","g","P","i","S","k","l","m","u","j","v","n","o","p","9","w","6","7","8","x","_"],paddingChar:"=",maxRequiredLength:64,bitLength:6};function Z(e){switch(e){case "ddu":return Gt;case "ddu_v1":return $t;case "oneCharSet":return Yt;default:return}}var qt=65536;function Re(e,t,r,n){let o=(i,s,a,c,d)=>{if(jt(a,r?.usePowerOfTwo)&&a>0){let h=Math.floor(Math.log2(a)),l=1<<h;return {charSet:i.length===l?i:i.slice(0,l),padding:s,requiredLength:l,bitLength:h,isPredefined:c,useRepeatPadding:d}}return {charSet:i.length===a?i:i.slice(0,a),padding:s,requiredLength:a,bitLength:a>0?Math.ceil(Math.log2(a)):0,isPredefined:c,useRepeatPadding:d}};try{let i=e??r?.dduChar,s=t??r?.paddingChar;if(i){if(!s)throw new Error("[Ddu64 Constructor] paddingChar is required when dduChar is provided.");let h=typeof i=="string"?[...i]:[...i],l=r?.codaChar,m=l?!0:r?.useRepeatPadding??!1;if(l&&l.length>0){if(n){let y=l.filter(b=>!Ie(b));if(y.length>0)throw new Error(`[Ddu64 Constructor] Unknown coda character(s): [${y.join(", ")}]. Coda must be empty ("") or a Hangul jongseong jamo (\u3131, \u3132, \u3133, \u2026 \u314E). Unknown coda collapses to no-coda and can create duplicate symbols.`)}h=q(h,l);}if(n&&new Set(h).size!==h.length){let b=h.filter((A,x)=>h.indexOf(A)!==x);throw new Error(`[Ddu64 Constructor] Character set contains duplicate characters: [${[...new Set(b)].join(", ")}]`)}let f=r?.requiredLength??h.length;if(h.length<f)throw new Error("[Ddu64 Constructor] Insufficient characters.");return o(h,s,f,!1,m)}let a=r?.dduSetSymbol??ee.dduSetSymbol??"ddu",c=Zt(a),d=c.codaChar?q(c.charSet,c.codaChar):c.charSet,u=o(d,c.paddingChar,c.maxRequiredLength,!0,c.useRepeatPadding),p=c.encodingProfile;return p?(u.encodingProfile=p,u.bitLength=p.bitLength,u.usePowerOfTwo=p.usePowerOfTwo,u.bitsPerPadChar=p.bitsPerPadChar):(u.bitsPerPadChar=c.bitsPerPadChar,u.usePowerOfTwo=c.usePowerOfTwo,c.usePowerOfTwo===!1&&(u.bitLength=c.bitLength)),u}catch(i){if(n)throw i;return ue(r)}}function _e(e,t,r){let n=[e,null];for(let i of n){let s=i?{...i}:ue(r);try{let a=s.charSet,c=s.requiredLength,d=Array.from(new Set(a));if(d.length!==a.length){if(t){let h=a.filter((l,m)=>a.indexOf(l)!==m);throw new Error(`[Ddu64 normalizeCharSet] Character set contains duplicate characters: [${[...new Set(h)].join(", ")}]`)}a=d,s.isPredefined||(c=a.length);}if(a.length<c)throw new Error(`[Ddu64 normalizeCharSet] Insufficient characters. Required: ${c}, Has: ${a.length}`);if(c<2)throw new Error("[Ddu64 normalizeCharSet] At least 2 unique characters required.");if(a.length===0)throw new Error("[Ddu64 normalizeCharSet] Empty charset.");if(a.find(h=>h.length!==1)){if(t)throw new Error("[Ddu64 normalizeCharSet] Multi-character symbols are not supported.");continue}if(a.length>qt){if(t)throw new Error("[Ddu64 normalizeCharSet] Charset size exceeds maximum supported size of 65536.");continue}if(s.padding.length!==1)throw new Error(`[Ddu64 normalizeCharSet] Padding length mismatch. Expected 1, got ${s.padding.length}`);if(a.includes(s.padding)){if(t)throw new Error(`[Ddu64 normalizeCharSet] Padding character "${s.padding}" conflicts with charset.`);a=a.filter(h=>h!==s.padding);}for(let h of a)if(h.includes(`
5
+ `)||h.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");if(s.padding.includes(`
6
+ `)||s.padding.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");return {charSet:a.length===c?a:a.slice(0,c),padding:s.padding,isPredefined:s.isPredefined}}catch(a){if(t)throw a}}let o=ue(r);return {charSet:o.charSet.slice(0,o.requiredLength),padding:o.padding,isPredefined:true}}function Me(e,t,r){for(let n of Ue){for(let o of e)if(o.includes(n)){let i=`[Ddu64 Constructor] URL-Safe mode conflict: charset character "${o}" contains "${n}".`;if(r)throw new Error(i);return false}if(t.includes(n)){let o=`[Ddu64 Constructor] URL-Safe mode conflict: padding character "${t}" contains "${n}".`;if(r)throw new Error(o);return false}}return true}function Ne(e,t,r){if(r>256)return;let n=Math.min(e.length,r),o=e.slice(0,n),i=new Set;for(let a=0;a<o.length;a++)i.add(o[a]);i.add(t);for(let a=0;a<o.length;a++){let c=o[a];for(let p=0;p<o.length;p++){let h=c+o[p];if(i.has(h))throw new Error(`Combination conflict: "${c}" + "${o[p]}"`);i.add(h);}let d=c+t;if(i.has(d))throw new Error(`Combination conflict: "${c}" + padding`);i.add(d);let u=t+c;if(i.has(u))throw new Error(`Combination conflict: padding + "${c}"`);i.add(u);}let s=t+t;if(i.has(s))throw new Error("Combination conflict: double padding");i.add(s);}function jt(e,t){return t!==void 0?t?e>0:false:e>0&&(e&e-1)===0}function Zt(e){let t=Z(e);if(!t)throw new Error(`CharSet with symbol ${e} not found`);return t}function ue(e){let t=e?.dduSetSymbol??ee.dduSetSymbol??"oneCharSet",r=Z(t)??Z("oneCharSet");if(!r)throw new Error("Critical: No fallback CharSet available");return {charSet:r.codaChar?q(r.charSet,r.codaChar):r.charSet,padding:r.paddingChar,requiredLength:r.maxRequiredLength,bitLength:r.encodingProfile?.bitLength??r.bitLength,isPredefined:true,useRepeatPadding:r.useRepeatPadding,bitsPerPadChar:r.encodingProfile?.bitsPerPadChar??r.bitsPerPadChar,usePowerOfTwo:r.encodingProfile?.usePowerOfTwo??r.usePowerOfTwo,encodingProfile:r.encodingProfile}}var Xt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ke(e,t,r,n){return r&&n===6&&t==="="&&e.join("")===Xt}function He(e){let t=Jt(e);if(t===null)return null;let r=0,n=t.length;for(;n>0&&t[n-1]==="=";)r++,n--;return {payload:t.slice(0,n),paddingBits:r===2?4:r===1?2:0}}function ze(e,t,r){let n=t===4?2:t===2?1:t===0?0:-1;if(n<0)return null;for(let o=0;o<e.length;o++)if(!r(e.charCodeAt(o)))return null;return Qt(e+"=".repeat(n))}function Jt(e){let t=e.toBase64;if(typeof t=="function")return t.call(e);let r=globalThis.Buffer;return r?.from?r.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"):null}function Qt(e){let t=Uint8Array;if(typeof t.fromBase64=="function")return t.fromBase64(e);let r=globalThis.Buffer;if(r?.from){let n=r.from(e,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}return null}function X(e,t){if(!e)throw new g("[Ddu64 adapter] No platform adapter available. Use encodeAsync()/decodeAsync() in browser environments, or provide an adapter via options.adapter.",t);return e}function Fe(e,t,r){let n=X(e.adapter,"encode");if(!n.encryptSync)throw new g("[Ddu64 encrypt] Sync encryption unavailable. Use encodeAsync() in browser environments.","encode");let o=$e(e,n,"encrypt","encode");return n.encryptSync(t,o,r)}function Ve(e,t,r){let n=X(e.adapter,"decode");if(!n.decryptSync)throw new g("[Ddu64 decrypt] Sync decryption unavailable. Use decodeAsync() in browser environments.","decode");let o=$e(e,n,"decrypt","decode");return n.decryptSync(t,o,r)}function We(e,t,r,n){let o=X(e,"encode");if(r==="brotli"){if(!o.brotliCompressSync)throw new g("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return o.brotliCompressSync(t,n)}if(!o.deflateSync)throw new g("[Ddu64 compress] Sync compression unavailable. Use encodeAsync() in browser environments.","encode");return o.deflateSync(t,n)}function Ge(e,t,r,n){let o=X(e,"decode");if(r==="brotli"){if(!o.brotliDecompressSync)throw new g("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return o.brotliDecompressSync(t,n)}if(!o.inflateSync)throw new g("[Ddu64 decompress] Sync decompression unavailable. Use decodeAsync() in browser environments.","decode");return o.inflateSync(t,n)}function $e(e,t,r,n){if(e.encryptionKeyHash)return e.encryptionKeyHash;if(!t.deriveKeySync){let i=r==="encrypt"?"encodeAsync":"decodeAsync";throw new g(`[Ddu64 ${r}] Sync key derivation unavailable. Use ${i}() in browser environments.`,n)}let o=t.deriveKeySync(e.encryptionKey,e.keyDerivation);return e.setEncryptionKeyHash(o),o}async function Ye(e,t,r){try{let n=J(e.adapter,"encode"),o=await Ze(e,n);return await n.encrypt(t,o,r)}catch(n){throw Q(n,"encode","encrypt")}}async function qe(e,t,r){try{let n=J(e.adapter,"decode"),o=await Ze(e,n);return await n.decrypt(t,o,r)}catch(n){throw Q(n,"decode","decrypt")}}async function le(e,t,r,n){try{let o=J(e,"encode");if(r==="brotli"){if(!o.brotliCompress)throw new g("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return await o.brotliCompress(t,n)}return await o.deflate(t,n)}catch(o){throw Q(o,"encode","compress")}}async function je(e,t,r,n){try{let o=J(e,"decode");if(r==="brotli"){if(!o.brotliDecompress)throw new g("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return await o.brotliDecompress(t,n)}return await o.inflate(t,n)}catch(o){throw Q(o,"decode","decompress")}}function J(e,t){if(!e)throw new g("[Ddu64 adapter] No platform adapter available. Use @ddunigma/node or @ddunigma/node/browser, or provide an adapter via options.adapter.",t);return e}async function Ze(e,t){if(e.encryptionKeyHash)return e.encryptionKeyHash;let r=await t.deriveKey(e.encryptionKey,e.keyDerivation);return e.setEncryptionKeyHash(r),r}function Q(e,t,r){if(B(e))return e;let n=T(e);if(D(n))return new g(n,t,e);switch(r){case "compress":return new R(n,e);case "decompress":return new _(n,e);case "encrypt":return new U(n,e);case "decrypt":return new L(n,e)}}function Xe(e,t,r){return e!=null&&typeof e=="object"&&!Array.isArray(e)?{dduChar:void 0,paddingChar:void 0,dduOptions:e}:{dduChar:e,paddingChar:t,dduOptions:r}}function Je(e){let t=new Uint16Array(e.length),r=0;for(let o=0;o<e.length;o++){let i=e[o].charCodeAt(0);t[o]=i,i>r&&(r=i);}let n=new Int32Array(r+1);n.fill(-1);for(let o=0;o<e.length;o++)n[t[o]]=o;return {charCodeLookup:n,charCodes:t}}function W(e,t){return t<e.length?e[t]:-1}var Qe=8;function M(e,t,r,n){if(e===void 0)return t;if(e===Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(!Number.isFinite(e)||e<=0){if(r)throw new Error(`[Ddu64 options] Invalid ${n}. Must be a positive finite number or Infinity.`);return t}return Math.floor(e)}function et(e,t,r,n){if(e===0)return 0;if(t<0||t>=r)throw new Error(`[Ddu64 decode] Invalid padding bits: ${t}`);let s=Math.ceil(e/(n?1:2))*r-t;if(s<0)throw new Error("[Ddu64 decode] Invalid decoded bit length");return Math.ceil(s/Qe)}function tt(e,t){if(!t&&e.length%2!==0)throw new Error(`[Ddu64 decode] Invalid encoded length for variable charset. Expected multiple of 2, got ${e.length}`)}function rt(e,t,r,n){if(e.length===0)return;let o=n?1:2,s=e.length/o*r-t;if(s<0||s%Qe!==0)throw new Error(`[Ddu64 decode] Invalid encoded bit length. Expected a whole number of bytes, got ${s} bits.`)}function nt(e,t,r,n,o){if(t===0)return;if(e.length===0)throw new Error("[Ddu64 decode] Invalid padding bits without payload");let i=(1<<t)-1,s;if(r){let a=e[e.length-1],c=W(n,a.charCodeAt(0));if(c<0)throw new Error(`[Ddu64 decode] Invalid character "${a}" at ${e.length-1}`);s=c;}else {let a=e[e.length-2],c=e[e.length-1],d=W(n,a.charCodeAt(0)),u=W(n,c.charCodeAt(0));if(d<0||u<0)throw new Error("[Ddu64 decode] Invalid character in final encoded chunk");s=d*o+u;}if((s&i)!==0)throw new Error("[Ddu64 decode] Invalid non-zero padding bits in final symbol")}function ot(e,t,r){let n=t?.checksum??r.defaultChecksum,o=t?.compress!==false,i=t?.encrypt!==false,s=e;r.reportDecodeStart(e.length);let a=t?.chunkSeparator??r.defaultChunkSeparator;s=Te(s,a),r.urlSafe&&(s=ve(s));let c=null,d=null;if(n){let x=Ce(s);if(c=x.checksum,d=x.scope,s=x.data,!c)throw new v("[Ddu64 checksum] Checksum verification requested, but no checksum marker was found.")}r.shouldObfuscate(t)&&(s=r.deobfuscate(s));let{cleanedInput:u,paddingBits:p,compressionAlgorithm:h,isEncrypted:l,pipelineVersion:m}=be(s,r.paddingChar,r.bitLength,r.bitsPerPadChar);if(l&&i&&!r.encryptionKey)throw new Error("[Ddu64 decode] Encrypted payload requires an encryptionKey");let f=l&&m===4?G({compressionAlgorithm:h}):void 0;tt(u,r.usePowerOfTwo),nt(u,p,r.usePowerOfTwo,r.dduCharCodeLookup,r.charSetSize),rt(u,p,r.bitLength,r.usePowerOfTwo);let y=M(t?.maxDecodedBytes,r.defaultMaxDecodedBytes,true,"maxDecodedBytes"),b=et(u.length,p,r.bitLength,r.usePowerOfTwo);if(b>y)throw new Error(`[Ddu64 decode] Decoded output exceeds limit. Estimated: ${b} bytes, Limit: ${y} bytes`);return r.reportBitpackDecode(u.length,e.length),{decoded:r.decodeChars(u,p),extractedChecksum:c,extractedChecksumScope:d,compressionAlgorithm:h,isEncrypted:l,pipelineVersion:m,encryptionAAD:f,allowInternalDecompress:o,allowInternalDecrypt:i}}function it(e){return e.omitFooter?"":Ae({paddingBits:e.paddingBits,compressionAlgorithm:e.compressionAlgorithm,isEncrypted:e.isEncrypted,paddingChar:e.paddingChar,useRepeatPadding:e.useRepeatPadding&&!e.compressionAlgorithm&&!e.isEncrypted,bitsPerPadChar:e.bitsPerPadChar,pipelineVersion:e.isEncrypted?e.pipelineVersion:2})}function st(e){let t=e.encoded;if(e.shouldObfuscate(e.options)&&(t=e.getObfuscationLayer().obfuscate(t)),e.shouldChecksum&&e.checksum){let r=e.checksumScope==="plaintext"?"P":"O";t=t+"CK"+r+e.checksum;}return e.urlSafe&&(t=Le(t)),e.chunkSize&&e.chunkSize>0&&(e.assertSafeChunkSeparator(t,e.chunkSeparator),t=Be(t,e.chunkSize,e.chunkSeparator)),t}function at(e,t){let r=e.length;if(r<=4096){let s=new Array(r);for(let a=0;a<r;a++)s[a]=t[e[a]];return String.fromCharCode.apply(null,s)}if(r<=8192){let s=new Uint16Array(r);for(let a=0;a<r;a++)s[a]=t[e[a]];return String.fromCharCode.apply(null,s)}let n=new Array(Math.ceil(r/8192)),o=new Uint16Array(8192),i=0;for(let s=0;s<r;s+=8192){let a=Math.min(8192,r-s);for(let d=0;d<a;d++)o[d]=t[e[s+d]];let c=o.subarray(0,a);n[i++]=String.fromCharCode.apply(null,c);}return n.join("")}function ct(e,t,r,n,o){if(e.length===0)return "";let i=o.canUseNativeBase64?He(e):null,s,a;if(i)s=i.paddingBits,a=i.payload;else {let d=tr(e,o);s=d.paddingBits,a=at(d.indices,o.dduCharCodes);}let c=it({paddingBits:s,compressionAlgorithm:t,isEncrypted:r,paddingChar:o.paddingChar,useRepeatPadding:o.useRepeatPadding,bitsPerPadChar:o.bitsPerPadChar,pipelineVersion:o.encryptedPipelineVersion,omitFooter:n?.omitFooter});return a+c}function dt(e,t,r){let n=e.length;if(n===0)return new Uint8Array(0);let o=r.canUseNativeBase64?ze(e,t,u=>W(r.dduCharCodeLookup,u)>=0):null;if(o)return o;let s=n>=r.wasmThreshold?new Uint16Array(n):new Array(n),a=r.dduCharCodeLookup,c=a.length;for(let u=0;u<n;u++){let p=e.charCodeAt(u),h=p<c?a[p]:-1;if(h<0)throw new Error(`[Ddu64 decode] Invalid character "${e[u]}" at ${u}`);s[u]=h;}let d=ut(n,r)?re():null;if(d?.ready&&r.usePowerOfTwo){let u=s instanceof Uint16Array?s:Uint16Array.from(s);return d.decode(u,r.bitLength,t)}return Ee(s,t,r.bitPackConfig)}function tr(e,t){let r=ut(e.length,t)?re():null;return r?.ready&&t.usePowerOfTwo?r.encode(e,t.bitLength):De(e,t.bitPackConfig)}function ut(e,t){return e>=t.wasmThreshold}function lt(e,t,r){let n=e.decoded,o=e.extractedChecksumScope??t?.checksumScope??"plaintext";return o==="output"&&yt(e,r),n=rr(e,r,n),n=nr(e,t,r,n),o==="plaintext"&&gt(e,r,t,n),n=or(e,r,n),Ct(r,n),n}async function ht(e,t,r){let n=e.decoded,o=e.extractedChecksumScope??t?.checksumScope??"plaintext";if(o==="output"&&yt(e,r),pt(e,r)&&(E(r,n.length,55,"decrypt"),n=await r.decrypt(n,e.encryptionAAD)),mt(e)){let i=bt(t,r);E(r,n.length,70,"decompress"),n=await r.decompress(n,e.compressionAlgorithm,i);}return o==="plaintext"&&gt(e,r,t,n),ft(e,r)&&(E(r,n.length,90,"decrypt"),n=await r.decrypt(n,e.encryptionAAD)),Ct(r,n),n}function rr(e,t,r){return pt(e,t)?(E(t,r.length,55,"decrypt"),t.decrypt(r,e.encryptionAAD)):r}function nr(e,t,r,n){if(!mt(e))return n;let o=bt(t,r);return E(r,n.length,70,"decompress"),r.decompress(n,e.compressionAlgorithm,o)}function or(e,t,r){return ft(e,t)?(E(t,r.length,90,"decrypt"),t.decrypt(r,e.encryptionAAD)):r}function pt(e,t){return (e.pipelineVersion===3||e.pipelineVersion===4)&&e.isEncrypted&&!!t.encryptionKey&&e.allowInternalDecrypt}function ft(e,t){return e.pipelineVersion===2&&e.isEncrypted&&!!t.encryptionKey&&e.allowInternalDecrypt}function mt(e){return !!e.compressionAlgorithm&&e.allowInternalDecompress&&(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt)}function yt(e,t){if(!e.extractedChecksum)return;E(t,e.decoded.length,85,"checksum");let r=O(e.decoded);if(!ce(r,e.extractedChecksum))throw new v(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${r}`)}function gt(e,t,r,n){if(!e.extractedChecksum||!(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt))return;E(t,n.length,85,"checksum");let o=O(n);if(!ce(o,e.extractedChecksum))throw new v(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${o}`)}function bt(e,t){return M(e?.maxDecompressedBytes,t.defaultMaxDecompressedBytes,true,"maxDecompressedBytes")}function E(e,t,r,n){e.reportProgress({processedBytes:t,totalBytes:t,percent:r,stage:n});}function Ct(e,t){E(e,t.length,100,"done");}function he(e,t,r){let n=wt(t,r),o=typeof e=="string"?V(e):e;St(r,o.length);let i="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(i=O(o));let s,a;if(n.shouldCompress){let{algo:d,level:u}=At(t,r);Pt(r,o.length);let p=r.compress(o,d,u);p.length<o.length&&(a=p.length,o=p,s=d);}let c=false;return n.shouldEncrypt&&(Dt(r,o.length),o=r.encrypt(o,r.getEncryptionAAD(s)),c=true),n.shouldChecksum&&n.checksumScope==="output"&&(i=O(o)),{encoded:r.finalize(o,s,c,i,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:a}}async function pe(e,t,r){let n=wt(t,r),o=typeof e=="string"?V(e):e;St(r,o.length);let i="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(i=O(o));let s,a;if(n.shouldCompress){let{algo:d,level:u}=At(t,r);Pt(r,o.length);let p=await r.compress(o,d,u);p.length<o.length&&(a=p.length,o=p,s=d);}let c=false;return n.shouldEncrypt&&(Dt(r,o.length),o=await r.encrypt(o,r.getEncryptionAAD(s)),c=true),n.shouldChecksum&&n.checksumScope==="output"&&(i=O(o)),{encoded:r.finalize(o,s,c,i,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:a}}function At(e,t){let r=e?.compressionAlgorithm??t.defaultCompressionAlgorithm,n=j(e?.compressionLevel??t.defaultCompressionLevel,r);return {algo:r,level:n}}function wt(e,t){return {shouldCompress:e?.compress??t.defaultCompress,shouldChecksum:e?.checksum??t.defaultChecksum,checksumScope:e?.checksumScope??t.defaultChecksumScope,shouldEncrypt:(e?.encrypt??true)&&t.hasEncryptionKey,chunkSize:e?.chunkSize??t.defaultChunkSize,chunkSeparator:e?.chunkSeparator??t.defaultChunkSeparator}}function St(e,t){e.reportProgress({processedBytes:0,totalBytes:t,percent:0,stage:"start"});}function Pt(e,t){e.reportProgress({processedBytes:t,totalBytes:t,percent:20,stage:"compress"});}function Dt(e,t){e.reportProgress({processedBytes:t,totalBytes:t,percent:45,stage:"encrypt"});}var sr=64*1024*1024,ar=64*1024*1024,Et=28,xt=class{dduChar;dduCharCodes;paddingChar;bitLength;usePowerOfTwo;dduCharCodeLookup;defaultCompress;defaultMaxDecodedBytes;defaultMaxDecompressedBytes;urlSafe;encryptionKey;keyDerivation;encryptionKeyHash;syncGatewayContext;defaultChecksum;defaultChecksumScope;defaultChunkSize;defaultChunkSeparator;defaultCompressionLevel;defaultCompressionAlgorithm;useRepeatPadding;bitsPerPadChar;bitPackConfig;wasmThreshold;canUseNativeBase64;payloadCodecContext;adapter;defaultObfuscate;obfuscationLayer;constructor(t,r,n){let o=Xe(t,r,n);t=o.dduChar,r=o.paddingChar,n=o.dduOptions;let i=n?.throwOnError??true;n?.adapter?this.adapter=n.adapter:this.adapter=void 0;let s=Re(t,r,n,i),a=_e(s,i,n);this.dduChar=a.charSet,this.paddingChar=a.padding;let c=a.isPredefined;this.defaultCompress=n?.compress??false,this.defaultMaxDecodedBytes=M(n?.maxDecodedBytes,sr,i,"maxDecodedBytes"),this.defaultMaxDecompressedBytes=M(n?.maxDecompressedBytes,ar,i,"maxDecompressedBytes");let d=this.dduChar.length,u=ke(d),p=n?.usePowerOfTwo,h=s.encodingProfile;this.usePowerOfTwo=h?.usePowerOfTwo??s.usePowerOfTwo??(p!==void 0?p&&u:u);let l=h?.bitLength??(s.isPredefined&&s.usePowerOfTwo!==void 0?s.bitLength:void 0);this.bitLength=l??xe(d,this.usePowerOfTwo);let m=Je(this.dduChar);this.dduCharCodeLookup=m.charCodeLookup,this.dduCharCodes=m.charCodes,c||Ne(this.dduChar,this.paddingChar,d);let f=n?.urlSafe??false;if(this.urlSafe=f?Me(this.dduChar,this.paddingChar,i):false,this.encryptionKey=n?.encryptionKey,this.keyDerivation=n?.keyDerivation,this.defaultChecksum=n?.checksum??false,this.defaultChecksumScope=n?.checksumScope??"output",this.defaultChunkSize=n?.chunkSize,this.defaultChunkSeparator=n?.chunkSeparator??`
7
+ `,this.defaultCompressionAlgorithm=n?.compressionAlgorithm??"deflate",this.defaultCompressionLevel=j(n?.compressionLevel,this.defaultCompressionAlgorithm),this.useRepeatPadding=n?.useRepeatPadding??s.useRepeatPadding??false,this.bitsPerPadChar=h?.bitsPerPadChar??s.bitsPerPadChar??2,this.defaultObfuscate=n?.obfuscate??false,this.defaultObfuscate&&!this.encryptionKey)throw new F("[Ddu64 obfuscation] Obfuscation requires encryption to be enabled.");this.bitPackConfig={bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,charsetSize:d},this.wasmThreshold=Pe(n?.wasmThreshold??16384),this.canUseNativeBase64=Ke(this.dduChar,this.paddingChar,this.usePowerOfTwo,this.bitLength),this.payloadCodecContext={bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,bitPackConfig:this.bitPackConfig,wasmThreshold:this.wasmThreshold,canUseNativeBase64:this.canUseNativeBase64,dduCharCodes:this.dduCharCodes,dduCharCodeLookup:this.dduCharCodeLookup,paddingChar:this.paddingChar,useRepeatPadding:this.useRepeatPadding,bitsPerPadChar:this.bitsPerPadChar,encryptedPipelineVersion:4};}encode(t,r){try{return this.encodeInternal(t,r).encoded}catch(n){throw w(n,"encode")}}decode(t,r){try{let n=this.decodeToUint8Array(t,r);return de(n)}catch(n){throw w(n,"decode")}}decodeToUint8Array(t,r){try{return this.decodeToUint8ArrayInternal(t,r)}catch(n){throw w(n,"decode")}}decodeToUint8ArrayInternal(t,r){let n=this.decodePrelude(t,r);return lt(n,r,{...this.buildDecodeBaseContext(r),decrypt:(o,i)=>this.decryptSync(o,i),decompress:(o,i,s)=>this.decompressSync(o,i,s)})}async encodeAsync(t,r){try{return await this.encodeAsyncInternal(t,r)}catch(n){throw w(n,"encode")}}async encodeAsyncInternal(t,r){return (await pe(t,r,{...this.buildEncodeBaseContext(r),compress:(o,i,s)=>le(this.adapter,o,i,s),encrypt:(o,i)=>Ye(this.getSyncGatewayContext(),o,i)})).encoded}async decodeAsync(t,r){try{let n=await this.decodeToUint8ArrayAsync(t,r);return de(n)}catch(n){throw w(n,"decode")}}async decodeToUint8ArrayAsync(t,r){try{return await this.decodeToUint8ArrayAsyncInternal(t,r)}catch(n){throw w(n,"decode")}}async decodeToUint8ArrayAsyncInternal(t,r){let n=this.decodePrelude(t,r);return ht(n,r,{...this.buildDecodeBaseContext(r),decrypt:(o,i)=>qe(this.getSyncGatewayContext(),o,i),decompress:(o,i,s)=>je(this.adapter,o,i,s)})}buildDecodeBaseContext(t){return {encryptionKey:this.encryptionKey,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,reportProgress:r=>this.reportProgress(t,r)}}getCharSetInfo(){return {charSet:[...this.dduChar],paddingChar:this.paddingChar,bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,encoding:"utf-8",defaultCompress:this.defaultCompress,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,urlSafe:this.urlSafe,hasEncryptionKey:!!this.encryptionKey,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultObfuscate:this.defaultObfuscate,wasmThreshold:this.wasmThreshold,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm}}getStats(t,r){let n=typeof t=="string"?V(t):t,{encoded:o,compressedSize:i}=this.encodeStatsInternal(n,r);return this.buildEncodeStats(n.length,o.length,i,r)}async getStatsAsync(t,r){let n=typeof t=="string"?V(t):t,{encoded:o,compressedSize:i}=await this.encodeStatsAsyncInternal(n,r);return this.buildEncodeStats(n.length,o.length,i,r)}buildEncodeStats(t,r,n,o){let i=t>0?r/t:0,a=(o?.compress??this.defaultCompress)&&n!==void 0&&t>0?n/t:void 0;return {originalSize:t,encodedSize:r,compressedSize:n,compressionRatio:a,expansionRatio:i,charsetSize:this.dduChar.length,bitLength:this.bitLength}}encodeInternal(t,r){return he(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>this.compressSync(n,o,i),encrypt:(n,o)=>this.encryptSync(n,o)})}encodeStatsInternal(t,r){return he(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>this.compressSync(n,o,i),encrypt:n=>new Uint8Array(n.length+Et)})}async encodeStatsAsyncInternal(t,r){return pe(t,r,{...this.buildEncodeBaseContext(r),compress:(n,o,i)=>le(this.adapter,n,o,i),encrypt:async n=>new Uint8Array(n.length+Et)})}buildEncodeBaseContext(t){return {defaultCompress:this.defaultCompress,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm,hasEncryptionKey:!!this.encryptionKey,reportProgress:r=>this.reportProgress(t,r),getEncryptionAAD:r=>G({compressionAlgorithm:r}),finalize:(r,n,o,i,s,a,c,d)=>this.finalizeEncode(r,n,o,i,s,a,c,d,t)}}finalizeEncode(t,r,n,o,i,s,a,c,d){this.reportProgress(d,{processedBytes:t.length,totalBytes:t.length,percent:70,stage:"encode"});let u=ct(t,r,n,d,this.getPayloadCodecContext());return u=this.applyPostEncoding(u,d,o,i,s,a,c),this.reportProgress(d,{processedBytes:t.length,totalBytes:t.length,percent:100,stage:"done"}),u}applyPostEncoding(t,r,n,o,i,s,a){return st({encoded:t,options:r,checksum:n,shouldChecksum:o,checksumScope:i,chunkSize:s,chunkSeparator:a,urlSafe:this.urlSafe,shouldObfuscate:c=>this.shouldObfuscate(c),getObfuscationLayer:()=>this.getObfuscationLayer(),assertSafeChunkSeparator:(c,d)=>this.assertSafeChunkSeparator(c,d)})}decodePrelude(t,r){return ot(t,r,{defaultChecksum:this.defaultChecksum,defaultChunkSeparator:this.defaultChunkSeparator,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,urlSafe:this.urlSafe,paddingChar:this.paddingChar,bitLength:this.bitLength,bitsPerPadChar:this.bitsPerPadChar,usePowerOfTwo:this.usePowerOfTwo,dduCharCodeLookup:this.dduCharCodeLookup,charSetSize:this.dduChar.length,encryptionKey:this.encryptionKey,shouldObfuscate:n=>this.shouldObfuscate(n),deobfuscate:n=>this.getObfuscationLayer().deobfuscate(n),decodeChars:(n,o)=>dt(n,o,this.getPayloadCodecContext()),reportDecodeStart:n=>{this.reportProgress(r,{processedBytes:0,totalBytes:n,percent:0,stage:"start"});},reportBitpackDecode:(n,o)=>{this.reportProgress(r,{processedBytes:n,totalBytes:o,percent:30,stage:"decode"});}})}getPayloadCodecContext(){return this.payloadCodecContext}reportProgress(t,r){t?.onProgress?.(r);}encryptSync(t,r){try{return Fe(this.getSyncGatewayContext(),t,r)}catch(n){if(B(n))throw n;let o=T(n);throw D(o)?w(n,"encode"):new U(o,n)}}decryptSync(t,r){try{return Ve(this.getSyncGatewayContext(),t,r)}catch(n){if(B(n))throw n;let o=T(n);throw D(o)?w(n,"decode"):new L(o,n)}}compressSync(t,r,n){try{return We(this.adapter,t,r,n)}catch(o){if(B(o))throw o;let i=T(o);throw D(i)?w(o,"encode"):new R(i,o)}}decompressSync(t,r,n){try{return Ge(this.adapter,t,r,n)}catch(o){if(B(o))throw o;let i=T(o);throw D(i)?w(o,"decode"):new _(i,o)}}getSyncGatewayContext(){if(!this.syncGatewayContext){let t={adapter:this.adapter,encryptionKey:this.encryptionKey,keyDerivation:this.keyDerivation,encryptionKeyHash:this.encryptionKeyHash,setEncryptionKeyHash:r=>{this.encryptionKeyHash=r,t.encryptionKeyHash=r;}};this.syncGatewayContext=t;}return this.syncGatewayContext}getObfuscationLayer(){return this.obfuscationLayer||(this.obfuscationLayer=new z($(this.dduChar,this.paddingChar))),this.obfuscationLayer}shouldObfuscate(t){if(!(t?.obfuscate??this.defaultObfuscate))return false;if(!this.encryptionKey||t?.encrypt===false)throw new F("[Ddu64 obfuscation] Obfuscation requires encryption to be enabled.");return true}assertSafeChunkSeparator(t,r){if(!(r.length===0||this.isLineBreakSeparator(r))&&t.includes(r))throw new Error(`[Ddu64 chunking] Unsafe chunkSeparator "${r}" appears in encoded output. Use a separator that cannot be produced by the charset, footer, checksum, or URL-safe output.`)}isLineBreakSeparator(t){return t===`
8
+ `||t===`\r
9
+ `||t==="\r"}};var kt=class e{chars=[];constructor(){}static create(){return new e}static fromUnicodeRange(t,r){return new e().addUnicodeRange(t,r)}static fromString(t){return new e().addString(t)}static base64(){return new e().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")}static base32(){return new e().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")}static uppercase(){return e.fromUnicodeRange(65,90)}static lowercase(){return e.fromUnicodeRange(97,122)}static digits(){return e.fromUnicodeRange(48,57)}static hangulJamo(){return new e().addUnicodeRange(4352,4370).addUnicodeRange(4449,4469).addUnicodeRange(4520,4546)}addUnicodeRange(t,r){for(let n=t;n<=r;n++)this.chars.push(String.fromCodePoint(n));return this}addString(t){return typeof t=="string"?this.chars.push(...t):this.chars.push(...t),this}add(...t){return this.chars.push(...t),this}excludeConfusing(){let t=new Set(["0","O","o","1","l","I","i","|","L"]);return this.chars=this.chars.filter(r=>!t.has(r)),this}exclude(...t){let r=new Set(t);return this.chars=this.chars.filter(n=>!r.has(n)),this}excludeUrlUnsafe(){let t=new Set(["+","/","=","?","&","#","%"," "]);return this.chars=this.chars.filter(r=>!t.has(r)),this}unique(){return this.chars=[...new Set(this.chars)],this}shuffle(t){let r=t!==void 0?this.seededRandom(t):Math.random;for(let n=this.chars.length-1;n>0;n--){let o=Math.floor(r()*(n+1));[this.chars[n],this.chars[o]]=[this.chars[o],this.chars[n]];}return this}seededRandom(t){let r=t|0||1;return ()=>(r^=r<<13,r^=r>>17,r^=r<<5,(r>>>0)/4294967296)}limit(t){return this.chars=this.chars.slice(0,t),this}limitToPowerOfTwo(){let t=this.chars.length;if(t===0)return this;let r=1<<Math.floor(Math.log2(t));return this.chars=this.chars.slice(0,r),this}sort(){return this.chars.sort(),this}reverse(){return this.chars.reverse(),this}get length(){return this.chars.length}buildString(){return this.chars.join("")}build(){return [...this.chars]}buildWithPadding(t){let r=[...this.chars],n=t;if(!n){let o=["=",".","_","-","~","!"];for(let i of o)if(!r.includes(i)){n=i;break}if(!n)throw new Error("Cannot find suitable padding character")}return {charset:r,padding:n}}};exports.A=w;exports.B=Xe;exports.C=xt;exports.D=kt;exports.a=fe;exports.b=Bt;exports.c=ur;exports.d=lr;exports.e=z;exports.f=gr;exports.g=br;exports.h=Ar;exports.i=wr;exports.j=re;exports.k=Sr;exports.l=Nt;exports.m=C;exports.n=ne;exports.o=oe;exports.p=R;exports.q=_;exports.r=U;exports.s=L;exports.t=v;exports.u=ie;exports.v=se;exports.w=g;exports.x=F;exports.y=ae;exports.z=B;//# sourceMappingURL=chunk-UMA4JEN4.cjs.map
10
+ //# sourceMappingURL=chunk-UMA4JEN4.cjs.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkFACJ5LAG_cjs=require('./chunk-FACJ5LAG.cjs');function R(){let e=globalThis;return e.Deno?.version?.deno?"deno":e.Bun?.version?"bun":e.process?.versions?.node?"node":typeof e.EdgeRuntime=="string"||typeof e.WebSocketPair<"u"&&e.crypto?.subtle?"edge":typeof e.crypto<"u"&&e.crypto?.subtle?"browser":"unknown"}function W(e,n){let r=e.getCharSetInfo(),d=n?.compress??r.defaultCompress,p=(n?.encrypt??true)&&r.hasEncryptionKey,y=n?.checksum??r.defaultChecksum,t=d?n?.compressionAlgorithm??r.defaultCompressionAlgorithm:void 0,m=r.paddingChar,f=D(r,{compressed:d,encrypted:p,checksum:y}),c=false,s=[],h=0,o=null;return new TransformStream({async transform(a,u){if(f){if(!c){let k=chunkFACJ5LAG_cjs.z(m,{compressionAlgorithm:void 0,encrypted:false});u.enqueue(k),c=true;}let i;o&&o.length>0?(i=new Uint8Array(o.length+a.length),i.set(o,0),i.set(a,o.length)):i=a;let g=r.bitLength,S=U(g,8)/8,l=Math.floor(i.length/S)*S;if(l>0){let k=i.subarray(0,l),E=await e.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:void 0,chunkSeparator:void 0,omitFooter:true});u.enqueue(E);}l<i.length?o=i.slice(l):o=null;}else s.push(a),h+=a.length;},async flush(a){try{if(f){if(!c){let u=chunkFACJ5LAG_cjs.z(m,{compressionAlgorithm:void 0,encrypted:!1});a.enqueue(u);}if(o&&o.length>0){let u=await e.encodeAsync(o,{compress:!1,encrypt:!1,checksum:!1,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(u);}o=null;}else {let u=chunkFACJ5LAG_cjs.z(m,{compressionAlgorithm:t,encrypted:p});if(a.enqueue(u),h>0){let i=new Uint8Array(h),g=0;for(let l of s)i.set(l,g),g+=l.length;let S=await e.encodeAsync(i,{...n,compress:d,encrypt:p,checksum:y,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(S);}s=[],h=0;}}catch(u){a.error(chunkFACJ5LAG_cjs.w(u,"stream"));}}})}function L(e,n){let r=e.getCharSetInfo(),d=r.paddingChar,p=chunkFACJ5LAG_cjs.y(d),y=n?.checksum??r.defaultChecksum,t="",m=false,f=null;return new TransformStream({async transform(c,s){if(t+=c,!m&&t.length>=p){if(!t.startsWith(d)){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f=chunkFACJ5LAG_cjs.A(t,d),f===null){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f.encrypted&&!r.hasEncryptionKey){s.error(new Error("[WebStreams decode] Encrypted stream requires an encryptionKey"));return}m=true,t=t.slice(p);}},async flush(c){try{if(!m){if(t.length===0)return;c.error(new Error("[WebStreams decode] Incomplete stream header"));return}if(t.length===0)return;let s=f.compressionAlgorithm,h=await e.decodeToUint8ArrayAsync(t,{...n,compress:n?.compress,compressionAlgorithm:s,encrypt:n?.encrypt,checksum:y,chunkSize:void 0,chunkSeparator:void 0});h.length>0&&c.enqueue(h),t="";}catch(s){c.error(chunkFACJ5LAG_cjs.w(s,"stream"));}}})}function D(e,n){return e.usePowerOfTwo&&!n.compressed&&!n.encrypted&&!n.checksum}function U(e,n){return e*n/I(e,n)}function I(e,n){for(;n!==0;){let r=n;n=e%n,e=r;}return e}exports.a=R;exports.b=W;exports.c=L;//# sourceMappingURL=chunk-WS6GB27C.cjs.map
2
- //# sourceMappingURL=chunk-WS6GB27C.cjs.map
1
+ 'use strict';var chunkUMA4JEN4_cjs=require('./chunk-UMA4JEN4.cjs');function R(){let e=globalThis;return e.Deno?.version?.deno?"deno":e.Bun?.version?"bun":e.process?.versions?.node?"node":typeof e.EdgeRuntime=="string"||typeof e.WebSocketPair<"u"&&e.crypto?.subtle?"edge":typeof e.crypto<"u"&&e.crypto?.subtle?"browser":"unknown"}function W(e,n){let r=e.getCharSetInfo(),d=n?.compress??r.defaultCompress,p=(n?.encrypt??true)&&r.hasEncryptionKey,y=n?.checksum??r.defaultChecksum,t=d?n?.compressionAlgorithm??r.defaultCompressionAlgorithm:void 0,m=r.paddingChar,f=D(r,{compressed:d,encrypted:p,checksum:y}),c=false,s=[],h=0,o=null;return new TransformStream({async transform(a,u){if(f){if(!c){let k=chunkUMA4JEN4_cjs.c(m,{compressionAlgorithm:void 0,encrypted:false});u.enqueue(k),c=true;}let i;o&&o.length>0?(i=new Uint8Array(o.length+a.length),i.set(o,0),i.set(a,o.length)):i=a;let g=r.bitLength,S=U(g,8)/8,l=Math.floor(i.length/S)*S;if(l>0){let k=i.subarray(0,l),E=await e.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:void 0,chunkSeparator:void 0,omitFooter:true});u.enqueue(E);}l<i.length?o=i.slice(l):o=null;}else s.push(a),h+=a.length;},async flush(a){try{if(f){if(!c){let u=chunkUMA4JEN4_cjs.c(m,{compressionAlgorithm:void 0,encrypted:!1});a.enqueue(u);}if(o&&o.length>0){let u=await e.encodeAsync(o,{compress:!1,encrypt:!1,checksum:!1,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(u);}o=null;}else {let u=chunkUMA4JEN4_cjs.c(m,{compressionAlgorithm:t,encrypted:p});if(a.enqueue(u),h>0){let i=new Uint8Array(h),g=0;for(let l of s)i.set(l,g),g+=l.length;let S=await e.encodeAsync(i,{...n,compress:d,encrypt:p,checksum:y,chunkSize:void 0,chunkSeparator:void 0});a.enqueue(S);}s=[],h=0;}}catch(u){a.error(chunkUMA4JEN4_cjs.A(u,"stream"));}}})}function L(e,n){let r=e.getCharSetInfo(),d=r.paddingChar,p=chunkUMA4JEN4_cjs.b(d),y=n?.checksum??r.defaultChecksum,t="",m=false,f=null;return new TransformStream({async transform(c,s){if(t+=c,!m&&t.length>=p){if(!t.startsWith(d)){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f=chunkUMA4JEN4_cjs.d(t,d),f===null){s.error(new Error("[WebStreams decode] Invalid or missing stream header"));return}if(f.encrypted&&!r.hasEncryptionKey){s.error(new Error("[WebStreams decode] Encrypted stream requires an encryptionKey"));return}m=true,t=t.slice(p);}},async flush(c){try{if(!m){if(t.length===0)return;c.error(new Error("[WebStreams decode] Incomplete stream header"));return}if(t.length===0)return;let s=f.compressionAlgorithm,h=await e.decodeToUint8ArrayAsync(t,{...n,compress:n?.compress,compressionAlgorithm:s,encrypt:n?.encrypt,checksum:y,chunkSize:void 0,chunkSeparator:void 0});h.length>0&&c.enqueue(h),t="";}catch(s){c.error(chunkUMA4JEN4_cjs.A(s,"stream"));}}})}function D(e,n){return e.usePowerOfTwo&&!n.compressed&&!n.encrypted&&!n.checksum}function U(e,n){return e*n/I(e,n)}function I(e,n){for(;n!==0;){let r=n;n=e%n,e=r;}return e}exports.a=R;exports.b=W;exports.c=L;//# sourceMappingURL=chunk-WCXD5LRF.cjs.map
2
+ //# sourceMappingURL=chunk-WCXD5LRF.cjs.map
package/dist/core.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkFACJ5LAG_cjs=require('./chunk-FACJ5LAG.cjs');Object.defineProperty(exports,"CharsetBuilder",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.C}});Object.defineProperty(exports,"Ddu64",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.B}});Object.defineProperty(exports,"Ddu64AdapterError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.s}});Object.defineProperty(exports,"Ddu64CharsetError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.q}});Object.defineProperty(exports,"Ddu64ChecksumError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.p}});Object.defineProperty(exports,"Ddu64CompressionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.l}});Object.defineProperty(exports,"Ddu64Core",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.B}});Object.defineProperty(exports,"Ddu64DecodeError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.k}});Object.defineProperty(exports,"Ddu64DecompressionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.m}});Object.defineProperty(exports,"Ddu64DecryptionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.o}});Object.defineProperty(exports,"Ddu64EncodeError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.j}});Object.defineProperty(exports,"Ddu64EncryptionError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.n}});Object.defineProperty(exports,"Ddu64Error",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.i}});Object.defineProperty(exports,"Ddu64ErrorCode",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.h}});Object.defineProperty(exports,"Ddu64LimitError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.r}});Object.defineProperty(exports,"Ddu64ObfuscationError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.t}});Object.defineProperty(exports,"Ddu64StreamError",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.u}});Object.defineProperty(exports,"DduSetSymbol",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.a}});Object.defineProperty(exports,"getWasmCodec",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.e}});Object.defineProperty(exports,"getWasmCodecSync",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.f}});Object.defineProperty(exports,"isDdu64Error",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.v}});Object.defineProperty(exports,"preloadWasm",{enumerable:true,get:function(){return chunkFACJ5LAG_cjs.d}});//# sourceMappingURL=core.cjs.map
1
+ 'use strict';var chunkUMA4JEN4_cjs=require('./chunk-UMA4JEN4.cjs');Object.defineProperty(exports,"CharsetBuilder",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.D}});Object.defineProperty(exports,"Ddu64",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.C}});Object.defineProperty(exports,"Ddu64AdapterError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.w}});Object.defineProperty(exports,"Ddu64CharsetError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.u}});Object.defineProperty(exports,"Ddu64ChecksumError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.t}});Object.defineProperty(exports,"Ddu64CompressionError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.p}});Object.defineProperty(exports,"Ddu64Core",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.C}});Object.defineProperty(exports,"Ddu64DecodeError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.o}});Object.defineProperty(exports,"Ddu64DecompressionError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.q}});Object.defineProperty(exports,"Ddu64DecryptionError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.s}});Object.defineProperty(exports,"Ddu64EncodeError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.n}});Object.defineProperty(exports,"Ddu64EncryptionError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.r}});Object.defineProperty(exports,"Ddu64Error",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.m}});Object.defineProperty(exports,"Ddu64ErrorCode",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.l}});Object.defineProperty(exports,"Ddu64LimitError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.v}});Object.defineProperty(exports,"Ddu64ObfuscationError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.x}});Object.defineProperty(exports,"Ddu64StreamError",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.y}});Object.defineProperty(exports,"DduSetSymbol",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.a}});Object.defineProperty(exports,"getWasmCodec",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.i}});Object.defineProperty(exports,"getWasmCodecSync",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.j}});Object.defineProperty(exports,"isDdu64Error",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.z}});Object.defineProperty(exports,"preloadWasm",{enumerable:true,get:function(){return chunkUMA4JEN4_cjs.h}});//# sourceMappingURL=core.cjs.map
2
2
  //# sourceMappingURL=core.cjs.map
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WasmCodec } from './errors-DxOlTuHc.cjs';
2
- export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, D as Ddu64, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, D as Ddu64Core, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, a as DduConstructorOptions, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, z as isDdu64Error } from './errors-DxOlTuHc.cjs';
1
+ import { W as WasmCodec } from './errors-DNICpo4L.cjs';
2
+ export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, D as Ddu64, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, D as Ddu64Core, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, a as DduConstructorOptions, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, z as isDdu64Error } from './errors-DNICpo4L.cjs';
3
3
 
4
4
  /**
5
5
  * ddunigma 비트 패킹 가속을 위한 WASM 로더 및 통합.
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WasmCodec } from './errors-DxOlTuHc.js';
2
- export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, D as Ddu64, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, D as Ddu64Core, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, a as DduConstructorOptions, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, z as isDdu64Error } from './errors-DxOlTuHc.js';
1
+ import { W as WasmCodec } from './errors-DNICpo4L.js';
2
+ export { C as CharSetConfig, b as CharSetInfo, c as CharsetBuilder, D as Ddu64, d as Ddu64AdapterError, e as Ddu64CharsetError, f as Ddu64ChecksumError, g as Ddu64CompressionError, D as Ddu64Core, h as Ddu64DecodeError, i as Ddu64DecompressionError, j as Ddu64DecryptionError, k as Ddu64EncodeError, l as Ddu64EncryptionError, m as Ddu64Error, n as Ddu64ErrorCode, o as Ddu64ErrorOptions, p as Ddu64LimitError, q as Ddu64ObfuscationError, r as Ddu64Operation, s as Ddu64StreamError, a as DduConstructorOptions, t as DduEncodeStats, u as DduOptions, v as DduProgressInfo, w as DduSetSymbol, x as DduTextEncoding, E as EncodingProfile, K as KeyDerivationAlgorithm, y as KeyDerivationOptions, O as ObfuscationLayer, P as PlatformAdapter, z as isDdu64Error } from './errors-DNICpo4L.js';
3
3
 
4
4
  /**
5
5
  * ddunigma 비트 패킹 가속을 위한 WASM 로더 및 통합.
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- export{C as CharsetBuilder,B as Ddu64,s as Ddu64AdapterError,q as Ddu64CharsetError,p as Ddu64ChecksumError,l as Ddu64CompressionError,B as Ddu64Core,k as Ddu64DecodeError,m as Ddu64DecompressionError,o as Ddu64DecryptionError,j as Ddu64EncodeError,n as Ddu64EncryptionError,i as Ddu64Error,h as Ddu64ErrorCode,r as Ddu64LimitError,t as Ddu64ObfuscationError,u as Ddu64StreamError,a as DduSetSymbol,e as getWasmCodec,f as getWasmCodecSync,v as isDdu64Error,d as preloadWasm}from'./chunk-65RDFQV7.js';//# sourceMappingURL=core.js.map
1
+ export{D as CharsetBuilder,C as Ddu64,w as Ddu64AdapterError,u as Ddu64CharsetError,t as Ddu64ChecksumError,p as Ddu64CompressionError,C as Ddu64Core,o as Ddu64DecodeError,q as Ddu64DecompressionError,s as Ddu64DecryptionError,n as Ddu64EncodeError,r as Ddu64EncryptionError,m as Ddu64Error,l as Ddu64ErrorCode,v as Ddu64LimitError,x as Ddu64ObfuscationError,y as Ddu64StreamError,a as DduSetSymbol,i as getWasmCodec,j as getWasmCodecSync,z as isDdu64Error,h as preloadWasm}from'./chunk-HTZT725P.js';//# sourceMappingURL=core.js.map
2
2
  //# sourceMappingURL=core.js.map