import type { ChannelSelectionProfile, ChannelSelectorResult, ClickTarget, Nullable, ProviderModule, ResolvedSiteProfile } from "../types/index.js"; import type { Page } from "puppeteer-core"; /** * Returns a direct watch URL for the channel specified in the profile, if one can be resolved. Looks up the strategy entry's resolveDirectUrl hook and calls it * with the channelSelector and page. Returns null if the strategy has no resolver, the profile has no channelSelector, or the resolver returns null. * @param profile - The resolved site profile. * @param page - The Puppeteer page object, passed through to the strategy's resolver for response interception setup or API calls. * @returns The direct watch URL or null. */ export declare function resolveDirectUrl(profile: ResolvedSiteProfile, page: Page): Promise>; /** * Invalidates the cached direct watch URL for the channel specified in the profile. Looks up the strategy entry's invalidateDirectUrl hook and calls it with * the channelSelector. No-op if the strategy has no invalidator or the profile has no channelSelector. * @param profile - The resolved site profile. */ export declare function invalidateDirectUrl(profile: ResolvedSiteProfile): void; /** * Clears all channel selection caches. Called by handleBrowserDisconnect() in browser/index.ts when the browser restarts, since cached state (guide row positions, * discovered page URLs, watch URLs) may be stale in a new browser session. */ export declare function clearChannelSelectionCaches(): void; /** * Looks up a provider module by its URL slug. Returns undefined if no provider matches. * @param slug - The provider slug (e.g., "yttv", "hulu", "sling"). * @returns The matching provider module or undefined. */ export declare function getProviderBySlug(slug: string): ProviderModule | undefined; /** * Returns all registered provider module slugs. Used for validation in the checkboxList setting for precache providers. * @returns Array of provider slugs. */ export declare function getProviderSlugs(): string[]; /** * Returns slug and label pairs for all registered provider modules. Used by the checkboxList setting to render precache provider checkbox labels. * @returns Array of objects with label and slug properties. */ export declare function getProviderModuleInfo(): { label: string; slug: string; }[]; /** * Returns a mapping of provider guide URL hostnames to provider slugs for all registered provider modules. Used by the channels panel to embed a client-side * lookup table so the browser can fetch provider channel discovery by slug when the user enters a matching URL. * @returns Record mapping hostnames to provider slugs. */ export declare function getProviderDomainMap(): Record; /** * Returns a map of provider slugs to their guide URLs. Used client-side to suggest the correct full URL when a user enters a bare or www-variant hostname. * @returns Record mapping provider slug to guide URL. */ export declare function getProviderGuideUrls(): Record; /** * Returns cached discovered channels from all provider modules, grouped by guide URL hostname. Each entry includes the hostname and an array of label/value pairs * suitable for datalist population. Only includes providers whose cache is non-null (i.e., discovery or precaching has already run). Used by the channels panel * to merge provider-discovered channels into the channel selector datalist alongside predefined channel suggestions. * @returns Array of objects with hostname and entries properties. */ export declare function getCachedProviderChannels(): { entries: { label: string; value: string; }[]; hostname: string; }[]; /** * Clicks at the specified coordinates after a brief settle delay. The delay allows scroll animations and lazy-loaded content to finish before the click fires. * Callers are responsible for scrolling the target element into view (typically via scrollIntoView inside a page.evaluate call) before invoking this function. * Exported for use by tuning strategy files (thumbnailRow, tileClick, hulu). * @param page - The Puppeteer page object. * @param target - The x/y coordinates to click. * @returns True if the click was executed. */ export declare function scrollAndClick(page: Page, target: ClickTarget): Promise; export declare function normalizeChannelName(name: string): string; export declare function resolveMatchSelector(profile: ChannelSelectionProfile): string; /** * Logs available channel names from a provider's guide grid when channel selection fails. Produces an actionable log message listing channel names that users can * use as `channelSelector` values in user-defined channels. When `presetSuffix` is provided, channels already covered by built-in preset definitions are filtered * out so users see only channels that require manual configuration. When omitted (small channel sets like Fox or HBO), all channels are logged unfiltered. * @param options - Diagnostic dump configuration. * @param options.additionalKnownNames - Extra names to exclude from the filtered list (e.g., CHANNEL_ALTERNATES values for YTTV). * @param options.availableChannels - Sorted list of channel names discovered in the guide grid. * @param options.channelName - The channelSelector value that failed to match, for the log message. * @param options.guideUrl - The URL of the provider's guide page, included in the log message so users know what to set as the channel URL. * @param options.presetSuffix - Key suffix to filter preset channels (e.g., "-yttv", "-hulu"). Omit for small unfiltered channel sets. * @param options.providerName - Human-readable provider name for the log message (e.g., "YouTube TV", "Hulu"). */ export declare function logAvailableChannels(options: { additionalKnownNames?: string[]; availableChannels: string[]; channelName: string; guideUrl: string; presetSuffix?: string; providerName: string; }): void; /** * Selects a channel from a multi-channel player UI using the strategy specified in the profile. This is the main entry point for channel selection, called by * tuneToChannel() after page navigation. * * The function handles: * - Pre-selection scroll phase to force lazy-loaded content into the DOM (when scrollToBottom or scrollSelector+scrollTarget is set) * - Polling for channel element readiness before strategy dispatch (when profile.channelSelection.matchSelector is set) * - Strategy dispatch based on profile.channelSelection.strategy * - No-op for single-channel sites (strategy "none" or no channelSelector) * - Logging of selection attempts and results * @param page - The Puppeteer page object. * @param profile - The resolved site profile containing channelSelection config and channelSelector slug. * @returns Result object with success status and optional failure reason. */ export declare function selectChannel(page: Page, profile: ResolvedSiteProfile): Promise;