<!-- source-hash: 1b020dd80f0099498e2af194cf845b64 -->
Handles embed-mode URL resolution and external navigation for chat panel link interactions, ensuring relative paths are correctly absolutized against the embedder-supplied content origin and opened safely in new tabs.

## Key Components

| Export | Type | Description |
|--------|------|-------------|
| `NEW_TAB_FEATURES` | `const` | Window features string (`noopener,noreferrer`) for reverse-tabnabbing prevention |
| `isModifierClick` | `function` | Detects cmd/ctrl/shift/alt or non-primary button clicks |
| `stripSameOriginToPath` | `function` | Strips origin from same-origin absolute URLs, returning a router-friendly relative path |
| `resolveHrefForRuntime` | `function` | Pre-resolves hrefs against `defaultContentOrigin` in embed mode; no-op in host mode |
| `resolveExternalNavigation` | `function` | Full resolution pipeline — absolutizes href, handles protocol-relative guards, returns an inline-callable `open()` |
| `ExternalNavResolution` | `interface` | Return type: resolved `href` + synchronous `open()` invoker |

## Usage Example

```typescript
import {
  resolveExternalNavigation,
  resolveHrefForRuntime,
  isModifierClick,
} from './chat-nav-resolution'

// Pre-render: absolutize href so modifier-click / status bar shows correct URL
const resolvedHref = resolveHrefForRuntime('/knowledge-base/article.md', runtime)
// embed mode + defaultContentOrigin="https://hub.example.com"
// → "https://hub.example.com/knowledge-base/article.md"

// onClick handler
function handleChipClick(e: React.MouseEvent, href: string) {
  if (isModifierClick(e)) return // let browser handle natively (already absolute)

  const { open } = resolveExternalNavigation({
    href,
    targetPlatform: 'hub',
    runtime,
  })
  open() // must be called synchronously inside user gesture
}
```

## Notes

- `resolveExternalNavigation` uses an explicit `if/else` (not `??`) when invoking `openExternal` to avoid a double-open bug where a `void` return would fall through to `window.open`.
- Protocol-relative URLs (`//evil.com/path`) are normalized to `https://` before processing to prevent open-redirect vulnerabilities.
- In embed mode, relative hrefs without a `defaultContentOrigin` emit a `console.warn` in non-production environments.