import { _ as RouterContextValue, g as Router, h as RouteTransform, p as RouteChildren } from "./types-DEfyw-7V.js";
import { ComponentType, FunctionComponent } from "react";
import { RouterContext as RouterContext$1 } from "sanity/_singletons";
/**
 * @public
 */
interface RouteNodeOptions {
  /**
   * The path of the route node.
   */
  path?: string;
  /**
   * The children of the route node. See {@link RouteChildren}
   */
  children?: RouteChildren;
  /**
   * The transforms to apply to the route node. See {@link RouteTransform}
   */
  transform?: {
    [key: string]: RouteTransform<any>;
  };
  /**
   * The scope of the route node.
   */
  scope?: string;
  /**
   * Optionally disable scoping of search params
   * Scoped search params will be represented as scope[param]=value in the url
   * Disabling this will still scope search params based on any parent scope unless the parent scope also has disabled search params scoping
   * Caution: enabling this can cause conflicts with multiple plugins defining search params with the same name
   */
  __unsafe_disableScopedSearchParams?: boolean;
}
/**
 * Interface for the {@link route} object.
 *
 * @public
 */
interface RouteObject {
  /**
   * Creates a new router.
   * Returns {@link Router}
   * See {@link RouteNodeOptions} and {@link RouteChildren}
   */
  create: (routeOrOpts: RouteNodeOptions | string, childrenOrOpts?: RouteNodeOptions | RouteChildren | null, children?: Router | RouteChildren) => Router;
  /**
   * Creates a new router for handling intents.
   * Returns {@link Router}
   */
  intents: (base: string) => Router;
  /**
   * Creates a new router scope.
   * Returns {@link Router}
   */
  scope(scopeName: string, routeOrOpts: RouteNodeOptions | string, childrenOrOpts?: RouteNodeOptions | RouteChildren | null, children?: Router | RouteChildren): Router;
}
/**
 * An object containing functions for creating routers and router scopes.
 * See {@link RouteObject}
 *
 * @public
 *
 * @example
 * ```ts
 * const router = route.create({
 *   path: "/foo",
 *   children: [
 *     route.create({
 *       path: "/bar",
 *       children: [
 *         route.create({
 *           path: "/:baz",
 *           transform: {
 *             baz: {
 *               toState: (id) => ({ id }),
 *               toPath: (state) => state.id,
 *             },
 *           },
 *         }),
 *       ],
 *     }),
 *   ],
 * });
 * ```
 */
declare const route: RouteObject;
/**
 * @internal
 * @param options - Route node options
 */
declare function _createNode(options: RouteNodeOptions): Router;
/**
 * @internal
 */
declare const STICKY_PARAMS: string[];
/**
 * Returns the router context value.
 * @public
 *
 * @returns The router context value.
 *  {@link RouterContextValue}
 * @throws An error if the router context value is missing.
 *
 * @example
 * ```tsx
 * const router = useRouter()
 * ```
 */
declare function useRouter(): RouterContextValue;
/**
 * Decode a path segment containing JSON parameters
 *
 * @param pathSegment - The path segment to decode
 * @returns The decoded parameters
 * @internal
 * @hidden
 */
declare function decodeJsonParams(pathSegment?: string): any;
/**
 * Encodes a set of parameters as a path segment, using base64url
 *
 * @param params - Paramters to encode
 * @returns The encoded parameters as a path segment
 * @internal
 * @hidden
 */
declare function encodeJsonParams(params?: any): string;
/**
 * A higher-order component that injects the `router` object from the `useRouter` hook
 * into the props of the wrapped component.
 *
 * @internal
 * @deprecated - Use the `useRouter` hook instead.
 *
 * @param Component - The component to wrap.
 *
 * @returns The wrapped component.
 *
 * @example
 * ```tsx
 * function MyComponent(props) {
 *  return <div>{props.router.state.myParam}</div>
 * }
 *
 * export default withRouter(MyComponent)
 * ```
 */
declare function withRouter<Props extends {
  router: RouterContextValue;
}>(Component: ComponentType<Props>): FunctionComponent<Omit<Props, 'router'>>;
/**
 * @internal
 * @deprecated - Use the `useRouter` hook instead.
 */
interface WithRouterProps {
  /**
   * The `router` object from the `useRouter` hook.
   *  {@link RouterContextValue}
   */
  router: RouterContextValue;
  /**
   * A function that renders the wrapped component with the `router` object as a parameter.
   */
  children: (router: RouterContextValue) => React.JSX.Element;
}
/**
 * A higher-order component that injects the router object into its child component.
 *
 * @internal
 * @deprecated - Use the `useRouter` hook instead.
 *
 * @returns The rendered component.
 *
 * @example
 * ```tsx
 * function MyComponent(props: {router: Router}) {
 *   const {location} = props.router
 *   const {pathname} = location
 *   return <p>The current path is: {pathname}</p>
 * }
 *
 * function App() {
 *   return (
 *     <Router>
 *       <WithRouter>
 *         {router => <MyComponent router={router} />}
 *       </WithRouter>
 *     </Router>
 *   )
 * }
 * ```
 */
declare const WithRouter: FunctionComponent<Omit<WithRouterProps, "router">>;
export { encodeJsonParams as a, STICKY_PARAMS as c, _createNode as d, route as f, decodeJsonParams as i, RouteNodeOptions as l, WithRouterProps as n, RouterContext$1 as o, withRouter as r, useRouter as s, WithRouter as t, RouteObject as u };
//# sourceMappingURL=withRouter-Ul0HGhWL.d.ts.map