export { OVERLAY_RULES } from "./overlay.js"; export { bareYoutubeVideoId, SITES, type SiteAdapter, siteFor, youtubeThumbnailUrl, youtubeTimestampUrl, youtubeUrl, youtubeVideoId, } from "./sites.js"; export { TIDY_RULES, TIDY_VERSION, type TrackingProvider, } from "./tidy-rules.js"; export interface StripOptions { /** Extra param names to strip (compared lowercased), for app-specific junk. */ strip?: readonly string[]; } export interface UrlsInOptions extends StripOptions { /** Drop scheme-less matches (`example.com/x`) instead of coercing them to https://. */ requireScheme?: boolean; } /** One URL resolved from text: every layer of the funnel, answered once. */ export interface Url { /** Exactly the text that matched (punctuation and tracking still on it). */ raw: string; /** Span of the raw match in the input text (cut links out of a message). */ start: number; end: number; /** False when the scanner inferred the link from a bare domain (`example.com/x`). */ hadScheme: boolean; /** The cleaned absolute URL — fetch, share, and display this. */ href: string; /** The www-less host. */ host: string; /** The recognized service owning the host ("youtube"), or null. */ site: string | null; /** The service's native content id (a YouTube video id), or null. */ id: string | null; /** Canonical identity for caches/dedupe: every spelling of one resource collides. */ key: string; } /** * Every http(s) URL in free text, in order, fully resolved. Duplicate * spellings are kept (spans matter); dedupe is one line on `key`. */ export declare function urlsIn(text: string, opts?: UrlsInOptions): Url[]; /** One pasted token / URL string as a resolved {@link Url}, or null. */ export declare function urlOf(token: string, opts?: UrlsInOptions): Url | null; /** A URL's host without a leading www., or the input unchanged if it won't parse. */ export declare function hostOf(url: string): string; /** * True if `host` IS `domain` or a subdomain of it — never a lookalike suffix * (`notyoutube.com` doesn't match `youtube.com`). RFC 6265 §5.1.3 domain- * matching semantics, the same rule cookies use. */ export declare function hostMatches(host: string, domain: string): boolean; /** * The same URL minus tracking params: safe to fetch, share, and display. * Unparseable or non-http(s) input is returned unchanged. */ export declare function cleanUrl(url: string, opts?: StripOptions): string; /** * A canonical identity for the resource behind `url`, for cache keys and * dedupe. A recognized site's content collapses to its native id * ("youtube:dQw4w9WgXcQ" — watch, youtu.be, shorts, live, embed, all one * key); everything else canonicalizes to `host/path?sortedQuery`, * scheme-agnostic, www-less, tracking-stripped, fragment-free. Unparseable * or non-http(s) input is returned unchanged so it still keys consistently. */ export declare function urlKey(url: string, opts?: StripOptions): string; /** * True if `name` is a tracking param — globally, or on `host` specifically. * Providers that match on the full URL (matchHref) need more context than a * host and are skipped here; `cleanUrl`/`urlKey` do honor them. */ export declare function isTrackingParam(name: string, host?: string): boolean; //# sourceMappingURL=index.d.ts.map