{"version":3,"file":"link.cjs","names":[],"sources":["../../src/link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { flushSync } from 'react-dom'\nimport {\n  deepEqual,\n  exactPathTest,\n  functionalUpdate,\n  isDangerousProtocol,\n  preloadWarning,\n  removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n  AnyRouter,\n  Constrain,\n  LinkOptions,\n  RegisteredRouter,\n  RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n  ValidateLinkOptions,\n  ValidateLinkOptionsArray,\n} from './typePrimitives'\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n  forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n  const router = useRouter()\n  const innerRef = useForwardedRef(forwardedRef)\n\n  // Determine if we're on the server - used for tree-shaking client-only code\n  const _isServer = isServer ?? router.isServer\n\n  const {\n    // custom props\n    activeProps,\n    inactiveProps,\n    activeOptions,\n    to,\n    preload: userPreload,\n    preloadDelay: userPreloadDelay,\n    hashScrollIntoView,\n    replace,\n    startTransition,\n    resetScroll,\n    viewTransition,\n    // element props\n    children,\n    target,\n    disabled,\n    style,\n    className,\n    onClick,\n    onBlur,\n    onFocus,\n    onMouseEnter,\n    onMouseLeave,\n    onTouchStart,\n    ignoreBlocker,\n    // prevent these from being returned\n    params: _params,\n    search: _search,\n    hash: _hash,\n    state: _state,\n    mask: _mask,\n    reloadDocument: _reloadDocument,\n    unsafeRelative: _unsafeRelative,\n    from: _from,\n    _fromLocation,\n    ...propsSafeToSpread\n  } = options\n\n  // ==========================================================================\n  // SERVER EARLY RETURN\n  // On the server, we return static props without any event handlers,\n  // effects, or client-side interactivity.\n  //\n  // For SSR parity (to avoid hydration errors), we still compute the link's\n  // active status on the server, but we avoid creating any router-state\n  // subscriptions by reading from the location store directly.\n  //\n  // Note: `location.hash` is not available on the server.\n  // ==========================================================================\n  if (_isServer) {\n    const safeInternal = isSafeInternal(to)\n\n    // If `to` is obviously an absolute URL, treat as external and avoid\n    // computing the internal location via `buildLocation`.\n    if (\n      typeof to === 'string' &&\n      !safeInternal &&\n      // Quick checks to avoid `new URL` in common internal-like cases\n      to.indexOf(':') > -1\n    ) {\n      try {\n        new URL(to)\n        if (isDangerousProtocol(to, router.protocolAllowlist)) {\n          if (process.env.NODE_ENV !== 'production') {\n            console.warn(`Blocked Link with dangerous protocol: ${to}`)\n          }\n          return {\n            ...propsSafeToSpread,\n            ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n            href: undefined,\n            ...(children && { children }),\n            ...(target && { target }),\n            ...(disabled && { disabled }),\n            ...(style && { style }),\n            ...(className && { className }),\n          }\n        }\n\n        return {\n          ...propsSafeToSpread,\n          ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n          href: to,\n          ...(children && { children }),\n          ...(target && { target }),\n          ...(disabled && { disabled }),\n          ...(style && { style }),\n          ...(className && { className }),\n        }\n      } catch {\n        // Not an absolute URL\n      }\n    }\n\n    const next = router.buildLocation({ ...options, from: options.from } as any)\n\n    // Use publicHref - it contains the correct href for display\n    // When a rewrite changes the origin, publicHref is the full URL\n    // Otherwise it's the origin-stripped path\n    // This avoids constructing URL objects in the hot path\n    const hrefOptionPublicHref = next.maskedLocation\n      ? next.maskedLocation.publicHref\n      : next.publicHref\n    const hrefOptionExternal = next.maskedLocation\n      ? next.maskedLocation.external\n      : next.external\n    const hrefOption = getHrefOption(\n      hrefOptionPublicHref,\n      hrefOptionExternal,\n      router.history,\n      disabled,\n    )\n\n    const externalLink = (() => {\n      if (hrefOption?.external) {\n        if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n          if (process.env.NODE_ENV !== 'production') {\n            console.warn(\n              `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n            )\n          }\n          return undefined\n        }\n        return hrefOption.href\n      }\n\n      if (safeInternal) return undefined\n\n      // Only attempt URL parsing when it looks like an absolute URL.\n      if (typeof to === 'string' && to.indexOf(':') > -1) {\n        try {\n          new URL(to)\n          if (isDangerousProtocol(to, router.protocolAllowlist)) {\n            if (process.env.NODE_ENV !== 'production') {\n              console.warn(`Blocked Link with dangerous protocol: ${to}`)\n            }\n            return undefined\n          }\n          return to\n        } catch {}\n      }\n\n      return undefined\n    })()\n\n    const isActive = (() => {\n      if (externalLink) return false\n\n      const currentLocation = router.stores.location.state\n\n      const exact = activeOptions?.exact ?? false\n\n      if (exact) {\n        const testExact = exactPathTest(\n          currentLocation.pathname,\n          next.pathname,\n          router.basepath,\n        )\n        if (!testExact) {\n          return false\n        }\n      } else {\n        const currentPathSplit = removeTrailingSlash(\n          currentLocation.pathname,\n          router.basepath,\n        )\n        const nextPathSplit = removeTrailingSlash(\n          next.pathname,\n          router.basepath,\n        )\n\n        const pathIsFuzzyEqual =\n          currentPathSplit.startsWith(nextPathSplit) &&\n          (currentPathSplit.length === nextPathSplit.length ||\n            currentPathSplit[nextPathSplit.length] === '/')\n\n        if (!pathIsFuzzyEqual) {\n          return false\n        }\n      }\n\n      const includeSearch = activeOptions?.includeSearch ?? true\n      if (includeSearch) {\n        if (currentLocation.search !== next.search) {\n          const currentSearchEmpty =\n            !currentLocation.search ||\n            (typeof currentLocation.search === 'object' &&\n              Object.keys(currentLocation.search).length === 0)\n          const nextSearchEmpty =\n            !next.search ||\n            (typeof next.search === 'object' &&\n              Object.keys(next.search).length === 0)\n\n          if (!(currentSearchEmpty && nextSearchEmpty)) {\n            const searchTest = deepEqual(currentLocation.search, next.search, {\n              partial: !exact,\n              ignoreUndefined: !activeOptions?.explicitUndefined,\n            })\n            if (!searchTest) {\n              return false\n            }\n          }\n        }\n      }\n\n      // Hash is not available on the server\n      if (activeOptions?.includeHash) {\n        return false\n      }\n\n      return true\n    })()\n\n    if (externalLink) {\n      return {\n        ...propsSafeToSpread,\n        ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n        href: externalLink,\n        ...(children && { children }),\n        ...(target && { target }),\n        ...(disabled && { disabled }),\n        ...(style && { style }),\n        ...(className && { className }),\n      }\n    }\n\n    const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n      isActive\n        ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n        : STATIC_EMPTY_OBJECT\n\n    const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n      isActive\n        ? STATIC_EMPTY_OBJECT\n        : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n    const resolvedStyle = (() => {\n      const baseStyle = style\n      const activeStyle = resolvedActiveProps.style\n      const inactiveStyle = resolvedInactiveProps.style\n\n      if (!baseStyle && !activeStyle && !inactiveStyle) {\n        return undefined\n      }\n\n      if (baseStyle && !activeStyle && !inactiveStyle) {\n        return baseStyle\n      }\n\n      if (!baseStyle && activeStyle && !inactiveStyle) {\n        return activeStyle\n      }\n\n      if (!baseStyle && !activeStyle && inactiveStyle) {\n        return inactiveStyle\n      }\n\n      return {\n        ...baseStyle,\n        ...activeStyle,\n        ...inactiveStyle,\n      }\n    })()\n\n    const resolvedClassName = (() => {\n      const baseClassName = className\n      const activeClassName = resolvedActiveProps.className\n      const inactiveClassName = resolvedInactiveProps.className\n\n      if (!baseClassName && !activeClassName && !inactiveClassName) {\n        return ''\n      }\n\n      let out = ''\n\n      if (baseClassName) {\n        out = baseClassName\n      }\n\n      if (activeClassName) {\n        out = out ? `${out} ${activeClassName}` : activeClassName\n      }\n\n      if (inactiveClassName) {\n        out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n      }\n\n      return out\n    })()\n\n    return {\n      ...propsSafeToSpread,\n      ...resolvedActiveProps,\n      ...resolvedInactiveProps,\n      href: hrefOption?.href,\n      ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n      disabled: !!disabled,\n      target,\n      ...(resolvedStyle && { style: resolvedStyle }),\n      ...(resolvedClassName && { className: resolvedClassName }),\n      ...(disabled && STATIC_DISABLED_PROPS),\n      ...(isActive && STATIC_ACTIVE_PROPS),\n    }\n  }\n\n  // ==========================================================================\n  // CLIENT-ONLY CODE\n  // Everything below this point only runs on the client. The `isServer` check\n  // above is a compile-time constant that bundlers use for dead code elimination,\n  // so this entire section is removed from server bundles.\n  //\n  // We disable the rules-of-hooks lint rule because these hooks appear after\n  // an early return. This is safe because:\n  // 1. `isServer` is a compile-time constant from conditional exports\n  // 2. In server bundles, this code is completely eliminated by the bundler\n  // 3. In client bundles, `isServer` is `false`, so the early return never executes\n  // ==========================================================================\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const isHydrated = useHydrated()\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const _options = React.useMemo(\n    () => options,\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [\n      router,\n      options.from,\n      options._fromLocation,\n      options.hash,\n      options.to,\n      options.search,\n      options.params,\n      options.state,\n      options.mask,\n      options.unsafeRelative,\n    ],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const currentLocation = useStore(\n    router.stores.location,\n    (l) => l,\n    (prev, next) => prev.href === next.href,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const next = React.useMemo(() => {\n    const opts = { _fromLocation: currentLocation, ..._options }\n    return router.buildLocation(opts as any)\n  }, [router, currentLocation, _options])\n\n  // Use publicHref - it contains the correct href for display\n  // When a rewrite changes the origin, publicHref is the full URL\n  // Otherwise it's the origin-stripped path\n  // This avoids constructing URL objects in the hot path\n  const hrefOptionPublicHref = next.maskedLocation\n    ? next.maskedLocation.publicHref\n    : next.publicHref\n  const hrefOptionExternal = next.maskedLocation\n    ? next.maskedLocation.external\n    : next.external\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const hrefOption = React.useMemo(\n    () =>\n      getHrefOption(\n        hrefOptionPublicHref,\n        hrefOptionExternal,\n        router.history,\n        disabled,\n      ),\n    [disabled, hrefOptionExternal, hrefOptionPublicHref, router.history],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const externalLink = React.useMemo(() => {\n    if (hrefOption?.external) {\n      // Block dangerous protocols for external links\n      if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(\n            `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n          )\n        }\n        return undefined\n      }\n      return hrefOption.href\n    }\n    const safeInternal = isSafeInternal(to)\n    if (safeInternal) return undefined\n    if (typeof to !== 'string' || to.indexOf(':') === -1) return undefined\n    try {\n      new URL(to as any)\n      // Block dangerous protocols like javascript:, blob:, data:\n      if (isDangerousProtocol(to, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(`Blocked Link with dangerous protocol: ${to}`)\n        }\n        return undefined\n      }\n      return to\n    } catch {}\n    return undefined\n  }, [to, hrefOption, router.protocolAllowlist])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const isActive = React.useMemo(() => {\n    if (externalLink) return false\n    if (activeOptions?.exact) {\n      const testExact = exactPathTest(\n        currentLocation.pathname,\n        next.pathname,\n        router.basepath,\n      )\n      if (!testExact) {\n        return false\n      }\n    } else {\n      const currentPathSplit = removeTrailingSlash(\n        currentLocation.pathname,\n        router.basepath,\n      )\n      const nextPathSplit = removeTrailingSlash(next.pathname, router.basepath)\n\n      const pathIsFuzzyEqual =\n        currentPathSplit.startsWith(nextPathSplit) &&\n        (currentPathSplit.length === nextPathSplit.length ||\n          currentPathSplit[nextPathSplit.length] === '/')\n\n      if (!pathIsFuzzyEqual) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeSearch ?? true) {\n      const searchTest = deepEqual(currentLocation.search, next.search, {\n        partial: !activeOptions?.exact,\n        ignoreUndefined: !activeOptions?.explicitUndefined,\n      })\n      if (!searchTest) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeHash) {\n      return isHydrated && currentLocation.hash === next.hash\n    }\n    return true\n  }, [\n    activeOptions?.exact,\n    activeOptions?.explicitUndefined,\n    activeOptions?.includeHash,\n    activeOptions?.includeSearch,\n    currentLocation,\n    externalLink,\n    isHydrated,\n    next.hash,\n    next.pathname,\n    next.search,\n    router.basepath,\n  ])\n\n  // Get the active props\n  const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n    ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n    : STATIC_EMPTY_OBJECT\n\n  // Get the inactive props\n  const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n    isActive\n      ? STATIC_EMPTY_OBJECT\n      : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n  const resolvedClassName = [\n    className,\n    resolvedActiveProps.className,\n    resolvedInactiveProps.className,\n  ]\n    .filter(Boolean)\n    .join(' ')\n\n  const resolvedStyle = (style ||\n    resolvedActiveProps.style ||\n    resolvedInactiveProps.style) && {\n    ...style,\n    ...resolvedActiveProps.style,\n    ...resolvedInactiveProps.style,\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const [isTransitioning, setIsTransitioning] = React.useState(false)\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const hasRenderFetched = React.useRef(false)\n\n  const preload =\n    options.reloadDocument || externalLink\n      ? false\n      : (userPreload ?? router.options.defaultPreload)\n  const preloadDelay =\n    userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const doPreload = React.useCallback(() => {\n    router\n      .preloadRoute({ ..._options, _builtLocation: next } as any)\n      .catch((err) => {\n        console.warn(err)\n        console.warn(preloadWarning)\n      })\n  }, [router, _options, next])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const preloadViewportIoCallback = React.useCallback(\n    (entry: IntersectionObserverEntry | undefined) => {\n      if (entry?.isIntersecting) {\n        doPreload()\n      }\n    },\n    [doPreload],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  useIntersectionObserver(\n    innerRef,\n    preloadViewportIoCallback,\n    intersectionObserverOptions,\n    { disabled: !!disabled || !(preload === 'viewport') },\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  React.useEffect(() => {\n    if (hasRenderFetched.current) {\n      return\n    }\n    if (!disabled && preload === 'render') {\n      doPreload()\n      hasRenderFetched.current = true\n    }\n  }, [disabled, doPreload, preload])\n\n  // The click handler\n  const handleClick = (e: React.MouseEvent) => {\n    // Check actual element's target attribute as fallback\n    const elementTarget = (\n      e.currentTarget as HTMLAnchorElement | SVGAElement\n    ).getAttribute('target')\n    const effectiveTarget = target !== undefined ? target : elementTarget\n\n    if (\n      !disabled &&\n      !isCtrlEvent(e) &&\n      !e.defaultPrevented &&\n      (!effectiveTarget || effectiveTarget === '_self') &&\n      e.button === 0\n    ) {\n      e.preventDefault()\n\n      flushSync(() => {\n        setIsTransitioning(true)\n      })\n\n      const unsub = router.subscribe('onResolved', () => {\n        unsub()\n        setIsTransitioning(false)\n      })\n\n      // All is well? Navigate!\n      // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n      router.navigate({\n        ..._options,\n        replace,\n        resetScroll,\n        hashScrollIntoView,\n        startTransition,\n        viewTransition,\n        ignoreBlocker,\n      })\n    }\n  }\n\n  if (externalLink) {\n    return {\n      ...propsSafeToSpread,\n      ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n      href: externalLink,\n      ...(children && { children }),\n      ...(target && { target }),\n      ...(disabled && { disabled }),\n      ...(style && { style }),\n      ...(className && { className }),\n      ...(onClick && { onClick }),\n      ...(onBlur && { onBlur }),\n      ...(onFocus && { onFocus }),\n      ...(onMouseEnter && { onMouseEnter }),\n      ...(onMouseLeave && { onMouseLeave }),\n      ...(onTouchStart && { onTouchStart }),\n    }\n  }\n\n  const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {\n    if (disabled || preload !== 'intent') return\n\n    if (!preloadDelay) {\n      doPreload()\n      return\n    }\n\n    const eventTarget = e.currentTarget\n\n    if (timeoutMap.has(eventTarget)) {\n      return\n    }\n\n    const id = setTimeout(() => {\n      timeoutMap.delete(eventTarget)\n      doPreload()\n    }, preloadDelay)\n    timeoutMap.set(eventTarget, id)\n  }\n\n  const handleTouchStart = (_: React.TouchEvent) => {\n    if (disabled || preload !== 'intent') return\n    doPreload()\n  }\n\n  const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {\n    if (disabled || !preload || !preloadDelay) return\n    const eventTarget = e.currentTarget\n    const id = timeoutMap.get(eventTarget)\n    if (id) {\n      clearTimeout(id)\n      timeoutMap.delete(eventTarget)\n    }\n  }\n\n  return {\n    ...propsSafeToSpread,\n    ...resolvedActiveProps,\n    ...resolvedInactiveProps,\n    href: hrefOption?.href,\n    ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n    onClick: composeHandlers([onClick, handleClick]),\n    onBlur: composeHandlers([onBlur, handleLeave]),\n    onFocus: composeHandlers([onFocus, enqueueIntentPreload]),\n    onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),\n    onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n    onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n    disabled: !!disabled,\n    target,\n    ...(resolvedStyle && { style: resolvedStyle }),\n    ...(resolvedClassName && { className: resolvedClassName }),\n    ...(disabled && STATIC_DISABLED_PROPS),\n    ...(isActive && STATIC_ACTIVE_PROPS),\n    ...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),\n  }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\nconst STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\nconst intersectionObserverOptions: IntersectionObserverInit = {\n  rootMargin: '100px',\n}\n\nconst composeHandlers =\n  (handlers: Array<undefined | React.EventHandler<any>>) =>\n  (e: React.SyntheticEvent) => {\n    for (const handler of handlers) {\n      if (!handler) continue\n      if (e.defaultPrevented) return\n      handler(e)\n    }\n  }\n\nfunction getHrefOption(\n  publicHref: string,\n  external: boolean,\n  history: AnyRouter['history'],\n  disabled: boolean | undefined,\n) {\n  if (disabled) return undefined\n  // Full URL means rewrite changed the origin - treat as external-like\n  if (external) {\n    return { href: publicHref, external: true }\n  }\n  return {\n    href: history.createHref(publicHref) || '/',\n    external: false,\n  }\n}\n\nfunction isSafeInternal(to: unknown) {\n  if (typeof to !== 'string') return false\n  const zero = to.charCodeAt(0)\n  if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n  return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n  ? React.JSX.IntrinsicElements[TComp]\n  : TComp extends React.ComponentType<any>\n    ? React.ComponentPropsWithoutRef<TComp> &\n        React.RefAttributes<React.ComponentRef<TComp>>\n    : never\n\nexport type UseLinkPropsOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n  LinkComponentReactProps<TComp> & {\n    [key: `data-${string}`]: unknown\n  }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n  /**\n   * A function that returns additional props for the `active` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n   */\n  activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n  /**\n   * A function that returns additional props for the `inactive` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n   */\n  inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  LinkPropsChildren\n\nexport interface LinkPropsChildren {\n  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n  children?:\n    | React.ReactNode\n    | ((state: {\n        isActive: boolean\n        isTransitioning: boolean\n      }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n  UseLinkReactProps<TComp>,\n  keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n  LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n  any,\n  any,\n  string,\n  string,\n  string,\n  string\n>\n\nexport type LinkComponent<\n  in out TComp,\n  in out TDefaultFrom extends string = string,\n> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = TDefaultFrom,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n  in out TDefaultFrom extends string = string,\n> {\n  defaultFrom: TDefaultFrom;\n  <\n    TRouter extends AnyRouter = RegisteredRouter,\n    const TTo extends string | undefined = undefined,\n    const TMaskTo extends string = '',\n  >(\n    props: LinkComponentProps<\n      'a',\n      TRouter,\n      this['defaultFrom'],\n      TTo,\n      this['defaultFrom'],\n      TMaskTo\n    >,\n  ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n  Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n  return React.forwardRef(function CreatedLink(props, ref) {\n    return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n  }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on hover\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n  (props, ref) => {\n    const { _asChild, ...rest } = props\n    const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n    const children =\n      typeof rest.children === 'function'\n        ? rest.children({\n            isActive: (linkProps as any)['data-status'] === 'active',\n          })\n        : rest.children\n\n    if (!_asChild) {\n      // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n      // @ts-expect-error\n      const { disabled: _, ...rest } = linkProps\n      return React.createElement('a', rest, children)\n    }\n    return React.createElement(_asChild, linkProps, children)\n  },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n  return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n  TOptions,\n  TComp,\n  TRouter extends AnyRouter = RegisteredRouter,\n> =\n  TOptions extends ReadonlyArray<any>\n    ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n    : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n  const TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n>(\n  options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n  return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,aAOd,SACA,cACkC;CAClC,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,WAAW,cAAA,gBAAgB,aAAa;CAG9C,MAAM,YAAY,+BAAA,YAAY,OAAO;CAErC,MAAM,EAEJ,aACA,eACA,eACA,IACA,SAAS,aACT,cAAc,kBACd,oBACA,SACA,iBACA,aACA,gBAEA,UACA,QACA,UACA,OACA,WACA,SACA,QACA,SACA,cACA,cACA,cACA,eAEA,QAAQ,SACR,QAAQ,SACR,MAAM,OACN,OAAO,QACP,MAAM,OACN,gBAAgB,iBAChB,gBAAgB,iBAChB,MAAM,OACN,eACA,GAAG,sBACD;AAaJ,KAAI,WAAW;EACb,MAAM,eAAe,eAAe,GAAG;AAIvC,MACE,OAAO,OAAO,YACd,CAAC,gBAED,GAAG,QAAQ,IAAI,GAAG,GAElB,KAAI;AACF,OAAI,IAAI,GAAG;AACX,QAAA,GAAA,sBAAA,qBAAwB,IAAI,OAAO,kBAAkB,EAAE;AACrD,QAAA,QAAA,IAAA,aAA6B,aAC3B,SAAQ,KAAK,yCAAyC,KAAK;AAE7D,WAAO;KACL,GAAG;KACH,KAAK;KACL,MAAM,KAAA;KACN,GAAI,YAAY,EAAE,UAAU;KAC5B,GAAI,UAAU,EAAE,QAAQ;KACxB,GAAI,YAAY,EAAE,UAAU;KAC5B,GAAI,SAAS,EAAE,OAAO;KACtB,GAAI,aAAa,EAAE,WAAW;KAC/B;;AAGH,U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