accessibility-plugin-react 2.13.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,13 @@ 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,
29
32
  AccessibleTooltipsController: () => AccessibleTooltipsController,
30
33
  BigCursorController: () => BigCursorController,
31
34
  CONTRAST_MODES: () => CONTRAST_MODES,
@@ -34,6 +37,7 @@ __export(index_exports, {
34
37
  ChoiceControl: () => ChoiceControl,
35
38
  ContrastController: () => ContrastController,
36
39
  ContrastModeController: () => ContrastModeController,
40
+ CustomPresetsController: () => CustomPresetsController,
37
41
  DEFAULT_PREFERENCES: () => DEFAULT_PREFERENCES,
38
42
  DEFAULT_READING_MASK_HEIGHT: () => DEFAULT_READING_MASK_HEIGHT,
39
43
  DYSLEXIA_FONT_STACK: () => DYSLEXIA_FONT_STACK,
@@ -46,6 +50,7 @@ __export(index_exports, {
46
50
  FontFamilyController: () => FontFamilyController,
47
51
  FontSizeController: () => FontSizeController,
48
52
  GrayscaleController: () => GrayscaleController,
53
+ HeadingsNavigatorController: () => HeadingsNavigatorController,
49
54
  HideDecorativeImagesController: () => HideDecorativeImagesController,
50
55
  HideImagesController: () => HideImagesController,
51
56
  HideVideosController: () => HideVideosController,
@@ -60,8 +65,14 @@ __export(index_exports, {
60
65
  MAX_READING_MASK_HEIGHT: () => MAX_READING_MASK_HEIGHT,
61
66
  MIN_READING_MASK_HEIGHT: () => MIN_READING_MASK_HEIGHT,
62
67
  PROFILE_DEFINITIONS: () => PROFILE_DEFINITIONS,
68
+ PageNavigatorController: () => PageNavigatorController,
69
+ PageStructureController: () => PageStructureController,
63
70
  ParagraphSpacingController: () => ParagraphSpacingController,
71
+ PresetsBackupController: () => PresetsBackupController,
72
+ PresetsController: () => PresetsController,
73
+ ProfileController: () => ProfileController,
64
74
  ProfilePreviewCard: () => ProfilePreviewCard,
75
+ ProfilesController: () => ProfilesController,
65
76
  READING_MASK_HEIGHT_PRESETS: () => READING_MASK_HEIGHT_PRESETS,
66
77
  ReadingGuideController: () => ReadingGuideController,
67
78
  ReadingMaskController: () => ReadingMaskController,
@@ -69,6 +80,7 @@ __export(index_exports, {
69
80
  ResetController: () => ResetController,
70
81
  SaturationController: () => SaturationController,
71
82
  SearchCount: () => SearchCount,
83
+ SettingsImportExportController: () => SettingsImportExportController,
72
84
  SkipToMainLink: () => SkipToMainLink,
73
85
  StepperControl: () => StepperControl,
74
86
  TEXT_ALIGN_BLOCK_SELECTOR: () => TEXT_ALIGN_BLOCK_SELECTOR,
@@ -80,11 +92,17 @@ __export(index_exports, {
80
92
  ToggleControl: () => ToggleControl,
81
93
  TooltipsController: () => TooltipsController,
82
94
  WordSpacingController: () => WordSpacingController,
95
+ applyCustomPresetToStore: () => applyCustomPresetToStore,
96
+ applyProfileToStore: () => applyProfileToStore,
97
+ createCustomPreset: () => createCustomPreset,
83
98
  createInitialPreferencesState: () => createInitialPreferencesState,
99
+ downloadJsonFile: () => downloadJsonFile,
84
100
  enLocale: () => enLocale,
85
101
  enableAccessibleTooltips: () => enableAccessibleTooltips,
102
+ exportPresetsToJson: () => exportPresetsToJson,
86
103
  findMainLandmark: () => findMainLandmark,
87
104
  getAuthoredDescription: () => getAuthoredDescription,
105
+ getProfileDefinition: () => getProfileDefinition,
88
106
  getScriptSpacingConstraints: () => getScriptSpacingConstraints,
89
107
  hasFinePointer: () => hasFinePointer,
90
108
  isEligibleDecorativeImage: () => isEligibleDecorativeImage,
@@ -97,18 +115,31 @@ __export(index_exports, {
97
115
  isProtectedFromTextSpacing: () => isProtectedFromTextSpacing,
98
116
  isReducedMotionActive: () => isReducedMotionActive,
99
117
  isRtlLocale: () => isRtlLocale,
118
+ isValidCustomPreset: () => isValidCustomPreset,
119
+ mapFeaturesToProfileSettings: () => mapFeaturesToProfileSettings,
120
+ mapProfileSettingsToFeatures: () => mapProfileSettingsToFeatures,
121
+ navigateToElement: () => navigateToElement,
100
122
  normalizePreferenceValue: () => normalizePreferenceValue,
101
123
  normalizePreferences: () => normalizePreferences,
102
124
  nudgeReadingAid: () => nudgeReadingAid,
103
125
  positionTooltip: () => positionTooltip,
104
126
  preferencesReducer: () => preferencesReducer,
127
+ recordProfileOverride: () => recordProfileOverride,
105
128
  registerLocale: () => registerLocale,
106
129
  resolveEffectivePreferences: () => resolveEffectivePreferences,
107
130
  resolveLocaleStrings: () => resolveLocaleStrings,
131
+ revertProfileFromStore: () => revertProfileFromStore,
132
+ sanitizePreferences: () => sanitizePreferences,
133
+ scanHeadings: () => scanHeadings,
134
+ scanLandmarks: () => scanLandmarks,
108
135
  subscribeFinePointer: () => subscribeFinePointer,
109
136
  subscribeForcedColors: () => subscribeForcedColors,
137
+ subscribePageStructure: () => subscribePageStructure,
110
138
  subscribeReducedMotion: () => subscribeReducedMotion,
111
- useAccessibility: () => useAccessibility
139
+ useAccessibility: () => useAccessibility,
140
+ usePresets: () => usePresets,
141
+ useProfiles: () => useProfiles,
142
+ validateAndParseImport: () => validateAndParseImport
112
143
  });
113
144
  module.exports = __toCommonJS(index_exports);
114
145
 
@@ -135,7 +166,7 @@ function styleInject(css, { insertAt } = {}) {
135
166
  }
136
167
 
137
168
  // src/styles/tailwind.css
138
- 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');
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');
139
170
 
140
171
  // src/core/AccessibilityPlugin.tsx
141
172
  var import_react4 = require("react");
@@ -464,6 +495,16 @@ builtins.readingMaskHeight = {
464
495
  defaultValue: DEFAULT_READING_MASK_HEIGHT,
465
496
  validate: (v) => typeof v === "number" && v >= MIN_READING_MASK_HEIGHT && v <= MAX_READING_MASK_HEIGHT
466
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
+ };
467
508
  function validValue(key, value, fallback, validate) {
468
509
  if (builtins[key]) return builtins[key].validate(value);
469
510
  if (validate) {
@@ -1966,15 +2007,39 @@ function AccessibilityPlugin({
1966
2007
  const definition = registrations.current.get(key);
1967
2008
  if (!validKey(key) || !definition || !validValue(key, value2, definition.defaultValue, definition.validate))
1968
2009
  throw new Error(`Invalid value or unregistered feature: ${key}`);
1969
- 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
+ });
1970
2028
  },
1971
2029
  [setFeatures]
1972
2030
  );
1973
2031
  const resetAll = (0, import_react4.useCallback)(() => {
1974
2032
  resetFns.current.forEach((fn) => fn());
1975
- setFeatures(
1976
- (previous) => validPlacement(previous[PLACEMENT_KEY]) ? { [PLACEMENT_KEY]: previous[PLACEMENT_KEY] } : {}
1977
- );
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
+ });
1978
2043
  }, [setFeatures]);
1979
2044
  const registerReset = (0, import_react4.useCallback)((key, fn) => {
1980
2045
  resetFns.current.set(key, fn);
@@ -2749,6 +2814,16 @@ var DEFAULT_PREFERENCES = Object.freeze({
2749
2814
  saturation: "original",
2750
2815
  tooltips: false
2751
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
+ ];
2752
2827
  var PROFILE_DEFINITIONS = {
2753
2828
  motor: {
2754
2829
  id: "motor",
@@ -3028,6 +3103,249 @@ function preferencesReducer(state, action) {
3028
3103
  }
3029
3104
  }
3030
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
+
3031
3349
  // src/core/FeatureIcon.tsx
3032
3350
  var import_jsx_runtime7 = require("react/jsx-runtime");
3033
3351
  var drawings = {
@@ -3100,6 +3418,19 @@ var drawings = {
3100
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" }),
3101
3419
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 9h8M8 13h5" })
3102
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" }) }),
3103
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" }) })
3104
3435
  };
3105
3436
  function FeatureIcon({ name }) {
@@ -3642,7 +3973,7 @@ function ParagraphSpacingController({
3642
3973
  }
3643
3974
 
3644
3975
  // src/features/ContrastController.tsx
3645
- var import_react12 = require("react");
3976
+ var import_react13 = require("react");
3646
3977
  var import_jsx_runtime14 = require("react/jsx-runtime");
3647
3978
  var FEATURE_KEY7 = "contrast";
3648
3979
  var DEFAULT_VALUE7 = 0;
@@ -3665,7 +3996,7 @@ function ContrastController() {
3665
3996
  FEATURE_KEY7,
3666
3997
  DEFAULT_VALUE7
3667
3998
  );
3668
- const forcedColors = (0, import_react12.useSyncExternalStore)(
3999
+ const forcedColors = (0, import_react13.useSyncExternalStore)(
3669
4000
  subscribeForcedColors,
3670
4001
  isForcedColorsActive,
3671
4002
  () => false
@@ -3697,7 +4028,7 @@ function ContrastController() {
3697
4028
  }
3698
4029
 
3699
4030
  // src/features/ContrastModeController.tsx
3700
- var import_react13 = require("react");
4031
+ var import_react14 = require("react");
3701
4032
  var import_jsx_runtime15 = require("react/jsx-runtime");
3702
4033
  var FEATURE_KEY8 = "contrastMode";
3703
4034
  var DEFAULT_VALUE8 = "off";
@@ -3713,7 +4044,7 @@ function ContrastModeController() {
3713
4044
  FEATURE_KEY8,
3714
4045
  DEFAULT_VALUE8
3715
4046
  );
3716
- const forcedColors = (0, import_react13.useSyncExternalStore)(
4047
+ const forcedColors = (0, import_react14.useSyncExternalStore)(
3717
4048
  subscribeForcedColors,
3718
4049
  isForcedColorsActive,
3719
4050
  () => false
@@ -4019,7 +4350,7 @@ function HideVideosController() {
4019
4350
  }
4020
4351
 
4021
4352
  // src/features/BigCursorController.tsx
4022
- var import_react14 = require("react");
4353
+ var import_react15 = require("react");
4023
4354
  var import_jsx_runtime24 = require("react/jsx-runtime");
4024
4355
  var FEATURE_KEY17 = "bigCursor";
4025
4356
  var DEFAULT_VALUE17 = false;
@@ -4030,10 +4361,10 @@ function BigCursorController({
4030
4361
  FEATURE_KEY17,
4031
4362
  DEFAULT_VALUE17
4032
4363
  );
4033
- const [finePointer, setFinePointer] = (0, import_react14.useState)(
4364
+ const [finePointer, setFinePointer] = (0, import_react15.useState)(
4034
4365
  () => hasFinePointer()
4035
4366
  );
4036
- (0, import_react14.useEffect)(() => {
4367
+ (0, import_react15.useEffect)(() => {
4037
4368
  return subscribeFinePointer(() => {
4038
4369
  setFinePointer(hasFinePointer());
4039
4370
  });
@@ -4396,7 +4727,7 @@ function HighlightFocusController() {
4396
4727
  var FocusHighlightController = HighlightFocusController;
4397
4728
 
4398
4729
  // src/features/ReduceMotionController.tsx
4399
- var import_react15 = require("react");
4730
+ var import_react16 = require("react");
4400
4731
  var import_jsx_runtime28 = require("react/jsx-runtime");
4401
4732
  var FEATURE_KEY21 = "reduceMotion";
4402
4733
  var DEFAULT_VALUE21 = false;
@@ -4405,7 +4736,7 @@ function ReduceMotionController() {
4405
4736
  FEATURE_KEY21,
4406
4737
  DEFAULT_VALUE21
4407
4738
  );
4408
- const osReducedMotion = (0, import_react15.useSyncExternalStore)(
4739
+ const osReducedMotion = (0, import_react16.useSyncExternalStore)(
4409
4740
  subscribeReducedMotion,
4410
4741
  isReducedMotionActive,
4411
4742
  () => false
@@ -4486,128 +4817,1885 @@ function TooltipsController({
4486
4817
  }
4487
4818
  var AccessibleTooltipsController = TooltipsController;
4488
4819
 
4489
- // src/features/ResetController.tsx
4490
- var import_react_dom2 = require("react-dom");
4491
- var import_react16 = require("react");
4492
- var import_jsx_runtime30 = require("react/jsx-runtime");
4493
- function ResetController() {
4494
- const ctx = (0, import_react16.useContext)(AccessibilityContext);
4495
- if (!ctx) {
4496
- throw new Error(
4497
- "ResetController must be used within an <AccessibilityPlugin> provider."
4498
- );
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;
4499
4838
  }
4500
- const actionHost = (0, import_react16.useContext)(PanelActionsContext);
4501
- const { resetAll } = ctx;
4502
- const strings = resolveLocaleStrings(ctx.locale);
4503
- const button = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
4504
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FeatureIcon, { name: "reset" }),
4505
- strings.resetAll
4506
- ] }) });
4507
- return actionHost ? (0, import_react_dom2.createPortal)(button, actionHost) : button;
4839
+ return true;
4508
4840
  }
4509
-
4510
- // src/core/controls/ToggleControl.tsx
4511
- var import_jsx_runtime31 = require("react/jsx-runtime");
4512
- function ToggleControl({
4513
- id,
4514
- label,
4515
- checked,
4516
- onChange,
4517
- disabled = false,
4518
- unavailable = false,
4519
- unavailableReason,
4520
- name,
4521
- description,
4522
- largeControls = false,
4523
- className = "",
4524
- style
4525
- }) {
4526
- const isInteractive = !disabled && !unavailable;
4527
- const toggleLabel = typeof label === "string" ? label : void 0;
4528
- const handleClick = () => {
4529
- if (isInteractive) {
4530
- onChange(!checked);
4531
- }
4532
- };
4533
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4534
- "div",
4535
- {
4536
- className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4537
- style,
4538
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4539
- "button",
4540
- {
4541
- id,
4542
- name,
4543
- type: "button",
4544
- className: `arap-toggle ${checked ? "arap-toggle-active" : ""}`,
4545
- role: "switch",
4546
- "aria-checked": checked,
4547
- "aria-label": toggleLabel,
4548
- "aria-disabled": !isInteractive,
4549
- disabled: !isInteractive,
4550
- onClick: handleClick,
4551
- title: unavailableReason || description || toggleLabel,
4552
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4553
- "span",
4554
- {
4555
- className: "arap-toggle-knob",
4556
- style: {
4557
- transform: checked ? largeControls ? "translateX(28px)" : "translateX(24px)" : "translateX(0)"
4558
- }
4559
- }
4560
- )
4561
- }
4562
- )
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));
4563
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]"
4564
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
+ };
4565
5009
  }
4566
5010
 
4567
- // src/core/controls/ChoiceControl.tsx
4568
- var import_react17 = require("react");
4569
- var import_jsx_runtime32 = require("react/jsx-runtime");
4570
- function ChoiceControl({
4571
- id,
4572
- label,
4573
- value,
4574
- options,
4575
- groups,
4576
- onChange,
4577
- disabled = false,
4578
- largeControls = false,
5011
+ // src/features/PageNavigatorController.tsx
5012
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5013
+ function PageNavigatorController({
4579
5014
  className = "",
4580
- style,
4581
- orientation = "horizontal"
5015
+ label = "Page Navigator",
5016
+ description = "Explore headings and landmarks",
5017
+ closeOnNavigate = false
4582
5018
  }) {
4583
- const containerRef = (0, import_react17.useRef)(null);
4584
- const allOptions = (0, import_react17.useMemo)(
4585
- () => groups ? groups.flatMap((g) => g.options) : options || [],
4586
- [groups, options]
5019
+ const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
5020
+ const [activeTab, setActiveTab] = (0, import_react17.useState)(
5021
+ "headings"
4587
5022
  );
4588
- const handleKeyDown = (0, import_react17.useCallback)(
4589
- (e) => {
4590
- if (disabled || allOptions.length === 0) return;
4591
- const enabledOptions = allOptions.filter((opt) => !opt.disabled);
4592
- const currentIndex = enabledOptions.findIndex(
4593
- (opt) => opt.value === value
4594
- );
4595
- let nextIndex = -1;
4596
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
4597
- e.preventDefault();
4598
- nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % enabledOptions.length;
4599
- } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
4600
- e.preventDefault();
4601
- nextIndex = currentIndex === -1 ? enabledOptions.length - 1 : (currentIndex - 1 + enabledOptions.length) % enabledOptions.length;
4602
- } else if (e.key === "Home") {
4603
- e.preventDefault();
4604
- nextIndex = 0;
4605
- } else if (e.key === "End") {
4606
- e.preventDefault();
4607
- nextIndex = enabledOptions.length - 1;
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
+ }
4608
5055
  }
4609
- if (nextIndex !== -1 && enabledOptions[nextIndex]) {
4610
- onChange(enabledOptions[nextIndex].value);
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
+ }
6648
+ )
6649
+ }
6650
+ )
6651
+ }
6652
+ );
6653
+ }
6654
+
6655
+ // src/core/controls/ChoiceControl.tsx
6656
+ var import_react22 = require("react");
6657
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6658
+ function ChoiceControl({
6659
+ id,
6660
+ label,
6661
+ value,
6662
+ options,
6663
+ groups,
6664
+ onChange,
6665
+ disabled = false,
6666
+ largeControls = false,
6667
+ className = "",
6668
+ style,
6669
+ orientation = "horizontal"
6670
+ }) {
6671
+ const containerRef = (0, import_react22.useRef)(null);
6672
+ const allOptions = (0, import_react22.useMemo)(
6673
+ () => groups ? groups.flatMap((g) => g.options) : options || [],
6674
+ [groups, options]
6675
+ );
6676
+ const handleKeyDown = (0, import_react22.useCallback)(
6677
+ (e) => {
6678
+ if (disabled || allOptions.length === 0) return;
6679
+ const enabledOptions = allOptions.filter((opt) => !opt.disabled);
6680
+ const currentIndex = enabledOptions.findIndex(
6681
+ (opt) => opt.value === value
6682
+ );
6683
+ let nextIndex = -1;
6684
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") {
6685
+ e.preventDefault();
6686
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % enabledOptions.length;
6687
+ } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
6688
+ e.preventDefault();
6689
+ nextIndex = currentIndex === -1 ? enabledOptions.length - 1 : (currentIndex - 1 + enabledOptions.length) % enabledOptions.length;
6690
+ } else if (e.key === "Home") {
6691
+ e.preventDefault();
6692
+ nextIndex = 0;
6693
+ } else if (e.key === "End") {
6694
+ e.preventDefault();
6695
+ nextIndex = enabledOptions.length - 1;
6696
+ }
6697
+ if (nextIndex !== -1 && enabledOptions[nextIndex]) {
6698
+ onChange(enabledOptions[nextIndex].value);
4611
6699
  const buttons = containerRef.current?.querySelectorAll(
4612
6700
  "button[data-choice-value]"
4613
6701
  );
@@ -4622,7 +6710,7 @@ function ChoiceControl({
4622
6710
  const renderOptionButton = (opt) => {
4623
6711
  const isSelected = value === opt.value;
4624
6712
  const isOptionDisabled = disabled || Boolean(opt.disabled);
4625
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6713
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4626
6714
  "button",
4627
6715
  {
4628
6716
  type: "button",
@@ -4636,15 +6724,15 @@ function ChoiceControl({
4636
6724
  onClick: () => !isOptionDisabled && onChange(opt.value),
4637
6725
  title: opt.description,
4638
6726
  children: [
4639
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
4640
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: opt.label }),
4641
- opt.badge && /* @__PURE__ */ (0, import_jsx_runtime32.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 })
4642
6730
  ]
4643
6731
  },
4644
6732
  String(opt.value)
4645
6733
  );
4646
6734
  };
4647
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6735
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4648
6736
  "div",
4649
6737
  {
4650
6738
  ref: containerRef,
@@ -4655,15 +6743,15 @@ function ChoiceControl({
4655
6743
  className: `arap-choice-control arap-segmented ${largeControls ? "arap-large-controls" : ""} ${className}`,
4656
6744
  style,
4657
6745
  onKeyDown: handleKeyDown,
4658
- children: groups ? groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6746
+ children: groups ? groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4659
6747
  "div",
4660
6748
  {
4661
6749
  className: "arap-choice-group",
4662
6750
  role: "group",
4663
6751
  "aria-label": group.label,
4664
6752
  children: [
4665
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "arap-choice-group-title", children: group.label }),
4666
- /* @__PURE__ */ (0, import_jsx_runtime32.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) })
4667
6755
  ]
4668
6756
  },
4669
6757
  group.label
@@ -4673,7 +6761,7 @@ function ChoiceControl({
4673
6761
  }
4674
6762
 
4675
6763
  // src/core/controls/StepperControl.tsx
4676
- var import_jsx_runtime33 = require("react/jsx-runtime");
6764
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4677
6765
  function StepperControl({
4678
6766
  id,
4679
6767
  label,
@@ -4703,15 +6791,15 @@ function StepperControl({
4703
6791
  onChange(Math.min(max, Number((value + step).toFixed(2))));
4704
6792
  }
4705
6793
  };
4706
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6794
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4707
6795
  "div",
4708
6796
  {
4709
6797
  id,
4710
6798
  className: `arap-stepper-control-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4711
6799
  style,
4712
6800
  children: [
4713
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "arap-controls", children: [
4714
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6801
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "arap-controls", children: [
6802
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4715
6803
  "button",
4716
6804
  {
4717
6805
  type: "button",
@@ -4722,8 +6810,8 @@ function StepperControl({
4722
6810
  children: "\u2212"
4723
6811
  }
4724
6812
  ),
4725
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
4726
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6813
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
6814
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4727
6815
  "button",
4728
6816
  {
4729
6817
  type: "button",
@@ -4735,7 +6823,7 @@ function StepperControl({
4735
6823
  }
4736
6824
  )
4737
6825
  ] }),
4738
- showSlider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "arap-slider-container", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6826
+ showSlider && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "arap-slider-container", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4739
6827
  "input",
4740
6828
  {
4741
6829
  type: "range",
@@ -4759,7 +6847,7 @@ function StepperControl({
4759
6847
  }
4760
6848
 
4761
6849
  // src/core/controls/FeatureCard.tsx
4762
- var import_jsx_runtime34 = require("react/jsx-runtime");
6850
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4763
6851
  function FeatureCard({
4764
6852
  id,
4765
6853
  featureKey,
@@ -4778,7 +6866,7 @@ function FeatureCard({
4778
6866
  largeControls = false
4779
6867
  }) {
4780
6868
  const cardTitle = typeof title === "string" ? title : void 0;
4781
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6869
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4782
6870
  "div",
4783
6871
  {
4784
6872
  id,
@@ -4787,27 +6875,27 @@ function FeatureCard({
4787
6875
  className: `arap-feature arap-feature-card ${status !== "idle" ? `arap-feature-${status}` : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4788
6876
  style,
4789
6877
  children: [
4790
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-card-header", children: [
4791
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "arap-label", children: [
4792
- icon ?? (featureKey ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FeatureIcon, { name: featureKey }) : null),
4793
- /* @__PURE__ */ (0, import_jsx_runtime34.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 })
4794
6882
  ] }),
4795
- statusBadge && /* @__PURE__ */ (0, import_jsx_runtime34.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 })
4796
6884
  ] }),
4797
- description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "arap-card-desc", children: description }),
4798
- status === "error" && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
4799
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4800
- /* @__PURE__ */ (0, import_jsx_runtime34.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 })
4801
6889
  ] }),
4802
- status === "unavailable" && unavailableMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
4803
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
4804
- /* @__PURE__ */ (0, import_jsx_runtime34.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 })
4805
6893
  ] }),
4806
- status === "permission-required" && permissionMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
4807
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
4808
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "arap-permission-content", children: [
4809
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: permissionMessage }),
4810
- onRequestPermission && /* @__PURE__ */ (0, import_jsx_runtime34.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)(
4811
6899
  "button",
4812
6900
  {
4813
6901
  type: "button",
@@ -4818,199 +6906,20 @@ function FeatureCard({
4818
6906
  )
4819
6907
  ] })
4820
6908
  ] }),
4821
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "arap-card-content", children })
4822
- ]
4823
- }
4824
- );
4825
- }
4826
-
4827
- // src/core/controls/FeatureStatusState.tsx
4828
- var import_jsx_runtime35 = require("react/jsx-runtime");
4829
- function SearchCount({
4830
- totalCount,
4831
- matchedCount,
4832
- query,
4833
- className = "",
4834
- style
4835
- }) {
4836
- const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
4837
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4838
- "div",
4839
- {
4840
- role: "status",
4841
- "aria-live": "polite",
4842
- className: `arap-search-count ${className}`,
4843
- style,
4844
- children: text
4845
- }
4846
- );
4847
- }
4848
- function EmptyState({
4849
- title = "No matching tools found",
4850
- description = "Try adjusting your search query or reset filters.",
4851
- actionLabel = "Clear search",
4852
- onAction,
4853
- icon,
4854
- className = "",
4855
- style
4856
- }) {
4857
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4858
- "div",
4859
- {
4860
- role: "status",
4861
- className: `arap-empty-state ${className}`,
4862
- style,
4863
- children: [
4864
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
4865
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "arap-empty-title", children: title }),
4866
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "arap-empty-desc", children: description }),
4867
- onAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
4868
- ]
4869
- }
4870
- );
4871
- }
4872
- function ErrorState({
4873
- title = "Something went wrong",
4874
- message,
4875
- onRetry,
4876
- retryLabel = "Try again",
4877
- className = "",
4878
- style
4879
- }) {
4880
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4881
- "div",
4882
- {
4883
- role: "alert",
4884
- className: `arap-error-state arap-card-alert arap-card-error ${className}`,
4885
- style,
4886
- children: [
4887
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4888
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "arap-error-content", children: [
4889
- title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h4", { className: "arap-error-title", children: title }),
4890
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "arap-error-message", children: message }),
4891
- onRetry && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
4892
- ] })
4893
- ]
4894
- }
4895
- );
4896
- }
4897
-
4898
- // src/core/controls/ProfilePreviewCard.tsx
4899
- var import_jsx_runtime36 = require("react/jsx-runtime");
4900
- function ProfilePreviewCard({
4901
- profile,
4902
- isActive,
4903
- onApply,
4904
- onRevert,
4905
- largeControls = false,
4906
- className = "",
4907
- style
4908
- }) {
4909
- const affectedKeys = Object.keys(
4910
- profile.settings
4911
- );
4912
- const formatKeyName = (key) => {
4913
- switch (key) {
4914
- case "fontScale":
4915
- return "Font Size";
4916
- case "lineHeight":
4917
- return "Line Height";
4918
- case "contrastMode":
4919
- return "Contrast";
4920
- case "reduceMotion":
4921
- return "Reduce Motion";
4922
- case "textAlign":
4923
- return "Text Align";
4924
- case "highlightLinks":
4925
- return "Highlight Links";
4926
- case "highlightFocus":
4927
- return "Highlight Focus";
4928
- case "cursorSize":
4929
- return "Cursor Size";
4930
- case "readerMode":
4931
- return "Reading Mode";
4932
- case "saturation":
4933
- return "Saturation";
4934
- case "hideDecorativeImages":
4935
- return "Hide Images";
4936
- default:
4937
- return key.replace(/([A-Z])/g, " $1").trim();
4938
- }
4939
- };
4940
- const formatSettingValue = (key, val) => {
4941
- if (typeof val === "boolean") return val ? "On" : "Off";
4942
- if (key === "fontScale" && typeof val === "number")
4943
- return `${Math.round(val * 100)}%`;
4944
- if (key === "lineHeight" && typeof val === "number")
4945
- return `${Math.round(val * 100)}%`;
4946
- if (val === null || val === void 0) return "Original";
4947
- return String(val);
4948
- };
4949
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4950
- "div",
4951
- {
4952
- role: "group",
4953
- "aria-label": `${profile.label} profile`,
4954
- className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4955
- style,
4956
- children: [
4957
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "arap-profile-header", children: [
4958
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "arap-profile-title-row", children: [
4959
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h4", { className: "arap-profile-title", children: profile.label }),
4960
- isActive && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4961
- "span",
4962
- {
4963
- className: "arap-profile-active-badge",
4964
- "aria-label": "Active profile",
4965
- children: "\u2713 Active"
4966
- }
4967
- )
4968
- ] }),
4969
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "arap-profile-desc", children: profile.description })
4970
- ] }),
4971
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "arap-profile-affected", children: [
4972
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
4973
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
4974
- const val = profile.settings[key];
4975
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "arap-profile-chip", children: [
4976
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
4977
- formatKeyName(key),
4978
- ":"
4979
- ] }),
4980
- " ",
4981
- formatSettingValue(key, val)
4982
- ] }, key);
4983
- }) })
4984
- ] }),
4985
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4986
- "button",
4987
- {
4988
- type: "button",
4989
- className: "arap-profile-revert-btn",
4990
- onClick: onRevert,
4991
- "aria-label": `Revert ${profile.label} profile`,
4992
- children: "Revert to custom settings"
4993
- }
4994
- ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4995
- "button",
4996
- {
4997
- type: "button",
4998
- className: "arap-profile-apply-btn",
4999
- onClick: () => onApply(profile),
5000
- "aria-label": `Apply ${profile.label} profile`,
5001
- children: "Apply Profile"
5002
- }
5003
- ) })
6909
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "arap-card-content", children })
5004
6910
  ]
5005
6911
  }
5006
6912
  );
5007
6913
  }
5008
6914
  // Annotate the CommonJS export names for ESM import in node:
5009
6915
  0 && (module.exports = {
6916
+ ALLOWED_PREFERENCE_KEYS,
6917
+ ALL_PROFILE_IDS,
5010
6918
  AccessibilityButton,
5011
6919
  AccessibilityContext,
5012
6920
  AccessibilityList,
5013
6921
  AccessibilityPlugin,
6922
+ AccessibilityProfilesController,
5014
6923
  AccessibleTooltipsController,
5015
6924
  BigCursorController,
5016
6925
  CONTRAST_MODES,
@@ -5019,6 +6928,7 @@ function ProfilePreviewCard({
5019
6928
  ChoiceControl,
5020
6929
  ContrastController,
5021
6930
  ContrastModeController,
6931
+ CustomPresetsController,
5022
6932
  DEFAULT_PREFERENCES,
5023
6933
  DEFAULT_READING_MASK_HEIGHT,
5024
6934
  DYSLEXIA_FONT_STACK,
@@ -5031,6 +6941,7 @@ function ProfilePreviewCard({
5031
6941
  FontFamilyController,
5032
6942
  FontSizeController,
5033
6943
  GrayscaleController,
6944
+ HeadingsNavigatorController,
5034
6945
  HideDecorativeImagesController,
5035
6946
  HideImagesController,
5036
6947
  HideVideosController,
@@ -5045,8 +6956,14 @@ function ProfilePreviewCard({
5045
6956
  MAX_READING_MASK_HEIGHT,
5046
6957
  MIN_READING_MASK_HEIGHT,
5047
6958
  PROFILE_DEFINITIONS,
6959
+ PageNavigatorController,
6960
+ PageStructureController,
5048
6961
  ParagraphSpacingController,
6962
+ PresetsBackupController,
6963
+ PresetsController,
6964
+ ProfileController,
5049
6965
  ProfilePreviewCard,
6966
+ ProfilesController,
5050
6967
  READING_MASK_HEIGHT_PRESETS,
5051
6968
  ReadingGuideController,
5052
6969
  ReadingMaskController,
@@ -5054,6 +6971,7 @@ function ProfilePreviewCard({
5054
6971
  ResetController,
5055
6972
  SaturationController,
5056
6973
  SearchCount,
6974
+ SettingsImportExportController,
5057
6975
  SkipToMainLink,
5058
6976
  StepperControl,
5059
6977
  TEXT_ALIGN_BLOCK_SELECTOR,
@@ -5065,11 +6983,17 @@ function ProfilePreviewCard({
5065
6983
  ToggleControl,
5066
6984
  TooltipsController,
5067
6985
  WordSpacingController,
6986
+ applyCustomPresetToStore,
6987
+ applyProfileToStore,
6988
+ createCustomPreset,
5068
6989
  createInitialPreferencesState,
6990
+ downloadJsonFile,
5069
6991
  enLocale,
5070
6992
  enableAccessibleTooltips,
6993
+ exportPresetsToJson,
5071
6994
  findMainLandmark,
5072
6995
  getAuthoredDescription,
6996
+ getProfileDefinition,
5073
6997
  getScriptSpacingConstraints,
5074
6998
  hasFinePointer,
5075
6999
  isEligibleDecorativeImage,
@@ -5082,17 +7006,30 @@ function ProfilePreviewCard({
5082
7006
  isProtectedFromTextSpacing,
5083
7007
  isReducedMotionActive,
5084
7008
  isRtlLocale,
7009
+ isValidCustomPreset,
7010
+ mapFeaturesToProfileSettings,
7011
+ mapProfileSettingsToFeatures,
7012
+ navigateToElement,
5085
7013
  normalizePreferenceValue,
5086
7014
  normalizePreferences,
5087
7015
  nudgeReadingAid,
5088
7016
  positionTooltip,
5089
7017
  preferencesReducer,
7018
+ recordProfileOverride,
5090
7019
  registerLocale,
5091
7020
  resolveEffectivePreferences,
5092
7021
  resolveLocaleStrings,
7022
+ revertProfileFromStore,
7023
+ sanitizePreferences,
7024
+ scanHeadings,
7025
+ scanLandmarks,
5093
7026
  subscribeFinePointer,
5094
7027
  subscribeForcedColors,
7028
+ subscribePageStructure,
5095
7029
  subscribeReducedMotion,
5096
- useAccessibility
7030
+ useAccessibility,
7031
+ usePresets,
7032
+ useProfiles,
7033
+ validateAndParseImport
5097
7034
  });
5098
7035
  //# sourceMappingURL=index.js.map