From 9baad91fad2f0d66ba36c4307935f59e95586221 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Thu, 18 Dec 2025 11:43:50 +0000 Subject: [PATCH] Lazily load tools in tool registry to reduce chunk size --- .../core/data/useTranslatedToolRegistry.tsx | 239 ++++++------------ 1 file changed, 80 insertions(+), 159 deletions(-) diff --git a/frontend/src/core/data/useTranslatedToolRegistry.tsx b/frontend/src/core/data/useTranslatedToolRegistry.tsx index 0afbb500b..6b22d2700 100644 --- a/frontend/src/core/data/useTranslatedToolRegistry.tsx +++ b/frontend/src/core/data/useTranslatedToolRegistry.tsx @@ -1,19 +1,8 @@ -import { useMemo } from "react"; +import { useMemo, lazy } from "react"; import LocalIcon from "@app/components/shared/LocalIcon"; import { useTranslation } from "react-i18next"; import { devApiLink } from "@app/constants/links"; -import SplitPdfPanel from "@app/tools/Split"; -import CompressPdfPanel from "@app/tools/Compress"; -import OCRPanel from "@app/tools/OCR"; -import ConvertPanel from "@app/tools/Convert"; -import Sanitize from "@app/tools/Sanitize"; -import AddPassword from "@app/tools/AddPassword"; -import ChangePermissions from "@app/tools/ChangePermissions"; -import RemoveBlanks from "@app/tools/RemoveBlanks"; -import RemovePages from "@app/tools/RemovePages"; -import ReorganizePages from "@app/tools/ReorganizePages"; import { reorganizePagesOperationConfig } from "@app/hooks/tools/reorganizePages/useReorganizePagesOperation"; -import RemovePassword from "@app/tools/RemovePassword"; import { SubcategoryId, ToolCategoryId, @@ -23,34 +12,9 @@ import { LinkToolRegistry, } from "@app/data/toolsTaxonomy"; import { isSuperToolId, isLinkToolId } from '@app/types/toolId'; -import AdjustContrast from "@app/tools/AdjustContrast"; -import AdjustContrastSingleStepSettings from "@app/components/tools/adjustContrast/AdjustContrastSingleStepSettings"; import { adjustContrastOperationConfig } from "@app/hooks/tools/adjustContrast/useAdjustContrastOperation"; import { getSynonyms } from "@app/utils/toolSynonyms"; import { useProprietaryToolRegistry } from "@app/data/useProprietaryToolRegistry"; -import GetPdfInfo from "@app/tools/GetPdfInfo"; -import AddWatermark from "@app/tools/AddWatermark"; -import AddStamp from "@app/tools/AddStamp"; -import AddAttachments from "@app/tools/AddAttachments"; -import Merge from '@app/tools/Merge'; -import EditTableOfContents from '@app/tools/EditTableOfContents'; -import Repair from "@app/tools/Repair"; -import AutoRename from "@app/tools/AutoRename"; -import SingleLargePage from "@app/tools/SingleLargePage"; -import PageLayout from "@app/tools/PageLayout"; -import UnlockPdfForms from "@app/tools/UnlockPdfForms"; -import RemoveCertificateSign from "@app/tools/RemoveCertificateSign"; -import RemoveImage from "@app/tools/RemoveImage"; -import CertSign from "@app/tools/CertSign"; -import BookletImposition from "@app/tools/BookletImposition"; -import Flatten from "@app/tools/Flatten"; -import Rotate from "@app/tools/Rotate"; -import PdfTextEditor from "@app/tools/pdfTextEditor/PdfTextEditor"; -import ChangeMetadata from "@app/tools/ChangeMetadata"; -import Crop from "@app/tools/Crop"; -import Sign from "@app/tools/Sign"; -import AddText from "@app/tools/AddText"; -import AddImage from "@app/tools/AddImage"; import { compressOperationConfig } from "@app/hooks/tools/compress/useCompressOperation"; import { splitOperationConfig } from "@app/hooks/tools/split/useSplitOperation"; import { addPasswordOperationConfig } from "@app/hooks/tools/addPassword/useAddPasswordOperation"; @@ -88,50 +52,7 @@ import { scannerImageSplitOperationConfig } from "@app/hooks/tools/scannerImageS import { addPageNumbersOperationConfig } from "@app/components/tools/addPageNumbers/useAddPageNumbersOperation"; import { extractPagesOperationConfig } from "@app/hooks/tools/extractPages/useExtractPagesOperation"; import { ENDPOINTS as SPLIT_ENDPOINT_NAMES } from '@app/constants/splitConstants'; -import CompressSettings from "@app/components/tools/compress/CompressSettings"; -import AddPasswordSettings from "@app/components/tools/addPassword/AddPasswordSettings"; -import RemovePasswordSettings from "@app/components/tools/removePassword/RemovePasswordSettings"; -import SanitizeSettings from "@app/components/tools/sanitize/SanitizeSettings"; -import AddWatermarkSingleStepSettings from "@app/components/tools/addWatermark/AddWatermarkSingleStepSettings"; -import OCRSettings from "@app/components/tools/ocr/OCRSettings"; -import ConvertSettings from "@app/components/tools/convert/ConvertSettings"; -import ChangePermissionsSettings from "@app/components/tools/changePermissions/ChangePermissionsSettings"; -import BookletImpositionSettings from "@app/components/tools/bookletImposition/BookletImpositionSettings"; -import FlattenSettings from "@app/components/tools/flatten/FlattenSettings"; -import RedactSingleStepSettings from "@app/components/tools/redact/RedactSingleStepSettings"; -import Redact from "@app/tools/Redact"; -import AdjustPageScale from "@app/tools/AdjustPageScale"; -import ReplaceColor from "@app/tools/ReplaceColor"; -import ScannerImageSplit from "@app/tools/ScannerImageSplit"; -import OverlayPdfs from "@app/tools/OverlayPdfs"; import { ToolId } from "@app/types/toolId"; -import MergeSettings from '@app/components/tools/merge/MergeSettings'; -import AdjustPageScaleSettings from "@app/components/tools/adjustPageScale/AdjustPageScaleSettings"; -import ScannerImageSplitSettings from "@app/components/tools/scannerImageSplit/ScannerImageSplitSettings"; -import ChangeMetadataSingleStep from "@app/components/tools/changeMetadata/ChangeMetadataSingleStep"; -import SignSettings from "@app/components/tools/sign/SignSettings"; -import AddPageNumbers from "@app/tools/AddPageNumbers"; -import RemoveAnnotations from "@app/tools/RemoveAnnotations"; -import PageLayoutSettings from "@app/components/tools/pageLayout/PageLayoutSettings"; -import ExtractImages from "@app/tools/ExtractImages"; -import ExtractPages from "@app/tools/ExtractPages"; -import ExtractImagesSettings from "@app/components/tools/extractImages/ExtractImagesSettings"; -import ExtractPagesSettings from "@app/components/tools/extractPages/ExtractPagesSettings"; -import ReplaceColorSettings from "@app/components/tools/replaceColor/ReplaceColorSettings"; -import AddStampAutomationSettings from "@app/components/tools/addStamp/AddStampAutomationSettings"; -import CertSignAutomationSettings from "@app/components/tools/certSign/CertSignAutomationSettings"; -import CropAutomationSettings from "@app/components/tools/crop/CropAutomationSettings"; -import RotateAutomationSettings from "@app/components/tools/rotate/RotateAutomationSettings"; -import SplitAutomationSettings from "@app/components/tools/split/SplitAutomationSettings"; -import AddAttachmentsSettings from "@app/components/tools/addAttachments/AddAttachmentsSettings"; -import RemovePagesSettings from "@app/components/tools/removePages/RemovePagesSettings"; -import RemoveBlanksSettings from "@app/components/tools/removeBlanks/RemoveBlanksSettings"; -import AddPageNumbersAutomationSettings from "@app/components/tools/addPageNumbers/AddPageNumbersAutomationSettings"; -import OverlayPdfsSettings from "@app/components/tools/overlayPdfs/OverlayPdfsSettings"; -import ValidateSignature from "@app/tools/ValidateSignature"; -import ShowJS from "@app/tools/ShowJS"; -import Automate from "@app/tools/Automate"; -import Compare from "@app/tools/Compare"; import { CONVERT_SUPPORTED_FORMATS } from "@app/constants/convertSupportedFornats"; @@ -156,7 +77,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { pdfTextEditor: { icon: , name: t("home.pdfTextEditor.title", "PDF Text Editor"), - component: PdfTextEditor, + component: lazy(() => import("@app/tools/pdfTextEditor/PdfTextEditor")), description: t( "home.pdfTextEditor.desc", "Review and edit text and images in PDFs with grouped text editing and PDF regeneration" @@ -186,21 +107,21 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { merge: { icon: , name: t("home.merge.title", "Merge"), - component: Merge, + component: lazy(() => import("@app/tools/Merge")), description: t("home.merge.desc", "Merge multiple PDFs into a single document"), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, maxFiles: -1, endpoints: ["merge-pdfs"], operationConfig: mergeOperationConfig, - automationSettings: MergeSettings, + automationSettings: lazy(() => import("@app/components/tools/merge/MergeSettings")), synonyms: getSynonyms(t, "merge") }, // Signing certSign: { icon: , name: t("home.certSign.title", "Certificate Sign"), - component: CertSign, + component: lazy(() => import("@app/tools/CertSign")), description: t("home.certSign.desc", "Sign PDF documents using digital certificates"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.SIGNING, @@ -208,24 +129,24 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { maxFiles: -1, endpoints: ["cert-sign"], operationConfig: certSignOperationConfig, - automationSettings: CertSignAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/certSign/CertSignAutomationSettings")), }, sign: { icon: , name: t("home.sign.title", "Sign"), - component: Sign, + component: lazy(() => import("@app/tools/Sign")), description: t("home.sign.desc", "Adds signature to PDF by drawing, text or image"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.SIGNING, operationConfig: signOperationConfig, - automationSettings: SignSettings, // TODO:: not all settings shown, suggested next tools shown + automationSettings: lazy(() => import("@app/components/tools/sign/SignSettings")), // TODO:: not all settings shown, suggested next tools shown synonyms: getSynonyms(t, "sign"), supportsAutomate: false, //TODO make support Sign }, addText: { icon: , name: t('home.addText.title', 'Add Text'), - component: AddText, + component: lazy(() => import("@app/tools/AddText")), description: t('home.addText.desc', 'Add custom text anywhere in your PDF'), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.GENERAL, @@ -237,7 +158,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { addImage: { icon: , name: t('home.addImage.title', 'Add Image'), - component: AddImage, + component: lazy(() => import("@app/tools/AddImage")), description: t('home.addImage.desc', 'Add images anywhere in your PDF'), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.GENERAL, @@ -252,33 +173,33 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { addPassword: { icon: , name: t("home.addPassword.title", "Add Password"), - component: AddPassword, + component: lazy(() => import("@app/tools/AddPassword")), description: t("home.addPassword.desc", "Add password protection and restrictions to PDF files"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, maxFiles: -1, endpoints: ["add-password"], operationConfig: addPasswordOperationConfig, - automationSettings: AddPasswordSettings, + automationSettings: lazy(() => import("@app/components/tools/addPassword/AddPasswordSettings")), synonyms: getSynonyms(t, "addPassword") }, watermark: { icon: , name: t("home.watermark.title", "Add Watermark"), - component: AddWatermark, + component: lazy(() => import("@app/tools/AddWatermark")), maxFiles: -1, description: t("home.watermark.desc", "Add a custom watermark to your PDF document."), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, endpoints: ["add-watermark"], operationConfig: addWatermarkOperationConfig, - automationSettings: AddWatermarkSingleStepSettings, + automationSettings: lazy(() => import("@app/components/tools/addWatermark/AddWatermarkSingleStepSettings")), synonyms: getSynonyms(t, "watermark") }, addStamp: { icon: , name: t("home.addStamp.title", "Add Stamp to PDF"), - component: AddStamp, + component: lazy(() => import("@app/tools/AddStamp")), description: t("home.addStamp.desc", "Add text or add image stamps at set locations"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, @@ -286,38 +207,38 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { maxFiles: -1, endpoints: ["add-stamp"], operationConfig: addStampOperationConfig, - automationSettings: AddStampAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/addStamp/AddStampAutomationSettings")), }, sanitize: { icon: , name: t("home.sanitize.title", "Sanitize"), - component: Sanitize, + component: lazy(() => import("@app/tools/Sanitize")), maxFiles: -1, categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, description: t("home.sanitize.desc", "Remove potentially harmful elements from PDF files"), endpoints: ["sanitize-pdf"], operationConfig: sanitizeOperationConfig, - automationSettings: SanitizeSettings, + automationSettings: lazy(() => import("@app/components/tools/sanitize/SanitizeSettings")), synonyms: getSynonyms(t, "sanitize") }, flatten: { icon: , name: t("home.flatten.title", "Flatten"), - component: Flatten, + component: lazy(() => import("@app/tools/Flatten")), description: t("home.flatten.desc", "Remove all interactive elements and forms from a PDF"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, maxFiles: -1, endpoints: ["flatten"], operationConfig: flattenOperationConfig, - automationSettings: FlattenSettings, + automationSettings: lazy(() => import("@app/components/tools/flatten/FlattenSettings")), synonyms: getSynonyms(t, "flatten") }, unlockPDFForms: { icon: , name: t("home.unlockPDFForms.title", "Unlock PDF Forms"), - component: UnlockPdfForms, + component: lazy(() => import("@app/tools/UnlockPdfForms")), description: t("home.unlockPDFForms.desc", "Remove read-only property of form fields in a PDF document."), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, @@ -330,20 +251,20 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { changePermissions: { icon: , name: t("home.changePermissions.title", "Change Permissions"), - component: ChangePermissions, + component: lazy(() => import("@app/tools/ChangePermissions")), description: t("home.changePermissions.desc", "Change document restrictions and permissions"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_SECURITY, maxFiles: -1, endpoints: ["add-password"], operationConfig: changePermissionsOperationConfig, - automationSettings: ChangePermissionsSettings, + automationSettings: lazy(() => import("@app/components/tools/changePermissions/ChangePermissionsSettings")), synonyms: getSynonyms(t, "changePermissions"), }, getPdfInfo: { icon: , name: t("home.getPdfInfo.title", "Get ALL Info on PDF"), - component: GetPdfInfo, + component: lazy(() => import("@app/tools/GetPdfInfo")), description: t("home.getPdfInfo.desc", "Grabs any and all information possible on PDFs"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.VERIFICATION, @@ -356,7 +277,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { validateSignature: { icon: , name: t("home.validateSignature.title", "Validate PDF Signature"), - component: ValidateSignature, + component: lazy(() => import("@app/tools/ValidateSignature")), description: t("home.validateSignature.desc", "Verify digital signatures and certificates in PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.VERIFICATION, @@ -386,20 +307,20 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { changeMetadata: { icon: , name: t("home.changeMetadata.title", "Change Metadata"), - component: ChangeMetadata, + component: lazy(() => import("@app/tools/ChangeMetadata")), description: t("home.changeMetadata.desc", "Change/Remove/Add metadata from a PDF document"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.DOCUMENT_REVIEW, maxFiles: -1, endpoints: ["update-metadata"], operationConfig: changeMetadataOperationConfig, - automationSettings: ChangeMetadataSingleStep, + automationSettings: lazy(() => import("@app/components/tools/changeMetadata/ChangeMetadataSingleStep")), synonyms: getSynonyms(t, "changeMetadata") }, editTableOfContents: { icon: , name: t("home.editTableOfContents.title", "Edit Table of Contents"), - component: EditTableOfContents, + component: lazy(() => import("@app/tools/EditTableOfContents")), description: t( "home.editTableOfContents.desc", "Add or edit bookmarks and table of contents in PDF documents" @@ -418,44 +339,44 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { crop: { icon: , name: t("home.crop.title", "Crop PDF"), - component: Crop, + component: lazy(() => import("@app/tools/Crop")), description: t("home.crop.desc", "Crop a PDF to reduce its size (maintains text!)"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, maxFiles: -1, endpoints: ["crop"], operationConfig: cropOperationConfig, - automationSettings: CropAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/crop/CropAutomationSettings")), }, rotate: { icon: , name: t("home.rotate.title", "Rotate"), - component: Rotate, + component: lazy(() => import("@app/tools/Rotate")), description: t("home.rotate.desc", "Easily rotate your PDFs."), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, maxFiles: -1, endpoints: ["rotate-pdf"], operationConfig: rotateOperationConfig, - automationSettings: RotateAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/rotate/RotateAutomationSettings")), synonyms: getSynonyms(t, "rotate") }, split: { icon: , name: t("home.split.title", "Split"), - component: SplitPdfPanel, + component: lazy(() => import("@app/tools/Split")), description: t("home.split.desc", "Split PDFs into multiple documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, endpoints: Array.from(new Set(Object.values(SPLIT_ENDPOINT_NAMES))), operationConfig: splitOperationConfig, - automationSettings: SplitAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/split/SplitAutomationSettings")), synonyms: getSynonyms(t, "split") }, reorganizePages: { icon: , name: t("home.reorganizePages.title", "Reorganize Pages"), - component: ReorganizePages, + component: lazy(() => import("@app/tools/ReorganizePages")), description: t( "home.reorganizePages.desc", "Rearrange, duplicate, or delete PDF pages with visual drag-and-drop control." @@ -471,24 +392,24 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { scalePages: { icon: , name: t("home.scalePages.title", "Adjust page size/scale"), - component: AdjustPageScale, + component: lazy(() => import("@app/tools/AdjustPageScale")), description: t("home.scalePages.desc", "Change the size/scale of a page and/or its contents."), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, maxFiles: -1, endpoints: ["scale-pages"], operationConfig: adjustPageScaleOperationConfig, - automationSettings: AdjustPageScaleSettings, + automationSettings: lazy(() => import("@app/components/tools/adjustPageScale/AdjustPageScaleSettings")), synonyms: getSynonyms(t, "scalePages") }, addPageNumbers: { icon: , name: t("home.addPageNumbers.title", "Add Page Numbers"), - component: AddPageNumbers, + component: lazy(() => import("@app/tools/AddPageNumbers")), description: t("home.addPageNumbers.desc", "Add Page numbers throughout a document in a set location"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, - automationSettings: AddPageNumbersAutomationSettings, + automationSettings: lazy(() => import("@app/components/tools/addPageNumbers/AddPageNumbersAutomationSettings")), maxFiles: -1, endpoints: ["add-page-numbers"], operationConfig: addPageNumbersOperationConfig, @@ -497,21 +418,21 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { pageLayout: { icon: , name: t("home.pageLayout.title", "Multi-Page Layout"), - component: PageLayout, + component: lazy(() => import("@app/tools/PageLayout")), description: t("home.pageLayout.desc", "Merge multiple pages of a PDF document into a single page"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, maxFiles: -1, endpoints: ["multi-page-layout"], - automationSettings: PageLayoutSettings, + automationSettings: lazy(() => import("@app/components/tools/pageLayout/PageLayoutSettings")), synonyms: getSynonyms(t, "pageLayout") }, bookletImposition: { icon: , name: t("home.bookletImposition.title", "Booklet Imposition"), - component: BookletImposition, + component: lazy(() => import("@app/tools/BookletImposition")), operationConfig: bookletImpositionOperationConfig, - automationSettings: BookletImpositionSettings, + automationSettings: lazy(() => import("@app/components/tools/bookletImposition/BookletImpositionSettings")), description: t("home.bookletImposition.desc", "Create booklets with proper page ordering and multi-page layout for printing and binding"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, @@ -521,7 +442,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { icon: , name: t("home.pdfToSinglePage.title", "PDF to Single Large Page"), - component: SingleLargePage, + component: lazy(() => import("@app/tools/SingleLargePage")), description: t("home.pdfToSinglePage.desc", "Merges all PDF pages into one large single page"), categoryId: ToolCategoryId.STANDARD_TOOLS, @@ -535,7 +456,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { addAttachments: { icon: , name: t("home.addAttachments.title", "Add Attachments"), - component: AddAttachments, + component: lazy(() => import("@app/tools/AddAttachments")), description: t("home.addAttachments.desc", "Add or remove embedded files (attachments) to/from a PDF"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.PAGE_FORMATTING, @@ -543,7 +464,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { maxFiles: 1, endpoints: ["add-attachments"], operationConfig: addAttachmentsOperationConfig, - automationSettings: AddAttachmentsSettings, + automationSettings: lazy(() => import("@app/components/tools/addAttachments/AddAttachmentsSettings")), }, // Extraction @@ -551,26 +472,26 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { extractPages: { icon: , name: t("home.extractPages.title", "Extract Pages"), - component: ExtractPages, + component: lazy(() => import("@app/tools/ExtractPages")), description: t("home.extractPages.desc", "Extract specific pages from a PDF document"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.EXTRACTION, synonyms: getSynonyms(t, "extractPages"), - automationSettings: ExtractPagesSettings, + automationSettings: lazy(() => import("@app/components/tools/extractPages/ExtractPagesSettings")), operationConfig: extractPagesOperationConfig, endpoints: ["rearrange-pages"], }, extractImages: { icon: , name: t("home.extractImages.title", "Extract Images"), - component: ExtractImages, + component: lazy(() => import("@app/tools/ExtractImages")), description: t("home.extractImages.desc", "Extract images from PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.EXTRACTION, maxFiles: -1, endpoints: ["extract-images"], operationConfig: extractImagesOperationConfig, - automationSettings: ExtractImagesSettings, + automationSettings: lazy(() => import("@app/components/tools/extractImages/ExtractImagesSettings")), synonyms: getSynonyms(t, "extractImages") }, @@ -579,7 +500,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { removePages: { icon: , name: t("home.removePages.title", "Remove Pages"), - component: RemovePages, + component: lazy(() => import("@app/tools/RemovePages")), description: t("home.removePages.desc", "Remove specific pages from a PDF document"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, @@ -587,12 +508,12 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { endpoints: ["remove-pages"], synonyms: getSynonyms(t, "removePages"), operationConfig: removePagesOperationConfig, - automationSettings: RemovePagesSettings, + automationSettings: lazy(() => import("@app/components/tools/removePages/RemovePagesSettings")), }, removeBlanks: { icon: , name: t("home.removeBlanks.title", "Remove Blank Pages"), - component: RemoveBlanks, + component: lazy(() => import("@app/tools/RemoveBlanks")), description: t("home.removeBlanks.desc", "Remove blank pages from PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, @@ -600,12 +521,12 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { endpoints: ["remove-blanks"], synonyms: getSynonyms(t, "removeBlanks"), operationConfig: removeBlanksOperationConfig, - automationSettings: RemoveBlanksSettings, + automationSettings: lazy(() => import("@app/components/tools/removeBlanks/RemoveBlanksSettings")), }, removeAnnotations: { icon: , name: t("home.removeAnnotations.title", "Remove Annotations"), - component: RemoveAnnotations, + component: lazy(() => import("@app/tools/RemoveAnnotations")), description: t("home.removeAnnotations.desc", "Remove annotations and comments from PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, @@ -618,7 +539,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { removeImage: { icon: , name: t("home.removeImage.title", "Remove Images"), - component: RemoveImage, + component: lazy(() => import("@app/tools/RemoveImage")), description: t("home.removeImage.desc", "Remove all images from a PDF document"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, @@ -631,20 +552,20 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { removePassword: { icon: , name: t("home.removePassword.title", "Remove Password"), - component: RemovePassword, + component: lazy(() => import("@app/tools/RemovePassword")), description: t("home.removePassword.desc", "Remove password protection from PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, endpoints: ["remove-password"], maxFiles: -1, operationConfig: removePasswordOperationConfig, - automationSettings: RemovePasswordSettings, + automationSettings: lazy(() => import("@app/components/tools/removePassword/RemovePasswordSettings")), synonyms: getSynonyms(t, "removePassword") }, removeCertSign: { icon: , name: t("home.removeCertSign.title", "Remove Certificate Sign"), - component: RemoveCertificateSign, + component: lazy(() => import("@app/tools/RemoveCertificateSign")), description: t("home.removeCertSign.desc", "Remove digital signature from PDF documents"), categoryId: ToolCategoryId.STANDARD_TOOLS, subcategoryId: SubcategoryId.REMOVAL, @@ -660,7 +581,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { automate: { icon: , name: t("home.automate.title", "Automate"), - component: Automate, + component: lazy(() => import("@app/tools/Automate")), description: t( "home.automate.desc", "Build multi-step workflows by chaining together PDF actions. Ideal for recurring tasks." @@ -676,7 +597,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { autoRename: { icon: , name: t("home.autoRename.title", "Auto Rename PDF File"), - component: AutoRename, + component: lazy(() => import("@app/tools/AutoRename")), maxFiles: -1, endpoints: ["auto-rename"], operationConfig: autoRenameOperationConfig, @@ -692,18 +613,18 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { adjustContrast: { icon: , name: t("home.adjustContrast.title", "Adjust Colors/Contrast"), - component: AdjustContrast, + component: lazy(() => import("@app/tools/AdjustContrast")), description: t("home.adjustContrast.desc", "Adjust colors and contrast of PDF documents"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, operationConfig: adjustContrastOperationConfig, - automationSettings: AdjustContrastSingleStepSettings, + automationSettings: lazy(() => import("@app/components/tools/adjustContrast/AdjustContrastSingleStepSettings")), synonyms: getSynonyms(t, "adjustContrast"), }, repair: { icon: , name: t("home.repair.title", "Repair"), - component: Repair, + component: lazy(() => import("@app/tools/Repair")), description: t("home.repair.desc", "Repair corrupted or damaged PDF files"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, @@ -716,39 +637,39 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { scannerImageSplit: { icon: , name: t("home.scannerImageSplit.title", "Detect & Split Scanned Photos"), - component: ScannerImageSplit, + component: lazy(() => import("@app/tools/ScannerImageSplit")), description: t("home.scannerImageSplit.desc", "Detect and split scanned photos into separate pages"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, maxFiles: -1, endpoints: ["extract-image-scans"], operationConfig: scannerImageSplitOperationConfig, - automationSettings: ScannerImageSplitSettings, + automationSettings: lazy(() => import("@app/components/tools/scannerImageSplit/ScannerImageSplitSettings")), synonyms: getSynonyms(t, "ScannerImageSplit"), }, overlayPdfs: { icon: , name: t("home.overlay-pdfs.title", "Overlay PDFs"), - component: OverlayPdfs, + component: lazy(() => import("@app/tools/OverlayPdfs")), description: t("home.overlay-pdfs.desc", "Overlay one PDF on top of another"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, endpoints: ["overlay-pdf"], operationConfig: overlayPdfsOperationConfig, synonyms: getSynonyms(t, "overlay-pdfs"), - automationSettings: OverlayPdfsSettings + automationSettings: lazy(() => import("@app/components/tools/overlayPdfs/OverlayPdfsSettings")) }, replaceColor: { icon: , name: t("home.replaceColor.title", "Replace & Invert Color"), - component: ReplaceColor, + component: lazy(() => import("@app/tools/ReplaceColor")), description: t("home.replaceColor.desc", "Replace or invert colors in PDF documents"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, maxFiles: -1, endpoints: ["replace-invert-pdf"], operationConfig: replaceColorOperationConfig, - automationSettings: ReplaceColorSettings, + automationSettings: lazy(() => import("@app/components/tools/replaceColor/ReplaceColorSettings")), synonyms: getSynonyms(t, "replaceColor"), }, scannerEffect: { @@ -768,7 +689,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { showJS: { icon: , name: t("home.showJS.title", "Show JavaScript"), - component: ShowJS, + component: lazy(() => import("@app/tools/ShowJS")), description: t("home.showJS.desc", "Extract and display JavaScript code from PDF documents"), categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.DEVELOPER_TOOLS, @@ -831,7 +752,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { compare: { icon: , name: t("home.compare.title", "Compare"), - component: Compare, + component: lazy(() => import("@app/tools/Compare")), description: t("home.compare.desc", "Compare two PDF documents and highlight differences"), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, @@ -844,20 +765,20 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { compress: { icon: , name: t("home.compress.title", "Compress"), - component: CompressPdfPanel, + component: lazy(() => import("@app/tools/Compress")), description: t("home.compress.desc", "Compress PDFs to reduce their file size."), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, maxFiles: -1, endpoints: ["compress-pdf"], operationConfig: compressOperationConfig, - automationSettings: CompressSettings, + automationSettings: lazy(() => import("@app/components/tools/compress/CompressSettings")), synonyms: getSynonyms(t, "compress") }, convert: { icon: , name: t("home.convert.title", "Convert"), - component: ConvertPanel, + component: lazy(() => import("@app/tools/Convert")), description: t("home.convert.desc", "Convert files to and from PDF format"), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, @@ -881,34 +802,34 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog { ], operationConfig: convertOperationConfig, - automationSettings: ConvertSettings, + automationSettings: lazy(() => import("@app/components/tools/convert/ConvertSettings")), synonyms: getSynonyms(t, "convert") }, ocr: { icon: , name: t("home.ocr.title", "OCR"), - component: OCRPanel, + component: lazy(() => import("@app/tools/OCR")), description: t("home.ocr.desc", "Extract text from scanned PDFs using Optical Character Recognition"), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, maxFiles: -1, endpoints: ["ocr-pdf"], operationConfig: ocrOperationConfig, - automationSettings: OCRSettings, + automationSettings: lazy(() => import("@app/components/tools/ocr/OCRSettings")), synonyms: getSynonyms(t, "ocr") }, redact: { icon: , name: t("home.redact.title", "Redact"), - component: Redact, + component: lazy(() => import("@app/tools/Redact")), description: t("home.redact.desc", "Permanently remove sensitive information from PDF documents"), categoryId: ToolCategoryId.RECOMMENDED_TOOLS, subcategoryId: SubcategoryId.GENERAL, maxFiles: -1, endpoints: ["auto-redact"], operationConfig: redactOperationConfig, - automationSettings: RedactSingleStepSettings, + automationSettings: lazy(() => import("@app/components/tools/redact/RedactSingleStepSettings")), synonyms: getSynonyms(t, "redact") }, };