import type { ResourceProfileFilterSettings } from "./settings-manager.ts"; /** * Decode a stored allow/block filter into the set of enabled resource ids, * given the full universe of ids for that kind. * - undefined / empty filter -> all enabled * - block contains "*" -> none enabled * - allow non-empty -> exactly the allow entries that exist in allIds * - block of specific ids (no "*") -> all ids except blocked ones * (If both allow and block specific ids are present: start from allow-or-all, then remove blocked.) */ export declare function decodeResourceSelection(filter: ResourceProfileFilterSettings | undefined, allIds: string[]): Set; export interface ResourceSelectionIdentity { id: string; } export interface RemappedResourceSelectionFilter { filter: ResourceProfileFilterSettings | undefined; missingIds: Set; } /** * Resolve persisted profile patterns onto the editor's collision-safe resource ids. * * Runtime filters intentionally accept basenames, parent directory names, globs, and paths. The * editor, however, must toggle one concrete resource at a time. This remap expands every matching * pattern to the concrete ids it currently selects and preserves only genuinely missing patterns. * Saving then migrates ambiguous legacy patterns (for example `index.ts`) to exact concrete ids. */ export declare function remapResourceSelectionFilter(filter: ResourceProfileFilterSettings | undefined, items: readonly T[], matchesPattern: (item: T, pattern: string) => boolean): RemappedResourceSelectionFilter; /** * Options that let the encoder distinguish a genuine grant-all from an all-enabled snapshot of an * enumerated grant (e.g. a collapsed universe where every enumerated id happens to be visible). * - originalFilter: the filter the selection was decoded from. A wildcard is preserved as a * wildcard; an enumerated grant is NEVER widened into one. * - grantAll: the caller explicitly chose "grant all (including future)" — force the wildcard. */ export interface EncodeResourceSelectionOptions { originalFilter?: ResourceProfileFilterSettings; grantAll?: boolean; } /** * Encode an enabled set back into a filter. * - all enabled -> enumerated { allow: [...allIds] } (or { allow: ["*"] } only when the * original was already a wildcard / the caller chose grant-all) * - some but not all -> { allow: [...enabled, in allIds order] } * - none enabled -> { block: ["*"] } */ export declare function encodeResourceSelection(enabled: Set, allIds: string[], options?: EncodeResourceSelectionOptions): ResourceProfileFilterSettings | undefined; export type ResourceFraming = "allow" | "block"; /** * Detect the framing of a given resource profile filter settings. */ export declare function detectResourceFraming(filter: ResourceProfileFilterSettings | undefined): ResourceFraming; /** * Encode an enabled set back into a filter, respecting the specified framing. */ export declare function encodeResourceSelectionWithFraming(enabled: Set, allIds: string[], framing: ResourceFraming, options?: EncodeResourceSelectionOptions): ResourceProfileFilterSettings | undefined; //# sourceMappingURL=profile-resource-selection.d.ts.map