accessibility-plugin-react 2.12.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -22,10 +22,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  // src/index.ts
23
23
  var index_exports = {};
24
24
  __export(index_exports, {
25
+ ALLOWED_PREFERENCE_KEYS: () => ALLOWED_PREFERENCE_KEYS,
26
+ ALL_PROFILE_IDS: () => ALL_PROFILE_IDS,
25
27
  AccessibilityButton: () => AccessibilityButton,
26
28
  AccessibilityContext: () => AccessibilityContext,
27
29
  AccessibilityList: () => AccessibilityList,
28
30
  AccessibilityPlugin: () => AccessibilityPlugin,
31
+ AccessibilityProfilesController: () => AccessibilityProfilesController,
32
+ AccessibleTooltipsController: () => AccessibleTooltipsController,
29
33
  BigCursorController: () => BigCursorController,
30
34
  CONTRAST_MODES: () => CONTRAST_MODES,
31
35
  CONTRAST_PALETTES: () => CONTRAST_PALETTES,
@@ -33,6 +37,7 @@ __export(index_exports, {
33
37
  ChoiceControl: () => ChoiceControl,
34
38
  ContrastController: () => ContrastController,
35
39
  ContrastModeController: () => ContrastModeController,
40
+ CustomPresetsController: () => CustomPresetsController,
36
41
  DEFAULT_PREFERENCES: () => DEFAULT_PREFERENCES,
37
42
  DEFAULT_READING_MASK_HEIGHT: () => DEFAULT_READING_MASK_HEIGHT,
38
43
  DYSLEXIA_FONT_STACK: () => DYSLEXIA_FONT_STACK,
@@ -45,6 +50,7 @@ __export(index_exports, {
45
50
  FontFamilyController: () => FontFamilyController,
46
51
  FontSizeController: () => FontSizeController,
47
52
  GrayscaleController: () => GrayscaleController,
53
+ HeadingsNavigatorController: () => HeadingsNavigatorController,
48
54
  HideDecorativeImagesController: () => HideDecorativeImagesController,
49
55
  HideImagesController: () => HideImagesController,
50
56
  HideVideosController: () => HideVideosController,
@@ -59,8 +65,14 @@ __export(index_exports, {
59
65
  MAX_READING_MASK_HEIGHT: () => MAX_READING_MASK_HEIGHT,
60
66
  MIN_READING_MASK_HEIGHT: () => MIN_READING_MASK_HEIGHT,
61
67
  PROFILE_DEFINITIONS: () => PROFILE_DEFINITIONS,
68
+ PageNavigatorController: () => PageNavigatorController,
69
+ PageStructureController: () => PageStructureController,
62
70
  ParagraphSpacingController: () => ParagraphSpacingController,
71
+ PresetsBackupController: () => PresetsBackupController,
72
+ PresetsController: () => PresetsController,
73
+ ProfileController: () => ProfileController,
63
74
  ProfilePreviewCard: () => ProfilePreviewCard,
75
+ ProfilesController: () => ProfilesController,
64
76
  READING_MASK_HEIGHT_PRESETS: () => READING_MASK_HEIGHT_PRESETS,
65
77
  ReadingGuideController: () => ReadingGuideController,
66
78
  ReadingMaskController: () => ReadingMaskController,
@@ -68,6 +80,7 @@ __export(index_exports, {
68
80
  ResetController: () => ResetController,
69
81
  SaturationController: () => SaturationController,
70
82
  SearchCount: () => SearchCount,
83
+ SettingsImportExportController: () => SettingsImportExportController,
71
84
  SkipToMainLink: () => SkipToMainLink,
72
85
  StepperControl: () => StepperControl,
73
86
  TEXT_ALIGN_BLOCK_SELECTOR: () => TEXT_ALIGN_BLOCK_SELECTOR,
@@ -77,10 +90,19 @@ __export(index_exports, {
77
90
  TextAlignController: () => TextAlignController,
78
91
  TextScaleController: () => TextScaleController,
79
92
  ToggleControl: () => ToggleControl,
93
+ TooltipsController: () => TooltipsController,
80
94
  WordSpacingController: () => WordSpacingController,
95
+ applyCustomPresetToStore: () => applyCustomPresetToStore,
96
+ applyProfileToStore: () => applyProfileToStore,
97
+ createCustomPreset: () => createCustomPreset,
81
98
  createInitialPreferencesState: () => createInitialPreferencesState,
99
+ downloadJsonFile: () => downloadJsonFile,
82
100
  enLocale: () => enLocale,
101
+ enableAccessibleTooltips: () => enableAccessibleTooltips,
102
+ exportPresetsToJson: () => exportPresetsToJson,
83
103
  findMainLandmark: () => findMainLandmark,
104
+ getAuthoredDescription: () => getAuthoredDescription,
105
+ getProfileDefinition: () => getProfileDefinition,
84
106
  getScriptSpacingConstraints: () => getScriptSpacingConstraints,
85
107
  hasFinePointer: () => hasFinePointer,
86
108
  isEligibleDecorativeImage: () => isEligibleDecorativeImage,
@@ -93,17 +115,31 @@ __export(index_exports, {
93
115
  isProtectedFromTextSpacing: () => isProtectedFromTextSpacing,
94
116
  isReducedMotionActive: () => isReducedMotionActive,
95
117
  isRtlLocale: () => isRtlLocale,
118
+ isValidCustomPreset: () => isValidCustomPreset,
119
+ mapFeaturesToProfileSettings: () => mapFeaturesToProfileSettings,
120
+ mapProfileSettingsToFeatures: () => mapProfileSettingsToFeatures,
121
+ navigateToElement: () => navigateToElement,
96
122
  normalizePreferenceValue: () => normalizePreferenceValue,
97
123
  normalizePreferences: () => normalizePreferences,
98
124
  nudgeReadingAid: () => nudgeReadingAid,
125
+ positionTooltip: () => positionTooltip,
99
126
  preferencesReducer: () => preferencesReducer,
127
+ recordProfileOverride: () => recordProfileOverride,
100
128
  registerLocale: () => registerLocale,
101
129
  resolveEffectivePreferences: () => resolveEffectivePreferences,
102
130
  resolveLocaleStrings: () => resolveLocaleStrings,
131
+ revertProfileFromStore: () => revertProfileFromStore,
132
+ sanitizePreferences: () => sanitizePreferences,
133
+ scanHeadings: () => scanHeadings,
134
+ scanLandmarks: () => scanLandmarks,
103
135
  subscribeFinePointer: () => subscribeFinePointer,
104
136
  subscribeForcedColors: () => subscribeForcedColors,
137
+ subscribePageStructure: () => subscribePageStructure,
105
138
  subscribeReducedMotion: () => subscribeReducedMotion,
106
- useAccessibility: () => useAccessibility
139
+ useAccessibility: () => useAccessibility,
140
+ usePresets: () => usePresets,
141
+ useProfiles: () => useProfiles,
142
+ validateAndParseImport: () => validateAndParseImport
107
143
  });
108
144
  module.exports = __toCommonJS(index_exports);
109
145
 
@@ -130,7 +166,7 @@ function styleInject(css, { insertAt } = {}) {
130
166
  }
131
167
 
132
168
  // src/styles/tailwind.css
133
- styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n.arap-skip-to-main {\n position: fixed;\n top: 12px;\n left: 16px;\n z-index: 2147483647;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n pointer-events: none;\n font-family: inherit;\n font-size: 0.9375rem;\n font-weight: 600;\n text-decoration: none;\n color: var(--arap-accent, #008060);\n background: var(--arap-surface, #ffffff);\n border-radius: 8px;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.arap-skip-to-main:focus,\n.arap-skip-to-main:focus-visible {\n width: auto;\n height: auto;\n min-height: 44px;\n margin: 0;\n padding: 10px 18px;\n clip-path: none;\n overflow: visible;\n white-space: normal;\n pointer-events: auto;\n border: 2px solid var(--arap-accent, #008060);\n outline: 3px solid var(--arap-accent, #008060);\n outline-offset: 3px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n@media (forced-colors: active) {\n .arap-skip-to-main {\n background: Canvas;\n color: CanvasText;\n border-color: Highlight;\n }\n .arap-skip-to-main:focus,\n .arap-skip-to-main:focus-visible {\n outline: 3px solid Highlight;\n }\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n.arap-statement {\n flex: none;\n padding-top: 10px;\n text-align: center;\n}\n.arap-statement-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 6px 12px;\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 4px;\n font-size: 14px;\n font-weight: 500;\n border-radius: 8px;\n}\n.arap-statement-link:hover {\n color: var(--arap-accent-hover);\n background: var(--arap-selected);\n}\n.arap-statement-link:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-credits {\n display: flex;\n flex: none;\n flex-direction: column;\n gap: 2px;\n padding-top: 8px;\n color: var(--arap-muted);\n text-align: center;\n font-size: 11px;\n line-height: 1.4;\n}\n.arap-credits a {\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.arap-credits a:hover {\n color: var(--arap-accent-hover);\n}\n.arap-credits a:focus-visible {\n outline: 2px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-root .arap-btn[data-large-controls=true] {\n width: 64px;\n height: 64px;\n min-width: 48px;\n min-height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] {\n width: min(440px, calc(100vw - 32px));\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-heading button {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 32px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-btn-sm {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 24px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-value {\n min-width: 64px;\n font-size: 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-segment {\n min-width: 48px;\n min-height: 48px;\n padding: 10px 14px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle {\n width: 64px;\n height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle::before {\n inset: 8px 0;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-knob {\n top: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-active .arap-toggle-knob {\n transform: translateX(28px);\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-reset-btn {\n min-height: 52px;\n font-size: 16px;\n padding: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-button,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-default,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-arrows button {\n min-width: 48px;\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-popover select {\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-statement-link {\n min-height: 48px;\n font-size: 15px;\n padding: 10px 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-skip-actions {\n min-width: 48px;\n min-height: 48px;\n}\n.arap-feature-card {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n}\n.arap-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-card-title {\n font-weight: 600;\n font-size: 15px;\n color: var(--arap-text);\n}\n.arap-card-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-status-badge {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 11px;\n font-weight: 600;\n background: var(--arap-control);\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-card-alert {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: 8px;\n font-size: 13px;\n line-height: 1.4;\n}\n.arap-alert-icon {\n flex: none;\n font-size: 16px;\n line-height: 1;\n}\n.arap-card-error {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n}\n.arap-card-unavailable {\n background: #f8fafc;\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n}\n.arap-card-permission {\n background: #fffbeb;\n border: 1px solid #fde68a;\n color: #92400e;\n}\n.arap-permission-content {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-permission-btn {\n align-self: flex-start;\n padding: 4px 10px;\n border: 1px solid #d97706;\n border-radius: 6px;\n background: #f59e0b;\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n}\n.arap-permission-btn:hover {\n background: #d97706;\n}\n.arap-card-content {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.arap-choice-group {\n display: flex;\n flex-direction: column;\n gap: 6px;\n width: 100%;\n}\n.arap-choice-group-title {\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-choice-badge {\n font-size: 11px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--arap-divider);\n color: var(--arap-muted);\n}\n.arap-segment-active .arap-choice-badge {\n background: rgba(255, 255, 255, 0.25);\n color: #fff;\n}\n.arap-stepper-control-wrapper {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.arap-slider-container {\n display: flex;\n align-items: center;\n padding: 4px 0;\n}\n.arap-slider {\n width: 100%;\n accent-color: var(--arap-accent);\n cursor: pointer;\n}\n.arap-search-count {\n padding: 6px 0;\n font-size: 12px;\n font-weight: 500;\n color: var(--arap-muted);\n}\n.arap-empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 24px 16px;\n gap: 8px;\n}\n.arap-empty-icon {\n font-size: 32px;\n}\n.arap-empty-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-empty-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n}\n.arap-empty-btn,\n.arap-retry-btn {\n margin-top: 6px;\n padding: 8px 16px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n font-weight: 500;\n font-size: 13px;\n color: var(--arap-text);\n cursor: pointer;\n}\n.arap-empty-btn:hover,\n.arap-retry-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n color: var(--arap-accent);\n}\n.arap-profile-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.arap-profile-card-active {\n border-color: var(--arap-accent);\n background: var(--arap-selected);\n box-shadow: 0 0 0 1px var(--arap-accent);\n}\n.arap-profile-header {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-profile-active-badge {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-accent);\n background: #dbeafe;\n padding: 2px 8px;\n border-radius: 9999px;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-profile-affected {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-profile-affected-label {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.arap-profile-chip {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n border-radius: 6px;\n background: var(--arap-control);\n border: 1px solid var(--arap-divider);\n font-size: 12px;\n color: var(--arap-text);\n}\n.arap-profile-actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n.arap-profile-apply-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-accent);\n color: #fff;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-apply-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-profile-revert-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-muted);\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-revert-btn:hover {\n background: var(--arap-control);\n color: var(--arap-text);\n border-color: var(--arap-text);\n}\n.arap-notice {\n grid-column: 1 / -1;\n margin-top: 6px;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.45;\n background: #fefce8;\n border: 1px solid #fef08a;\n color: #854d0e;\n}\n.arap-notice-warning {\n background: #fffbeb;\n border-color: #fde68a;\n color: #92400e;\n}\n.arap-reading-mask {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-reading-guide {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-feature-expandable {\n flex-direction: column !important;\n align-items: stretch !important;\n}\n');
169
+ styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n.arap-skip-to-main {\n position: fixed;\n top: 12px;\n left: 16px;\n z-index: 2147483647;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n pointer-events: none;\n font-family: inherit;\n font-size: 0.9375rem;\n font-weight: 600;\n text-decoration: none;\n color: var(--arap-accent, #008060);\n background: var(--arap-surface, #ffffff);\n border-radius: 8px;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.arap-skip-to-main:focus,\n.arap-skip-to-main:focus-visible {\n width: auto;\n height: auto;\n min-height: 44px;\n margin: 0;\n padding: 10px 18px;\n clip-path: none;\n overflow: visible;\n white-space: normal;\n pointer-events: auto;\n border: 2px solid var(--arap-accent, #008060);\n outline: 3px solid var(--arap-accent, #008060);\n outline-offset: 3px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n@media (forced-colors: active) {\n .arap-skip-to-main {\n background: Canvas;\n color: CanvasText;\n border-color: Highlight;\n }\n .arap-skip-to-main:focus,\n .arap-skip-to-main:focus-visible {\n outline: 3px solid Highlight;\n }\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n.arap-statement {\n flex: none;\n padding-top: 10px;\n text-align: center;\n}\n.arap-statement-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 6px 12px;\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 4px;\n font-size: 14px;\n font-weight: 500;\n border-radius: 8px;\n}\n.arap-statement-link:hover {\n color: var(--arap-accent-hover);\n background: var(--arap-selected);\n}\n.arap-statement-link:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-credits {\n display: flex;\n flex: none;\n flex-direction: column;\n gap: 2px;\n padding-top: 8px;\n color: var(--arap-muted);\n text-align: center;\n font-size: 11px;\n line-height: 1.4;\n}\n.arap-credits a {\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.arap-credits a:hover {\n color: var(--arap-accent-hover);\n}\n.arap-credits a:focus-visible {\n outline: 2px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-root .arap-btn[data-large-controls=true] {\n width: 64px;\n height: 64px;\n min-width: 48px;\n min-height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] {\n width: min(440px, calc(100vw - 32px));\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-heading button {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 32px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-btn-sm {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 24px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-value {\n min-width: 64px;\n font-size: 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-segment {\n min-width: 48px;\n min-height: 48px;\n padding: 10px 14px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle {\n width: 64px;\n height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle::before {\n inset: 8px 0;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-knob {\n top: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-active .arap-toggle-knob {\n transform: translateX(28px);\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-reset-btn {\n min-height: 52px;\n font-size: 16px;\n padding: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-button,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-default,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-arrows button {\n min-width: 48px;\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-popover select {\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-statement-link {\n min-height: 48px;\n font-size: 15px;\n padding: 10px 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-skip-actions {\n min-width: 48px;\n min-height: 48px;\n}\n.arap-feature-card {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n}\n.arap-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-card-title {\n font-weight: 600;\n font-size: 15px;\n color: var(--arap-text);\n}\n.arap-card-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-status-badge {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 11px;\n font-weight: 600;\n background: var(--arap-control);\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-card-alert {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: 8px;\n font-size: 13px;\n line-height: 1.4;\n}\n.arap-alert-icon {\n flex: none;\n font-size: 16px;\n line-height: 1;\n}\n.arap-card-error {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n}\n.arap-card-unavailable {\n background: #f8fafc;\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n}\n.arap-card-permission {\n background: #fffbeb;\n border: 1px solid #fde68a;\n color: #92400e;\n}\n.arap-permission-content {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-permission-btn {\n align-self: flex-start;\n padding: 4px 10px;\n border: 1px solid #d97706;\n border-radius: 6px;\n background: #f59e0b;\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n}\n.arap-permission-btn:hover {\n background: #d97706;\n}\n.arap-card-content {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.arap-choice-group {\n display: flex;\n flex-direction: column;\n gap: 6px;\n width: 100%;\n}\n.arap-choice-group-title {\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-choice-badge {\n font-size: 11px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--arap-divider);\n color: var(--arap-muted);\n}\n.arap-segment-active .arap-choice-badge {\n background: rgba(255, 255, 255, 0.25);\n color: #fff;\n}\n.arap-stepper-control-wrapper {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.arap-slider-container {\n display: flex;\n align-items: center;\n padding: 4px 0;\n}\n.arap-slider {\n width: 100%;\n accent-color: var(--arap-accent);\n cursor: pointer;\n}\n.arap-search-count {\n padding: 6px 0;\n font-size: 12px;\n font-weight: 500;\n color: var(--arap-muted);\n}\n.arap-empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 24px 16px;\n gap: 8px;\n}\n.arap-empty-icon {\n font-size: 32px;\n}\n.arap-empty-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-empty-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n}\n.arap-empty-btn,\n.arap-retry-btn {\n margin-top: 6px;\n padding: 8px 16px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n font-weight: 500;\n font-size: 13px;\n color: var(--arap-text);\n cursor: pointer;\n}\n.arap-empty-btn:hover,\n.arap-retry-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n color: var(--arap-accent);\n}\n.arap-profile-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.arap-profile-card-active {\n border-color: var(--arap-accent);\n background: var(--arap-selected);\n box-shadow: 0 0 0 1px var(--arap-accent);\n}\n.arap-profile-header {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-profile-active-badge {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-accent);\n background: #dbeafe;\n padding: 2px 8px;\n border-radius: 9999px;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-profile-affected {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-profile-affected-label {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.arap-profile-chip {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n border-radius: 6px;\n background: var(--arap-control);\n border: 1px solid var(--arap-divider);\n font-size: 12px;\n color: var(--arap-text);\n}\n.arap-profile-actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n.arap-profile-apply-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-accent);\n color: #fff;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-apply-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-profile-revert-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-muted);\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-revert-btn:hover {\n background: var(--arap-control);\n color: var(--arap-text);\n border-color: var(--arap-text);\n}\n.arap-notice {\n grid-column: 1 / -1;\n margin-top: 6px;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.45;\n background: #fefce8;\n border: 1px solid #fef08a;\n color: #854d0e;\n}\n.arap-notice-warning {\n background: #fffbeb;\n border-color: #fde68a;\n color: #92400e;\n}\n.arap-reading-mask {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-reading-guide {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-feature-expandable {\n flex-direction: column !important;\n align-items: stretch !important;\n}\n.arap-accessible-tooltip {\n position: fixed !important;\n z-index: 2147483646 !important;\n max-width: 320px !important;\n min-width: 48px !important;\n box-sizing: border-box !important;\n padding: 6px 12px !important;\n background: #0f172a !important;\n color: #ffffff !important;\n font-family:\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n sans-serif !important;\n font-size: 13px !important;\n line-height: 1.4 !important;\n font-weight: 500 !important;\n border-radius: 6px !important;\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;\n pointer-events: auto !important;\n word-break: break-word !important;\n white-space: normal !important;\n opacity: 0 !important;\n visibility: hidden !important;\n transition: opacity 120ms ease, transform 120ms ease !important;\n transform: translateY(2px) !important;\n}\n.arap-accessible-tooltip[data-visible=true] {\n opacity: 1 !important;\n visibility: visible !important;\n transform: translateY(0) !important;\n}\n.arap-accessible-tooltip[data-placement=top] {\n transform: translateY(-2px) !important;\n}\n.arap-accessible-tooltip[data-placement=top][data-visible=true] {\n transform: translateY(0) !important;\n}\n@media (forced-colors: active) {\n .arap-accessible-tooltip {\n background: Canvas !important;\n color: CanvasText !important;\n border: 2px solid Highlight !important;\n box-shadow: none !important;\n }\n}\n.arap-navigator-dialog {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n margin-top: 10px;\n padding: 10px;\n background: var(--arap-control, #f1f5f9);\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 8px;\n box-sizing: border-box;\n}\n.arap-navigator-tabs {\n display: flex;\n gap: 4px;\n border-bottom: 1px solid var(--arap-border, #cbd5e1);\n padding-bottom: 6px;\n}\n.arap-navigator-tab {\n flex: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 6px 10px;\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted, #64748b);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 120ms ease;\n}\n.arap-navigator-tab:hover {\n color: var(--arap-text, #0f172a);\n background: rgba(0, 0, 0, 0.04);\n}\n.arap-navigator-tab-active {\n color: var(--arap-accent, #008060) !important;\n background: var(--arap-selected, #f0fdf4) !important;\n}\n.arap-navigator-search-box {\n width: 100%;\n}\n.arap-navigator-search {\n width: 100%;\n box-sizing: border-box;\n padding: 6px 10px;\n font-size: 12px;\n border: 1px solid var(--arap-border, #cbd5e1);\n border-radius: 6px;\n background: var(--arap-surface, #ffffff);\n color: var(--arap-text, #0f172a);\n}\n.arap-navigator-search:focus {\n outline: 2px solid var(--arap-accent, #008060);\n outline-offset: 1px;\n}\n.arap-navigator-content {\n max-height: 240px;\n overflow-y: auto;\n overflow-x: hidden;\n}\n.arap-navigator-list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-navigator-item {\n margin: 0;\n padding: 0;\n}\n.arap-navigator-jump-btn {\n width: 100%;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 8px;\n font-size: 12px;\n font-weight: 500;\n text-align: left;\n background: var(--arap-surface, #ffffff);\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 6px;\n color: var(--arap-text, #0f172a);\n cursor: pointer;\n transition: background 100ms ease, border-color 100ms ease;\n}\n.arap-navigator-jump-btn:hover,\n.arap-navigator-jump-btn:focus-visible {\n background: var(--arap-selected, #f0fdf4);\n border-color: var(--arap-accent, #008060);\n outline: 2px solid var(--arap-accent, #008060);\n outline-offset: -1px;\n}\n.arap-navigator-badge {\n display: inline-block;\n padding: 2px 6px;\n font-size: 10px;\n font-weight: 700;\n border-radius: 4px;\n flex-shrink: 0;\n}\n.arap-navigator-badge-h {\n background: #e0f2fe;\n color: #0369a1;\n}\n.arap-navigator-badge-l {\n background: #fef3c7;\n color: #b45309;\n}\n.arap-navigator-item-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.arap-navigator-empty {\n padding: 16px;\n font-size: 12px;\n text-align: center;\n color: var(--arap-muted, #64748b);\n font-style: italic;\n}\n.arap-profile-card {\n padding: 12px;\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 8px;\n background: var(--arap-card-bg, #ffffff);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.arap-profile-card:hover {\n border-color: var(--arap-primary, #2563eb);\n}\n.arap-profile-card-active {\n border-color: var(--arap-primary, #2563eb);\n background: rgba(37, 99, 235, 0.03);\n box-shadow: 0 0 0 1px var(--arap-primary, #2563eb);\n}\n.arap-profile-header {\n margin-bottom: 8px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--arap-text, #1e293b);\n}\n.arap-profile-active-badge {\n display: inline-block;\n padding: 2px 8px;\n font-size: 11px;\n font-weight: 600;\n border-radius: 9999px;\n background: #dbeafe;\n color: #1d4ed8;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 11px;\n color: var(--arap-muted, #64748b);\n line-height: 1.4;\n}\n.arap-profile-affected {\n margin-top: 8px;\n margin-bottom: 10px;\n}\n.arap-profile-affected-label {\n display: block;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--arap-muted, #94a3b8);\n margin-bottom: 4px;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n}\n.arap-profile-chip {\n display: inline-block;\n padding: 2px 6px;\n font-size: 10px;\n background: var(--arap-chip-bg, #f1f5f9);\n color: var(--arap-text, #334155);\n border-radius: 4px;\n border: 1px solid var(--arap-chip-border, #e2e8f0);\n}\n.arap-profile-actions {\n display: flex;\n justify-content: flex-end;\n margin-top: 8px;\n}\n.arap-profile-apply-btn,\n.arap-profile-revert-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n padding: 6px 14px;\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease, border-color 0.15s ease;\n}\n.arap-profile-apply-btn {\n background: var(--arap-primary, #2563eb);\n color: #ffffff;\n border: 1px solid var(--arap-primary, #2563eb);\n}\n.arap-profile-apply-btn:hover {\n background: #1d4ed8;\n}\n.arap-profile-revert-btn {\n background: #ffffff;\n color: #dc2626;\n border: 1px solid #fca5a5;\n}\n.arap-profile-revert-btn:hover {\n background: #fef2f2;\n border-color: #f87171;\n}\n.arap-large-controls .arap-profile-apply-btn,\n.arap-large-controls .arap-profile-revert-btn {\n min-height: 48px;\n padding: 10px 18px;\n font-size: 14px;\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-profile-card,\n .arap-profile-apply-btn,\n .arap-profile-revert-btn,\n .arap-preset-card {\n transition: none !important;\n }\n}\n.arap-preset-card {\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.arap-preset-card:hover {\n border-color: var(--arap-border-hover, #cbd5e1);\n}\n.arap-large-controls .arap-preset-card button {\n min-height: 48px;\n padding: 10px 16px;\n font-size: 14px;\n}\n');
134
170
 
135
171
  // src/core/AccessibilityPlugin.tsx
136
172
  var import_react4 = require("react");
@@ -438,7 +474,9 @@ for (const key of [
438
474
  "readingGuide",
439
475
  "highlightFocus",
440
476
  "focusHighlight",
441
- "reduceMotion"
477
+ "reduceMotion",
478
+ "tooltips",
479
+ "accessibleTooltips"
442
480
  ]) {
443
481
  builtins[key] = {
444
482
  defaultValue: false,
@@ -457,6 +495,16 @@ builtins.readingMaskHeight = {
457
495
  defaultValue: DEFAULT_READING_MASK_HEIGHT,
458
496
  validate: (v) => typeof v === "number" && v >= MIN_READING_MASK_HEIGHT && v <= MAX_READING_MASK_HEIGHT
459
497
  };
498
+ builtins.activeProfile = {
499
+ defaultValue: null,
500
+ validate: (v) => v === null || typeof v === "object" && v !== null && "profileId" in v && typeof v.profileId === "string"
501
+ };
502
+ builtins.customPresets = {
503
+ defaultValue: [],
504
+ validate: (v) => Array.isArray(v) && v.every(
505
+ (item) => typeof item === "object" && item !== null && typeof item.id === "string" && typeof item.name === "string" && typeof item.createdAt === "string" && typeof item.settings === "object" && item.settings !== null
506
+ )
507
+ };
460
508
  function validValue(key, value, fallback, validate) {
461
509
  if (builtins[key]) return builtins[key].validate(value);
462
510
  if (validate) {
@@ -1593,6 +1641,274 @@ function useBuiltinEffects(values, onDisable) {
1593
1641
  if (!values.readingGuide) return;
1594
1642
  return readingAid(false, 4, onDisable);
1595
1643
  }, [values.readingGuide, onDisable]);
1644
+ (0, import_react3.useEffect)(() => {
1645
+ if (!values.tooltips && !values.accessibleTooltips) return;
1646
+ return enableAccessibleTooltips();
1647
+ }, [values.tooltips, values.accessibleTooltips]);
1648
+ }
1649
+ var SENSITIVE_AUTOCOMPLETE_PATTERN = /password|credit-card|cc-|card-|security-code|cvc|cvv|one-time-code/i;
1650
+ function getAuthoredDescription(element) {
1651
+ if (!(element instanceof HTMLElement || element instanceof SVGElement)) {
1652
+ return null;
1653
+ }
1654
+ if (element.closest("[data-arap-ui]")) {
1655
+ return null;
1656
+ }
1657
+ if (element.matches("script, style, link, meta, noscript, template")) {
1658
+ return null;
1659
+ }
1660
+ if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) {
1661
+ if (element instanceof HTMLInputElement && element.type === "password") {
1662
+ return null;
1663
+ }
1664
+ const ac = element.getAttribute("autocomplete");
1665
+ if (ac && SENSITIVE_AUTOCOMPLETE_PATTERN.test(ac)) {
1666
+ return null;
1667
+ }
1668
+ }
1669
+ if (element.getAttribute("data-sensitive") === "true") {
1670
+ return null;
1671
+ }
1672
+ if (element.getAttribute("aria-hidden") === "true" || element.getAttribute("role") === "presentation" || element.getAttribute("role") === "none") {
1673
+ return null;
1674
+ }
1675
+ const ariaDesc = element.getAttribute("aria-description")?.trim();
1676
+ let describedByText = "";
1677
+ const describedBy = element.getAttribute("aria-describedby");
1678
+ if (describedBy) {
1679
+ const ids = describedBy.trim().split(/\s+/);
1680
+ const parts = [];
1681
+ for (const id of ids) {
1682
+ const target = document.getElementById(id);
1683
+ if (target) {
1684
+ const text = target.textContent?.trim();
1685
+ if (text) parts.push(text);
1686
+ }
1687
+ }
1688
+ if (parts.length > 0) {
1689
+ describedByText = parts.join(" ");
1690
+ }
1691
+ }
1692
+ const explicitDesc = ariaDesc || describedByText || null;
1693
+ const ariaLabel = element.getAttribute("aria-label")?.trim() || null;
1694
+ const visibleText = (element.textContent || "").trim();
1695
+ const alt = element instanceof HTMLImageElement || element instanceof HTMLAreaElement || element instanceof HTMLInputElement && element.type === "image" ? element.getAttribute("alt")?.trim() || null : null;
1696
+ const title = element.getAttribute("title")?.trim() || null;
1697
+ if (explicitDesc) {
1698
+ if (ariaLabel && ariaLabel.toLowerCase() !== visibleText.toLowerCase() && ariaLabel.toLowerCase() !== explicitDesc.toLowerCase()) {
1699
+ return `${ariaLabel} \u2014 ${explicitDesc}`;
1700
+ }
1701
+ if (explicitDesc.toLowerCase() !== visibleText.toLowerCase()) {
1702
+ return explicitDesc;
1703
+ }
1704
+ }
1705
+ if (ariaLabel && ariaLabel.toLowerCase() !== visibleText.toLowerCase()) {
1706
+ return ariaLabel;
1707
+ }
1708
+ if (alt && alt !== "") {
1709
+ return alt;
1710
+ }
1711
+ if (title && title.toLowerCase() !== visibleText.toLowerCase()) {
1712
+ return title;
1713
+ }
1714
+ return null;
1715
+ }
1716
+ function positionTooltip(tooltip, target) {
1717
+ const rect = target.getBoundingClientRect();
1718
+ const tooltipRect = tooltip.getBoundingClientRect();
1719
+ const tooltipWidth = tooltipRect.width || tooltip.offsetWidth || 180;
1720
+ const tooltipHeight = tooltipRect.height || tooltip.offsetHeight || 32;
1721
+ const gap = 8;
1722
+ const vw = typeof window !== "undefined" && window.innerWidth || document.documentElement.clientWidth || 800;
1723
+ const vh = typeof window !== "undefined" && window.innerHeight || document.documentElement.clientHeight || 600;
1724
+ let placement = "top";
1725
+ let top = rect.top - tooltipHeight - gap;
1726
+ if (top < gap) {
1727
+ top = rect.bottom + gap;
1728
+ placement = "bottom";
1729
+ }
1730
+ if (top + tooltipHeight > vh - gap) {
1731
+ top = Math.max(gap, vh - tooltipHeight - gap);
1732
+ }
1733
+ let left = rect.left + (rect.width - tooltipWidth) / 2;
1734
+ left = Math.max(gap, Math.min(vw - tooltipWidth - gap, left));
1735
+ tooltip.style.top = `${Math.round(top)}px`;
1736
+ tooltip.style.left = `${Math.round(left)}px`;
1737
+ tooltip.setAttribute("data-placement", placement);
1738
+ }
1739
+ function enableAccessibleTooltips() {
1740
+ if (typeof document === "undefined") return () => {
1741
+ };
1742
+ let tooltipEl = document.createElement("div");
1743
+ tooltipEl.className = "arap-accessible-tooltip";
1744
+ tooltipEl.setAttribute("role", "presentation");
1745
+ tooltipEl.setAttribute("aria-hidden", "true");
1746
+ tooltipEl.setAttribute("data-arap-ui", "true");
1747
+ document.body.appendChild(tooltipEl);
1748
+ let activeTarget = null;
1749
+ let dismissedTarget = null;
1750
+ let hideTimeout = null;
1751
+ let isPointerOverTooltip = false;
1752
+ function show(target, text) {
1753
+ if (hideTimeout) {
1754
+ clearTimeout(hideTimeout);
1755
+ hideTimeout = null;
1756
+ }
1757
+ activeTarget = target;
1758
+ if (!tooltipEl || !document.body.contains(tooltipEl)) {
1759
+ tooltipEl = document.createElement("div");
1760
+ tooltipEl.className = "arap-accessible-tooltip";
1761
+ tooltipEl.setAttribute("role", "presentation");
1762
+ tooltipEl.setAttribute("aria-hidden", "true");
1763
+ tooltipEl.setAttribute("data-arap-ui", "true");
1764
+ document.body.appendChild(tooltipEl);
1765
+ }
1766
+ tooltipEl.textContent = text;
1767
+ tooltipEl.setAttribute("data-visible", "true");
1768
+ positionTooltip(tooltipEl, target);
1769
+ }
1770
+ function hide(immediate = false) {
1771
+ if (hideTimeout) {
1772
+ clearTimeout(hideTimeout);
1773
+ hideTimeout = null;
1774
+ }
1775
+ const doHide = () => {
1776
+ if (isPointerOverTooltip) return;
1777
+ if (tooltipEl) {
1778
+ tooltipEl.removeAttribute("data-visible");
1779
+ tooltipEl.style.top = "-9999px";
1780
+ tooltipEl.style.left = "-9999px";
1781
+ }
1782
+ activeTarget = null;
1783
+ };
1784
+ if (immediate) {
1785
+ doHide();
1786
+ } else {
1787
+ hideTimeout = setTimeout(doHide, 100);
1788
+ }
1789
+ }
1790
+ function findTargetWithDescription(node) {
1791
+ if (!(node instanceof Element)) return null;
1792
+ if (node.closest("[data-arap-ui]")) return null;
1793
+ let curr = node;
1794
+ while (curr && curr !== document.body && curr !== document.documentElement) {
1795
+ const desc = getAuthoredDescription(curr);
1796
+ if (desc) return { element: curr, text: desc };
1797
+ curr = curr.parentElement;
1798
+ }
1799
+ return null;
1800
+ }
1801
+ const handlePointerOver = (event) => {
1802
+ if (tooltipEl && (event.target === tooltipEl || tooltipEl.contains(event.target))) {
1803
+ isPointerOverTooltip = true;
1804
+ if (hideTimeout) {
1805
+ clearTimeout(hideTimeout);
1806
+ hideTimeout = null;
1807
+ }
1808
+ return;
1809
+ }
1810
+ const match = findTargetWithDescription(event.target);
1811
+ if (!match) {
1812
+ if (activeTarget && !isPointerOverTooltip) {
1813
+ hide();
1814
+ }
1815
+ return;
1816
+ }
1817
+ if (match.element === dismissedTarget) {
1818
+ return;
1819
+ }
1820
+ if (match.element === activeTarget) {
1821
+ if (hideTimeout) {
1822
+ clearTimeout(hideTimeout);
1823
+ hideTimeout = null;
1824
+ }
1825
+ return;
1826
+ }
1827
+ show(match.element, match.text);
1828
+ };
1829
+ const handlePointerOut = (event) => {
1830
+ if (dismissedTarget === event.target) {
1831
+ dismissedTarget = null;
1832
+ }
1833
+ if (tooltipEl && (event.target === tooltipEl || tooltipEl.contains(event.target))) {
1834
+ isPointerOverTooltip = false;
1835
+ const related = event.relatedTarget;
1836
+ if (activeTarget && (activeTarget === related || activeTarget.contains(related))) {
1837
+ return;
1838
+ }
1839
+ hide();
1840
+ return;
1841
+ }
1842
+ const match = findTargetWithDescription(event.target);
1843
+ if (match && match.element === activeTarget) {
1844
+ const related = event.relatedTarget;
1845
+ if (tooltipEl && (related === tooltipEl || tooltipEl.contains(related))) {
1846
+ return;
1847
+ }
1848
+ hide();
1849
+ }
1850
+ };
1851
+ const handleFocusIn = (event) => {
1852
+ const match = findTargetWithDescription(event.target);
1853
+ if (!match) {
1854
+ hide(true);
1855
+ return;
1856
+ }
1857
+ if (match.element === dismissedTarget) {
1858
+ return;
1859
+ }
1860
+ show(match.element, match.text);
1861
+ };
1862
+ const handleFocusOut = (event) => {
1863
+ if (dismissedTarget === event.target) {
1864
+ dismissedTarget = null;
1865
+ }
1866
+ if (activeTarget && activeTarget === event.target) {
1867
+ hide(true);
1868
+ }
1869
+ };
1870
+ const handleKeyDown = (event) => {
1871
+ if (event.key === "Escape" && activeTarget) {
1872
+ dismissedTarget = activeTarget;
1873
+ hide(true);
1874
+ }
1875
+ };
1876
+ const handleReposition = () => {
1877
+ if (activeTarget && tooltipEl && tooltipEl.getAttribute("data-visible") === "true") {
1878
+ if (!document.contains(activeTarget)) {
1879
+ hide(true);
1880
+ return;
1881
+ }
1882
+ positionTooltip(tooltipEl, activeTarget);
1883
+ }
1884
+ };
1885
+ document.addEventListener("pointerover", handlePointerOver, {
1886
+ passive: true
1887
+ });
1888
+ document.addEventListener("mouseover", handlePointerOver, { passive: true });
1889
+ document.addEventListener("pointerout", handlePointerOut, { passive: true });
1890
+ document.addEventListener("mouseout", handlePointerOut, { passive: true });
1891
+ document.addEventListener("focusin", handleFocusIn);
1892
+ document.addEventListener("focusout", handleFocusOut);
1893
+ document.addEventListener("keydown", handleKeyDown);
1894
+ window.addEventListener("scroll", handleReposition, { passive: true });
1895
+ window.addEventListener("resize", handleReposition, { passive: true });
1896
+ return () => {
1897
+ if (hideTimeout) clearTimeout(hideTimeout);
1898
+ document.removeEventListener("pointerover", handlePointerOver);
1899
+ document.removeEventListener("mouseover", handlePointerOver);
1900
+ document.removeEventListener("pointerout", handlePointerOut);
1901
+ document.removeEventListener("mouseout", handlePointerOut);
1902
+ document.removeEventListener("focusin", handleFocusIn);
1903
+ document.removeEventListener("focusout", handleFocusOut);
1904
+ document.removeEventListener("keydown", handleKeyDown);
1905
+ window.removeEventListener("scroll", handleReposition);
1906
+ window.removeEventListener("resize", handleReposition);
1907
+ if (tooltipEl) {
1908
+ tooltipEl.remove();
1909
+ tooltipEl = null;
1910
+ }
1911
+ };
1596
1912
  }
1597
1913
  function CustomEffect({
1598
1914
  definition,
@@ -1691,15 +2007,39 @@ function AccessibilityPlugin({
1691
2007
  const definition = registrations.current.get(key);
1692
2008
  if (!validKey(key) || !definition || !validValue(key, value2, definition.defaultValue, definition.validate))
1693
2009
  throw new Error(`Invalid value or unregistered feature: ${key}`);
1694
- setFeatures((previous) => ({ ...previous, [key]: value2 }));
2010
+ setFeatures((previous) => {
2011
+ const copy = { ...previous, [key]: value2 };
2012
+ if (key !== "activeProfile" && key !== PLACEMENT_KEY && previous.activeProfile && typeof previous.activeProfile === "object") {
2013
+ const profileState = previous.activeProfile;
2014
+ const targetKey = key === "fontSize" || key === "textScale" ? "fontScale" : key === "focusHighlight" ? "highlightFocus" : key === "linkHighlight" ? "highlightLinks" : key === "bigCursor" ? "cursorSize" : key === "readingGuide" || key === "readingMask" ? "readerMode" : key;
2015
+ if (profileState.baseSnapshot && (targetKey in profileState.baseSnapshot || key in profileState.baseSnapshot)) {
2016
+ copy.activeProfile = {
2017
+ ...profileState,
2018
+ overrides: {
2019
+ ...profileState.overrides,
2020
+ [targetKey]: value2,
2021
+ [key]: value2
2022
+ }
2023
+ };
2024
+ }
2025
+ }
2026
+ return copy;
2027
+ });
1695
2028
  },
1696
2029
  [setFeatures]
1697
2030
  );
1698
2031
  const resetAll = (0, import_react4.useCallback)(() => {
1699
2032
  resetFns.current.forEach((fn) => fn());
1700
- setFeatures(
1701
- (previous) => validPlacement(previous[PLACEMENT_KEY]) ? { [PLACEMENT_KEY]: previous[PLACEMENT_KEY] } : {}
1702
- );
2033
+ setFeatures((previous) => {
2034
+ const preserved = {};
2035
+ if (validPlacement(previous[PLACEMENT_KEY])) {
2036
+ preserved[PLACEMENT_KEY] = previous[PLACEMENT_KEY];
2037
+ }
2038
+ if (Array.isArray(previous.customPresets)) {
2039
+ preserved.customPresets = previous.customPresets;
2040
+ }
2041
+ return preserved;
2042
+ });
1703
2043
  }, [setFeatures]);
1704
2044
  const registerReset = (0, import_react4.useCallback)((key, fn) => {
1705
2045
  resetFns.current.set(key, fn);
@@ -2474,6 +2814,16 @@ var DEFAULT_PREFERENCES = Object.freeze({
2474
2814
  saturation: "original",
2475
2815
  tooltips: false
2476
2816
  });
2817
+ var ALL_PROFILE_IDS = [
2818
+ "motor",
2819
+ "blind",
2820
+ "color-blind",
2821
+ "dyslexia",
2822
+ "low-vision",
2823
+ "cognitive",
2824
+ "seizure",
2825
+ "adhd"
2826
+ ];
2477
2827
  var PROFILE_DEFINITIONS = {
2478
2828
  motor: {
2479
2829
  id: "motor",
@@ -2753,6 +3103,249 @@ function preferencesReducer(state, action) {
2753
3103
  }
2754
3104
  }
2755
3105
 
3106
+ // src/core/profiles.ts
3107
+ function getProfileDefinition(id) {
3108
+ return PROFILE_DEFINITIONS[id];
3109
+ }
3110
+ function mapProfileSettingsToFeatures(settings) {
3111
+ const features = {};
3112
+ if (settings.fontScale !== void 0) {
3113
+ features.fontScale = settings.fontScale;
3114
+ features.textScale = settings.fontScale;
3115
+ features.fontSize = Math.round(settings.fontScale * 100);
3116
+ }
3117
+ if (settings.lineHeight !== void 0) {
3118
+ features.lineHeight = settings.lineHeight !== null ? Math.round(settings.lineHeight * 100) : 100;
3119
+ }
3120
+ if (settings.letterSpacingEm !== void 0) {
3121
+ features.letterSpacingEm = settings.letterSpacingEm;
3122
+ }
3123
+ if (settings.wordSpacingEm !== void 0) {
3124
+ features.wordSpacingEm = settings.wordSpacingEm;
3125
+ }
3126
+ if (settings.paragraphSpacingEm !== void 0) {
3127
+ features.paragraphSpacingEm = settings.paragraphSpacingEm;
3128
+ }
3129
+ if (settings.textAlign !== void 0) {
3130
+ features.textAlign = settings.textAlign === "original" ? "default" : settings.textAlign;
3131
+ }
3132
+ if (settings.contrastMode !== void 0) {
3133
+ features.contrastMode = settings.contrastMode;
3134
+ features.contrast = settings.contrastMode;
3135
+ }
3136
+ if (settings.highlightLinks !== void 0) {
3137
+ features.linkHighlight = settings.highlightLinks;
3138
+ }
3139
+ if (settings.highlightFocus !== void 0) {
3140
+ features.highlightFocus = settings.highlightFocus;
3141
+ features.focusHighlight = settings.highlightFocus;
3142
+ }
3143
+ if (settings.reduceMotion !== void 0) {
3144
+ features.reduceMotion = settings.reduceMotion;
3145
+ }
3146
+ if (settings.hideDecorativeImages !== void 0) {
3147
+ features.hideImages = settings.hideDecorativeImages;
3148
+ }
3149
+ if (settings.fontFamily !== void 0) {
3150
+ features.fontFamily = settings.fontFamily === "original" ? "default" : settings.fontFamily;
3151
+ }
3152
+ if (settings.cursorSize !== void 0) {
3153
+ features.bigCursor = settings.cursorSize === "large";
3154
+ }
3155
+ if (settings.readerMode !== void 0) {
3156
+ if (settings.readerMode === "guide") {
3157
+ features.readingGuide = true;
3158
+ features.readingMask = false;
3159
+ } else if (settings.readerMode === "mask") {
3160
+ features.readingMask = true;
3161
+ features.readingGuide = false;
3162
+ } else {
3163
+ features.readingGuide = false;
3164
+ features.readingMask = false;
3165
+ }
3166
+ }
3167
+ if (settings.saturation !== void 0) {
3168
+ features.saturation = settings.saturation === "low" ? 1 : settings.saturation === "high" ? 2 : 0;
3169
+ }
3170
+ if (settings.tooltips !== void 0) {
3171
+ features.tooltips = settings.tooltips;
3172
+ features.accessibleTooltips = settings.tooltips;
3173
+ }
3174
+ return features;
3175
+ }
3176
+ function mapFeaturesToProfileSettings(features) {
3177
+ const result = {
3178
+ ...DEFAULT_PREFERENCES
3179
+ };
3180
+ if (typeof features.fontScale === "number") {
3181
+ result.fontScale = features.fontScale;
3182
+ } else if (typeof features.textScale === "number") {
3183
+ result.fontScale = features.textScale;
3184
+ } else if (typeof features.fontSize === "number") {
3185
+ result.fontScale = features.fontSize / 100;
3186
+ }
3187
+ if (features.lineHeight !== void 0) {
3188
+ result.lineHeight = typeof features.lineHeight === "number" ? features.lineHeight / 100 : null;
3189
+ }
3190
+ if (typeof features.contrastMode === "string") {
3191
+ result.contrastMode = features.contrastMode === "original" ? "off" : features.contrastMode;
3192
+ }
3193
+ if (features.linkHighlight !== void 0) {
3194
+ result.highlightLinks = Boolean(features.linkHighlight);
3195
+ }
3196
+ if (features.highlightFocus !== void 0 || features.focusHighlight !== void 0) {
3197
+ result.highlightFocus = Boolean(
3198
+ features.highlightFocus ?? features.focusHighlight
3199
+ );
3200
+ }
3201
+ if (features.reduceMotion !== void 0) {
3202
+ result.reduceMotion = Boolean(features.reduceMotion);
3203
+ }
3204
+ if (features.hideImages !== void 0) {
3205
+ result.hideDecorativeImages = Boolean(features.hideImages);
3206
+ }
3207
+ if (typeof features.fontFamily === "string") {
3208
+ result.fontFamily = features.fontFamily === "default" ? "original" : features.fontFamily;
3209
+ }
3210
+ if (features.bigCursor !== void 0) {
3211
+ result.cursorSize = features.bigCursor ? "large" : "original";
3212
+ }
3213
+ if (features.readingMask) {
3214
+ result.readerMode = "mask";
3215
+ } else if (features.readingGuide) {
3216
+ result.readerMode = "guide";
3217
+ } else if (features.readingMask === false || features.readingGuide === false) {
3218
+ result.readerMode = "off";
3219
+ }
3220
+ if (features.tooltips !== void 0 || features.accessibleTooltips !== void 0) {
3221
+ result.tooltips = Boolean(features.tooltips ?? features.accessibleTooltips);
3222
+ }
3223
+ return result;
3224
+ }
3225
+ function applyProfileToStore(profileId, currentFeatures, setFeatureState, existingActiveState) {
3226
+ const profile = PROFILE_DEFINITIONS[profileId];
3227
+ if (!profile) {
3228
+ throw new Error(`Unknown profile identifier: ${profileId}`);
3229
+ }
3230
+ const currentSettings = mapFeaturesToProfileSettings(currentFeatures);
3231
+ const targetSettings = profile.settings;
3232
+ const baseSnapshot = {
3233
+ ...existingActiveState?.baseSnapshot ?? {}
3234
+ };
3235
+ for (const k of Object.keys(targetSettings)) {
3236
+ if (!(k in baseSnapshot)) {
3237
+ baseSnapshot[k] = currentSettings[k];
3238
+ }
3239
+ }
3240
+ const activeProfileState = {
3241
+ profileId,
3242
+ baseSnapshot,
3243
+ overrides: {}
3244
+ };
3245
+ const targetFeatures = mapProfileSettingsToFeatures(targetSettings);
3246
+ for (const [key, val] of Object.entries(targetFeatures)) {
3247
+ try {
3248
+ setFeatureState(key, val);
3249
+ } catch {
3250
+ }
3251
+ }
3252
+ try {
3253
+ setFeatureState("activeProfile", activeProfileState);
3254
+ } catch {
3255
+ }
3256
+ return activeProfileState;
3257
+ }
3258
+ function revertProfileFromStore(activeProfileState, setFeatureState) {
3259
+ const { baseSnapshot, overrides } = activeProfileState;
3260
+ const restoredSettings = {};
3261
+ for (const [k, baseVal] of Object.entries(baseSnapshot)) {
3262
+ const key = k;
3263
+ if (key in overrides) {
3264
+ restoredSettings[key] = overrides[key];
3265
+ } else {
3266
+ restoredSettings[key] = baseVal;
3267
+ }
3268
+ }
3269
+ const restoredFeatures = mapProfileSettingsToFeatures(restoredSettings);
3270
+ for (const [key, val] of Object.entries(restoredFeatures)) {
3271
+ try {
3272
+ setFeatureState(key, val);
3273
+ } catch {
3274
+ }
3275
+ }
3276
+ try {
3277
+ setFeatureState("activeProfile", null);
3278
+ } catch {
3279
+ }
3280
+ }
3281
+ function recordProfileOverride(key, value, activeProfileState, setFeatureState) {
3282
+ if (!activeProfileState) return null;
3283
+ const nextOverrides = {
3284
+ ...activeProfileState.overrides,
3285
+ [key]: value
3286
+ };
3287
+ const nextState = {
3288
+ ...activeProfileState,
3289
+ overrides: nextOverrides
3290
+ };
3291
+ try {
3292
+ setFeatureState("activeProfile", nextState);
3293
+ } catch {
3294
+ }
3295
+ return nextState;
3296
+ }
3297
+
3298
+ // src/core/useProfiles.ts
3299
+ var import_react12 = require("react");
3300
+ function useProfiles() {
3301
+ const ctx = (0, import_react12.useContext)(AccessibilityContext);
3302
+ if (!ctx) {
3303
+ throw new Error(
3304
+ "useProfiles must be used within an <AccessibilityPlugin> provider."
3305
+ );
3306
+ }
3307
+ const { value: activeProfileState, setValue: setActiveProfileState } = useAccessibility("activeProfile", null);
3308
+ const applyProfile = (0, import_react12.useCallback)(
3309
+ (profileId) => {
3310
+ const nextState = applyProfileToStore(
3311
+ profileId,
3312
+ ctx.state.features,
3313
+ ctx.setFeatureState,
3314
+ activeProfileState
3315
+ );
3316
+ setActiveProfileState(nextState);
3317
+ },
3318
+ [
3319
+ ctx.state.features,
3320
+ ctx.setFeatureState,
3321
+ activeProfileState,
3322
+ setActiveProfileState
3323
+ ]
3324
+ );
3325
+ const revertProfile = (0, import_react12.useCallback)(() => {
3326
+ if (activeProfileState) {
3327
+ revertProfileFromStore(activeProfileState, ctx.setFeatureState);
3328
+ setActiveProfileState(null);
3329
+ }
3330
+ }, [activeProfileState, ctx.setFeatureState, setActiveProfileState]);
3331
+ const activeProfileId = activeProfileState?.profileId ?? null;
3332
+ const activeProfile = activeProfileId ? getProfileDefinition(activeProfileId) ?? null : null;
3333
+ const isProfileActive = (0, import_react12.useCallback)(
3334
+ (id) => activeProfileId === id,
3335
+ [activeProfileId]
3336
+ );
3337
+ const allProfiles = ALL_PROFILE_IDS.map((id) => PROFILE_DEFINITIONS[id]);
3338
+ return {
3339
+ profiles: allProfiles,
3340
+ activeProfileId,
3341
+ activeProfile,
3342
+ activeProfileState,
3343
+ applyProfile,
3344
+ revertProfile,
3345
+ isProfileActive
3346
+ };
3347
+ }
3348
+
2756
3349
  // src/core/FeatureIcon.tsx
2757
3350
  var import_jsx_runtime7 = require("react/jsx-runtime");
2758
3351
  var drawings = {
@@ -2817,6 +3410,27 @@ var drawings = {
2817
3410
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M3 5h18M3 10h12M3 19h18" }),
2818
3411
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M2 15h20", strokeWidth: "3" })
2819
3412
  ] }),
3413
+ tooltips: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3414
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
3415
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 9h8M8 13h5" })
3416
+ ] }),
3417
+ accessibleTooltips: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3418
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
3419
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 9h8M8 13h5" })
3420
+ ] }),
3421
+ pageNavigator: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3422
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
3423
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polygon", { points: "12 3 15.5 10.5 12 9 8.5 10.5 12 3", fill: "currentColor" }),
3424
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polygon", { points: "12 21 8.5 13.5 12 15 15.5 13.5 12 21" })
3425
+ ] }),
3426
+ headings: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 6v12M14 6v12M4 12h10M18 10h3M18 14h3M18 18h3" }) }),
3427
+ landmarks: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1zM4 22v-7" }) }),
3428
+ profiles: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3429
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
3430
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "9", cy: "7", r: "4" }),
3431
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75" })
3432
+ ] }),
3433
+ presets: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" }) }),
2820
3434
  reset: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M3 10a9 9 0 1 1 1 7M3 4v6h6" }) })
2821
3435
  };
2822
3436
  function FeatureIcon({ name }) {
@@ -3359,7 +3973,7 @@ function ParagraphSpacingController({
3359
3973
  }
3360
3974
 
3361
3975
  // src/features/ContrastController.tsx
3362
- var import_react12 = require("react");
3976
+ var import_react13 = require("react");
3363
3977
  var import_jsx_runtime14 = require("react/jsx-runtime");
3364
3978
  var FEATURE_KEY7 = "contrast";
3365
3979
  var DEFAULT_VALUE7 = 0;
@@ -3382,7 +3996,7 @@ function ContrastController() {
3382
3996
  FEATURE_KEY7,
3383
3997
  DEFAULT_VALUE7
3384
3998
  );
3385
- const forcedColors = (0, import_react12.useSyncExternalStore)(
3999
+ const forcedColors = (0, import_react13.useSyncExternalStore)(
3386
4000
  subscribeForcedColors,
3387
4001
  isForcedColorsActive,
3388
4002
  () => false
@@ -3414,7 +4028,7 @@ function ContrastController() {
3414
4028
  }
3415
4029
 
3416
4030
  // src/features/ContrastModeController.tsx
3417
- var import_react13 = require("react");
4031
+ var import_react14 = require("react");
3418
4032
  var import_jsx_runtime15 = require("react/jsx-runtime");
3419
4033
  var FEATURE_KEY8 = "contrastMode";
3420
4034
  var DEFAULT_VALUE8 = "off";
@@ -3430,7 +4044,7 @@ function ContrastModeController() {
3430
4044
  FEATURE_KEY8,
3431
4045
  DEFAULT_VALUE8
3432
4046
  );
3433
- const forcedColors = (0, import_react13.useSyncExternalStore)(
4047
+ const forcedColors = (0, import_react14.useSyncExternalStore)(
3434
4048
  subscribeForcedColors,
3435
4049
  isForcedColorsActive,
3436
4050
  () => false
@@ -3736,7 +4350,7 @@ function HideVideosController() {
3736
4350
  }
3737
4351
 
3738
4352
  // src/features/BigCursorController.tsx
3739
- var import_react14 = require("react");
4353
+ var import_react15 = require("react");
3740
4354
  var import_jsx_runtime24 = require("react/jsx-runtime");
3741
4355
  var FEATURE_KEY17 = "bigCursor";
3742
4356
  var DEFAULT_VALUE17 = false;
@@ -3747,10 +4361,10 @@ function BigCursorController({
3747
4361
  FEATURE_KEY17,
3748
4362
  DEFAULT_VALUE17
3749
4363
  );
3750
- const [finePointer, setFinePointer] = (0, import_react14.useState)(
4364
+ const [finePointer, setFinePointer] = (0, import_react15.useState)(
3751
4365
  () => hasFinePointer()
3752
4366
  );
3753
- (0, import_react14.useEffect)(() => {
4367
+ (0, import_react15.useEffect)(() => {
3754
4368
  return subscribeFinePointer(() => {
3755
4369
  setFinePointer(hasFinePointer());
3756
4370
  });
@@ -4113,7 +4727,7 @@ function HighlightFocusController() {
4113
4727
  var FocusHighlightController = HighlightFocusController;
4114
4728
 
4115
4729
  // src/features/ReduceMotionController.tsx
4116
- var import_react15 = require("react");
4730
+ var import_react16 = require("react");
4117
4731
  var import_jsx_runtime28 = require("react/jsx-runtime");
4118
4732
  var FEATURE_KEY21 = "reduceMotion";
4119
4733
  var DEFAULT_VALUE21 = false;
@@ -4122,7 +4736,7 @@ function ReduceMotionController() {
4122
4736
  FEATURE_KEY21,
4123
4737
  DEFAULT_VALUE21
4124
4738
  );
4125
- const osReducedMotion = (0, import_react15.useSyncExternalStore)(
4739
+ const osReducedMotion = (0, import_react16.useSyncExternalStore)(
4126
4740
  subscribeReducedMotion,
4127
4741
  isReducedMotionActive,
4128
4742
  () => false
@@ -4147,77 +4761,1890 @@ function ReduceMotionController() {
4147
4761
  ] });
4148
4762
  }
4149
4763
 
4150
- // src/features/ResetController.tsx
4151
- var import_react_dom2 = require("react-dom");
4152
- var import_react16 = require("react");
4764
+ // src/features/TooltipsController.tsx
4153
4765
  var import_jsx_runtime29 = require("react/jsx-runtime");
4154
- function ResetController() {
4155
- const ctx = (0, import_react16.useContext)(AccessibilityContext);
4156
- if (!ctx) {
4157
- throw new Error(
4158
- "ResetController must be used within an <AccessibilityPlugin> provider."
4159
- );
4160
- }
4161
- const actionHost = (0, import_react16.useContext)(PanelActionsContext);
4162
- const { resetAll } = ctx;
4163
- const strings = resolveLocaleStrings(ctx.locale);
4164
- const button = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
4165
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FeatureIcon, { name: "reset" }),
4166
- strings.resetAll
4167
- ] }) });
4168
- return actionHost ? (0, import_react_dom2.createPortal)(button, actionHost) : button;
4169
- }
4170
-
4171
- // src/core/controls/ToggleControl.tsx
4172
- var import_jsx_runtime30 = require("react/jsx-runtime");
4173
- function ToggleControl({
4174
- id,
4175
- label,
4176
- checked,
4177
- onChange,
4178
- disabled = false,
4179
- unavailable = false,
4180
- unavailableReason,
4181
- name,
4182
- description,
4183
- largeControls = false,
4766
+ var FEATURE_KEY22 = "tooltips";
4767
+ var DEFAULT_VALUE22 = false;
4768
+ function TooltipsController({
4184
4769
  className = "",
4185
- style
4770
+ label = "Accessible Tooltips",
4771
+ description = "Show authored alt text and descriptions on hover or focus"
4186
4772
  }) {
4187
- const isInteractive = !disabled && !unavailable;
4188
- const toggleLabel = typeof label === "string" ? label : void 0;
4189
- const handleClick = () => {
4190
- if (isInteractive) {
4191
- onChange(!checked);
4192
- }
4193
- };
4194
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4773
+ const { value, setValue } = useAccessibility(
4774
+ FEATURE_KEY22,
4775
+ DEFAULT_VALUE22
4776
+ );
4777
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4195
4778
  "div",
4196
4779
  {
4197
- className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4198
- style,
4199
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4200
- "button",
4201
- {
4202
- id,
4203
- name,
4204
- type: "button",
4205
- className: `arap-toggle ${checked ? "arap-toggle-active" : ""}`,
4206
- role: "switch",
4207
- "aria-checked": checked,
4208
- "aria-label": toggleLabel,
4209
- "aria-disabled": !isInteractive,
4210
- disabled: !isInteractive,
4211
- onClick: handleClick,
4212
- title: unavailableReason || description || toggleLabel,
4213
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4214
- "span",
4215
- {
4216
- className: "arap-toggle-knob",
4217
- style: {
4218
- transform: checked ? largeControls ? "translateX(28px)" : "translateX(24px)" : "translateX(0)"
4780
+ className: `arap-feature ${className}`,
4781
+ role: "group",
4782
+ "aria-label": label,
4783
+ children: [
4784
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "arap-label", children: [
4785
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FeatureIcon, { name: FEATURE_KEY22 }),
4786
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
4787
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { display: "block" }, children: label }),
4788
+ description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4789
+ "span",
4790
+ {
4791
+ style: {
4792
+ display: "block",
4793
+ fontSize: "11px",
4794
+ fontWeight: 400,
4795
+ color: "var(--arap-muted, #64748b)",
4796
+ marginTop: "1px"
4797
+ },
4798
+ children: description
4219
4799
  }
4220
- }
4800
+ )
4801
+ ] })
4802
+ ] }),
4803
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4804
+ "button",
4805
+ {
4806
+ className: `arap-toggle ${value ? "arap-toggle-active" : ""}`,
4807
+ onClick: () => setValue(!value),
4808
+ "aria-label": label,
4809
+ "aria-pressed": Boolean(value),
4810
+ type: "button",
4811
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "arap-toggle-knob", "aria-hidden": "true" })
4812
+ }
4813
+ )
4814
+ ]
4815
+ }
4816
+ );
4817
+ }
4818
+ var AccessibleTooltipsController = TooltipsController;
4819
+
4820
+ // src/features/PageNavigatorController.tsx
4821
+ var import_react17 = require("react");
4822
+
4823
+ // src/core/pageNavigator.ts
4824
+ var EXCLUDED_TAGS = /* @__PURE__ */ new Set([
4825
+ "SCRIPT",
4826
+ "STYLE",
4827
+ "LINK",
4828
+ "META",
4829
+ "NOSCRIPT",
4830
+ "TEMPLATE"
4831
+ ]);
4832
+ function isElementVisible(el) {
4833
+ if (el.getAttribute("aria-hidden") === "true") return false;
4834
+ if (el.getAttribute("hidden") !== null) return false;
4835
+ if (el.closest("[aria-hidden='true']")) return false;
4836
+ if (el.style.display === "none" || el.style.visibility === "hidden") {
4837
+ return false;
4838
+ }
4839
+ return true;
4840
+ }
4841
+ function scanHeadings(root) {
4842
+ const doc = root || (typeof document !== "undefined" ? document : null);
4843
+ if (!doc) return [];
4844
+ const candidates = doc.querySelectorAll(
4845
+ "h1, h2, h3, h4, h5, h6, [role='heading']"
4846
+ );
4847
+ const items = [];
4848
+ let index = 0;
4849
+ candidates.forEach((node) => {
4850
+ if (!(node instanceof HTMLElement)) return;
4851
+ if (EXCLUDED_TAGS.has(node.tagName)) return;
4852
+ if (node.closest("[data-arap-ui]")) return;
4853
+ if (!isElementVisible(node)) return;
4854
+ let level = 2;
4855
+ const match = node.tagName.match(/^H([1-6])$/i);
4856
+ if (match) {
4857
+ level = parseInt(match[1], 10);
4858
+ } else if (node.getAttribute("role") === "heading") {
4859
+ const ariaLevel = parseInt(node.getAttribute("aria-level") || "2", 10);
4860
+ level = Math.max(1, Math.min(6, isNaN(ariaLevel) ? 2 : ariaLevel));
4861
+ }
4862
+ const text = node.getAttribute("aria-label")?.trim() || node.textContent?.trim() || "";
4863
+ if (!text) return;
4864
+ items.push({
4865
+ id: node.id || `arap-heading-${++index}`,
4866
+ level,
4867
+ text,
4868
+ element: node
4869
+ });
4870
+ });
4871
+ return items;
4872
+ }
4873
+ var LANDMARK_TAGS = {
4874
+ HEADER: "banner",
4875
+ NAV: "navigation",
4876
+ MAIN: "main",
4877
+ ASIDE: "complementary",
4878
+ FOOTER: "contentinfo",
4879
+ FORM: "form",
4880
+ SECTION: "region"
4881
+ };
4882
+ var LANDMARK_TITLES = {
4883
+ banner: "Header (Banner)",
4884
+ navigation: "Navigation",
4885
+ main: "Main Content",
4886
+ complementary: "Sidebar (Complementary)",
4887
+ contentinfo: "Footer (Content Info)",
4888
+ search: "Search",
4889
+ region: "Region",
4890
+ form: "Form"
4891
+ };
4892
+ function isScopedHeaderOrFooter(el) {
4893
+ const parentSection = el.parentElement?.closest(
4894
+ "article, aside, main, nav, section"
4895
+ );
4896
+ return Boolean(parentSection && !parentSection.closest("[data-arap-ui]"));
4897
+ }
4898
+ function scanLandmarks(root) {
4899
+ const doc = root || (typeof document !== "undefined" ? document : null);
4900
+ if (!doc) return [];
4901
+ const candidates = doc.querySelectorAll(
4902
+ "header, nav, main, aside, footer, form[role='search'], [role='banner'], [role='navigation'], [role='main'], [role='complementary'], [role='contentinfo'], [role='search'], [role='region'][aria-label], [role='region'][aria-labelledby], section[aria-label], section[aria-labelledby], a[id]:not([href]), a[name]"
4903
+ );
4904
+ const items = [];
4905
+ let index = 0;
4906
+ candidates.forEach((node) => {
4907
+ if (!(node instanceof HTMLElement)) return;
4908
+ if (EXCLUDED_TAGS.has(node.tagName)) return;
4909
+ if (node.closest("[data-arap-ui]")) return;
4910
+ if (!isElementVisible(node)) return;
4911
+ let type = "";
4912
+ const explicitRole = node.getAttribute("role");
4913
+ if (explicitRole && [
4914
+ "banner",
4915
+ "navigation",
4916
+ "main",
4917
+ "complementary",
4918
+ "contentinfo",
4919
+ "search",
4920
+ "region",
4921
+ "form"
4922
+ ].includes(explicitRole)) {
4923
+ type = explicitRole;
4924
+ } else if (node.tagName in LANDMARK_TAGS) {
4925
+ if ((node.tagName === "HEADER" || node.tagName === "FOOTER") && isScopedHeaderOrFooter(node)) {
4926
+ return;
4927
+ }
4928
+ type = LANDMARK_TAGS[node.tagName];
4929
+ } else if (node.tagName === "A" && (node.id || node.getAttribute("name"))) {
4930
+ type = "anchor";
4931
+ }
4932
+ if (!type) return;
4933
+ let label = node.getAttribute("aria-label")?.trim() || "";
4934
+ if (!label && node.getAttribute("aria-labelledby")) {
4935
+ const labelId = node.getAttribute("aria-labelledby").trim();
4936
+ const labelEl = document.getElementById(labelId);
4937
+ if (labelEl) {
4938
+ label = labelEl.textContent?.trim() || "";
4939
+ }
4940
+ }
4941
+ if (!label) {
4942
+ if (type === "anchor") {
4943
+ label = node.textContent?.trim() || node.id || node.getAttribute("name") || "Named Anchor";
4944
+ } else {
4945
+ label = LANDMARK_TITLES[type] || type.charAt(0).toUpperCase() + type.slice(1);
4946
+ }
4947
+ }
4948
+ items.push({
4949
+ id: node.id || `arap-landmark-${++index}`,
4950
+ type,
4951
+ label,
4952
+ element: node
4953
+ });
4954
+ });
4955
+ return items;
4956
+ }
4957
+ function navigateToElement(element, options = {}) {
4958
+ if (!element || !element.isConnected) return;
4959
+ const isNaturallyFocusable = element instanceof HTMLAnchorElement || element instanceof HTMLButtonElement || element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement || element.hasAttribute("tabindex");
4960
+ const hadTabIndex = element.hasAttribute("tabindex");
4961
+ const previousTabIndex = element.getAttribute("tabindex");
4962
+ if (!isNaturallyFocusable) {
4963
+ element.setAttribute("tabindex", "-1");
4964
+ }
4965
+ const isReduced = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
4966
+ const behavior = options.behavior ?? (isReduced ? "auto" : "smooth");
4967
+ element.scrollIntoView({ behavior, block: "start" });
4968
+ element.focus();
4969
+ if (!isNaturallyFocusable) {
4970
+ const handleBlur = () => {
4971
+ if (hadTabIndex && previousTabIndex !== null) {
4972
+ element.setAttribute("tabindex", previousTabIndex);
4973
+ } else {
4974
+ element.removeAttribute("tabindex");
4975
+ }
4976
+ element.removeEventListener("blur", handleBlur);
4977
+ };
4978
+ element.addEventListener("blur", handleBlur, { once: true });
4979
+ }
4980
+ options.onComplete?.();
4981
+ }
4982
+ function subscribePageStructure(callback) {
4983
+ if (typeof MutationObserver === "undefined" || typeof document === "undefined" || !document.body) {
4984
+ return () => {
4985
+ };
4986
+ }
4987
+ let timer = null;
4988
+ const observer = new MutationObserver((mutations) => {
4989
+ const isExternal = mutations.some((m) => {
4990
+ const target = m.target;
4991
+ if (target instanceof Element && target.closest("[data-arap-ui]")) {
4992
+ return false;
4993
+ }
4994
+ return [...m.addedNodes, ...m.removedNodes].some((node) => {
4995
+ return !(node instanceof Element && node.closest("[data-arap-ui]"));
4996
+ });
4997
+ });
4998
+ if (!isExternal) return;
4999
+ if (timer) clearTimeout(timer);
5000
+ timer = setTimeout(() => {
5001
+ callback();
5002
+ }, 100);
5003
+ });
5004
+ observer.observe(document.body, { childList: true, subtree: true });
5005
+ return () => {
5006
+ if (timer) clearTimeout(timer);
5007
+ observer.disconnect();
5008
+ };
5009
+ }
5010
+
5011
+ // src/features/PageNavigatorController.tsx
5012
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5013
+ function PageNavigatorController({
5014
+ className = "",
5015
+ label = "Page Navigator",
5016
+ description = "Explore headings and landmarks",
5017
+ closeOnNavigate = false
5018
+ }) {
5019
+ const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
5020
+ const [activeTab, setActiveTab] = (0, import_react17.useState)(
5021
+ "headings"
5022
+ );
5023
+ const [headings, setHeadings] = (0, import_react17.useState)([]);
5024
+ const [landmarks, setLandmarks] = (0, import_react17.useState)([]);
5025
+ const [search, setSearch] = (0, import_react17.useState)("");
5026
+ const triggerRef = (0, import_react17.useRef)(null);
5027
+ const dialogRef = (0, import_react17.useRef)(null);
5028
+ const refreshStructure = (0, import_react17.useCallback)(() => {
5029
+ setHeadings(scanHeadings());
5030
+ setLandmarks(scanLandmarks());
5031
+ }, []);
5032
+ const handleOpen = () => {
5033
+ refreshStructure();
5034
+ setIsOpen(true);
5035
+ };
5036
+ const handleClose = () => {
5037
+ setIsOpen(false);
5038
+ triggerRef.current?.focus();
5039
+ };
5040
+ (0, import_react17.useEffect)(() => {
5041
+ if (!isOpen) return;
5042
+ return subscribePageStructure(refreshStructure);
5043
+ }, [isOpen, refreshStructure]);
5044
+ (0, import_react17.useEffect)(() => {
5045
+ if (isOpen) {
5046
+ dialogRef.current?.focus();
5047
+ }
5048
+ }, [isOpen]);
5049
+ const handleNavigate = (element) => {
5050
+ navigateToElement(element, {
5051
+ onComplete: () => {
5052
+ if (closeOnNavigate) {
5053
+ setIsOpen(false);
5054
+ }
5055
+ }
5056
+ });
5057
+ };
5058
+ const filteredHeadings = search.trim() ? headings.filter(
5059
+ (h) => h.text.toLowerCase().includes(search.toLowerCase())
5060
+ ) : headings;
5061
+ const filteredLandmarks = search.trim() ? landmarks.filter(
5062
+ (l) => l.label.toLowerCase().includes(search.toLowerCase())
5063
+ ) : landmarks;
5064
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5065
+ "div",
5066
+ {
5067
+ className: `arap-feature arap-feature-expandable ${className}`,
5068
+ role: "group",
5069
+ "aria-label": label,
5070
+ children: [
5071
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5072
+ "div",
5073
+ {
5074
+ style: {
5075
+ display: "flex",
5076
+ alignItems: "center",
5077
+ justifyContent: "space-between",
5078
+ width: "100%"
5079
+ },
5080
+ children: [
5081
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "arap-label", children: [
5082
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FeatureIcon, { name: "pageNavigator" }),
5083
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
5084
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { display: "block" }, children: label }),
5085
+ description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5086
+ "span",
5087
+ {
5088
+ style: {
5089
+ display: "block",
5090
+ fontSize: "11px",
5091
+ fontWeight: 400,
5092
+ color: "var(--arap-muted, #64748b)",
5093
+ marginTop: "1px"
5094
+ },
5095
+ children: description
5096
+ }
5097
+ )
5098
+ ] })
5099
+ ] }),
5100
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5101
+ "button",
5102
+ {
5103
+ ref: triggerRef,
5104
+ className: "arap-btn-sm",
5105
+ type: "button",
5106
+ "aria-expanded": isOpen,
5107
+ "aria-controls": "arap-page-navigator-dialog",
5108
+ onClick: () => {
5109
+ if (isOpen) {
5110
+ handleClose();
5111
+ } else {
5112
+ handleOpen();
5113
+ }
5114
+ },
5115
+ children: isOpen ? "Close" : "Explore"
5116
+ }
5117
+ )
5118
+ ]
5119
+ }
5120
+ ),
5121
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5122
+ "div",
5123
+ {
5124
+ ref: dialogRef,
5125
+ id: "arap-page-navigator-dialog",
5126
+ className: "arap-navigator-dialog",
5127
+ role: "region",
5128
+ "aria-label": "Page Structure Explorer",
5129
+ tabIndex: -1,
5130
+ onKeyDown: (event) => {
5131
+ if (event.key === "Escape") {
5132
+ event.stopPropagation();
5133
+ handleClose();
5134
+ }
5135
+ },
5136
+ children: [
5137
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5138
+ "div",
5139
+ {
5140
+ className: "arap-navigator-tabs",
5141
+ role: "tablist",
5142
+ "aria-label": "Structure views",
5143
+ children: [
5144
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5145
+ "button",
5146
+ {
5147
+ id: "arap-tab-headings",
5148
+ className: `arap-navigator-tab ${activeTab === "headings" ? "arap-navigator-tab-active" : ""}`,
5149
+ role: "tab",
5150
+ "aria-selected": activeTab === "headings",
5151
+ "aria-controls": "arap-panel-headings",
5152
+ type: "button",
5153
+ onClick: () => setActiveTab("headings"),
5154
+ onKeyDown: (e) => {
5155
+ if (e.key === "ArrowRight") {
5156
+ document.getElementById("arap-tab-landmarks")?.focus();
5157
+ setActiveTab("landmarks");
5158
+ }
5159
+ },
5160
+ children: [
5161
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FeatureIcon, { name: "headings" }),
5162
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
5163
+ "Headings (",
5164
+ headings.length,
5165
+ ")"
5166
+ ] })
5167
+ ]
5168
+ }
5169
+ ),
5170
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5171
+ "button",
5172
+ {
5173
+ id: "arap-tab-landmarks",
5174
+ className: `arap-navigator-tab ${activeTab === "landmarks" ? "arap-navigator-tab-active" : ""}`,
5175
+ role: "tab",
5176
+ "aria-selected": activeTab === "landmarks",
5177
+ "aria-controls": "arap-panel-landmarks",
5178
+ type: "button",
5179
+ onClick: () => setActiveTab("landmarks"),
5180
+ onKeyDown: (e) => {
5181
+ if (e.key === "ArrowLeft") {
5182
+ document.getElementById("arap-tab-headings")?.focus();
5183
+ setActiveTab("headings");
5184
+ }
5185
+ },
5186
+ children: [
5187
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FeatureIcon, { name: "landmarks" }),
5188
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
5189
+ "Landmarks (",
5190
+ landmarks.length,
5191
+ ")"
5192
+ ] })
5193
+ ]
5194
+ }
5195
+ )
5196
+ ]
5197
+ }
5198
+ ),
5199
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "arap-navigator-search-box", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5200
+ "input",
5201
+ {
5202
+ type: "search",
5203
+ className: "arap-navigator-search",
5204
+ placeholder: `Filter ${activeTab}...`,
5205
+ value: search,
5206
+ onChange: (e) => setSearch(e.target.value),
5207
+ "aria-label": `Filter ${activeTab}`
5208
+ }
5209
+ ) }),
5210
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "arap-navigator-content", children: [
5211
+ activeTab === "headings" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5212
+ "div",
5213
+ {
5214
+ id: "arap-panel-headings",
5215
+ role: "tabpanel",
5216
+ "aria-labelledby": "arap-tab-headings",
5217
+ children: filteredHeadings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "arap-navigator-empty", role: "status", children: headings.length === 0 ? "No headings found on this page." : "No matching headings." }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { className: "arap-navigator-list", role: "list", children: filteredHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { className: "arap-navigator-item", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5218
+ "button",
5219
+ {
5220
+ type: "button",
5221
+ className: "arap-navigator-jump-btn",
5222
+ style: {
5223
+ paddingLeft: `${Math.max(8, (h.level - 1) * 12 + 8)}px`
5224
+ },
5225
+ onClick: () => handleNavigate(h.element),
5226
+ children: [
5227
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5228
+ "span",
5229
+ {
5230
+ className: "arap-navigator-badge arap-navigator-badge-h",
5231
+ "aria-hidden": "true",
5232
+ children: [
5233
+ "H",
5234
+ h.level
5235
+ ]
5236
+ }
5237
+ ),
5238
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "arap-navigator-item-text", children: h.text })
5239
+ ]
5240
+ }
5241
+ ) }, `${h.id}-${i}`)) })
5242
+ }
5243
+ ),
5244
+ activeTab === "landmarks" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5245
+ "div",
5246
+ {
5247
+ id: "arap-panel-landmarks",
5248
+ role: "tabpanel",
5249
+ "aria-labelledby": "arap-tab-landmarks",
5250
+ children: filteredLandmarks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "arap-navigator-empty", role: "status", children: landmarks.length === 0 ? "No landmarks found on this page." : "No matching landmarks." }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { className: "arap-navigator-list", role: "list", children: filteredLandmarks.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { className: "arap-navigator-item", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5251
+ "button",
5252
+ {
5253
+ type: "button",
5254
+ className: "arap-navigator-jump-btn",
5255
+ onClick: () => handleNavigate(l.element),
5256
+ children: [
5257
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5258
+ "span",
5259
+ {
5260
+ className: "arap-navigator-badge arap-navigator-badge-l",
5261
+ "aria-hidden": "true",
5262
+ children: l.type.toUpperCase()
5263
+ }
5264
+ ),
5265
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "arap-navigator-item-text", children: l.label })
5266
+ ]
5267
+ }
5268
+ ) }, `${l.id}-${i}`)) })
5269
+ }
5270
+ )
5271
+ ] })
5272
+ ]
5273
+ }
5274
+ )
5275
+ ]
5276
+ }
5277
+ );
5278
+ }
5279
+ var HeadingsNavigatorController = PageNavigatorController;
5280
+ var PageStructureController = PageNavigatorController;
5281
+
5282
+ // src/features/ProfilesController.tsx
5283
+ var import_react18 = require("react");
5284
+
5285
+ // src/core/controls/ProfilePreviewCard.tsx
5286
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5287
+ function ProfilePreviewCard({
5288
+ profile,
5289
+ isActive,
5290
+ onApply,
5291
+ onRevert,
5292
+ largeControls = false,
5293
+ className = "",
5294
+ style
5295
+ }) {
5296
+ const affectedKeys = Object.keys(
5297
+ profile.settings
5298
+ );
5299
+ const formatKeyName = (key) => {
5300
+ switch (key) {
5301
+ case "fontScale":
5302
+ return "Font Size";
5303
+ case "lineHeight":
5304
+ return "Line Height";
5305
+ case "contrastMode":
5306
+ return "Contrast";
5307
+ case "reduceMotion":
5308
+ return "Reduce Motion";
5309
+ case "textAlign":
5310
+ return "Text Align";
5311
+ case "highlightLinks":
5312
+ return "Highlight Links";
5313
+ case "highlightFocus":
5314
+ return "Highlight Focus";
5315
+ case "cursorSize":
5316
+ return "Cursor Size";
5317
+ case "readerMode":
5318
+ return "Reading Mode";
5319
+ case "saturation":
5320
+ return "Saturation";
5321
+ case "hideDecorativeImages":
5322
+ return "Hide Images";
5323
+ default:
5324
+ return key.replace(/([A-Z])/g, " $1").trim();
5325
+ }
5326
+ };
5327
+ const formatSettingValue = (key, val) => {
5328
+ if (typeof val === "boolean") return val ? "On" : "Off";
5329
+ if (key === "fontScale" && typeof val === "number")
5330
+ return `${Math.round(val * 100)}%`;
5331
+ if (key === "lineHeight" && typeof val === "number")
5332
+ return `${Math.round(val * 100)}%`;
5333
+ if (val === null || val === void 0) return "Original";
5334
+ return String(val);
5335
+ };
5336
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
5337
+ "div",
5338
+ {
5339
+ role: "group",
5340
+ "aria-label": `${profile.label} profile`,
5341
+ className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
5342
+ style,
5343
+ children: [
5344
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "arap-profile-header", children: [
5345
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "arap-profile-title-row", children: [
5346
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h4", { className: "arap-profile-title", children: profile.label }),
5347
+ isActive && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5348
+ "span",
5349
+ {
5350
+ className: "arap-profile-active-badge",
5351
+ "aria-label": "Active profile",
5352
+ children: "\u2713 Active"
5353
+ }
5354
+ )
5355
+ ] }),
5356
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "arap-profile-desc", children: profile.description })
5357
+ ] }),
5358
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "arap-profile-affected", children: [
5359
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
5360
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
5361
+ const val = profile.settings[key];
5362
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "arap-profile-chip", children: [
5363
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("strong", { children: [
5364
+ formatKeyName(key),
5365
+ ":"
5366
+ ] }),
5367
+ " ",
5368
+ formatSettingValue(key, val)
5369
+ ] }, key);
5370
+ }) })
5371
+ ] }),
5372
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5373
+ "button",
5374
+ {
5375
+ type: "button",
5376
+ className: "arap-profile-revert-btn",
5377
+ onClick: onRevert,
5378
+ "aria-label": `Revert ${profile.label} profile`,
5379
+ children: "Revert to custom settings"
5380
+ }
5381
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5382
+ "button",
5383
+ {
5384
+ type: "button",
5385
+ className: "arap-profile-apply-btn",
5386
+ onClick: () => onApply(profile),
5387
+ "aria-label": `Apply ${profile.label} profile`,
5388
+ children: "Apply Profile"
5389
+ }
5390
+ ) })
5391
+ ]
5392
+ }
5393
+ );
5394
+ }
5395
+
5396
+ // src/core/controls/FeatureStatusState.tsx
5397
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5398
+ function SearchCount({
5399
+ totalCount,
5400
+ matchedCount,
5401
+ query,
5402
+ className = "",
5403
+ style
5404
+ }) {
5405
+ const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
5406
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5407
+ "div",
5408
+ {
5409
+ role: "status",
5410
+ "aria-live": "polite",
5411
+ className: `arap-search-count ${className}`,
5412
+ style,
5413
+ children: text
5414
+ }
5415
+ );
5416
+ }
5417
+ function EmptyState({
5418
+ title = "No matching tools found",
5419
+ description = "Try adjusting your search query or reset filters.",
5420
+ actionLabel = "Clear search",
5421
+ onAction,
5422
+ icon,
5423
+ className = "",
5424
+ style
5425
+ }) {
5426
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5427
+ "div",
5428
+ {
5429
+ role: "status",
5430
+ className: `arap-empty-state ${className}`,
5431
+ style,
5432
+ children: [
5433
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
5434
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h3", { className: "arap-empty-title", children: title }),
5435
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "arap-empty-desc", children: description }),
5436
+ onAction && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
5437
+ ]
5438
+ }
5439
+ );
5440
+ }
5441
+ function ErrorState({
5442
+ title = "Something went wrong",
5443
+ message,
5444
+ onRetry,
5445
+ retryLabel = "Try again",
5446
+ className = "",
5447
+ style
5448
+ }) {
5449
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5450
+ "div",
5451
+ {
5452
+ role: "alert",
5453
+ className: `arap-error-state arap-card-alert arap-card-error ${className}`,
5454
+ style,
5455
+ children: [
5456
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
5457
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "arap-error-content", children: [
5458
+ title && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h4", { className: "arap-error-title", children: title }),
5459
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "arap-error-message", children: message }),
5460
+ onRetry && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
5461
+ ] })
5462
+ ]
5463
+ }
5464
+ );
5465
+ }
5466
+
5467
+ // src/features/ProfilesController.tsx
5468
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5469
+ function ProfilesController({
5470
+ className = "",
5471
+ label = "Accessibility Profiles",
5472
+ description = "Explore suggested preference combinations",
5473
+ largeControls = false,
5474
+ onProfileChange
5475
+ }) {
5476
+ const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
5477
+ const [search, setSearch] = (0, import_react18.useState)("");
5478
+ const dialogId = "arap-profiles-dialog";
5479
+ const searchInputId = (0, import_react18.useId)();
5480
+ const triggerRef = (0, import_react18.useRef)(null);
5481
+ const {
5482
+ profiles,
5483
+ activeProfile,
5484
+ activeProfileState,
5485
+ applyProfile,
5486
+ revertProfile,
5487
+ isProfileActive
5488
+ } = useProfiles();
5489
+ const handleApply = (profileId) => {
5490
+ applyProfile(profileId);
5491
+ onProfileChange?.(profileId);
5492
+ };
5493
+ const handleRevert = () => {
5494
+ revertProfile();
5495
+ onProfileChange?.(null);
5496
+ };
5497
+ const filteredProfiles = (0, import_react18.useMemo)(() => {
5498
+ const q = search.trim().toLowerCase();
5499
+ if (!q) return profiles;
5500
+ return profiles.filter((p) => {
5501
+ const nameMatch = p.label.toLowerCase().includes(q);
5502
+ const descMatch = p.description.toLowerCase().includes(q);
5503
+ const settingMatch = Object.keys(p.settings).some(
5504
+ (k) => k.toLowerCase().includes(q)
5505
+ );
5506
+ return nameMatch || descMatch || settingMatch;
5507
+ });
5508
+ }, [profiles, search]);
5509
+ const hasOverrides = Boolean(activeProfileState?.overrides) && Object.keys(activeProfileState?.overrides ?? {}).length > 0;
5510
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5511
+ "div",
5512
+ {
5513
+ className: `arap-feature arap-feature-expandable ${largeControls ? "arap-large-controls" : ""} ${className}`,
5514
+ role: "group",
5515
+ "aria-label": label,
5516
+ children: [
5517
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5518
+ "div",
5519
+ {
5520
+ style: {
5521
+ display: "flex",
5522
+ alignItems: "center",
5523
+ justifyContent: "space-between",
5524
+ width: "100%"
5525
+ },
5526
+ children: [
5527
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "arap-label", children: [
5528
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FeatureIcon, { name: "profiles" }),
5529
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
5530
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { style: { display: "block" }, children: label }),
5531
+ description && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5532
+ "span",
5533
+ {
5534
+ style: {
5535
+ display: "block",
5536
+ fontSize: "11px",
5537
+ fontWeight: 400,
5538
+ color: "var(--arap-muted, #64748b)",
5539
+ marginTop: "1px"
5540
+ },
5541
+ children: activeProfile ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5542
+ "span",
5543
+ {
5544
+ style: {
5545
+ color: "var(--arap-primary, #2563eb)",
5546
+ fontWeight: 500
5547
+ },
5548
+ children: [
5549
+ "Active: ",
5550
+ activeProfile.label,
5551
+ hasOverrides && " (Customized)"
5552
+ ]
5553
+ }
5554
+ ) : description
5555
+ }
5556
+ )
5557
+ ] })
5558
+ ] }),
5559
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
5560
+ activeProfile && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5561
+ "button",
5562
+ {
5563
+ type: "button",
5564
+ className: "arap-btn-sm",
5565
+ onClick: handleRevert,
5566
+ "aria-label": "Revert active profile to custom settings",
5567
+ title: "Revert to custom settings",
5568
+ children: "Revert"
5569
+ }
5570
+ ),
5571
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5572
+ "button",
5573
+ {
5574
+ ref: triggerRef,
5575
+ className: "arap-btn-sm",
5576
+ type: "button",
5577
+ "aria-expanded": isOpen,
5578
+ "aria-controls": dialogId,
5579
+ onClick: () => setIsOpen(!isOpen),
5580
+ children: isOpen ? "Close" : "Browse"
5581
+ }
5582
+ )
5583
+ ] })
5584
+ ]
5585
+ }
5586
+ ),
5587
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5588
+ "div",
5589
+ {
5590
+ id: dialogId,
5591
+ className: "arap-profiles-panel",
5592
+ style: {
5593
+ marginTop: "12px",
5594
+ paddingTop: "12px",
5595
+ borderTop: "1px solid var(--arap-divider, #e2e8f0)"
5596
+ },
5597
+ children: [
5598
+ activeProfile && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5599
+ "div",
5600
+ {
5601
+ className: "arap-profile-active-banner",
5602
+ style: {
5603
+ display: "flex",
5604
+ alignItems: "center",
5605
+ justifyContent: "space-between",
5606
+ padding: "8px 12px",
5607
+ marginBottom: "12px",
5608
+ background: "rgba(37, 99, 235, 0.08)",
5609
+ border: "1px solid rgba(37, 99, 235, 0.2)",
5610
+ borderRadius: "6px"
5611
+ },
5612
+ children: [
5613
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
5614
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5615
+ "span",
5616
+ {
5617
+ style: {
5618
+ display: "block",
5619
+ fontWeight: 600,
5620
+ fontSize: "13px",
5621
+ color: "var(--arap-primary, #2563eb)"
5622
+ },
5623
+ children: [
5624
+ "\u2713 Current Profile: ",
5625
+ activeProfile.label
5626
+ ]
5627
+ }
5628
+ ),
5629
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5630
+ "span",
5631
+ {
5632
+ style: {
5633
+ display: "block",
5634
+ fontSize: "11px",
5635
+ color: "var(--arap-muted, #64748b)"
5636
+ },
5637
+ children: hasOverrides ? "Your custom adjustments survive alongside this profile." : "Neutral suggestion applied. Adjust any setting freely."
5638
+ }
5639
+ )
5640
+ ] }),
5641
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5642
+ "button",
5643
+ {
5644
+ type: "button",
5645
+ className: "arap-btn-sm",
5646
+ onClick: handleRevert,
5647
+ "aria-label": "Revert active profile",
5648
+ children: "Revert to Custom"
5649
+ }
5650
+ )
5651
+ ]
5652
+ }
5653
+ ),
5654
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5655
+ "div",
5656
+ {
5657
+ className: "arap-navigator-search",
5658
+ style: { marginBottom: "10px" },
5659
+ children: [
5660
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: searchInputId, className: "arap-sr-only", children: "Filter profiles" }),
5661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5662
+ "input",
5663
+ {
5664
+ id: searchInputId,
5665
+ type: "search",
5666
+ className: "arap-search-input",
5667
+ value: search,
5668
+ onChange: (e) => setSearch(e.target.value),
5669
+ placeholder: "Search 8 accessibility profiles...",
5670
+ "aria-label": "Filter profiles"
5671
+ }
5672
+ ),
5673
+ search && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5674
+ "button",
5675
+ {
5676
+ type: "button",
5677
+ className: "arap-search-clear",
5678
+ onClick: () => setSearch(""),
5679
+ "aria-label": "Clear profile filter",
5680
+ children: "\xD7"
5681
+ }
5682
+ )
5683
+ ]
5684
+ }
5685
+ ),
5686
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5687
+ SearchCount,
5688
+ {
5689
+ totalCount: profiles.length,
5690
+ matchedCount: filteredProfiles.length,
5691
+ query: search
5692
+ }
5693
+ ),
5694
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5695
+ "div",
5696
+ {
5697
+ className: "arap-profiles-list",
5698
+ style: {
5699
+ display: "flex",
5700
+ flexDirection: "column",
5701
+ gap: "10px",
5702
+ marginTop: "8px"
5703
+ },
5704
+ children: filteredProfiles.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5705
+ EmptyState,
5706
+ {
5707
+ title: "No profiles found",
5708
+ description: `No accessibility profiles match "${search}".`,
5709
+ actionLabel: "Clear filter",
5710
+ onAction: () => setSearch("")
5711
+ }
5712
+ ) : filteredProfiles.map((p) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5713
+ ProfilePreviewCard,
5714
+ {
5715
+ profile: p,
5716
+ isActive: isProfileActive(p.id),
5717
+ onApply: () => handleApply(p.id),
5718
+ onRevert: handleRevert,
5719
+ largeControls
5720
+ },
5721
+ p.id
5722
+ ))
5723
+ }
5724
+ )
5725
+ ]
5726
+ }
5727
+ )
5728
+ ]
5729
+ }
5730
+ );
5731
+ }
5732
+ var ProfileController = ProfilesController;
5733
+ var AccessibilityProfilesController = ProfilesController;
5734
+
5735
+ // src/features/ResetController.tsx
5736
+ var import_react_dom2 = require("react-dom");
5737
+ var import_react19 = require("react");
5738
+ var import_jsx_runtime34 = require("react/jsx-runtime");
5739
+ function ResetController() {
5740
+ const ctx = (0, import_react19.useContext)(AccessibilityContext);
5741
+ if (!ctx) {
5742
+ throw new Error(
5743
+ "ResetController must be used within an <AccessibilityPlugin> provider."
5744
+ );
5745
+ }
5746
+ const actionHost = (0, import_react19.useContext)(PanelActionsContext);
5747
+ const { resetAll } = ctx;
5748
+ const strings = resolveLocaleStrings(ctx.locale);
5749
+ const button = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
5750
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FeatureIcon, { name: "reset" }),
5751
+ strings.resetAll
5752
+ ] }) });
5753
+ return actionHost ? (0, import_react_dom2.createPortal)(button, actionHost) : button;
5754
+ }
5755
+
5756
+ // src/features/PresetsController.tsx
5757
+ var import_react21 = require("react");
5758
+
5759
+ // src/core/usePresets.ts
5760
+ var import_react20 = require("react");
5761
+
5762
+ // src/core/presets.ts
5763
+ var ALLOWED_PREFERENCE_KEYS = Object.freeze([
5764
+ "fontScale",
5765
+ "lineHeight",
5766
+ "letterSpacingEm",
5767
+ "wordSpacingEm",
5768
+ "paragraphSpacingEm",
5769
+ "textAlign",
5770
+ "contrastMode",
5771
+ "highlightLinks",
5772
+ "highlightFocus",
5773
+ "reduceMotion",
5774
+ "hideDecorativeImages",
5775
+ "fontFamily",
5776
+ "cursorSize",
5777
+ "readerMode",
5778
+ "saturation",
5779
+ "tooltips"
5780
+ ]);
5781
+ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
5782
+ "__proto__",
5783
+ "constructor",
5784
+ "prototype",
5785
+ "token",
5786
+ "auth",
5787
+ "password",
5788
+ "email",
5789
+ "user",
5790
+ "userId",
5791
+ "session",
5792
+ "cookie",
5793
+ "transcript",
5794
+ "recording",
5795
+ "pageContent",
5796
+ "notes",
5797
+ "input"
5798
+ ]);
5799
+ function sanitizePreferences(raw) {
5800
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5801
+ return {};
5802
+ }
5803
+ const record = raw;
5804
+ const clean = {};
5805
+ for (const key of ALLOWED_PREFERENCE_KEYS) {
5806
+ if (key in record && record[key] !== void 0 && !FORBIDDEN_KEYS.has(key)) {
5807
+ clean[key] = normalizePreferenceValue(
5808
+ key,
5809
+ record[key]
5810
+ );
5811
+ }
5812
+ }
5813
+ return clean;
5814
+ }
5815
+ function generatePresetId() {
5816
+ const timestamp = Date.now();
5817
+ const randomPart = Math.random().toString(36).substring(2, 9);
5818
+ return `preset_${timestamp}_${randomPart}`;
5819
+ }
5820
+ function createCustomPreset(name, settings) {
5821
+ const trimmedName = (name || "").trim() || `Preset ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`;
5822
+ const sanitizedSettings = sanitizePreferences(settings);
5823
+ return {
5824
+ id: generatePresetId(),
5825
+ name: trimmedName.slice(0, 60),
5826
+ // clamp name length
5827
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5828
+ settings: sanitizedSettings
5829
+ };
5830
+ }
5831
+ function isValidCustomPreset(item) {
5832
+ if (!item || typeof item !== "object" || Array.isArray(item)) {
5833
+ return false;
5834
+ }
5835
+ const candidate = item;
5836
+ return typeof candidate.id === "string" && candidate.id.length > 0 && typeof candidate.name === "string" && candidate.name.length > 0 && typeof candidate.createdAt === "string" && typeof candidate.settings === "object" && candidate.settings !== null && !Array.isArray(candidate.settings);
5837
+ }
5838
+ function exportPresetsToJson(options) {
5839
+ const envelope = {
5840
+ $schema: "https://accessibility-plugin.org/schemas/presets-v1.json",
5841
+ version: 1,
5842
+ app: "accessibility-plugin-react",
5843
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
5844
+ presets: options.presets.map((p) => ({
5845
+ id: p.id,
5846
+ name: p.name,
5847
+ createdAt: p.createdAt,
5848
+ updatedAt: p.updatedAt,
5849
+ settings: sanitizePreferences(p.settings)
5850
+ }))
5851
+ };
5852
+ if (options.currentSettings) {
5853
+ envelope.currentSettings = sanitizePreferences(options.currentSettings);
5854
+ }
5855
+ return JSON.stringify(envelope, null, 2);
5856
+ }
5857
+ function downloadJsonFile(filename, jsonContent) {
5858
+ if (typeof window === "undefined" || typeof document === "undefined") return;
5859
+ const blob = new Blob([jsonContent], {
5860
+ type: "application/json;charset=utf-8"
5861
+ });
5862
+ const url = URL.createObjectURL(blob);
5863
+ const anchor = document.createElement("a");
5864
+ anchor.href = url;
5865
+ anchor.download = filename.endsWith(".json") ? filename : `${filename}.json`;
5866
+ anchor.style.display = "none";
5867
+ document.body.appendChild(anchor);
5868
+ anchor.click();
5869
+ document.body.removeChild(anchor);
5870
+ URL.revokeObjectURL(url);
5871
+ }
5872
+ function validateAndParseImport(jsonString) {
5873
+ if (!jsonString || typeof jsonString !== "string" || !jsonString.trim()) {
5874
+ return {
5875
+ success: false,
5876
+ error: "Import file is empty."
5877
+ };
5878
+ }
5879
+ let raw;
5880
+ try {
5881
+ raw = JSON.parse(jsonString);
5882
+ } catch {
5883
+ return {
5884
+ success: false,
5885
+ error: "Invalid JSON format: syntax error in file."
5886
+ };
5887
+ }
5888
+ if (!raw || typeof raw !== "object") {
5889
+ return {
5890
+ success: false,
5891
+ error: "Malformed import: file root must be an object or array."
5892
+ };
5893
+ }
5894
+ if (Array.isArray(raw)) {
5895
+ const validPresets = [];
5896
+ for (const item of raw) {
5897
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
5898
+ const p = item;
5899
+ const name = typeof p.name === "string" ? p.name : "Imported Preset";
5900
+ const id = typeof p.id === "string" && p.id ? p.id : generatePresetId();
5901
+ const createdAt = typeof p.createdAt === "string" ? p.createdAt : (/* @__PURE__ */ new Date()).toISOString();
5902
+ const settings = sanitizePreferences(p.settings || p);
5903
+ if (Object.keys(settings).length > 0) {
5904
+ validPresets.push({ id, name, createdAt, settings });
5905
+ }
5906
+ }
5907
+ }
5908
+ if (validPresets.length === 0) {
5909
+ return {
5910
+ success: false,
5911
+ error: "Array did not contain any valid accessibility presets."
5912
+ };
5913
+ }
5914
+ return {
5915
+ success: true,
5916
+ presets: validPresets,
5917
+ message: `Successfully imported ${validPresets.length} preset(s).`
5918
+ };
5919
+ }
5920
+ const obj = raw;
5921
+ if ("version" in obj && typeof obj.version === "number") {
5922
+ if (obj.version > 1) {
5923
+ return {
5924
+ success: false,
5925
+ error: `Unsupported schema version: version ${obj.version} is newer than supported version 1.`
5926
+ };
5927
+ }
5928
+ if (obj.version < 1) {
5929
+ return {
5930
+ success: false,
5931
+ error: `Unsupported schema version: version ${obj.version} is not recognized.`
5932
+ };
5933
+ }
5934
+ }
5935
+ const importedPresets = [];
5936
+ if (Array.isArray(obj.presets)) {
5937
+ for (const item of obj.presets) {
5938
+ if (isValidCustomPreset(item)) {
5939
+ importedPresets.push({
5940
+ id: item.id,
5941
+ name: item.name,
5942
+ createdAt: item.createdAt,
5943
+ updatedAt: item.updatedAt,
5944
+ settings: sanitizePreferences(item.settings)
5945
+ });
5946
+ } else if (typeof item === "object" && item !== null) {
5947
+ const record = item;
5948
+ const name = typeof record.name === "string" ? record.name : "Imported Preset";
5949
+ const id = typeof record.id === "string" && record.id ? record.id : generatePresetId();
5950
+ const createdAt = typeof record.createdAt === "string" ? record.createdAt : (/* @__PURE__ */ new Date()).toISOString();
5951
+ const settings = sanitizePreferences(record.settings || record);
5952
+ if (Object.keys(settings).length > 0) {
5953
+ importedPresets.push({ id, name, createdAt, settings });
5954
+ }
5955
+ }
5956
+ }
5957
+ }
5958
+ let currentSettings;
5959
+ if ("currentSettings" in obj && typeof obj.currentSettings === "object") {
5960
+ currentSettings = sanitizePreferences(obj.currentSettings);
5961
+ } else if (!("presets" in obj) && !("version" in obj)) {
5962
+ const flat = sanitizePreferences(obj);
5963
+ if (Object.keys(flat).length > 0) {
5964
+ currentSettings = flat;
5965
+ }
5966
+ }
5967
+ if (importedPresets.length === 0 && (!currentSettings || Object.keys(currentSettings).length === 0)) {
5968
+ return {
5969
+ success: false,
5970
+ error: "No valid presets or accessibility settings found in the file."
5971
+ };
5972
+ }
5973
+ const parts = [];
5974
+ if (importedPresets.length > 0)
5975
+ parts.push(`${importedPresets.length} preset(s)`);
5976
+ if (currentSettings && Object.keys(currentSettings).length > 0)
5977
+ parts.push("current settings");
5978
+ return {
5979
+ success: true,
5980
+ presets: importedPresets,
5981
+ currentSettings,
5982
+ message: `Successfully imported ${parts.join(" and ")}.`
5983
+ };
5984
+ }
5985
+ function applyCustomPresetToStore(preset, setFeatureState) {
5986
+ const mapped = mapProfileSettingsToFeatures(preset.settings);
5987
+ for (const [key, value] of Object.entries(mapped)) {
5988
+ try {
5989
+ setFeatureState(key, value);
5990
+ } catch {
5991
+ }
5992
+ }
5993
+ }
5994
+
5995
+ // src/core/usePresets.ts
5996
+ function usePresets() {
5997
+ const ctx = (0, import_react20.useContext)(AccessibilityContext);
5998
+ if (!ctx) {
5999
+ throw new Error(
6000
+ "usePresets must be used within an <AccessibilityPlugin> provider."
6001
+ );
6002
+ }
6003
+ const { value: rawPresets, setValue: setPresets } = useAccessibility("customPresets", []);
6004
+ const presets = (0, import_react20.useMemo)(
6005
+ () => Array.isArray(rawPresets) ? rawPresets : [],
6006
+ [rawPresets]
6007
+ );
6008
+ const currentSettings = (0, import_react20.useMemo)(
6009
+ () => mapFeaturesToProfileSettings(ctx.state.features),
6010
+ [ctx.state.features]
6011
+ );
6012
+ const saveCurrentAsPreset = (0, import_react20.useCallback)(
6013
+ (name) => {
6014
+ const newPreset = createCustomPreset(name, currentSettings);
6015
+ setPresets([...presets, newPreset]);
6016
+ return newPreset;
6017
+ },
6018
+ [currentSettings, presets, setPresets]
6019
+ );
6020
+ const applyPreset = (0, import_react20.useCallback)(
6021
+ (presetId) => {
6022
+ const found = presets.find((p) => p.id === presetId);
6023
+ if (!found) return false;
6024
+ applyCustomPresetToStore(found, ctx.setFeatureState);
6025
+ return true;
6026
+ },
6027
+ [ctx.setFeatureState, presets]
6028
+ );
6029
+ const deletePreset = (0, import_react20.useCallback)(
6030
+ (presetId) => {
6031
+ const next = presets.filter((p) => p.id !== presetId);
6032
+ if (next.length === presets.length) return false;
6033
+ setPresets(next);
6034
+ return true;
6035
+ },
6036
+ [presets, setPresets]
6037
+ );
6038
+ const exportPresets = (0, import_react20.useCallback)(() => {
6039
+ return exportPresetsToJson({ presets, currentSettings });
6040
+ }, [currentSettings, presets]);
6041
+ const downloadExport = (0, import_react20.useCallback)(
6042
+ (filename) => {
6043
+ const json = exportPresetsToJson({ presets, currentSettings });
6044
+ const dateStr = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
6045
+ const targetName = filename || `accessibility-preferences-${dateStr}.json`;
6046
+ downloadJsonFile(targetName, json);
6047
+ },
6048
+ [currentSettings, presets]
6049
+ );
6050
+ const importFromJson = (0, import_react20.useCallback)(
6051
+ (jsonStr) => {
6052
+ const result = validateAndParseImport(jsonStr);
6053
+ if (!result.success) {
6054
+ return result;
6055
+ }
6056
+ if (result.presets.length > 0) {
6057
+ const existingMap = new Map(presets.map((p) => [p.id, p]));
6058
+ for (const p of result.presets) {
6059
+ existingMap.set(p.id, p);
6060
+ }
6061
+ setPresets(Array.from(existingMap.values()));
6062
+ }
6063
+ if (result.currentSettings && Object.keys(result.currentSettings).length > 0) {
6064
+ applyCustomPresetToStore(
6065
+ {
6066
+ id: "temp_import",
6067
+ name: "Imported Settings",
6068
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6069
+ settings: result.currentSettings
6070
+ },
6071
+ ctx.setFeatureState
6072
+ );
6073
+ }
6074
+ return result;
6075
+ },
6076
+ [ctx.setFeatureState, presets, setPresets]
6077
+ );
6078
+ const importFromFile = (0, import_react20.useCallback)(
6079
+ async (file) => {
6080
+ try {
6081
+ const text = await file.text();
6082
+ return importFromJson(text);
6083
+ } catch (err) {
6084
+ return {
6085
+ success: false,
6086
+ error: `Failed to read file: ${err instanceof Error ? err.message : String(err)}`
6087
+ };
6088
+ }
6089
+ },
6090
+ [importFromJson]
6091
+ );
6092
+ return {
6093
+ presets,
6094
+ currentSettings,
6095
+ saveCurrentAsPreset,
6096
+ applyPreset,
6097
+ deletePreset,
6098
+ exportPresets,
6099
+ downloadExport,
6100
+ importFromJson,
6101
+ importFromFile
6102
+ };
6103
+ }
6104
+
6105
+ // src/features/PresetsController.tsx
6106
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6107
+ function PresetsController({
6108
+ className = "",
6109
+ label = "Custom Presets",
6110
+ description = "Save, restore, and transfer your settings",
6111
+ largeControls = false
6112
+ }) {
6113
+ const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
6114
+ const [presetName, setPresetName] = (0, import_react21.useState)("");
6115
+ const [statusMessage, setStatusMessage] = (0, import_react21.useState)("");
6116
+ const [errorMessage, setErrorMessage] = (0, import_react21.useState)("");
6117
+ const dialogId = "arap-presets-dialog";
6118
+ const nameInputId = (0, import_react21.useId)();
6119
+ const fileInputRef = (0, import_react21.useRef)(null);
6120
+ const triggerRef = (0, import_react21.useRef)(null);
6121
+ const {
6122
+ presets,
6123
+ saveCurrentAsPreset,
6124
+ applyPreset,
6125
+ deletePreset,
6126
+ downloadExport,
6127
+ importFromFile
6128
+ } = usePresets();
6129
+ const handleSave = () => {
6130
+ const trimmed = presetName.trim();
6131
+ if (!trimmed) {
6132
+ setErrorMessage("Please enter a name for your preset.");
6133
+ setStatusMessage("");
6134
+ return;
6135
+ }
6136
+ const created = saveCurrentAsPreset(trimmed);
6137
+ setPresetName("");
6138
+ setErrorMessage("");
6139
+ setStatusMessage(`Preset "${created.name}" saved successfully.`);
6140
+ };
6141
+ const handleApply = (preset) => {
6142
+ const success = applyPreset(preset.id);
6143
+ if (success) {
6144
+ setErrorMessage("");
6145
+ setStatusMessage(`Preset "${preset.name}" applied.`);
6146
+ }
6147
+ };
6148
+ const handleDelete = (preset) => {
6149
+ const success = deletePreset(preset.id);
6150
+ if (success) {
6151
+ setErrorMessage("");
6152
+ setStatusMessage(`Preset "${preset.name}" deleted.`);
6153
+ }
6154
+ };
6155
+ const handleExport = () => {
6156
+ downloadExport();
6157
+ setErrorMessage("");
6158
+ setStatusMessage("Settings and presets exported to JSON file.");
6159
+ };
6160
+ const handleFileInputChange = async (e) => {
6161
+ const file = e.target.files?.[0];
6162
+ if (!file) return;
6163
+ const result = await importFromFile(file);
6164
+ if (result.success) {
6165
+ setErrorMessage("");
6166
+ setStatusMessage(result.message);
6167
+ } else {
6168
+ setStatusMessage("");
6169
+ setErrorMessage(result.error);
6170
+ }
6171
+ if (fileInputRef.current) {
6172
+ fileInputRef.current.value = "";
6173
+ }
6174
+ };
6175
+ const formatKeyName = (key) => {
6176
+ switch (key) {
6177
+ case "fontScale":
6178
+ return "Font Size";
6179
+ case "lineHeight":
6180
+ return "Line Height";
6181
+ case "contrastMode":
6182
+ return "Contrast";
6183
+ case "reduceMotion":
6184
+ return "Reduce Motion";
6185
+ case "textAlign":
6186
+ return "Text Align";
6187
+ case "highlightLinks":
6188
+ return "Highlight Links";
6189
+ case "highlightFocus":
6190
+ return "Highlight Focus";
6191
+ case "cursorSize":
6192
+ return "Cursor Size";
6193
+ case "readerMode":
6194
+ return "Reading Mode";
6195
+ case "saturation":
6196
+ return "Saturation";
6197
+ case "hideDecorativeImages":
6198
+ return "Hide Images";
6199
+ default:
6200
+ return key.replace(/([A-Z])/g, " $1").trim();
6201
+ }
6202
+ };
6203
+ const formatSettingValue = (key, val) => {
6204
+ if (typeof val === "boolean") return val ? "On" : "Off";
6205
+ if (key === "fontScale" && typeof val === "number")
6206
+ return `${Math.round(val * 100)}%`;
6207
+ if (key === "lineHeight" && typeof val === "number")
6208
+ return `${Math.round(val * 100)}%`;
6209
+ if (val === null || val === void 0) return "Original";
6210
+ return String(val);
6211
+ };
6212
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6213
+ "div",
6214
+ {
6215
+ className: `arap-feature arap-feature-expandable ${largeControls ? "arap-large-controls" : ""} ${className}`,
6216
+ role: "group",
6217
+ "aria-label": label,
6218
+ children: [
6219
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6220
+ "div",
6221
+ {
6222
+ style: {
6223
+ display: "flex",
6224
+ alignItems: "center",
6225
+ justifyContent: "space-between",
6226
+ width: "100%"
6227
+ },
6228
+ children: [
6229
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "arap-label", children: [
6230
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FeatureIcon, { name: "presets" }),
6231
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
6232
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { style: { display: "block" }, children: label }),
6233
+ description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6234
+ "span",
6235
+ {
6236
+ style: {
6237
+ display: "block",
6238
+ fontSize: "11px",
6239
+ fontWeight: 400,
6240
+ color: "var(--arap-muted, #64748b)",
6241
+ marginTop: "1px"
6242
+ },
6243
+ children: presets.length > 0 ? `${presets.length} custom preset${presets.length === 1 ? "" : "s"} saved` : description
6244
+ }
6245
+ )
6246
+ ] })
6247
+ ] }),
6248
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6249
+ "button",
6250
+ {
6251
+ ref: triggerRef,
6252
+ className: "arap-btn-sm",
6253
+ type: "button",
6254
+ "aria-expanded": isOpen,
6255
+ "aria-controls": dialogId,
6256
+ onClick: () => setIsOpen(!isOpen),
6257
+ children: isOpen ? "Close" : "Presets"
6258
+ }
6259
+ )
6260
+ ]
6261
+ }
6262
+ ),
6263
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6264
+ "div",
6265
+ {
6266
+ id: dialogId,
6267
+ role: "region",
6268
+ "aria-label": "Custom Presets and Settings",
6269
+ tabIndex: -1,
6270
+ style: {
6271
+ marginTop: "12px",
6272
+ padding: "12px",
6273
+ borderRadius: "6px",
6274
+ backgroundColor: "var(--arap-card-bg, #f8fafc)",
6275
+ border: "1px solid var(--arap-border, #e2e8f0)"
6276
+ },
6277
+ onKeyDown: (e) => {
6278
+ if (e.key === "Escape") {
6279
+ e.stopPropagation();
6280
+ setIsOpen(false);
6281
+ triggerRef.current?.focus();
6282
+ }
6283
+ },
6284
+ children: [
6285
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6286
+ "div",
6287
+ {
6288
+ role: "status",
6289
+ "aria-live": "polite",
6290
+ className: "arap-presets-status",
6291
+ style: {
6292
+ minHeight: statusMessage || errorMessage ? "24px" : "0",
6293
+ marginBottom: statusMessage || errorMessage ? "8px" : "0"
6294
+ },
6295
+ children: [
6296
+ statusMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6297
+ "div",
6298
+ {
6299
+ style: {
6300
+ fontSize: "12px",
6301
+ fontWeight: 500,
6302
+ color: "var(--arap-success, #16a34a)",
6303
+ padding: "4px 8px",
6304
+ backgroundColor: "rgba(22, 163, 74, 0.1)",
6305
+ borderRadius: "4px"
6306
+ },
6307
+ children: [
6308
+ "\u2713 ",
6309
+ statusMessage
6310
+ ]
6311
+ }
6312
+ ),
6313
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6314
+ "div",
6315
+ {
6316
+ role: "alert",
6317
+ style: {
6318
+ fontSize: "12px",
6319
+ fontWeight: 500,
6320
+ color: "var(--arap-error, #dc2626)",
6321
+ padding: "4px 8px",
6322
+ backgroundColor: "rgba(220, 38, 38, 0.1)",
6323
+ borderRadius: "4px"
6324
+ },
6325
+ children: [
6326
+ "\u26A0 ",
6327
+ errorMessage
6328
+ ]
6329
+ }
6330
+ )
6331
+ ]
6332
+ }
6333
+ ),
6334
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6335
+ "div",
6336
+ {
6337
+ className: "arap-presets-save-section",
6338
+ style: { marginBottom: "14px" },
6339
+ children: [
6340
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6341
+ "label",
6342
+ {
6343
+ htmlFor: nameInputId,
6344
+ style: {
6345
+ display: "block",
6346
+ fontSize: "12px",
6347
+ fontWeight: 600,
6348
+ marginBottom: "4px",
6349
+ color: "var(--arap-text, #1e293b)"
6350
+ },
6351
+ children: "Save current settings as preset:"
6352
+ }
6353
+ ),
6354
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
6355
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6356
+ "input",
6357
+ {
6358
+ id: nameInputId,
6359
+ type: "text",
6360
+ className: "arap-search-input",
6361
+ style: { flex: 1, padding: "6px 10px", fontSize: "13px" },
6362
+ value: presetName,
6363
+ onChange: (e) => {
6364
+ setPresetName(e.target.value);
6365
+ if (errorMessage) setErrorMessage("");
6366
+ },
6367
+ onKeyDown: (e) => {
6368
+ if (e.key === "Enter") {
6369
+ e.preventDefault();
6370
+ handleSave();
6371
+ }
6372
+ },
6373
+ placeholder: "Preset name (e.g. My Reading Setup)",
6374
+ "aria-label": "Preset name"
6375
+ }
6376
+ ),
6377
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6378
+ "button",
6379
+ {
6380
+ type: "button",
6381
+ className: "arap-btn-sm",
6382
+ onClick: handleSave,
6383
+ "aria-label": "Save current preset",
6384
+ children: "Save"
6385
+ }
6386
+ )
6387
+ ] })
6388
+ ]
6389
+ }
6390
+ ),
6391
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6392
+ "div",
6393
+ {
6394
+ className: "arap-presets-transfer-section",
6395
+ style: {
6396
+ display: "flex",
6397
+ gap: "8px",
6398
+ marginBottom: "14px",
6399
+ paddingBottom: "12px",
6400
+ borderBottom: "1px solid var(--arap-border, #e2e8f0)"
6401
+ },
6402
+ children: [
6403
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6404
+ "button",
6405
+ {
6406
+ type: "button",
6407
+ className: "arap-btn-sm",
6408
+ style: { flex: 1 },
6409
+ onClick: handleExport,
6410
+ "aria-label": "Export settings and presets to JSON file",
6411
+ children: "Export JSON"
6412
+ }
6413
+ ),
6414
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6415
+ "button",
6416
+ {
6417
+ type: "button",
6418
+ className: "arap-btn-sm",
6419
+ style: { flex: 1 },
6420
+ onClick: () => fileInputRef.current?.click(),
6421
+ "aria-label": "Import settings and presets from JSON file",
6422
+ children: "Import JSON"
6423
+ }
6424
+ ),
6425
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6426
+ "input",
6427
+ {
6428
+ ref: fileInputRef,
6429
+ type: "file",
6430
+ accept: ".json,application/json",
6431
+ style: { display: "none" },
6432
+ "aria-label": "Upload JSON settings file",
6433
+ onChange: handleFileInputChange
6434
+ }
6435
+ )
6436
+ ]
6437
+ }
6438
+ ),
6439
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "arap-presets-list-section", children: [
6440
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6441
+ "h4",
6442
+ {
6443
+ style: {
6444
+ fontSize: "12px",
6445
+ fontWeight: 600,
6446
+ marginBottom: "6px",
6447
+ color: "var(--arap-text, #1e293b)"
6448
+ },
6449
+ children: [
6450
+ "Saved Presets (",
6451
+ presets.length,
6452
+ "):"
6453
+ ]
6454
+ }
6455
+ ),
6456
+ presets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6457
+ EmptyState,
6458
+ {
6459
+ title: "No saved presets yet",
6460
+ description: "Configure your preferences and save them above for quick 1-click access."
6461
+ }
6462
+ ) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6463
+ "div",
6464
+ {
6465
+ style: {
6466
+ display: "flex",
6467
+ flexDirection: "column",
6468
+ gap: "8px"
6469
+ },
6470
+ children: presets.map((p) => {
6471
+ const affectedKeys = Object.keys(
6472
+ p.settings
6473
+ );
6474
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6475
+ "div",
6476
+ {
6477
+ className: "arap-preset-card",
6478
+ role: "group",
6479
+ "aria-label": `${p.name} preset`,
6480
+ style: {
6481
+ padding: "8px 10px",
6482
+ borderRadius: "6px",
6483
+ backgroundColor: "var(--arap-bg, #ffffff)",
6484
+ border: "1px solid var(--arap-border, #e2e8f0)"
6485
+ },
6486
+ children: [
6487
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6488
+ "div",
6489
+ {
6490
+ style: {
6491
+ display: "flex",
6492
+ alignItems: "center",
6493
+ justifyContent: "space-between",
6494
+ marginBottom: "4px"
6495
+ },
6496
+ children: [
6497
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
6498
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6499
+ "strong",
6500
+ {
6501
+ style: {
6502
+ fontSize: "13px",
6503
+ color: "var(--arap-text, #1e293b)"
6504
+ },
6505
+ children: p.name
6506
+ }
6507
+ ),
6508
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6509
+ "span",
6510
+ {
6511
+ style: {
6512
+ display: "block",
6513
+ fontSize: "10px",
6514
+ color: "var(--arap-muted, #64748b)"
6515
+ },
6516
+ children: [
6517
+ "Saved ",
6518
+ new Date(p.createdAt).toLocaleDateString()
6519
+ ]
6520
+ }
6521
+ )
6522
+ ] }),
6523
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6524
+ "div",
6525
+ {
6526
+ style: {
6527
+ display: "flex",
6528
+ gap: "6px",
6529
+ alignItems: "center"
6530
+ },
6531
+ children: [
6532
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6533
+ "button",
6534
+ {
6535
+ type: "button",
6536
+ className: "arap-btn-sm",
6537
+ onClick: () => handleApply(p),
6538
+ "aria-label": `Apply preset ${p.name}`,
6539
+ children: "Apply"
6540
+ }
6541
+ ),
6542
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6543
+ "button",
6544
+ {
6545
+ type: "button",
6546
+ className: "arap-btn-sm",
6547
+ onClick: () => handleDelete(p),
6548
+ "aria-label": `Delete preset ${p.name}`,
6549
+ style: {
6550
+ color: "var(--arap-error, #dc2626)"
6551
+ },
6552
+ children: "Delete"
6553
+ }
6554
+ )
6555
+ ]
6556
+ }
6557
+ )
6558
+ ]
6559
+ }
6560
+ ),
6561
+ affectedKeys.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6562
+ "div",
6563
+ {
6564
+ className: "arap-profile-chips",
6565
+ style: { marginTop: "4px" },
6566
+ children: affectedKeys.map((key) => {
6567
+ const val = p.settings[key];
6568
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "arap-profile-chip", children: [
6569
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("strong", { children: [
6570
+ formatKeyName(key),
6571
+ ":"
6572
+ ] }),
6573
+ " ",
6574
+ formatSettingValue(key, val)
6575
+ ] }, key);
6576
+ })
6577
+ }
6578
+ )
6579
+ ]
6580
+ },
6581
+ p.id
6582
+ );
6583
+ })
6584
+ }
6585
+ )
6586
+ ] })
6587
+ ]
6588
+ }
6589
+ )
6590
+ ]
6591
+ }
6592
+ );
6593
+ }
6594
+ var CustomPresetsController = PresetsController;
6595
+ var SettingsImportExportController = PresetsController;
6596
+ var PresetsBackupController = PresetsController;
6597
+
6598
+ // src/core/controls/ToggleControl.tsx
6599
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6600
+ function ToggleControl({
6601
+ id,
6602
+ label,
6603
+ checked,
6604
+ onChange,
6605
+ disabled = false,
6606
+ unavailable = false,
6607
+ unavailableReason,
6608
+ name,
6609
+ description,
6610
+ largeControls = false,
6611
+ className = "",
6612
+ style
6613
+ }) {
6614
+ const isInteractive = !disabled && !unavailable;
6615
+ const toggleLabel = typeof label === "string" ? label : void 0;
6616
+ const handleClick = () => {
6617
+ if (isInteractive) {
6618
+ onChange(!checked);
6619
+ }
6620
+ };
6621
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6622
+ "div",
6623
+ {
6624
+ className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
6625
+ style,
6626
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6627
+ "button",
6628
+ {
6629
+ id,
6630
+ name,
6631
+ type: "button",
6632
+ className: `arap-toggle ${checked ? "arap-toggle-active" : ""}`,
6633
+ role: "switch",
6634
+ "aria-checked": checked,
6635
+ "aria-label": toggleLabel,
6636
+ "aria-disabled": !isInteractive,
6637
+ disabled: !isInteractive,
6638
+ onClick: handleClick,
6639
+ title: unavailableReason || description || toggleLabel,
6640
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6641
+ "span",
6642
+ {
6643
+ className: "arap-toggle-knob",
6644
+ style: {
6645
+ transform: checked ? largeControls ? "translateX(28px)" : "translateX(24px)" : "translateX(0)"
6646
+ }
6647
+ }
4221
6648
  )
4222
6649
  }
4223
6650
  )
@@ -4226,8 +6653,8 @@ function ToggleControl({
4226
6653
  }
4227
6654
 
4228
6655
  // src/core/controls/ChoiceControl.tsx
4229
- var import_react17 = require("react");
4230
- var import_jsx_runtime31 = require("react/jsx-runtime");
6656
+ var import_react22 = require("react");
6657
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4231
6658
  function ChoiceControl({
4232
6659
  id,
4233
6660
  label,
@@ -4241,12 +6668,12 @@ function ChoiceControl({
4241
6668
  style,
4242
6669
  orientation = "horizontal"
4243
6670
  }) {
4244
- const containerRef = (0, import_react17.useRef)(null);
4245
- const allOptions = (0, import_react17.useMemo)(
6671
+ const containerRef = (0, import_react22.useRef)(null);
6672
+ const allOptions = (0, import_react22.useMemo)(
4246
6673
  () => groups ? groups.flatMap((g) => g.options) : options || [],
4247
6674
  [groups, options]
4248
6675
  );
4249
- const handleKeyDown = (0, import_react17.useCallback)(
6676
+ const handleKeyDown = (0, import_react22.useCallback)(
4250
6677
  (e) => {
4251
6678
  if (disabled || allOptions.length === 0) return;
4252
6679
  const enabledOptions = allOptions.filter((opt) => !opt.disabled);
@@ -4283,7 +6710,7 @@ function ChoiceControl({
4283
6710
  const renderOptionButton = (opt) => {
4284
6711
  const isSelected = value === opt.value;
4285
6712
  const isOptionDisabled = disabled || Boolean(opt.disabled);
4286
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6713
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4287
6714
  "button",
4288
6715
  {
4289
6716
  type: "button",
@@ -4297,15 +6724,15 @@ function ChoiceControl({
4297
6724
  onClick: () => !isOptionDisabled && onChange(opt.value),
4298
6725
  title: opt.description,
4299
6726
  children: [
4300
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
4301
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: opt.label }),
4302
- opt.badge && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "arap-choice-badge", "aria-hidden": "true", children: opt.badge })
6727
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
6728
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: opt.label }),
6729
+ opt.badge && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "arap-choice-badge", "aria-hidden": "true", children: opt.badge })
4303
6730
  ]
4304
6731
  },
4305
6732
  String(opt.value)
4306
6733
  );
4307
6734
  };
4308
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6735
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4309
6736
  "div",
4310
6737
  {
4311
6738
  ref: containerRef,
@@ -4316,15 +6743,15 @@ function ChoiceControl({
4316
6743
  className: `arap-choice-control arap-segmented ${largeControls ? "arap-large-controls" : ""} ${className}`,
4317
6744
  style,
4318
6745
  onKeyDown: handleKeyDown,
4319
- children: groups ? groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6746
+ children: groups ? groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4320
6747
  "div",
4321
6748
  {
4322
6749
  className: "arap-choice-group",
4323
6750
  role: "group",
4324
6751
  "aria-label": group.label,
4325
6752
  children: [
4326
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "arap-choice-group-title", children: group.label }),
4327
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "arap-segmented", children: group.options.map(renderOptionButton) })
6753
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "arap-choice-group-title", children: group.label }),
6754
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "arap-segmented", children: group.options.map(renderOptionButton) })
4328
6755
  ]
4329
6756
  },
4330
6757
  group.label
@@ -4334,7 +6761,7 @@ function ChoiceControl({
4334
6761
  }
4335
6762
 
4336
6763
  // src/core/controls/StepperControl.tsx
4337
- var import_jsx_runtime32 = require("react/jsx-runtime");
6764
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4338
6765
  function StepperControl({
4339
6766
  id,
4340
6767
  label,
@@ -4364,15 +6791,15 @@ function StepperControl({
4364
6791
  onChange(Math.min(max, Number((value + step).toFixed(2))));
4365
6792
  }
4366
6793
  };
4367
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6794
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4368
6795
  "div",
4369
6796
  {
4370
6797
  id,
4371
6798
  className: `arap-stepper-control-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4372
6799
  style,
4373
6800
  children: [
4374
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "arap-controls", children: [
4375
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6801
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "arap-controls", children: [
6802
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4376
6803
  "button",
4377
6804
  {
4378
6805
  type: "button",
@@ -4383,8 +6810,8 @@ function StepperControl({
4383
6810
  children: "\u2212"
4384
6811
  }
4385
6812
  ),
4386
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
4387
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6813
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
6814
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4388
6815
  "button",
4389
6816
  {
4390
6817
  type: "button",
@@ -4396,7 +6823,7 @@ function StepperControl({
4396
6823
  }
4397
6824
  )
4398
6825
  ] }),
4399
- showSlider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "arap-slider-container", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6826
+ showSlider && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "arap-slider-container", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4400
6827
  "input",
4401
6828
  {
4402
6829
  type: "range",
@@ -4420,7 +6847,7 @@ function StepperControl({
4420
6847
  }
4421
6848
 
4422
6849
  // src/core/controls/FeatureCard.tsx
4423
- var import_jsx_runtime33 = require("react/jsx-runtime");
6850
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4424
6851
  function FeatureCard({
4425
6852
  id,
4426
6853
  featureKey,
@@ -4439,7 +6866,7 @@ function FeatureCard({
4439
6866
  largeControls = false
4440
6867
  }) {
4441
6868
  const cardTitle = typeof title === "string" ? title : void 0;
4442
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6869
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4443
6870
  "div",
4444
6871
  {
4445
6872
  id,
@@ -4448,27 +6875,27 @@ function FeatureCard({
4448
6875
  className: `arap-feature arap-feature-card ${status !== "idle" ? `arap-feature-${status}` : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4449
6876
  style,
4450
6877
  children: [
4451
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-card-header", children: [
4452
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "arap-label", children: [
4453
- icon ?? (featureKey ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FeatureIcon, { name: featureKey }) : null),
4454
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "arap-card-title", children: title })
6878
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "arap-card-header", children: [
6879
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "arap-label", children: [
6880
+ icon ?? (featureKey ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FeatureIcon, { name: featureKey }) : null),
6881
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "arap-card-title", children: title })
4455
6882
  ] }),
4456
- statusBadge && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "arap-status-badge", "aria-hidden": "true", children: statusBadge })
6883
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "arap-status-badge", "aria-hidden": "true", children: statusBadge })
4457
6884
  ] }),
4458
- description && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "arap-card-desc", children: description }),
4459
- status === "error" && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
4460
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4461
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: errorMessage })
6885
+ description && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "arap-card-desc", children: description }),
6886
+ status === "error" && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
6887
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
6888
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: errorMessage })
4462
6889
  ] }),
4463
- status === "unavailable" && unavailableMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
4464
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
4465
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: unavailableMessage })
6890
+ status === "unavailable" && unavailableMessage && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
6891
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
6892
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: unavailableMessage })
4466
6893
  ] }),
4467
- status === "permission-required" && permissionMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
4468
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
4469
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-permission-content", children: [
4470
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: permissionMessage }),
4471
- onRequestPermission && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6894
+ status === "permission-required" && permissionMessage && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
6895
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
6896
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "arap-permission-content", children: [
6897
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: permissionMessage }),
6898
+ onRequestPermission && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4472
6899
  "button",
4473
6900
  {
4474
6901
  type: "button",
@@ -4479,199 +6906,21 @@ function FeatureCard({
4479
6906
  )
4480
6907
  ] })
4481
6908
  ] }),
4482
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "arap-card-content", children })
4483
- ]
4484
- }
4485
- );
4486
- }
4487
-
4488
- // src/core/controls/FeatureStatusState.tsx
4489
- var import_jsx_runtime34 = require("react/jsx-runtime");
4490
- function SearchCount({
4491
- totalCount,
4492
- matchedCount,
4493
- query,
4494
- className = "",
4495
- style
4496
- }) {
4497
- const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
4498
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4499
- "div",
4500
- {
4501
- role: "status",
4502
- "aria-live": "polite",
4503
- className: `arap-search-count ${className}`,
4504
- style,
4505
- children: text
4506
- }
4507
- );
4508
- }
4509
- function EmptyState({
4510
- title = "No matching tools found",
4511
- description = "Try adjusting your search query or reset filters.",
4512
- actionLabel = "Clear search",
4513
- onAction,
4514
- icon,
4515
- className = "",
4516
- style
4517
- }) {
4518
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4519
- "div",
4520
- {
4521
- role: "status",
4522
- className: `arap-empty-state ${className}`,
4523
- style,
4524
- children: [
4525
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
4526
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h3", { className: "arap-empty-title", children: title }),
4527
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "arap-empty-desc", children: description }),
4528
- onAction && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
4529
- ]
4530
- }
4531
- );
4532
- }
4533
- function ErrorState({
4534
- title = "Something went wrong",
4535
- message,
4536
- onRetry,
4537
- retryLabel = "Try again",
4538
- className = "",
4539
- style
4540
- }) {
4541
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4542
- "div",
4543
- {
4544
- role: "alert",
4545
- className: `arap-error-state arap-card-alert arap-card-error ${className}`,
4546
- style,
4547
- children: [
4548
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4549
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-error-content", children: [
4550
- title && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "arap-error-title", children: title }),
4551
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "arap-error-message", children: message }),
4552
- onRetry && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
4553
- ] })
4554
- ]
4555
- }
4556
- );
4557
- }
4558
-
4559
- // src/core/controls/ProfilePreviewCard.tsx
4560
- var import_jsx_runtime35 = require("react/jsx-runtime");
4561
- function ProfilePreviewCard({
4562
- profile,
4563
- isActive,
4564
- onApply,
4565
- onRevert,
4566
- largeControls = false,
4567
- className = "",
4568
- style
4569
- }) {
4570
- const affectedKeys = Object.keys(
4571
- profile.settings
4572
- );
4573
- const formatKeyName = (key) => {
4574
- switch (key) {
4575
- case "fontScale":
4576
- return "Font Size";
4577
- case "lineHeight":
4578
- return "Line Height";
4579
- case "contrastMode":
4580
- return "Contrast";
4581
- case "reduceMotion":
4582
- return "Reduce Motion";
4583
- case "textAlign":
4584
- return "Text Align";
4585
- case "highlightLinks":
4586
- return "Highlight Links";
4587
- case "highlightFocus":
4588
- return "Highlight Focus";
4589
- case "cursorSize":
4590
- return "Cursor Size";
4591
- case "readerMode":
4592
- return "Reading Mode";
4593
- case "saturation":
4594
- return "Saturation";
4595
- case "hideDecorativeImages":
4596
- return "Hide Images";
4597
- default:
4598
- return key.replace(/([A-Z])/g, " $1").trim();
4599
- }
4600
- };
4601
- const formatSettingValue = (key, val) => {
4602
- if (typeof val === "boolean") return val ? "On" : "Off";
4603
- if (key === "fontScale" && typeof val === "number")
4604
- return `${Math.round(val * 100)}%`;
4605
- if (key === "lineHeight" && typeof val === "number")
4606
- return `${Math.round(val * 100)}%`;
4607
- if (val === null || val === void 0) return "Original";
4608
- return String(val);
4609
- };
4610
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4611
- "div",
4612
- {
4613
- role: "group",
4614
- "aria-label": `${profile.label} profile`,
4615
- className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4616
- style,
4617
- children: [
4618
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "arap-profile-header", children: [
4619
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "arap-profile-title-row", children: [
4620
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h4", { className: "arap-profile-title", children: profile.label }),
4621
- isActive && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4622
- "span",
4623
- {
4624
- className: "arap-profile-active-badge",
4625
- "aria-label": "Active profile",
4626
- children: "\u2713 Active"
4627
- }
4628
- )
4629
- ] }),
4630
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "arap-profile-desc", children: profile.description })
4631
- ] }),
4632
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "arap-profile-affected", children: [
4633
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
4634
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
4635
- const val = profile.settings[key];
4636
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "arap-profile-chip", children: [
4637
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("strong", { children: [
4638
- formatKeyName(key),
4639
- ":"
4640
- ] }),
4641
- " ",
4642
- formatSettingValue(key, val)
4643
- ] }, key);
4644
- }) })
4645
- ] }),
4646
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4647
- "button",
4648
- {
4649
- type: "button",
4650
- className: "arap-profile-revert-btn",
4651
- onClick: onRevert,
4652
- "aria-label": `Revert ${profile.label} profile`,
4653
- children: "Revert to custom settings"
4654
- }
4655
- ) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4656
- "button",
4657
- {
4658
- type: "button",
4659
- className: "arap-profile-apply-btn",
4660
- onClick: () => onApply(profile),
4661
- "aria-label": `Apply ${profile.label} profile`,
4662
- children: "Apply Profile"
4663
- }
4664
- ) })
6909
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "arap-card-content", children })
4665
6910
  ]
4666
6911
  }
4667
6912
  );
4668
6913
  }
4669
6914
  // Annotate the CommonJS export names for ESM import in node:
4670
6915
  0 && (module.exports = {
6916
+ ALLOWED_PREFERENCE_KEYS,
6917
+ ALL_PROFILE_IDS,
4671
6918
  AccessibilityButton,
4672
6919
  AccessibilityContext,
4673
6920
  AccessibilityList,
4674
6921
  AccessibilityPlugin,
6922
+ AccessibilityProfilesController,
6923
+ AccessibleTooltipsController,
4675
6924
  BigCursorController,
4676
6925
  CONTRAST_MODES,
4677
6926
  CONTRAST_PALETTES,
@@ -4679,6 +6928,7 @@ function ProfilePreviewCard({
4679
6928
  ChoiceControl,
4680
6929
  ContrastController,
4681
6930
  ContrastModeController,
6931
+ CustomPresetsController,
4682
6932
  DEFAULT_PREFERENCES,
4683
6933
  DEFAULT_READING_MASK_HEIGHT,
4684
6934
  DYSLEXIA_FONT_STACK,
@@ -4691,6 +6941,7 @@ function ProfilePreviewCard({
4691
6941
  FontFamilyController,
4692
6942
  FontSizeController,
4693
6943
  GrayscaleController,
6944
+ HeadingsNavigatorController,
4694
6945
  HideDecorativeImagesController,
4695
6946
  HideImagesController,
4696
6947
  HideVideosController,
@@ -4705,8 +6956,14 @@ function ProfilePreviewCard({
4705
6956
  MAX_READING_MASK_HEIGHT,
4706
6957
  MIN_READING_MASK_HEIGHT,
4707
6958
  PROFILE_DEFINITIONS,
6959
+ PageNavigatorController,
6960
+ PageStructureController,
4708
6961
  ParagraphSpacingController,
6962
+ PresetsBackupController,
6963
+ PresetsController,
6964
+ ProfileController,
4709
6965
  ProfilePreviewCard,
6966
+ ProfilesController,
4710
6967
  READING_MASK_HEIGHT_PRESETS,
4711
6968
  ReadingGuideController,
4712
6969
  ReadingMaskController,
@@ -4714,6 +6971,7 @@ function ProfilePreviewCard({
4714
6971
  ResetController,
4715
6972
  SaturationController,
4716
6973
  SearchCount,
6974
+ SettingsImportExportController,
4717
6975
  SkipToMainLink,
4718
6976
  StepperControl,
4719
6977
  TEXT_ALIGN_BLOCK_SELECTOR,
@@ -4723,10 +6981,19 @@ function ProfilePreviewCard({
4723
6981
  TextAlignController,
4724
6982
  TextScaleController,
4725
6983
  ToggleControl,
6984
+ TooltipsController,
4726
6985
  WordSpacingController,
6986
+ applyCustomPresetToStore,
6987
+ applyProfileToStore,
6988
+ createCustomPreset,
4727
6989
  createInitialPreferencesState,
6990
+ downloadJsonFile,
4728
6991
  enLocale,
6992
+ enableAccessibleTooltips,
6993
+ exportPresetsToJson,
4729
6994
  findMainLandmark,
6995
+ getAuthoredDescription,
6996
+ getProfileDefinition,
4730
6997
  getScriptSpacingConstraints,
4731
6998
  hasFinePointer,
4732
6999
  isEligibleDecorativeImage,
@@ -4739,16 +7006,30 @@ function ProfilePreviewCard({
4739
7006
  isProtectedFromTextSpacing,
4740
7007
  isReducedMotionActive,
4741
7008
  isRtlLocale,
7009
+ isValidCustomPreset,
7010
+ mapFeaturesToProfileSettings,
7011
+ mapProfileSettingsToFeatures,
7012
+ navigateToElement,
4742
7013
  normalizePreferenceValue,
4743
7014
  normalizePreferences,
4744
7015
  nudgeReadingAid,
7016
+ positionTooltip,
4745
7017
  preferencesReducer,
7018
+ recordProfileOverride,
4746
7019
  registerLocale,
4747
7020
  resolveEffectivePreferences,
4748
7021
  resolveLocaleStrings,
7022
+ revertProfileFromStore,
7023
+ sanitizePreferences,
7024
+ scanHeadings,
7025
+ scanLandmarks,
4749
7026
  subscribeFinePointer,
4750
7027
  subscribeForcedColors,
7028
+ subscribePageStructure,
4751
7029
  subscribeReducedMotion,
4752
- useAccessibility
7030
+ useAccessibility,
7031
+ usePresets,
7032
+ useProfiles,
7033
+ validateAndParseImport
4753
7034
  });
4754
7035
  //# sourceMappingURL=index.js.map