/**
 * Artifact frame-selector roles — the single source of truth.
 *
 * Frames are detected by CSS selector in three distinct ROLES. They are
 * deliberately not one constant: the stepper/export role includes bare
 * `.slide` (defense-in-depth for decks authored before the
 * `data-artifact-frame` contract), while the selection role excludes it so
 * arbitrary `.slide`-classed elements never become selection frames.
 *
 *  - STEPPER: which elements page in fullscreen/present and in the
 *    standalone export runtime. Honors the bundle's explicit
 *    `display.controls.stepper.selector` override.
 *  - EXPORT: which elements become per-frame screenshots/PDF pages in the
 *    Playwright render path. Same chain as STEPPER (one frame vocabulary
 *    across present + export).
 *  - SELECTION: which ancestors count as the containing frame when
 *    attributing an element selection in the editor canvas.
 */
export const FRAME_STEPPER_FALLBACK_SELECTOR = '[data-artifact-frame], [data-artifact-page], [data-artifact-slide], .slide, .page';
export const FRAME_EXPORT_FALLBACK_SELECTOR = FRAME_STEPPER_FALLBACK_SELECTOR;
export const FRAME_SELECTION_SELECTOR = '[data-artifact-frame],[data-artifact-page],[data-artifact-slide],.page';
/** Resolve the stepper/export selector: a non-empty explicit override wins,
 *  anything else (undefined, empty, whitespace) falls back to the shared
 *  chain. Centralizes the trim/empty handling that previously differed
 *  between call sites. */
export function frameStepperSelector(explicit) {
    if (typeof explicit === 'string' && explicit.trim())
        return explicit.trim();
    return FRAME_STEPPER_FALLBACK_SELECTOR;
}
/**
 * Fullscreen/present hide-show CSS for stepper frames, generated from the
 * RESOLVED stepper selector. The stepper JS detects frames via this selector,
 * so the CSS that hides inactive frames must target the same elements — a
 * hardcoded `[data-artifact-frame]` rule next to a broader detection chain
 * left `.slide`/`.page`/explicit-selector decks advancing their counter while
 * every frame stayed visible.
 *
 * The active frame wins by appending `[data-studiograph-active-frame]` to each
 * branch (one attribute of extra specificity beats the hide rule regardless of
 * rule order, including id-bearing explicit selectors). Limitations, by
 * design: top-level comma splitting only (commas inside `:is()`/`:not()` are
 * not supported in stepper selectors), and branches containing CSS-invalid
 * `<>{}` characters are dropped defensively.
 */
export function frameStepperVisibilityCss(selector, scope) {
    const branches = selector
        .split(',')
        .map((branch) => branch.trim())
        .filter((branch) => branch && !/[<>{}]/.test(branch));
    if (branches.length === 0)
        return '';
    const hide = branches.map((branch) => `${scope} ${branch}`).join(',\n');
    const show = branches.map((branch) => `${scope} ${branch}[data-studiograph-active-frame]`).join(',\n');
    return `${hide} {
  display: none !important;
  position: absolute !important;
  inset: 0 auto auto 0 !important;
  margin: 0 !important;
}
${show} {
  display: block !important;
}`;
}
//# sourceMappingURL=artifact-frame-selectors.js.map