{"version":3,"file":"_internal.cjs","names":[],"sources":["../src/shared/internal/codec.ts","../src/shared/internal/helpers.ts","../src/shared/internal/validations.ts","../src/sync/channel/state.ts","../src/sync/protocol.ts"],"sourcesContent":["/**\n * Text encoding/decoding utilities using cached TextEncoder/TextDecoder.\n *\n * @internal\n * @module\n */\n\nimport { Lazy } from 'happy-rusty';\n\n/**\n * Lazily initialized `TextEncoder` instance.\n * Created on first access via `force()`.\n */\nconst encoder = /*#__PURE__*/ Lazy(() => new TextEncoder());\n\n/**\n * Lazily initialized `TextDecoder` instance.\n * Created on first access via `force()`.\n */\nconst decoder = /*#__PURE__*/ Lazy(() => new TextDecoder());\n\n/**\n * Encodes a string to a UTF-8 `Uint8Array`.\n *\n * @param data - The string to encode.\n * @returns A `Uint8Array` containing the encoded data.\n */\nexport function encodeUtf8(data: string): Uint8Array<ArrayBuffer> {\n    return encoder.force().encode(data);\n}\n\n/**\n * Decodes binary data to a UTF-8 string.\n *\n * @param data - The binary data to decode.\n * @returns The decoded string.\n */\nexport function decodeUtf8(data: AllowSharedBufferSource): string {\n    return decoder.force().decode(data);\n}","/**\n * Shared helper utilities for both async and sync APIs.\n *\n * @internal\n * @module\n */\n\nimport type { WriteSyncFileContent } from '../defines.ts';\nimport { encodeUtf8 } from './codec.ts';\n\n/**\n * Asynchronously reads a Blob's content as a Uint8Array.\n * Uses native `bytes()` method if available, otherwise falls back to `arrayBuffer()`.\n *\n * @param blob - The Blob to read.\n * @returns A promise that resolves to a Uint8Array containing the blob's binary data.\n */\nexport async function readBlobBytes(blob: Blob): Promise<Uint8Array<ArrayBuffer>> {\n    return typeof blob.bytes === 'function'\n        ? blob.bytes()\n        : new Uint8Array(await blob.arrayBuffer());\n}\n\n/**\n * Synchronously reads a Blob's content as a Uint8Array.\n * Uses FileReaderSync for synchronous binary data reading.\n *\n * **Note:** This function can only be used in Worker threads,\n * as `FileReaderSync` is not available in the main thread.\n *\n * @param blob - The Blob to read.\n * @returns A Uint8Array containing the blob's binary data.\n */\nexport function readBlobBytesSync(blob: Blob): Uint8Array<ArrayBuffer> {\n    const reader = new FileReaderSync();\n    return new Uint8Array(reader.readAsArrayBuffer(blob));\n}\n\n/**\n * Converts a `WriteSyncFileContent` to a `Uint8Array` without copying the buffer.\n * Handles `Uint8Array`, `ArrayBuffer`, other `ArrayBufferView` (e.g. TypedArray),\n * and `string` (via UTF-8 encoding). `Blob` is intentionally NOT handled here —\n * callers that accept `Blob` (e.g. the async `writeFile`) must convert it via\n * `readBlobBytesSync` before calling this helper.\n *\n * @param contents - The content to convert. Must not be a `Blob` or `ReadableStream`.\n * @returns A `Uint8Array` view over the given content.\n */\nexport function toBytesView(contents: WriteSyncFileContent): Uint8Array<ArrayBuffer> {\n    if (contents instanceof Uint8Array) {\n        return contents as Uint8Array<ArrayBuffer>;\n    }\n    if (contents instanceof ArrayBuffer) {\n        return new Uint8Array(contents);\n    }\n    if (ArrayBuffer.isView(contents)) {\n        // Other TypedArray -> Uint8Array (handle potential byteOffset)\n        return new Uint8Array(contents.buffer, contents.byteOffset, contents.byteLength);\n    }\n    // String -> Uint8Array via TextEncoder\n    return encodeUtf8(contents);\n}\n","/**\n * Internal shared validation functions for async and sync operations.\n * These functions return Result types instead of throwing exceptions.\n *\n * @internal\n * @module\n */\n\nimport { normalize } from '@std/path/posix';\nimport { Err, Ok, RESULT_VOID, type IOResult, type VoidIOResult } from 'happy-rusty';\nimport { ROOT_DIR, type ExistsOptions, type WriteFileContent, type WriteSyncFileContent } from '../mod.ts';\n\n/**\n * Validates that the provided path is an absolute path and normalizes it.\n * Returns a Result instead of throwing.\n *\n * @param path - The file path to validate.\n * @returns An `IOResult` containing the normalized absolute path, or an error.\n */\nexport function validateAbsolutePath(path: string): IOResult<string> {\n    if (typeof path !== 'string') {\n        return Err(new TypeError(`Path must be a string but received ${ typeof path }`));\n    }\n\n    if (path[0] !== ROOT_DIR) {\n        return Err(new Error(`Path must be absolute (start with '/'): '${ path }'`));\n    }\n\n    // Normalize and remove trailing slash except for root\n    const normalized = normalize(path);\n    const result = normalized.length > 1 && normalized[normalized.length - 1] === ROOT_DIR\n        ? normalized.slice(0, -1)\n        : normalized;\n\n    return Ok(result);\n}\n\n/**\n * Validates that the provided URL is valid and returns a URL object.\n * Supports relative URLs by using current location as base.\n * Returns a Result instead of throwing.\n *\n * @param url - The URL string or URL object to validate.\n * @returns An `IOResult` containing the URL object, or an error.\n */\nexport function validateUrl(url: string | URL): IOResult<URL> {\n    if (url instanceof URL) {\n        return Ok(url);\n    }\n\n    try {\n        return Ok(new URL(url, location.href));\n    } catch {\n        return Err(new TypeError(`Invalid URL: '${ url }'`));\n    }\n}\n\n/**\n * Validates that the provided ExistsOptions are valid.\n * `isDirectory` and `isFile` cannot both be `true`.\n *\n * @param options - The ExistsOptions to validate.\n * @returns A `VoidIOResult` indicating success, or an error if options are invalid.\n */\nexport function validateExistsOptions(options?: ExistsOptions): VoidIOResult {\n    const { isDirectory = false, isFile = false } = options ?? {};\n\n    return isDirectory && isFile\n        ? Err(new Error('isDirectory and isFile cannot both be true'))\n        : RESULT_VOID;\n}\n\n/**\n * Validates that the provided value is a valid Date for pruneTemp expiration.\n * Returns a Result instead of throwing.\n *\n * @param expired - The Date to validate.\n * @returns A `VoidIOResult` indicating success, or an error if not a valid Date instance, eg: `new Date('invalid')`.\n */\nexport function validateExpiredDate(expired: Date): VoidIOResult {\n    if (!(expired instanceof Date)) {\n        return Err(new TypeError(`Expired must be a Date but received ${ typeof expired }`));\n    }\n\n    return Number.isNaN(expired.getTime())\n        ? Err(new TypeError('Expired must be a valid Date'))\n        : RESULT_VOID;\n}\n\n/**\n * Validates that the provided content is a valid type for writeFile (async).\n * Supports: string, Blob, ArrayBuffer, TypedArray, ReadableStream<Uint8Array>.\n *\n * @param contents - The content to validate.\n * @returns A `VoidIOResult` indicating success, or an error if type is invalid.\n */\nexport function validateWriteFileContent(contents: WriteFileContent): VoidIOResult {\n    // Check for ReadableStream first (async only)\n    if (isBinaryReadableStream(contents)) {\n        return RESULT_VOID;\n    }\n\n    // Check for Blob (async only)\n    if (contents instanceof Blob) {\n        return RESULT_VOID;\n    }\n\n    // Check for sync-compatible types (string, ArrayBuffer, TypedArray)\n    if (isWriteSyncFileContent(contents)) {\n        return RESULT_VOID;\n    }\n\n    return Err(new TypeError('Invalid content type for writeFile. Expected string, Blob, ArrayBuffer, TypedArray, or ReadableStream'));\n}\n\n/**\n * Validates that the provided content is a valid type for writeFileSync (sync).\n * Supports: string, ArrayBuffer, TypedArray.\n * Note: Blob and ReadableStream are NOT supported in sync operations.\n *\n * @param contents - The content to validate.\n * @returns A `VoidIOResult` indicating success, or an error if type is invalid.\n */\nexport function validateWriteSyncFileContent(contents: WriteSyncFileContent): VoidIOResult {\n    if (!isWriteSyncFileContent(contents)) {\n        return Err(new TypeError('Invalid content type for writeFileSync. Expected string, ArrayBuffer, or TypedArray'));\n    }\n\n    return RESULT_VOID;\n}\n\n// #region Internal functions\n\n/**\n * Type guard for detecting binary ReadableStream input for file writing.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a ReadableStream.\n */\nfunction isBinaryReadableStream(x: unknown): x is ReadableStream<Uint8Array<ArrayBuffer>> {\n    return typeof ReadableStream !== 'undefined' && x instanceof ReadableStream;\n}\n\n/**\n * Type guard for detecting valid sync file content types.\n * Supports: string, ArrayBuffer, ArrayBufferView (TypedArray/DataView).\n *\n * @param contents - The value to check.\n * @returns `true` if the value is a valid sync file content type.\n */\nfunction isWriteSyncFileContent(contents: unknown): contents is WriteSyncFileContent {\n    return typeof contents === 'string' ||\n        contents instanceof ArrayBuffer ||\n        ArrayBuffer.isView(contents);\n}\n\n// #endregion\n","/**\n * Internal shared state for sync channel.\n * This module is not exported publicly.\n *\n * @internal\n */\n\nimport type { SyncMessenger } from '../protocol.ts';\n\n/**\n * State for sync channel.\n * - 'idle': Not initialized, can call connectSyncChannel or attachSyncChannel\n * - 'connecting': Connection in progress (only during connectSyncChannel)\n * - 'ready': Ready to use, messenger is available\n */\nexport type SyncChannelState = 'idle' | 'connecting' | 'ready';\n\n/**\n * Current state of the sync channel.\n */\nlet syncChannelState: SyncChannelState = 'idle';\n\n/**\n * Messenger instance for sync communication.\n * Only available when syncChannelState is 'ready'.\n */\nlet messenger: SyncMessenger | null = null;\n\n/**\n * Global timeout for synchronous I/O operations in milliseconds.\n */\nlet globalSyncOpTimeout = 1000;\n\n/**\n * Gets the current sync channel state.\n */\nexport function getSyncChannelState(): SyncChannelState {\n    return syncChannelState;\n}\n\n/**\n * Sets the sync channel state.\n */\nexport function setSyncChannelState(state: SyncChannelState): void {\n    syncChannelState = state;\n}\n\n/**\n * Gets the messenger instance.\n */\nexport function getMessenger(): SyncMessenger | null {\n    return messenger;\n}\n\n/**\n * Sets the messenger instance and marks the channel as ready.\n */\nexport function setMessenger(m: SyncMessenger): void {\n    messenger = m;\n    syncChannelState = 'ready';\n}\n\n/**\n * Gets the global sync operation timeout.\n */\nexport function getGlobalSyncOpTimeout(): number {\n    return globalSyncOpTimeout;\n}\n\n/**\n * Sets the global sync operation timeout.\n */\nexport function setGlobalSyncOpTimeout(timeout: number): void {\n    globalSyncOpTimeout = timeout;\n}\n","/**\n * Binary protocol for synchronous communication between main thread and worker.\n * Uses SharedArrayBuffer with lock-based synchronization via Atomics.\n *\n * @internal\n * @module\n */\n\nimport { decodeUtf8, encodeUtf8 } from '../shared/internal/mod.ts';\n\n// #region Internal Variables\n\n/**\n * Payload type markers for binary protocol.\n */\nconst PayloadType = {\n    /**\n     * Pure JSON payload, no binary data.\n     * Format: [type: 1B][json bytes]\n     */\n    JSON: 0,\n    /**\n     * JSON payload with separate binary data field.\n     * Binary data is stored separately to avoid JSON serialization overhead.\n     * Format: [type: 1B][json length: 4B][json bytes][binary bytes]\n     */\n    BINARY_JSON: 1,\n} as const;\n\n// #endregion\n\n/**\n * Operations that can be called from main thread to worker thread.\n * Each value corresponds to a specific file system operation.\n */\nexport const WorkerOp = {\n    // core (0-99)\n    createFile: 0,\n    mkdir: 1,\n    move: 2,\n    readDir: 3,\n    readFile: 4,\n    remove: 5,\n    stat: 6,\n    truncate: 7,\n    writeFile: 8,\n    // ext (100+)\n    copy: 100,\n    emptyDir: 101,\n    exists: 102,\n    deleteTemp: 103,\n    mkTemp: 104,\n    pruneTemp: 105,\n    readBlobFile: 106,\n    unzip: 107,\n    zip: 108,\n} as const;\n\n/**\n * Worker operation type.\n */\nexport type WorkerOp = typeof WorkerOp[keyof typeof WorkerOp];\n\n/**\n * Main thread lock index in the Int32Array view of SharedArrayBuffer.\n * Used to synchronize main thread state.\n */\nexport const MAIN_LOCK_INDEX = 0;\n\n/**\n * Worker thread lock index in the Int32Array view of SharedArrayBuffer.\n * Used to synchronize worker thread state.\n */\nexport const WORKER_LOCK_INDEX = 1;\n\n/**\n * Data length index in the Int32Array view of SharedArrayBuffer.\n * Stores the byte length of the current payload.\n */\nexport const DATA_INDEX = 2;\n\n/**\n * Main thread locked value (waiting for response).\n */\nexport const MAIN_LOCKED = 1;\n\n/**\n * Main thread unlocked value (response ready or idle).\n * This is the default/initial state.\n */\nexport const MAIN_UNLOCKED = 0;\n\n/**\n * Worker thread unlocked value (request ready to process).\n * Intentionally equals MAIN_LOCKED to simplify state machine.\n */\nexport const WORKER_UNLOCKED = MAIN_LOCKED;\n\n/**\n * Encodes data to a binary buffer for cross-thread communication.\n * Uses JSON serialization with optional binary data separation.\n *\n * If the last element of the array is a Uint8Array, it is stored separately\n * to avoid JSON serialization overhead (which would convert to number[]).\n *\n * All requests/responses use array format: `[op, ...args]` or `[error, result]`.\n *\n * @param value - The array data to encode.\n * @returns A `Uint8Array` containing the encoded payload.\n */\nexport function encodePayload(value: unknown[]): Uint8Array<ArrayBuffer> {\n    const lastItem = value[value.length - 1];\n\n    // If the last element is a Uint8Array, store it separately\n    if (lastItem instanceof Uint8Array) {\n        // BINARY_JSON format: [type: 1B][json length: 4B][json bytes][binary bytes]\n        const jsonValue = value.slice(0, -1);\n        const json = encodeUtf8(JSON.stringify(jsonValue));\n        const result = new Uint8Array(1 + 4 + json.byteLength + lastItem.byteLength);\n        result[0] = PayloadType.BINARY_JSON;\n        new DataView(result.buffer).setUint32(1, json.byteLength);\n        result.set(json, 5);\n        result.set(lastItem, 5 + json.byteLength);\n        return result;\n    }\n\n    // JSON format: [type: 1B][json bytes]\n    const json = encodeUtf8(JSON.stringify(value));\n    const result = new Uint8Array(1 + json.byteLength);\n    result[0] = PayloadType.JSON;\n    result.set(json, 1);\n    return result;\n}\n\n/**\n * Decodes binary payload back to its original structure.\n * Reverses the `encodePayload` operation.\n *\n * For BINARY_JSON payloads, the binary data is restored as the last element.\n *\n * All requests/responses use array format: `[op, ...args]` or `[error, result]`.\n *\n * @template T - The expected type of the decoded data (must be an array type).\n * @param payload - The binary payload from SharedArrayBuffer to decode.\n * @returns The decoded array with Uint8Array<ArrayBuffer> restored as the last element if applicable.\n */\nexport function decodePayload<T extends unknown[]>(payload: Uint8Array<SharedArrayBuffer>): T {\n    const type = payload[0];\n\n    if (type === PayloadType.BINARY_JSON) {\n        // BINARY_JSON format: [type: 1B][json length: 4B][json bytes][binary bytes]\n        const jsonLen = new DataView(payload.buffer, payload.byteOffset + 1, 4).getUint32(0);\n        // Use slice() for both json and data:\n        // 1. TextDecoder cannot accept SharedArrayBuffer views (browser security restriction)\n        // 2. Returned data needs its own ArrayBuffer (caller may access .buffer property)\n        const json = payload.slice(5, 5 + jsonLen);\n        const data = payload.slice(5 + jsonLen);\n        const parsed: unknown[] = JSON.parse(decodeUtf8(json));\n\n        // Restore binary data as the last element\n        parsed.push(data);\n\n        return parsed as T;\n    }\n\n    // JSON format: [type: 1B][json bytes]\n    // Use slice() because TextDecoder cannot accept SharedArrayBuffer views\n    return JSON.parse(decodeUtf8(payload.slice(1)));\n}\n\n/**\n * Messenger for synchronous communication between main thread and worker thread.\n * Inspired by [memfs](https://github.com/streamich/memfs/blob/master/src/fsa-to-node/worker/SyncMessenger.ts).\n *\n * Uses a `SharedArrayBuffer` with lock-based synchronization via `Atomics`.\n *\n * Buffer Layout (all values are Int32 at 4-byte boundaries):\n * ```\n * Offset  Size    Field           Description\n * ------  ----    -----           -----------\n * 0       4       MAIN_LOCK       Main thread state (0=unlocked/ready, 1=locked/waiting)\n * 4       4       WORKER_LOCK     Worker thread state (0=locked/idle, 1=unlocked/processing)\n * 8       4       DATA_LENGTH     Length of payload data in bytes\n * 12      4       RESERVED        Reserved for future use\n * 16+     var     PAYLOAD         Actual request/response binary data\n * ```\n *\n * Communication Flow:\n * 1. Main thread writes request to PAYLOAD, sets DATA_LENGTH\n * 2. Main thread sets MAIN_LOCK=1 (locked), WORKER_LOCK=1 (unlocked)\n * 3. Worker sees WORKER_LOCK=1, reads request, processes it\n * 4. Worker writes response to PAYLOAD, sets DATA_LENGTH\n * 5. Worker sets WORKER_LOCK=0 (locked), MAIN_LOCK=0 (unlocked)\n * 6. Main thread sees MAIN_LOCK=0, reads response\n *\n * @example\n * ```typescript\n * // Create messenger with 1MB buffer\n * const sab = new SharedArrayBuffer(1024 * 1024);\n * const messenger = new SyncMessenger(sab);\n * ```\n */\nexport class SyncMessenger {\n    /**\n     * Header size in bytes: 4 Int32 values = 16 bytes.\n     * Payload data starts after this offset.\n     */\n    private static readonly HEADER_LENGTH = 4 * 4;\n\n    /**\n     * Int32 view for atomic lock operations.\n     * Layout: [MAIN_LOCK, WORKER_LOCK, DATA_LENGTH, RESERVED]\n     */\n    readonly i32a: Int32Array;\n\n    /**\n     * Maximum payload size in bytes.\n     * Calculated as: total buffer size - header length.\n     * Requests/responses exceeding this limit will fail.\n     */\n    readonly maxDataLength: number;\n\n    /**\n     * Uint8 view for reading/writing binary payload.\n     * Payload starts after the header.\n     */\n    private readonly u8a: Uint8Array<SharedArrayBuffer>;\n\n    /**\n     * Creates a new SyncMessenger instance.\n     *\n     * @param sab - The SharedArrayBuffer to use for cross-thread communication.\n     *              Must be created in the main thread and transferred to the worker.\n     */\n    constructor(sab: SharedArrayBuffer) {\n        this.i32a = new Int32Array(sab);\n        this.u8a = new Uint8Array(sab);\n        this.maxDataLength = sab.byteLength - SyncMessenger.HEADER_LENGTH;\n    }\n\n    /**\n     * Writes payload data to the buffer after the header.\n     *\n     * @param data - The payload data to write.\n     */\n    setPayload(data: Uint8Array): void {\n        this.u8a.set(data, SyncMessenger.HEADER_LENGTH);\n    }\n\n    /**\n     * Reads payload data from the buffer as a view.\n     *\n     * Note: Returns a subarray (view) of the SharedArrayBuffer.\n     * Caller must use slice() if they need to pass data to TextDecoder\n     * or return data to user code that may access .buffer property.\n     *\n     * @param length - The number of bytes to read.\n     * @returns A view into the SharedArrayBuffer payload region.\n     */\n    getPayload(length: number): Uint8Array<SharedArrayBuffer> {\n        return this.u8a.subarray(SyncMessenger.HEADER_LENGTH, SyncMessenger.HEADER_LENGTH + length);\n    }\n}"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,UAAwB,eAAA,GAAA,YAAA,KAAA,OAAW,IAAI,YAAY,CAAC;;;;;AAM1D,MAAM,UAAwB,eAAA,GAAA,YAAA,KAAA,OAAW,IAAI,YAAY,CAAC;;;;;;;AAQ1D,SAAgB,WAAW,MAAuC;CAC9D,OAAO,QAAQ,MAAM,CAAC,CAAC,OAAO,IAAI;AACtC;;;;;;;AAQA,SAAgB,WAAW,MAAuC;CAC9D,OAAO,QAAQ,MAAM,CAAC,CAAC,OAAO,IAAI;AACtC;;;;;;;;;;ACtBA,eAAsB,cAAc,MAA8C;CAC9E,OAAO,OAAO,KAAK,UAAU,aACvB,KAAK,MAAM,IACX,IAAI,WAAW,MAAM,KAAK,YAAY,CAAC;AACjD;;;;;;;;;;;AAYA,SAAgB,kBAAkB,MAAqC;CACnE,MAAM,SAAS,IAAI,eAAe;CAClC,OAAO,IAAI,WAAW,OAAO,kBAAkB,IAAI,CAAC;AACxD;;;;;;;;;;;AAYA,SAAgB,YAAY,UAAyD;CACjF,IAAI,oBAAoB,YACpB,OAAO;CAEX,IAAI,oBAAoB,aACpB,OAAO,IAAI,WAAW,QAAQ;CAElC,IAAI,YA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