import { ClassValue } from 'clsx';
import { formatDistanceToNow } from 'date-fns';
import { ForwardedRef } from 'react';
import { MutableRefObject } from 'react';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { RefCallback } from 'react';

export declare const afterFrames: (cb: () => void, frames?: number) => () => void;

/**
 * Build pagination link with page number and optional search query
 * @param pageNumber - The page number to navigate to
 * @param searchQuery - Optional search query to preserve in URL
 * @returns Query string for pagination link
 */
export declare function buildPaginationLink(pageNumber: number, searchQuery?: string | null): string;

export declare function cn(...inputs: ClassValue[]): string;

export declare function createPaginationLinks(xPrevPage: number, xNextPage: number, searchQuery?: string | null): {
    getPrevPageLink: () => string;
    getNextPageLink: () => string;
};

/**
 * Converts comma-separated values to a structured object with metadata
 * @param inputValue The comma-separated string (e.g., "a,b,c" or "a:1,a:2,a:3")
 * @returns Object with data and metadata about key-value pairs
 */
export declare const csvToObject: (inputValue: string) => {
    data: Record<string, string>;
    metadata: Record<string, boolean>;
};

export declare const decodeURIComponentIfValid: (path: string) => string;

export declare const decodeURIPath: (path: string) => string;

/**
 * Pluralizes a word based on the count
 * @param count The count of the word
 * @param singular The singular form of the word
 * @param plural The plural form of the word
 * @param include Whether to include the count in the result
 * @returns The pluralized word
 */
export declare const easyPluralize: (count: number, singular: string, plural: string, include?: boolean) => string;

export declare const encodePath: (path: string) => string;

export declare const filterChildrenByDisplayNames: (children: ReactNode, displayNames: string[], exclude?: true) => ReactElement[];

/**
 * Format a timestamp to a localized date string
 * @param timestamp - Unix timestamp in milliseconds or ISO date string
 * @param dateStyle - DateTimeFormat style: 'full' | 'long' | 'medium' | 'short'
 * @returns Formatted date string or empty string if timestamp is falsy
 * @example
 * formatDate(1642774800000) // Returns "Jan 21, 2024"
 * formatDate("2022-01-21", "full") // Returns "Friday, January 21, 2024"
 */
export declare function formatDate(timestamp: number | string, dateStyle?: Intl.DateTimeFormatOptions['dateStyle']): string;

export { formatDistanceToNow }

/**
 * Formats duration in milliseconds or nanoseconds to human-readable duration format.
 * For 3723000 is formatted as "1h 2m 3s".
 * @param durationInMs
 * @param unit
 * @returns
 */
export declare const formatDuration: (duration: number, unit?: "ms" | "ns") => string;

/**
 * Format a number with current locale.
 * @param num number
 * @returns Formatted string.
 */
export declare function formatNumber(num: number | bigint): string;

/**
 * This is the function that formats a timestamp to a relative time string.
 * ⭐️ It is used in TimeAgoCard component.
 *
 * @param timestamp
 * @param locale
 * @returns
 */
export declare const formatRelativeTime: (timestamp?: number | string | null, locale?: string | string[]) => string;

/**
 * Formats an epoch timestamp into a string in the format "HH:mm:ss.SSS".
 *
 * @param epoch - The epoch timestamp (milliseconds since January 1, 1970).
 * @returns A formatted string representing the time in "HH:mm:ss.SSS" format.
 */
export declare const formatTimestamp: (epoch: number) => string;

/**
 * Generate a random alphanumeric hash of a given length
 * @param length - The length of the hash to generate
 * @returns A random alphanumeric hash of the given length
 */
export declare function generateAlphaNumericHash(length: number): string;

export declare const getComponentDisplayName: (child: ReactNode) => string | undefined;

export declare const getErrorMessage: (error: Error | string | null, defaultMessage: string) => string;

/**
 * @param startTs
 * @param endTs
 * @returns duration in "1h 2m 3s" format
 */
export declare const getFormattedDuration: (startTs?: number, endTs?: number) => string;

export declare const getInitials: (name: string, length?: number) => string;

export declare const getShadowActiveElement: (rootEl: HTMLElement) => {
    isShadowRoot: boolean;
    activeEl: Element | null;
};

export declare const INITIAL_ZOOM_LEVEL = 1;

/**
 * Checks if a value is of one of the provided types and provides type assertion
 * @param value - The value to check
 * @param types - Array of JavaScript type names to check against
 * @returns True if the value matches any of the provided types, false otherwise
 * @example
 * const value: unknown = "hello";
 * if (isAnyTypeOf(value, ['string', 'number'])) {
 *   TypeScript now knows that value is string | number
 *   console.log(value.toString());
 * }
 */
export declare function isAnyTypeOf<T extends JavaScriptType[]>(value: unknown, types: [...T]): value is TypeFromArray<T>;

export declare function isPromise(obj: any): obj is Promise<any>;

/**
 * Valid JavaScript type names that can be returned by the typeof operator
 */
declare type JavaScriptType = 'string' | 'number' | 'boolean' | 'undefined' | 'object' | 'function' | 'symbol' | 'bigint';

export declare const LOCALE: string;

declare type PossibleRef<T> = MutableRefObject<T> | RefCallback<T> | ForwardedRef<T>;

/**
 * Splits an object into two parts: one with the specified keys and one with the remaining keys
 * @param obj - The object to split
 * @param keys - Array of keys to extract
 * @returns An object with two properties: `picked` containing the extracted properties and `rest` containing the remaining properties
 * @example
 * const { picked: { created_by, review_decision }, rest } = splitObjectProps(
 *   Object.fromEntries(searchParams.entries()),
 *   ['created_by', 'review_decision']
 * );
 */
export declare function splitObjectProps<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): {
    picked: Pick<T, K>;
    rest: Omit<T, K>;
};

/**
 * Calculate human-readable time distance between two dates
 * @param date1 - First date in milliseconds
 * @param date2 - Second date in milliseconds (defaults to 0)
 * @param onlyHighestDenomination - If true, returns only the highest unit (e.g., "2 days" instead of "2 days 3 hours")
 * @returns Formatted distance string
 */
export declare const timeDistance: (date1?: number, date2?: number, onlyHighestDenomination?: boolean) => string;

/**
 * Creates a union type from an array of JavaScript type names
 */
declare type TypeFromArray<T extends JavaScriptType[]> = {
    [K in keyof T]: T[K] extends JavaScriptType ? TypeMap[T[K]] : never;
}[number];

/**
 * Maps JavaScript type names to their actual types
 */
declare type TypeMap = {
    string: string;
    number: number;
    boolean: boolean;
    undefined: undefined;
    object: object | null;
    function: (...args: any[]) => any;
    symbol: symbol;
    bigint: bigint;
};

/**
 * A React hook that merges multiple refs into a single ref callback.
 */
export declare function useMergeRefs<T>(refs: Array<PossibleRef<T> | null | undefined>): RefCallback<T>;

export declare interface Violation {
    violation: string;
}

/**
 * Helps to construct conditional arrays like this: [item1, condition && item2, item3].filter(item => !!item)
 */
export declare const wrapConditionalArrayElements: <T>(elements: T[], isPassing: boolean) => T[];

/**
 * Helps to construct conditional objects like this: {a: b, ...(some ? c : {}), z: x}
 */
export declare const wrapConditionalObjectElement: <T>(element: T, isPassing: boolean) => T;

export declare const ZOOM_INC_DEC_LEVEL = 0.1;

export { }
