documentation-hub 5.7.2

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.
Files changed (271) hide show
  1. package/.eslintrc.json +43 -0
  2. package/.github/workflows/build.yml +64 -0
  3. package/.github/workflows/ci.yml +39 -0
  4. package/.vscode/extensions.json +3 -0
  5. package/Current.md +97 -0
  6. package/DocHub_Image.png +0 -0
  7. package/README.md +666 -0
  8. package/USER_GUIDE.md +1173 -0
  9. package/Updater.md +311 -0
  10. package/build/256x256.png +0 -0
  11. package/build/512x512.png +0 -0
  12. package/build/app-update.yml +4 -0
  13. package/build/create-icon.js +208 -0
  14. package/build/icon.ico +0 -0
  15. package/build/icon.png +0 -0
  16. package/build/icon_1024x1024.png +0 -0
  17. package/dist/assets/Analytics-BpsG9895.js +1 -0
  18. package/dist/assets/Card-IAZin8kp.js +1 -0
  19. package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
  20. package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
  21. package/dist/assets/Documents-CqZ25axS.js +1 -0
  22. package/dist/assets/Input-l89xwXBi.js +1 -0
  23. package/dist/assets/Reporting-DqdHJY_a.js +1 -0
  24. package/dist/assets/Search-XNbu5z_3.js +1 -0
  25. package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
  26. package/dist/assets/Sessions-ClZOPYNc.js +1 -0
  27. package/dist/assets/Settings-DUEHGURa.js +11 -0
  28. package/dist/assets/index-8xUe8ptc.js +24 -0
  29. package/dist/assets/index-RYyJqF7O.css +1 -0
  30. package/dist/assets/path-BkOl0AGO.js +1 -0
  31. package/dist/assets/promises-ID_B9S-h.js +1 -0
  32. package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
  33. package/dist/assets/useToast-yRSO1dkm.js +1 -0
  34. package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
  35. package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
  36. package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
  37. package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
  38. package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
  39. package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
  40. package/dist/electron/main-CXkNtyv-.js +19789 -0
  41. package/dist/electron/main.js +5 -0
  42. package/dist/electron/preload.js +1 -0
  43. package/dist/icon.png +0 -0
  44. package/dist/index.html +27 -0
  45. package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
  46. package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
  47. package/docs/README.md +115 -0
  48. package/docs/TOC_WIRING_GUIDE.md +344 -0
  49. package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
  50. package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
  51. package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
  52. package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
  53. package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
  54. package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
  55. package/docs/analysis/List_Implementation.md +206 -0
  56. package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
  57. package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
  58. package/docs/analysis/RefactorStyles.md +852 -0
  59. package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
  60. package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
  61. package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
  62. package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
  63. package/docs/analysis/github-issues-to-create.md +237 -0
  64. package/docs/api/API_README.md +538 -0
  65. package/docs/api/API_REFERENCE.md +751 -0
  66. package/docs/api/TYPE_DEFINITIONS.md +869 -0
  67. package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
  68. package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
  69. package/docs/docxmlater-readme.md +1341 -0
  70. package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
  71. package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
  72. package/docs/fixes/README.md +37 -0
  73. package/docs/github-issues/issue-1-body.md +125 -0
  74. package/docs/github-issues/issue-10-body.md +850 -0
  75. package/docs/github-issues/issue-2-body.md +200 -0
  76. package/docs/github-issues/issue-3-body.md +270 -0
  77. package/docs/github-issues/issue-4-body.md +169 -0
  78. package/docs/github-issues/issue-5-body.md +173 -0
  79. package/docs/github-issues/issue-6-body.md +158 -0
  80. package/docs/github-issues/issue-7-body.md +171 -0
  81. package/docs/github-issues/issue-8-body.md +407 -0
  82. package/docs/github-issues/issue-9-body.md +515 -0
  83. package/docs/github-issues/issue-tracker.md +274 -0
  84. package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
  85. package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
  86. package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
  87. package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
  88. package/docs/implementation/RefactorStyles.md +588 -0
  89. package/docs/implementation/implement-plan.md +489 -0
  90. package/docs/implementation/missing-helpers-implementation.md +391 -0
  91. package/docs/implementation/refactor-plan.md +520 -0
  92. package/docs/implementation/session-implementation-complete.md +233 -0
  93. package/docs/implementation/session-management-plan.md +250 -0
  94. package/docs/setup-checklist.md +77 -0
  95. package/docs/versions/changelog.md +345 -0
  96. package/electron/customUpdater.ts +656 -0
  97. package/electron/main.ts +2441 -0
  98. package/electron/memoryConfig.ts +187 -0
  99. package/electron/preload.ts +394 -0
  100. package/electron/proxyConfig.ts +340 -0
  101. package/electron/services/BackupService.ts +452 -0
  102. package/electron/services/DictionaryService.ts +402 -0
  103. package/electron/services/LocalDictionaryLookupService.ts +147 -0
  104. package/electron/services/PowerAutomateApiService.ts +231 -0
  105. package/electron/services/SharePointSyncService.ts +474 -0
  106. package/electron/windowsCertStore.ts +427 -0
  107. package/electron/zscalerConfig.ts +381 -0
  108. package/eslint.config.js +92 -0
  109. package/jest.config.js +52 -0
  110. package/package.json +214 -0
  111. package/postcss.config.mjs +6 -0
  112. package/public/icon.png +0 -0
  113. package/publish-release.ps1 +5 -0
  114. package/renovate.json +30 -0
  115. package/src/App.tsx +216 -0
  116. package/src/__mocks__/p-limit.js +12 -0
  117. package/src/__mocks__/styleMock.js +1 -0
  118. package/src/components/common/BugReportButton.tsx +44 -0
  119. package/src/components/common/BugReportDialog.tsx +193 -0
  120. package/src/components/common/Button.tsx +153 -0
  121. package/src/components/common/Card.tsx +86 -0
  122. package/src/components/common/ColorPickerDialog.tsx +177 -0
  123. package/src/components/common/ConfirmDialog.tsx +96 -0
  124. package/src/components/common/DebugConsole.tsx +275 -0
  125. package/src/components/common/EmptyState.tsx +183 -0
  126. package/src/components/common/ErrorBoundary.tsx +98 -0
  127. package/src/components/common/ErrorDetailsDialog.tsx +153 -0
  128. package/src/components/common/ErrorFallback.tsx +218 -0
  129. package/src/components/common/Input.tsx +109 -0
  130. package/src/components/common/Skeleton.tsx +184 -0
  131. package/src/components/common/SplashScreen.tsx +81 -0
  132. package/src/components/common/Toast.tsx +155 -0
  133. package/src/components/common/Tooltip.tsx +79 -0
  134. package/src/components/common/UpdateNotification.tsx +320 -0
  135. package/src/components/comparison/ComparisonWindow.tsx +374 -0
  136. package/src/components/comparison/SideBySideDiff.tsx +486 -0
  137. package/src/components/comparison/index.ts +8 -0
  138. package/src/components/document/DocumentUploader.tsx +288 -0
  139. package/src/components/document/HyperlinkPreview.tsx +430 -0
  140. package/src/components/document/HyperlinkService.md +1484 -0
  141. package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
  142. package/src/components/document/InlineChangesView.tsx +707 -0
  143. package/src/components/document/ProcessingProgress.tsx +303 -0
  144. package/src/components/document/ProcessingResults.tsx +256 -0
  145. package/src/components/document/TrackedChangesDetail.tsx +530 -0
  146. package/src/components/document/TrackedChangesPanel.tsx +546 -0
  147. package/src/components/document/VirtualDocumentList.tsx +240 -0
  148. package/src/components/editor/DocumentEditor.tsx +723 -0
  149. package/src/components/editor/DocumentEditorModal.tsx +640 -0
  150. package/src/components/editor/EditorQuickActions.tsx +502 -0
  151. package/src/components/editor/EditorToolbar.tsx +312 -0
  152. package/src/components/editor/TableEditor.tsx +926 -0
  153. package/src/components/editor/index.ts +18 -0
  154. package/src/components/layout/Header.tsx +190 -0
  155. package/src/components/layout/Sidebar.tsx +313 -0
  156. package/src/components/layout/TitleBar.tsx +190 -0
  157. package/src/components/navigation/CommandPalette.tsx +233 -0
  158. package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
  159. package/src/components/sessions/ChangeItem.tsx +408 -0
  160. package/src/components/sessions/ChangeViewer.tsx +1155 -0
  161. package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
  162. package/src/components/sessions/ProcessingOptions.tsx +297 -0
  163. package/src/components/sessions/ReplacementsTab.tsx +438 -0
  164. package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
  165. package/src/components/sessions/SessionManager.tsx +188 -0
  166. package/src/components/sessions/StylesEditor.tsx +1335 -0
  167. package/src/components/sessions/TabContainer.tsx +151 -0
  168. package/src/components/sessions/VirtualSessionList.tsx +157 -0
  169. package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
  170. package/src/components/settings/CertificateManager.tsx +410 -0
  171. package/src/components/settings/SegmentedControl.tsx +88 -0
  172. package/src/components/settings/SettingRow.tsx +52 -0
  173. package/src/contexts/GlobalStatsContext.tsx +396 -0
  174. package/src/contexts/SessionContext.tsx +2129 -0
  175. package/src/contexts/ThemeContext.tsx +428 -0
  176. package/src/contexts/UserSettingsContext.tsx +290 -0
  177. package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
  178. package/src/global.d.ts +273 -0
  179. package/src/hooks/useDocumentQueue.tsx +210 -0
  180. package/src/hooks/useToast.tsx +55 -0
  181. package/src/main.tsx +10 -0
  182. package/src/pages/Analytics.tsx +386 -0
  183. package/src/pages/CurrentSession.tsx +1174 -0
  184. package/src/pages/Dashboard.tsx +319 -0
  185. package/src/pages/Documents.tsx +317 -0
  186. package/src/pages/Projects.tsx +250 -0
  187. package/src/pages/Reporting.tsx +386 -0
  188. package/src/pages/Search.tsx +349 -0
  189. package/src/pages/Sessions.tsx +285 -0
  190. package/src/pages/Settings.tsx +2662 -0
  191. package/src/services/HyperlinkService.ts +1085 -0
  192. package/src/services/document/DocXMLaterProcessor.ts +617 -0
  193. package/src/services/document/DocumentProcessingComparison.ts +856 -0
  194. package/src/services/document/DocumentSnapshotService.ts +575 -0
  195. package/src/services/document/WordDocumentProcessor.ts +10509 -0
  196. package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
  197. package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
  198. package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
  199. package/src/services/document/blanklines/BlankLineManager.ts +658 -0
  200. package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
  201. package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
  202. package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
  203. package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
  204. package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
  205. package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
  206. package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
  207. package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
  208. package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
  209. package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
  210. package/src/services/document/blanklines/index.ts +67 -0
  211. package/src/services/document/blanklines/rules/additionRules.ts +337 -0
  212. package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
  213. package/src/services/document/blanklines/rules/removalRules.ts +362 -0
  214. package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
  215. package/src/services/document/blanklines/types.ts +29 -0
  216. package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
  217. package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
  218. package/src/services/document/helpers/whitespace.ts +117 -0
  219. package/src/services/document/list/ListNormalizer.ts +947 -0
  220. package/src/services/document/list/index.ts +45 -0
  221. package/src/services/document/list/list-detection.ts +275 -0
  222. package/src/services/document/list/list-types.ts +162 -0
  223. package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
  224. package/src/services/document/processors/ListProcessor.ts +257 -0
  225. package/src/services/document/processors/StructureProcessor.ts +176 -0
  226. package/src/services/document/processors/StyleProcessor.ts +389 -0
  227. package/src/services/document/processors/TableProcessor.ts +2238 -0
  228. package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
  229. package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
  230. package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
  231. package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
  232. package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
  233. package/src/services/document/processors/index.ts +28 -0
  234. package/src/services/document/types/docx-processing.ts +310 -0
  235. package/src/services/editor/EditorActionHandlers.ts +901 -0
  236. package/src/services/editor/index.ts +13 -0
  237. package/src/setupTests.ts +47 -0
  238. package/src/styles/global.css +782 -0
  239. package/src/types/backup.ts +132 -0
  240. package/src/types/dictionary.ts +125 -0
  241. package/src/types/document-processing.ts +331 -0
  242. package/src/types/docxmlater-augments.d.ts +142 -0
  243. package/src/types/editor.ts +280 -0
  244. package/src/types/electron.ts +340 -0
  245. package/src/types/globalStats.ts +155 -0
  246. package/src/types/hyperlink.ts +471 -0
  247. package/src/types/operations.ts +354 -0
  248. package/src/types/session.ts +427 -0
  249. package/src/types/settings.ts +112 -0
  250. package/src/utils/MemoryMonitor.ts +248 -0
  251. package/src/utils/cn.ts +6 -0
  252. package/src/utils/colorConvert.ts +306 -0
  253. package/src/utils/diffUtils.ts +347 -0
  254. package/src/utils/documentUtils.ts +202 -0
  255. package/src/utils/electronGuard.ts +62 -0
  256. package/src/utils/indexedDB.ts +915 -0
  257. package/src/utils/logger.ts +717 -0
  258. package/src/utils/pathSecurity.ts +232 -0
  259. package/src/utils/pathValidator.ts +236 -0
  260. package/src/utils/processingTimeEstimator.ts +153 -0
  261. package/src/utils/safeJsonParse.ts +62 -0
  262. package/src/utils/textSanitizer.ts +162 -0
  263. package/src/utils/urlHelpers.ts +304 -0
  264. package/src/utils/urlPatterns.ts +198 -0
  265. package/src/utils/urlSanitizer.ts +152 -0
  266. package/src/vite-env.d.ts +11 -0
  267. package/tsconfig.electron.json +19 -0
  268. package/tsconfig.json +36 -0
  269. package/tsconfig.node.json +12 -0
  270. package/typedoc.json +45 -0
  271. package/vite.config.ts +152 -0
@@ -0,0 +1,11 @@
1
+ import{j as e,A as Nt,m as D,X as Ns,ae as wt,af as Ee,ag as Re,R as St,z as kt,O as Ct,B as Pt,T as It,G as Tt,E as At,a as ws,g as Ut,P as Ss,h as Ft,c as Dt,x as Rt,U as ks,ah as Lt,v as Cs,ai as Et,V as Le,aj as Ps,ak as Is,al as ge,am as Mt,an as z,ao as Bt,s as zt,t as Ht,ap as $t,aq as fs,ar as _t,Z as bs,as as Wt,a4 as Ue,at as Vt,au as Yt,av as pe,aw as Ot,N as re,J as Gt}from"./vendor-ui-BU7NfluV.js";import{c as n,B as p,l as H,b as qt,d as Jt,u as Qt,a as Kt,e as Xt,g as Zt}from"./index-8xUe8ptc.js";import{r as t}from"./vendor-react-BVZ_anCF.js";import{I as Fe}from"./Input-l89xwXBi.js";import{h as gs,s as js,v as ea}from"./urlHelpers-TvgahX0r.js";import"./vendor-charts-RkGK5ROP.js";function sa({isOpen:r,onClose:x,color:c,onColorChange:b,title:h="Pick a Color"}){const[f,j]=t.useState(c);t.useEffect(()=>{r&&j(c)},[r,c]);const y=()=>{b(f),x()},d=()=>{j(c),x()};return e.jsx(Nt,{children:r&&e.jsxs(e.Fragment,{children:[e.jsx(D.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-xs z-50",onClick:d}),e.jsxs(D.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-80 bg-background border border-border rounded-xl shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"font-semibold",children:h}),e.jsx("button",{onClick:d,className:"p-1 rounded-md hover:bg-muted transition-colors",children:e.jsx(Ns,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"p-6 space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"w-full h-32 rounded-lg border border-border relative overflow-hidden group cursor-pointer",children:[e.jsx("div",{className:"absolute inset-0 transition-all",style:{backgroundColor:f}}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20",children:e.jsxs("div",{className:"bg-white/90 px-3 py-1.5 rounded-full flex items-center gap-2 text-sm font-medium",children:[e.jsx(wt,{className:"w-4 h-4"}),"Click to pick color"]})}),e.jsx("input",{type:"color",value:f,onChange:o=>j(o.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx("input",{type:"text",value:f,onChange:o=>{const g=o.target.value;/^#[0-9A-Fa-f]{0,6}$/.test(g)&&j(g)},className:"w-full pl-10 pr-3 py-2 text-sm border border-border rounded-md bg-background font-mono focus:border-primary focus:ring-1 focus:ring-primary/20 transition-all",placeholder:"#000000",maxLength:7})]}),e.jsx("div",{className:"w-10 h-10 rounded-md border-2 border-border shadow-inner",style:{backgroundColor:f}})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Quick Colors"}),e.jsx("div",{className:"grid grid-cols-8 gap-2",children:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#64748b","#475569","#334155","#1e293b","#0f172a","#ffffff","#000000"].map(o=>e.jsx("button",{onClick:()=>j(o),className:n("w-8 h-8 rounded border-2 transition-all",f===o?"border-primary scale-110":"border-border hover:border-muted-foreground hover:scale-105"),style:{backgroundColor:o},"aria-label":`Select ${o}`},o))})]})]})}),e.jsxs("div",{className:"flex gap-2 p-4 border-t border-border",children:[e.jsx(p,{variant:"outline",className:"flex-1",onClick:d,children:"Cancel"}),e.jsx(p,{variant:"default",className:"flex-1",onClick:y,icon:e.jsx(Re,{className:"w-4 h-4"}),children:"OK"})]})]})]})})}function ta({open:r,onOpenChange:x,title:c,message:b,confirmText:h="Confirm",cancelText:f="Cancel",variant:j="default",onConfirm:y,loading:d=!1}){const[o,g]=t.useState(!1),S=async()=>{g(!0);try{await y(),x(!1)}catch(U){H.error("Confirmation action failed:",U)}finally{g(!1)}};return e.jsx(St,{open:r,onOpenChange:x,children:e.jsxs(kt,{children:[e.jsx(Ct,{className:"fixed inset-0 bg-black/50 backdrop-blur-xs data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 z-50"}),e.jsxs(Pt,{className:n("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","w-full max-w-lg rounded-lg border border-border bg-card p-6 shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx(It,{className:"text-lg font-semibold text-foreground",children:c}),e.jsxs(Tt,{className:"rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(Ns,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]}),e.jsx(At,{className:"text-sm text-muted-foreground mb-6",children:b}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(p,{variant:"outline",onClick:()=>x(!1),disabled:o||d,children:f}),e.jsx(p,{variant:j==="destructive"?"destructive":"default",onClick:S,loading:o||d,disabled:o||d,children:h})]})]})]})})}function ys({value:r,onValueChange:x,options:c,className:b,size:h="md"}){const f={sm:"p-0.5 text-xs",md:"p-1 text-sm",lg:"p-1.5 text-base"},j={sm:"px-2.5 py-1",md:"px-4 py-2",lg:"px-5 py-2.5"},y={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"};return e.jsx("div",{role:"radiogroup",className:n("inline-flex items-center rounded-lg bg-muted/50 border border-border",f[h],b),children:c.map(d=>{const o=r===d.value,g=d.icon;return e.jsxs("button",{type:"button",role:"radio","aria-checked":o,onClick:()=>x(d.value),className:n("relative flex items-center justify-center gap-2 rounded-md font-medium transition-colors",j[h],o?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[o&&e.jsx(D.div,{layoutId:"segmented-indicator",className:"absolute inset-0 bg-background rounded-md shadow-sm border border-border/50",transition:{type:"spring",stiffness:400,damping:30}}),e.jsxs("span",{className:"relative flex items-center gap-2",children:[g&&e.jsx(g,{className:y[h]}),e.jsx("span",{children:d.label})]})]},d.value)})})}function De({icon:r,title:x,description:c,badge:b,children:h,className:f}){return e.jsxs("div",{className:n("flex items-center justify-between gap-4 py-3",f),children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r&&e.jsx("div",{className:"p-2 rounded-lg bg-muted shrink-0 mt-0.5",children:e.jsx(r,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:x}),b&&e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded bg-muted text-muted-foreground uppercase tracking-wide",children:b})]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:c})]})]}),e.jsx("div",{className:"shrink-0",children:h})]})}function aa(r){const x=t.useRef({value:r,previous:r});return t.useMemo(()=>(x.current.value!==r&&(x.current.previous=x.current.value,x.current.value=r),x.current.previous),[r])}var je="Switch",[ra]=Dt(je),[na,oa]=ra(je),Ts=t.forwardRef((r,x)=>{const{__scopeSwitch:c,name:b,checked:h,defaultChecked:f,required:j,disabled:y,value:d="on",onCheckedChange:o,form:g,...S}=r,[U,N]=t.useState(null),Y=ws(x,$=>N($)),O=t.useRef(!1),ne=U?g||!!U.closest("form"):!0,[R,ye]=Ut({prop:h,defaultProp:f??!1,onChange:o,caller:je});return e.jsxs(na,{scope:c,checked:R,disabled:y,children:[e.jsx(Ss.button,{type:"button",role:"switch","aria-checked":R,"aria-required":j,"data-state":Ds(R),"data-disabled":y?"":void 0,disabled:y,value:d,...S,ref:Y,onClick:Ft(r.onClick,$=>{ye(F=>!F),ne&&(O.current=$.isPropagationStopped(),O.current||$.stopPropagation())})}),ne&&e.jsx(Fs,{control:U,bubbles:!O.current,name:b,value:d,checked:R,required:j,disabled:y,form:g,style:{transform:"translateX(-100%)"}})]})});Ts.displayName=je;var As="SwitchThumb",Us=t.forwardRef((r,x)=>{const{__scopeSwitch:c,...b}=r,h=oa(As,c);return e.jsx(Ss.span,{"data-state":Ds(h.checked),"data-disabled":h.disabled?"":void 0,...b,ref:x})});Us.displayName=As;var ia="SwitchBubbleInput",Fs=t.forwardRef(({__scopeSwitch:r,control:x,checked:c,bubbles:b=!0,...h},f)=>{const j=t.useRef(null),y=ws(j,f),d=aa(c),o=qt(x);return t.useEffect(()=>{const g=j.current;if(!g)return;const S=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(S,"checked").set;if(d!==c&&N){const Y=new Event("click",{bubbles:b});N.call(g,c),g.dispatchEvent(Y)}},[d,c,b]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...h,tabIndex:-1,ref:y,style:{...h.style,...o,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Fs.displayName=ia;function Ds(r){return r?"checked":"unchecked"}var fe=Ts,be=Us;const vs=[{group:"Account",items:[{id:"profile",label:"Profile",icon:ks,description:"Personal information"}]},{group:"Customization",items:[{id:"appearance",label:"Appearance",icon:Ee,description:"Theme & colors"},{id:"typography",label:"Typography",icon:Lt,description:"Fonts & text styling"},{id:"display",label:"Display",icon:Cs,description:"Monitor settings"}]},{group:"System",items:[{id:"language",label:"Language",icon:Et,description:"Region & locale"},{id:"updates",label:"Updates",icon:Le,description:"App updates & versioning"},{id:"api-connections",label:"API Connections",icon:Ps,description:"External services"},{id:"local-dictionary",label:"Local Dictionary",icon:Is,description:"Offline hyperlink lookups"},{id:"backup-settings",label:"Backups",icon:ge,description:"Document backup options"},{id:"submit-idea",label:"Submit Idea for New Implementation",icon:Mt,description:"Share your ideas"}]}];function ya(){const[r,x]=t.useState("profile"),[c,b]=t.useState(""),[h,f]=t.useState(""),[j,y]=t.useState(!1),[d,o]=t.useState(!1),[g,S]=t.useState(!1),[U,N]=t.useState(""),[Y,O]=t.useState(""),[ne,R]=t.useState(!1),[ye,$]=t.useState(""),[F,ve]=t.useState(0),[Me,Be]=t.useState(!1),[G,oe]=t.useState("logged-out"),[ze,He]=t.useState(!1),[ie,_]=t.useState(null),{settings:u,updateProfile:Rs,updateNotifications:Ls,updateApiConnections:Es,updateUpdateSettings:Ms,updateLocalDictionary:$e,updateBackupSettings:Bs,updateDisplaySettings:zs,updateSettings:_e,saveSettings:Hs}=Jt(),{sessions:$s}=Qt(),{stats:_s,resetAllStats:Ws}=Kt(),[E,le]=t.useState(u.profile),[Vs,Ys]=t.useState(u.notifications),[k,q]=t.useState(u.apiConnections),[We,Ve]=t.useState(u.language),[Ye,Oe]=t.useState(u.timezone),[Ge,qe]=t.useState(u.dateFormat),[i,J]=t.useState(u.updateSettings),[v,ce]=t.useState(u.localDictionary),[W,Je]=t.useState(u.backupSettings),[Qe,Ke]=t.useState(u.displaySettings),[Xe,Os]=t.useState([]),[Ze,es]=t.useState(!1),[C,M]=t.useState(null),[Ne,we]=t.useState(!1),[la,ca]=t.useState(""),[da,ua]=t.useState(!1),[ma,xa]=t.useState(!1),[Gs,Se]=t.useState(!1),[qs,ss]=t.useState(!1),I=t.useRef(null),m=t.useRef(null),T=t.useRef(null);t.useEffect(()=>{(async()=>{try{if(!window.electronAPI?.getCurrentVersion){console.warn("Settings: electronAPI.getCurrentVersion not available");return}const a=await window.electronAPI.getCurrentVersion();O(a)}catch{}})()},[]),t.useEffect(()=>{if(typeof window.electronAPI>"u"){console.warn("Settings: electronAPI not available (running in browser mode?)");return}const s=window.electronAPI.onUpdateAvailable(A=>{R(!0),$(A.version),N(`Update available: ${A.version}`),S(!1)}),a=window.electronAPI.onUpdateDownloadProgress(A=>{ve(A.percent),N(`Downloading update: ${Math.round(A.percent)}%`)}),l=window.electronAPI.onUpdateDownloaded(A=>{Be(!0),ve(100),N(`Update ${A.version} downloaded. Ready to install.`)}),w=window.electronAPI.onUpdateNotAvailable(A=>{R(!1),N("You are up to date"),S(!1)}),vt=window.electronAPI.onUpdateError(A=>{N(`Update error: ${A.message}`),S(!1)});return()=>{s(),a(),l(),w(),vt()}},[]),t.useEffect(()=>{le(u.profile),Ys(u.notifications),q(u.apiConnections),Ve(u.language),Oe(u.timezone),qe(u.dateFormat),J(u.updateSettings),ce(u.localDictionary),Je(u.backupSettings),Ke(u.displaySettings)},[u]),t.useEffect(()=>{r==="display"&&(async()=>{if(!(typeof window.electronAPI>"u"||!window.electronAPI.display))try{const a=await window.electronAPI.display.getAllDisplays();Os(a)}catch{}})()},[r]),t.useEffect(()=>{const s=async()=>{if(!(typeof window.electronAPI>"u"))try{const a=await window.electronAPI.dictionary.getStatus();a.success&&a.status&&M(a.status)}catch{}};if(r==="local-dictionary"){s();const a=setInterval(s,5e3);return()=>clearInterval(a)}},[r]),t.useEffect(()=>{if(typeof window.electronAPI>"u")return;const s=window.electronAPI.dictionary.onSyncProgress(l=>{M(w=>w?{...w,syncProgress:l.progress,syncInProgress:!0}:null)}),a=window.electronAPI.dictionary.onSyncComplete(l=>{we(!1),l.success&&window.electronAPI.dictionary.getStatus().then(w=>{w.success&&w.status&&M(w.status)})});return()=>{s(),a()}},[]),t.useEffect(()=>()=>{I.current&&clearTimeout(I.current),m.current&&clearTimeout(m.current),T.current&&clearTimeout(T.current)},[]);const ts=s=>{if(q({...k,powerAutomateUrl:s}),gs(s)){const a=js(s);hs(!0),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{q({...k,powerAutomateUrl:a}),hs(!1),I.current=null},1500)}if(s.trim()){const a=ea(s);xs(a)}else xs(null)},Js=async()=>{ss(!0);try{await Ws(),Se(!1)}catch(s){H.error("Failed to reset stats:",s)}finally{ss(!1)}},de=async()=>{if(k.powerAutomateUrl){const a=js(k.powerAutomateUrl);k.powerAutomateUrl=a}Rs(E),Ls(Vs),Es(k),Ms(i),_e({language:We,timezone:Ye,dateFormat:Ge}),typeof window.electronAPI<"u"&&(i.useSharePointSource&&i.sharePointFolderUrl?await window.electronAPI.setUpdateProvider({type:"sharepoint",sharePointUrl:i.sharePointFolderUrl}):await window.electronAPI.setUpdateProvider({type:"github"})),await Hs()&&(o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1),m.current=null},2e3))},Qs=async()=>{S(!0),N("Checking for updates..."),R(!1),Be(!1),ve(0);try{await window.electronAPI?.checkForUpdates()}catch{N("Error checking for updates"),S(!1)}},Ks=async()=>{N("Starting download...");try{await window.electronAPI?.downloadUpdate()}catch{N("Download failed")}},Xs=()=>{window.electronAPI?.installUpdate()},Zs=async()=>{oe("logging-in");try{const s=await window.electronAPI?.sharePointLogin();oe(s?.success?"logged-in":"logged-out"),!s?.success&&s?.error&&_({success:!1,message:s.error})}catch{oe("logged-out"),_({success:!1,message:"Login failed"})}},et=async()=>{await window.electronAPI?.sharePointLogout(),oe("logged-out"),_(null)},st=async()=>{if(i.sharePointFolderUrl){He(!0),_(null);try{const s=await window.electronAPI?.testSharePointConnection(i.sharePointFolderUrl);_(s||{success:!1,message:"Test failed"})}catch{_({success:!1,message:"Connection test failed"})}finally{He(!1)}}},as=s=>{if(!s)return!1;try{const a=new URL(s);return a.protocol==="https:"&&a.hostname.endsWith(".sharepoint.com")}catch{return!1}},tt=async()=>{$e(v),o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1),m.current=null},2e3)},at=async()=>{if(!(typeof window.electronAPI>"u")&&v.sharePointFileUrl.trim()){we(!0),M(s=>s?{...s,syncError:null,syncInProgress:!0}:null);try{await window.electronAPI.dictionary.initialize();const s=await window.electronAPI.dictionary.retrieveFromSharePoint(v.sharePointFileUrl);if(s.success){const a=new Date().toISOString();ce(l=>({...l,lastRetrievalTime:a,lastRetrievalSuccess:!0,totalEntries:s.entriesImported||0})),$e({...v,lastRetrievalTime:a,lastRetrievalSuccess:!0,totalEntries:s.entriesImported||0}),M(l=>l?{...l,lastSyncTime:a,lastSyncSuccess:!0,totalEntries:s.entriesImported||0,syncInProgress:!1,syncError:null}:null)}else M(a=>a?{...a,syncError:s.error||"Retrieval failed",syncInProgress:!1,lastSyncSuccess:!1}:null)}catch(s){const a=s instanceof Error?s.message:"Retrieval failed";M(l=>l?{...l,syncError:a,syncInProgress:!1}:null)}finally{we(!1)}}},rt=()=>{Bs(W),o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1),m.current=null},2e3)},nt=async()=>{try{if(!window.electronAPI?.exportSettings){console.warn("Settings: electronAPI.exportSettings not available");return}const s=await window.electronAPI.exportSettings();if(!s.success||s.canceled)return;const a={version:"1.0",exportDate:new Date().toISOString(),data:{userSettings:u,themeSettings:{theme:rs,density:us,accentColor:V,blur:ue},sessions:$s,globalStats:_s}},l=await window.electronAPI.saveExportData(s.filePath,a);l.success?(o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1),m.current=null},2e3)):H.error("Failed to save export data:",l.error)}catch(s){H.error("Export failed:",s)}},ot=async()=>{try{if(!window.electronAPI?.importSettings){console.warn("Settings: electronAPI.importSettings not available");return}const s=await window.electronAPI.importSettings();if(!s.success||s.canceled)return;if(!s.data?.version||!s.data?.data){H.error("Invalid import file format");return}const a=s.data.data;a.userSettings&&_e(a.userSettings),o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1),m.current=null,window.location.reload()},2e3)}catch(s){H.error("Import failed:",s)}},{theme:rs,setTheme:it,accentColor:V,setAccentColor:ke,customAccentColor:ns,setCustomAccentColor:lt,customPrimaryColor:ct,setCustomPrimaryColor:os,customBackgroundColor:dt,setCustomBackgroundColor:is,customHeaderColor:ut,setCustomHeaderColor:ls,customSidebarColor:mt,setCustomSidebarColor:cs,customBorderColor:xt,setCustomBorderColor:ds,useCustomColors:B,setUseCustomColors:Ce,density:us,setDensity:ht,animations:Pe,setAnimations:pt,blur:ue,setBlur:ft,reduceMotion:Ie,setReduceMotion:bt,fontSize:Q,setFontSize:K,fontFamily:me,setFontFamily:X,fontWeight:Te,setFontWeight:Z,fontStyle:xe,setFontStyle:Ae,letterSpacing:ee,setLetterSpacing:se,lineHeight:te,setLineHeight:ae}=Xt(),[L,he]=t.useState(null),[gt,ms]=t.useState("#000000"),[P,xs]=t.useState(null),[jt,hs]=t.useState(!1),yt={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},ps={hidden:{opacity:0,x:-20},visible:{opacity:1,x:0,transition:{duration:.3}}};return e.jsxs(D.div,{className:"p-6 max-w-7xl mx-auto",variants:yt,initial:"hidden",animate:"visible",children:[e.jsxs("div",{className:"flex gap-8",children:[e.jsx(D.aside,{className:"w-64 shrink-0",variants:ps,children:e.jsxs("div",{className:"sticky top-6",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx(Rt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search settings...",className:"w-full pl-10 pr-3 py-2 text-sm rounded-lg border border-border bg-background text-muted-foreground placeholder:text-muted-foreground/50 hover:border-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20 transition-colors"})]}),e.jsx("nav",{className:"space-y-6",children:vs.map((s,a)=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:s.group}),e.jsx("div",{className:"space-y-0.5",children:s.items.map(l=>{const w=l.icon;return e.jsxs("button",{onClick:()=>x(l.id),className:n("w-full flex items-start gap-3 px-3 py-2.5 rounded-lg transition-all group",r===l.id?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"),children:[e.jsx(w,{className:n("w-4 h-4 mt-0.5 transition-colors",r===l.id?"text-primary":"text-muted-foreground group-hover:text-foreground")}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"text-sm font-medium",children:l.label}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:l.description})]})]},l.id)})}),a<vs.length-1&&e.jsx("div",{className:"mt-4 border-b border-border"})]},s.group))})]})}),e.jsxs(D.main,{className:"flex-1 max-w-4xl",variants:ps,children:[r==="profile"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Profile"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your personal information and account details"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Fe,{label:"First Name",value:E.firstName,onChange:s=>le({...E,firstName:s.target.value})}),e.jsx(Fe,{label:"Last Name",value:E.lastName,onChange:s=>le({...E,lastName:s.target.value})})]}),e.jsx(Fe,{label:"Email",type:"email",value:E.email,onChange:s=>le({...E,email:s.target.value})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p,{variant:"outline",icon:e.jsx(Le,{className:"w-4 h-4"}),onClick:nt,children:"Export Settings"}),e.jsx(p,{variant:"outline",icon:e.jsx(Le,{className:"w-4 h-4",style:{transform:"rotate(180deg)"}}),onClick:ot,children:"Import Settings"}),e.jsx(p,{onClick:de,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Changes"})]})]}),e.jsx("div",{className:"pt-6 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-destructive",children:"Reset Analytics Statistics"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Permanently delete all historical analytics data. This action cannot be undone."})]}),e.jsx(p,{variant:"destructive",onClick:()=>Se(!0),icon:e.jsx(Bt,{className:"w-4 h-4"}),children:"Reset Stats"})]})})]}),r==="appearance"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Appearance"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Customize the visual appearance of the application"})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-primary/10",children:e.jsx(Ee,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Theme & Display"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose your preferred theme and interface density"})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("label",{className:"text-sm font-medium",children:"Theme Mode"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Select light, dark, or follow system preference"})]}),e.jsx(ys,{value:rs,onValueChange:it,options:[{value:"light",label:"Light",icon:zt},{value:"dark",label:"Dark",icon:Ht},{value:"system",label:"System",icon:$t}],size:"sm"})]}),e.jsx("div",{className:"border-t border-border"}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("label",{className:"text-sm font-medium",children:"Interface Density"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Adjust spacing and element sizes"})]}),e.jsx(ys,{value:us,onValueChange:ht,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"},{value:"minimal",label:"Minimal"}],size:"sm"})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-primary/10",children:e.jsx(fs,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Colors"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize your accent color and theme"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-3 block",children:"Accent Color"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[[{name:"blue",label:"Blue",color:"#3b82f6"},{name:"purple",label:"Purple",color:"#8b5cf6"},{name:"green",label:"Green",color:"#22c55e"},{name:"orange",label:"Orange",color:"#f97316"},{name:"pink",label:"Pink",color:"#ec4899"},{name:"cyan",label:"Cyan",color:"#06b6d4"},{name:"indigo",label:"Indigo",color:"#6366f1"}].map(s=>e.jsxs(D.button,{onClick:()=>ke(s.name),whileHover:{scale:1.05},whileTap:{scale:.95},className:n("group relative flex items-center gap-2 px-3 py-2 rounded-full border-2 transition-all",V===s.name?"border-primary bg-primary/10 shadow-sm":"border-border hover:border-muted-foreground bg-background"),"aria-label":`Select ${s.label} accent`,children:[e.jsx("div",{className:"w-4 h-4 rounded-full shadow-inner",style:{backgroundColor:s.color}}),e.jsx("span",{className:"text-xs font-medium",children:s.label}),V===s.name&&e.jsx(Re,{className:"w-3 h-3 text-primary"})]},s.name)),e.jsxs(D.button,{onClick:()=>{ke("custom"),ms(ns),he("accent")},whileHover:{scale:1.05},whileTap:{scale:.95},className:n("group relative flex items-center gap-2 px-3 py-2 rounded-full border-2 transition-all",V==="custom"?"border-primary bg-primary/10 shadow-sm":"border-border hover:border-muted-foreground bg-background"),"aria-label":"Select custom accent color",children:[e.jsx("div",{className:"w-4 h-4 rounded-full",style:{background:V==="custom"?ns:"conic-gradient(from 180deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #8b5cf6, #ec4899, #ef4444)"}}),e.jsx("span",{className:"text-xs font-medium",children:"Custom"}),V==="custom"&&e.jsx(Re,{className:"w-3 h-3 text-primary"})]})]})]}),e.jsxs("div",{className:"border-t border-border pt-5",children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>Ce(!B),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),Ce(!B))},className:"flex items-center justify-between w-full group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Advanced: Custom Theme Colors"}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded bg-muted text-muted-foreground uppercase tracking-wide",children:"Advanced"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fe,{checked:B,onCheckedChange:Ce,className:n("relative w-10 h-5 rounded-full transition-colors",B?"bg-primary":"bg-input border border-border"),onClick:s=>s.stopPropagation(),children:e.jsx(be,{className:n("block w-4 h-4 bg-background rounded-full shadow-sm transition-transform",B?"translate-x-5":"translate-x-0.5")})}),e.jsx(_t,{className:n("w-4 h-4 text-muted-foreground transition-transform",B&&"rotate-180")})]})]}),B&&e.jsx(D.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"mt-4",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",children:[{key:"primary",label:"Primary",color:ct,setter:os,showTextHint:!0},{key:"background",label:"Background",color:dt,setter:is,showTextHint:!0},{key:"header",label:"Header",color:ut,setter:ls,showTextHint:!0},{key:"sidebar",label:"Sidebar",color:mt,setter:cs,showTextHint:!0},{key:"border",label:"Borders",color:xt,setter:ds}].map(s=>e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:s.label}),e.jsx("button",{"aria-label":`Select ${s.label.toLowerCase()} color`,onClick:()=>{ms(s.color),he(s.key)},className:"w-full h-10 rounded-lg border border-border flex items-center justify-center gap-2 hover:bg-muted/50 transition-colors group",children:e.jsx("div",{className:"w-6 h-6 rounded-md shadow-inner group-hover:scale-110 transition-transform",style:{backgroundColor:s.color}})}),s.showTextHint&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1 text-center",children:["Text: ",Zt(s.color)==="#FFFFFF"?"White":"Black"]})]},s.key))})})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-primary/10",children:e.jsx(bs,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Visual Effects"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control animations and visual enhancements"})]})]}),e.jsxs("div",{className:"space-y-1 divide-y divide-border",children:[e.jsx(De,{icon:fs,title:"Glass morphism effects",description:"Blur and transparency for a modern look",children:e.jsx(fe,{checked:ue,onCheckedChange:ft,className:n("relative w-10 h-5 rounded-full transition-colors",ue?"bg-primary":"bg-input border border-border"),children:e.jsx(be,{className:n("block w-4 h-4 bg-background rounded-full shadow-sm transition-transform",ue?"translate-x-5":"translate-x-0.5")})})}),e.jsx(De,{icon:bs,title:"Smooth animations",description:"Transitions and micro-interactions",children:e.jsx(fe,{checked:Pe,onCheckedChange:pt,className:n("relative w-10 h-5 rounded-full transition-colors",Pe?"bg-primary":"bg-input border border-border"),children:e.jsx(be,{className:n("block w-4 h-4 bg-background rounded-full shadow-sm transition-transform",Pe?"translate-x-5":"translate-x-0.5")})})}),e.jsx(De,{icon:Wt,title:"Reduce motion",description:"Minimize animations for accessibility",children:e.jsx(fe,{checked:Ie,onCheckedChange:bt,className:n("relative w-10 h-5 rounded-full transition-colors",Ie?"bg-primary":"bg-input border border-border"),children:e.jsx(be,{className:n("block w-4 h-4 bg-background rounded-full shadow-sm transition-transform",Ie?"translate-x-5":"translate-x-0.5")})})})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-2",children:"Disabling visual effects can improve performance on slower systems."})]})]}),r==="typography"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Typography"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Customize fonts and text styling throughout the application"})]}),e.jsx("div",{className:"p-6 rounded-lg border border-border bg-muted/30",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-lg font-semibold",style:{fontSize:`${Q*1.2}px`,fontFamily:me,fontWeight:Te,fontStyle:xe,letterSpacing:`${ee}em`,lineHeight:te},children:"Preview: Main Heading"}),e.jsx("p",{style:{fontSize:`${Q}px`,fontFamily:me,fontWeight:Te,fontStyle:xe,letterSpacing:`${ee}em`,lineHeight:te},children:"This is a preview of your typography settings. The quick brown fox jumps over the lazy dog. Adjust the settings below to see how your text will appear throughout the application."}),e.jsx("p",{className:"text-muted-foreground",style:{fontSize:`${Q*.875}px`,fontFamily:me,letterSpacing:`${ee}em`,lineHeight:te},children:"Secondary text appears like this, used for descriptions and supporting content."})]})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider mb-3",children:"Quick Presets"}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsx("button",{onClick:()=>{K(16),X("'Inter', sans-serif"),Z("400"),se(.02),ae(1.7)},"aria-label":"Apply reading typography preset",className:"px-3 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Reading"}),e.jsx("button",{onClick:()=>{K(14),X("system-ui"),Z("400"),se(0),ae(1.4)},"aria-label":"Apply compact typography preset",className:"px-3 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Compact"}),e.jsx("button",{onClick:()=>{K(18),X("'Poppins', sans-serif"),Z("500"),se(.01),ae(1.6)},"aria-label":"Apply presentation typography preset",className:"px-3 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Presentation"}),e.jsx("button",{onClick:()=>{K(15),X("system-ui"),Z("400"),Ae("normal"),se(0),ae(1.5)},"aria-label":"Apply default typography preset",className:"px-3 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Default"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium",children:"Font"}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"font-family-select",className:"text-sm text-muted-foreground mb-2 block",children:"Family"}),e.jsxs("select",{id:"font-family-select",value:me,onChange:s=>X(s.target.value),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20",children:[e.jsx("option",{value:"system-ui",children:"System Default"}),e.jsx("option",{value:"'Inter', sans-serif",children:"Inter"}),e.jsx("option",{value:"'Roboto', sans-serif",children:"Roboto"}),e.jsx("option",{value:"'Open Sans', sans-serif",children:"Open Sans"}),e.jsx("option",{value:"'Lato', sans-serif",children:"Lato"}),e.jsx("option",{value:"'Poppins', sans-serif",children:"Poppins"}),e.jsx("option",{value:"'SF Pro Display', sans-serif",children:"SF Pro"}),e.jsx("option",{value:"'Segoe UI', sans-serif",children:"Segoe UI"}),e.jsx("option",{value:"'JetBrains Mono', monospace",children:"JetBrains Mono"}),e.jsx("option",{value:"'Fira Code', monospace",children:"Fira Code"}),e.jsx("option",{value:"'Webdings', fantasy",children:"Webdings 🎉"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-2 block",children:"Size"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"12",max:"20",value:Q,onChange:s=>K(Number(s.target.value)),"aria-label":"Font size",className:"flex-1"}),e.jsxs("span",{className:"text-sm font-mono w-12 text-center bg-muted rounded px-2 py-1",children:[Q,"px"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-foreground mb-2 block",children:"Weight"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"Semibold"},{value:"700",label:"Bold"}].map(s=>e.jsx("button",{onClick:()=>Z(s.value),"aria-label":`Set font weight to ${s.label}`,className:n("px-2 py-1.5 text-sm rounded transition-colors",Te===s.value?"bg-primary text-primary-foreground":"hover:bg-muted"),children:s.label},s.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-foreground mb-2 block",children:"Style"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("button",{onClick:()=>Ae("normal"),"aria-label":"Set font style to normal",className:n("px-3 py-2 rounded-lg border transition-all text-sm",xe==="normal"?"border-primary bg-primary/10":"border-border hover:bg-muted"),children:"Normal"}),e.jsx("button",{onClick:()=>Ae("italic"),"aria-label":"Set font style to italic",className:n("px-3 py-2 rounded-lg border transition-all text-sm italic",xe==="italic"?"border-primary bg-primary/10":"border-border hover:bg-muted"),children:"Italic"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium",children:"Spacing"}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-foreground mb-2 block",children:"Letter Spacing"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Tight"}),e.jsx("input",{type:"range",min:"-0.05",max:"0.1",step:"0.01",value:ee,onChange:s=>se(Number(s.target.value)),"aria-label":"Letter spacing",className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Wide"}),e.jsxs("span",{className:"text-sm font-mono w-16 text-center bg-muted rounded px-2 py-1",children:[ee.toFixed(2),"em"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-foreground mb-2 block",children:"Line Height"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Compact"}),e.jsx("input",{type:"range",min:"1",max:"2",step:"0.1",value:te,onChange:s=>ae(Number(s.target.value)),"aria-label":"Line height",className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Spacious"}),e.jsx("span",{className:"text-sm font-mono w-12 text-center bg-muted rounded px-2 py-1",children:te.toFixed(1)})]})]})]})]})]}),r==="display"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Display"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Configure monitor settings for document comparison"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-4",children:"Monitor for Comparing Files"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Select which monitor to use when comparing documents side by side"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"comparison-monitor",className:"block text-sm font-medium mb-2",children:"Select Monitor"}),e.jsx("select",{id:"comparison-monitor",value:Qe?.comparisonMonitorId??0,onChange:s=>Ke(a=>({...a,comparisonMonitorId:parseInt(s.target.value,10)})),className:"w-full px-3 py-2 rounded-md border border-input bg-background",children:Xe.length>0?Xe.map(s=>e.jsxs("option",{value:s.id,children:[s.label," (",s.workArea.width," x ",s.workArea.height,")"]},s.id)):e.jsx("option",{value:0,children:"Primary (loading...)"})})]}),e.jsx("div",{className:"pt-6",children:e.jsx(p,{variant:"outline",onClick:async()=>{if(!(typeof window.electronAPI>"u"||!window.electronAPI.display)){es(!0);try{await window.electronAPI.display.identifyMonitors()}finally{setTimeout(()=>es(!1),3e3)}}},disabled:Ze,children:Ze?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"Identifying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Cs,{className:"w-4 h-4 mr-2"}),"Identify Monitors"]})})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:'Click "Identify Monitors" to display a number on each connected monitor for 3 seconds'})]}),e.jsx("div",{className:"pt-4 border-t",children:e.jsxs(p,{onClick:()=>{zs(Qe),o(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(!1)},2e3)},showSuccess:d,children:[e.jsx(z,{className:"w-4 h-4 mr-2"}),"Save Display Settings"]})})]})]}),r==="language"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Language & Region"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Set your language, timezone, and regional preferences"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"language-select",className:"block text-sm font-medium mb-2",children:"Language"}),e.jsxs("select",{id:"language-select",value:We,onChange:s=>Ve(s.target.value),className:"w-full px-3 py-2 rounded-md border border-input bg-background",children:[e.jsx("option",{children:"English (US)"}),e.jsx("option",{children:"Español (Spanish)"}),e.jsx("option",{children:"中文 (Mandarin Chinese)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"timezone-select",className:"block text-sm font-medium mb-2",children:"Timezone"}),e.jsxs("select",{id:"timezone-select",value:Ye,onChange:s=>Oe(s.target.value),className:"w-full px-3 py-2 rounded-md border border-input bg-background",children:[e.jsxs("optgroup",{label:"United States",children:[e.jsx("option",{children:"UTC-10:00 Hawaii-Aleutian"}),e.jsx("option",{children:"UTC-09:00 Alaska"}),e.jsx("option",{children:"UTC-08:00 Pacific Time (PT)"}),e.jsx("option",{children:"UTC-07:00 Mountain Time (MT)"}),e.jsx("option",{children:"UTC-06:00 Central Time (CT)"}),e.jsx("option",{children:"UTC-05:00 Eastern Time (ET)"})]}),e.jsxs("optgroup",{label:"Common International",children:[e.jsx("option",{children:"UTC+00:00 Coordinated Universal Time"}),e.jsx("option",{children:"UTC+00:00 London (GMT)"}),e.jsx("option",{children:"UTC+01:00 Paris/Berlin (CET)"}),e.jsx("option",{children:"UTC+02:00 Cairo/Athens"}),e.jsx("option",{children:"UTC+03:00 Moscow/Istanbul"}),e.jsx("option",{children:"UTC+05:30 Mumbai/Delhi"}),e.jsx("option",{children:"UTC+08:00 Beijing/Singapore"}),e.jsx("option",{children:"UTC+09:00 Tokyo/Seoul"}),e.jsx("option",{children:"UTC+10:00 Sydney"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"date-format-select",className:"block text-sm font-medium mb-2",children:"Date Format"}),e.jsxs("select",{id:"date-format-select",value:Ge,onChange:s=>qe(s.target.value),className:"w-full px-3 py-2 rounded-md border border-input bg-background",children:[e.jsx("option",{children:"MM/DD/YYYY"}),e.jsx("option",{children:"DD/MM/YYYY"}),e.jsx("option",{children:"YYYY-MM-DD"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:de,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Settings"})})]})]}),r==="updates"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Updates"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage application updates and versioning"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-muted/20 rounded-lg space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Current Version"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Y||"Loading..."})]}),e.jsx(p,{onClick:Qs,disabled:g,icon:e.jsx(Ue,{className:n("w-4 h-4",g&&"animate-spin")}),children:g?"Checking...":"Check for Updates"})]}),U&&e.jsx("p",{className:"text-sm text-muted-foreground",children:U}),ne&&!Me&&e.jsx(p,{onClick:Ks,variant:"default",className:"w-full",disabled:F>0&&F<100,children:F>0?`Downloading ${Math.round(F)}%`:`Download Update ${ye}`}),F>0&&F<100&&e.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${F}%`}})}),Me&&e.jsx(p,{onClick:Xs,variant:"default",className:"w-full bg-green-600 hover:bg-green-700",children:"Install & Restart"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"auto-update",className:"text-sm font-medium",children:"Auto-update on launch"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically check for updates when the application starts"})]}),e.jsx("button",{id:"auto-update",role:"switch","aria-checked":i.autoUpdateOnLaunch,onClick:()=>J({...i,autoUpdateOnLaunch:!i.autoUpdateOnLaunch}),className:n("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",i.autoUpdateOnLaunch?"bg-primary border-primary toggle-checked":"bg-input border-border"),children:e.jsx("span",{className:n("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",i.autoUpdateOnLaunch?"translate-x-6":"translate-x-1")})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"pre-releases",className:"text-sm font-medium",children:"Check for pre-releases"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Include beta and pre-release versions in update checks"})]}),e.jsx("button",{id:"pre-releases",role:"switch","aria-checked":i.checkForPreReleases,onClick:()=>J({...i,checkForPreReleases:!i.checkForPreReleases}),className:n("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",i.checkForPreReleases?"bg-primary border-primary toggle-checked":"bg-input border-border"),children:e.jsx("span",{className:n("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",i.checkForPreReleases?"translate-x-6":"translate-x-1")})})]})]}),e.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{htmlFor:"use-sharepoint",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Vt,{className:"w-4 h-4"}),"Use SharePoint for Updates"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Download updates from a SharePoint folder instead of GitHub"})]}),e.jsx("button",{id:"use-sharepoint",role:"switch","aria-checked":i.useSharePointSource,onClick:()=>J({...i,useSharePointSource:!i.useSharePointSource}),className:n("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",i.useSharePointSource?"bg-primary border-primary toggle-checked":"bg-input border-border"),children:e.jsx("span",{className:n("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",i.useSharePointSource?"translate-x-6":"translate-x-1")})})]}),i.useSharePointSource&&e.jsxs("div",{className:"space-y-4 pt-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sp-url",className:"block text-sm font-medium mb-2",children:"SharePoint Folder URL"}),e.jsx("input",{id:"sp-url",type:"url",value:i.sharePointFolderUrl||"",onChange:s=>J({...i,sharePointFolderUrl:s.target.value}),placeholder:"https://company.sharepoint.com/sites/IT/Shared Documents/Updates",className:n("w-full px-3 py-2 rounded-md border bg-background focus:outline-none focus:ring-1",i.sharePointFolderUrl&&!as(i.sharePointFolderUrl)?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"border-input focus:border-primary focus:ring-primary/20")}),i.sharePointFolderUrl&&!as(i.sharePointFolderUrl)&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:"Invalid URL. Must be https://*.sharepoint.com/sites/..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Folder must contain: latest.yml and the MSI installer file"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[G!=="logged-in"?e.jsx(p,{variant:"outline",onClick:Zs,disabled:G==="logging-in",icon:e.jsx(ks,{className:"w-4 h-4"}),children:G==="logging-in"?"Signing In...":"Sign In to Microsoft"}):e.jsx(p,{variant:"outline",onClick:et,icon:e.jsx(Yt,{className:"w-4 h-4"}),children:"Sign Out"}),G==="logged-in"&&e.jsxs("span",{className:"text-xs text-green-500 flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3"})," Authenticated"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(p,{variant:"outline",onClick:st,disabled:ze||!i.sharePointFolderUrl||G!=="logged-in",icon:e.jsx(Ot,{className:"w-4 h-4"}),children:ze?"Testing...":"Test Connection"}),ie&&e.jsxs("span",{className:n("text-xs flex items-center gap-1",ie.success?"text-green-500":"text-red-500"),children:[ie.success?e.jsx(pe,{className:"w-3 h-3"}):e.jsx(re,{className:"w-3 h-3"}),ie.message]})]}),e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/20 p-2 rounded",children:"GitHub remains the default update source. SharePoint is only used when enabled with a valid URL and you're signed in. If SharePoint fails, the app will automatically fall back to GitHub."})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:de,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Settings"})})]})]}),r==="api-connections"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"API Connections"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Configure external service integrations and API endpoints"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-3",children:"Hyperlink Processing"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{htmlFor:"powerautomate-url",className:"block text-sm font-medium mb-2",children:"PowerAutomate Dictionary URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"powerautomate-url",type:"url",value:k.powerAutomateUrl,onChange:s=>ts(s.target.value),onPaste:s=>{I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{const a=s.currentTarget.value;gs(a)&&ts(a),I.current=null},10)},placeholder:"https://prod-11.westus.logic.azure.com/workflows/...",className:n("w-full px-3 py-2 pr-10 rounded-md border bg-background focus:outline-none focus:ring-1",P?.valid===!1?"border-red-500 focus:border-red-500 focus:ring-red-500/20":P?.warnings.length?"border-yellow-500 focus:border-yellow-500 focus:ring-yellow-500/20":"border-input focus:border-primary focus:ring-primary/20")}),P&&e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:P.valid?e.jsx(pe,{className:"w-5 h-5 text-green-500"}):e.jsx(re,{className:"w-5 h-5 text-red-500"})})]}),P&&!P.valid&&P.issues.length>0&&e.jsx("div",{className:"mt-2 p-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 shrink-0"}),e.jsx("div",{className:"flex-1 space-y-1",children:P.issues.map((s,a)=>e.jsx("p",{className:"text-xs text-red-700 dark:text-red-300",children:s},a))})]})}),P&&P.warnings.length>0&&e.jsx("div",{className:"mt-2 p-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 mt-0.5 shrink-0"}),e.jsx("div",{className:"flex-1 space-y-1",children:P.warnings.map((s,a)=>e.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:s},a))})]})}),jt&&e.jsx("div",{className:"mt-2 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pe,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"URL automatically sanitized! Encoded characters have been fixed."})]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"This URL is used by the Hyperlink Service to retrieve document metadata and validate links. The service will send collected document IDs to this endpoint and receive enriched data in response."})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-3",children:"Feedback & Reporting"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bug-report-url",className:"block text-sm font-medium mb-2",children:"Bug Report API URL"}),e.jsx("input",{id:"bug-report-url",type:"url",value:k.bugReportUrl,onChange:s=>q({...k,bugReportUrl:s.target.value}),placeholder:"https://www.example.com",className:"w-full px-3 py-2 rounded-md border border-input bg-background focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Bug reports will be sent to this API endpoint. Leave as default to use email instead."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"submit-idea-url",className:"block text-sm font-medium mb-2",children:"Submit Idea API URL"}),e.jsx("input",{id:"submit-idea-url",type:"url",value:k.submitIdeaUrl,onChange:s=>q({...k,submitIdeaUrl:s.target.value}),placeholder:"https://www.example.com",className:"w-full px-3 py-2 rounded-md border border-input bg-background focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Feature suggestions will be sent to this API endpoint. Leave as default to use email instead."})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Ps,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium mb-1",children:"About API Connections"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API connections allow Documentation Hub to integrate with external services for enhanced functionality. These endpoints are used during document processing to enrich data, validate content, and automate workflows."})]})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:de,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Settings"})})]})]}),r==="submit-idea"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Submit Idea for New Implementation"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Have an idea to improve the application? We'd love to hear from you!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Title for Idea"}),e.jsx("input",{type:"text",value:c,onChange:s=>b(s.target.value),placeholder:"Enter a brief title for your idea",className:"w-full px-3 py-2 rounded-md border border-input bg-background"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Why is this needed / Who would this benefit?"}),e.jsx("textarea",{value:h,onChange:s=>f(s.target.value),placeholder:"Describe the benefits and potential users of this feature...",rows:6,className:"w-full px-3 py-2 rounded-md border border-input bg-background resize-none"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:async()=>{if(!c||!h)return;const s={Type:"Feedback",Email:u.profile.email,Title:c,Description:h},a=u.apiConnections.submitIdeaUrl;if(a==="https://www.example.com"||!a){const l=encodeURIComponent(`Feature Idea: ${c}`),w=encodeURIComponent(`
2
+ Feature Idea
3
+ ------------
4
+ Email: ${u.profile.email}
5
+ Title: ${c}
6
+
7
+ Description:
8
+ ${h}
9
+
10
+ Submitted: ${new Date().toLocaleString()}
11
+ `);window.location.href=`mailto:support@example.com?subject=${l}&body=${w}`,b(""),f(""),y(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{y(!1),T.current=null},2e3),alert("Your idea has been sent to the Documentation Hub Admin");return}try{(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).ok?(b(""),f(""),y(!0),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{y(!1),T.current=null},2e3),alert("Your idea has been sent to the Documentation Hub Admin")):alert("Failed to submit idea. Please try again.")}catch(l){H.error("Error submitting idea:",l),alert("Failed to submit idea. Please check your API configuration.")}},icon:e.jsx(Gt,{className:"w-4 h-4"}),showSuccess:j,disabled:!c||!h,children:"Submit Idea"})}),e.jsx("div",{className:"mt-6 p-4 bg-muted/30 rounded-lg border border-border",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("strong",{children:"Note:"})," Your ideas help shape the future of Documentation Hub. We review all submissions and prioritize features based on user feedback and technical feasibility."]})})]})]}),r==="local-dictionary"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Local Dictionary"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Configure offline hyperlink lookups using a local SharePoint dictionary"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"p-4 bg-muted/20 rounded-lg border border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"dictionary-enabled",className:"text-sm font-medium",children:"Enable Local Dictionary"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"When enabled, hyperlink lookups will use the local database first, falling back to the API if not found"})]}),e.jsx("button",{id:"dictionary-enabled",role:"switch","aria-checked":v.enabled,onClick:()=>ce({...v,enabled:!v.enabled}),className:n("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",v.enabled?"bg-primary border-primary toggle-checked":"bg-input border-border"),children:e.jsx("span",{className:n("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",v.enabled?"translate-x-6":"translate-x-1")})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium",children:"SharePoint Dictionary File"}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sharepoint-file-url",className:"block text-sm font-medium mb-2",children:"SharePoint File URL"}),e.jsx("input",{id:"sharepoint-file-url",type:"url",value:v.sharePointFileUrl,onChange:s=>ce({...v,sharePointFileUrl:s.target.value}),placeholder:"https://company.sharepoint.com/sites/IT/Shared Documents/Dictionary.xlsx",className:"w-full px-3 py-2 rounded-md border border-input bg-background focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Direct URL to the .xlsx dictionary file on SharePoint (Daily_Inventory sheet, Dictionary_Table table)"})]})]}),e.jsxs("div",{className:"p-4 bg-muted/20 rounded-lg border border-border space-y-3",children:[e.jsx("h3",{className:"font-medium",children:"Dictionary Status"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Total Entries:"}),e.jsx("span",{className:"ml-2 font-medium",children:v.totalEntries?.toLocaleString()||C?.totalEntries?.toLocaleString()||"0"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Last Retrieved:"}),e.jsx("span",{className:"ml-2 font-medium",children:v.lastRetrievalTime?new Date(v.lastRetrievalTime).toLocaleString():C?.lastSyncTime?new Date(C.lastSyncTime).toLocaleString():"Never"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Status:"}),e.jsx("span",{className:n("ml-2 font-medium",v.lastRetrievalSuccess||C?.lastSyncSuccess?"text-green-600":"text-muted-foreground"),children:C?.syncInProgress?"Retrieving...":v.lastRetrievalSuccess||C?.lastSyncSuccess?"Ready":"Not retrieved"})]})]}),C?.syncInProgress&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Retrieving dictionary..."}),e.jsxs("span",{children:[Math.round(C.syncProgress||0),"%"]})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${C.syncProgress||0}%`}})})]}),C?.syncError&&e.jsx("div",{className:"p-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-xs text-red-700 dark:text-red-300",children:C.syncError})]})}),e.jsx(p,{variant:"outline",onClick:at,disabled:Ne||!v.sharePointFileUrl?.trim(),icon:e.jsx(Ue,{className:n("w-4 h-4",Ne&&"animate-spin")}),className:"w-full",children:Ne?"Retrieving...":"Retrieve Dictionary"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Opens browser for Microsoft sign-in, then downloads and imports the dictionary"})]}),e.jsx("div",{className:"pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Is,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium mb-1",children:"About Local Dictionary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The local dictionary downloads your SharePoint dictionary file and stores it in a high-performance SQLite database for instant lookups. When enabled, hyperlink lookups check the local database first. If an ID is not found locally, the system automatically falls back to the API for that lookup."})]})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:tt,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Settings"})})]})]}),r==="backup-settings"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Backups"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Configure automatic document backup settings"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"p-4 bg-muted/20 rounded-lg border border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:"backup-enabled",className:"text-sm font-medium",children:"Enable Automatic Backups"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Create backup copies of documents before processing changes"})]}),e.jsx("button",{id:"backup-enabled",role:"switch","aria-checked":W.enabled,onClick:()=>Je({...W,enabled:!W.enabled}),className:n("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",W.enabled?"bg-primary border-primary toggle-checked":"bg-input border-border"),children:e.jsx("span",{className:n("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",W.enabled?"translate-x-6":"translate-x-1")})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium",children:"Backup Details"}),e.jsxs("div",{className:"p-4 bg-muted/10 rounded-lg border border-border space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ge,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Backup Location"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Backups are stored in a ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"DocHub_Backups"})," folder in the same directory as the original document."]})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ge,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Naming Convention"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Backup files are named using incremental numbering:"}),e.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded block mt-1",children:"filename_Backup_1.docx, filename_Backup_2.docx, ..."})]})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ge,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium mb-1",children:"About Backups"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatic backups protect your documents by creating a copy before any processing changes are applied. Each backup is numbered incrementally, allowing you to restore from any previous version if needed. Disable this feature only if you have your own backup solution in place."})]})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{onClick:rt,showSuccess:d,icon:e.jsx(z,{className:"w-4 h-4"}),children:"Save Settings"})})]})]})]})]}),e.jsx(sa,{isOpen:L!==null,onClose:()=>he(null),color:gt,onColorChange:s=>{switch(L){case"accent":lt(s),ke("custom");break;case"primary":os(s);break;case"background":is(s);break;case"header":ls(s);break;case"sidebar":cs(s);break;case"border":ds(s);break}he(null)},title:L==="accent"?"Custom Accent Color":L==="primary"?"Custom Primary Color":L==="background"?"Custom Background Color":L==="header"?"Custom Header Color":L==="sidebar"?"Custom Sidebar Color":L==="border"?"Custom Border Color":"Pick a Color"}),e.jsx(ta,{open:Gs,onOpenChange:Se,onConfirm:Js,title:"Reset All Statistics?",message:"This will permanently delete all historical data including daily, weekly, and monthly statistics. Your all-time totals will be reset to zero. This action cannot be undone.",confirmText:"Reset All Stats",variant:"destructive",loading:qs})]})}export{ya as Settings};