import * as react_jsx_runtime from 'react/jsx-runtime';
import * as react_router from 'react-router';
import { LinkProps as LinkProps$1, NavigateOptions as NavigateOptions$1, NavigateProps as NavigateProps$1 } from 'react-router';
import React from 'react';

type To<Pathname = string> = {
    pathname: Pathname;
    search?: string;
    hash?: string;
};
type ComponentProps<Path extends string | To, Params extends Record<string, any>> = Path extends keyof Params ? {
    to: Path;
    params: Params[Path];
} : Path extends {
    pathname: infer Pathname;
} ? Pathname extends keyof Params ? {
    to: To<Pathname>;
    params: Params[Pathname];
} : {
    to: To<Pathname>;
    params?: never;
} : {
    to: Path;
    params?: never;
};
type LinkProps<Path extends string | To, Params extends Record<string, any>> = Omit<LinkProps$1, 'to'> & ComponentProps<Path, Params>;
type NavigateProps<Path extends string | To, Params extends Record<string, any>> = Omit<NavigateProps$1, 'to'> & ComponentProps<Path, Params>;
type NavigateOptions<Path extends string | To | number, Params extends Record<string, any>> = Path extends number ? [] : Path extends keyof Params ? [NavigateOptions$1 & {
    params: Params[Path];
}] : Path extends {
    pathname: infer Pathname;
} ? Pathname extends keyof Params ? [NavigateOptions$1 & {
    params: Params[Pathname];
}] : [NavigateOptions$1 & {
    params?: never;
}] | [] : [NavigateOptions$1 & {
    params?: never;
}] | [];

declare const components: <Path extends string, Params extends Record<string, any>>() => {
    Link: React.ForwardRefExoticComponent<(React.PropsWithoutRef<Omit<react_router.LinkProps, "to"> & (Path extends keyof Params ? {
        to: Path;
        params: Params[Path];
    } : Path extends {
        pathname: infer Pathname;
    } ? Pathname extends keyof Params ? {
        to: To<Pathname>;
        params: Params[Pathname];
    } : {
        to: To<Pathname>;
        params?: never;
    } : {
        to: Path;
        params?: never;
    })> | React.PropsWithoutRef<Omit<react_router.LinkProps, "to"> & (To<Path> extends infer T ? T extends To<Path> ? T extends keyof Params ? {
        to: T;
        params: Params[T];
    } : T extends {
        pathname: infer Pathname;
    } ? Pathname extends keyof Params ? {
        to: To<Pathname>;
        params: Params[Pathname];
    } : {
        to: To<Pathname>;
        params?: never;
    } : {
        to: T;
        params?: never;
    } : never : never)>) & React.RefAttributes<HTMLAnchorElement>>;
    Navigate: <P extends Path | To<Path>>({ to, params, ...props }: LinkProps<P, Params>) => react_jsx_runtime.JSX.Element;
};

declare const hooks: <Path extends string, Params extends Record<string, any>, ModalPath extends string>() => {
    useParams: <P extends keyof Params>(path: P) => Params[P];
    useNavigate: () => <P extends Path | To<Path> | number>(to: P, ...[options]: NavigateOptions<P, Params>) => void | Promise<void>;
    useModals: () => {
        current: any;
        open: <P extends Path>(path: ModalPath, options?: NavigateOptions$1 & (P extends keyof Params ? {
            at?: P | undefined;
            params: Params[P];
        } : {
            at?: P | undefined;
            params?: never;
        })) => void;
        close: <P extends Path>(options?: NavigateOptions$1 & (P extends keyof Params ? {
            at?: P | undefined;
            params: Params[P];
        } : {
            at?: P | undefined;
            params?: never;
        })) => void;
    };
};

declare const utils: <Path extends string, Params extends Record<string, any>>() => {
    redirect: <P extends Path>(url: P, ...[options]: P extends keyof Params ? [(number | ResponseInit) & {
        params: Params[P];
    }] : [] | [(number | ResponseInit) & {
        params?: never;
    }]) => Response;
};

export { type LinkProps, type NavigateOptions, type NavigateProps, type To, components, hooks, utils };
