declare const BOT_CATEGORY: Readonly<{ SEARCH: "search"; AI_TRAINING: "ai-training"; AI_ASSISTANT: "ai-assistant"; AI_AGENT: "ai-agent"; SOCIAL_PREVIEW: "social-preview"; MONITORING: "monitoring"; ADVERTISING: "advertising"; ARCHIVING: "archiving"; SEO: "seo"; SECURITY: "security"; SECURITY_SCANNER: "security-scanner"; AUTOMATION: "automation"; PAYMENT: "payment"; PERFORMANCE: "performance"; LINK_VALIDATOR: "link-validator"; FEED: "feed"; GENERIC: "generic"; }>; /** * Parse a User-Agent string and optional Client Hints headers. * Results are cached (LRU) and lazily computed per section. * * import { parse } from '@exortek/ua'; * * const result = parse('Mozilla/5.0 ...'); * console.log(result.browser.name); // 'Chrome' * console.log(result.os.name); // 'Windows' * console.log(result.device.type); // 'mobile' * * // With Client Hints (server-side) * const result2 = parse(req.headers['user-agent'], { * headers: req.headers, * }); * * @param {string} ua * @param {ParseOptions} [options] * @returns {UAResult} */ declare function parse(ua: string, options?: ParseOptions): UAResult; /** * Parse only the browser portion. * * @param {string} ua * @returns {BrowserResult} */ declare function parseBrowser(ua: string): BrowserResult; /** * Parse only the OS portion. * * @param {string} ua * @returns {OSResult} */ declare function parseOS(ua: string): OSResult; /** * Parse only the device portion. * * @param {string} ua * @returns {DeviceResult} */ declare function parseDevice(ua: string): DeviceResult; /** * Parse only the engine portion. * * @param {string} ua * @returns {EngineResult} */ declare function parseEngine(ua: string): EngineResult; /** * Parse only the CPU portion. * * @param {string} ua * @returns {CPUResult} */ declare function parseCPU(ua: string): CPUResult; /** * Detect whether a UA string uses Chrome's frozen/reduced format. * Chrome 107+ sends a reduced UA where the version is locked and * platform info is generalized. When true, Client Hints are required * for accurate browser version and OS detection. * * if (isFrozenUA(ua)) { * // Must use Client Hints for accurate version/OS * } * * @param {string} ua * @returns {boolean} */ declare function isFrozenUA(ua: string): boolean; /** * Compare a parse result against version conditions. * * import { parse, satisfies } from '@exortek/ua'; * * const r = parse(ua); * satisfies(r, { chrome: '>=120', firefox: '>=115' }); * satisfies(r, { mobile: { safari: '>=16' } }); * * @param {UAResult} result * @param {Record>} conditions * @returns {boolean} */ declare function satisfies(result: UAResult, conditions: Record>): boolean; /** * Clear the internal parse cache. */ declare function clearCache(): void; /** * The `Accept-CH` header value to send so browsers provide * high-entropy Client Hints. Set this on every response: * * res.setHeader('Accept-CH', ACCEPT_CH); * * The middleware adapters do this automatically. * * @type {string} */ declare const ACCEPT_CH: string; /** * The `Vary` header value to add when the response depends on * Client Hints. Required for correct CDN/proxy caching: * * res.setHeader('Vary', VARY_CH); * * @type {string} */ declare const VARY_CH: string; type BrowserResult = { name?: string | undefined; version?: string | undefined; major?: string | undefined; type?: string | undefined; }; type OSResult = { name?: string | undefined; version?: string | undefined; }; type DeviceResult = { type?: string | undefined; vendor?: string | undefined; model?: string | undefined; }; type EngineResult = { name?: string | undefined; version?: string | undefined; }; type CPUResult = { architecture?: string | undefined; }; type UAResult = { ua: string; browser: BrowserResult; os: OSResult; device: DeviceResult; engine: EngineResult; cpu: CPUResult; }; type ParseOptions = { headers?: Record | undefined; clientHints?: boolean | undefined; }; export { ACCEPT_CH, BOT_CATEGORY, VARY_CH, clearCache, isFrozenUA, parse, parseBrowser, parseCPU, parseDevice, parseEngine, parseOS, satisfies }; export type { BrowserResult, CPUResult, DeviceResult, EngineResult, OSResult, ParseOptions, UAResult };