import { SystemLogLine } from './system-log-line'; import { IMotionMasterMessage, MotionMasterMessage, Ipv4 } from './types'; /** * Parses a single line of a system log into a structured `SystemLogLine` object. * * The function expects the log line to follow the format: * ``` * YYYY-MM-DD HH:MM:SS.sss (uptime) [id]file:linelevel|message * ``` * where the `id` part is optional. * * @param line - A single system log line as a string. * @returns A `SystemLogLine` object with parsed fields, or `undefined` if the line cannot be parsed. * * @example * const line = '2025-12-05 10:01:23.123 (12:34:56) [device1]main.ts:123INFO|Started'; * const parsed = parseSystemLogLine(line); * console.log(parsed?.date); // → Date object for '2025-12-05 10:01:23.123' * console.log(parsed?.uptime); // → '12:34:56' * console.log(parsed?.id); // → 'device1' * console.log(parsed?.message); // → 'Started' * * @remarks * - Uses a regular expression with the `s` (dotAll) flag; this may not be supported in all browsers. * - If parsing fails, the function returns `undefined`. * - The returned object includes the original line for reference. */ export declare function parseSystemLogLine(line: string): SystemLogLine | undefined; /** * Parses a system log string into an array of structured `SystemLogLine` objects. * * Each log entry is expected to start with a timestamp in the format `YYYY-MM-DD HH:MM:SS.sss`. * The function uses a regular expression to split the content into individual log entries, * then parses each entry into a `SystemLogLine` using `parseSystemLogLine`. * * @param content - The full system log content as a string. * @returns An array of `SystemLogLine` objects representing each parsed log entry. * * @example * const logContent = '2025-12-05 10:01:23.123 Info: started\n2025-12-05 10:01:24.456 Error: failed'; * const lines = parseSystemLogContent(logContent); * console.log(lines[0].timestamp); // → Date object for '2025-12-05 10:01:23.123' * * @remarks * - Entries that cannot be parsed by `parseSystemLogLine` are ignored. * - The regular expression uses the `s` (dotAll) flag, which may not be supported in all browsers; * a `@ts-ignore` is used to suppress TypeScript warnings. */ export declare function parseSystemLogContent(content: string): SystemLogLine[]; /** * Computes the difference between two system log contents by returning only the new lines * added after the last known line from the old content. * * @param oldContent - The previous log content. * @param newContent - The current log content. * @param lineSeparator - Optional string used to split lines (default: `'\n'`). * @param lastLineIndex - Optional index of the line in `oldContent` to use as the reference point * (default: `-2`, i.e., the second-to-last line). * @returns A string containing only the new lines from `newContent` that come after the reference * line from `oldContent`. If the reference line is not found, returns the entire `newContent`. * * @example * const oldLog = 'line1\nline2\nline3'; * const newLog = 'line1\nline2\nline3\nline4\nline5'; * const diff = diffSystemLogContents(oldLog, newLog); * console.log(diff); // → 'line4\nline5' * * @remarks * - Useful for incremental log processing where only newly appended lines need to be handled. * - Handles negative indexing for selecting the reference line from the end of `oldContent`. */ export declare function diffSystemLogContents(oldContent: string, newContent: string, lineSeparator?: string, lastLineIndex?: number): string; /** * Converts a `MotionMasterMessage` instance into a plain JavaScript object with full defaults * and JSON-compatible values. * * The conversion uses `MotionMasterMessage.toObject` with options that: * - Convert bytes fields to standard arrays. * - Include default values for missing fields. * - Initialize empty arrays for repeated fields and empty objects for map fields. * - Include virtual `oneof` properties indicating which field is set. * - Apply JSON-compatible conversions (e.g., NaN and Infinity to strings). * * @param motionMasterMessage - The `MotionMasterMessage` instance to convert. * @returns A plain object representation of the message with all fields populated and JSON-safe. * * @example * const plainObject = createPlainObjectFromMotionMasterMessage(message); * console.log(plainObject.status); // → fully populated status object * * @remarks * - Useful for logging, serialization, or transferring messages over standard JSON APIs. * - Ensures that all optional, repeated, and map fields are represented in the resulting object. */ export declare function createPlainObjectFromMotionMasterMessage(motionMasterMessage: MotionMasterMessage): IMotionMasterMessage; /** * Converts a `IMotionMasterMessage` into a structured context object suitable for logging. * * The resulting object includes: * - `namespace`: a string identifying the logging context (default: `'reqResMessage'`), * - `motionMasterMessage`: the original message, * - `type`: either `'request'` or `'status'` depending on the message content, * - `name`: a comma-separated string of the keys in the request or status object. * * @param motionMasterMessage - The Motion Master message to convert. * @param namespace - Optional namespace for the logging context (default is `'reqResMessage'`). * @returns An object containing the logging context with type, name, namespace, and original message. * * @example * const context = convertMotionMasterMessageToLoggerContext(message, 'motion'); * console.log(context.namespace); // → 'motion' * console.log(context.type); // → 'request' or 'status' * console.log(context.name); // → comma-separated keys of the message content * * @remarks * - Determines type by checking the presence of `request` or `status` in the message. * - Useful for structured logging or telemetry where message metadata is required. */ export declare function convertMotionMasterMessageToLoggerContext(motionMasterMessage: IMotionMasterMessage, namespace?: string): { namespace: string; motionMasterMessage: IMotionMasterMessage; type: string; name: string; }; /** * Decodes a `Uint8Array` of bytes into a string using UTF-8 encoding. * * @param content - The byte array to decode. * @returns The decoded string representation of the input bytes. * * @example * const bytes = new Uint8Array([72, 101, 108, 108, 111]); * const text = decodeTextContent(bytes); // → "Hello" * * @remarks * - Uses the standard `TextDecoder` API with UTF-8 encoding. * - Creates a copy of the input array before decoding, so the original `Uint8Array` is not modified. */ export declare function decodeTextContent(content: Uint8Array): string; /** * Returns a promise that resolves with the specified value after a given delay. * * @typeParam T - The type of the value to resolve. * @param ms - The delay in milliseconds before the promise resolves. * @param value - Optional value to resolve the promise with (defaults to `undefined` if not provided). * @returns A `Promise` that resolves to `value` after `ms` milliseconds. * * @example * await resolveAfter(1000, 'hello'); // resolves with 'hello' after 1 second * await resolveAfter(500); // resolves with undefined after 0.5 seconds * * @remarks * - Useful for simulating delays or asynchronous timing in tests or animations. * - The function does not reject; it always resolves after the specified timeout. */ export declare function resolveAfter(ms: number, value?: T): Promise; /** * Converts a standard 24-bit RGB color value into a format suitable for certain LED controllers. * * The conversion swaps the red and green channels, producing a new 24-bit integer where: * - Original green becomes the most significant byte, * - Original red becomes the middle byte, * - Original blue remains the least significant byte. * * @param value - A 24-bit RGB color represented as a number (0xRRGGBB). * @returns The converted 24-bit LED color value with swapped red and green channels. * * @example * const rgb = 0x112233; * const ledColor = convertRgbToLedColor(rgb); // → 0x221133 * * @remarks * - Useful when interfacing with LED hardware that expects a different channel ordering. * - Input and output are standard JavaScript numbers representing 24-bit colors. */ export declare function convertRgbToLedColor(value: number): number; /** * Generates a random hexadecimal color string with a specified minimum brightness. * * @param brightness - Minimum value for each RGB channel (0–255). Higher values produce lighter colors. * @returns A random color string in `#RRGGBB` format. * * @example * createRandomColor(100); // → '#c48f7a' (example output) * createRandomColor(200); // → '#e5f0ff' (example output) * * @remarks * - Each color channel (red, green, blue) is independently randomized between `brightness` and 255. * - Ensures that no channel is darker than the specified brightness. * - Useful for generating visually distinct colors while avoiding very dark shades. */ export declare function createRandomColor(brightness: number): string; /** * Finds the first key in a `Map` that corresponds to the specified value. * * @typeParam K - The type of keys in the map. * @typeParam V - The type of values in the map. * @param map - The map to search. * @param searchValue - The value to find the corresponding key for. * @returns The first key whose value strictly equals (`===`) the searchValue, or `undefined` if no match is found. * * @example * const myMap = new Map([['a', 1], ['b', 2], ['c', 1]]); * getMapKeyByValue(myMap, 1); // → 'a' * getMapKeyByValue(myMap, 3); // → undefined * * @remarks * - Only the first matching key is returned; subsequent keys with the same value are ignored. * - Comparison uses strict equality (`===`). */ export declare function getMapKeyByValue(map: Map, searchValue: V): K | undefined; /** * Identifies duplicate elements in an array and returns them as a new array. * * @typeParam T - The type of elements in the array. * @param arr - The array to check for duplicate values. * @returns An array containing all elements that appear more than once in the input array. * Each duplicate element appears only once in the returned array, regardless of how many times it occurs. * * @example * findDuplicates([1, 2, 3, 2, 4, 3, 5]); // → [2, 3] * findDuplicates(['a', 'b', 'a', 'c']); // → ['a'] * * @remarks * - Uses `Set` internally for efficient duplicate detection. * - Preserves the insertion order of first detected duplicates. */ export declare function findDuplicates(arr: T[]): T[]; /** * Converts a camelCase or PascalCase string into a space-separated, lowercase string. * * @param str - The input string in camelCase or PascalCase format. * @returns A new string where each uppercase letter is preceded by a space and all letters are lowercase. * * @example * camelCaseToWords('camelCaseString'); // → 'camel case string' * camelCaseToWords('PascalCase'); // → 'pascal case' * * @remarks * - Useful for converting identifiers into human-readable words. * - Leading spaces are preserved if the string starts with an uppercase letter. */ export declare function camelCaseToWords(str: string): string; /** * Clears (sets to 0) the bit at the specified position in a number. * * @param value - The original number whose bit is to be cleared. * @param position - Zero-based bit position to clear (0 = least-significant bit). * @returns A new number with the bit at the specified position cleared to 0. * * @example * setBitLow(0b1011, 1); // → 0b1001 (clears bit 1) * setBitLow(0b1111, 3); // → 0b0111 (clears bit 3) * * @remarks * - Only the bit at the given position is affected; all other bits remain unchanged. * - Works with any 32-bit integer representable in JavaScript. */ export declare function setBitLow(value: number, position: number): number; /** * Sets (changes to 1) the bit at the specified position in a number. * * @param value - The original number whose bit is to be set. * @param position - Zero-based bit position to set (0 = least-significant bit). * @returns A new number with the bit at the specified position set to 1. * * @example * setBitHigh(0b1001, 1); // → 0b1011 (sets bit 1) * setBitHigh(0b0111, 3); // → 0b1111 (sets bit 3) * * @remarks * - Only the bit at the given position is affected; all other bits remain unchanged. * - Works with any 32-bit integer representable in JavaScript. */ export declare function setBitHigh(value: number, position: number): number; /** * Retrieves the value of the bit at the specified position in a number. * * @param n - The number from which to retrieve the bit. * @param k - Zero-based bit position to retrieve (0 = least-significant bit). * @returns `1` if the bit at position `k` is set, otherwise `0`. * * @example * getBit(0b1010, 1); // → 1 (bit 1 is set) * getBit(0b1010, 0); // → 0 (bit 0 is clear) * * @remarks * - Works with any 32-bit integer representable in JavaScript. * - Does not modify the original number. */ export declare function getBit(n: number, k: number): number; /** * Checks whether the bit at the specified position in a number is set (1). * * @param n - The number to check. * @param k - Zero-based bit position to check (0 = least-significant bit). * @returns `true` if the bit at position `k` is 1, otherwise `false`. * * @example * isBitOn(0b1010, 1); // → true (bit 1 is set) * isBitOn(0b1010, 0); // → false (bit 0 is clear) * * @remarks * - Works with any 32-bit integer representable in JavaScript. * - Does not modify the original number. */ export declare function isBitOn(n: number, k: number): boolean; /** * Sets (changes to 1) the bit at the specified position in a number. * * The original number is not mutated; a new number is returned with the bit set. * * @param n - The original number whose bit is to be set. * @param k - Zero-based bit position to set (0 = least-significant bit). * @returns A new number equal to `n` with bit `k` set. * * @example * setBit(0b1001, 1); // → 0b1011 (sets bit 1) * setBit(0b0111, 3); // → 0b1111 (sets bit 3) * * @remarks * - Only the bit at position `k` is affected; all other bits remain unchanged. * - Works with any 32-bit integer representable in JavaScript. */ export declare function setBit(n: number, k: number): number; /** * Clears (sets to 0) the bit at the specified position in a number. * * The original number is not mutated; a new number is returned with the bit cleared. * * @param n - The original number whose bit is to be cleared. * @param k - Zero-based bit position to clear (0 = least-significant bit). * @returns A new number equal to `n` with bit `k` cleared. * * @example * clearBit(0b1011, 1); // → 0b1001 (clears bit 1) * clearBit(0b1111, 3); // → 0b0111 (clears bit 3) * * @remarks * - Only the bit at position `k` is affected; all other bits remain unchanged. * - Works with any 32-bit integer representable in JavaScript. */ export declare function clearBit(n: number, k: number): number; /** * Updates the bit at position `k` in the given number `n` to the specified value. * * The original number is not mutated; instead, a new number is returned with the bit updated. * * @param n - The original number whose bit is being modified. * @param k - Zero-based bit position to update (0 = least-significant bit). * @param value - Boolean or numeric value indicating whether the bit should be set (`true` / `1`) * or cleared (`false` / `0`). * @returns A new number equal to `n` with bit `k` updated. * * @example * updateBit(0b1010, 1, true); // → 0b1011 (set bit 1) * updateBit(0b1011, 3, false); // → 0b0011 (clear bit 3) * * @remarks * - Values other than `0` or `false` result in bit being set to `1`. * - Works with any 32-bit integer representable in JavaScript. */ export declare function updateBit(n: number, k: number, value: number | boolean): number; /** * Converts a number (or string) to a fixed-point format with specified precision. * * @param x - The number or string to be formatted. * @param n - The number of digits after the decimal point (default is 6). * @param rightTrimZero - Flag to indicate if trailing zeros after the decimal point should be removed (default is true). * @returns The formatted number as a string. */ export declare function toFixedFormat(x: number | string, n?: number, rightTrimZero?: boolean): string; /** * Converts a `Blob` object into a Base64-encoded string. * * @param blob - The `Blob` to convert. * @returns A `Promise` that resolves to the Base64 string representation of the blob. * * @example * const blob = new Blob(['Hello, world!'], { type: 'text/plain' }); * const base64 = await convertBlobToBase64(blob); * console.log(base64); // → 'SGVsbG8sIHdvcmxkIQ==' * * @remarks * - Internally uses `FileReader.readAsDataURL` to serialize the blob. * - The returned Base64 string excludes the data URL prefix (e.g., `data:text/plain;base64,`). * - The promise is rejected if the blob cannot be read. */ export declare function convertBlobToBase64(blob: Blob): Promise; /** * Checks if the application is running in an Electron environment. * * @returns A promise that resolves to true if the application is running in an Electron environment, otherwise false. * * @deprecated Use the synchronous `isElectronContext()` function instead. */ export declare function isElectronApp(): Promise; /** * Checks if the current execution context is an Electron environment. * * The check uses three heuristics: * 1. Node integration: Detects if `process.versions.electron` exists. * 2. Preload bridge: Detects if a custom `window.electron` object is present. * 3. Fallback: Checks if `navigator.userAgent` contains "electron". * * @returns `true` if running in an Electron context, otherwise `false`. */ export declare function isElectronContext(): boolean; /** * Parses a 32-bit integer value into its individual components: prefix, numerator, denominator, and reserved. * * Read ETG.1004 Unit specification for details. * * This function takes a 32-bit signed integer `value` and extracts the following components: * - `prefix`: The most significant byte (bits 24-31). * - `numerator`: The second byte (bits 16-23). * - `denominator`: The third byte (bits 8-15). * - `reserved`: The least significant byte (bits 0-7). * * The function uses bitwise operations to isolate each byte from the 32-bit integer. * * @param value - The 32-bit integer to be parsed. * @returns An object containing the extracted components: * - `prefix`: The extracted prefix byte (8 bits). * - `numerator`: The extracted numerator byte (8 bits). * - `denominator`: The extracted denominator byte (8 bits). * - `reserved`: The extracted reserved byte (8 bits). * * @example * const parsed = parseUnitValue(0x12345678); * console.log(parsed); * // → { prefix: 0x12, numerator: 0x34, denominator: 0x56, reserved: 0x78 } */ export declare function parseUnitValue(value: number): { prefix: number; numerator: number; denominator: number; reserved: number; }; /** * Merges multiple `Uint8Array` instances into a single `Uint8Array`. * * @param ary - One or more `Uint8Array` instances to merge. * @returns A new `Uint8Array` containing all elements from the input arrays in order. * * @example * const a = new Uint8Array([1, 2]); * const b = new Uint8Array([3, 4]); * const merged = mergeUint8Arrays(a, b); // → Uint8Array [1, 2, 3, 4] * * @remarks * - Preserves the order of elements from each input array. * - Efficiently concatenates arrays without creating intermediate arrays for each element. * - Returns a new `Uint8Array`; the input arrays are not modified. */ export declare function mergeUint8Arrays(...ary: Uint8Array[]): Uint8Array; /** * Returns a new array containing only the unique elements from the input array, preserving their order. * * @typeParam T - The type of elements in the array. * @param items - The array from which to remove duplicates. * @returns A new array with duplicate elements removed. * * @example * uniqueItems([1, 2, 2, 3, 1]); // → [1, 2, 3] * uniqueItems(['a', 'b', 'a']); // → ['a', 'b'] * * @remarks * - Uses a `Set` internally for efficient duplicate removal. * - Original array is not modified. */ export declare function uniqueItems(items: Array): Array; /** * Groups an array of objects by the specified property. * * @typeParam T - The type of objects in the input array. * @typeParam K - The key of the property in `T` to group by. * * @param items - The array of objects to group. * @param property - The property name to group by. The property must be a key of `T`. * * @returns An object where each key is the stringified value of the specified property, * and each value is an array of objects from `items` that share that property value. * * @example * ```ts * const data = [ * { index: '0x1600', value: '0x60400010' }, * { index: '0x1600', value: '0x60600008' }, * { index: '0x1601', value: '0x60fe0120' } * ]; * * const grouped = groupByProperty(data, 'index'); * // { * // "0x1600": [ * // { index: "0x1600", value: "0x60400010" }, * // { index: "0x1600", value: "0x60600008" } * // ], * // "0x1601": [ * // { index: "0x1601", value: "0x60fe0120" } * // ] * // } * ``` */ export declare function groupByProperty(items: T[], property: K): Record; /** * Maps an array of objects by a specified property, creating a map where the key is * the value of the specified property and the value is an array of objects that have * the same property value. * * @param {V[]} objects - The array of objects to be mapped. * @param {keyof V} prop - The property name by which the objects will be mapped. * @returns {Map} A map where the keys are the unique property values and the values are arrays of objects that share that property value. */ export declare function mapByProperty(objects: V[], prop: keyof V): Map; /** * Converts a C type to its corresponding struct format character. * * @param cType - The C type as a string (e.g., `int8_t`, `uint32_t`, `char[24]`, etc.). * @returns A string representing the struct format equivalent of the given C type. * For example, `int8_t` becomes `b`, `uint16_t` becomes `H`, `char[24]` becomes `24s`, etc. * @throws Error if the given C type is not recognized. */ export declare function convertCTypeToStructFormatCharacter(cType: string): string; /** * Converts a string or number representing a numeric value into a number. * * - If the input is already a number, it is returned as is. * - If the input is a string starting with `#x`, it is parsed as a hexadecimal number. * - Otherwise, the string is parsed using `Number()`, which supports * decimal, hexadecimal (`0x`), binary (`0b`), octal (`0o`), and floating-point literals. * * @param value - The input value to convert. Can be a number or a string * representing a numeric value with optional prefixes. * * @returns The numeric value parsed from the input. If parsing fails, returns `NaN`. * * @example * ```ts * hexDecValueToNumber(42); // returns 42 * hexDecValueToNumber("#x2A"); // returns 42 (hexadecimal 2A) * hexDecValueToNumber("42"); // returns 42 (decimal) * hexDecValueToNumber("0x2A"); // returns 42 (hexadecimal) * hexDecValueToNumber("0b101010"); // returns 42 (binary) * hexDecValueToNumber("0o52"); // returns 42 (octal) * ``` */ export declare function hexDecValueToNumber(value: string | number): number; /** * Converts a value to a hexadecimal string representation. * * - If the value is a string that can be parsed as a number, converts it to hex. * - If the value is a string that cannot be parsed as a number, returns it as is. * - If the value is a Uint8Array, converts each byte to a hex string, with optional padding and prefix, then joins with spaces. * - If the value is a number, converts it to hex with optional padding and prefix. * - If the value is an array of numbers, converts each to hex with optional padding and prefix, then joins with spaces. * - Returns an empty string for unsupported value types. * * @param value - The value to convert (string, number, Uint8Array, or array of numbers). * @param pad - Optional minimum length for each hex number (without prefix). * @param prefix - Optional prefix for each hex number (default '0x'). * @param uppercase - Optional flag to use uppercase letters in hex (default false). * @returns Hexadecimal string representation or original string. * * @example * ```ts * convertValueToHexString("255"); // "0xff" * convertValueToHexString("not a number"); // "not a number" * convertValueToHexString(255); // "0xff" * convertValueToHexString([1, 255], 4); // "0x0001 0x00ff" * convertValueToHexString(new Uint8Array([15,255]), 2); // "0x0f 0xff" * ``` */ export declare function convertValueToHexString(value: string | number | Uint8Array | Array, pad?: number | null, prefix?: string, uppercase?: boolean): string; /** * Converts an ipv4 address to or from uint32 number. * * - If the value is a string, it will be parsed to array of octets and passed further for conversion to number (uint32). * - If the value is an array, it will be passed further for conversion to number (uint32). * - If the value is a number, it will be parsed to quad-dot format. * - Returns a string or number depending on the type of passed argument. * - It will throw an error if the octet numbers are not valid. * * @param ipv4 - The value to convert (string, number, or array of numbers). * @returns string or number reflecting the input value in its counter format. * * @example * ```ts * convertIpv4("192.168.1.1"); // "3232235777" * convertIpv4(3232235777); // "192.168.1.1" * convertIpv4(1); // "1.0.0.0" * convertIpv4("1"); // Throws an error for invalid IPv4 address * ``` */ export declare function convertIpv4(ipv4: Ipv4 | number): string | number; /** * Converts a raw fixed-point value (e.g., Q15) to a floating-point number. * * @param rawValue Raw fixed-point integer value. * @param qFractionalBits Number of fractional bits (default: 15). * @param round Whether to round the result to nearest integer (default: false). * @returns Floating-point (or optionally rounded) value. */ export declare function fromQ(rawValue: number, qFractionalBits?: number, round?: boolean): number; /** * Represents a notification message along with the elapsed time * since the tracking started. */ export interface NotificationEntry { message: string; timeDifference: number; } /** * Analyzes an array of measured time durations and returns useful statistics * both for the full dataset and for outlier-filtered data. * * This is intended for benchmarking or performance-profiling scenarios where * you collect many individual operation durations (e.g., using `performance.now()`). * * ## What each metric means * * - `count`: Number of measured durations. * - `durations`: Sorted list of all input durations (ascending). * - `filtered`: Sorted list of durations excluding statistical outliers using the IQR rule. * - `filteredCount`: Number of durations remaining after outlier removal. * * ### For both full and filtered stats: * * - `min`: The shortest measured duration. * - `max`: The longest measured duration. * - `mean`: The arithmetic average time. * - `median`: The middle value when sorted (50th percentile). More stable than mean. * - `std`: Standard deviation. Measures how much the durations vary. * - `p95`: 95th percentile. 95% of values are below this value. Useful as a near-worst-case indicator. * - `q1`: 25th percentile (lower quartile). * - `q3`: 75th percentile (upper quartile). * - `iqr`: Interquartile range (Q3 − Q1). Measures the spread of the middle 50% of values. * * ## Outlier filtering (IQR rule) * Outliers are removed if they fall outside: * [Q1 − 1.5×IQR, Q3 + 1.5×IQR] * * This avoids skewing results when a single operation takes unusually long. * * ## How to collect durations * * ```ts * const durations: number[] = []; * for (let i = 0; i < iterations; i++) { * const start = performance.now(); * await doWork(); * durations.push(performance.now() - start); * } * ``` * * ### Important: * - Do NOT use `Date.now()`; it has only millisecond resolution. * - Pre-warm your code (JIT, caches, I/O) before measuring. * - Run many iterations (100–10 000) to get stable stats. * - Avoid logging inside the measured code; it distorts timing. * * @param durations An array of time durations in milliseconds. Must contain at least one value. * @returns An object containing sorted durations, filtered durations, and statistics for both full and filtered datasets. * @throws If the input array is empty. */ export declare function analyzeTimeDurations(durations: number[]): { count: number; filteredCount: number; durations: number[]; filtered: number[]; fullStats: { min: number; max: number; mean: number; median: number; std: number; p95: number; q1: number; q3: number; iqr: number; }; filteredStats: { min: number; max: number; mean: number; median: number; std: number; p95: number; q1: number; q3: number; iqr: number; }; }; /** * Creates a function to normalize unsigned counter timestamps relative to an initial value, * correctly handling wrap-around for counters with any bit width from 1 to 32 bits. * * This is useful when timestamps from a hardware or software counter may wrap around, * and you want strictly increasing normalized timestamps starting from zero. * * @param initial - The first timestamp received. This value will normalize to 0. * @param bits - The bit width of the counter (1..32). Determines the maximum value before wrap-around. * * @returns A function that takes a timestamp and returns a normalized, strictly increasing timestamp. * * @example * // 8-bit counter * const normalize8 = makeNormalizeTimestampFn(100, 8); * console.log(normalize8(100)); // 0 * console.log(normalize8(255)); // 155 * console.log(normalize8(3)); // 159 * * @example * // 16-bit counter * const normalize16 = makeNormalizeTimestampFn(1000, 16); * console.log(normalize16(1000)); // 0 * console.log(normalize16(65535)); // 64535 * console.log(normalize16(10)); // 65546 * * @example * // 32-bit counter (microseconds) * const normalize32 = makeNormalizeTimestampFn(100, 32); * console.log(normalize32(100)); // 0 * console.log(normalize32(4294967295)); // 4294967195 * console.log(normalize32(3)); // 4294967299 * * @throws {Error} If bits is not in the range 1..32 */ export declare function makeNormalizeTimestampFn(initial: number, bits: number): (timestamp: number) => number;