{
  "version": 3,
  "sources": ["../../src/http/http.ts", "../../src/errors.ts", "../../src/http/SseFrameParser.ts", "../../src/http/ServerSentEvents.ts", "../../src/collections/LinkedList.ts", "../../src/http/SimpleWebSocket.ts"],
  "sourcesContent": ["/**\r\n * @module http\r\n * Type-safe HTTP module built on fetch() with automatic JWT handling.\r\n *\r\n * @example\r\n * import { configure, get, post } from './http';\r\n *\r\n * configure({ baseUrl: '/api' });\r\n * const response = await get('/users');\r\n * const users = response.as<User[]>();\r\n */\r\n\r\n/**\r\n * Configuration options for the http module.\r\n */\r\nexport interface HttpOptions {\r\n    /**\r\n     * Root URL to remote endpoint. Used so that each method only has to specify path in requests.\r\n     */\r\n    baseUrl?: string;\r\n\r\n    /**\r\n     * Default content type to use if none is specified in the request method.\r\n     */\r\n    contentType?: string;\r\n\r\n    /**\r\n     * Checks for a JWT token in localStorage to automatically include it in requests.\r\n     *\r\n     * Undefined = use \"jwt\", null = disable.\r\n     */\r\n    bearerTokenName?: string | null;\r\n\r\n    /**\r\n     * Default request timeout in milliseconds.\r\n     * Uses `AbortSignal.timeout()` to automatically abort requests that take too long.\r\n     * Can be overridden per-request by passing a `signal` in `RequestInit`.\r\n     *\r\n     * @example\r\n     * configure({ baseUrl: '/api', timeout: 10000 }); // 10 second timeout\r\n     */\r\n    timeout?: number;\r\n}\r\n\r\n/**\r\n * Response for request methods.\r\n */\r\nexport interface HttpResponse {\r\n    /**\r\n     * Http status code.\r\n     */\r\n    statusCode: number;\r\n\r\n    /**\r\n     * Reason to why the status code was used.\r\n     */\r\n    statusReason: string;\r\n\r\n    /**\r\n     * True if this is a 2xx response.\r\n     */\r\n    success: boolean;\r\n\r\n    /**\r\n     * Content type of response body.\r\n     */\r\n    contentType: string | null;\r\n\r\n    /**\r\n     * Body returned.\r\n     *\r\n     * Body has been read and deserialized from json (if the request content type was 'application/json' which is the default).\r\n     */\r\n    body: unknown;\r\n\r\n    /**\r\n     * Charset used in body.\r\n     */\r\n    charset: string | null;\r\n\r\n    /**\r\n     * Cast body to a type.\r\n     */\r\n    as<T>(): T;\r\n}\r\n\r\n/**\r\n * Error thrown when a request fails.\r\n */\r\nexport class HttpError extends Error {\r\n    message: string;\r\n    response: HttpResponse;\r\n\r\n    constructor(response: HttpResponse) {\r\n        super(response.statusReason);\r\n        this.message = response.statusReason;\r\n        this.response = response;\r\n    }\r\n}\r\n\r\n/**\r\n * HTTP request options.\r\n */\r\nexport interface RequestOptions {\r\n    method?: 'GET' | 'POST' | 'PUT' | 'DELETE';\r\n    mode?: 'cors' | 'no-cors' | '*cors' | 'same-origin';\r\n    cache:\r\n        | 'default'\r\n        | 'no-store'\r\n        | 'reload'\r\n        | 'no-cache'\r\n        | 'force-cache'\r\n        | 'only-if-cached';\r\n    credentials: 'omit' | 'same-origin' | 'include';\r\n    headers: Map<string, string>;\r\n    redirect: 'follow' | 'manual' | '*follow' | 'error';\r\n    referrerPolicy:\r\n        | 'no-referrer'\r\n        | '*no-referrer-when-downgrade'\r\n        | 'origin'\r\n        | 'origin-when-cross-origin'\r\n        | 'same-origin'\r\n        | 'strict-origin'\r\n        | 'strict-origin-when-cross-origin'\r\n        | 'unsafe-url';\r\n\r\n    /**\r\n     * Will be serialized if the content type is json (and the body is an object).\r\n     */\r\n    body: unknown;\r\n}\r\n\r\n/** @internal */\r\ndeclare type FetchFn = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;\r\n\r\nlet config: HttpOptions = {\r\n    bearerTokenName: 'jwt'\r\n};\r\n\r\nlet fetchImpl: FetchFn = fetch;\r\n\r\n/**\r\n * Replace the fetch implementation for testing purposes.\r\n *\r\n * @param fn - Custom fetch function, or undefined to restore the default.\r\n *\r\n * @example\r\n * setFetch(async (url, options) => {\r\n *     return new Response(JSON.stringify({ id: 1 }), { status: 200 });\r\n * });\r\n */\r\nexport function setFetch(fn?: FetchFn): void {\r\n    fetchImpl = fn ?? fetch;\r\n}\r\n\r\n/**\r\n * Configure the http module.\r\n *\r\n * @example\r\n * configure({ baseUrl: '/api/v1', bearerTokenName: 'auth_token' });\r\n */\r\nexport function configure(options: HttpOptions): void {\r\n    config = {\r\n        ...config,\r\n        ...options\r\n    };\r\n    if (options.bearerTokenName === undefined) {\r\n        config.bearerTokenName = 'jwt';\r\n    }\r\n}\r\n\r\n/**\r\n * The fetch implementation currently in use, so that `setFetch()` also controls other modules\r\n * in this package that talk to the network.\r\n *\r\n * @internal\r\n */\r\nexport function currentFetch(): FetchFn {\r\n    return fetchImpl;\r\n}\r\n\r\n/**\r\n * Prefixes a url with the configured base url.\r\n *\r\n * @internal\r\n */\r\nexport function resolveUrl(url: string): string {\r\n    if (!config.baseUrl) {\r\n        return url;\r\n    }\r\n\r\n    if (url[0] !== '/' && config.baseUrl[config.baseUrl.length - 1] !== '/') {\r\n        return `${config.baseUrl}/${url}`;\r\n    }\r\n\r\n    return config.baseUrl + url;\r\n}\r\n\r\n/**\r\n * The JWT token from localStorage, or null when token handling is disabled or no token is stored.\r\n *\r\n * @internal\r\n */\r\nexport function bearerToken(): string | null {\r\n    if (!config.bearerTokenName) {\r\n        return null;\r\n    }\r\n\r\n    return localStorage.getItem(config.bearerTokenName);\r\n}\r\n\r\n/**\r\n * Make an HTTP request.\r\n *\r\n * @param url - URL to make the request against.\r\n * @param options - Request options.\r\n * @returns Response from server.\r\n *\r\n * @example\r\n * const response = await request('/users', { method: 'GET' });\r\n */\r\nexport async function request(url: string, options?: RequestInit): Promise<HttpResponse> {\r\n    const token = bearerToken();\r\n    if (token && options) {\r\n        const headers = options?.headers\r\n            ? new Headers(options.headers)\r\n            : new Headers();\r\n\r\n        if (!headers.get('Authorization')) {\r\n            headers.set('Authorization', 'Bearer ' + token);\r\n        }\r\n\r\n        options.headers = headers;\r\n    }\r\n\r\n    if (config.timeout && !options?.signal) {\r\n        options ??= {};\r\n        options.signal = AbortSignal.timeout(config.timeout);\r\n    }\r\n\r\n    const response = await fetchImpl(resolveUrl(url), options);\r\n\r\n    if (!response.ok) {\r\n        return {\r\n            statusCode: response.status,\r\n            statusReason: response.statusText,\r\n            success: false,\r\n            contentType: response.headers.get('content-type'),\r\n            body: await response.text(),\r\n            charset: response.headers.get('charset'),\r\n\r\n            as() {\r\n                throw new Error('No response received');\r\n            }\r\n        };\r\n    }\r\n\r\n    let body: unknown | null = null;\r\n    if (response.status !== 204) {\r\n        body = await response.json();\r\n    }\r\n\r\n    return {\r\n        success: true,\r\n        statusCode: response.status,\r\n        statusReason: response.statusText,\r\n        contentType: response.headers.get('content-type'),\r\n        body: body,\r\n        charset: response.headers.get('charset'),\r\n        as<T>() {\r\n            return <T>body;\r\n        }\r\n    };\r\n}\r\n\r\n/**\r\n * GET a resource.\r\n *\r\n * @param url - URL to get resource from.\r\n * @param queryString - Optional query string parameters.\r\n * @param options - Request options.\r\n * @returns HTTP response.\r\n *\r\n * @example\r\n * const response = await get('/users', { page: '1', limit: '10' });\r\n * const users = response.as<User[]>();\r\n */\r\nexport async function get(\r\n    url: string,\r\n    queryString?: Record<string, string>,\r\n    options?: RequestInit\r\n): Promise<HttpResponse> {\r\n    if (!options) {\r\n        options = {\r\n            method: 'GET',\r\n            headers: {\r\n                'content-type': config.contentType ?? 'application/json'\r\n            }\r\n        };\r\n    } else {\r\n        options.method = 'GET';\r\n    }\r\n\r\n    if (queryString) {\r\n        let prefix = '&';\r\n        if (url.indexOf('?') === -1) {\r\n            prefix = '?';\r\n        }\r\n\r\n        for (const key in queryString) {\r\n            const value = queryString[key];\r\n            url += `${prefix}${key}=${value}`;\r\n            prefix = '&';\r\n        }\r\n    }\r\n\r\n    return request(url, options);\r\n}\r\n\r\n/**\r\n * POST a resource.\r\n *\r\n * @param url - URL to post to.\r\n * @param data - Data to post.\r\n * @param options - Request options.\r\n * @returns HTTP response.\r\n *\r\n * @example\r\n * const response = await post('/users', JSON.stringify({ name: 'John' }));\r\n */\r\nexport async function post(\r\n    url: string,\r\n    data: BodyInit,\r\n    options?: RequestInit\r\n): Promise<HttpResponse> {\r\n    if (!options) {\r\n        options = {\r\n            method: 'POST',\r\n            body: data,\r\n            headers: {\r\n                'content-type': config.contentType ?? 'application/json'\r\n            }\r\n        };\r\n    } else {\r\n        options.method = 'POST';\r\n        options.body = data;\r\n    }\r\n\r\n    return request(url, options);\r\n}\r\n\r\n/**\r\n * PUT a resource.\r\n *\r\n * @param url - URL to resource.\r\n * @param data - Data to put.\r\n * @param options - Request options.\r\n * @returns HTTP response.\r\n *\r\n * @example\r\n * const response = await put('/users/1', JSON.stringify({ name: 'Jane' }));\r\n */\r\nexport async function put(\r\n    url: string,\r\n    data: BodyInit,\r\n    options?: RequestInit\r\n): Promise<HttpResponse> {\r\n    if (!options) {\r\n        options = {\r\n            method: 'PUT',\r\n            body: data,\r\n            headers: {\r\n                'content-type': config.contentType ?? 'application/json'\r\n            }\r\n        };\r\n    } else {\r\n        options.method = 'PUT';\r\n        options.body = data;\r\n    }\r\n\r\n    return request(url, options);\r\n}\r\n\r\n/**\r\n * DELETE a resource.\r\n *\r\n * @param url - URL to resource.\r\n * @param options - Request options.\r\n * @returns HTTP response.\r\n *\r\n * @example\r\n * const response = await del('/users/1');\r\n */\r\nexport async function del(url: string, options?: RequestInit): Promise<HttpResponse> {\r\n    if (!options) {\r\n        options = {\r\n            method: 'DELETE',\r\n            headers: {\r\n                'content-type': config.contentType ?? 'application/json'\r\n            }\r\n        };\r\n    } else {\r\n        options.method = 'DELETE';\r\n    }\r\n\r\n    return request(url, options);\r\n}\r\n", "/**\r\n * Global error handling for Relaxjs.\r\n * Register a handler with `onError()` to intercept errors before they throw.\r\n * Call `ctx.suppress()` in the handler to prevent the error from being thrown.\r\n *\r\n * @example\r\n * import { onError } from 'relaxjs';\r\n *\r\n * onError((error, ctx) => {\r\n *     logToService(error.message, error.context);\r\n *     showToast(error.message);\r\n *     ctx.suppress();\r\n * });\r\n */\r\n\r\n/**\r\n * Passed to error handlers to control error behavior.\r\n * Call `suppress()` to prevent the error from being thrown.\r\n */\r\nexport interface ErrorContext {\r\n    suppress(): void;\r\n}\r\n\r\n/**\r\n * Error with structured context for debugging.\r\n * The `context` record contains details like route name, component tag, route data.\r\n *\r\n * @example\r\n * onError((error, ctx) => {\r\n *     console.log(error.context.route);\r\n *     console.log(error.context.componentTagName);\r\n * });\r\n */\r\nexport class RelaxError extends Error {\r\n    constructor(\r\n        message: string,\r\n        public context: Record<string, unknown>,\r\n    ) {\r\n        super(message);\r\n    }\r\n}\r\n\r\n/** @internal */\r\ntype ErrorHandler = (error: RelaxError, ctx: ErrorContext) => void;\r\n\r\nlet handler: ErrorHandler | null = null;\r\n\r\n/**\r\n * Registers a global error handler for Relaxjs errors.\r\n * The handler receives the error and an `ErrorContext`.\r\n * Call `ctx.suppress()` to prevent the error from being thrown.\r\n * Only one handler can be active at a time; subsequent calls replace the previous handler.\r\n *\r\n * @example\r\n * onError((error, ctx) => {\r\n *     if (error.context.route === 'optional-panel') {\r\n *         ctx.suppress();\r\n *         return;\r\n *     }\r\n *     showErrorDialog(error.message);\r\n * });\r\n */\r\nexport function onError(fn: ErrorHandler) {\r\n    handler = fn;\r\n}\r\n\r\n/**\r\n * Reports an error through the global handler.\r\n * Returns the `RelaxError` if it should be thrown, or `null` if the handler suppressed it.\r\n * The caller is responsible for throwing the returned error.\r\n *\r\n * @param message - Human-readable error description\r\n * @param context - Structured data for debugging (route, component, params, cause, etc.)\r\n * @returns The error to throw, or `null` if suppressed\r\n *\r\n * @example\r\n * const error = reportError('Failed to load route component', {\r\n *     route: 'user',\r\n *     componentTagName: 'user-profile',\r\n *     routeData: { id: 123 },\r\n * });\r\n * if (error) throw error;\r\n */\r\nexport function reportError(message: string, context: Record<string, unknown>): RelaxError | null {\r\n    const error = new RelaxError(message, context);\r\n    if (handler) {\r\n        let suppressed = false;\r\n        const ctx: ErrorContext = {\r\n            suppress() { suppressed = true; },\r\n        };\r\n        handler(error, ctx);\r\n        if (suppressed) {\r\n            return null;\r\n        }\r\n    }\r\n    return error;\r\n}\r\n\r\n/**\r\n * Wraps an async function into a synchronous callback suitable for addEventListener.\r\n * Catches promise rejections and reports them through the global error handler.\r\n *\r\n * @param fn - Async function to wrap\r\n * @returns Synchronous function that can be passed to addEventListener\r\n *\r\n * @example\r\n * button.addEventListener('click', asyncHandler(async (e) => {\r\n *     await saveData();\r\n * }));\r\n *\r\n * @example\r\n * form.addEventListener('submit', asyncHandler(async (e) => {\r\n *     e.preventDefault();\r\n *     await submitForm();\r\n * }));\r\n */\r\nexport function asyncHandler<TArgs extends unknown[]>(\r\n    fn: (...args: TArgs) => Promise<void>,\r\n): (...args: TArgs) => void {\r\n    return function (this: any, ...args: TArgs) {\r\n        fn.call(this, ...args).catch((cause: unknown) => {\r\n            const error = reportError('Async callback failed', { cause });\r\n            if (error) throw error;\r\n        });\r\n    };\r\n}\r\n", "/**\n * @module SseFrameParser\n * Turns the raw text of a `text/event-stream` response into complete SSE frames.\n *\n * A streamed response arrives in arbitrary chunks. A single frame is regularly split across two\n * chunks, and two frames regularly arrive in one chunk. The parser buffers whatever is incomplete\n * so the caller only ever sees whole frames.\n *\n * Internal to the http module. Not part of the public API.\n *\n * @example\n * const parser = new SseFrameParser();\n * parser.push('event: token\\ndata: {\"te');  // []\n * parser.push('xt\":\"hi\"}\\n\\n');             // [{ event: 'token', data: '{\"text\":\"hi\"}' }]\n */\n\n/**\n * One complete event received from the server.\n */\nexport interface SseFrame {\n    /**\n     * Name from the `event:` field, or `message` when the server did not send one.\n     */\n    event: string;\n\n    /**\n     * Payload from the `data:` field. Several `data:` lines are joined with a newline.\n     */\n    data: string;\n\n    /**\n     * Value of the `id:` field, when the server sent one for this frame.\n     */\n    id?: string;\n\n    /**\n     * Reconnection delay in milliseconds from the `retry:` field.\n     */\n    retry?: number;\n}\n\n/**\n * Parses `text/event-stream` text into frames.\n *\n * A frame that is still incomplete when the stream ends is discarded, as the event stream\n * specification requires. Half a JSON payload is worse than no payload.\n */\nexport class SseFrameParser {\n    private buffer = '';\n    private eventName = '';\n    private data: string[] = [];\n    private id?: string;\n    private retry?: number;\n\n    /**\n     * Feed the next piece of the response body in.\n     *\n     * @param chunk - Decoded text, of any length and split at any position.\n     * @returns Every frame that became complete with this chunk, in arrival order.\n     */\n    push(chunk: string): SseFrame[] {\n        this.buffer += chunk;\n\n        const frames: SseFrame[] = [];\n        let position = 0;\n        let lineBreak = this.findLineBreak(position);\n\n        while (lineBreak) {\n            const line = this.buffer.slice(position, lineBreak.start);\n            position = lineBreak.end;\n\n            if (line.length === 0) {\n                const frame = this.takeFrame();\n                if (frame) {\n                    frames.push(frame);\n                }\n            } else {\n                this.readField(line);\n            }\n\n            lineBreak = this.findLineBreak(position);\n        }\n\n        this.buffer = this.buffer.slice(position);\n        return frames;\n    }\n\n    /**\n     * Locates the next line terminator, which may be LF, CRLF or a lone CR.\n     *\n     * A CR at the very end of the buffer is left unresolved: the next chunk decides whether it was\n     * a lone CR or the first half of a CRLF.\n     */\n    private findLineBreak(from: number): { start: number; end: number } | null {\n        for (let i = from; i < this.buffer.length; i++) {\n            const character = this.buffer[i];\n\n            if (character === '\\n') {\n                return { start: i, end: i + 1 };\n            }\n\n            if (character === '\\r') {\n                if (i + 1 >= this.buffer.length) {\n                    return null;\n                }\n                return this.buffer[i + 1] === '\\n'\n                    ? { start: i, end: i + 2 }\n                    : { start: i, end: i + 1 };\n            }\n        }\n\n        return null;\n    }\n\n    private readField(line: string): void {\n        if (line[0] === ':') {\n            return;\n        }\n\n        const colon = line.indexOf(':');\n        const name = colon === -1 ? line : line.slice(0, colon);\n        let value = colon === -1 ? '' : line.slice(colon + 1);\n\n        if (value[0] === ' ') {\n            value = value.slice(1);\n        }\n\n        switch (name) {\n            case 'event':\n                this.eventName = value;\n                break;\n            case 'data':\n                this.data.push(value);\n                break;\n            case 'id':\n                this.id = value;\n                break;\n            case 'retry':\n                if (/^\\d+$/.test(value)) {\n                    this.retry = Number(value);\n                }\n                break;\n        }\n    }\n\n    private takeFrame(): SseFrame | null {\n        if (this.data.length === 0) {\n            this.reset();\n            return null;\n        }\n\n        const frame: SseFrame = {\n            event: this.eventName.length > 0 ? this.eventName : 'message',\n            data: this.data.join('\\n')\n        };\n\n        if (this.id !== undefined) {\n            frame.id = this.id;\n        }\n        if (this.retry !== undefined) {\n            frame.retry = this.retry;\n        }\n\n        this.reset();\n        return frame;\n    }\n\n    private reset(): void {\n        this.eventName = '';\n        this.data = [];\n        this.id = undefined;\n        this.retry = undefined;\n    }\n}\n", "/**\n * @module ServerSentEvents\n * SSE client that dispatches received events as DOM events.\n *\n * By default it uses the browser's built-in EventSource, which reconnects on its own.\n * Set a request option like `method`, `body`, `headers` or `signal`, or `autoReconnect: false`,\n * and it switches to a fetch based transport that can send data to the server and can tell you\n * why the stream ended.\n *\n * @example\n * const sse = new SSEClient('/api/events', {\n *     eventTypes: ['user-updated', 'order-created']\n * });\n * sse.connect();\n *\n * document.addEventListener('user-updated', (e: SSEDataEvent) => {\n *     console.log('User updated:', e.data);\n * });\n */\n\nimport { reportError } from '../errors';\nimport { HttpError, HttpResponse, bearerToken, currentFetch, resolveUrl } from './http';\nimport { SseFrameParser } from './SseFrameParser';\n\n/**\n * Event dispatched when an SSE message is received.\n * The event name matches the SSE event type.\n */\nexport class SSEDataEvent extends Event {\n    constructor(\n        eventName: string,\n        public data: unknown,\n        eventInit?: EventInit\n    ) {\n        super(eventName, { bubbles: true, ...eventInit });\n    }\n}\n\n/**\n * Factory function for creating custom event instances.\n *\n * @example\n * const factory: SSEEventFactory = (eventName, data) => {\n *     switch (eventName) {\n *         case 'user-updated':\n *             return new UserUpdatedEvent(data as User);\n *         default:\n *             return new SSEDataEvent(eventName, data);\n *     }\n * };\n */\nexport type SSEEventFactory = (eventName: string, data: unknown) => Event;\n\n/**\n * Why a stream stopped.\n *\n * `completed` = the server sent one of your `terminalEvents` and then closed.\n * `truncated` = the server closed cleanly but never sent a terminal event, so the result is\n * incomplete and you may want to offer a retry.\n * `aborted` = you stopped it yourself, through `disconnect()` or an `AbortSignal`.\n * `failed` = the request never started or died. `error` and `response` say why.\n */\nexport type SSECloseReason = 'completed' | 'truncated' | 'aborted' | 'failed';\n\n/**\n * Details about a stream that has stopped.\n */\nexport interface SSECloseResult {\n    /**\n     * Why the stream stopped.\n     */\n    reason: SSECloseReason;\n\n    /**\n     * Name of the last event received before the stream stopped.\n     */\n    lastEventName?: string;\n\n    /**\n     * Set when the reason is `failed`.\n     */\n    error?: Error;\n\n    /**\n     * Set when the server answered with a non 2xx status. `body` holds the raw response text.\n     */\n    response?: HttpResponse;\n}\n\n/**\n * Passed to `onError` when the fetch transport fails.\n *\n * It extends Event so that the `onError` signature is the same for both transports.\n */\nexport class SSEErrorEvent extends Event {\n    constructor(\n        public error: Error,\n        public response?: HttpResponse\n    ) {\n        super('error');\n    }\n}\n\n/**\n * Configuration options for SSEClient.\n */\nexport interface SSEOptions {\n    /**\n     * Target element or CSS selector for event dispatching.\n     * Defaults to document.\n     */\n    target?: string | Element;\n\n    /**\n     * Whether to send credentials with the request (default: false).\n     */\n    withCredentials?: boolean;\n\n    /**\n     * Specific SSE event types to listen for.\n     * If not specified, listens to the default 'message' event.\n     *\n     * @example\n     * eventTypes: ['user-updated', 'order-created']\n     */\n    eventTypes?: string[];\n\n    /**\n     * Factory function for creating custom event instances.\n     * If not provided, SSEDataEvent is used.\n     *\n     * @example\n     * eventFactory: (name, data) => new MyCustomEvent(name, data)\n     */\n    eventFactory?: SSEEventFactory;\n\n    /**\n     * HTTP method for the request (default: 'GET').\n     * Setting it selects the fetch transport.\n     */\n    method?: 'GET' | 'POST' | 'PUT' | 'DELETE';\n\n    /**\n     * Data to send to the server.\n     * Setting it selects the fetch transport, since EventSource cannot send a body.\n     *\n     * @example\n     * body: JSON.stringify({ matchId: 42 })\n     */\n    body?: BodyInit;\n\n    /**\n     * Extra request headers.\n     * Setting them selects the fetch transport, since EventSource cannot send headers.\n     */\n    headers?: Record<string, string>;\n\n    /**\n     * Signal used to cancel the stream. Closes with reason `aborted`.\n     * Setting it selects the fetch transport.\n     */\n    signal?: AbortSignal;\n\n    /**\n     * Whether the browser should reconnect when the stream drops (default: true).\n     *\n     * Set to false to select the fetch transport, which never reconnects. A request that sends\n     * data is not always safe to repeat, so reconnection is not available there.\n     */\n    autoReconnect?: boolean;\n\n    /**\n     * Names of the events the server sends last. Receiving one of them means the result is\n     * complete, so the stream closes with reason `completed` instead of `truncated`.\n     *\n     * @example\n     * terminalEvents: ['verdict']\n     */\n    terminalEvents?: string[];\n\n    /**\n     * Callback when the stream stops, for any reason. Called once per `connect()`.\n     *\n     * On the EventSource transport it is only called for `disconnect()`, because EventSource\n     * cannot tell a finished server from a broken one.\n     */\n    onClose?: (client: SSEClient, result: SSECloseResult) => void;\n\n    /**\n     * Callback when connection is established.\n     */\n    onConnect?: (client: SSEClient) => void;\n\n    /**\n     * Callback when an error occurs.\n     * On the EventSource transport the browser reconnects afterwards.\n     * On the fetch transport the argument is an SSEErrorEvent and there is no reconnect.\n     */\n    onError?: (client: SSEClient, error: Event) => void;\n}\n\n/**\n * Server-Sent Events client that dispatches received events as DOM events.\n *\n * @example\n * const sse = new SSEClient('/api/events', {\n *     target: '#notifications',\n *     eventTypes: ['notification', 'alert']\n * });\n *\n * sse.connect();\n *\n * document.querySelector('#notifications')\n *     .addEventListener('notification', (e: SSEDataEvent) => {\n *         showNotification(e.data);\n *     });\n *\n * sse.disconnect();\n *\n * @example\n * const sse = new SSEClient('/api/verdict', {\n *     method: 'POST',\n *     body: JSON.stringify({ matchId: 42 }),\n *     eventTypes: ['token', 'verdict'],\n *     terminalEvents: ['verdict'],\n *     onClose: (client, result) => {\n *         if (result.reason === 'truncated') {\n *             showRetryButton();\n *         }\n *     }\n * });\n *\n * sse.connect();\n */\nexport class SSEClient {\n    private eventSource?: EventSource;\n    private abortController?: AbortController;\n    private streaming = false;\n    private target: Element | Document;\n\n    /**\n     * Whether the client is currently connected.\n     */\n    get connected(): boolean {\n        if (this.eventSource) {\n            return this.eventSource.readyState === EventSource.OPEN;\n        }\n\n        return this.streaming;\n    }\n\n    constructor(\n        private url: string,\n        private options?: SSEOptions\n    ) {\n        this.target = this.resolveTarget(options?.target);\n    }\n\n    /**\n     * Establish connection to the SSE endpoint.\n     *\n     * Can be called again after the stream has closed, which is how you retry a truncated result.\n     */\n    connect(): void {\n        if (this.eventSource || this.abortController) {\n            return;\n        }\n\n        if (!this.usesFetchTransport()) {\n            this.connectViaEventSource();\n            return;\n        }\n\n        if (this.options?.autoReconnect === true) {\n            const error = reportError(\n                'SSEClient: autoReconnect is not available when you set method, body, headers or signal, because a request that sends data is not always safe to repeat.',\n                { url: this.url }\n            );\n            if (error) {\n                throw error;\n            }\n        }\n\n        this.connectViaFetch();\n    }\n\n    /**\n     * Close the connection. Closes with reason `aborted`.\n     */\n    disconnect(): void {\n        if (this.abortController) {\n            this.abortController.abort();\n            return;\n        }\n\n        if (this.eventSource) {\n            this.eventSource.close();\n            this.eventSource = undefined;\n            this.options?.onClose?.(this, { reason: 'aborted' });\n        }\n    }\n\n    private usesFetchTransport(): boolean {\n        const options = this.options;\n        if (!options) {\n            return false;\n        }\n\n        return (\n            options.method !== undefined ||\n            options.body !== undefined ||\n            options.headers !== undefined ||\n            options.signal !== undefined ||\n            options.autoReconnect === false\n        );\n    }\n\n    private connectViaEventSource(): void {\n        const eventSource = new EventSource(this.url, {\n            withCredentials: this.options?.withCredentials ?? false\n        });\n\n        this.eventSource = eventSource;\n\n        eventSource.onopen = () => {\n            this.options?.onConnect?.(this);\n        };\n\n        eventSource.onerror = (error) => {\n            this.options?.onError?.(this, error);\n        };\n\n        if (this.options?.eventTypes && this.options.eventTypes.length > 0) {\n            for (const eventType of this.options.eventTypes) {\n                eventSource.addEventListener(eventType, (e: MessageEvent) => {\n                    this.dispatchEvent(eventType, e.data);\n                });\n            }\n        } else {\n            eventSource.onmessage = (e: MessageEvent) => {\n                this.dispatchEvent('message', e.data);\n            };\n        }\n    }\n\n    private connectViaFetch(): void {\n        const controller = new AbortController();\n        this.abortController = controller;\n\n        this.streamResponse(controller).catch((error) => {\n            this.streaming = false;\n            this.abortController = undefined;\n            reportError('SSEClient: unhandled failure while reading the event stream.', {\n                url: this.url,\n                error\n            });\n        });\n    }\n\n    private async streamResponse(controller: AbortController): Promise<void> {\n        const options = this.options ?? {};\n        this.bridgeSignal(options.signal, controller);\n\n        let response: Response;\n        try {\n            response = await currentFetch()(resolveUrl(this.url), {\n                method: options.method ?? 'GET',\n                body: options.body,\n                headers: this.buildHeaders(options.headers),\n                signal: controller.signal,\n                credentials: options.withCredentials ? 'include' : 'same-origin'\n            });\n        } catch (error) {\n            this.reportFailure(error, controller);\n            return;\n        }\n\n        if (!response.ok) {\n            const httpResponse = await this.readErrorResponse(response);\n            const error = new HttpError(httpResponse);\n            options.onError?.(this, new SSEErrorEvent(error, httpResponse));\n            this.finish({ reason: 'failed', error, response: httpResponse });\n            return;\n        }\n\n        this.streaming = true;\n        options.onConnect?.(this);\n\n        let lastEventName: string | undefined;\n        let sawTerminalEvent = false;\n\n        try {\n            const parser = new SseFrameParser();\n            const decoder = new TextDecoder();\n            const reader = response.body?.getReader();\n\n            while (reader) {\n                const { done, value } = await reader.read();\n                if (done) {\n                    break;\n                }\n\n                for (const frame of parser.push(decoder.decode(value, { stream: true }))) {\n                    lastEventName = frame.event;\n\n                    if (options.terminalEvents?.includes(frame.event)) {\n                        sawTerminalEvent = true;\n                    }\n\n                    if (this.acceptsEvent(frame.event)) {\n                        this.dispatchEvent(frame.event, frame.data);\n                    }\n                }\n            }\n        } catch (error) {\n            this.reportFailure(error, controller, lastEventName);\n            return;\n        }\n\n        if (controller.signal.aborted) {\n            this.finish({ reason: 'aborted', lastEventName });\n            return;\n        }\n\n        const expectsTerminalEvent = (options.terminalEvents?.length ?? 0) > 0;\n        this.finish({\n            reason: expectsTerminalEvent && !sawTerminalEvent ? 'truncated' : 'completed',\n            lastEventName\n        });\n    }\n\n    private bridgeSignal(signal: AbortSignal | undefined, controller: AbortController): void {\n        if (!signal) {\n            return;\n        }\n\n        if (signal.aborted) {\n            controller.abort();\n            return;\n        }\n\n        signal.addEventListener('abort', () => controller.abort(), { once: true });\n    }\n\n    private buildHeaders(custom?: Record<string, string>): Headers {\n        const headers = new Headers({ Accept: 'text/event-stream' });\n\n        for (const name in custom) {\n            headers.set(name, custom[name]);\n        }\n\n        const token = bearerToken();\n        if (token && !headers.get('Authorization')) {\n            headers.set('Authorization', 'Bearer ' + token);\n        }\n\n        return headers;\n    }\n\n    private async readErrorResponse(response: Response): Promise<HttpResponse> {\n        return {\n            statusCode: response.status,\n            statusReason: response.statusText,\n            success: false,\n            contentType: response.headers.get('content-type'),\n            body: await response.text(),\n            charset: response.headers.get('charset'),\n\n            as() {\n                throw new Error('No response received');\n            }\n        };\n    }\n\n    private reportFailure(\n        error: unknown,\n        controller: AbortController,\n        lastEventName?: string\n    ): void {\n        if (controller.signal.aborted) {\n            this.finish({ reason: 'aborted', lastEventName });\n            return;\n        }\n\n        const failure = error instanceof Error ? error : new Error(String(error));\n        this.options?.onError?.(this, new SSEErrorEvent(failure));\n        this.finish({ reason: 'failed', error: failure, lastEventName });\n    }\n\n    private finish(result: SSECloseResult): void {\n        this.streaming = false;\n        this.abortController = undefined;\n        this.options?.onClose?.(this, result);\n    }\n\n    private acceptsEvent(eventName: string): boolean {\n        const eventTypes = this.options?.eventTypes;\n        if (eventTypes && eventTypes.length > 0) {\n            return eventTypes.includes(eventName);\n        }\n\n        return eventName === 'message';\n    }\n\n    private resolveTarget(target?: string | Element): Element | Document {\n        if (!target) {\n            return document;\n        }\n        if (typeof target === 'string') {\n            const element = document.querySelector(target);\n            if (!element) {\n                throw new Error(`SSEClient: Target element not found: ${target}`);\n            }\n            return element;\n        }\n        return target;\n    }\n\n    private dispatchEvent(eventName: string, rawData: string): void {\n        let data: unknown;\n\n        if (rawData.length > 0 && (rawData[0] === '{' || rawData[0] === '[' || rawData[0] === '\"')) {\n            try {\n                data = JSON.parse(rawData);\n            } catch {\n                data = rawData;\n            }\n        } else {\n            data = rawData;\n        }\n\n        const event = this.options?.eventFactory\n            ? this.options.eventFactory(eventName, data)\n            : new SSEDataEvent(eventName, data);\n\n        this.target.dispatchEvent(event);\n    }\n}\n", "/**\r\n * A node in the @see LinkedList.\r\n */\r\nexport class Node<T> {\r\n    /**\r\n     * Next node unless last one.\r\n     */\r\n    public next: Node<T> | null = null;\r\n    /**\r\n     * Previous node unless first one.\r\n     */\r\n    public prev: Node<T> | null = null;\r\n\r\n    /**\r\n     * Constructor.\r\n     * @param value Value contained in the node.\r\n     */\r\n    constructor(public value: T, private removeCallback: () => void) {}\r\n\r\n    /**\r\n     * Remove this node.\r\n     * Will notify the list of the update to ensure correct element count.\r\n     */\r\n    remove() {\r\n        if (this.prev) this.prev.next = this.next;\r\n        if (this.next) this.next.prev = this.prev;\r\n        this.removeCallback();\r\n    }\r\n}\r\n\r\n/**\r\n * A trivial linked list implementation.\r\n */\r\nexport class LinkedList<T> {\r\n    private _first: Node<T> | null = null;\r\n    private _last: Node<T> | null = null;\r\n    private _length = 0;\r\n\r\n    /**\r\n     * Add a value to the beginning of the list.\r\n     * @param value Value that should be contained in the node.\r\n     */\r\n    addFirst(value: T) {\r\n        const newNode = this.createNode(value);\r\n        if (!this._first) {\r\n            this._first = newNode;\r\n            this._last = this._first;\r\n        } else {\r\n            newNode.next = this._first;\r\n            this._first.prev = newNode;\r\n            this._first = newNode;\r\n        }\r\n\r\n        this._length++;\r\n    }\r\n\r\n    /**\r\n     * Add a value to the end of the list.\r\n     * @param value Value that should be contained in a node.\r\n     */\r\n    addLast(value: T) {\r\n        const newNode = this.createNode(value);\r\n        if (!this._last) {\r\n            this._first = newNode;\r\n            this._last = newNode;\r\n        } else {\r\n            newNode.prev = this._last;\r\n            this._last.next = newNode;\r\n            this._last = newNode;\r\n        }\r\n\r\n        this._length++;\r\n    }\r\n\r\n    private createNode(value: T): Node<T> {\r\n        let node: Node<T>;\r\n        node = new Node(value, () => {\r\n            if (this._first === node) this._first = node.next;\r\n            if (this._last === node) this._last = node.prev;\r\n            this._length--;\r\n        });\r\n        return node;\r\n    }\r\n\r\n    /**\r\n     * Remove a node from the beginning of the list.\r\n     * @returns Value contained in the first node.\r\n     */\r\n    removeFirst(): T {\r\n        if (!this._first) {\r\n            throw new Error('The list is empty.');\r\n        }\r\n\r\n        const value = this._first.value;\r\n        this._first = this._first.next;\r\n        if (!this._first) this._last = null;\r\n        this._length--;\r\n        return value;\r\n    }\r\n\r\n    /**\r\n     * Remove a node from the end of the list.\r\n     * @returns Value contained in the last node.\r\n     */\r\n    removeLast(): T {\r\n        if (!this._last) {\r\n            throw new Error('The list is empty.');\r\n        }\r\n\r\n        const value = this._last.value;\r\n        this._last = this._last.prev;\r\n        if (!this._last) this._first = null;\r\n        this._length--;\r\n        return value;\r\n    }\r\n\r\n    /**\r\n     * Number of nodes in the list.\r\n     *\r\n     * The count works as long as you do not manually remove nodes (by assigning next/prev to the neighbors).\r\n     */\r\n    get length(): number {\r\n        return this._length;\r\n    }\r\n\r\n    /**\r\n     * First node, or `null` if the list is empty.\r\n     */\r\n    get first(): Node<T> | null {\r\n        return this._first;\r\n    }\r\n\r\n    /**\r\n     * Contained value of the first node, or `undefined` if the list is empty.\r\n     */\r\n    get firstValue(): T | undefined {\r\n        return this._first?.value;\r\n    }\r\n\r\n    /**\r\n     * Last node, or `null` if the list is empty.\r\n     */\r\n    get last(): Node<T> | null {\r\n        return this._last;\r\n    }\r\n\r\n    /**\r\n     * Contained value of the last node, or `undefined` if the list is empty.\r\n     */\r\n    get lastValue(): T | undefined {\r\n        return this._last?.value;\r\n    }\r\n}\r\n", "/**\r\n * @module SimpleWebSocket\r\n * WebSocket client with automatic reconnection and message queuing.\r\n * Provides a reliable messaging layer over WebSocket connections.\r\n *\r\n * @example\r\n * // Create and connect\r\n * const ws = new WebSocketClient<ChatMessage>('wss://chat.example.com');\r\n * ws.connect();\r\n *\r\n * // Send and receive\r\n * await ws.send({ text: 'Hello' });\r\n * const msg = await ws.receive();\r\n */\r\n\r\nimport { LinkedList } from '../collections/LinkedList';\r\n\r\n/**\r\n * Simplified message event for WebSocket data.\r\n */\r\nexport interface SimpleDataEvent {\r\n    data: string | ArrayBufferLike | Blob | ArrayBufferView;\r\n}\r\n\r\n/**\r\n * Abstraction interface for WebSocket to enable unit testing.\r\n * Implement this for custom WebSocket instances or mocks.\r\n */\r\nexport interface WebSocketAbstraction {\r\n    onopen: ((event: Event) => void) | null;\r\n    onerror: ((event: ErrorEvent) => void) | null;\r\n    onclose: ((event: CloseEvent) => void) | null;\r\n    onmessage: ((event: SimpleDataEvent) => void) | null;\r\n    send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;\r\n    close(): void;\r\n}\r\n\r\n/**\r\n * Factory function type for creating WebSocket instances.\r\n */\r\nexport type WebSocketFactory = () => WebSocketAbstraction;\r\n\r\n/**\r\n * Managed WebSocket client with automatic reconnection and message queuing.\r\n *\r\n * Features:\r\n * - Automatic reconnection on disconnect\r\n * - Message queuing when disconnected\r\n * - Type-safe message handling with optional codecs\r\n * - Promise-based receive API\r\n *\r\n * @template TMessage - The type of messages sent and received\r\n *\r\n * @example\r\n * // Basic usage\r\n * interface ChatMessage { user: string; text: string; }\r\n *\r\n * const client = new WebSocketClient<ChatMessage>('wss://chat.example.com');\r\n * client.connect();\r\n *\r\n * // Send messages\r\n * await client.send({ user: 'John', text: 'Hello!' });\r\n *\r\n * // Receive messages\r\n * while (true) {\r\n *     const message = await client.receive();\r\n *     console.log(`${message.user}: ${message.text}`);\r\n * }\r\n *\r\n * @example\r\n * // With options\r\n * const client = new WebSocketClient<Message>('wss://api.example.com', {\r\n *     autoReconnect: true,\r\n *     onConnect: (socket) => console.log('Connected'),\r\n *     onClose: () => console.log('Disconnected')\r\n * });\r\n */\r\nexport class WebSocketClient<TMessage> {\r\n    private ws?: WebSocketAbstraction;\r\n    private receiveQueue = new LinkedList<TMessage>();\r\n    private receivePromiseWrapper?: PromiseWrapper<TMessage>;\r\n    private sendQueue = new LinkedList<TMessage>();\r\n    private _isConnected = false;\r\n    private isSendingQueue = false;\r\n    private url?: string;\r\n    private wsFactory?: WebSocketFactory;\r\n    private reconnectAttempts = 0;\r\n    private shouldReconnect = true;\r\n\r\n    get connected(): boolean {\r\n        return this._isConnected;\r\n    }\r\n\r\n    constructor(\r\n        urlOrWebSocketFactory: string | WebSocketFactory,\r\n        private options?: WebSocketOptions<TMessage>\r\n    ) {\r\n        if (typeof urlOrWebSocketFactory === 'string') {\r\n            this.url = urlOrWebSocketFactory;\r\n        } else {\r\n            this.wsFactory = urlOrWebSocketFactory;\r\n        }\r\n    }\r\n\r\n    connect() {\r\n        this.shouldReconnect = true;\r\n        this.reconnectAttempts = 0;\r\n        this.reConnect();\r\n    }\r\n\r\n    disconnect() {\r\n        this.shouldReconnect = false;\r\n        this.ws?.close();\r\n    }\r\n\r\n    send(data: TMessage): void {\r\n        if (!this._isConnected || this.isSendingQueue) {\r\n            this.sendQueue.addLast(data);\r\n            return;\r\n        }\r\n\r\n        if (this.sendQueue.length > 0) {\r\n            this.sendQueueItems();\r\n        }\r\n\r\n        this.sendInternal(data);\r\n    }\r\n\r\n    /**\r\n     * Receive a new message.\r\n     *\r\n     * @throws Error if called while another receive() is pending.\r\n     * @throws Error if connection closes while waiting.\r\n     */\r\n    receive(): Promise<TMessage> {\r\n        if (this.receivePromiseWrapper) {\r\n            throw new Error('You can only invoke receive() once at a time.');\r\n        }\r\n\r\n        if (this.receiveQueue.firstValue) {\r\n            return Promise.resolve(this.receiveQueue.removeFirst());\r\n        }\r\n\r\n        const wrapper = new PromiseWrapper<TMessage>();\r\n        this.receivePromiseWrapper = wrapper;\r\n        return new Promise((resolve, reject) => {\r\n            wrapper.resolve = resolve;\r\n            wrapper.reject = reject;\r\n        });\r\n    }\r\n\r\n    private onMessage(ev: SimpleDataEvent) {\r\n        let msg: TMessage;\r\n        if (this.options?.codec) {\r\n            msg = this.options.codec.decode(ev.data);\r\n        } else if (typeof ev.data === 'string') {\r\n            if (\r\n                ev.data.length > 0 &&\r\n                (ev.data[0] === '\"' || ev.data[0] === '[' || ev.data[0] === '{')\r\n            ) {\r\n                msg = JSON.parse(ev.data);\r\n            } else {\r\n                msg = ev.data as TMessage;\r\n            }\r\n        } else {\r\n            msg = ev.data as TMessage;\r\n        }\r\n\r\n        if (this.receivePromiseWrapper) {\r\n            this.receivePromiseWrapper.resolve(msg);\r\n            this.receivePromiseWrapper = undefined;\r\n            return;\r\n        }\r\n\r\n        this.receiveQueue.addLast(msg);\r\n    }\r\n\r\n    private reConnect() {\r\n        const ws: WebSocketAbstraction = this.url\r\n            ? (new WebSocket(this.url) as unknown as WebSocketAbstraction)\r\n            : this.wsFactory!();\r\n        this.ws = ws;\r\n        ws.onmessage = (evt: SimpleDataEvent) => this.onMessage(evt);\r\n        ws.onerror = () => ws.close();\r\n        ws.onopen = () => {\r\n            this._isConnected = true;\r\n            this.reconnectAttempts = 0;\r\n            this.options?.onConnect?.(this);\r\n            this.sendQueueItems();\r\n        };\r\n        ws.onclose = () => {\r\n            this._isConnected = false;\r\n\r\n            if (this.receivePromiseWrapper) {\r\n                this.receivePromiseWrapper.reject(new Error('WebSocket connection closed'));\r\n                this.receivePromiseWrapper = undefined;\r\n            }\r\n\r\n            this.options?.onClose?.(this);\r\n\r\n            if (this.shouldReconnect && this.options?.autoReconnect !== false) {\r\n                const baseDelay = this.options?.reconnectDelay ?? 1000;\r\n                const maxDelay = this.options?.maxReconnectDelay ?? 30000;\r\n                const delay = Math.min(baseDelay * Math.pow(2, this.reconnectAttempts), maxDelay);\r\n                this.reconnectAttempts++;\r\n                setTimeout(() => this.reConnect(), delay);\r\n            }\r\n        };\r\n    }\r\n\r\n    private sendInternal(data: TMessage) {\r\n        let dataToSend: string | ArrayBufferLike | Blob | ArrayBufferView;\r\n        if (typeof data !== 'string') {\r\n            if (this.options?.codec) {\r\n                dataToSend = this.options.codec.encode(data);\r\n            } else {\r\n                dataToSend = JSON.stringify(data);\r\n            }\r\n        } else {\r\n            dataToSend = data;\r\n        }\r\n\r\n        this.ws!.send(dataToSend);\r\n    }\r\n\r\n    private sendQueueItems(): void {\r\n        if (this.isSendingQueue) {\r\n            return;\r\n        }\r\n\r\n        this.isSendingQueue = true;\r\n        while (this.sendQueue.length > 0) {\r\n            const item = this.sendQueue.removeFirst();\r\n            if (item == null) {\r\n                break;\r\n            }\r\n\r\n            this.sendInternal(item);\r\n        }\r\n\r\n        this.isSendingQueue = false;\r\n    }\r\n}\r\n\r\n/**\r\n * CODEC used for messages.\r\n */\r\nexport interface WebSocketCodec<TMessage> {\r\n    /**\r\n     *\r\n     * @param data\r\n     */\r\n    encode(data: TMessage): string | ArrayBufferLike | Blob | ArrayBufferView;\r\n\r\n    /**\r\n     *\r\n     * @param data\r\n     */\r\n    decode(data: string | ArrayBufferLike | Blob | ArrayBufferView): TMessage;\r\n}\r\n\r\n/**\r\n * Configuration options for @see WebSocketClient.\r\n */\r\nexport interface WebSocketOptions<TMessage> {\r\n    /**\r\n     * CODEC to use for inbound and outbound messages (if something else that JSON should be used).\r\n     */\r\n    codec?: WebSocketCodec<TMessage>;\r\n\r\n    /**\r\n     * Automatically reconnect when getting disconnected (default: true).\r\n     */\r\n    autoReconnect?: boolean;\r\n\r\n    /**\r\n     * Initial delay in milliseconds before reconnecting (default: 1000).\r\n     * Uses exponential backoff on subsequent attempts.\r\n     */\r\n    reconnectDelay?: number;\r\n\r\n    /**\r\n     * Maximum delay in milliseconds between reconnect attempts (default: 30000).\r\n     */\r\n    maxReconnectDelay?: number;\r\n\r\n    /**\r\n     * Callback when the WS is connected.\r\n     *\r\n     * Can be used for authentication messages etc.\r\n     *\r\n     * @param socket Socket\r\n     */\r\n    onConnect?: (socket: WebSocketClient<TMessage>) => void;\r\n\r\n    /**\r\n     * Invoked when the connection is closed.\r\n     *\r\n     * The connection will be automatically reconnected if configured (on by default).\r\n     *\r\n     * @param socket Socket.\r\n     */\r\n    onClose?: (socket: WebSocketClient<TMessage>) => void;\r\n}\r\n\r\nclass PromiseWrapper<TMessage> {\r\n    resolve!: (value: TMessage | PromiseLike<TMessage>) => void;\r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AAwB,QAGjC,KAAK,SAAS,UAAU,IAAI,EAExB,KAAK,iBAAmB,KAAK,SAAS,gBAAkB,GAAO,CAC/D,IAAME,EAAY,KAAK,SAAS,gBAAkB,IAC5CC,EAAW,KAAK,SAAS,mBAAqB,IAC9CC,EAAQ,KAAK,IAAIF,EAAY,KAAK,IAAI,EAAG,KAAK,iBAAiB,EAAGC,CAAQ,EAChF,KAAK,oBACL,WAAW,IAAM,KAAK,UAAU,EAAGC,CAAK,CAC5C,CACJ,CACJ,CAEQ,aAAaX,EAAgB,CACjC,IAAIY,EACA,OAAOZ,GAAS,SACZ,KAAK,SAAS,MACdY,EAAa,KAAK,QAAQ,MAAM,OAAOZ,CAAI,EAE3CY,EAAa,KAAK,UAAUZ,CAAI,EAGpCY,EAAaZ,EAGjB,KAAK,GAAI,KAAKY,CAAU,CAC5B,CAEQ,gBAAuB,CAC3B,GAAI,MAAK,eAKT,KADA,KAAK,eAAiB,GACf,KAAK,UAAU,OAAS,GAAG,CAC9B,IAAMC,EAAO,KAAK,UAAU,YAAY,EACxC,GAAIA,GAAQ,KACR,MAGJ,KAAK,aAAaA,CAAI,CAC1B,CAEA,KAAK,eAAiB,GAC1B,CACJ,EA+DMX,EAAN,KAA+B,CAG/B",
  "names": ["HttpError", "response", "config", "fetchImpl", "setFetch", "fn", "configure", "options", "currentFetch", "resolveUrl", "url", "bearerToken", "request", "token", "headers", "body", "get", "queryString", "prefix", "key", "value", "post", "data", "put", "del", "RelaxError", "message", "context", "handler", "reportError", "message", "context", "error", "RelaxError", "handler", "suppressed", "SseFrameParser", "chunk", "frames", "position", "lineBreak", "line", "frame", "from", "i", "character", "colon", "name", "value", "SSEDataEvent", "eventName", "data", "eventInit", "SSEErrorEvent", "error", "response", "SSEClient", "url", "options", "reportError", "eventSource", "eventType", "e", "controller", "currentFetch", "resolveUrl", "httpResponse", "HttpError", "lastEventName", "sawTerminalEvent", "parser", "SseFrameParser", "decoder", "reader", "done", "value", "frame", "expectsTerminalEvent", "signal", "custom", "headers", "name", "token", "bearerToken", "failure", "result", "eventTypes", "target", "element", "rawData", "event", "Node", "value", "removeCallback", "LinkedList", "newNode", "node", "WebSocketClient", "urlOrWebSocketFactory", "options", "LinkedList", "data", "wrapper", "PromiseWrapper", "resolve", "reject", "ev", "msg", "ws", "evt", "baseDelay", "maxDelay", "delay", "dataToSend", "item"]
}
