
import { Disposable } from '../../../../base/common/lifecycle.js';
import { localize } from '../../../../nls.js';
import { AccessibleViewType, AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js';
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from './webview.js';
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';

class WebviewFindAccessibilityHelp {
    constructor() {
        this.priority = 105;
        this.name = "webview-find";
        this.type = AccessibleViewType.Help;
        this.when = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED;
    }
    getProvider(accessor) {
        return ( new WebviewFindAccessibilityHelpProvider());
    }
}
class WebviewFindAccessibilityHelpProvider extends Disposable {
    constructor() {
        super(...arguments);
        this.id = AccessibleViewProviderId.WebviewFindHelp;
        this.verbositySettingKey = AccessibilityVerbositySettingId.Find;
        this.options = {
            type: AccessibleViewType.Help
        };
    }
    onClose() {}
    provideContent() {
        const content = [];
        content.push(( localize(15100, "Accessibility Help: Webview Find")));
        content.push(( localize(
            15101,
            "You are in the Find input for embedded web content. This could be a Markdown preview, a documentation viewer, or a web-based extension interface."
        )));
        content.push("");
        content.push(( localize(15102, "Current Search Status:")));
        content.push(( localize(15103, "You are searching the web content.")));
        content.push("");
        content.push(( localize(15104, "Inside the Webview Find Input (What It Does):")));
        content.push(( localize(
            15105,
            "While you are in the Find input, your focus stays in the field. You can type, edit your search term, or navigate matches without leaving the input. When you navigate to a match, the webview updates to show it, but your focus remains in the Find input."
        )));
        content.push("");
        content.push(( localize(15106, "What You Hear Each Time You Move to a Match:")));
        content.push(( localize(15107, "Each navigation step gives you a complete spoken update:")));
        content.push(( localize(
            15108,
            "1) The content containing the match is read first, so you get immediate context."
        )));
        content.push(( localize(
            15109,
            "2) Your position among the matches is announced, so you know how far you are through the results."
        )));
        content.push(( localize(
            15110,
            "3) The exact location information is announced so you know where the match is."
        )));
        content.push("");
        content.push(( localize(15111, "Focus Behavior (Important):")));
        content.push(( localize(
            15112,
            "When you navigate from the Webview Find input, the content updates in the background while your focus stays in the input. This is intentional, so you can keep refining your search without losing your place."
        )));
        content.push(( localize(
            15113,
            "The webview may scroll to show the match, depending on how it is designed."
        )));
        content.push(( localize(
            15114,
            "If you want to close Find and return focus to the webview content, press Escape. Focus moves back into the webview."
        )));
        content.push("");
        content.push(( localize(15115, "Keyboard Navigation Summary:")));
        content.push("");
        content.push(( localize(15116, "While focused IN the Find input:")));
        content.push(( localize(15117, "- Enter: Move to the next match while staying in the Find input.")));
        content.push(( localize(
            15118,
            "- Shift+Enter: Move to the previous match while staying in the Find input."
        )));
        content.push("");
        content.push(( localize(15119, "Find Options:")));
        content.push(( localize(15120, "- Match Case: Only exact case matches are included.")));
        content.push(( localize(15121, "- Whole Word: Only full words are matched.")));
        content.push(( localize(15122, "- Regular Expression: Use pattern matching for advanced searches.")));
        content.push("");
        content.push(( localize(15123, "Important About Webviews:")));
        content.push(( localize(
            15124,
            "Some webviews intercept keyboard input before VS Code's Find can use it. If Enter or Shift+Enter do not navigate matches, the webview may be handling those keys. Try clicking or tabbing into the webview content first to ensure the webview has focus, then reopen Find and try navigation again."
        )));
        content.push("");
        content.push(( localize(
            15125,
            "Settings You Can Adjust ({0} opens Settings):",
            "<keybinding:workbench.action.openSettings>"
        )));
        content.push(( localize(
            15126,
            "Webview Find has minimal configuration. Most behavior depends on the webview itself."
        )));
        content.push(( localize(
            15127,
            "- `accessibility.verbosity.find`: Controls whether the Webview Find input announces the Accessibility Help hint."
        )));
        content.push("");
        content.push(( localize(15128, "Closing:")));
        content.push(( localize(
            15129,
            "Press Escape to close Webview Find. Focus moves back into the webview content, and your search history is available on next Find."
        )));
        return content.join("\n");
    }
}

export { WebviewFindAccessibilityHelp };
