/** * URL canonicalization (DESIGN D4, ADR-0004 §5). * * Pure, identity-only normalization used solely as the Map key for * cross-arm (and cross-sub-query) result dedupe in search merge. The * emitted `url` on every result is the first writer's original string; * `canonicalUrl` exists to identify "same URL across providers" — not * to present a prettier URL to the user. * * Rules (DESIGN D4): * - lowercase scheme + host (the WHATWG URL parser handles both) * - strip default ports: `:443` for https, `:80` for http (also * already done by the WHATWG parser — `parsed.host` never carries * a scheme-default port) * - strip the URL fragment * - strip a trailing `/` from the path (the root `/` is preserved) * - remove `utm_*` and `fbclid` query parameters — each parameter * NAME is percent-decoded before the match (`?%66bclid=x` * collapses with `?fbclid=x`), while the surviving raw pairs keep * their exact bytes and order * - relative or malformed inputs pass through verbatim — identity * must never throw, so the Map key for an unparseable string is * the string itself * * Everything NOT in that list is preserved verbatim: the raw path is * re-sliced from the input (WHATWG collapses dot segments — * `/a/../b` → `/b` — a normalization D4 does not authorize) and * userinfo is kept in the key (D4 authorizes dropping no authority * component, so `https://user@host/a` and `https://host/a` stay * distinct identities). The re-slice locates the authority under the * WHATWG parser's own boundary rules: special schemes accept any * slash/backslash separator run before the authority (and `\` * terminates it), so parser-equivalent spellings of one URL — * `https:///host/p`, `https:/\host/p`, `https:host/p` — collapse to a * single identity without duplicating host text or inventing userinfo. * * One widening beyond the parser (fusion plan D3, resolving the gate * formerly recorded here): the identity KEY collapses the direct www * alias of a two-label apex host — `www.example.com` keys as * `example.com`. The emitted `url` stays verbatim; only the Map key * changes. Deeper subdomains stay distinct by the two-label rule: * `www.blog.example.com`, `blog.example.com`, and `www.bbc.co.uk` * keep their own keys (deterministic, no public-suffix-list * dependency). Single-label remainders (`www.localhost`) do not * strip. Origin semantics for every other consumer of these URLs are * unchanged — this rule lives in `canonicalUrl` only. */ export declare function canonicalUrl(input: string): string; //# sourceMappingURL=url.d.ts.map