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.
- package/.eslintrc.json +43 -0
- package/.github/workflows/build.yml +64 -0
- package/.github/workflows/ci.yml +39 -0
- package/.vscode/extensions.json +3 -0
- package/Current.md +97 -0
- package/DocHub_Image.png +0 -0
- package/README.md +666 -0
- package/USER_GUIDE.md +1173 -0
- package/Updater.md +311 -0
- package/build/256x256.png +0 -0
- package/build/512x512.png +0 -0
- package/build/app-update.yml +4 -0
- package/build/create-icon.js +208 -0
- package/build/icon.ico +0 -0
- package/build/icon.png +0 -0
- package/build/icon_1024x1024.png +0 -0
- package/dist/assets/Analytics-BpsG9895.js +1 -0
- package/dist/assets/Card-IAZin8kp.js +1 -0
- package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
- package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
- package/dist/assets/Documents-CqZ25axS.js +1 -0
- package/dist/assets/Input-l89xwXBi.js +1 -0
- package/dist/assets/Reporting-DqdHJY_a.js +1 -0
- package/dist/assets/Search-XNbu5z_3.js +1 -0
- package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
- package/dist/assets/Sessions-ClZOPYNc.js +1 -0
- package/dist/assets/Settings-DUEHGURa.js +11 -0
- package/dist/assets/index-8xUe8ptc.js +24 -0
- package/dist/assets/index-RYyJqF7O.css +1 -0
- package/dist/assets/path-BkOl0AGO.js +1 -0
- package/dist/assets/promises-ID_B9S-h.js +1 -0
- package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
- package/dist/assets/useToast-yRSO1dkm.js +1 -0
- package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
- package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
- package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
- package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
- package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
- package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
- package/dist/electron/main-CXkNtyv-.js +19789 -0
- package/dist/electron/main.js +5 -0
- package/dist/electron/preload.js +1 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +27 -0
- package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
- package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
- package/docs/README.md +115 -0
- package/docs/TOC_WIRING_GUIDE.md +344 -0
- package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
- package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
- package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
- package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
- package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
- package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
- package/docs/analysis/List_Implementation.md +206 -0
- package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
- package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
- package/docs/analysis/RefactorStyles.md +852 -0
- package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
- package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
- package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
- package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
- package/docs/analysis/github-issues-to-create.md +237 -0
- package/docs/api/API_README.md +538 -0
- package/docs/api/API_REFERENCE.md +751 -0
- package/docs/api/TYPE_DEFINITIONS.md +869 -0
- package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
- package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
- package/docs/docxmlater-readme.md +1341 -0
- package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
- package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
- package/docs/fixes/README.md +37 -0
- package/docs/github-issues/issue-1-body.md +125 -0
- package/docs/github-issues/issue-10-body.md +850 -0
- package/docs/github-issues/issue-2-body.md +200 -0
- package/docs/github-issues/issue-3-body.md +270 -0
- package/docs/github-issues/issue-4-body.md +169 -0
- package/docs/github-issues/issue-5-body.md +173 -0
- package/docs/github-issues/issue-6-body.md +158 -0
- package/docs/github-issues/issue-7-body.md +171 -0
- package/docs/github-issues/issue-8-body.md +407 -0
- package/docs/github-issues/issue-9-body.md +515 -0
- package/docs/github-issues/issue-tracker.md +274 -0
- package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
- package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
- package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
- package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
- package/docs/implementation/RefactorStyles.md +588 -0
- package/docs/implementation/implement-plan.md +489 -0
- package/docs/implementation/missing-helpers-implementation.md +391 -0
- package/docs/implementation/refactor-plan.md +520 -0
- package/docs/implementation/session-implementation-complete.md +233 -0
- package/docs/implementation/session-management-plan.md +250 -0
- package/docs/setup-checklist.md +77 -0
- package/docs/versions/changelog.md +345 -0
- package/electron/customUpdater.ts +656 -0
- package/electron/main.ts +2441 -0
- package/electron/memoryConfig.ts +187 -0
- package/electron/preload.ts +394 -0
- package/electron/proxyConfig.ts +340 -0
- package/electron/services/BackupService.ts +452 -0
- package/electron/services/DictionaryService.ts +402 -0
- package/electron/services/LocalDictionaryLookupService.ts +147 -0
- package/electron/services/PowerAutomateApiService.ts +231 -0
- package/electron/services/SharePointSyncService.ts +474 -0
- package/electron/windowsCertStore.ts +427 -0
- package/electron/zscalerConfig.ts +381 -0
- package/eslint.config.js +92 -0
- package/jest.config.js +52 -0
- package/package.json +214 -0
- package/postcss.config.mjs +6 -0
- package/public/icon.png +0 -0
- package/publish-release.ps1 +5 -0
- package/renovate.json +30 -0
- package/src/App.tsx +216 -0
- package/src/__mocks__/p-limit.js +12 -0
- package/src/__mocks__/styleMock.js +1 -0
- package/src/components/common/BugReportButton.tsx +44 -0
- package/src/components/common/BugReportDialog.tsx +193 -0
- package/src/components/common/Button.tsx +153 -0
- package/src/components/common/Card.tsx +86 -0
- package/src/components/common/ColorPickerDialog.tsx +177 -0
- package/src/components/common/ConfirmDialog.tsx +96 -0
- package/src/components/common/DebugConsole.tsx +275 -0
- package/src/components/common/EmptyState.tsx +183 -0
- package/src/components/common/ErrorBoundary.tsx +98 -0
- package/src/components/common/ErrorDetailsDialog.tsx +153 -0
- package/src/components/common/ErrorFallback.tsx +218 -0
- package/src/components/common/Input.tsx +109 -0
- package/src/components/common/Skeleton.tsx +184 -0
- package/src/components/common/SplashScreen.tsx +81 -0
- package/src/components/common/Toast.tsx +155 -0
- package/src/components/common/Tooltip.tsx +79 -0
- package/src/components/common/UpdateNotification.tsx +320 -0
- package/src/components/comparison/ComparisonWindow.tsx +374 -0
- package/src/components/comparison/SideBySideDiff.tsx +486 -0
- package/src/components/comparison/index.ts +8 -0
- package/src/components/document/DocumentUploader.tsx +288 -0
- package/src/components/document/HyperlinkPreview.tsx +430 -0
- package/src/components/document/HyperlinkService.md +1484 -0
- package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
- package/src/components/document/InlineChangesView.tsx +707 -0
- package/src/components/document/ProcessingProgress.tsx +303 -0
- package/src/components/document/ProcessingResults.tsx +256 -0
- package/src/components/document/TrackedChangesDetail.tsx +530 -0
- package/src/components/document/TrackedChangesPanel.tsx +546 -0
- package/src/components/document/VirtualDocumentList.tsx +240 -0
- package/src/components/editor/DocumentEditor.tsx +723 -0
- package/src/components/editor/DocumentEditorModal.tsx +640 -0
- package/src/components/editor/EditorQuickActions.tsx +502 -0
- package/src/components/editor/EditorToolbar.tsx +312 -0
- package/src/components/editor/TableEditor.tsx +926 -0
- package/src/components/editor/index.ts +18 -0
- package/src/components/layout/Header.tsx +190 -0
- package/src/components/layout/Sidebar.tsx +313 -0
- package/src/components/layout/TitleBar.tsx +190 -0
- package/src/components/navigation/CommandPalette.tsx +233 -0
- package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
- package/src/components/sessions/ChangeItem.tsx +408 -0
- package/src/components/sessions/ChangeViewer.tsx +1155 -0
- package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
- package/src/components/sessions/ProcessingOptions.tsx +297 -0
- package/src/components/sessions/ReplacementsTab.tsx +438 -0
- package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
- package/src/components/sessions/SessionManager.tsx +188 -0
- package/src/components/sessions/StylesEditor.tsx +1335 -0
- package/src/components/sessions/TabContainer.tsx +151 -0
- package/src/components/sessions/VirtualSessionList.tsx +157 -0
- package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
- package/src/components/settings/CertificateManager.tsx +410 -0
- package/src/components/settings/SegmentedControl.tsx +88 -0
- package/src/components/settings/SettingRow.tsx +52 -0
- package/src/contexts/GlobalStatsContext.tsx +396 -0
- package/src/contexts/SessionContext.tsx +2129 -0
- package/src/contexts/ThemeContext.tsx +428 -0
- package/src/contexts/UserSettingsContext.tsx +290 -0
- package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
- package/src/global.d.ts +273 -0
- package/src/hooks/useDocumentQueue.tsx +210 -0
- package/src/hooks/useToast.tsx +55 -0
- package/src/main.tsx +10 -0
- package/src/pages/Analytics.tsx +386 -0
- package/src/pages/CurrentSession.tsx +1174 -0
- package/src/pages/Dashboard.tsx +319 -0
- package/src/pages/Documents.tsx +317 -0
- package/src/pages/Projects.tsx +250 -0
- package/src/pages/Reporting.tsx +386 -0
- package/src/pages/Search.tsx +349 -0
- package/src/pages/Sessions.tsx +285 -0
- package/src/pages/Settings.tsx +2662 -0
- package/src/services/HyperlinkService.ts +1085 -0
- package/src/services/document/DocXMLaterProcessor.ts +617 -0
- package/src/services/document/DocumentProcessingComparison.ts +856 -0
- package/src/services/document/DocumentSnapshotService.ts +575 -0
- package/src/services/document/WordDocumentProcessor.ts +10509 -0
- package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
- package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
- package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
- package/src/services/document/blanklines/BlankLineManager.ts +658 -0
- package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
- package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
- package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
- package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
- package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
- package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
- package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
- package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
- package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
- package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
- package/src/services/document/blanklines/index.ts +67 -0
- package/src/services/document/blanklines/rules/additionRules.ts +337 -0
- package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
- package/src/services/document/blanklines/rules/removalRules.ts +362 -0
- package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
- package/src/services/document/blanklines/types.ts +29 -0
- package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
- package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
- package/src/services/document/helpers/whitespace.ts +117 -0
- package/src/services/document/list/ListNormalizer.ts +947 -0
- package/src/services/document/list/index.ts +45 -0
- package/src/services/document/list/list-detection.ts +275 -0
- package/src/services/document/list/list-types.ts +162 -0
- package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
- package/src/services/document/processors/ListProcessor.ts +257 -0
- package/src/services/document/processors/StructureProcessor.ts +176 -0
- package/src/services/document/processors/StyleProcessor.ts +389 -0
- package/src/services/document/processors/TableProcessor.ts +2238 -0
- package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
- package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
- package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
- package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
- package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
- package/src/services/document/processors/index.ts +28 -0
- package/src/services/document/types/docx-processing.ts +310 -0
- package/src/services/editor/EditorActionHandlers.ts +901 -0
- package/src/services/editor/index.ts +13 -0
- package/src/setupTests.ts +47 -0
- package/src/styles/global.css +782 -0
- package/src/types/backup.ts +132 -0
- package/src/types/dictionary.ts +125 -0
- package/src/types/document-processing.ts +331 -0
- package/src/types/docxmlater-augments.d.ts +142 -0
- package/src/types/editor.ts +280 -0
- package/src/types/electron.ts +340 -0
- package/src/types/globalStats.ts +155 -0
- package/src/types/hyperlink.ts +471 -0
- package/src/types/operations.ts +354 -0
- package/src/types/session.ts +427 -0
- package/src/types/settings.ts +112 -0
- package/src/utils/MemoryMonitor.ts +248 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/colorConvert.ts +306 -0
- package/src/utils/diffUtils.ts +347 -0
- package/src/utils/documentUtils.ts +202 -0
- package/src/utils/electronGuard.ts +62 -0
- package/src/utils/indexedDB.ts +915 -0
- package/src/utils/logger.ts +717 -0
- package/src/utils/pathSecurity.ts +232 -0
- package/src/utils/pathValidator.ts +236 -0
- package/src/utils/processingTimeEstimator.ts +153 -0
- package/src/utils/safeJsonParse.ts +62 -0
- package/src/utils/textSanitizer.ts +162 -0
- package/src/utils/urlHelpers.ts +304 -0
- package/src/utils/urlPatterns.ts +198 -0
- package/src/utils/urlSanitizer.ts +152 -0
- package/src/vite-env.d.ts +11 -0
- package/tsconfig.electron.json +19 -0
- package/tsconfig.json +36 -0
- package/tsconfig.node.json +12 -0
- package/typedoc.json +45 -0
- package/vite.config.ts +152 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{j as e,R as Nt,z as yt,O as wt,B as kt,N as He,T as Ct,G as St,X as Be,U as Ue,n as de,ax as Tt,ay as It,az as At,aA as Dt,aB as Ft,a7 as dt,aC as Pt,p as Ve,aD as ct,aE as Bt,a9 as We,M as Rt,aF as Ke,ar as _e,q as qe,A as je,m as ee,aG as Lt,ag as xe,a1 as Je,aH as Et,aI as Xe,aJ as Ye,aK as Ze,aL as De,aM as Ot,aN as $t,aO as Mt,aP as zt,aQ as Ht,V as Ut,F as et,an as tt,a6 as Vt,a8 as Wt,aR as st,aS as Oe,a5 as $e,aT as _t,al as Qt,aU as qt,aV as Gt,aW as Kt,r as Jt,ao as Xt}from"./vendor-ui-BU7NfluV.js";import{B as G,c as I,u as Re,d as Yt,l as Y}from"./index-8xUe8ptc.js";import{C as le,a as me,b as Zt,c as es,d as ts}from"./Card-IAZin8kp.js";import{u as ss,T as rs}from"./useToast-yRSO1dkm.js";import{r as c,j as as,u as ns}from"./vendor-react-BVZ_anCF.js";import{a as is}from"./urlHelpers-TvgahX0r.js";import"./vendor-charts-RkGK5ROP.js";function ls({open:t,onOpenChange:a,documentName:l,errors:o,errorType:n,processedAt:r}){return e.jsx(Nt,{open:t,onOpenChange:a,children:e.jsxs(yt,{children:[e.jsx(wt,{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(kt,{className:I("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.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-5 h-5 text-red-500"}),e.jsx(Ct,{className:"text-lg font-semibold text-foreground",children:"Processing Error"})]}),e.jsxs(St,{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(Be,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"font-medium text-foreground",children:l}),r&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:new Date(r).toLocaleString()})]}),e.jsx("div",{className:"mb-4",children:n==="file_locked"?e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",children:"File Locked"}):n==="api_timeout"?e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400",children:"API Timeout"}):n==="word_compatibility"?e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400",children:"Compatibility Mode"}):e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",children:"Error"})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"Error Details:"}),e.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-muted/50 p-3 space-y-2",children:o.length>0?o.map((u,f)=>e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:u},f)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No error details available."})})]}),n==="file_locked"&&e.jsx("div",{className:"mb-4 p-3 rounded-md bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:[e.jsx("strong",{children:"Tip:"})," Please close the document in Microsoft Word and try processing again."]})}),n==="api_timeout"&&e.jsx("div",{className:"mb-4 p-3 rounded-md bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800",children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:[e.jsx("strong",{children:"Tip:"})," The Power Automate service timed out. Please wait a moment and try again."]})}),n==="word_compatibility"&&e.jsxs("div",{className:"mb-4 p-3 rounded-md bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800",children:[e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-2",children:e.jsx("strong",{children:"How to Convert Your Document:"})}),e.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-300 mb-2",children:"It appears the Word document you are trying to process was using outdated functions from an old Word version. Please convert the file by following these steps:"}),e.jsxs("ol",{className:"text-sm text-purple-700 dark:text-purple-300 list-decimal list-inside space-y-1",children:[e.jsx("li",{children:"Open the document in Microsoft Word"}),e.jsxs("li",{children:["Click on the word ",e.jsx("strong",{children:'"Compatibility"'})," in the Title Bar"]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{children:'"Convert"'})]}),e.jsx("li",{children:"Save and close the document"}),e.jsxs("li",{children:["Return here and click ",e.jsx("strong",{children:"Retry"})]})]}),e.jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400 mt-3 italic",children:"Be cautious: Even Word's own conversion methods aren't always accurate, so some odd formatting may occur as a result. Thoroughly compare the original to the processed file to ensure everything aligns with our Documentation Standards."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(G,{variant:"outline",onClick:()=>a(!1),children:"Close"})})]})]})})}function mt({change:t}){const a=t.before||t.after,l=t.before&&t.after&&t.before!==t.after,o=t.category==="hyperlink"&&t.hyperlinkChange,n=t.propertyChange&&t.propertyChange.property,r=t.groupedProperties&&t.groupedProperties.length>0,u=l||t.description?.toLowerCase().startsWith("updated");return e.jsxs("div",{className:"group p-3 bg-muted/30 rounded-md hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[e.jsx(os,{source:t.source}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm text-foreground break-words",children:[t.description||"Change applied",o&&t.hyperlinkChange?.contentId&&e.jsx("code",{className:"ml-2 bg-primary/10 text-primary px-1.5 py-0.5 rounded text-xs font-medium",children:us(t.hyperlinkChange.contentId)})]}),t.affectedText&&!t.hyperlinkChange&&!u&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",title:t.affectedText,children:['Text: "',ve(t.affectedText),'"']}),t.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground",children:[e.jsx(Ue,{className:"w-3 h-3"}),e.jsx("span",{children:t.author}),t.date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"-"}),e.jsx("span",{children:ms(t.date)})]})]}),t.location?.nearestHeading&&e.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground",children:[e.jsx(de,{className:"w-3 h-3"}),e.jsxs("span",{children:["Near: ",t.location.nearestHeading]})]})]})]}),t.count&&t.count>1&&e.jsxs("span",{className:"shrink-0 px-2 py-0.5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:[t.count," instances"]})]}),o?e.jsx(cs,{change:t.hyperlinkChange}):a?e.jsx("div",{className:"mt-2 pl-7",children:l?e.jsx(ds,{before:t.before,after:t.after}):t.before?e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Removed: "}),e.jsxs("span",{className:"text-red-600 dark:text-red-400 line-through",children:['"',ve(t.before),'"']})]}):t.after?e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Added: "}),e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:['"',ve(t.after),'"']})]}):null}):null,n&&!r&&e.jsxs("div",{className:"mt-2 pl-7 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Property: "}),e.jsx("span",{className:"font-medium",children:t.propertyChange.property}),t.affectedText&&e.jsxs("span",{className:"text-muted-foreground ml-1",title:t.affectedText,children:['on "',Qe(t.affectedText,30),'"']}),(t.propertyChange.oldValue||t.propertyChange.newValue)&&e.jsxs("span",{className:"ml-2",children:[t.propertyChange.oldValue&&e.jsx("span",{className:"text-red-600 dark:text-red-400 line-through mr-1",children:Fe(t.propertyChange.oldValue)}),e.jsx("span",{className:"text-muted-foreground mx-1",children:"->"}),t.propertyChange.newValue&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:Fe(t.propertyChange.newValue)})]})]}),r&&e.jsxs("div",{className:"mt-2 pl-7",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Properties changed:"}),e.jsx("div",{className:"space-y-1",children:t.groupedProperties.map((f,y)=>e.jsxs("div",{className:"text-xs flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"-"}),e.jsxs("span",{className:"font-medium min-w-[100px]",children:[f.property,":"]}),f.oldValue&&e.jsx("span",{className:"text-red-600 dark:text-red-400 line-through",children:Fe(f.oldValue)}),e.jsx("span",{className:"text-muted-foreground",children:"->"}),f.newValue&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:Fe(f.newValue)})]},y))})]})]})}function os({source:t}){const a=t==="word";return e.jsx("span",{className:I("shrink-0 px-1.5 py-0.5 text-[10px] font-medium rounded uppercase tracking-wide",a?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"),children:a?"Word":"DocHub"})}function ds({before:t,after:a}){const l=ve(t),o=ve(a);return e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:"From:"}),e.jsxs("span",{className:"text-red-600 dark:text-red-400 line-through break-words",children:['"',l,'"']})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:"To:"}),e.jsxs("span",{className:"text-green-600 dark:text-green-400 break-words",children:['"',o,'"']})]})]})}function cs({change:t}){const a=t.urlBefore!==t.urlAfter,l=t.textBefore!==t.textAfter;return e.jsxs("div",{className:"mt-2 pl-7 space-y-3",children:[t.contentId&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Content ID:"}),e.jsx("code",{className:"bg-primary/10 text-primary px-1.5 py-0.5 rounded text-xs font-medium",children:t.contentId})]}),t.status&&t.status!=="updated"&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:I("px-2 py-0.5 text-xs font-medium rounded uppercase",t.status==="not_found"?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"),children:t.status==="not_found"?"Source Not Found":"Source Expired"})}),(a||l)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"What Changed:"}),a&&e.jsxs("div",{className:"space-y-1 ml-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"URL:"}),e.jsxs("div",{className:"space-y-1 text-xs font-mono",children:[t.urlBefore&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"shrink-0 w-1 h-full bg-red-500 rounded-full"}),e.jsx("span",{className:"text-red-600 dark:text-red-400 line-through break-all",children:rt(t.urlBefore)})]}),t.urlAfter&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"shrink-0 w-1 h-full bg-green-500 rounded-full"}),e.jsx("span",{className:"text-green-600 dark:text-green-400 break-all",children:rt(t.urlAfter)})]})]})]}),l&&e.jsxs("div",{className:"space-y-1 ml-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Text to Display:"}),e.jsxs("div",{className:"space-y-1 text-xs font-mono",children:[t.textBefore&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"shrink-0 w-1 h-full bg-red-500 rounded-full"}),e.jsx("span",{className:"text-red-600 dark:text-red-400 line-through break-all",children:Qe(t.textBefore,80)})]}),t.textAfter&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"shrink-0 w-1 h-full bg-green-500 rounded-full"}),e.jsx("span",{className:"text-green-600 dark:text-green-400 break-all",children:Qe(t.textAfter,80)})]})]})]})]})]})}function ms(t){return(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Qe(t,a){return t.length<=a?t:t.substring(0,a)+"..."}function ve(t){if(!t)return"";const a=t.replace(/\s+/g," ").trim();if(!a)return"";const l=a.split(" ").filter(o=>o.length>0);return l.length===0?"":l.length<=8?a:l.slice(0,6).join(" ")+"..."}function rt(t,a=60){if(t.length<=a)return t;try{const o=new URL(t).hostname,n=a-o.length-5;return`${o}/...${t.slice(-Math.max(10,n))}`}catch{return t.substring(0,a)+"..."}}function us(t){const a=t.split(/[-_]/),l=a[a.length-1];return l&&l.length>0?l:t.slice(-6)}function Fe(t){if(t==null)return"";if(typeof t=="object")try{const a=JSON.stringify(t);return a.length>50?a.substring(0,47)+"...":a}catch{return"[complex value]"}return String(t)}function xs(t){if(!t.wordRevisions?.entries)return[];const a=t.wordRevisions.processingAuthor,o=t.wordRevisions.entries.map(r=>({id:r.id,source:a&&r.author===a?"processing":"word",category:r.category,description:r.description,author:r.author,date:r.date,location:r.location?{paragraphIndex:r.location.paragraphIndex,nearestHeading:r.location.nearestHeading}:void 0,before:r.content?.before,after:r.content?.after,affectedText:r.content?.affectedText||r.content?.before||r.content?.after,hyperlinkChange:r.content?.hyperlinkChange,propertyChange:r.propertyChange})).filter(ut),n=xt(o);return pt(n)}function ps(t){if(!t.previousRevisions?.entries||t.previousRevisions.entries.length===0)return[];const l=t.previousRevisions.entries.map(n=>({id:`previous-${n.id}`,source:"word",category:n.category,description:n.description,author:n.author,date:n.date,location:n.location?{paragraphIndex:n.location.paragraphIndex,nearestHeading:n.location.nearestHeading}:void 0,before:n.content?.before,after:n.content?.after,affectedText:n.content?.affectedText||n.content?.before||n.content?.after,hyperlinkChange:n.content?.hyperlinkChange,propertyChange:n.propertyChange})).filter(ut),o=xt(l);return pt(o)}function ut(t){if(t.hyperlinkChange||t.propertyChange)return!0;const a=t.before?.trim()||"",l=t.after?.trim()||"",o=t.affectedText?.trim()||"";if(!a&&!l&&!o)return!1;if(a.length===0&&l.length<=1||l.length===0&&a.length<=1){const n=t.description?.toLowerCase()||"";if(n.includes('inserted " "')||n.includes('deleted " "')||n.includes("inserted ' '")||n.includes("deleted ' '"))return!1}return!0}function xt(t){const a=[],l=new Set,o=[],n=[];for(const r of t){if(r.category==="content"){const u=r.before&&!r.after,f=r.after&&!r.before;if(u){o.push(r);continue}if(f){n.push(r);continue}}a.push(r)}for(const r of o){if(l.has(r.id))continue;let u=null,f=0;for(const y of n){if(l.has(y.id)||r.source!==y.source||r.author!==y.author)continue;let S=0;const h=r.location?.paragraphIndex??-1,C=y.location?.paragraphIndex??-1;h>=0&&C>=0&&(h===C?S+=10:Math.abs(h-C)<=1?S+=5:Math.abs(h-C)<=3&&(S+=2));const A=r.location?.nearestHeading,D=y.location?.nearestHeading;A&&D&&A===D&&(S+=8);const w=r.before?.trim().toLowerCase()||"",M=y.after?.trim().toLowerCase()||"";w&&M&&(w===M?S+=15:(w.includes(M)||M.includes(w))&&(S+=7)),S>f&&S>=5&&(f=S,u=y)}if(u){l.add(r.id),l.add(u.id);const y=r.before||"",S=u.after||"",h=hs(y,S);a.push({id:`updated-${r.id}`,source:r.source,category:"content",description:`Updated${h?`: "${h}"`:""}`,author:r.author,date:r.date||u.date,location:r.location,before:y,after:S,affectedText:y||S})}else a.push(r),l.add(r.id)}for(const r of n)l.has(r.id)||(a.push(r),l.add(r.id));return a}function hs(t,a){const l=a||t||"";if(!l)return"";const o=l.replace(/\s+/g," ").trim();if(!o)return"";const n=o.split(" ").filter(r=>r.length>0);return n.length===0?"":n.length<=8?o:n.slice(0,6).join(" ")+"..."}function pt(t){const a=[],l=new Map,o=new Map;for(const n of t)if(n.category==="formatting"&&n.propertyChange?.property&&n.affectedText){const r=n.location?.paragraphIndex??"unknown",u=`${n.affectedText}|${n.source}|${n.author||""}|${r}`;l.has(u)||l.set(u,[]),l.get(u).push(n)}else if(n.affectedText&&n.description){const r=n.location?.paragraphIndex??"unknown",u=`${n.description}|${n.affectedText}|${n.source}|${n.author||""}|${r}`;o.has(u)||o.set(u,[]),o.get(u).push(n)}else a.push(n);for(const[,n]of l)if(n.length===1)a.push(n[0]);else{const r=n[0],u=n.map(f=>({property:f.propertyChange.property,oldValue:f.propertyChange.oldValue,newValue:f.propertyChange.newValue}));a.push({id:r.id,source:r.source,category:r.category,description:`Changed ${n.length} formatting properties`,author:r.author,date:r.date,location:r.location,affectedText:r.affectedText,count:n.length,groupedProperties:u})}for(const[,n]of o)if(n.length===1)a.push(n[0]);else{const r=n[0];a.push({...r,count:n.length,description:r.description})}return a}const oe={content:{label:"Content",icon:de,color:"text-blue-500"},formatting:{label:"Formatting",icon:ct,color:"text-purple-500"},structural:{label:"Structural",icon:Ve,color:"text-orange-500"},table:{label:"Table",icon:Pt,color:"text-green-500"},hyperlink:{label:"Hyperlinks",icon:dt,color:"text-cyan-500"},image:{label:"Images",icon:Ft,color:"text-pink-500"},field:{label:"Fields",icon:Dt,color:"text-yellow-500"},comment:{label:"Comments",icon:At,color:"text-indigo-500"},bookmark:{label:"Bookmarks",icon:It,color:"text-red-500"},contentControl:{label:"Content Controls",icon:Tt,color:"text-teal-500"}};function gs({sessionId:t,expandDocumentId:a,onExpandHandled:l}){const{sessions:o}=Re(),[n,r]=c.useState(new Set),[u,f]=c.useState("all"),[y,S]=c.useState("all"),[h,C]=c.useState("all"),[A,D]=c.useState(!1),[w,M]=c.useState(""),[O,_]=c.useState(!1),B=c.useRef(null);c.useEffect(()=>{a&&(r(new Set([a])),l?.())},[a,l]);const V=o.find(m=>m.id===t),d=c.useMemo(()=>V?V.documents.filter(m=>m.status==="completed").map(m=>({document:m,changes:xs(m)})).filter(m=>m.changes.length>0):[],[V]),g=c.useMemo(()=>V?V.documents.filter(m=>m.status==="completed").map(m=>({document:m,changes:ps(m)})).filter(m=>m.changes.length>0):[],[V]),F=g.length>0,k=g.reduce((m,b)=>m+b.changes.length,0),j=c.useMemo(()=>{const m=d.flatMap(b=>b.changes);return{total:m.length,insertions:m.filter(b=>b.category==="content"&&b.after&&!b.before).length,deletions:m.filter(b=>b.category==="content"&&b.before&&!b.after).length,formatting:m.filter(b=>b.category==="formatting").length,structural:m.filter(b=>b.category==="structural").length,table:m.filter(b=>b.category==="table").length,hyperlink:m.filter(b=>b.category==="hyperlink").length,wordRevisions:m.filter(b=>b.source==="word").length,processingChanges:m.filter(b=>b.source==="processing").length}},[d]),T=c.useMemo(()=>{const m=d.flatMap(R=>R.changes),b=new Set;return m.forEach(R=>{R.author&&b.add(R.author)}),Array.from(b).sort()},[d]);c.useEffect(()=>{const m=b=>{B.current&&!B.current.contains(b.target)&&D(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const H=c.useMemo(()=>d.map(m=>({...m,changes:m.changes.filter(b=>{if(u!=="all"&&b.source!==u||y!=="all"&&b.category!==y||h!=="all"&&b.author!==h)return!1;if(w){const R=w.toLowerCase(),q=b.description?.toLowerCase().includes(R),Q=b.before?.toLowerCase().includes(R),W=b.after?.toLowerCase().includes(R);if(!q&&!Q&&!W)return!1}return!0})})).filter(m=>m.changes.length>0),[d,u,y,h,w]),K=c.useMemo(()=>H.map(m=>{const b={content:[],formatting:[],structural:[],table:[],hyperlink:[],image:[],field:[],comment:[],bookmark:[],contentControl:[]};return m.changes.forEach(R=>{b[R.category].push(R)}),{document:m.document,grouped:b,total:m.changes.length}}),[H]),z=c.useCallback(m=>{r(b=>{const R=new Set(b);return R.has(m)?R.delete(m):R.add(m),R})},[]),ce=c.useCallback(()=>{let m=`# Document Changes
|
|
2
|
+
|
|
3
|
+
`;H.forEach(b=>{m+=`## ${b.document.name}
|
|
4
|
+
|
|
5
|
+
`;const R={content:[],formatting:[],structural:[],table:[],hyperlink:[],image:[],field:[],comment:[],bookmark:[],contentControl:[]};b.changes.forEach(q=>{R[q.category].push(q)}),Object.keys(R).forEach(q=>{const Q=R[q];Q.length!==0&&(m+=`### ${oe[q].label} Changes
|
|
6
|
+
|
|
7
|
+
`,Q.forEach(W=>{m+=`- ${W.description}`,W.source==="word"&&W.author&&(m+=` (by ${W.author})`),W.affectedText&&(m+=`
|
|
8
|
+
- Text: "${W.affectedText}"`),W.before&&W.after&&(m+=`
|
|
9
|
+
- Before: \`${W.before}\`
|
|
10
|
+
- After: \`${W.after}\``),m+=`
|
|
11
|
+
`}),m+=`
|
|
12
|
+
`)})}),navigator.clipboard.writeText(m).then(()=>{_(!0),setTimeout(()=>_(!1),2e3)})},[H]);return d.length===0&&!F?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(de,{className:"w-12 h-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Changes to Display"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:"Process documents to see tracked changes here. Both Word tracked changes and DocHub processing changes will be displayed."})]}):e.jsxs("div",{className:"space-y-4",children:[d.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Document Changes"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[j.total," total changes across ",d.length," document(s)"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(G,{variant:"outline",size:"sm",onClick:ce,className:"gap-2",children:[e.jsx(Bt,{className:"w-4 h-4"}),O?"Copied!":"Copy Markdown"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-6 gap-2",children:[e.jsx(ue,{icon:We,label:"Insertions",count:j.insertions,color:"text-green-500"}),e.jsx(ue,{icon:Rt,label:"Deletions",count:j.deletions,color:"text-red-500"}),e.jsx(ue,{icon:ct,label:"Formatting",count:j.formatting,color:"text-purple-500"}),e.jsx(ue,{icon:Ve,label:"Structural",count:j.structural,color:"text-orange-500"}),e.jsx(ue,{icon:de,label:"Word",count:j.wordRevisions,color:"text-blue-500"}),e.jsx(ue,{icon:Ve,label:"Processing",count:j.processingChanges,color:"text-gray-500"})]})]}),d.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(Ke,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Source:"}),e.jsx(be,{active:u==="all",onClick:()=>f("all"),children:"All"}),e.jsx(be,{active:u==="word",onClick:()=>f("word"),children:"Word"}),e.jsx(be,{active:u==="processing",onClick:()=>f("processing"),children:"DocHub"})]}),e.jsx("div",{className:"w-px h-6 bg-border"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Category:"}),e.jsx(be,{active:y==="all",onClick:()=>S("all"),children:"All"}),Object.keys(oe).map(m=>e.jsx(be,{active:y===m,onClick:()=>S(m),children:oe[m].label},m))]}),e.jsx("div",{className:"w-px h-6 bg-border"}),T.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative",ref:B,children:[e.jsxs("button",{onClick:()=>D(!A),className:I("flex items-center gap-2 px-2 py-1 text-xs rounded-md transition-colors",h!=="all"?"bg-primary text-primary-foreground":"bg-background hover:bg-muted border border-border"),children:[e.jsx(Ue,{className:"w-3 h-3"}),e.jsx("span",{children:h==="all"?"All Authors":h}),e.jsx(_e,{className:"w-3 h-3"})]}),A&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 min-w-[180px] bg-popover border border-border rounded-md shadow-lg py-1",children:[e.jsxs("button",{onClick:()=>{C("all"),D(!1)},className:I("w-full px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors flex items-center gap-2",h==="all"&&"bg-muted"),children:[e.jsx("span",{className:"w-4"}),"All Authors"]}),e.jsx("div",{className:"h-px bg-border my-1"}),T.map(m=>e.jsxs("button",{onClick:()=>{C(m),D(!1)},className:I("w-full px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors flex items-center gap-2",h===m&&"bg-muted"),children:[e.jsx(Ue,{className:"w-3 h-3 text-muted-foreground"}),m]},m))]})]}),h!=="all"&&e.jsx("button",{onClick:()=>C("all"),className:"p-1 rounded hover:bg-muted transition-colors",title:"Clear author filter",children:e.jsx(Be,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-px h-6 bg-border"})]}),e.jsx("input",{type:"text",placeholder:"Search changes...",value:w,onChange:m=>M(m.target.value),className:"px-3 py-1 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50"})]}),d.length>0&&e.jsx("div",{className:"space-y-3",children:K.map(m=>e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>z(m.document.id),className:"w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[n.has(m.document.id)?e.jsx(_e,{className:"w-4 h-4"}):e.jsx(qe,{className:"w-4 h-4"}),e.jsx(de,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:m.document.name})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[m.total," change",m.total!==1?"s":""]})]}),e.jsx(je,{children:n.has(m.document.id)&&e.jsx(ee.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsx("div",{className:"px-4 pb-4 space-y-4",children:Object.keys(oe).map(b=>{const R=m.grouped[b];if(R.length===0)return null;const q=oe[b],Q=q.icon;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(Q,{className:I("w-4 h-4",q.color)}),e.jsx("span",{children:q.label}),e.jsxs("span",{className:"text-muted-foreground",children:["(",R.length,")"]})]}),e.jsx("div",{className:"pl-6 space-y-2",children:R.map(W=>e.jsx(mt,{change:W},W.id))})]},b)})})})})]},m.document.id))}),H.length===0&&d.length>0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ke,{className:"w-8 h-8 text-muted-foreground mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No changes match the current filters"}),e.jsx(G,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>{f("all"),S("all"),C("all"),M("")},children:"Clear Filters"})]}),F&&e.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(Lt,{className:"w-5 h-5 text-amber-500"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Previous Tracked Changes"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[k," change",k!==1?"s":""," that existed in the document before DocHub processing"]})]})]}),e.jsx("div",{className:"space-y-3",children:g.map(m=>e.jsx(fs,{document:m.document,changes:m.changes},`previous-${m.document.id}`))})]})]})}function ue({icon:t,label:a,count:l,color:o}){return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-md",children:[e.jsx(t,{className:I("w-4 h-4",o)}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:a}),e.jsx("span",{className:"text-sm font-medium",children:l})]})]})}function be({active:t,onClick:a,children:l}){return e.jsx("button",{onClick:a,className:I("px-2 py-1 text-xs rounded-md transition-colors",t?"bg-primary text-primary-foreground":"bg-background hover:bg-muted border border-border"),children:l})}function fs({document:t,changes:a}){const[l,o]=c.useState(!1),n=c.useMemo(()=>{const r={content:[],formatting:[],structural:[],table:[],hyperlink:[],image:[],field:[],comment:[],bookmark:[],contentControl:[]};return a.forEach(u=>{r[u.category].push(u)}),r},[a]);return e.jsxs("div",{className:"border border-amber-200 dark:border-amber-800 bg-amber-50/50 dark:bg-amber-950/20 rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>o(!l),className:"w-full px-4 py-3 flex items-center justify-between hover:bg-amber-100/50 dark:hover:bg-amber-900/20 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[l?e.jsx(_e,{className:"w-4 h-4 text-amber-600"}):e.jsx(qe,{className:"w-4 h-4 text-amber-600"}),e.jsx(de,{className:"w-4 h-4 text-amber-600"}),e.jsx("span",{className:"font-medium",children:t.name})]}),e.jsxs("span",{className:"text-sm text-amber-700 dark:text-amber-400",children:[a.length," previous change",a.length!==1?"s":""]})]}),e.jsx(je,{children:l&&e.jsx(ee.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsx("div",{className:"px-4 pb-4 space-y-4",children:Object.keys(oe).map(r=>{const u=n[r];if(u.length===0)return null;const f=oe[r],y=f.icon;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(y,{className:I("w-4 h-4",f.color)}),e.jsx("span",{children:f.label}),e.jsxs("span",{className:"text-muted-foreground",children:["(",u.length,")"]})]}),e.jsx("div",{className:"pl-6 space-y-2",children:u.map(S=>e.jsx(mt,{change:S},S.id))})]},r)})})})})]})}const bs=["text","hyperlinks","structure","lists"],vs={"remove-italics":"Removes all italic text formatting","normalize-dashes":"Converts special dashes (em-dash, en-dash) to regular hyphens","preserve-red-font":"Prevents changes to text that is colored red","replace-outdated-titles":"Updates a hyperlink's display text to match the title within theSource if different","validate-document-styles":"Applies your custom style settings from the Styles tab","correct-misapplied-styles":"Fixes paragraphs with incorrectly applied TOC or Hyperlink styles so they receive proper formatting","update-top-hyperlinks":"Adds or updates links that jump to the document start","update-toc-hyperlinks":"Creates or updates clickable links in the table of contents","force-remove-heading1-toc":"Removes the main document title from the table of contents","fix-internal-hyperlinks":"Fixes broken links that point to other parts of the document","fix-content-ids":"Appends Content ID to the end of theSource Hyperlinks","center-border-images":"Centers and borders images if image is bigger than 100x100 pixels","remove-whitespace":"Removes unnecessary spaces, tabs, and blank areas","remove-paragraph-lines":"Makes spacing between paragraphs consistent","remove-headers-footers":"Removes text from document headers and footers","add-document-warning":"Adds a standard disclaimer notice if missing","validate-header2-tables":"Formats 1x1 Heading 2 tables to ensure standardization across document","list-indentation":"Corrects the indentation of bulleted and numbered lists","bullet-uniformity":"Makes bullet styles consistent throughout","normalize-table-lists":"Converts typed list prefixes (1., A., •) to proper Word formatting and fixes mixed lists","smart-tables":"Applies consistent styling to all tables","adjust-table-padding":"Adjusts the space inside table cells","standardize-table-borders":"Makes table border styles uniform","set-landscape-margins":"Sets document to landscape orientation with 1-inch margins"},js=[{id:"remove-italics",label:"Remove Italics",group:"text",enabled:!0},{id:"normalize-dashes",label:"Standardize Dashes",group:"text",enabled:!0},{id:"preserve-red-font",label:"Keep Red Text",group:"text",enabled:!1},{id:"replace-outdated-titles",label:"Update theSource Link Titles",group:"hyperlinks",enabled:!0},{id:"validate-document-styles",label:"Apply Custom Styles",group:"text",enabled:!0},{id:"correct-misapplied-styles",label:"Fix Misapplied Styles",group:"text",enabled:!0},{id:"update-top-hyperlinks",label:'"Top of Document" Hyperlinks',group:"hyperlinks",enabled:!0},{id:"update-toc-hyperlinks",label:"Table of Contents Hyperlinks",group:"hyperlinks",enabled:!0},{id:"force-remove-heading1-toc",label:"Remove Title from TOC",group:"hyperlinks",enabled:!0},{id:"fix-internal-hyperlinks",label:"Internal Hyperlinks",group:"hyperlinks",enabled:!0},{id:"fix-content-ids",label:"Content ID References",group:"hyperlinks",enabled:!0},{id:"center-border-images",label:"Center and Border Images",group:"structure",enabled:!0},{id:"remove-whitespace",label:"Clean Up Spaces",group:"structure",enabled:!0},{id:"remove-paragraph-lines",label:"Standardize Blank Lines",group:"structure",enabled:!0},{id:"remove-headers-footers",label:"Clear Headers/Footers",group:"structure",enabled:!0},{id:"add-document-warning",label:"Add Missing Disclaimer",group:"structure",enabled:!0},{id:"validate-header2-tables",label:"Heading 2 Tables",group:"structure",enabled:!0},{id:"set-landscape-margins",label:"Landscape Layout",group:"structure",enabled:!0},{id:"list-indentation",label:"Fix List Spacing",group:"lists",enabled:!0},{id:"bullet-uniformity",label:"Standardize Bullets",group:"lists",enabled:!0},{id:"normalize-table-lists",label:"Fix Typed List Prefixes",group:"lists",enabled:!0},{id:"smart-tables",label:"Format Tables",group:"lists",enabled:!0},{id:"adjust-table-padding",label:"Table Cell Spacing",group:"lists",enabled:!0},{id:"standardize-table-borders",label:"Fix Table Borders",group:"lists",enabled:!0}],Me={text:"Text Formatting",hyperlinks:"Links & Navigation",structure:"Document Structure",lists:"Lists & Tables"};function Ns({options:t,onOptionsChange:a,autoAcceptRevisions:l=!1,onAutoAcceptRevisionsChange:o}){const n=c.useMemo(()=>t.every(h=>h.enabled),[t]),r=c.useCallback(h=>{const C=t.map(A=>A.id===h?{...A,enabled:!A.enabled}:A);a(C)},[t,a]);c.useCallback(()=>{const h=!n,C=t.map(A=>({...A,enabled:h}));a(C)},[n,t,a]);const u=c.useCallback(h=>{const A=t.filter(w=>w.group===h).every(w=>w.enabled),D=t.map(w=>w.group===h?{...w,enabled:!A}:w);a(D)},[t,a]),f=t.reduce((h,C)=>(h[C.group]||(h[C.group]=[]),h[C.group].push(C),h),{}),y=c.useMemo(()=>{const h={};for(const C of bs){const A=t.filter(D=>D.group===C&&D.enabled);A.length>0&&(h[C]=A)}return h},[t]),S=Object.keys(y).length>0;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:"space-y-4",children:Object.entries(f).map(([h,C])=>{const A=C.every(w=>w.enabled),D=C.some(w=>w.enabled);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded",onClick:()=>u(h),role:"checkbox","aria-checked":A?!0:D?"mixed":!1,"aria-label":`Toggle ${Me[h]}`,children:[e.jsx("div",{"aria-hidden":"true",className:I("w-5 h-5 rounded border-2 flex items-center justify-center transition-all",A?"bg-primary border-primary checkbox-checked":D?"bg-primary/50 border-primary":"border-border hover:border-primary/50"),children:(A||D)&&e.jsx(xe,{className:"w-3 h-3 text-primary-foreground checkbox-checkmark"})}),e.jsx("span",{className:"font-semibold text-sm",children:Me[h]})]}),e.jsx("div",{className:"pl-5 space-y-1",children:C.map(w=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:w.enabled,onChange:()=>r(w.id),className:"sr-only"}),e.jsx("div",{className:I("w-4 h-4 rounded border-2 flex items-center justify-center transition-all",w.enabled?"bg-primary border-primary checkbox-checked":"border-border group-hover:border-primary/50"),children:w.enabled&&e.jsx(ee.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:30},children:e.jsx(xe,{className:"w-2.5 h-2.5 text-primary-foreground checkbox-checkmark"})})})]}),e.jsx("span",{className:"text-sm",children:w.label})]},w.id))})]},h)})}),e.jsxs("div",{className:"bg-muted/20 rounded-lg p-4 border border-border/50",children:[e.jsx("h4",{className:"font-medium text-sm mb-3 text-muted-foreground",children:"Enabled processing:"}),S?e.jsx("div",{className:"space-y-4",children:Object.entries(y).map(([h,C])=>e.jsxs("div",{children:[e.jsx("h5",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:Me[h]}),e.jsx("ul",{className:"space-y-1.5",children:C.map(A=>e.jsxs(ee.li,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-primary mt-0.5",children:"•"}),e.jsx("span",{children:vs[A.id]})]},A.id))})]},h))}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No processing options enabled"})]})]})})}function ys({sessionId:t}){const{sessions:a,updateSessionReplacements:l}=Re(),[o,n]=c.useState(!1),[r,u]=c.useState(!1),[f,y]=c.useState([]),[S,h]=c.useState([]),[C,A]=c.useState({});c.useEffect(()=>{if(!t)return;const d=a.find(g=>g.id===t);if(d?.replacements){const g=[],F=[];d.replacements.forEach(k=>{k.type==="hyperlink"?g.push({id:k.id,enabled:k.enabled,oldHyperlink:k.pattern,newContentId:k.replacement}):k.type==="text"&&F.push({id:k.id,enabled:k.enabled,oldText:k.pattern,newText:k.replacement})}),y(g),h(F),n(g.some(k=>k.enabled)),u(F.some(k=>k.enabled))}},[t,a]);const D=(d,g)=>{if(!t)return;const F=[...d.map(k=>({id:k.id,enabled:k.enabled,type:"hyperlink",pattern:k.oldHyperlink,replacement:k.newContentId})),...g.map(k=>({id:k.id,enabled:k.enabled,type:"text",pattern:k.oldText,replacement:k.newText}))];l(t,F)},w=()=>{const d={id:`hyperlink-${Date.now()}`,enabled:!0,oldHyperlink:"",newContentId:""},g=[...f,d];y(g),D(g,S)},M=(d,g)=>{if(g.newContentId!==void 0){const k=is(g.newContentId);if(k.valid)A(j=>{const T={...j};return delete T[d],T});else{A(T=>({...T,[d]:k.error||"Invalid URL"}));const j=f.map(T=>T.id===d?{...T,...g}:T);y(j);return}}const F=f.map(k=>k.id===d?{...k,...g}:k);y(F),D(F,S)},O=d=>{const g=f.filter(F=>F.id!==d);y(g),D(g,S)},_=()=>{const d={id:`text-${Date.now()}`,enabled:!0,oldText:"",newText:""},g=[...S,d];h(g),D(f,g)},B=(d,g)=>{const F=S.map(k=>k.id===d?{...k,...g}:k);h(F),D(f,F)},V=d=>{const g=S.filter(F=>F.id!==d);h(g),D(f,g)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>n(!o),className:I("relative w-12 h-6 rounded-full transition-colors",o?"bg-primary":"bg-muted"),children:e.jsx(ee.div,{className:"absolute top-1 w-4 h-4 bg-white rounded-full shadow-xs",animate:{x:o?24:2},transition:{type:"spring",stiffness:500,damping:30}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Replace Hyperlinks"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Replace hyperlink targets based on rules"})]})]}),e.jsx(G,{size:"sm",variant:"outline",icon:e.jsx(We,{className:"w-4 h-4"}),onClick:w,disabled:!o,children:"Add Rule"})]}),f.length>0&&e.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium w-12",children:"Enable"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Old Hyperlink Text"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"New Content ID"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium w-12"})]})}),e.jsx("tbody",{children:e.jsx(je,{children:f.map(d=>e.jsxs(ee.tr,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,x:-20},className:I("border-t border-border",!o&&"opacity-50"),children:[e.jsx("td",{className:"px-4 py-3",children:e.jsx("label",{className:"flex items-center cursor-pointer",children:e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:d.enabled,onChange:g=>M(d.id,{enabled:g.target.checked}),disabled:!o,className:"sr-only"}),e.jsx("div",{className:I("w-5 h-5 rounded border-2 flex items-center justify-center transition-all",d.enabled&&o?"bg-primary border-primary checkbox-checked":"border-border"),children:d.enabled&&o&&e.jsx(xe,{className:"w-3 h-3 text-primary-foreground checkbox-checkmark"})})]})})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("input",{type:"text",value:d.oldHyperlink,onChange:g=>M(d.id,{oldHyperlink:g.target.value}),disabled:!o,placeholder:"Enter old hyperlink text",className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-muted/30 focus:bg-background transition-colors disabled:opacity-50"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:d.newContentId,onChange:g=>M(d.id,{newContentId:g.target.value}),disabled:!o,placeholder:"Enter new content ID",className:I("w-full px-3 py-1.5 text-sm border rounded-md bg-muted/30 focus:bg-background transition-colors disabled:opacity-50",C[d.id]?"border-red-500 focus:border-red-500":"border-border")}),C[d.id]&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:C[d.id]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>O(d.id),disabled:!o,className:"p-1.5 text-muted-foreground hover:text-red-500 transition-colors disabled:opacity-50",children:e.jsx(Je,{className:"w-4 h-4"})})})]},d.id))})})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(!r),className:I("relative w-12 h-6 rounded-full transition-colors",r?"bg-primary":"bg-muted"),children:e.jsx(ee.div,{className:"absolute top-1 w-4 h-4 bg-white rounded-full shadow-xs",animate:{x:r?24:2},transition:{type:"spring",stiffness:500,damping:30}})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Replace Text"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Replace text content based on rules"})]})]}),e.jsx(G,{size:"sm",variant:"outline",icon:e.jsx(We,{className:"w-4 h-4"}),onClick:_,disabled:!r,children:"Add Rule"})]}),S.length>0&&e.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium w-12",children:"Enable"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Old Text"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"New Text"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium w-12"})]})}),e.jsx("tbody",{children:e.jsx(je,{children:S.map(d=>e.jsxs(ee.tr,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,x:-20},className:I("border-t border-border",!r&&"opacity-50"),children:[e.jsx("td",{className:"px-4 py-3",children:e.jsx("label",{className:"flex items-center cursor-pointer",children:e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:d.enabled,onChange:g=>B(d.id,{enabled:g.target.checked}),disabled:!r,className:"sr-only"}),e.jsx("div",{className:I("w-5 h-5 rounded border-2 flex items-center justify-center transition-all",d.enabled&&r?"bg-primary border-primary checkbox-checked":"border-border"),children:d.enabled&&r&&e.jsx(xe,{className:"w-3 h-3 text-primary-foreground checkbox-checkmark"})})]})})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("input",{type:"text",value:d.oldText,onChange:g=>B(d.id,{oldText:g.target.value}),disabled:!r,placeholder:"Enter old text",className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-muted/30 focus:bg-background transition-colors disabled:opacity-50"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("input",{type:"text",value:d.newText,onChange:g=>B(d.id,{newText:g.target.value}),disabled:!r,placeholder:"Enter new text",className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-muted/30 focus:bg-background transition-colors disabled:opacity-50"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>V(d.id),disabled:!r,className:"p-1.5 text-muted-foreground hover:text-red-500 transition-colors disabled:opacity-50",children:e.jsx(Je,{className:"w-4 h-4"})})})]},d.id))})})]})})]})]})}const ze=[{id:"header1",name:"Heading 1",fontSize:18,fontFamily:"Verdana",bold:!0,italic:!1,underline:!1,alignment:"left",spaceBefore:0,spaceAfter:12,lineSpacing:1,color:"#000000"},{id:"header2",name:"Heading 2",fontSize:14,fontFamily:"Verdana",bold:!0,italic:!1,underline:!1,alignment:"left",spaceBefore:6,spaceAfter:6,lineSpacing:1,color:"#000000"},{id:"header3",name:"Heading 3",fontSize:12,fontFamily:"Verdana",bold:!0,italic:!1,underline:!1,alignment:"left",spaceBefore:3,spaceAfter:3,lineSpacing:1,color:"#000000"},{id:"normal",name:"Normal",fontSize:12,fontFamily:"Verdana",bold:!1,italic:!1,underline:!1,preserveBold:!0,preserveItalic:!1,preserveUnderline:!1,preserveCenterAlignment:!0,alignment:"left",spaceBefore:3,spaceAfter:3,lineSpacing:1,color:"#000000",noSpaceBetweenSame:!1},{id:"listParagraph",name:"List Paragraph",fontSize:12,fontFamily:"Verdana",bold:!1,italic:!1,underline:!1,preserveBold:!0,preserveItalic:!1,preserveUnderline:!1,alignment:"left",spaceBefore:0,spaceAfter:6,lineSpacing:1,color:"#000000",noSpaceBetweenSame:!0,indentation:{left:.25,firstLine:.5}}],ws=Array.from({length:65},(t,a)=>a+8),ks=["Verdana","Arial","Times New Roman","Calibri","Georgia","Helvetica"],at=Array.from({length:25},(t,a)=>a*3),Cs=[{value:1,label:"Single"},{value:1.15,label:"1.15 (Default)"},{value:1.5,label:"1.5 Lines"},{value:2,label:"Double"}],Ss=[{level:0,symbolIndent:.25,textIndent:.5,bulletChar:"•",numberedFormat:"1."},{level:1,symbolIndent:.75,textIndent:1,bulletChar:"○",numberedFormat:"a."},{level:2,symbolIndent:1.25,textIndent:1.5,bulletChar:"•",numberedFormat:"i."},{level:3,symbolIndent:1.75,textIndent:2,bulletChar:"○",numberedFormat:"A."},{level:4,symbolIndent:2.25,textIndent:2.5,bulletChar:"•",numberedFormat:"I."}],Ts={enabled:!0,indentationLevels:Ss},nt=t=>!t||t.length===0?ze:t.map(a=>{const l=ze.find(o=>o.id===a.id)||ze[0];return{id:a.id||l.id,name:a.name||l.name,fontFamily:a.fontFamily||l.fontFamily,fontSize:a.fontSize||l.fontSize,bold:a.bold??l.bold,italic:a.italic??l.italic,underline:a.underline??l.underline,preserveBold:a.preserveBold??l.preserveBold,preserveItalic:a.preserveItalic??l.preserveItalic,preserveUnderline:a.preserveUnderline??l.preserveUnderline,preserveCenterAlignment:a.preserveCenterAlignment??l.preserveCenterAlignment,alignment:a.alignment||l.alignment,color:a.color||l.color,spaceBefore:a.spaceBefore??l.spaceBefore,spaceAfter:a.spaceAfter??l.spaceAfter,lineSpacing:a.lineSpacing??l.lineSpacing,noSpaceBetweenSame:a.noSpaceBetweenSame??l.noSpaceBetweenSame,indentation:a.indentation||l.indentation}}),Is=c.memo(function({initialStyles:a,initialListBulletSettings:l,onStylesChange:o,onListBulletSettingsChange:n,tableHeader2Shading:r,tableOtherShading:u,imageBorderWidth:f,padding1x1Top:y,padding1x1Bottom:S,padding1x1Left:h,padding1x1Right:C,paddingOtherTop:A,paddingOtherBottom:D,paddingOtherLeft:w,paddingOtherRight:M,cellBorderThickness:O,onTableShadingChange:_}){const[B,V]=c.useState(()=>nt(a)),[d,g]=c.useState(l||Ts),[F,k]=c.useState(r||"#BFBFBF"),[j,T]=c.useState(u||"#DFDFDF"),[H,K]=c.useState(f??1),z=(s,p)=>s===void 0?p:Math.max(0,Math.min(1,s)),[ce,m]=c.useState(z(y,0)),[b,R]=c.useState(z(S,0)),[q,Q]=c.useState(z(h,.08)),[W,x]=c.useState(z(C,.08)),[Ne,re]=c.useState(z(A,0)),[ye,we]=c.useState(z(D,0)),[ke,Ce]=c.useState(z(w,.08)),[Se,ae]=c.useState(z(M,.08)),[pe,he]=c.useState(O??.5);c.useEffect(()=>{a&&V(nt(a))},[a]),c.useEffect(()=>{l&&g(l)},[l]),c.useEffect(()=>{r!==void 0&&k(r)},[r]),c.useEffect(()=>{u!==void 0&&T(u)},[u]),c.useEffect(()=>{f!==void 0&&K(f)},[f]),c.useEffect(()=>{O!==void 0&&he(O)},[O]),c.useEffect(()=>{y!==void 0&&m(z(y,0)),S!==void 0&&R(z(S,0)),h!==void 0&&Q(z(h,.08)),C!==void 0&&x(z(C,.08)),A!==void 0&&re(z(A,0)),D!==void 0&&we(z(D,0)),w!==void 0&&Ce(z(w,.08)),M!==void 0&&ae(z(M,.08))},[y,S,h,C,A,D,w,M]);const L=(s,p)=>{const E=B.map(te=>te.id===s?{...te,...p}:te);V(E),o?.(E)},Te=s=>e.jsxs("div",{className:"space-y-4 p-4 border border-border rounded-lg",children:[e.jsx("h3",{className:"font-semibold text-base",children:s.name}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:`${s.id}-font-family`,className:"text-sm text-muted-foreground mb-1 block",children:"Font Family"}),e.jsx("select",{id:`${s.id}-font-family`,value:s.fontFamily,onChange:p=>L(s.id,{fontFamily:p.target.value}),className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:ks.map(p=>e.jsx("option",{value:p,children:p},p))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:`${s.id}-font-size`,className:"text-sm text-muted-foreground mb-1 block",children:"Font Size"}),e.jsx("select",{id:`${s.id}-font-size`,value:s.fontSize,onChange:p=>L(s.id,{fontSize:Number(p.target.value)}),className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:ws.map(p=>e.jsxs("option",{value:p,children:[p,"pt"]},p))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:`${s.id}-text-color`,className:"text-sm text-muted-foreground mb-1 block",children:"Text Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:`${s.id}-text-color`,type:"color",value:s.color,onChange:p=>L(s.id,{color:p.target.value}),className:"h-9 w-16 border border-border rounded cursor-pointer","aria-label":`${s.name} text color picker`}),e.jsx("input",{type:"text",value:s.color,onChange:p=>L(s.id,{color:p.target.value}),className:"flex-1 px-3 py-1.5 text-sm border border-border rounded-md bg-background",placeholder:"#000000","aria-label":`${s.name} text color hex value`})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-muted-foreground mb-1 block",id:`${s.id}-formatting-label`,children:"Formatting"}),(s.id==="header1"||s.id==="header2"||s.id==="header3")&&e.jsxs("div",{className:"flex gap-1",role:"group","aria-labelledby":`${s.id}-formatting-label`,children:[e.jsx("button",{onClick:()=>L(s.id,{bold:!s.bold}),className:I("p-2 rounded transition-all",s.bold?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),"aria-label":`Toggle bold for ${s.name}`,"aria-pressed":s.bold,children:e.jsx(Xe,{className:"w-4 h-4","aria-hidden":"true"})}),e.jsx("button",{onClick:()=>L(s.id,{italic:!s.italic}),className:I("p-2 rounded transition-all",s.italic?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),"aria-label":`Toggle italic for ${s.name}`,"aria-pressed":s.italic,children:e.jsx(Ye,{className:"w-4 h-4","aria-hidden":"true"})}),e.jsx("button",{onClick:()=>L(s.id,{underline:!s.underline}),className:I("p-2 rounded transition-all",s.underline?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),"aria-label":`Toggle underline for ${s.name}`,"aria-pressed":s.underline,children:e.jsx(Ze,{className:"w-4 h-4","aria-hidden":"true"})})]}),(s.id==="normal"||s.id==="listParagraph")&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>L(s.id,{bold:!s.bold}),disabled:s.preserveBold,className:I("p-2 rounded transition-all",s.preserveBold?"opacity-50 cursor-not-allowed bg-muted":s.bold?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),title:s.preserveBold?"Bold formatting is preserved":s.bold?"Bold enabled":"Bold disabled",children:e.jsx(Xe,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>L(s.id,{italic:!s.italic}),disabled:s.preserveItalic,className:I("p-2 rounded transition-all",s.preserveItalic?"opacity-50 cursor-not-allowed bg-muted":s.italic?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),title:s.preserveItalic?"Italic formatting is preserved":s.italic?"Italic enabled":"Italic disabled",children:e.jsx(Ye,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>L(s.id,{underline:!s.underline}),disabled:s.preserveUnderline,className:I("p-2 rounded transition-all",s.preserveUnderline?"opacity-50 cursor-not-allowed bg-muted":s.underline?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),title:s.preserveUnderline?"Underline formatting is preserved":s.underline?"Underline enabled":"Underline disabled",children:e.jsx(Ze,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex gap-2 text-xs",children:[e.jsxs("button",{onClick:()=>L(s.id,{preserveBold:!s.preserveBold}),className:I("flex items-center gap-1 px-2 py-1 rounded transition-all",s.preserveBold?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-muted hover:bg-muted/80 text-muted-foreground"),title:s.preserveBold?"Preserve existing bold formatting":"Apply bold setting",children:[e.jsx(De,{className:"w-3 h-3"}),e.jsx("span",{children:"Bold"})]}),e.jsxs("button",{onClick:()=>L(s.id,{preserveItalic:!s.preserveItalic}),className:I("flex items-center gap-1 px-2 py-1 rounded transition-all",s.preserveItalic?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-muted hover:bg-muted/80 text-muted-foreground"),title:s.preserveItalic?"Preserve existing italic formatting":"Apply italic setting",children:[e.jsx(De,{className:"w-3 h-3"}),e.jsx("span",{children:"Italic"})]}),e.jsxs("button",{onClick:()=>L(s.id,{preserveUnderline:!s.preserveUnderline}),className:I("flex items-center gap-1 px-2 py-1 rounded transition-all",s.preserveUnderline?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-muted hover:bg-muted/80 text-muted-foreground"),title:s.preserveUnderline?"Preserve existing underline formatting":"Apply underline setting",children:[e.jsx(De,{className:"w-3 h-3"}),e.jsx("span",{children:"Underline"})]}),s.id==="normal"&&e.jsxs("button",{onClick:()=>L(s.id,{preserveCenterAlignment:!(s.preserveCenterAlignment??!0)}),className:I("flex items-center gap-1 px-2 py-1 rounded transition-all",s.preserveCenterAlignment??!0?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-muted hover:bg-muted/80 text-muted-foreground"),title:s.preserveCenterAlignment??!0?"Preserve center alignment if paragraph is centered":"Apply alignment setting to all paragraphs",children:[e.jsx(De,{className:"w-3 h-3"}),e.jsx("span",{children:"Center"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"Alignment"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>L(s.id,{alignment:"left"}),className:I("p-2 rounded transition-all",s.alignment==="left"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:e.jsx(Ot,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>L(s.id,{alignment:"center"}),className:I("p-2 rounded transition-all",s.alignment==="center"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:e.jsx($t,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>L(s.id,{alignment:"right"}),className:I("p-2 rounded transition-all",s.alignment==="right"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:e.jsx(Mt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>L(s.id,{alignment:"justify"}),className:I("p-2 rounded transition-all",s.alignment==="justify"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:e.jsx(zt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"Space Before"}),e.jsx("select",{value:s.spaceBefore,onChange:p=>L(s.id,{spaceBefore:Number(p.target.value)}),className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:at.map(p=>e.jsxs("option",{value:p,children:[p,"pt"]},p))})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"Space After"}),e.jsx("select",{value:s.spaceAfter,onChange:p=>L(s.id,{spaceAfter:Number(p.target.value)}),className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:at.map(p=>e.jsxs("option",{value:p,children:[p,"pt"]},p))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"Line Spacing"}),e.jsx("select",{value:s.lineSpacing,onChange:p=>L(s.id,{lineSpacing:Number(p.target.value)}),className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:Cs.map(p=>e.jsx("option",{value:p.value,children:p.label},p.value))})]})]})]}),(s.id==="normal"||s.id==="listParagraph")&&e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"checkbox",checked:s.noSpaceBetweenSame,onChange:()=>L(s.id,{noSpaceBetweenSame:!s.noSpaceBetweenSame}),className:"sr-only"}),e.jsx("div",{className:I("w-5 h-5 rounded border-2 flex items-center justify-center transition-all",s.noSpaceBetweenSame?"bg-primary border-primary checkbox-checked":"border-border"),children:s.noSpaceBetweenSame&&e.jsx(xe,{className:"w-3 h-3 text-primary-foreground checkbox-checkmark"})})]}),e.jsx("span",{className:"text-sm",children:"Don't add space between paragraphs of the same style"})]}),e.jsx("div",{className:"p-3 bg-white rounded-md border border-border",children:e.jsxs("div",{style:{fontSize:`${s.fontSize}pt`,fontFamily:s.fontFamily,fontWeight:s.bold===void 0?"normal":s.bold?"bold":"normal",fontStyle:s.italic===void 0?"normal":s.italic?"italic":"normal",textDecoration:s.underline===void 0?"none":s.underline?"underline":"none",textAlign:s.alignment,color:s.color},children:["Sample text for ",s.name," style",(s.bold===void 0||s.italic===void 0||s.underline===void 0)&&e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"(preview only - actual formatting preserved)"})]})})]},s.id),Ie=()=>e.jsxs("div",{className:"space-y-4 p-4 border border-border rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Et,{className:"w-5 h-5 text-primary"}),e.jsx("h3",{className:"font-semibold text-base",children:"Lists & Bullets Uniformity"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Indentation Settings"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Adjust symbol position per level. Text follows with 0.25" hanging indent.'}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Symbol Position Increment"}),e.jsxs("span",{className:"text-sm font-medium tabular-nums",children:[(d.indentationLevels[0]?.symbolIndent||.25).toFixed(2),'"']})]}),e.jsx("input",{type:"range",value:d.indentationLevels[0]?.symbolIndent||.25,onChange:s=>{const p=Number(s.target.value),E=.25,te=["1.","a.","i.","A.","I."],J=[];let ne=p;for(let se=0;se<5;se++){const N=ne+E;J.push({level:se,symbolIndent:ne,textIndent:N,bulletChar:d.indentationLevels[se]?.bulletChar||(se%2===0?"•":"○"),numberedFormat:te[se]}),ne=N+E}g({...d,indentationLevels:J})},onPointerUp:()=>{n?.(d)},onMouseUp:()=>{n?.(d)},className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary",min:"0.25",max:"1.5",step:"0.25"}),e.jsxs("div",{className:"flex justify-between text-xxs text-muted-foreground",children:[e.jsx("span",{children:'0.25"'}),e.jsx("span",{children:'1.5"'})]})]}),e.jsxs("div",{className:"p-3 bg-muted/20 rounded-md",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:"Calculated Indentations:"}),e.jsx("div",{className:"grid grid-cols-5 gap-2 text-xxs",children:d.indentationLevels.map(s=>e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"font-medium",children:["L",s.level]}),e.jsxs("div",{className:"text-muted-foreground",children:[s.symbolIndent.toFixed(2),'" / ',s.textIndent.toFixed(2),'"']})]},s.level))})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Bullet Points Format"}),e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:"Configure bullet symbols for each of the 5 indentation levels."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Level 0"}),e.jsxs("select",{value:d.indentationLevels[0]?.bulletChar||"•",onChange:s=>{const p=[...d.indentationLevels];p[0]={...p[0],bulletChar:s.target.value};const E={...d,indentationLevels:p};g(E),n?.(E)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:[e.jsx("option",{value:"•",children:"• Closed Bullet"}),e.jsx("option",{value:"○",children:"○ Open Bullet"}),e.jsx("option",{value:"■",children:"■ Closed Square"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Level 1"}),e.jsxs("select",{value:d.indentationLevels[1]?.bulletChar||"○",onChange:s=>{const p=[...d.indentationLevels];p[1]={...p[1],bulletChar:s.target.value};const E={...d,indentationLevels:p};g(E),n?.(E)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:[e.jsx("option",{value:"•",children:"• Closed Bullet"}),e.jsx("option",{value:"○",children:"○ Open Bullet"}),e.jsx("option",{value:"■",children:"■ Closed Square"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Level 2"}),e.jsxs("select",{value:d.indentationLevels[2]?.bulletChar||"•",onChange:s=>{const p=[...d.indentationLevels];p[2]={...p[2],bulletChar:s.target.value};const E={...d,indentationLevels:p};g(E),n?.(E)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:[e.jsx("option",{value:"•",children:"• Closed Bullet"}),e.jsx("option",{value:"○",children:"○ Open Bullet"}),e.jsx("option",{value:"■",children:"■ Closed Square"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Level 3"}),e.jsxs("select",{value:d.indentationLevels[3]?.bulletChar||"○",onChange:s=>{const p=[...d.indentationLevels];p[3]={...p[3],bulletChar:s.target.value};const E={...d,indentationLevels:p};g(E),n?.(E)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:[e.jsx("option",{value:"•",children:"• Closed Bullet"}),e.jsx("option",{value:"○",children:"○ Open Bullet"}),e.jsx("option",{value:"■",children:"■ Closed Square"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Level 4"}),e.jsxs("select",{value:d.indentationLevels[4]?.bulletChar||"•",onChange:s=>{const p=[...d.indentationLevels];p[4]={...p[4],bulletChar:s.target.value};const E={...d,indentationLevels:p};g(E),n?.(E)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:[e.jsx("option",{value:"•",children:"• Closed Bullet"}),e.jsx("option",{value:"○",children:"○ Open Bullet"}),e.jsx("option",{value:"■",children:"■ Closed Square"})]})]})]}),e.jsxs("div",{className:"p-3 bg-muted/20 rounded-md",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:"Bullet Pattern Preview:"}),e.jsx("div",{className:"grid grid-cols-5 gap-2 text-sm",children:d.indentationLevels.map(s=>e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"font-medium text-xs text-muted-foreground",children:["L",s.level]}),e.jsx("div",{className:"text-lg",children:s.bulletChar})]},s.level))})]})]})]}),Ae=()=>{const s=()=>({padding1x1Top:ce,padding1x1Bottom:b,padding1x1Left:q,padding1x1Right:W,paddingOtherTop:Ne,paddingOtherBottom:ye,paddingOtherLeft:ke,paddingOtherRight:Se,cellBorderThickness:pe}),p=N=>{k(N),_?.(N,j,H,s())},E=N=>{T(N),_?.(F,N,H,s())},te=N=>{const X=parseFloat(N);!isNaN(X)&&X>=.5&&X<=10&&(K(X),_?.(F,j,X,s()))},J=(N,X,ge)=>{const ie=parseFloat(X);if(!isNaN(ie)&&ie>=0&&ie<=1){ge(ie);const Le={...s(),[N]:ie};_?.(F,j,H,Le)}},ne=N=>{const X=parseFloat(N);if(!isNaN(X)){he(X);const ge={...s(),cellBorderThickness:X};_?.(F,j,H,ge)}},se=[{value:.25,label:"0.25 pt"},{value:.5,label:"0.5 pt (Default)"},{value:.75,label:"0.75 pt"},{value:1,label:"1 pt"},{value:1.5,label:"1.5 pt"},{value:2,label:"2 pt"},{value:2.25,label:"2.25 pt"},{value:3,label:"3 pt"}];return e.jsxs("div",{className:"space-y-4 p-4 border border-border rounded-lg",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-semibold text-base",children:"Table & Image Settings"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure default shading colors for table cells, image border width, and cell padding"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-2 block",children:"Header 2 Table Shading"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"color",value:F,onChange:N=>p(N.target.value),className:"h-9 w-16 border border-border rounded cursor-pointer"}),e.jsx("input",{type:"text",value:F,onChange:N=>p(N.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-border rounded-md bg-background",placeholder:"#BFBFBF"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-2 block",children:"Other Table Shading"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"color",value:j,onChange:N=>E(N.target.value),className:"h-9 w-16 border border-border rounded cursor-pointer"}),e.jsx("input",{type:"text",value:j,onChange:N=>E(N.target.value),className:"flex-1 px-3 py-1.5 text-sm border border-border rounded-md bg-background",placeholder:"#DFDFDF"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-muted-foreground mb-2 block",children:"Image Border Width"}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{type:"number",step:"0.5",min:"0.5",max:"10",value:H,onChange:N=>te(N.target.value),className:"w-24 px-3 py-1.5 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"pt"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Border thickness for centered images (0.5 - 10pt)"})]})]}),e.jsxs("div",{className:"pt-4 border-t border-border",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Cell Border Thickness"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Set the border thickness for all table cells. Borders with color #FFC000 will preserve their color."}),e.jsx("div",{className:"flex gap-2 items-center",children:e.jsx("select",{value:pe,onChange:N=>ne(N.target.value),className:"w-48 px-3 py-1.5 text-sm border border-border rounded-md bg-background",children:se.map(N=>e.jsx("option",{value:N.value,children:N.label},N.value))})})]}),e.jsxs("div",{className:"pt-4 border-t border-border",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Table Cell Padding"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Set cell padding for 1x1 tables and other tables. Values are in inches."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"1x1 Tables"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Top"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:ce,onChange:N=>J("padding1x1Top",N.target.value,m),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Bottom"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:b,onChange:N=>J("padding1x1Bottom",N.target.value,R),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Left"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:q,onChange:N=>J("padding1x1Left",N.target.value,Q),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Right"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:W,onChange:N=>J("padding1x1Right",N.target.value,x),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"Other Tables"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Top"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:Ne,onChange:N=>J("paddingOtherTop",N.target.value,re),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Bottom"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:ye,onChange:N=>J("paddingOtherBottom",N.target.value,we),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Left"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:ke,onChange:N=>J("paddingOtherLeft",N.target.value,Ce),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Right"}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:Se,onChange:N=>J("paddingOtherRight",N.target.value,ae),className:"w-20 px-2 py-1 text-sm border border-border rounded-md bg-background"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:'"'})]})]})]})]})]})]})]})};return e.jsxs("div",{className:"space-y-4",children:[Ie(),Ae(),e.jsxs("div",{className:"relative py-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center",children:e.jsx("span",{className:"bg-background px-4 text-sm text-muted-foreground",children:"Paragraph Styles"})})]}),B.map(s=>Te(s))]})});function As({tabs:t,defaultTab:a,className:l,headerActions:o,activeTabId:n,onTabChange:r}){const[u,f]=c.useState(a||t[0]?.id),y=n!==void 0?n:u,S=B=>{n===void 0&&f(B),r?.(B)},[h,C]=c.useState(!1),[A,D]=c.useState(!1),w=c.useRef(null),M=t.find(B=>B.id===y);c.useEffect(()=>{const B=w.current;if(!B)return;const V=()=>{const{scrollLeft:d,scrollWidth:g,clientWidth:F}=B;C(d>0),D(d<g-F-1)};return V(),B.addEventListener("scroll",V),window.addEventListener("resize",V),()=>{B.removeEventListener("scroll",V),window.removeEventListener("resize",V)}},[t]);const O=()=>{w.current?.scrollBy({left:-200,behavior:"smooth"})},_=()=>{w.current?.scrollBy({left:200,behavior:"smooth"})};return e.jsxs("div",{className:I("w-full",l),children:[e.jsxs("div",{className:"sticky top-0 bg-background z-20 flex items-center border-b border-border",children:[h&&e.jsx("button",{onClick:O,className:"flex-shrink-0 px-2 py-2.5 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Scroll tabs left",children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsx("div",{ref:w,className:"flex gap-1 px-4 overflow-x-auto flex-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t.map(B=>e.jsxs("button",{onClick:()=>S(B.id),className:I("relative px-4 py-2.5 text-sm font-medium transition-all whitespace-nowrap","hover:text-foreground",y===B.id?"text-foreground":"text-muted-foreground"),children:[B.label,y===B.id&&e.jsx(ee.div,{layoutId:"activeTab",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary",initial:!1,transition:{type:"spring",stiffness:500,damping:30}})]},B.id))}),A&&e.jsx("button",{onClick:_,className:"flex-shrink-0 px-2 py-2.5 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Scroll tabs right",children:e.jsx(qe,{className:"w-4 h-4"})}),o?.[y]&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-l border-border",children:o[y]})]}),e.jsx("div",{className:"p-4",children:e.jsx(ee.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:M?.content},y)})]})}const it=12e3,lt=3e3,ot=20;class ht{timings=[];currentTiming=null;averageApiTime=it;startDocument(a,l=1){this.currentTiming={documentId:a,startTime:Date.now(),apiCallCount:l}}endDocument(){this.currentTiming&&(this.currentTiming.endTime=Date.now(),this.timings.push(this.currentTiming),this.timings.length>ot&&(this.timings=this.timings.slice(-ot)),this.updateAverageApiTime(),this.currentTiming=null)}recordApiCallTime(a){this.averageApiTime=.3*a+(1-.3)*this.averageApiTime}updateAverageApiTime(){const a=this.timings.filter(r=>r.endTime);if(a.length===0)return;const l=a.slice(-5),o=l.reduce((r,u)=>r+(u.endTime-u.startTime),0),n=l.reduce((r,u)=>r+u.apiCallCount,0);if(n>0){const r=o/n,u=.4;this.averageApiTime=u*r+(1-u)*this.averageApiTime}}estimateRemainingTime(a,l=1){if(a<=0)return 0;let o=0;if(this.currentTiming){const r=Date.now()-this.currentTiming.startTime,u=this.currentTiming.apiCallCount*this.averageApiTime+lt;o=Math.max(0,u-r)}const n=(a-(this.currentTiming?1:0))*(l*this.averageApiTime+lt);return o+n}getAverageApiTime(){return this.averageApiTime}static formatTime(a){if(a<=0)return"0s";const l=Math.ceil(a/1e3);if(l<60)return`${l}s`;const o=Math.floor(l/60),n=l%60;if(o<60)return n>0?`${o}m ${n}s`:`${o}m`;const r=Math.floor(o/60),u=o%60;return`${r}h ${u}m`}reset(){this.timings=[],this.currentTiming=null,this.averageApiTime=it}}const Pe=new ht;function Ds(t={}){const{processDocument:a}=Re(),{onDocumentComplete:l,onQueueComplete:o,onError:n}=t,r=c.useRef([]),u=c.useRef(!1),f=c.useRef(!0),[y,S]=c.useState([]),[h,C]=c.useState(!1),[A,D]=c.useState(null),[w,M]=c.useState(0),O=c.useCallback(()=>{if(f.current){S([...r.current]),C(u.current);const j=Pe.estimateRemainingTime(r.current.length);M(j)}},[]),_=c.useCallback(async()=>{if(u.current||r.current.length===0)return;const j=r.current.find(T=>T.status==="queued");if(j){u.current=!0,j.status="processing",D(j.documentId),O(),Pe.startDocument(j.documentId,1);try{await a(j.sessionId,j.documentId),j.status="completed",l?.(j.documentId,!0)}catch(T){j.status="error";const H=T instanceof Error?T.message:"Processing failed";n?.(j.documentId,H),l?.(j.documentId,!1)}Pe.endDocument(),r.current=r.current.filter(T=>T.documentId!==j.documentId),u.current=!1,D(null),O(),r.current.length===0?o?.():setTimeout(_,100)}},[a,O,l,o,n]),B=c.useCallback((j,T)=>{if(r.current.some(K=>K.documentId===T))return;const H={documentId:T,sessionId:j,addedAt:new Date,status:"queued"};r.current=[...r.current,H],O(),_()},[O,_]),V=c.useCallback((j,T)=>{const H=T.filter(K=>!r.current.some(z=>z.documentId===K)).map(K=>({documentId:K,sessionId:j,addedAt:new Date,status:"queued"}));H.length>0&&(r.current=[...r.current,...H],O(),_())},[O,_]),d=c.useCallback(j=>{r.current=r.current.filter(T=>T.documentId!==j),O()},[O]),g=c.useCallback(()=>{r.current=[],O()},[O]),F=c.useCallback(j=>r.current.findIndex(T=>T.documentId===j),[]),k=c.useCallback(j=>r.current.some(T=>T.documentId===j),[]);return c.useEffect(()=>{if(!h)return;const j=setInterval(()=>{if(f.current){const T=Pe.estimateRemainingTime(r.current.length);M(T)}},1e3);return()=>clearInterval(j)},[h]),c.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),{queue:y,isProcessing:h,currentDocumentId:A,estimatedTimeRemaining:w,estimatedTimeRemainingFormatted:ht.formatTime(w),addToQueue:B,addManyToQueue:V,removeFromQueue:d,clearQueue:g,getQueuePosition:F,isInQueue:k}}function $s(){const{id:t}=as(),a=ns(),{toasts:l,toast:o,dismiss:n}=ss(),{sessions:r,currentSession:u,loadSession:f,closeSession:y,reopenSession:S,addDocuments:h,removeDocument:C,processDocument:A,updateSessionName:D,updateSessionOptions:w,updateSessionStyles:M,updateSessionListBulletSettings:O,updateSessionTableShadingSettings:_,resetSessionToDefaults:B,saveAsCustomDefaults:V}=Re(),{settings:d}=Yt(),[g,F]=c.useState(!1),[k,j]=c.useState(!1),[T,H]=c.useState(""),[K,z]=c.useState(null),[ce,m]=c.useState(null),[b,R]=c.useState(void 0),q=c.useRef(!1),Q=c.useRef(!0),W=c.useRef(r);W.current=r,c.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]),c.useEffect(()=>{t&&!u&&f(t)},[t,u,f]);const x=r.find(i=>i.id===t),Ne=c.useMemo(()=>{const i=x?.processingOptions?.enabledOperations||[];return js.map(v=>({...v,enabled:i.includes(v.id)}))},[x?.processingOptions]),{queue:re,currentDocumentId:ye,addToQueue:we,addManyToQueue:ke,clearQueue:Ce,getQueuePosition:Se,isInQueue:ae,estimatedTimeRemainingFormatted:pe}=Ds({onDocumentComplete:(i,v)=>{const P=W.current.find(U=>U.id===x?.id)?.documents.find(U=>U.id===i);v&&P?.status==="completed"?o({title:"Done",description:P.name,variant:"success"}):P?.status==="error"&&o({title:"Processing failed",description:P.errors?.[0]||"Document error",variant:"destructive"})},onQueueComplete:()=>{re.length>1&&o({title:"All documents processed",variant:"success",duration:5e3})}}),he=c.useCallback(async()=>{if(q.current){Y.debug("[File Select] Already selecting files, ignoring request");return}const i=x?.id;if(!i){o({title:"No active session",variant:"destructive"});return}const v=window.electronAPI;if(!v?.selectDocuments||!v?.getFileStats){console.warn("CurrentSession: electronAPI methods not available"),o({title:"File selection unavailable",description:"Please restart app",variant:"destructive"});return}q.current=!0;try{const $=await v.selectDocuments();if(!Q.current){Y.debug("[File Select] Component unmounted during file selection");return}if(!$||$.length===0)return;if(x?.id!==i){Y.warn("[File Select] Session changed during file selection"),o({title:"Session changed",description:"Please try again",variant:"destructive"});return}const P=[],U=[];for(const Z of $){if(!Q.current){Y.debug("[File Select] Component unmounted during file processing");return}const Ee=Z.split(/[\\/]/).pop()||"document.docx";try{const fe=await v.getFileStats(Z),jt={path:Z,name:Ee,size:fe.size,type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",lastModified:fe.mtimeMs||Date.now(),webkitRelativePath:"",arrayBuffer:async()=>{throw new Error("Use Electron IPC for file operations")},slice:()=>new Blob,stream:()=>{throw new Error("Use Electron IPC for file operations")},text:async()=>{throw new Error("Use Electron IPC for file operations")},bytes:async()=>{throw new Error("Use Electron IPC for file operations")}};P.push(jt),Y.debug(`[File Select] Valid file: ${Ee} (${fe.size} bytes) at ${Z}`)}catch(fe){Y.error(`[File Select] Failed to access file at "${Z}":`,fe),U.push(Ee)}}if(!Q.current)return;P.length>0&&(await h(i,P),Q.current&&o({title:`${P.length} file${P.length>1?"s":""} added`,variant:"success"})),U.length>0&&Q.current&&(Y.warn(`[File Select] Rejected ${U.length} file(s):`,U),o({title:"Access denied",description:`${U.length} file${U.length>1?"s":""} skipped`,variant:"destructive"})),P.length===0&&$.length>0&&Q.current&&o({title:"Cannot access files",description:"Check file permissions",variant:"destructive"})}catch($){Q.current&&(Y.error("[File Select] Unexpected error:",$),o({title:"Selection failed",description:$ instanceof Error?$.message:"Unexpected error",variant:"destructive"}))}finally{q.current=!1}},[x?.id,h,o]);if(!x)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(le,{className:"max-w-md",children:e.jsxs(me,{className:"p-8 text-center",children:[e.jsx(He,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Session Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"The session you are looking for does not exist or has been deleted."}),e.jsx(G,{onClick:()=>a("/"),children:"Return to Dashboard"})]})})});const L=i=>{i.preventDefault(),F(!0)},Te=()=>{F(!1)},Ie=async i=>{if(i.preventDefault(),F(!1),!x||!i.dataTransfer?.files?.length)return;const v=Array.from(i.dataTransfer.files),$=window.electronAPI?.getPathsForFiles?.(v)||[],P=v.map((U,Z)=>({file:U,path:$[Z]||""})).filter(({file:U,path:Z})=>U.name.endsWith(".docx")&&Z).map(({file:U,path:Z})=>({name:U.name,path:Z,size:U.size,type:U.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",lastModified:U.lastModified,arrayBuffer:async()=>new ArrayBuffer(0),slice:()=>new Blob,stream:()=>new ReadableStream,text:async()=>"",webkitRelativePath:""}));if(P.length===0){Y.warn("[Drag-Drop] No valid .docx files dropped");return}h(x.id,P),o({title:`${P.length} file${P.length>1?"s":""} added`,variant:"success"})},Ae=i=>{!x||ae(i)||we(x.id,i)},s=()=>{y(x.id),a("/")},p=async()=>{const i=x.documents.filter(v=>v.status==="completed"&&v.path);if(i.length===0){o({title:"No completed files to export",description:"Process some documents first",variant:"destructive"});return}try{const v=await window.electronAPI.selectFolder();if(!v)return;const $=await window.electronAPI.copyFilesToFolder(i.map(P=>P.path),v);o({title:`Exported ${$.copied} file${$.copied!==1?"s":""}`,description:$.skipped>0?`${$.skipped} file(s) skipped`:void 0,variant:"success"})}catch(v){o({title:"Export failed",description:v instanceof Error?v.message:"Unknown error",variant:"destructive"})}},E=()=>{H(x.name),j(!0)},te=()=>{T.trim()&&T!==x.name&&D(x.id,T.trim()),j(!1)},J=()=>{j(!1),H("")},ne=i=>{const v=i.filter($=>$.enabled).map($=>$.id);console.log("[CurrentSession] Processing options changed:"),console.log(" - Enabled operations:",v),console.log(" - TOC enabled:",v.includes("update-toc-hyperlinks")),console.log(" - Validate styles enabled:",v.includes("validate-document-styles")),console.log(" - Validate Header2 tables enabled:",v.includes("validate-header2-tables")),w(x.id,{validateUrls:!0,createBackup:!0,processInternalLinks:v.includes("fix-internal-hyperlinks"),processExternalLinks:!0,enabledOperations:v})},se=(i,v,$,P)=>{_(x.id,{header2Shading:i,otherShading:v,imageBorderWidth:$,...P&&{padding1x1Top:P.padding1x1Top,padding1x1Bottom:P.padding1x1Bottom,padding1x1Left:P.padding1x1Left,padding1x1Right:P.padding1x1Right,paddingOtherTop:P.paddingOtherTop,paddingOtherBottom:P.paddingOtherBottom,paddingOtherLeft:P.paddingOtherLeft,paddingOtherRight:P.paddingOtherRight,cellBorderThickness:P.cellBorderThickness}})},N=i=>{w(x.id,{validateUrls:x.processingOptions?.validateUrls??!0,createBackup:x.processingOptions?.createBackup??!0,processInternalLinks:x.processingOptions?.processInternalLinks??!0,processExternalLinks:x.processingOptions?.processExternalLinks??!0,enabledOperations:x.processingOptions?.enabledOperations??[],autoAcceptRevisions:i})},X=i=>{switch(i){case"pending":return e.jsx(Jt,{className:"w-4 h-4 text-muted-foreground"});case"processing":return e.jsx($e,{className:"w-4 h-4 text-blue-500 animate-spin"});case"completed":return e.jsx(Kt,{className:"w-4 h-4 text-green-500"});case"error":return e.jsx(He,{className:"w-4 h-4 text-red-500"})}},ge=i=>i<1024?i+" B":i<1024*1024?(i/1024).toFixed(1)+" KB":(i/(1024*1024)).toFixed(1)+" MB",ie=x.documents.filter(i=>i.status==="completed"&&i.path).length,Le=e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(G,{onClick:p,variant:"outline",disabled:ie===0,className:"gap-2",icon:e.jsx(Ut,{className:"w-4 h-4"}),children:"Export Processed Files"}),e.jsx("div",{children:x.status==="closed"?e.jsx(G,{onClick:()=>S(x.id),variant:"default",className:"bg-green-600 hover:bg-green-700 text-white font-medium",icon:e.jsx(et,{className:"w-4 h-4"}),children:"Re-Open Session"}):e.jsx(G,{onClick:s,variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground font-medium",icon:e.jsx(tt,{className:"w-4 h-4"}),children:"Save and Close Session"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(le,{children:e.jsx(me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Vt,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Documents"}),e.jsx("p",{className:"text-2xl font-bold",children:x.stats.documentsProcessed})]})]})})}),e.jsx(le,{children:e.jsx(me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(dt,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Hyperlinks"}),e.jsx("p",{className:"text-2xl font-bold",children:x.stats.hyperlinksChecked})]})]})})}),e.jsx(le,{children:e.jsx(me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Wt,{className:"w-8 h-8 text-purple-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Feedback"}),e.jsx("p",{className:"text-2xl font-bold",children:x.stats.feedbackImported})]})]})})}),e.jsx(le,{children:e.jsx(me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(st,{className:"w-8 h-8 text-orange-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Time Saved"}),e.jsxs("p",{className:"text-2xl font-bold",children:[Math.round(x.stats.hyperlinksChecked*101/60),"m"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"101 seconds per hyperlink"})]})]})})})]}),e.jsxs(le,{children:[e.jsxs(Zt,{children:[e.jsx(es,{children:"Documents"}),e.jsx(ts,{children:"Upload and process Word documents (.docx)"})]}),e.jsx(me,{children:x.documents.length===0?e.jsxs("div",{className:I("border-2 border-dashed rounded-lg p-8 text-center transition-colors",g?"border-primary bg-primary/5":"border-border"),onDragOver:L,onDragLeave:Te,onDrop:Ie,children:[e.jsx(Oe,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:g?"Drop files here":"Upload Documents"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Drag and drop .docx files here, or click to browse"}),e.jsx(G,{onClick:he,icon:e.jsx(Oe,{className:"w-4 h-4"}),children:"Load Files"})]}):e.jsxs(e.Fragment,{children:[re.length>0&&e.jsxs("div",{className:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($e,{className:"w-4 h-4 animate-spin text-blue-500"}),e.jsxs("span",{className:"text-sm",children:["Processing document ",re.findIndex(i=>i.status==="processing")+1," of ",re.length]}),pe&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(st,{className:"w-3 h-3"}),"~",pe," remaining"]})]}),e.jsx(G,{size:"xs",variant:"ghost",onClick:Ce,children:"Cancel All"})]}),e.jsxs("div",{className:"mb-4 flex justify-between",children:[e.jsx(G,{onClick:()=>{const i=x.documents.filter(v=>v.status==="pending").map(v=>v.id);ke(x.id,i)},size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700 text-white",icon:e.jsx(_t,{className:"w-4 h-4"}),disabled:!x.documents.some(i=>i.status==="pending")||re.length>0,children:"Process Documents"}),e.jsx(G,{onClick:he,size:"sm",variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground",icon:e.jsx(Oe,{className:"w-4 h-4"}),children:"Add More Files"})]}),e.jsx("div",{className:"space-y-2",children:e.jsx(je,{children:x.documents.map(i=>e.jsxs(ee.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,x:-20},className:I("flex items-center justify-between p-3 rounded-lg border border-border hover:bg-muted/50 transition-all group",i.status==="completed"&&"cursor-pointer"),onDoubleClick:()=>{i.status==="completed"&&(R("tracked-changes"),m(i.id))},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[X(i.status),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:i.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[ge(i.size),i.processedAt&&` • Processed ${new Date(i.processedAt).toLocaleTimeString()}`]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i.status==="pending"&&!ae(i.id)&&e.jsx(G,{size:"xs",onClick:()=>Ae(i.id),disabled:ae(i.id),children:"Process"}),i.status==="pending"&&ae(i.id)&&e.jsx("span",{className:"text-xs text-blue-500 font-medium flex items-center gap-1",children:ye===i.id?e.jsxs(e.Fragment,{children:[e.jsx($e,{className:"w-3 h-3 animate-spin"}),"Processing..."]}):`Queue #${Se(i.id)+1}`}),i.status==="processing"&&e.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"Processing..."}),i.status==="completed"&&e.jsx("span",{className:"text-xs text-green-500 font-medium",children:"Completed"}),i.status==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>z(i),className:"text-xs text-red-500 font-medium hover:text-red-600 hover:underline cursor-pointer",title:"Click to view error details",children:i.errorType==="file_locked"?"Close File Before Processing":i.errorType==="api_timeout"?"Power Automate Timeout":i.errorType==="word_compatibility"?"Convert File in Word":"Error"}),(i.errorType==="file_locked"||i.errorType==="api_timeout"||i.errorType==="word_compatibility")&&e.jsx(G,{size:"xs",onClick:()=>Ae(i.id),disabled:ae(i.id),children:"Retry"})]}),i.status==="completed"&&i.path&&e.jsx("button",{onClick:async()=>{try{await window.electronAPI.openDocument(i.path),o({title:"Opening in Word",variant:"default"})}catch(v){Y.error("Failed to open document:",v),o({title:"Cannot open file",description:v instanceof Error?v.message:void 0,variant:"destructive"})}},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded hover:bg-green-50 dark:hover:bg-green-950",title:"Open document in Word",children:e.jsx(de,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),i.status==="completed"&&i.processingResult?.backupPath&&e.jsx("button",{onClick:async()=>{try{await window.electronAPI.openDocument(i.processingResult.backupPath),o({title:"Opening backup in Word",variant:"default"})}catch(v){Y.error("Failed to open backup:",v),o({title:"Cannot open backup file",description:v instanceof Error?v.message:void 0,variant:"destructive"})}},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded hover:bg-yellow-50 dark:hover:bg-yellow-950",title:"Open backup file",children:e.jsx(Qt,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400"})}),i.status==="completed"&&i.path&&i.processingResult?.backupPath&&e.jsx("button",{onClick:async()=>{if(!window.electronAPI?.display?.openComparison||!window.electronAPI?.display?.getAllDisplays){o({title:"Compare unavailable",description:"Feature not available in this version",variant:"destructive"});return}try{const v=await window.electronAPI.display.getAllDisplays(),$=d.displaySettings?.comparisonMonitorId??0,P=Math.min(Math.max(0,$),v.length-1),U=await window.electronAPI.display.openComparison(i.processingResult.backupPath,i.path,P);U.success?o({title:"Opening comparison",description:"Documents opening in Word side by side",variant:"default"}):o({title:"Compare failed",description:U.error,variant:"destructive"})}catch(v){Y.error("Failed to open comparison:",v),o({title:"Compare failed",description:v instanceof Error?v.message:void 0,variant:"destructive"})}},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded hover:bg-blue-50 dark:hover:bg-blue-950",title:"Compare before/after in Word",children:e.jsx(qt,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),i.path&&e.jsx("button",{onClick:async()=>{try{await window.electronAPI.showInFolder(i.path)}catch(v){Y.error("Failed to open file location:",v)}},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-background",title:"Open file location",children:e.jsx(et,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("button",{onClick:()=>C(x.id,i.id),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-background",children:e.jsx(Be,{className:"w-4 h-4 text-muted-foreground"})})]})]},i.id))})}),e.jsx("div",{className:I("mt-4 border-2 border-dashed rounded-lg p-4 text-center transition-colors",g?"border-primary bg-primary/5":"border-border"),onDragOver:L,onDragLeave:Te,onDrop:Ie,children:e.jsx("p",{className:"text-sm text-muted-foreground",children:g?"Drop files here to add":"Drag and drop more files here"})})]})})]})]}),gt=()=>{x&&(B(x.id),o({title:"Settings reset",variant:"default"}))},ft=()=>{x&&(V(x.id),o({title:"Saved as default",variant:"success"}))},Ge=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{size:"xs",variant:"ghost",onClick:gt,className:"text-xs",icon:e.jsx(Xt,{className:"w-3 h-3"}),children:"Reset"}),e.jsx(G,{size:"xs",variant:"outline",onClick:ft,className:"text-xs",icon:e.jsx(tt,{className:"w-3 h-3"}),children:"Save as Default"})]}),bt={processing:Ge,styles:Ge},vt=[{id:"session",label:`Session: ${x.name}`,content:Le},{id:"processing",label:"Processing Options",content:e.jsx(Ns,{sessionId:x.id,options:Ne,onOptionsChange:ne,autoAcceptRevisions:x.processingOptions?.autoAcceptRevisions??!1,onAutoAcceptRevisionsChange:N})},{id:"styles",label:"Styles",content:e.jsx(Is,{initialStyles:x.styles,initialListBulletSettings:x.listBulletSettings,onStylesChange:i=>{M(x.id,i)},onListBulletSettingsChange:i=>{O(x.id,i)},tableHeader2Shading:x.tableShadingSettings?.header2Shading||"#BFBFBF",tableOtherShading:x.tableShadingSettings?.otherShading||"#DFDFDF",imageBorderWidth:x.tableShadingSettings?.imageBorderWidth??1,padding1x1Top:x.tableShadingSettings?.padding1x1Top??0,padding1x1Bottom:x.tableShadingSettings?.padding1x1Bottom??0,padding1x1Left:x.tableShadingSettings?.padding1x1Left??.08,padding1x1Right:x.tableShadingSettings?.padding1x1Right??.08,paddingOtherTop:x.tableShadingSettings?.paddingOtherTop??0,paddingOtherBottom:x.tableShadingSettings?.paddingOtherBottom??0,paddingOtherLeft:x.tableShadingSettings?.paddingOtherLeft??.08,paddingOtherRight:x.tableShadingSettings?.paddingOtherRight??.08,cellBorderThickness:x.tableShadingSettings?.cellBorderThickness??.5,onTableShadingChange:se})},{id:"replacements",label:"Replacements",content:e.jsx(ys,{sessionId:x.id})},{id:"tracked-changes",label:"Document Changes",content:e.jsx(gs,{sessionId:x.id,expandDocumentId:ce,onExpandHandled:()=>m(null)})}];return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(rs,{toasts:l,onDismiss:n}),e.jsx("div",{className:"sticky top-0 z-30 bg-background p-6 pb-0 max-w-6xl mx-auto w-full",children:e.jsx("div",{className:"flex items-center gap-2 mb-6",children:k?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:T,onChange:i=>H(i.target.value),onKeyDown:i=>{i.key==="Enter"&&te(),i.key==="Escape"&&J()},className:"text-3xl font-bold bg-transparent border-b-2 border-primary outline-none px-1",autoFocus:!0}),e.jsx("button",{onClick:te,className:"p-1.5 rounded-lg hover:bg-muted transition-colors",children:e.jsx(xe,{className:"w-5 h-5 text-green-500"})}),e.jsx("button",{onClick:J,className:"p-1.5 rounded-lg hover:bg-muted transition-colors",children:e.jsx(Be,{className:"w-5 h-5 text-red-500"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-3xl font-bold",children:x.name}),x.status==="closed"&&e.jsx("span",{className:"text-sm px-2 py-1 rounded bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:"Closed"}),e.jsx("button",{onClick:E,className:"p-1.5 rounded-lg hover:bg-muted transition-colors",title:"Edit session name",children:e.jsx(Gt,{className:"w-4 h-4 text-muted-foreground"})})]})})}),e.jsx("div",{className:"flex-1 overflow-auto px-6 max-w-6xl mx-auto w-full",children:e.jsx(le,{children:e.jsx(As,{tabs:vt,defaultTab:"session",headerActions:bt,activeTabId:b,onTabChange:i=>R(i)})})}),e.jsx(ls,{open:K!==null,onOpenChange:i=>!i&&z(null),documentName:K?.name??"",errors:K?.errors??[],errorType:K?.errorType,processedAt:K?.processedAt})]})}export{$s as CurrentSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a6 as v,a7 as P,a8 as I,r as L,j as e,m as a,a9 as N,F as R,aa as y,ab as z,ac as B,M as E,n as b,ad as U}from"./vendor-ui-BU7NfluV.js";import{u as q,a as A,B as l,c}from"./index-8xUe8ptc.js";import{C as w,a as S,b as O,c as Y,d as J}from"./Card-IAZin8kp.js";import{S as K}from"./SessionManager-lH9hZfzH.js";import{u as Q,r as k}from"./vendor-react-BVZ_anCF.js";import"./vendor-charts-RkGK5ROP.js";import"./Input-l89xwXBi.js";const W={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},m={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.5}}};function ne(){const{recentSessions:x,loadSession:C}=q(),{stats:t,getTodayStats:M,getTodayChange:T}=A(),g=Q(),[F,o]=k.useState(!1),[V,h]=k.useState("new"),n=M(),r=T(),$=[{title:"Documents Processed",value:t.allTime.documentsProcessed.toString(),todayValue:n.documentsProcessed,change:r.documentsProcessed||0,icon:v,gradient:"from-green-400 to-emerald-600",bgGradient:"from-green-500/20 to-emerald-500/10"},{title:"Hyperlinks Checked",value:t.allTime.hyperlinksChecked.toString(),todayValue:n.hyperlinksChecked,change:r.hyperlinksChecked||0,icon:P,gradient:"from-blue-400 to-indigo-600",bgGradient:"from-blue-500/20 to-indigo-500/10"},{title:"Feedback Imported",value:t.allTime.feedbackImported.toString(),todayValue:n.feedbackImported,change:r.feedbackImported||0,icon:I,gradient:"from-purple-400 to-pink-600",bgGradient:"from-purple-500/20 to-pink-500/10"},{title:"Time Saved",value:`${t.allTime.timeSaved}m`,todayValue:n.timeSaved,change:r.timeSaved||0,icon:L,gradient:"from-orange-400 to-red-600",bgGradient:"from-orange-500/20 to-red-500/10"}],u=()=>{h("new"),o(!0)},D=()=>{h("load"),o(!0)},p=s=>{g(`/session/${s}`)},G=s=>{C(s),g(`/session/${s}`)},H=s=>{const j=new Date().getTime()-s.getTime(),i=Math.floor(j/(1e3*60*60));if(i<1)return`${Math.floor(j/6e4)} minutes ago`;if(i<24)return`${i} hours ago`;{const d=Math.floor(i/24);return`${d} day${d>1?"s":""} ago`}};return e.jsxs(a.div,{className:"p-6 space-y-6",variants:W,initial:"hidden",animate:"visible",children:[e.jsx(a.div,{className:"flex justify-end",variants:m,children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l,{onClick:u,variant:"default",size:"sm",icon:e.jsx(N,{className:"w-4 h-4"}),children:"New Session"}),e.jsx(l,{onClick:D,variant:"outline",size:"sm",icon:e.jsx(R,{className:"w-4 h-4"}),children:"Load Session"})]})}),e.jsx(a.div,{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",variants:m,children:$.map(s=>{const f=s.icon;return e.jsx(a.div,{whileHover:{y:-4},transition:{duration:.2},children:e.jsxs(w,{className:"relative overflow-hidden group cursor-pointer border-0 shadow-lg hover:shadow-2xl transition-all",children:[e.jsx("div",{className:c("absolute inset-0 bg-linear-to-br opacity-5 group-hover:opacity-10 transition-opacity",s.bgGradient)}),e.jsxs(S,{className:"p-6 relative",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:c("p-3 rounded-xl bg-linear-to-br",s.gradient,"shadow-lg"),children:e.jsx(f,{className:"w-6 h-6 text-white"})}),e.jsx(a.button,{whileHover:{scale:1.1},whileTap:{scale:.95},className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(y,{className:"w-4 h-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-foreground uppercase tracking-wide",children:s.title}),e.jsx("p",{className:"text-3xl font-bold tracking-tight",children:s.value}),e.jsx("div",{className:"flex items-center gap-2 pt-2",children:s.todayValue>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-1",children:s.change>0?e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx(z,{className:"w-3 h-3"}),e.jsxs("span",{children:["+",s.change]})]}):s.change<0?e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",children:[e.jsx(B,{className:"w-3 h-3"}),e.jsx("span",{children:s.change})]}):e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-muted text-muted-foreground",children:[e.jsx(E,{className:"w-3 h-3"}),e.jsx("span",{children:"No change"})]})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"vs yesterday"})]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"No activity today"})})]})]})]})},s.title)})}),e.jsx(a.div,{variants:m,children:e.jsxs(w,{children:[e.jsxs(O,{children:[e.jsx(Y,{children:"Recent Sessions"}),e.jsx(J,{children:"Your recently accessed document processing sessions"})]}),e.jsx(S,{children:x.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(b,{className:"w-12 h-12 mx-auto text-muted-foreground mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No sessions yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Create a new session to start processing documents"}),e.jsx(l,{onClick:u,variant:"outline",size:"sm",className:"mt-4",icon:e.jsx(N,{className:"w-4 h-4"}),children:"Create First Session"})]}):e.jsx("div",{className:"space-y-3",children:x.map(s=>e.jsxs(a.div,{className:"flex items-center justify-between p-4 rounded-lg border border-border hover:bg-muted/50 transition-all cursor-pointer group",whileHover:{x:4},onClick:()=>G(s.id),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(b,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium",children:s.name}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(v,{className:"w-3 h-3"}),s.documents.length," documents"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3"}),H(s.lastModified)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:c("text-xs px-2 py-1 rounded-full",s.status==="active"?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-muted text-muted-foreground"),children:s.status}),e.jsx(y,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]},s.id))})})]})}),F&&e.jsx(K,{mode:V,onClose:()=>o(!1),onSessionCreated:p,onSessionLoaded:p})]})}export{ne as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,n as m,aW as g,r as j,N as f,x as D,m as F,F as I}from"./vendor-ui-BU7NfluV.js";import{r as h}from"./vendor-react-BVZ_anCF.js";import{u as A,B as l,c as L,l as o}from"./index-8xUe8ptc.js";import{C as c,a as i,b as N,c as w}from"./Card-IAZin8kp.js";import{I as O}from"./Input-l89xwXBi.js";import"./vendor-charts-RkGK5ROP.js";function Q(){const{sessions:p}=A(),[a,v]=h.useState(""),[r,d]=h.useState("all"),n=h.useMemo(()=>{const s=[];return p.forEach(t=>{t.documents.forEach(u=>{s.push({...u,sessionName:t.name,sessionId:t.id})})}),s},[p]),x=h.useMemo(()=>n.filter(s=>{const t=a===""||s.name.toLowerCase().includes(a.toLowerCase())||s.sessionName.toLowerCase().includes(a.toLowerCase()),u=r==="all"||s.status===r;return t&&u}),[n,a,r]),b=async s=>{if(!s){o.warn("No path available for document");return}try{await window.electronAPI.showInFolder(s)}catch(t){o.error("Failed to open file location:",t)}},y=async s=>{if(!s){o.warn("No path available for document");return}try{await window.electronAPI.openDocument(s),o.info("Document opened successfully")}catch(t){o.error("Failed to open document:",t)}},C=s=>{switch(s){case"completed":return e.jsx(g,{className:"w-4 h-4 text-green-500"});case"error":return e.jsx(f,{className:"w-4 h-4 text-red-500"});case"pending":return e.jsx(j,{className:"w-4 h-4 text-muted-foreground"});default:return e.jsx(m,{className:"w-4 h-4 text-muted-foreground"})}},k=s=>{const t={completed:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",error:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",pending:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",processing:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"};return e.jsx("span",{className:L("px-2 py-1 text-xs rounded-full font-medium",t[s]),children:s.charAt(0).toUpperCase()+s.slice(1)})},S=s=>s?new Date(s).toLocaleString():"N/A";return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Documents"}),e.jsx("p",{className:"text-muted-foreground",children:"View and manage all processed documents across all sessions"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(c,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-foreground",children:"Total"}),e.jsx("p",{className:"text-2xl font-bold",children:n.length})]})]})})}),e.jsx(c,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-foreground",children:"Completed"}),e.jsx("p",{className:"text-2xl font-bold",children:n.filter(s=>s.status==="completed").length})]})]})})}),e.jsx(c,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(j,{className:"w-8 h-8 text-yellow-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-foreground",children:"Pending"}),e.jsx("p",{className:"text-2xl font-bold",children:n.filter(s=>s.status==="pending").length})]})]})})}),e.jsx(c,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{className:"w-8 h-8 text-red-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-foreground",children:"Errors"}),e.jsx("p",{className:"text-2xl font-bold",children:n.filter(s=>s.status==="error").length})]})]})})})]}),e.jsxs(c,{children:[e.jsx(N,{children:e.jsx(w,{children:"Filters"})}),e.jsx(i,{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx(O,{type:"search",placeholder:"Search documents...",value:a,onChange:s=>v(s.target.value),leftIcon:e.jsx(D,{className:"w-4 h-4"})})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l,{variant:r==="all"?"default":"outline",size:"sm",onClick:()=>d("all"),children:"All"}),e.jsx(l,{variant:r==="completed"?"default":"outline",size:"sm",onClick:()=>d("completed"),children:"Completed"}),e.jsx(l,{variant:r==="pending"?"default":"outline",size:"sm",onClick:()=>d("pending"),children:"Pending"}),e.jsx(l,{variant:r==="error"?"default":"outline",size:"sm",onClick:()=>d("error"),children:"Errors"})]})]})})]}),e.jsxs(c,{children:[e.jsx(N,{children:e.jsxs(w,{children:[x.length," Document",x.length!==1?"s":""]})}),e.jsx(i,{children:x.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(m,{className:"w-16 h-16 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No documents found"}),e.jsx("p",{className:"text-muted-foreground",children:a||r!=="all"?"Try adjusting your filters":"Start by creating a session and adding documents"})]}):e.jsx("div",{className:"space-y-2",children:x.map(s=>e.jsxs(F.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex items-center justify-between p-4 rounded-lg border border-border hover:bg-muted/50 transition-all group",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[C(s.status),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"truncate",children:s.sessionName}),s.processedAt&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:S(s.processedAt)})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[k(s.status),s.status==="completed"&&s.path&&e.jsx(l,{variant:"ghost",size:"xs",icon:e.jsx(m,{className:"w-4 h-4"}),onClick:()=>y(s.path),title:"Open document in Word",className:"text-green-600 hover:text-green-700 hover:bg-green-50 dark:text-green-400 dark:hover:bg-green-950",children:"Open Document"}),s.path&&e.jsx(l,{variant:"ghost",size:"xs",icon:e.jsx(I,{className:"w-4 h-4"}),onClick:()=>b(s.path),title:"Open file location",children:"Open Location"})]})]},`${s.sessionId}-${s.id}`))})})]})]})}export{Q as Documents};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,x as v,b4 as j,b5 as N,X as w}from"./vendor-ui-BU7NfluV.js";import{r as n}from"./vendor-react-BVZ_anCF.js";import{c as y}from"./index-8xUe8ptc.js";const k=n.forwardRef(({className:f,type:o="text",label:u,error:s,helperText:c,leftIcon:l,rightIcon:d,onClear:r,id:b,...a},h)=>{const[i,g]=n.useState(!1),p=n.useId(),m=b||p,t=o==="password",x=o==="search";return e.jsxs("div",{className:"w-full",children:[u&&e.jsxs("label",{htmlFor:m,className:"block text-sm font-medium text-foreground mb-1.5",children:[u,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:l}),x&&e.jsx(v,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx("input",{id:m,type:t&&i?"text":o,className:y("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-200",s&&"border-destructive focus-visible:ring-destructive",(l||x)&&"pl-10",(d||t||r&&a.value)&&"pr-10",f),ref:h,...a}),t&&e.jsx("button",{type:"button",onClick:()=>g(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:i?e.jsx(j,{className:"w-4 h-4"}):e.jsx(N,{className:"w-4 h-4"})}),r&&a.value&&!t&&e.jsx("button",{type:"button",onClick:r,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:e.jsx(w,{className:"w-4 h-4"})}),d&&!t&&!r&&e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:d})]}),s&&e.jsx("p",{className:"mt-1.5 text-sm text-destructive",role:"alert",children:s}),c&&!s&&e.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:c})]})});k.displayName="Input";export{k as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,m,o as K,a5 as L,J as M,n as w,I as O,a_ as V,ag as P,aW as Z,N as q}from"./vendor-ui-BU7NfluV.js";import{r as d}from"./vendor-react-BVZ_anCF.js";import{C,b as S,c as R,d as J,a as A}from"./Card-IAZin8kp.js";import{u as U,B as W,c as a,l as Q}from"./index-8xUe8ptc.js";import{u as X,T as Y}from"./useToast-yRSO1dkm.js";import"./vendor-charts-RkGK5ROP.js";const ee={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},x={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.5}}},de=d.memo(function(){const{sessions:N}=U(),{toasts:E,toast:g,dismiss:F}=X(),[o,f]=d.useState(new Set),[r,v]=d.useState("bug"),[n,k]=d.useState(!1),[b,T]=d.useState(!1),[z,l]=d.useState(0),j=d.useMemo(()=>{const s=[];return N.forEach(t=>{t.documents.forEach(i=>{(i.status==="completed"||i.status==="error")&&s.push({...i,sessionName:t.name,sessionId:t.id,backupPath:i.processingResult?.backupPath})})}),s.sort((t,i)=>{const c=t.processedAt?new Date(t.processedAt).getTime():0;return(i.processedAt?new Date(i.processedAt).getTime():0)-c}).slice(0,10)},[N]),D=n||o.size>0,I=s=>{if(n)return;const t=new Set(o);t.has(s)?t.delete(s):t.size<3&&t.add(s),f(t)},G=()=>{n||f(new Set),k(!n)},B=async()=>{T(!0),l(0);try{const t=`DocHub_Report_${Date.now()}`,c=`${await window.electronAPI.getDownloadsPath()}\\${t}`;await window.electronAPI.createFolder(c),l(10);let u="";if(!n&&o.size>0){const y=Array.from(o);for(let p=0;p<y.length;p++){const h=j.find($=>$.id===y[p]);h?.path&&(await window.electronAPI.copyFileToFolder(h.path,c),h.backupPath&&await window.electronAPI.copyFileToFolder(h.backupPath,c)),l(10+(p+1)*60/y.length)}u=await window.electronAPI.createReportZip(c,`${t}.zip`),l(85)}else l(85);const H=r==="bug"?"Bug Report: Documentation Hub":"Kudos: Documentation Hub",_=await window.electronAPI.openOutlookEmail(H,u);l(100),_.method==="mailto"&&u?g({title:"Email draft opened",description:"Please attach the ZIP file from the opened folder.",variant:"success",duration:6e3}):g({title:"Email draft opened",variant:"success"})}catch(s){Q.error("Failed to generate email:",s),g({title:"Failed to generate email",variant:"destructive"})}finally{T(!1),f(new Set),k(!1)}};return e.jsxs(m.div,{variants:ee,initial:"hidden",animate:"visible",className:"p-6 max-w-[1000px] mx-auto space-y-6",children:[e.jsxs(m.div,{variants:x,className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold mb-2 flex items-center gap-2",children:[e.jsx(K,{className:"w-8 h-8"}),"Reporting"]}),e.jsx("p",{className:"text-muted-foreground",children:"Generate bug reports or kudos emails"})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsx(W,{onClick:B,disabled:!D||b,className:a("gap-2",D&&"bg-primary hover:bg-primary/90"),children:b?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-5 h-5 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"w-5 h-5"}),"Generate Email"]})}),b&&e.jsx("div",{className:"h-2 w-40 bg-muted rounded-full overflow-hidden",children:e.jsx(m.div,{className:"h-full bg-primary",initial:{width:0},animate:{width:`${z}%`},transition:{duration:.3}})})]})]}),e.jsx(m.div,{variants:x,children:e.jsxs(C,{children:[e.jsxs(S,{children:[e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Report Type"]}),e.jsx(J,{children:"Select the type of report you want to generate"})]}),e.jsxs(A,{className:"flex gap-4",children:[e.jsxs("label",{className:a("flex items-center gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors flex-1",r==="bug"?"bg-primary/10 border-2 border-primary":"bg-muted/30 border-2 border-transparent hover:bg-muted/50"),children:[e.jsx("input",{type:"radio",name:"reportType",checked:r==="bug",onChange:()=>v("bug"),className:"sr-only"}),e.jsx("div",{className:a("w-5 h-5 rounded-full border-2 flex items-center justify-center",r==="bug"?"border-primary":"border-muted-foreground"),children:r==="bug"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary"})}),e.jsx(O,{className:a("w-5 h-5",r==="bug"?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:a("font-medium",r==="bug"?"text-foreground":"text-muted-foreground"),children:"Bug Report"})]}),e.jsxs("label",{className:a("flex items-center gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors flex-1",r==="kudos"?"bg-primary/10 border-2 border-primary":"bg-muted/30 border-2 border-transparent hover:bg-muted/50"),children:[e.jsx("input",{type:"radio",name:"reportType",checked:r==="kudos",onChange:()=>v("kudos"),className:"sr-only"}),e.jsx("div",{className:a("w-5 h-5 rounded-full border-2 flex items-center justify-center",r==="kudos"?"border-primary":"border-muted-foreground"),children:r==="kudos"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary"})}),e.jsx(V,{className:a("w-5 h-5",r==="kudos"?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:a("font-medium",r==="kudos"?"text-foreground":"text-muted-foreground"),children:"Kudos"})]})]})]})}),e.jsx(m.div,{variants:x,children:e.jsx("p",{className:"text-muted-foreground text-sm",children:'This section will help you send documents quickly for troubleshooting or reviewing purposes. Select up to three documents in the list below. Only processed or errored documents are shown. Ensure the correct "Report Type" is selected: "Bug Report" or "Kudos". Then click on the "Generate Email" button. This application will make a copy of both the backup file and the processed file, create a new folder within your Downloads folder starting with "DocHub_Report_". It will then zip it up, bring up a blank email, and automatically attach this zip file. Thanks for the report or feedback!'})}),e.jsx(m.div,{variants:x,children:e.jsxs(C,{children:[e.jsx(S,{children:e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5"}),"Select Documents"]})}),e.jsxs(A,{className:"space-y-2",children:[j.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(w,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No recently processed documents"}),e.jsx("p",{className:"text-sm",children:"Process some documents first to include them in reports"})]}):e.jsx(e.Fragment,{children:j.map(s=>e.jsxs("div",{onClick:()=>I(s.id),className:a("flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-colors",o.has(s.id)?"bg-primary/10 border border-primary":"bg-muted/30 hover:bg-muted/50 border border-transparent",n&&"opacity-50 cursor-not-allowed"),children:[e.jsx("div",{className:a("w-5 h-5 rounded border-2 flex items-center justify-center flex-shrink-0",o.has(s.id)?"bg-primary border-primary":"border-muted-foreground"),children:o.has(s.id)&&e.jsx(P,{className:"w-3 h-3 text-primary-foreground"})}),s.status==="completed"?e.jsx(Z,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):e.jsx(q,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"truncate block",children:s.name}),e.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:s.sessionName})]})]},s.id))}),e.jsx("div",{className:"pt-4 border-t border-border mt-4",children:e.jsxs("div",{onClick:G,className:a("flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-colors",n?"bg-primary/10 border border-primary":"bg-muted/30 hover:bg-muted/50 border border-transparent"),children:[e.jsx("div",{className:a("w-5 h-5 rounded border-2 flex items-center justify-center flex-shrink-0",n?"bg-primary border-primary":"border-muted-foreground"),children:n&&e.jsx(P,{className:"w-3 h-3 text-primary-foreground"})}),e.jsx("span",{className:"font-medium",children:"No Document (text-only report)"})]})}),o.size>0&&e.jsxs("p",{className:"text-sm text-muted-foreground pt-2",children:[o.size," of 3 documents selected"]})]})]})}),e.jsx(Y,{toasts:E,onDismiss:F})]})});export{de as Reporting};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,m as c,x as g,aF as I,F as D,ad as A,q as $,n as M,b3 as R,r as q,av as L}from"./vendor-ui-BU7NfluV.js";import{r as a,u as O}from"./vendor-react-BVZ_anCF.js";import{F as V}from"./vendor-search-Dw8P0qyA.js";import{C as z,a as B}from"./Card-IAZin8kp.js";import{I as Q}from"./Input-l89xwXBi.js";import{u as T,B as v,c as b}from"./index-8xUe8ptc.js";import"./vendor-charts-RkGK5ROP.js";const U={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.05}}},d={hidden:{opacity:0,y:10},visible:{opacity:1,y:0,transition:{duration:.3}}},Z=a.memo(function(){const[o,y]=a.useState(""),[m,w]=a.useState("all"),[u,S]=a.useState("all"),[i,x]=a.useState(0),[h,C]=a.useState(!1),{sessions:p}=T(),k=O(),f=a.useRef(null),l=a.useMemo(()=>{const s=[];return p.forEach(t=>{t.documents.forEach(n=>{s.push({...n,sessionId:t.id,sessionName:t.name})})}),s},[p]),j=a.useMemo(()=>new V(l,{keys:[{name:"name",weight:2},{name:"sessionName",weight:1},{name:"path",weight:.5}],threshold:.4,includeScore:!0}),[l]),r=a.useMemo(()=>{let s=o?j.search(o).map(t=>t.item):l;return m!=="all"&&(s=s.filter(t=>t.status===m)),u!=="all"&&(s=s.filter(t=>t.sessionId===u)),s},[o,m,u,j,l]);a.useEffect(()=>{const s=t=>{r.length&&(t.key==="ArrowDown"?(t.preventDefault(),x(n=>n<r.length-1?n+1:n)):t.key==="ArrowUp"?(t.preventDefault(),x(n=>n>0?n-1:n)):t.key==="Enter"&&r[i]&&(t.preventDefault(),N(r[i])))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r,i]),a.useEffect(()=>{x(0)},[r]),a.useEffect(()=>{if(f.current){const s=f.current.querySelector(`[data-index="${i}"]`);s&&s.scrollIntoView({block:"nearest",behavior:"smooth"})}},[i]);const N=s=>{k(`/session/${s.sessionId}`)},E=s=>{switch(s){case"completed":return e.jsx(L,{className:"w-4 h-4 text-green-500"});case"pending":return e.jsx(q,{className:"w-4 h-4 text-yellow-500"});case"error":return e.jsx(R,{className:"w-4 h-4 text-red-500"});default:return e.jsx(M,{className:"w-4 h-4 text-muted-foreground"})}},F=[{value:"all",label:"All Status",count:l.length},{value:"completed",label:"Completed",count:l.filter(s=>s.status==="completed").length},{value:"pending",label:"Pending",count:l.filter(s=>s.status==="pending").length},{value:"error",label:"Error",count:l.filter(s=>s.status==="error").length}];return e.jsxs(c.div,{variants:U,initial:"hidden",animate:"visible",className:"p-6 space-y-6 max-w-[1200px] mx-auto",children:[e.jsxs(c.div,{variants:d,children:[e.jsxs("h1",{className:"text-3xl font-bold mb-2 flex items-center gap-2",children:[e.jsx(g,{className:"w-8 h-8"}),"Search Documents"]}),e.jsx("p",{className:"text-muted-foreground",children:"Find documents across all sessions with advanced filtering"})]}),e.jsxs(c.div,{variants:d,className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Q,{type:"text",placeholder:"Search by document name, session, or path...",value:o,onChange:s=>y(s.target.value),className:"w-full pl-10 pr-12 h-12 text-lg",autoFocus:!0}),e.jsx(g,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx(v,{variant:h?"default":"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2",onClick:()=>C(!h),children:e.jsx(I,{className:"w-4 h-4"})})]}),h&&e.jsxs(c.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 bg-muted/30 rounded-lg border border-border",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Status"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:F.map(s=>e.jsxs(v,{variant:m===s.value?"default":"outline",size:"sm",onClick:()=>w(s.value),className:"gap-2",children:[s.label,e.jsxs("span",{className:"text-xs opacity-70",children:["(",s.count,")"]})]},s.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Session"}),e.jsxs("select",{value:u,onChange:s=>S(s.target.value),className:"w-full h-9 px-3 rounded-md border border-input bg-background",children:[e.jsx("option",{value:"all",children:"All Sessions"}),p.map(s=>e.jsxs("option",{value:s.id,children:[s.name," (",s.documents.length,")"]},s.id))]})]})]})]}),e.jsxs(c.div,{variants:d,className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[r.length," ",r.length===1?"result":"results"," found",o&&e.jsxs("span",{className:"ml-1",children:['for "',e.jsx("span",{className:"font-semibold text-foreground",children:o}),'"']})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs ml-1",children:"↓"})," to navigate,",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs ml-1",children:"Enter"})," to open"]})]}),e.jsx(c.div,{variants:d,className:"space-y-2",ref:f,children:r.length===0?e.jsx(z,{className:"border-dashed",children:e.jsxs(B,{className:"pt-12 pb-12 text-center",children:[e.jsx(g,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-lg font-medium mb-1",children:"No documents found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search query or filters"})]})}):r.map((s,t)=>e.jsx(c.div,{"data-index":t,variants:d,onClick:()=>N(s),onMouseEnter:()=>x(t),className:b("p-4 rounded-lg border cursor-pointer transition-all duration-150","hover:border-primary hover:bg-accent/50",i===t?"border-primary bg-accent/50 shadow-xs":"border-border bg-card"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[E(s.status),e.jsx("h3",{className:"font-medium truncate",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),s.sessionName]}),s.processedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),new Date(s.processedAt).toLocaleDateString()]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:s.path})]}),e.jsx($,{className:b("w-5 h-5 text-muted-foreground transition-transform",i===t&&"text-primary translate-x-1")})]})},`${s.sessionId}-${s.id}`))})]})});export{Z as Search};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,A as w,m as i,X as y,a9 as v,F as c,ad as S,n as k}from"./vendor-ui-BU7NfluV.js";import{u as C,B as d,c as m}from"./index-8xUe8ptc.js";import{I as F}from"./Input-l89xwXBi.js";import{r as x,a as E}from"./vendor-react-BVZ_anCF.js";function P({mode:n,onClose:t,onSessionCreated:u,onSessionLoaded:h}){const{sessions:l,createSession:p,loadSession:g}=C(),[r,j]=x.useState(""),[a,f]=x.useState(null),o=()=>{if(r.trim()){let s;E.flushSync(()=>{s=p(r.trim())}),u(s.id),t()}},N=()=>{a&&(g(a),h(a),t())},b=s=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(s);return e.jsx(w,{children:e.jsx(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-background/80 backdrop-blur-xs z-50 flex items-center justify-center p-4",onClick:t,children:e.jsxs(i.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-card rounded-xl shadow-2xl border border-border max-w-md w-full max-h-[80vh] overflow-hidden",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:n==="new"?"New Session":"Load Session"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:n==="new"?"Create a new document processing session":"Select a session to continue working"})]}),e.jsx("button",{onClick:t,className:"p-2 rounded-lg hover:bg-muted transition-colors",children:e.jsx(y,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-6",children:n==="new"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{label:"Session Name",placeholder:"Enter session name",value:r,onChange:s=>j(s.target.value),onKeyDown:s=>{s.key==="Enter"&&o()},autoFocus:!0}),e.jsx(d,{onClick:o,className:"w-full",disabled:!r.trim(),icon:e.jsx(v,{className:"w-4 h-4"}),children:"Create Session"})]}):e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(c,{className:"w-12 h-12 mx-auto text-muted-foreground mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No sessions available"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Create a new session to get started"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:l.map(s=>e.jsx(i.div,{className:m("p-4 rounded-lg border cursor-pointer transition-all",a===s.id?"border-primary bg-primary/5":"border-border hover:bg-muted/50"),onClick:()=>f(s.id),whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.name}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mt-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"w-3 h-3"}),b(s.createdAt)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(k,{className:"w-3 h-3"}),s.documents.length," documents"]})]})]}),e.jsx("span",{className:m("text-xs px-2 py-1 rounded-full",s.status==="active"?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"),children:s.status})]})},s.id))}),e.jsx(d,{onClick:N,className:"w-full",disabled:!a,icon:e.jsx(c,{className:"w-4 h-4"}),children:"Load Session"})]})})})]})})})}export{P as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,m as a,aX as F,aH as M,a9 as v,F as N,a1 as P,n as z,r as I,ad as V}from"./vendor-ui-BU7NfluV.js";import{u as A,c as d,B as l}from"./index-8xUe8ptc.js";import{C as B,b as E,c as G,a as H}from"./Card-IAZin8kp.js";import{I as Q}from"./Input-l89xwXBi.js";import{S as $}from"./SessionManager-lH9hZfzH.js";import{u as q,r as o}from"./vendor-react-BVZ_anCF.js";import"./vendor-charts-RkGK5ROP.js";const b={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},c={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.5}}};function Y(){const m=q(),{sessions:y,loadSession:w,deleteSession:C}=A(),[t,x]=o.useState(""),[i,u]=o.useState("grid"),[S,h]=o.useState(!1),[k,n]=o.useState(null),g=y.filter(s=>s.name.toLowerCase().includes(t.toLowerCase())),D=s=>{w(s),m(`/session/${s}`)},L=(s,r)=>{r.stopPropagation(),n(s)},T=s=>{C(s),n(null)},p=s=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(s),j=()=>{h(!0)},f=s=>{m(`/session/${s}`)};return e.jsxs(a.div,{className:"p-6 space-y-6",variants:b,initial:"hidden",animate:"visible",children:[e.jsxs(a.div,{className:"flex flex-col sm:flex-row gap-4 justify-between",variants:c,children:[e.jsx(Q,{type:"search",placeholder:"Search sessions...",value:t,onChange:s=>x(s.target.value),onClear:()=>x(""),className:"max-w-md"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex rounded-md border border-border",children:[e.jsx("button",{onClick:()=>u("grid"),className:d("p-2 rounded-l-md transition-colors",i==="grid"?"bg-primary text-primary-foreground":"hover:bg-muted"),"aria-label":"Grid view",children:e.jsx(F,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>u("list"),className:d("p-2 rounded-r-md transition-colors",i==="list"?"bg-primary text-primary-foreground":"hover:bg-muted"),"aria-label":"List view",children:e.jsx(M,{className:"w-4 h-4"})})]}),e.jsx(l,{icon:e.jsx(v,{className:"w-4 h-4"}),onClick:j,children:"New Session"})]})]}),e.jsx(a.div,{className:d("grid gap-4",i==="grid"?"grid-cols-1 md:grid-cols-2 lg:grid-cols-3":"grid-cols-1"),variants:b,children:g.map(s=>e.jsxs(a.div,{variants:c,children:[e.jsxs(B,{interactive:!0,variant:"bordered",className:"cursor-pointer relative group",onClick:()=>D(s.id),children:[e.jsx(E,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(N,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(G,{className:"text-xl font-semibold",children:s.name}),e.jsx("span",{className:d("text-xs px-2 py-1 rounded-full mt-1 inline-block",s.status==="active"?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"),children:s.status})]})]}),e.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("button",{onClick:r=>L(s.id,r),className:"p-1 hover:bg-muted rounded",children:e.jsx(P,{className:"w-4 h-4 text-muted-foreground hover:text-destructive"})})})]})}),e.jsx(H,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-base",children:[e.jsxs("div",{className:"flex items-center gap-1 text-foreground",children:[e.jsx(z,{className:"w-3 h-3"}),e.jsxs("span",{children:[s.documents.length," documents"]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-foreground",children:[e.jsx(I,{className:"w-3 h-3"}),e.jsxs("span",{children:[s.stats.timeSaved,"m saved"]})]})]}),e.jsxs("div",{className:"pt-2 border-t border-border",children:[e.jsx("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"w-3 h-3"}),e.jsxs("span",{children:["Created ",p(s.createdAt)]})]})}),e.jsx("div",{className:"flex items-center justify-between text-sm text-muted-foreground mt-1",children:e.jsxs("span",{children:["Last modified ",p(s.lastModified)]})})]}),i==="list"&&e.jsxs("div",{className:"pt-2 grid grid-cols-4 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Processed"}),e.jsx("p",{className:"font-medium",children:s.stats.documentsProcessed})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Links"}),e.jsx("p",{className:"font-medium",children:s.stats.hyperlinksChecked})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Feedback"}),e.jsx("p",{className:"font-medium",children:s.stats.feedbackImported})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Time"}),e.jsxs("p",{className:"font-medium",children:[s.stats.timeSaved,"m"]})]})]})]})})]}),k===s.id&&e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},className:"fixed inset-0 bg-background/80 backdrop-blur-xs z-50 flex items-center justify-center p-4",onClick:()=>n(null),children:e.jsxs(a.div,{initial:{scale:.95},animate:{scale:1},className:"bg-card rounded-lg shadow-xl border border-border p-6 max-w-sm",onClick:r=>r.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Delete Session"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:['Are you sure you want to delete "',s.name,'"? This action cannot be undone.']}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(l,{variant:"outline",size:"sm",onClick:()=>n(null),children:"Cancel"}),e.jsx(l,{variant:"destructive",size:"sm",onClick:()=>T(s.id),children:"Delete"})]})]})})]},s.id))}),g.length===0&&e.jsxs(a.div,{variants:c,className:"text-center py-12",children:[e.jsx(N,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:t?"No sessions found":"No sessions yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:t?"Try adjusting your search query":"Create your first session to start processing documents"}),!t&&e.jsx(l,{onClick:j,icon:e.jsx(v,{className:"w-4 h-4"}),children:"Create First Session"})]}),S&&e.jsx($,{mode:"new",onClose:()=>h(!1),onSessionCreated:f,onSessionLoaded:f})]})}export{Y as Sessions};
|