diff --git a/src/main/resources/static/pdfjs/js/viewer.js b/src/main/resources/static/pdfjs/js/viewer.js
index 4ebef407..f533f24b 100644
--- a/src/main/resources/static/pdfjs/js/viewer.js
+++ b/src/main/resources/static/pdfjs/js/viewer.js
@@ -1,4 +1,8 @@
-/* Copyright 2014 Mozilla Foundation
+/**
+ * @licstart The following is the entire license notice for the
+ * JavaScript code in this page
+ *
+ * Copyright 2023 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -11,56 +15,14888 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * @licend The above is the entire license notice for the
+ * JavaScript code in this page
*/
-"use strict";
+/******/
+(() => { // webpackBootstrap
+ /******/
+ "use strict";
+ /******/
+ var __webpack_modules__ = ([
+ /* 0 */,
+ /* 1 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
- // eslint-disable-next-line no-alert
- alert("Please build the pdfjs-dist library using\n `gulp dist-install`");
-}
-// The workerSrc property shall be specified.
-//
-pdfjsLib.GlobalWorkerOptions.workerSrc =
- "/pdfjs/pdf.worker.js";
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.GenericCom = void 0;
+ var _app = __webpack_require__(2);
+ var _preferences = __webpack_require__(42);
+ var _download_manager = __webpack_require__(43);
+ var _genericl10n = __webpack_require__(44);
+ var _generic_scripting = __webpack_require__(46);
+ ;
+ const GenericCom = {};
+ exports.GenericCom = GenericCom;
-// Some PDFs need external cmaps.
-//
-const CMAP_URL = "/pdfjs/cmaps/";
-const CMAP_PACKED = true;
+ class GenericPreferences extends _preferences.BasePreferences {
+ async _writeToStorage(prefObj) {
+ localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));
+ }
-const DEFAULT_URL = "/pdfjs/example/compressed.tracemonkey-pldi-09.pdf";
-const PAGE_TO_VIEW = 1;
-const SCALE = 1.0;
+ async _readFromStorage(prefObj) {
+ return JSON.parse(localStorage.getItem("pdfjs.preferences"));
+ }
+ }
-const ENABLE_XFA = true;
+ class GenericExternalServices extends _app.DefaultExternalServices {
+ static createDownloadManager() {
+ return new _download_manager.DownloadManager();
+ }
-const container = document.getElementById("pageContainer");
+ static createPreferences() {
+ return new GenericPreferences();
+ }
-const eventBus = new pdfjsViewer.EventBus();
+ static createL10n({
+ locale = "en-US"
+ }) {
+ return new _genericl10n.GenericL10n(locale);
+ }
-// Loading document.
-const loadingTask = pdfjsLib.getDocument({
- url: DEFAULT_URL,
- cMapUrl: CMAP_URL,
- cMapPacked: CMAP_PACKED,
- enableXfa: ENABLE_XFA,
-});
-(async function () {
- const pdfDocument = await loadingTask.promise;
- // Document loaded, retrieving the page.
- const pdfPage = await pdfDocument.getPage(PAGE_TO_VIEW);
+ static createScripting({
+ sandboxBundleSrc
+ }) {
+ return new _generic_scripting.GenericScripting(sandboxBundleSrc);
+ }
+ }
- // Creating the page view with default parameters.
- const pdfPageView = new pdfjsViewer.PDFPageView({
- container,
- id: PAGE_TO_VIEW,
- scale: SCALE,
- defaultViewport: pdfPage.getViewport({scale: SCALE}),
- eventBus,
- });
- // Associate the actual page with the view, and draw it.
- pdfPageView.setPdfPage(pdfPage);
- return pdfPageView.draw();
-})();
\ No newline at end of file
+ _app.PDFViewerApplication.externalServices = GenericExternalServices;
+
+ /***/
+ }),
+ /* 2 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFViewerApplication = exports.PDFPrintServiceFactory = exports.DefaultExternalServices = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+ var _app_options = __webpack_require__(5);
+ var _event_utils = __webpack_require__(6);
+ var _pdf_link_service = __webpack_require__(7);
+ var _webAlt_text_manager = __webpack_require__(8);
+ var _webAnnotation_editor_params = __webpack_require__(9);
+ var _overlay_manager = __webpack_require__(10);
+ var _password_prompt = __webpack_require__(11);
+ var _webPdf_attachment_viewer = __webpack_require__(12);
+ var _webPdf_cursor_tools = __webpack_require__(14);
+ var _webPdf_document_properties = __webpack_require__(16);
+ var _webPdf_find_bar = __webpack_require__(17);
+ var _pdf_find_controller = __webpack_require__(18);
+ var _pdf_history = __webpack_require__(20);
+ var _webPdf_layer_viewer = __webpack_require__(21);
+ var _webPdf_outline_viewer = __webpack_require__(22);
+ var _webPdf_presentation_mode = __webpack_require__(23);
+ var _pdf_rendering_queue = __webpack_require__(24);
+ var _pdf_scripting_manager = __webpack_require__(25);
+ var _webPdf_sidebar = __webpack_require__(26);
+ var _webPdf_thumbnail_viewer = __webpack_require__(27);
+ var _pdf_viewer = __webpack_require__(29);
+ var _webSecondary_toolbar = __webpack_require__(39);
+ var _webToolbar = __webpack_require__(40);
+ var _view_history = __webpack_require__(41);
+ const FORCE_PAGES_LOADED_TIMEOUT = 10000;
+ const WHEEL_ZOOM_DISABLED_TIMEOUT = 1000;
+ const ViewOnLoad = {
+ UNKNOWN: -1,
+ PREVIOUS: 0,
+ INITIAL: 1
+ };
+ const ViewerCssTheme = {
+ AUTOMATIC: 0,
+ LIGHT: 1,
+ DARK: 2
+ };
+
+ class DefaultExternalServices {
+ constructor() {
+ throw new Error("Cannot initialize DefaultExternalServices.");
+ }
+
+ static updateFindControlState(data) {
+ }
+
+ static updateFindMatchesCount(data) {
+ }
+
+ static initPassiveLoading(callbacks) {
+ }
+
+ static reportTelemetry(data) {
+ }
+
+ static createDownloadManager() {
+ throw new Error("Not implemented: createDownloadManager");
+ }
+
+ static createPreferences() {
+ throw new Error("Not implemented: createPreferences");
+ }
+
+ static createL10n(options) {
+ throw new Error("Not implemented: createL10n");
+ }
+
+ static createScripting(options) {
+ throw new Error("Not implemented: createScripting");
+ }
+
+ static get supportsPinchToZoom() {
+ return (0, _pdfjsLib.shadow)(this, "supportsPinchToZoom", true);
+ }
+
+ static get supportsIntegratedFind() {
+ return (0, _pdfjsLib.shadow)(this, "supportsIntegratedFind", false);
+ }
+
+ static get supportsDocumentFonts() {
+ return (0, _pdfjsLib.shadow)(this, "supportsDocumentFonts", true);
+ }
+
+ static get supportedMouseWheelZoomModifierKeys() {
+ return (0, _pdfjsLib.shadow)(this, "supportedMouseWheelZoomModifierKeys", {
+ ctrlKey: true,
+ metaKey: true
+ });
+ }
+
+ static get isInAutomation() {
+ return (0, _pdfjsLib.shadow)(this, "isInAutomation", false);
+ }
+
+ static updateEditorStates(data) {
+ throw new Error("Not implemented: updateEditorStates");
+ }
+
+ static get canvasMaxAreaInBytes() {
+ return (0, _pdfjsLib.shadow)(this, "canvasMaxAreaInBytes", -1);
+ }
+
+ static getNimbusExperimentData() {
+ return (0, _pdfjsLib.shadow)(this, "getNimbusExperimentData", Promise.resolve(null));
+ }
+ }
+
+ exports.DefaultExternalServices = DefaultExternalServices;
+ const PDFViewerApplication = {
+ initialBookmark: document.location.hash.substring(1),
+ _initializedCapability: new _pdfjsLib.PromiseCapability(),
+ appConfig: null,
+ pdfDocument: null,
+ pdfLoadingTask: null,
+ printService: null,
+ pdfViewer: null,
+ pdfThumbnailViewer: null,
+ pdfRenderingQueue: null,
+ pdfPresentationMode: null,
+ pdfDocumentProperties: null,
+ pdfLinkService: null,
+ pdfHistory: null,
+ pdfSidebar: null,
+ pdfOutlineViewer: null,
+ pdfAttachmentViewer: null,
+ pdfLayerViewer: null,
+ pdfCursorTools: null,
+ pdfScriptingManager: null,
+ store: null,
+ downloadManager: null,
+ overlayManager: null,
+ preferences: null,
+ toolbar: null,
+ secondaryToolbar: null,
+ eventBus: null,
+ l10n: null,
+ annotationEditorParams: null,
+ isInitialViewSet: false,
+ downloadComplete: false,
+ isViewerEmbedded: window.parent !== window,
+ url: "",
+ baseUrl: "",
+ _downloadUrl: "",
+ externalServices: DefaultExternalServices,
+ _boundEvents: Object.create(null),
+ documentInfo: null,
+ metadata: null,
+ _contentDispositionFilename: null,
+ _contentLength: null,
+ _saveInProgress: false,
+ _wheelUnusedTicks: 0,
+ _wheelUnusedFactor: 1,
+ _touchUnusedTicks: 0,
+ _touchUnusedFactor: 1,
+ _PDFBug: null,
+ _hasAnnotationEditors: false,
+ _title: document.title,
+ _printAnnotationStoragePromise: null,
+ _touchInfo: null,
+ _isCtrlKeyDown: false,
+ _nimbusDataPromise: null,
+ async initialize(appConfig) {
+ this.preferences = this.externalServices.createPreferences();
+ this.appConfig = appConfig;
+ await this._initializeOptions();
+ this._forceCssTheme();
+ await this._initializeL10n();
+ if (this.isViewerEmbedded && _app_options.AppOptions.get("externalLinkTarget") === _pdf_link_service.LinkTarget.NONE) {
+ _app_options.AppOptions.set("externalLinkTarget", _pdf_link_service.LinkTarget.TOP);
+ }
+ await this._initializeViewerComponents();
+ this.bindEvents();
+ this.bindWindowEvents();
+ const appContainer = appConfig.appContainer || document.documentElement;
+ this.l10n.translate(appContainer).then(() => {
+ this.eventBus.dispatch("localized", {
+ source: this
+ });
+ });
+ this._initializedCapability.resolve();
+ },
+ async _initializeOptions() {
+ if (_app_options.AppOptions.get("disablePreferences")) {
+ if (_app_options.AppOptions.get("pdfBugEnabled")) {
+ await this._parseHashParams();
+ }
+ return;
+ }
+ if (_app_options.AppOptions._hasUserOptions()) {
+ console.warn("_initializeOptions: The Preferences may override manually set AppOptions; " + 'please use the "disablePreferences"-option in order to prevent that.');
+ }
+ try {
+ _app_options.AppOptions.setAll(await this.preferences.getAll());
+ } catch (reason) {
+ console.error(`_initializeOptions: "${reason.message}".`);
+ }
+ if (_app_options.AppOptions.get("pdfBugEnabled")) {
+ await this._parseHashParams();
+ }
+ },
+ async _parseHashParams() {
+ const hash = document.location.hash.substring(1);
+ if (!hash) {
+ return;
+ }
+ const {
+ mainContainer,
+ viewerContainer
+ } = this.appConfig,
+ params = (0, _ui_utils.parseQueryString)(hash);
+ if (params.get("disableworker") === "true") {
+ try {
+ await loadFakeWorker();
+ } catch (ex) {
+ console.error(`_parseHashParams: "${ex.message}".`);
+ }
+ }
+ if (params.has("disablerange")) {
+ _app_options.AppOptions.set("disableRange", params.get("disablerange") === "true");
+ }
+ if (params.has("disablestream")) {
+ _app_options.AppOptions.set("disableStream", params.get("disablestream") === "true");
+ }
+ if (params.has("disableautofetch")) {
+ _app_options.AppOptions.set("disableAutoFetch", params.get("disableautofetch") === "true");
+ }
+ if (params.has("disablefontface")) {
+ _app_options.AppOptions.set("disableFontFace", params.get("disablefontface") === "true");
+ }
+ if (params.has("disablehistory")) {
+ _app_options.AppOptions.set("disableHistory", params.get("disablehistory") === "true");
+ }
+ if (params.has("verbosity")) {
+ _app_options.AppOptions.set("verbosity", params.get("verbosity") | 0);
+ }
+ if (params.has("textlayer")) {
+ switch (params.get("textlayer")) {
+ case "off":
+ _app_options.AppOptions.set("textLayerMode", _ui_utils.TextLayerMode.DISABLE);
+ break;
+ case "visible":
+ case "shadow":
+ case "hover":
+ viewerContainer.classList.add(`textLayer-${params.get("textlayer")}`);
+ try {
+ await loadPDFBug(this);
+ this._PDFBug.loadCSS();
+ } catch (ex) {
+ console.error(`_parseHashParams: "${ex.message}".`);
+ }
+ break;
+ }
+ }
+ if (params.has("pdfbug")) {
+ _app_options.AppOptions.set("pdfBug", true);
+ _app_options.AppOptions.set("fontExtraProperties", true);
+ const enabled = params.get("pdfbug").split(",");
+ try {
+ await loadPDFBug(this);
+ this._PDFBug.init(mainContainer, enabled);
+ } catch (ex) {
+ console.error(`_parseHashParams: "${ex.message}".`);
+ }
+ }
+ if (params.has("locale")) {
+ _app_options.AppOptions.set("locale", params.get("locale"));
+ }
+ },
+ async _initializeL10n() {
+ this.l10n = this.externalServices.createL10n({
+ locale: _app_options.AppOptions.get("locale")
+ });
+ const dir = await this.l10n.getDirection();
+ document.getElementsByTagName("html")[0].dir = dir;
+ },
+ _forceCssTheme() {
+ const cssTheme = _app_options.AppOptions.get("viewerCssTheme");
+ if (cssTheme === ViewerCssTheme.AUTOMATIC || !Object.values(ViewerCssTheme).includes(cssTheme)) {
+ return;
+ }
+ try {
+ const styleSheet = document.styleSheets[0];
+ const cssRules = styleSheet?.cssRules || [];
+ for (let i = 0, ii = cssRules.length; i < ii; i++) {
+ const rule = cssRules[i];
+ if (rule instanceof CSSMediaRule && rule.media?.[0] === "(prefers-color-scheme: dark)") {
+ if (cssTheme === ViewerCssTheme.LIGHT) {
+ styleSheet.deleteRule(i);
+ return;
+ }
+ const darkRules = /^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(rule.cssText);
+ if (darkRules?.[1]) {
+ styleSheet.deleteRule(i);
+ styleSheet.insertRule(darkRules[1], i);
+ }
+ return;
+ }
+ }
+ } catch (reason) {
+ console.error(`_forceCssTheme: "${reason?.message}".`);
+ }
+ },
+ async _initializeViewerComponents() {
+ const {
+ appConfig,
+ externalServices,
+ l10n
+ } = this;
+ const eventBus = externalServices.isInAutomation ? new _event_utils.AutomationEventBus() : new _event_utils.EventBus();
+ this.eventBus = eventBus;
+ this.overlayManager = new _overlay_manager.OverlayManager();
+ const pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
+ pdfRenderingQueue.onIdle = this._cleanup.bind(this);
+ this.pdfRenderingQueue = pdfRenderingQueue;
+ const pdfLinkService = new _pdf_link_service.PDFLinkService({
+ eventBus,
+ externalLinkTarget: _app_options.AppOptions.get("externalLinkTarget"),
+ externalLinkRel: _app_options.AppOptions.get("externalLinkRel"),
+ ignoreDestinationZoom: _app_options.AppOptions.get("ignoreDestinationZoom")
+ });
+ this.pdfLinkService = pdfLinkService;
+ const downloadManager = externalServices.createDownloadManager();
+ this.downloadManager = downloadManager;
+ const findController = new _pdf_find_controller.PDFFindController({
+ linkService: pdfLinkService,
+ eventBus,
+ updateMatchesCountOnProgress: true
+ });
+ this.findController = findController;
+ const pdfScriptingManager = new _pdf_scripting_manager.PDFScriptingManager({
+ eventBus,
+ sandboxBundleSrc: _app_options.AppOptions.get("sandboxBundleSrc"),
+ externalServices,
+ docProperties: this._scriptingDocProperties.bind(this)
+ });
+ this.pdfScriptingManager = pdfScriptingManager;
+ const container = appConfig.mainContainer,
+ viewer = appConfig.viewerContainer;
+ const annotationEditorMode = _app_options.AppOptions.get("annotationEditorMode");
+ const isOffscreenCanvasSupported = _app_options.AppOptions.get("isOffscreenCanvasSupported") && _pdfjsLib.FeatureTest.isOffscreenCanvasSupported;
+ const pageColors = _app_options.AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches ? {
+ background: _app_options.AppOptions.get("pageColorsBackground"),
+ foreground: _app_options.AppOptions.get("pageColorsForeground")
+ } : null;
+ const altTextManager = appConfig.altTextDialog ? new _webAlt_text_manager.AltTextManager(appConfig.altTextDialog, container, this.overlayManager, eventBus) : null;
+ const pdfViewer = new _pdf_viewer.PDFViewer({
+ container,
+ viewer,
+ eventBus,
+ renderingQueue: pdfRenderingQueue,
+ linkService: pdfLinkService,
+ downloadManager,
+ altTextManager,
+ findController,
+ scriptingManager: _app_options.AppOptions.get("enableScripting") && pdfScriptingManager,
+ l10n,
+ textLayerMode: _app_options.AppOptions.get("textLayerMode"),
+ annotationMode: _app_options.AppOptions.get("annotationMode"),
+ annotationEditorMode,
+ imageResourcesPath: _app_options.AppOptions.get("imageResourcesPath"),
+ enablePrintAutoRotate: _app_options.AppOptions.get("enablePrintAutoRotate"),
+ isOffscreenCanvasSupported,
+ maxCanvasPixels: _app_options.AppOptions.get("maxCanvasPixels"),
+ enablePermissions: _app_options.AppOptions.get("enablePermissions"),
+ pageColors
+ });
+ this.pdfViewer = pdfViewer;
+ pdfRenderingQueue.setViewer(pdfViewer);
+ pdfLinkService.setViewer(pdfViewer);
+ pdfScriptingManager.setViewer(pdfViewer);
+ if (appConfig.sidebar?.thumbnailView) {
+ this.pdfThumbnailViewer = new _webPdf_thumbnail_viewer.PDFThumbnailViewer({
+ container: appConfig.sidebar.thumbnailView,
+ eventBus,
+ renderingQueue: pdfRenderingQueue,
+ linkService: pdfLinkService,
+ l10n,
+ pageColors
+ });
+ pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
+ }
+ if (!this.isViewerEmbedded && !_app_options.AppOptions.get("disableHistory")) {
+ this.pdfHistory = new _pdf_history.PDFHistory({
+ linkService: pdfLinkService,
+ eventBus
+ });
+ pdfLinkService.setHistory(this.pdfHistory);
+ }
+ if (!this.supportsIntegratedFind && appConfig.findBar) {
+ this.findBar = new _webPdf_find_bar.PDFFindBar(appConfig.findBar, eventBus, l10n);
+ }
+ if (appConfig.annotationEditorParams) {
+ if (annotationEditorMode !== _pdfjsLib.AnnotationEditorType.DISABLE) {
+ if (_app_options.AppOptions.get("enableStampEditor") && isOffscreenCanvasSupported) {
+ appConfig.toolbar?.editorStampButton?.classList.remove("hidden");
+ }
+ this.annotationEditorParams = new _webAnnotation_editor_params.AnnotationEditorParams(appConfig.annotationEditorParams, eventBus);
+ } else {
+ for (const id of ["editorModeButtons", "editorModeSeparator"]) {
+ document.getElementById(id)?.classList.add("hidden");
+ }
+ }
+ }
+ if (appConfig.documentProperties) {
+ this.pdfDocumentProperties = new _webPdf_document_properties.PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, l10n, () => this._docFilename);
+ }
+ if (appConfig.secondaryToolbar?.cursorHandToolButton) {
+ this.pdfCursorTools = new _webPdf_cursor_tools.PDFCursorTools({
+ container,
+ eventBus,
+ cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad")
+ });
+ }
+ if (appConfig.toolbar) {
+ this.toolbar = new _webToolbar.Toolbar(appConfig.toolbar, eventBus, l10n);
+ }
+ if (appConfig.secondaryToolbar) {
+ this.secondaryToolbar = new _webSecondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar, eventBus);
+ }
+ if (this.supportsFullscreen && appConfig.secondaryToolbar?.presentationModeButton) {
+ this.pdfPresentationMode = new _webPdf_presentation_mode.PDFPresentationMode({
+ container,
+ pdfViewer,
+ eventBus
+ });
+ }
+ if (appConfig.passwordOverlay) {
+ this.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, l10n, this.isViewerEmbedded);
+ }
+ if (appConfig.sidebar?.outlineView) {
+ this.pdfOutlineViewer = new _webPdf_outline_viewer.PDFOutlineViewer({
+ container: appConfig.sidebar.outlineView,
+ eventBus,
+ linkService: pdfLinkService,
+ downloadManager
+ });
+ }
+ if (appConfig.sidebar?.attachmentsView) {
+ this.pdfAttachmentViewer = new _webPdf_attachment_viewer.PDFAttachmentViewer({
+ container: appConfig.sidebar.attachmentsView,
+ eventBus,
+ downloadManager
+ });
+ }
+ if (appConfig.sidebar?.layersView) {
+ this.pdfLayerViewer = new _webPdf_layer_viewer.PDFLayerViewer({
+ container: appConfig.sidebar.layersView,
+ eventBus,
+ l10n
+ });
+ }
+ if (appConfig.sidebar) {
+ this.pdfSidebar = new _webPdf_sidebar.PDFSidebar({
+ elements: appConfig.sidebar,
+ eventBus,
+ l10n
+ });
+ this.pdfSidebar.onToggled = this.forceRendering.bind(this);
+ this.pdfSidebar.onUpdateThumbnails = () => {
+ for (const pageView of pdfViewer.getCachedPageViews()) {
+ if (pageView.renderingState === _ui_utils.RenderingStates.FINISHED) {
+ this.pdfThumbnailViewer.getThumbnail(pageView.id - 1)?.setImage(pageView);
+ }
+ }
+ this.pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);
+ };
+ }
+ },
+ async run(config) {
+ await this.initialize(config);
+ const {
+ appConfig,
+ eventBus
+ } = this;
+ let file;
+ const queryString = document.location.search.substring(1);
+ const params = (0, _ui_utils.parseQueryString)(queryString);
+ file = params.get("file") ?? _app_options.AppOptions.get("defaultUrl");
+ validateFileURL(file);
+ const fileInput = appConfig.openFileInput;
+ fileInput.value = null;
+ fileInput.addEventListener("change", function (evt) {
+ const {
+ files
+ } = evt.target;
+ if (!files || files.length === 0) {
+ return;
+ }
+ eventBus.dispatch("fileinputchange", {
+ source: this,
+ fileInput: evt.target
+ });
+ });
+ appConfig.mainContainer.addEventListener("dragover", function (evt) {
+ evt.preventDefault();
+ evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";
+ });
+ appConfig.mainContainer.addEventListener("drop", function (evt) {
+ evt.preventDefault();
+ const {
+ files
+ } = evt.dataTransfer;
+ if (!files || files.length === 0) {
+ return;
+ }
+ eventBus.dispatch("fileinputchange", {
+ source: this,
+ fileInput: evt.dataTransfer
+ });
+ });
+ if (!this.supportsDocumentFonts) {
+ _app_options.AppOptions.set("disableFontFace", true);
+ this.l10n.get("web_fonts_disabled").then(msg => {
+ console.warn(msg);
+ });
+ }
+ if (!this.supportsPrinting) {
+ appConfig.toolbar?.print?.classList.add("hidden");
+ appConfig.secondaryToolbar?.printButton.classList.add("hidden");
+ }
+ if (!this.supportsFullscreen) {
+ appConfig.secondaryToolbar?.presentationModeButton.classList.add("hidden");
+ }
+ if (this.supportsIntegratedFind) {
+ appConfig.toolbar?.viewFind?.classList.add("hidden");
+ }
+ appConfig.mainContainer.addEventListener("transitionend", function (evt) {
+ if (evt.target === this) {
+ eventBus.dispatch("resize", {
+ source: this
+ });
+ }
+ }, true);
+ if (file) {
+ this.open({
+ url: file
+ });
+ } else {
+ this._hideViewBookmark();
+ }
+ },
+ get initialized() {
+ return this._initializedCapability.settled;
+ },
+ get initializedPromise() {
+ return this._initializedCapability.promise;
+ },
+ zoomIn(steps, scaleFactor) {
+ if (this.pdfViewer.isInPresentationMode) {
+ return;
+ }
+ this.pdfViewer.increaseScale({
+ drawingDelay: _app_options.AppOptions.get("defaultZoomDelay"),
+ steps,
+ scaleFactor
+ });
+ },
+ zoomOut(steps, scaleFactor) {
+ if (this.pdfViewer.isInPresentationMode) {
+ return;
+ }
+ this.pdfViewer.decreaseScale({
+ drawingDelay: _app_options.AppOptions.get("defaultZoomDelay"),
+ steps,
+ scaleFactor
+ });
+ },
+ zoomReset() {
+ if (this.pdfViewer.isInPresentationMode) {
+ return;
+ }
+ this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
+ },
+ get pagesCount() {
+ return this.pdfDocument ? this.pdfDocument.numPages : 0;
+ },
+ get page() {
+ return this.pdfViewer.currentPageNumber;
+ },
+ set page(val) {
+ this.pdfViewer.currentPageNumber = val;
+ },
+ get supportsPrinting() {
+ return PDFPrintServiceFactory.instance.supportsPrinting;
+ },
+ get supportsFullscreen() {
+ return (0, _pdfjsLib.shadow)(this, "supportsFullscreen", document.fullscreenEnabled);
+ },
+ get supportsPinchToZoom() {
+ return this.externalServices.supportsPinchToZoom;
+ },
+ get supportsIntegratedFind() {
+ return this.externalServices.supportsIntegratedFind;
+ },
+ get supportsDocumentFonts() {
+ return this.externalServices.supportsDocumentFonts;
+ },
+ get loadingBar() {
+ const barElement = document.getElementById("loadingBar");
+ const bar = barElement ? new _ui_utils.ProgressBar(barElement) : null;
+ return (0, _pdfjsLib.shadow)(this, "loadingBar", bar);
+ },
+ get supportedMouseWheelZoomModifierKeys() {
+ return this.externalServices.supportedMouseWheelZoomModifierKeys;
+ },
+ initPassiveLoading(file) {
+ throw new Error("Not implemented: initPassiveLoading");
+ },
+ setTitleUsingUrl(url = "", downloadUrl = null) {
+ this.url = url;
+ this.baseUrl = url.split("#")[0];
+ if (downloadUrl) {
+ this._downloadUrl = downloadUrl === url ? this.baseUrl : downloadUrl.split("#")[0];
+ }
+ if ((0, _pdfjsLib.isDataScheme)(url)) {
+ this._hideViewBookmark();
+ }
+ let title = (0, _pdfjsLib.getPdfFilenameFromUrl)(url, "");
+ if (!title) {
+ try {
+ title = decodeURIComponent((0, _pdfjsLib.getFilenameFromUrl)(url)) || url;
+ } catch {
+ title = url;
+ }
+ }
+ this.setTitle(title);
+ },
+ setTitle(title = this._title) {
+ this._title = title;
+ if (this.isViewerEmbedded) {
+ return;
+ }
+ const editorIndicator = this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;
+ document.title = `${editorIndicator ? "* " : ""}${title}`;
+ },
+ get _docFilename() {
+ return this._contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(this.url);
+ },
+ _hideViewBookmark() {
+ const {
+ secondaryToolbar
+ } = this.appConfig;
+ secondaryToolbar?.viewBookmarkButton.classList.add("hidden");
+ if (secondaryToolbar?.presentationModeButton.classList.contains("hidden")) {
+ document.getElementById("viewBookmarkSeparator")?.classList.add("hidden");
+ }
+ },
+ async close() {
+ this._unblockDocumentLoadEvent();
+ this._hideViewBookmark();
+ if (!this.pdfLoadingTask) {
+ return;
+ }
+ if (this.pdfDocument?.annotationStorage.size > 0 && this._annotationStorageModified) {
+ try {
+ await this.save();
+ } catch {
+ }
+ }
+ const promises = [];
+ promises.push(this.pdfLoadingTask.destroy());
+ this.pdfLoadingTask = null;
+ if (this.pdfDocument) {
+ this.pdfDocument = null;
+ this.pdfThumbnailViewer?.setDocument(null);
+ this.pdfViewer.setDocument(null);
+ this.pdfLinkService.setDocument(null);
+ this.pdfDocumentProperties?.setDocument(null);
+ }
+ this.pdfLinkService.externalLinkEnabled = true;
+ this.store = null;
+ this.isInitialViewSet = false;
+ this.downloadComplete = false;
+ this.url = "";
+ this.baseUrl = "";
+ this._downloadUrl = "";
+ this.documentInfo = null;
+ this.metadata = null;
+ this._contentDispositionFilename = null;
+ this._contentLength = null;
+ this._saveInProgress = false;
+ this._hasAnnotationEditors = false;
+ promises.push(this.pdfScriptingManager.destroyPromise, this.passwordPrompt.close());
+ this.setTitle();
+ this.pdfSidebar?.reset();
+ this.pdfOutlineViewer?.reset();
+ this.pdfAttachmentViewer?.reset();
+ this.pdfLayerViewer?.reset();
+ this.pdfHistory?.reset();
+ this.findBar?.reset();
+ this.toolbar?.reset();
+ this.secondaryToolbar?.reset();
+ this._PDFBug?.cleanup();
+ await Promise.all(promises);
+ },
+ async open(args) {
+ let deprecatedArgs = false;
+ if (typeof args === "string") {
+ args = {
+ url: args
+ };
+ deprecatedArgs = true;
+ } else if (args?.byteLength) {
+ args = {
+ data: args
+ };
+ deprecatedArgs = true;
+ }
+ if (deprecatedArgs) {
+ console.error("The `PDFViewerApplication.open` signature was updated, please use an object instead.");
+ }
+ if (this.pdfLoadingTask) {
+ await this.close();
+ }
+ const workerParams = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
+ Object.assign(_pdfjsLib.GlobalWorkerOptions, workerParams);
+ if (args.url) {
+ this.setTitleUsingUrl(args.originalUrl || args.url, args.url);
+ }
+ const apiParams = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
+ const params = {
+ canvasMaxAreaInBytes: this.externalServices.canvasMaxAreaInBytes,
+ ...apiParams,
+ ...args
+ };
+ const loadingTask = (0, _pdfjsLib.getDocument)(params);
+ this.pdfLoadingTask = loadingTask;
+ loadingTask.onPassword = (updateCallback, reason) => {
+ if (this.isViewerEmbedded) {
+ this._unblockDocumentLoadEvent();
+ }
+ this.pdfLinkService.externalLinkEnabled = false;
+ this.passwordPrompt.setUpdateCallback(updateCallback, reason);
+ this.passwordPrompt.open();
+ };
+ loadingTask.onProgress = ({
+ loaded,
+ total
+ }) => {
+ this.progress(loaded / total);
+ };
+ return loadingTask.promise.then(pdfDocument => {
+ this.load(pdfDocument);
+ }, reason => {
+ if (loadingTask !== this.pdfLoadingTask) {
+ return undefined;
+ }
+ let key = "loading_error";
+ if (reason instanceof _pdfjsLib.InvalidPDFException) {
+ key = "invalid_file_error";
+ } else if (reason instanceof _pdfjsLib.MissingPDFException) {
+ key = "missing_file_error";
+ } else if (reason instanceof _pdfjsLib.UnexpectedResponseException) {
+ key = "unexpected_response_error";
+ }
+ return this.l10n.get(key).then(msg => {
+ this._documentError(msg, {
+ message: reason?.message
+ });
+ throw reason;
+ });
+ });
+ },
+ _ensureDownloadComplete() {
+ if (this.pdfDocument && this.downloadComplete) {
+ return;
+ }
+ throw new Error("PDF document not downloaded.");
+ },
+ async download(options = {}) {
+ const url = this._downloadUrl,
+ filename = this._docFilename;
+ try {
+ this._ensureDownloadComplete();
+ const data = await this.pdfDocument.getData();
+ const blob = new Blob([data], {
+ type: "application/pdf"
+ });
+ await this.downloadManager.download(blob, url, filename, options);
+ } catch {
+ await this.downloadManager.downloadUrl(url, filename, options);
+ }
+ },
+ async save(options = {}) {
+ if (this._saveInProgress) {
+ return;
+ }
+ this._saveInProgress = true;
+ await this.pdfScriptingManager.dispatchWillSave();
+ const url = this._downloadUrl,
+ filename = this._docFilename;
+ try {
+ this._ensureDownloadComplete();
+ const data = await this.pdfDocument.saveDocument();
+ const blob = new Blob([data], {
+ type: "application/pdf"
+ });
+ await this.downloadManager.download(blob, url, filename, options);
+ } catch (reason) {
+ console.error(`Error when saving the document: ${reason.message}`);
+ await this.download(options);
+ } finally {
+ await this.pdfScriptingManager.dispatchDidSave();
+ this._saveInProgress = false;
+ }
+ if (this._hasAnnotationEditors) {
+ this.externalServices.reportTelemetry({
+ type: "editing",
+ data: {
+ type: "save"
+ }
+ });
+ }
+ },
+ downloadOrSave(options = {}) {
+ if (this.pdfDocument?.annotationStorage.size > 0) {
+ this.save(options);
+ } else {
+ this.download(options);
+ }
+ },
+ openInExternalApp() {
+ this.downloadOrSave({
+ openInExternalApp: true
+ });
+ },
+ _documentError(message, moreInfo = null) {
+ this._unblockDocumentLoadEvent();
+ this._otherError(message, moreInfo);
+ this.eventBus.dispatch("documenterror", {
+ source: this,
+ message,
+ reason: moreInfo?.message ?? null
+ });
+ },
+ _otherError(message, moreInfo = null) {
+ const moreInfoText = [`PDF.js v${_pdfjsLib.version || "?"} (build: ${_pdfjsLib.build || "?"})`];
+ if (moreInfo) {
+ moreInfoText.push(`Message: ${moreInfo.message}`);
+ if (moreInfo.stack) {
+ moreInfoText.push(`Stack: ${moreInfo.stack}`);
+ } else {
+ if (moreInfo.filename) {
+ moreInfoText.push(`File: ${moreInfo.filename}`);
+ }
+ if (moreInfo.lineNumber) {
+ moreInfoText.push(`Line: ${moreInfo.lineNumber}`);
+ }
+ }
+ }
+ console.error(`${message}\n\n${moreInfoText.join("\n")}`);
+ },
+ progress(level) {
+ if (!this.loadingBar || this.downloadComplete) {
+ return;
+ }
+ const percent = Math.round(level * 100);
+ if (percent <= this.loadingBar.percent) {
+ return;
+ }
+ this.loadingBar.percent = percent;
+ if (this.pdfDocument?.loadingParams.disableAutoFetch ?? _app_options.AppOptions.get("disableAutoFetch")) {
+ this.loadingBar.setDisableAutoFetch();
+ }
+ },
+ load(pdfDocument) {
+ this.pdfDocument = pdfDocument;
+ pdfDocument.getDownloadInfo().then(({
+ length
+ }) => {
+ this._contentLength = length;
+ this.downloadComplete = true;
+ this.loadingBar?.hide();
+ firstPagePromise.then(() => {
+ this.eventBus.dispatch("documentloaded", {
+ source: this
+ });
+ });
+ });
+ const pageLayoutPromise = pdfDocument.getPageLayout().catch(() => {
+ });
+ const pageModePromise = pdfDocument.getPageMode().catch(() => {
+ });
+ const openActionPromise = pdfDocument.getOpenAction().catch(() => {
+ });
+ this.toolbar?.setPagesCount(pdfDocument.numPages, false);
+ this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
+ this.pdfLinkService.setDocument(pdfDocument);
+ this.pdfDocumentProperties?.setDocument(pdfDocument);
+ const pdfViewer = this.pdfViewer;
+ pdfViewer.setDocument(pdfDocument);
+ const {
+ firstPagePromise,
+ onePageRendered,
+ pagesPromise
+ } = pdfViewer;
+ this.pdfThumbnailViewer?.setDocument(pdfDocument);
+ const storedPromise = (this.store = new _view_history.ViewHistory(pdfDocument.fingerprints[0])).getMultiple({
+ page: null,
+ zoom: _ui_utils.DEFAULT_SCALE_VALUE,
+ scrollLeft: "0",
+ scrollTop: "0",
+ rotation: null,
+ sidebarView: _ui_utils.SidebarView.UNKNOWN,
+ scrollMode: _ui_utils.ScrollMode.UNKNOWN,
+ spreadMode: _ui_utils.SpreadMode.UNKNOWN
+ }).catch(() => {
+ });
+ firstPagePromise.then(pdfPage => {
+ this.loadingBar?.setWidth(this.appConfig.viewerContainer);
+ this._initializeAnnotationStorageCallbacks(pdfDocument);
+ Promise.all([_ui_utils.animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {
+ const viewOnLoad = _app_options.AppOptions.get("viewOnLoad");
+ this._initializePdfHistory({
+ fingerprint: pdfDocument.fingerprints[0],
+ viewOnLoad,
+ initialDest: openAction?.dest
+ });
+ const initialBookmark = this.initialBookmark;
+ const zoom = _app_options.AppOptions.get("defaultZoomValue");
+ let hash = zoom ? `zoom=${zoom}` : null;
+ let rotation = null;
+ let sidebarView = _app_options.AppOptions.get("sidebarViewOnLoad");
+ let scrollMode = _app_options.AppOptions.get("scrollModeOnLoad");
+ let spreadMode = _app_options.AppOptions.get("spreadModeOnLoad");
+ if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) {
+ hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`;
+ rotation = parseInt(stored.rotation, 10);
+ if (sidebarView === _ui_utils.SidebarView.UNKNOWN) {
+ sidebarView = stored.sidebarView | 0;
+ }
+ if (scrollMode === _ui_utils.ScrollMode.UNKNOWN) {
+ scrollMode = stored.scrollMode | 0;
+ }
+ if (spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
+ spreadMode = stored.spreadMode | 0;
+ }
+ }
+ if (pageMode && sidebarView === _ui_utils.SidebarView.UNKNOWN) {
+ sidebarView = (0, _ui_utils.apiPageModeToSidebarView)(pageMode);
+ }
+ if (pageLayout && scrollMode === _ui_utils.ScrollMode.UNKNOWN && spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
+ const modes = (0, _ui_utils.apiPageLayoutToViewerModes)(pageLayout);
+ spreadMode = modes.spreadMode;
+ }
+ this.setInitialView(hash, {
+ rotation,
+ sidebarView,
+ scrollMode,
+ spreadMode
+ });
+ this.eventBus.dispatch("documentinit", {
+ source: this
+ });
+ if (!this.isViewerEmbedded) {
+ pdfViewer.focus();
+ }
+ await Promise.race([pagesPromise, new Promise(resolve => {
+ setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);
+ })]);
+ if (!initialBookmark && !hash) {
+ return;
+ }
+ if (pdfViewer.hasEqualPageSizes) {
+ return;
+ }
+ this.initialBookmark = initialBookmark;
+ pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;
+ this.setInitialView(hash);
+ }).catch(() => {
+ this.setInitialView();
+ }).then(function () {
+ pdfViewer.update();
+ });
+ });
+ pagesPromise.then(() => {
+ this._unblockDocumentLoadEvent();
+ this._initializeAutoPrint(pdfDocument, openActionPromise);
+ }, reason => {
+ this.l10n.get("loading_error").then(msg => {
+ this._documentError(msg, {
+ message: reason?.message
+ });
+ });
+ });
+ onePageRendered.then(data => {
+ this.externalServices.reportTelemetry({
+ type: "pageInfo",
+ timestamp: data.timestamp
+ });
+ if (this.pdfOutlineViewer) {
+ pdfDocument.getOutline().then(outline => {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ this.pdfOutlineViewer.render({
+ outline,
+ pdfDocument
+ });
+ });
+ }
+ if (this.pdfAttachmentViewer) {
+ pdfDocument.getAttachments().then(attachments => {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ this.pdfAttachmentViewer.render({
+ attachments
+ });
+ });
+ }
+ if (this.pdfLayerViewer) {
+ pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ this.pdfLayerViewer.render({
+ optionalContentConfig,
+ pdfDocument
+ });
+ });
+ }
+ });
+ this._initializePageLabels(pdfDocument);
+ this._initializeMetadata(pdfDocument);
+ },
+ async _scriptingDocProperties(pdfDocument) {
+ if (!this.documentInfo) {
+ await new Promise(resolve => {
+ this.eventBus._on("metadataloaded", resolve, {
+ once: true
+ });
+ });
+ if (pdfDocument !== this.pdfDocument) {
+ return null;
+ }
+ }
+ if (!this._contentLength) {
+ await new Promise(resolve => {
+ this.eventBus._on("documentloaded", resolve, {
+ once: true
+ });
+ });
+ if (pdfDocument !== this.pdfDocument) {
+ return null;
+ }
+ }
+ return {
+ ...this.documentInfo,
+ baseURL: this.baseUrl,
+ filesize: this._contentLength,
+ filename: this._docFilename,
+ metadata: this.metadata?.getRaw(),
+ authors: this.metadata?.get("dc:creator"),
+ numPages: this.pagesCount,
+ URL: this.url
+ };
+ },
+ async _initializeAutoPrint(pdfDocument, openActionPromise) {
+ const [openAction, jsActions] = await Promise.all([openActionPromise, this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions()]);
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ let triggerAutoPrint = openAction?.action === "Print";
+ if (jsActions) {
+ console.warn("Warning: JavaScript support is not enabled");
+ for (const name in jsActions) {
+ if (triggerAutoPrint) {
+ break;
+ }
+ switch (name) {
+ case "WillClose":
+ case "WillSave":
+ case "DidSave":
+ case "WillPrint":
+ case "DidPrint":
+ continue;
+ }
+ triggerAutoPrint = jsActions[name].some(js => _ui_utils.AutoPrintRegExp.test(js));
+ }
+ }
+ if (triggerAutoPrint) {
+ this.triggerPrinting();
+ }
+ },
+ async _initializeMetadata(pdfDocument) {
+ const {
+ info,
+ metadata,
+ contentDispositionFilename,
+ contentLength
+ } = await pdfDocument.getMetadata();
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ this.documentInfo = info;
+ this.metadata = metadata;
+ this._contentDispositionFilename ??= contentDispositionFilename;
+ this._contentLength ??= contentLength;
+ console.log(`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${_pdfjsLib.version || "?"} [${_pdfjsLib.build || "?"}])`);
+ let pdfTitle = info.Title;
+ const metadataTitle = metadata?.get("dc:title");
+ if (metadataTitle) {
+ if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) {
+ pdfTitle = metadataTitle;
+ }
+ }
+ if (pdfTitle) {
+ this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);
+ } else if (this._contentDispositionFilename) {
+ this.setTitle(this._contentDispositionFilename);
+ }
+ if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
+ if (pdfDocument.loadingParams.enableXfa) {
+ console.warn("Warning: XFA Foreground documents are not supported");
+ } else {
+ console.warn("Warning: XFA support is not enabled");
+ }
+ } else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) {
+ console.warn("Warning: Interactive form support is not enabled");
+ }
+ if (info.IsSignaturesPresent) {
+ console.warn("Warning: Digital signatures validation is not supported");
+ }
+ this.eventBus.dispatch("metadataloaded", {
+ source: this
+ });
+ },
+ async _initializePageLabels(pdfDocument) {
+ const labels = await pdfDocument.getPageLabels();
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ if (!labels || _app_options.AppOptions.get("disablePageLabels")) {
+ return;
+ }
+ const numLabels = labels.length;
+ let standardLabels = 0,
+ emptyLabels = 0;
+ for (let i = 0; i < numLabels; i++) {
+ const label = labels[i];
+ if (label === (i + 1).toString()) {
+ standardLabels++;
+ } else if (label === "") {
+ emptyLabels++;
+ } else {
+ break;
+ }
+ }
+ if (standardLabels >= numLabels || emptyLabels >= numLabels) {
+ return;
+ }
+ const {
+ pdfViewer,
+ pdfThumbnailViewer,
+ toolbar
+ } = this;
+ pdfViewer.setPageLabels(labels);
+ pdfThumbnailViewer?.setPageLabels(labels);
+ toolbar?.setPagesCount(numLabels, true);
+ toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
+ },
+ _initializePdfHistory({
+ fingerprint,
+ viewOnLoad,
+ initialDest = null
+ }) {
+ if (!this.pdfHistory) {
+ return;
+ }
+ this.pdfHistory.initialize({
+ fingerprint,
+ resetHistory: viewOnLoad === ViewOnLoad.INITIAL,
+ updateUrl: _app_options.AppOptions.get("historyUpdateUrl")
+ });
+ if (this.pdfHistory.initialBookmark) {
+ this.initialBookmark = this.pdfHistory.initialBookmark;
+ this.initialRotation = this.pdfHistory.initialRotation;
+ }
+ if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) {
+ this.initialBookmark = JSON.stringify(initialDest);
+ this.pdfHistory.push({
+ explicitDest: initialDest,
+ pageNumber: null
+ });
+ }
+ },
+ _initializeAnnotationStorageCallbacks(pdfDocument) {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ const {
+ annotationStorage
+ } = pdfDocument;
+ annotationStorage.onSetModified = () => {
+ window.addEventListener("beforeunload", beforeUnload);
+ this._annotationStorageModified = true;
+ };
+ annotationStorage.onResetModified = () => {
+ window.removeEventListener("beforeunload", beforeUnload);
+ delete this._annotationStorageModified;
+ };
+ annotationStorage.onAnnotationEditor = typeStr => {
+ this._hasAnnotationEditors = !!typeStr;
+ this.setTitle();
+ if (typeStr) {
+ this.externalServices.reportTelemetry({
+ type: "editing",
+ data: {
+ type: typeStr
+ }
+ });
+ }
+ };
+ },
+ setInitialView(storedHash, {
+ rotation,
+ sidebarView,
+ scrollMode,
+ spreadMode
+ } = {}) {
+ const setRotation = angle => {
+ if ((0, _ui_utils.isValidRotation)(angle)) {
+ this.pdfViewer.pagesRotation = angle;
+ }
+ };
+ const setViewerModes = (scroll, spread) => {
+ if ((0, _ui_utils.isValidScrollMode)(scroll)) {
+ this.pdfViewer.scrollMode = scroll;
+ }
+ if ((0, _ui_utils.isValidSpreadMode)(spread)) {
+ this.pdfViewer.spreadMode = spread;
+ }
+ };
+ this.isInitialViewSet = true;
+ this.pdfSidebar?.setInitialView(sidebarView);
+ setViewerModes(scrollMode, spreadMode);
+ if (this.initialBookmark) {
+ setRotation(this.initialRotation);
+ delete this.initialRotation;
+ this.pdfLinkService.setHash(this.initialBookmark);
+ this.initialBookmark = null;
+ } else if (storedHash) {
+ setRotation(rotation);
+ this.pdfLinkService.setHash(storedHash);
+ }
+ this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel);
+ this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);
+ if (!this.pdfViewer.currentScaleValue) {
+ this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
+ }
+ },
+ _cleanup() {
+ if (!this.pdfDocument) {
+ return;
+ }
+ this.pdfViewer.cleanup();
+ this.pdfThumbnailViewer?.cleanup();
+ this.pdfDocument.cleanup();
+ },
+ forceRendering() {
+ this.pdfRenderingQueue.printing = !!this.printService;
+ this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar?.visibleView === _ui_utils.SidebarView.THUMBS;
+ this.pdfRenderingQueue.renderHighestPriority();
+ },
+ beforePrint() {
+ this._printAnnotationStoragePromise = this.pdfScriptingManager.dispatchWillPrint().catch(() => {
+ }).then(() => {
+ return this.pdfDocument?.annotationStorage.print;
+ });
+ if (this.printService) {
+ return;
+ }
+ if (!this.supportsPrinting) {
+ this.l10n.get("printing_not_supported").then(msg => {
+ this._otherError(msg);
+ });
+ return;
+ }
+ if (!this.pdfViewer.pageViewsReady) {
+ this.l10n.get("printing_not_ready").then(msg => {
+ window.alert(msg);
+ });
+ return;
+ }
+ const pagesOverview = this.pdfViewer.getPagesOverview();
+ const printContainer = this.appConfig.printContainer;
+ const printResolution = _app_options.AppOptions.get("printResolution");
+ const optionalContentConfigPromise = this.pdfViewer.optionalContentConfigPromise;
+ const printService = PDFPrintServiceFactory.instance.createPrintService(this.pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, this._printAnnotationStoragePromise, this.l10n);
+ this.printService = printService;
+ this.forceRendering();
+ this.setTitle();
+ printService.layout();
+ if (this._hasAnnotationEditors) {
+ this.externalServices.reportTelemetry({
+ type: "editing",
+ data: {
+ type: "print"
+ }
+ });
+ }
+ },
+ afterPrint() {
+ if (this._printAnnotationStoragePromise) {
+ this._printAnnotationStoragePromise.then(() => {
+ this.pdfScriptingManager.dispatchDidPrint();
+ });
+ this._printAnnotationStoragePromise = null;
+ }
+ if (this.printService) {
+ this.printService.destroy();
+ this.printService = null;
+ this.pdfDocument?.annotationStorage.resetModified();
+ }
+ this.forceRendering();
+ this.setTitle();
+ },
+ rotatePages(delta) {
+ this.pdfViewer.pagesRotation += delta;
+ },
+ requestPresentationMode() {
+ this.pdfPresentationMode?.request();
+ },
+ triggerPrinting() {
+ if (!this.supportsPrinting) {
+ return;
+ }
+ window.print();
+ },
+ bindEvents() {
+ const {
+ eventBus,
+ _boundEvents
+ } = this;
+ _boundEvents.beforePrint = this.beforePrint.bind(this);
+ _boundEvents.afterPrint = this.afterPrint.bind(this);
+ eventBus._on("resize", webViewerResize);
+ eventBus._on("hashchange", webViewerHashchange);
+ eventBus._on("beforeprint", _boundEvents.beforePrint);
+ eventBus._on("afterprint", _boundEvents.afterPrint);
+ eventBus._on("pagerender", webViewerPageRender);
+ eventBus._on("pagerendered", webViewerPageRendered);
+ eventBus._on("updateviewarea", webViewerUpdateViewarea);
+ eventBus._on("pagechanging", webViewerPageChanging);
+ eventBus._on("scalechanging", webViewerScaleChanging);
+ eventBus._on("rotationchanging", webViewerRotationChanging);
+ eventBus._on("sidebarviewchanged", webViewerSidebarViewChanged);
+ eventBus._on("pagemode", webViewerPageMode);
+ eventBus._on("namedaction", webViewerNamedAction);
+ eventBus._on("presentationmodechanged", webViewerPresentationModeChanged);
+ eventBus._on("presentationmode", webViewerPresentationMode);
+ eventBus._on("switchannotationeditormode", webViewerSwitchAnnotationEditorMode);
+ eventBus._on("switchannotationeditorparams", webViewerSwitchAnnotationEditorParams);
+ eventBus._on("print", webViewerPrint);
+ eventBus._on("download", webViewerDownload);
+ eventBus._on("openinexternalapp", webViewerOpenInExternalApp);
+ eventBus._on("firstpage", webViewerFirstPage);
+ eventBus._on("lastpage", webViewerLastPage);
+ eventBus._on("nextpage", webViewerNextPage);
+ eventBus._on("previouspage", webViewerPreviousPage);
+ eventBus._on("zoomin", webViewerZoomIn);
+ eventBus._on("zoomout", webViewerZoomOut);
+ eventBus._on("zoomreset", webViewerZoomReset);
+ eventBus._on("pagenumberchanged", webViewerPageNumberChanged);
+ eventBus._on("scalechanged", webViewerScaleChanged);
+ eventBus._on("rotatecw", webViewerRotateCw);
+ eventBus._on("rotateccw", webViewerRotateCcw);
+ eventBus._on("optionalcontentconfig", webViewerOptionalContentConfig);
+ eventBus._on("switchscrollmode", webViewerSwitchScrollMode);
+ eventBus._on("scrollmodechanged", webViewerScrollModeChanged);
+ eventBus._on("switchspreadmode", webViewerSwitchSpreadMode);
+ eventBus._on("spreadmodechanged", webViewerSpreadModeChanged);
+ eventBus._on("documentproperties", webViewerDocumentProperties);
+ eventBus._on("findfromurlhash", webViewerFindFromUrlHash);
+ eventBus._on("updatefindmatchescount", webViewerUpdateFindMatchesCount);
+ eventBus._on("updatefindcontrolstate", webViewerUpdateFindControlState);
+ if (_app_options.AppOptions.get("pdfBug")) {
+ _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug;
+ eventBus._on("pagerendered", _boundEvents.reportPageStatsPDFBug);
+ eventBus._on("pagechanging", _boundEvents.reportPageStatsPDFBug);
+ }
+ eventBus._on("fileinputchange", webViewerFileInputChange);
+ eventBus._on("openfile", webViewerOpenFile);
+ },
+ bindWindowEvents() {
+ const {
+ eventBus,
+ _boundEvents
+ } = this;
+
+ function addWindowResolutionChange(evt = null) {
+ if (evt) {
+ webViewerResolutionChange(evt);
+ }
+ const mediaQueryList = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`);
+ mediaQueryList.addEventListener("change", addWindowResolutionChange, {
+ once: true
+ });
+ _boundEvents.removeWindowResolutionChange ||= function () {
+ mediaQueryList.removeEventListener("change", addWindowResolutionChange);
+ _boundEvents.removeWindowResolutionChange = null;
+ };
+ }
+
+ addWindowResolutionChange();
+ _boundEvents.windowResize = () => {
+ eventBus.dispatch("resize", {
+ source: window
+ });
+ };
+ _boundEvents.windowHashChange = () => {
+ eventBus.dispatch("hashchange", {
+ source: window,
+ hash: document.location.hash.substring(1)
+ });
+ };
+ _boundEvents.windowBeforePrint = () => {
+ eventBus.dispatch("beforeprint", {
+ source: window
+ });
+ };
+ _boundEvents.windowAfterPrint = () => {
+ eventBus.dispatch("afterprint", {
+ source: window
+ });
+ };
+ _boundEvents.windowUpdateFromSandbox = event => {
+ eventBus.dispatch("updatefromsandbox", {
+ source: window,
+ detail: event.detail
+ });
+ };
+ window.addEventListener("visibilitychange", webViewerVisibilityChange);
+ window.addEventListener("wheel", webViewerWheel, {
+ passive: false
+ });
+ window.addEventListener("touchstart", webViewerTouchStart, {
+ passive: false
+ });
+ window.addEventListener("touchmove", webViewerTouchMove, {
+ passive: false
+ });
+ window.addEventListener("touchend", webViewerTouchEnd, {
+ passive: false
+ });
+ window.addEventListener("click", webViewerClick);
+ window.addEventListener("keydown", webViewerKeyDown);
+ window.addEventListener("keyup", webViewerKeyUp);
+ window.addEventListener("resize", _boundEvents.windowResize);
+ window.addEventListener("hashchange", _boundEvents.windowHashChange);
+ window.addEventListener("beforeprint", _boundEvents.windowBeforePrint);
+ window.addEventListener("afterprint", _boundEvents.windowAfterPrint);
+ window.addEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox);
+ },
+ unbindEvents() {
+ const {
+ eventBus,
+ _boundEvents
+ } = this;
+ eventBus._off("resize", webViewerResize);
+ eventBus._off("hashchange", webViewerHashchange);
+ eventBus._off("beforeprint", _boundEvents.beforePrint);
+ eventBus._off("afterprint", _boundEvents.afterPrint);
+ eventBus._off("pagerender", webViewerPageRender);
+ eventBus._off("pagerendered", webViewerPageRendered);
+ eventBus._off("updateviewarea", webViewerUpdateViewarea);
+ eventBus._off("pagechanging", webViewerPageChanging);
+ eventBus._off("scalechanging", webViewerScaleChanging);
+ eventBus._off("rotationchanging", webViewerRotationChanging);
+ eventBus._off("sidebarviewchanged", webViewerSidebarViewChanged);
+ eventBus._off("pagemode", webViewerPageMode);
+ eventBus._off("namedaction", webViewerNamedAction);
+ eventBus._off("presentationmodechanged", webViewerPresentationModeChanged);
+ eventBus._off("presentationmode", webViewerPresentationMode);
+ eventBus._off("print", webViewerPrint);
+ eventBus._off("download", webViewerDownload);
+ eventBus._off("openinexternalapp", webViewerOpenInExternalApp);
+ eventBus._off("firstpage", webViewerFirstPage);
+ eventBus._off("lastpage", webViewerLastPage);
+ eventBus._off("nextpage", webViewerNextPage);
+ eventBus._off("previouspage", webViewerPreviousPage);
+ eventBus._off("zoomin", webViewerZoomIn);
+ eventBus._off("zoomout", webViewerZoomOut);
+ eventBus._off("zoomreset", webViewerZoomReset);
+ eventBus._off("pagenumberchanged", webViewerPageNumberChanged);
+ eventBus._off("scalechanged", webViewerScaleChanged);
+ eventBus._off("rotatecw", webViewerRotateCw);
+ eventBus._off("rotateccw", webViewerRotateCcw);
+ eventBus._off("optionalcontentconfig", webViewerOptionalContentConfig);
+ eventBus._off("switchscrollmode", webViewerSwitchScrollMode);
+ eventBus._off("scrollmodechanged", webViewerScrollModeChanged);
+ eventBus._off("switchspreadmode", webViewerSwitchSpreadMode);
+ eventBus._off("spreadmodechanged", webViewerSpreadModeChanged);
+ eventBus._off("documentproperties", webViewerDocumentProperties);
+ eventBus._off("findfromurlhash", webViewerFindFromUrlHash);
+ eventBus._off("updatefindmatchescount", webViewerUpdateFindMatchesCount);
+ eventBus._off("updatefindcontrolstate", webViewerUpdateFindControlState);
+ if (_boundEvents.reportPageStatsPDFBug) {
+ eventBus._off("pagerendered", _boundEvents.reportPageStatsPDFBug);
+ eventBus._off("pagechanging", _boundEvents.reportPageStatsPDFBug);
+ _boundEvents.reportPageStatsPDFBug = null;
+ }
+ eventBus._off("fileinputchange", webViewerFileInputChange);
+ eventBus._off("openfile", webViewerOpenFile);
+ _boundEvents.beforePrint = null;
+ _boundEvents.afterPrint = null;
+ },
+ unbindWindowEvents() {
+ const {
+ _boundEvents
+ } = this;
+ window.removeEventListener("visibilitychange", webViewerVisibilityChange);
+ window.removeEventListener("wheel", webViewerWheel, {
+ passive: false
+ });
+ window.removeEventListener("touchstart", webViewerTouchStart, {
+ passive: false
+ });
+ window.removeEventListener("touchmove", webViewerTouchMove, {
+ passive: false
+ });
+ window.removeEventListener("touchend", webViewerTouchEnd, {
+ passive: false
+ });
+ window.removeEventListener("click", webViewerClick);
+ window.removeEventListener("keydown", webViewerKeyDown);
+ window.removeEventListener("keyup", webViewerKeyUp);
+ window.removeEventListener("resize", _boundEvents.windowResize);
+ window.removeEventListener("hashchange", _boundEvents.windowHashChange);
+ window.removeEventListener("beforeprint", _boundEvents.windowBeforePrint);
+ window.removeEventListener("afterprint", _boundEvents.windowAfterPrint);
+ window.removeEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox);
+ _boundEvents.removeWindowResolutionChange?.();
+ _boundEvents.windowResize = null;
+ _boundEvents.windowHashChange = null;
+ _boundEvents.windowBeforePrint = null;
+ _boundEvents.windowAfterPrint = null;
+ _boundEvents.windowUpdateFromSandbox = null;
+ },
+ _accumulateTicks(ticks, prop) {
+ if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) {
+ this[prop] = 0;
+ }
+ this[prop] += ticks;
+ const wholeTicks = Math.trunc(this[prop]);
+ this[prop] -= wholeTicks;
+ return wholeTicks;
+ },
+ _accumulateFactor(previousScale, factor, prop) {
+ if (factor === 1) {
+ return 1;
+ }
+ if (this[prop] > 1 && factor < 1 || this[prop] < 1 && factor > 1) {
+ this[prop] = 1;
+ }
+ const newFactor = Math.floor(previousScale * factor * this[prop] * 100) / (100 * previousScale);
+ this[prop] = factor / newFactor;
+ return newFactor;
+ },
+ _centerAtPos(previousScale, x, y) {
+ const {
+ pdfViewer
+ } = this;
+ const scaleDiff = pdfViewer.currentScale / previousScale - 1;
+ if (scaleDiff !== 0) {
+ const [top, left] = pdfViewer.containerTopLeft;
+ pdfViewer.container.scrollLeft += (x - left) * scaleDiff;
+ pdfViewer.container.scrollTop += (y - top) * scaleDiff;
+ }
+ },
+ _unblockDocumentLoadEvent() {
+ document.blockUnblockOnload?.(false);
+ this._unblockDocumentLoadEvent = () => {
+ };
+ },
+ get scriptingReady() {
+ return this.pdfScriptingManager.ready;
+ }
+ };
+ exports.PDFViewerApplication = PDFViewerApplication;
+ {
+ const HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io"];
+ var validateFileURL = function (file) {
+ if (!file) {
+ return;
+ }
+ try {
+ const viewerOrigin = new URL(window.location.href).origin || "null";
+ if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {
+ return;
+ }
+ const fileOrigin = new URL(file, window.location.href).origin;
+ if (fileOrigin !== viewerOrigin) {
+ throw new Error("file origin does not match viewer's");
+ }
+ } catch (ex) {
+ PDFViewerApplication.l10n.get("loading_error").then(msg => {
+ PDFViewerApplication._documentError(msg, {
+ message: ex?.message
+ });
+ });
+ throw ex;
+ }
+ };
+ }
+
+ async function loadFakeWorker() {
+ _pdfjsLib.GlobalWorkerOptions.workerSrc ||= _app_options.AppOptions.get("workerSrc");
+ await (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.workerSrc);
+ }
+
+ async function loadPDFBug(self) {
+ const {
+ debuggerScriptPath
+ } = self.appConfig;
+ const {
+ PDFBug
+ } = await import(debuggerScriptPath);
+ self._PDFBug = PDFBug;
+ }
+
+ function reportPageStatsPDFBug({
+ pageNumber
+ }) {
+ if (!globalThis.Stats?.enabled) {
+ return;
+ }
+ const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
+ globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);
+ }
+
+ function webViewerPageRender({
+ pageNumber
+ }) {
+ if (pageNumber === PDFViewerApplication.page) {
+ PDFViewerApplication.toolbar?.updateLoadingIndicatorState(true);
+ }
+ }
+
+ function webViewerPageRendered({
+ pageNumber,
+ error
+ }) {
+ if (pageNumber === PDFViewerApplication.page) {
+ PDFViewerApplication.toolbar?.updateLoadingIndicatorState(false);
+ }
+ if (PDFViewerApplication.pdfSidebar?.visibleView === _ui_utils.SidebarView.THUMBS) {
+ const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
+ const thumbnailView = PDFViewerApplication.pdfThumbnailViewer?.getThumbnail(pageNumber - 1);
+ if (pageView) {
+ thumbnailView?.setImage(pageView);
+ }
+ }
+ if (error) {
+ PDFViewerApplication.l10n.get("rendering_error").then(msg => {
+ PDFViewerApplication._otherError(msg, error);
+ });
+ }
+ }
+
+ function webViewerPageMode({
+ mode
+ }) {
+ let view;
+ switch (mode) {
+ case "thumbs":
+ view = _ui_utils.SidebarView.THUMBS;
+ break;
+ case "bookmarks":
+ case "outline":
+ view = _ui_utils.SidebarView.OUTLINE;
+ break;
+ case "attachments":
+ view = _ui_utils.SidebarView.ATTACHMENTS;
+ break;
+ case "layers":
+ view = _ui_utils.SidebarView.LAYERS;
+ break;
+ case "none":
+ view = _ui_utils.SidebarView.NONE;
+ break;
+ default:
+ console.error('Invalid "pagemode" hash parameter: ' + mode);
+ return;
+ }
+ PDFViewerApplication.pdfSidebar?.switchView(view, true);
+ }
+
+ function webViewerNamedAction(evt) {
+ switch (evt.action) {
+ case "GoToPage":
+ PDFViewerApplication.appConfig.toolbar?.pageNumber.select();
+ break;
+ case "Find":
+ if (!PDFViewerApplication.supportsIntegratedFind) {
+ PDFViewerApplication?.findBar.toggle();
+ }
+ break;
+ case "Print":
+ PDFViewerApplication.triggerPrinting();
+ break;
+ case "SaveAs":
+ PDFViewerApplication.downloadOrSave();
+ break;
+ }
+ }
+
+ function webViewerPresentationModeChanged(evt) {
+ PDFViewerApplication.pdfViewer.presentationModeState = evt.state;
+ }
+
+ function webViewerSidebarViewChanged({
+ view
+ }) {
+ PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = view === _ui_utils.SidebarView.THUMBS;
+ if (PDFViewerApplication.isInitialViewSet) {
+ PDFViewerApplication.store?.set("sidebarView", view).catch(() => {
+ });
+ }
+ }
+
+ function webViewerUpdateViewarea({
+ location
+ }) {
+ if (PDFViewerApplication.isInitialViewSet) {
+ PDFViewerApplication.store?.setMultiple({
+ page: location.pageNumber,
+ zoom: location.scale,
+ scrollLeft: location.left,
+ scrollTop: location.top,
+ rotation: location.rotation
+ }).catch(() => {
+ });
+ }
+ if (PDFViewerApplication.appConfig.secondaryToolbar) {
+ const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams);
+ PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href;
+ }
+ }
+
+ function webViewerScrollModeChanged(evt) {
+ if (PDFViewerApplication.isInitialViewSet && !PDFViewerApplication.pdfViewer.isInPresentationMode) {
+ PDFViewerApplication.store?.set("scrollMode", evt.mode).catch(() => {
+ });
+ }
+ }
+
+ function webViewerSpreadModeChanged(evt) {
+ if (PDFViewerApplication.isInitialViewSet && !PDFViewerApplication.pdfViewer.isInPresentationMode) {
+ PDFViewerApplication.store?.set("spreadMode", evt.mode).catch(() => {
+ });
+ }
+ }
+
+ function webViewerResize() {
+ const {
+ pdfDocument,
+ pdfViewer,
+ pdfRenderingQueue
+ } = PDFViewerApplication;
+ if (pdfRenderingQueue.printing && window.matchMedia("print").matches) {
+ return;
+ }
+ if (!pdfDocument) {
+ return;
+ }
+ const currentScaleValue = pdfViewer.currentScaleValue;
+ if (currentScaleValue === "auto" || currentScaleValue === "page-fit" || currentScaleValue === "page-width") {
+ pdfViewer.currentScaleValue = currentScaleValue;
+ }
+ pdfViewer.update();
+ }
+
+ function webViewerHashchange(evt) {
+ const hash = evt.hash;
+ if (!hash) {
+ return;
+ }
+ if (!PDFViewerApplication.isInitialViewSet) {
+ PDFViewerApplication.initialBookmark = hash;
+ } else if (!PDFViewerApplication.pdfHistory?.popStateInProgress) {
+ PDFViewerApplication.pdfLinkService.setHash(hash);
+ }
+ }
+
+ {
+ var webViewerFileInputChange = function (evt) {
+ if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {
+ return;
+ }
+ const file = evt.fileInput.files[0];
+ PDFViewerApplication.open({
+ url: URL.createObjectURL(file),
+ originalUrl: file.name
+ });
+ };
+ var webViewerOpenFile = function (evt) {
+ const fileInput = PDFViewerApplication.appConfig.openFileInput;
+ fileInput.click();
+ };
+ }
+
+ function webViewerPresentationMode() {
+ PDFViewerApplication.requestPresentationMode();
+ }
+
+ function webViewerSwitchAnnotationEditorMode(evt) {
+ PDFViewerApplication.pdfViewer.annotationEditorMode = evt;
+ }
+
+ function webViewerSwitchAnnotationEditorParams(evt) {
+ PDFViewerApplication.pdfViewer.annotationEditorParams = evt;
+ }
+
+ function webViewerPrint() {
+ PDFViewerApplication.triggerPrinting();
+ }
+
+ function webViewerDownload() {
+ PDFViewerApplication.downloadOrSave();
+ }
+
+ function webViewerOpenInExternalApp() {
+ PDFViewerApplication.openInExternalApp();
+ }
+
+ function webViewerFirstPage() {
+ PDFViewerApplication.page = 1;
+ }
+
+ function webViewerLastPage() {
+ PDFViewerApplication.page = PDFViewerApplication.pagesCount;
+ }
+
+ function webViewerNextPage() {
+ PDFViewerApplication.pdfViewer.nextPage();
+ }
+
+ function webViewerPreviousPage() {
+ PDFViewerApplication.pdfViewer.previousPage();
+ }
+
+ function webViewerZoomIn() {
+ PDFViewerApplication.zoomIn();
+ }
+
+ function webViewerZoomOut() {
+ PDFViewerApplication.zoomOut();
+ }
+
+ function webViewerZoomReset() {
+ PDFViewerApplication.zoomReset();
+ }
+
+ function webViewerPageNumberChanged(evt) {
+ const pdfViewer = PDFViewerApplication.pdfViewer;
+ if (evt.value !== "") {
+ PDFViewerApplication.pdfLinkService.goToPage(evt.value);
+ }
+ if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) {
+ PDFViewerApplication.toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
+ }
+ }
+
+ function webViewerScaleChanged(evt) {
+ PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;
+ }
+
+ function webViewerRotateCw() {
+ PDFViewerApplication.rotatePages(90);
+ }
+
+ function webViewerRotateCcw() {
+ PDFViewerApplication.rotatePages(-90);
+ }
+
+ function webViewerOptionalContentConfig(evt) {
+ PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise;
+ }
+
+ function webViewerSwitchScrollMode(evt) {
+ PDFViewerApplication.pdfViewer.scrollMode = evt.mode;
+ }
+
+ function webViewerSwitchSpreadMode(evt) {
+ PDFViewerApplication.pdfViewer.spreadMode = evt.mode;
+ }
+
+ function webViewerDocumentProperties() {
+ PDFViewerApplication.pdfDocumentProperties?.open();
+ }
+
+ function webViewerFindFromUrlHash(evt) {
+ PDFViewerApplication.eventBus.dispatch("find", {
+ source: evt.source,
+ type: "",
+ query: evt.query,
+ caseSensitive: false,
+ entireWord: false,
+ highlightAll: true,
+ findPrevious: false,
+ matchDiacritics: true
+ });
+ }
+
+ function webViewerUpdateFindMatchesCount({
+ matchesCount
+ }) {
+ if (PDFViewerApplication.supportsIntegratedFind) {
+ PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);
+ } else {
+ PDFViewerApplication.findBar.updateResultsCount(matchesCount);
+ }
+ }
+
+ function webViewerUpdateFindControlState({
+ state,
+ previous,
+ matchesCount,
+ rawQuery
+ }) {
+ if (PDFViewerApplication.supportsIntegratedFind) {
+ PDFViewerApplication.externalServices.updateFindControlState({
+ result: state,
+ findPrevious: previous,
+ matchesCount,
+ rawQuery
+ });
+ } else {
+ PDFViewerApplication.findBar?.updateUIState(state, previous, matchesCount);
+ }
+ }
+
+ function webViewerScaleChanging(evt) {
+ PDFViewerApplication.toolbar?.setPageScale(evt.presetValue, evt.scale);
+ PDFViewerApplication.pdfViewer.update();
+ }
+
+ function webViewerRotationChanging(evt) {
+ if (PDFViewerApplication.pdfThumbnailViewer) {
+ PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;
+ }
+ PDFViewerApplication.forceRendering();
+ PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber;
+ }
+
+ function webViewerPageChanging({
+ pageNumber,
+ pageLabel
+ }) {
+ PDFViewerApplication.toolbar?.setPageNumber(pageNumber, pageLabel);
+ PDFViewerApplication.secondaryToolbar?.setPageNumber(pageNumber);
+ if (PDFViewerApplication.pdfSidebar?.visibleView === _ui_utils.SidebarView.THUMBS) {
+ PDFViewerApplication.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);
+ }
+ const currentPage = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
+ PDFViewerApplication.toolbar?.updateLoadingIndicatorState(currentPage?.renderingState === _ui_utils.RenderingStates.RUNNING);
+ }
+
+ function webViewerResolutionChange(evt) {
+ PDFViewerApplication.pdfViewer.refresh();
+ }
+
+ function webViewerVisibilityChange(evt) {
+ if (document.visibilityState === "visible") {
+ setZoomDisabledTimeout();
+ }
+ }
+
+ let zoomDisabledTimeout = null;
+
+ function setZoomDisabledTimeout() {
+ if (zoomDisabledTimeout) {
+ clearTimeout(zoomDisabledTimeout);
+ }
+ zoomDisabledTimeout = setTimeout(function () {
+ zoomDisabledTimeout = null;
+ }, WHEEL_ZOOM_DISABLED_TIMEOUT);
+ }
+
+ function webViewerWheel(evt) {
+ const {
+ pdfViewer,
+ supportedMouseWheelZoomModifierKeys,
+ supportsPinchToZoom
+ } = PDFViewerApplication;
+ if (pdfViewer.isInPresentationMode) {
+ return;
+ }
+ const deltaMode = evt.deltaMode;
+ let scaleFactor = Math.exp(-evt.deltaY / 100);
+ const isBuiltInMac = false;
+ const isPinchToZoom = evt.ctrlKey && !PDFViewerApplication._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;
+ if (isPinchToZoom || evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey || evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey) {
+ evt.preventDefault();
+ if (zoomDisabledTimeout || document.visibilityState === "hidden" || PDFViewerApplication.overlayManager.active) {
+ return;
+ }
+ const previousScale = pdfViewer.currentScale;
+ if (isPinchToZoom && supportsPinchToZoom) {
+ scaleFactor = PDFViewerApplication._accumulateFactor(previousScale, scaleFactor, "_wheelUnusedFactor");
+ if (scaleFactor < 1) {
+ PDFViewerApplication.zoomOut(null, scaleFactor);
+ } else if (scaleFactor > 1) {
+ PDFViewerApplication.zoomIn(null, scaleFactor);
+ } else {
+ return;
+ }
+ } else {
+ const delta = (0, _ui_utils.normalizeWheelEventDirection)(evt);
+ let ticks = 0;
+ if (deltaMode === WheelEvent.DOM_DELTA_LINE || deltaMode === WheelEvent.DOM_DELTA_PAGE) {
+ if (Math.abs(delta) >= 1) {
+ ticks = Math.sign(delta);
+ } else {
+ ticks = PDFViewerApplication._accumulateTicks(delta, "_wheelUnusedTicks");
+ }
+ } else {
+ const PIXELS_PER_LINE_SCALE = 30;
+ ticks = PDFViewerApplication._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");
+ }
+ if (ticks < 0) {
+ PDFViewerApplication.zoomOut(-ticks);
+ } else if (ticks > 0) {
+ PDFViewerApplication.zoomIn(ticks);
+ } else {
+ return;
+ }
+ }
+ PDFViewerApplication._centerAtPos(previousScale, evt.clientX, evt.clientY);
+ } else {
+ setZoomDisabledTimeout();
+ }
+ }
+
+ function webViewerTouchStart(evt) {
+ if (PDFViewerApplication.pdfViewer.isInPresentationMode || evt.touches.length < 2) {
+ return;
+ }
+ evt.preventDefault();
+ if (evt.touches.length !== 2 || PDFViewerApplication.overlayManager.active) {
+ PDFViewerApplication._touchInfo = null;
+ return;
+ }
+ let [touch0, touch1] = evt.touches;
+ if (touch0.identifier > touch1.identifier) {
+ [touch0, touch1] = [touch1, touch0];
+ }
+ PDFViewerApplication._touchInfo = {
+ touch0X: touch0.pageX,
+ touch0Y: touch0.pageY,
+ touch1X: touch1.pageX,
+ touch1Y: touch1.pageY
+ };
+ }
+
+ function webViewerTouchMove(evt) {
+ if (!PDFViewerApplication._touchInfo || evt.touches.length !== 2) {
+ return;
+ }
+ const {
+ pdfViewer,
+ _touchInfo,
+ supportsPinchToZoom
+ } = PDFViewerApplication;
+ let [touch0, touch1] = evt.touches;
+ if (touch0.identifier > touch1.identifier) {
+ [touch0, touch1] = [touch1, touch0];
+ }
+ const {
+ pageX: page0X,
+ pageY: page0Y
+ } = touch0;
+ const {
+ pageX: page1X,
+ pageY: page1Y
+ } = touch1;
+ const {
+ touch0X: pTouch0X,
+ touch0Y: pTouch0Y,
+ touch1X: pTouch1X,
+ touch1Y: pTouch1Y
+ } = _touchInfo;
+ if (Math.abs(pTouch0X - page0X) <= 1 && Math.abs(pTouch0Y - page0Y) <= 1 && Math.abs(pTouch1X - page1X) <= 1 && Math.abs(pTouch1Y - page1Y) <= 1) {
+ return;
+ }
+ _touchInfo.touch0X = page0X;
+ _touchInfo.touch0Y = page0Y;
+ _touchInfo.touch1X = page1X;
+ _touchInfo.touch1Y = page1Y;
+ if (pTouch0X === page0X && pTouch0Y === page0Y) {
+ const v1X = pTouch1X - page0X;
+ const v1Y = pTouch1Y - page0Y;
+ const v2X = page1X - page0X;
+ const v2Y = page1Y - page0Y;
+ const det = v1X * v2Y - v1Y * v2X;
+ if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {
+ return;
+ }
+ } else if (pTouch1X === page1X && pTouch1Y === page1Y) {
+ const v1X = pTouch0X - page1X;
+ const v1Y = pTouch0Y - page1Y;
+ const v2X = page0X - page1X;
+ const v2Y = page0Y - page1Y;
+ const det = v1X * v2Y - v1Y * v2X;
+ if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {
+ return;
+ }
+ } else {
+ const diff0X = page0X - pTouch0X;
+ const diff1X = page1X - pTouch1X;
+ const diff0Y = page0Y - pTouch0Y;
+ const diff1Y = page1Y - pTouch1Y;
+ const dotProduct = diff0X * diff1X + diff0Y * diff1Y;
+ if (dotProduct >= 0) {
+ return;
+ }
+ }
+ evt.preventDefault();
+ const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;
+ const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;
+ const previousScale = pdfViewer.currentScale;
+ if (supportsPinchToZoom) {
+ const newScaleFactor = PDFViewerApplication._accumulateFactor(previousScale, distance / pDistance, "_touchUnusedFactor");
+ if (newScaleFactor < 1) {
+ PDFViewerApplication.zoomOut(null, newScaleFactor);
+ } else if (newScaleFactor > 1) {
+ PDFViewerApplication.zoomIn(null, newScaleFactor);
+ } else {
+ return;
+ }
+ } else {
+ const PIXELS_PER_LINE_SCALE = 30;
+ const ticks = PDFViewerApplication._accumulateTicks((distance - pDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");
+ if (ticks < 0) {
+ PDFViewerApplication.zoomOut(-ticks);
+ } else if (ticks > 0) {
+ PDFViewerApplication.zoomIn(ticks);
+ } else {
+ return;
+ }
+ }
+ PDFViewerApplication._centerAtPos(previousScale, (page0X + page1X) / 2, (page0Y + page1Y) / 2);
+ }
+
+ function webViewerTouchEnd(evt) {
+ if (!PDFViewerApplication._touchInfo) {
+ return;
+ }
+ evt.preventDefault();
+ PDFViewerApplication._touchInfo = null;
+ PDFViewerApplication._touchUnusedTicks = 0;
+ PDFViewerApplication._touchUnusedFactor = 1;
+ }
+
+ function webViewerClick(evt) {
+ if (!PDFViewerApplication.secondaryToolbar?.isOpen) {
+ return;
+ }
+ const appConfig = PDFViewerApplication.appConfig;
+ if (PDFViewerApplication.pdfViewer.containsElement(evt.target) || appConfig.toolbar?.container.contains(evt.target) && evt.target !== appConfig.secondaryToolbar?.toggleButton) {
+ PDFViewerApplication.secondaryToolbar.close();
+ }
+ }
+
+ function webViewerKeyUp(evt) {
+ if (evt.key === "Control") {
+ PDFViewerApplication._isCtrlKeyDown = false;
+ }
+ }
+
+ function webViewerKeyDown(evt) {
+ PDFViewerApplication._isCtrlKeyDown = evt.key === "Control";
+ if (PDFViewerApplication.overlayManager.active) {
+ return;
+ }
+ const {
+ eventBus,
+ pdfViewer
+ } = PDFViewerApplication;
+ const isViewerInPresentationMode = pdfViewer.isInPresentationMode;
+ let handled = false,
+ ensureViewerFocused = false;
+ const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0);
+ if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
+ switch (evt.keyCode) {
+ case 70:
+ if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) {
+ PDFViewerApplication.findBar?.open();
+ handled = true;
+ }
+ break;
+ case 71:
+ if (!PDFViewerApplication.supportsIntegratedFind) {
+ const {
+ state
+ } = PDFViewerApplication.findController;
+ if (state) {
+ const newState = {
+ source: window,
+ type: "again",
+ findPrevious: cmd === 5 || cmd === 12
+ };
+ eventBus.dispatch("find", {
+ ...state,
+ ...newState
+ });
+ }
+ handled = true;
+ }
+ break;
+ case 61:
+ case 107:
+ case 187:
+ case 171:
+ PDFViewerApplication.zoomIn();
+ handled = true;
+ break;
+ case 173:
+ case 109:
+ case 189:
+ PDFViewerApplication.zoomOut();
+ handled = true;
+ break;
+ case 48:
+ case 96:
+ if (!isViewerInPresentationMode) {
+ setTimeout(function () {
+ PDFViewerApplication.zoomReset();
+ });
+ handled = false;
+ }
+ break;
+ case 38:
+ if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {
+ PDFViewerApplication.page = 1;
+ handled = true;
+ ensureViewerFocused = true;
+ }
+ break;
+ case 40:
+ if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
+ PDFViewerApplication.page = PDFViewerApplication.pagesCount;
+ handled = true;
+ ensureViewerFocused = true;
+ }
+ break;
+ }
+ }
+ if (cmd === 1 || cmd === 8) {
+ switch (evt.keyCode) {
+ case 83:
+ eventBus.dispatch("download", {
+ source: window
+ });
+ handled = true;
+ break;
+ case 79: {
+ eventBus.dispatch("openfile", {
+ source: window
+ });
+ handled = true;
+ }
+ break;
+ }
+ }
+ if (cmd === 3 || cmd === 10) {
+ switch (evt.keyCode) {
+ case 80:
+ PDFViewerApplication.requestPresentationMode();
+ handled = true;
+ PDFViewerApplication.externalServices.reportTelemetry({
+ type: "buttons",
+ data: {
+ id: "presentationModeKeyboard"
+ }
+ });
+ break;
+ case 71:
+ if (PDFViewerApplication.appConfig.toolbar) {
+ PDFViewerApplication.appConfig.toolbar.pageNumber.select();
+ handled = true;
+ }
+ break;
+ }
+ }
+ if (handled) {
+ if (ensureViewerFocused && !isViewerInPresentationMode) {
+ pdfViewer.focus();
+ }
+ evt.preventDefault();
+ return;
+ }
+ const curElement = (0, _ui_utils.getActiveOrFocusedElement)();
+ const curElementTagName = curElement?.tagName.toUpperCase();
+ if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElement?.isContentEditable) {
+ if (evt.keyCode !== 27) {
+ return;
+ }
+ }
+ if (cmd === 0) {
+ let turnPage = 0,
+ turnOnlyIfPageFit = false;
+ switch (evt.keyCode) {
+ case 38:
+ case 33:
+ if (pdfViewer.isVerticalScrollbarEnabled) {
+ turnOnlyIfPageFit = true;
+ }
+ turnPage = -1;
+ break;
+ case 8:
+ if (!isViewerInPresentationMode) {
+ turnOnlyIfPageFit = true;
+ }
+ turnPage = -1;
+ break;
+ case 37:
+ if (pdfViewer.isHorizontalScrollbarEnabled) {
+ turnOnlyIfPageFit = true;
+ }
+ case 75:
+ case 80:
+ turnPage = -1;
+ break;
+ case 27:
+ if (PDFViewerApplication.secondaryToolbar?.isOpen) {
+ PDFViewerApplication.secondaryToolbar.close();
+ handled = true;
+ }
+ if (!PDFViewerApplication.supportsIntegratedFind && PDFViewerApplication.findBar?.opened) {
+ PDFViewerApplication.findBar.close();
+ handled = true;
+ }
+ break;
+ case 40:
+ case 34:
+ if (pdfViewer.isVerticalScrollbarEnabled) {
+ turnOnlyIfPageFit = true;
+ }
+ turnPage = 1;
+ break;
+ case 13:
+ case 32:
+ if (!isViewerInPresentationMode) {
+ turnOnlyIfPageFit = true;
+ }
+ turnPage = 1;
+ break;
+ case 39:
+ if (pdfViewer.isHorizontalScrollbarEnabled) {
+ turnOnlyIfPageFit = true;
+ }
+ case 74:
+ case 78:
+ turnPage = 1;
+ break;
+ case 36:
+ if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {
+ PDFViewerApplication.page = 1;
+ handled = true;
+ ensureViewerFocused = true;
+ }
+ break;
+ case 35:
+ if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
+ PDFViewerApplication.page = PDFViewerApplication.pagesCount;
+ handled = true;
+ ensureViewerFocused = true;
+ }
+ break;
+ case 83:
+ PDFViewerApplication.pdfCursorTools?.switchTool(_ui_utils.CursorTool.SELECT);
+ break;
+ case 72:
+ PDFViewerApplication.pdfCursorTools?.switchTool(_ui_utils.CursorTool.HAND);
+ break;
+ case 82:
+ PDFViewerApplication.rotatePages(90);
+ break;
+ case 115:
+ PDFViewerApplication.pdfSidebar?.toggle();
+ break;
+ }
+ if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) {
+ if (turnPage > 0) {
+ pdfViewer.nextPage();
+ } else {
+ pdfViewer.previousPage();
+ }
+ handled = true;
+ }
+ }
+ if (cmd === 4) {
+ switch (evt.keyCode) {
+ case 13:
+ case 32:
+ if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== "page-fit") {
+ break;
+ }
+ pdfViewer.previousPage();
+ handled = true;
+ break;
+ case 82:
+ PDFViewerApplication.rotatePages(-90);
+ break;
+ }
+ }
+ if (!handled && !isViewerInPresentationMode) {
+ if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== "BUTTON") {
+ ensureViewerFocused = true;
+ }
+ }
+ if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {
+ pdfViewer.focus();
+ }
+ if (handled) {
+ evt.preventDefault();
+ }
+ }
+
+ function beforeUnload(evt) {
+ evt.preventDefault();
+ evt.returnValue = "";
+ return false;
+ }
+
+ function webViewerAnnotationEditorStatesChanged(data) {
+ PDFViewerApplication.externalServices.updateEditorStates(data);
+ }
+
+ function webViewerReportTelemetry({
+ details
+ }) {
+ PDFViewerApplication.externalServices.reportTelemetry(details);
+ }
+
+ const PDFPrintServiceFactory = {
+ instance: {
+ supportsPrinting: false,
+ createPrintService() {
+ throw new Error("Not implemented: createPrintService");
+ }
+ }
+ };
+ exports.PDFPrintServiceFactory = PDFPrintServiceFactory;
+
+ /***/
+ }),
+ /* 3 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.animationStarted = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RenderingStates = exports.ProgressBar = exports.PresentationModeState = exports.OutputScale = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.CursorTool = exports.AutoPrintRegExp = void 0;
+ exports.apiPageLayoutToViewerModes = apiPageLayoutToViewerModes;
+ exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
+ exports.approximateFraction = approximateFraction;
+ exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
+ exports.binarySearchFirstItem = binarySearchFirstItem;
+ exports.docStyle = void 0;
+ exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
+ exports.getPageSizeInches = getPageSizeInches;
+ exports.getVisibleElements = getVisibleElements;
+ exports.isPortraitOrientation = isPortraitOrientation;
+ exports.isValidRotation = isValidRotation;
+ exports.isValidScrollMode = isValidScrollMode;
+ exports.isValidSpreadMode = isValidSpreadMode;
+ exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
+ exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
+ exports.parseQueryString = parseQueryString;
+ exports.removeNullCharacters = removeNullCharacters;
+ exports.roundToDivide = roundToDivide;
+ exports.scrollIntoView = scrollIntoView;
+ exports.toggleCheckedBtn = toggleCheckedBtn;
+ exports.toggleExpandedBtn = toggleExpandedBtn;
+ exports.watchScroll = watchScroll;
+ const DEFAULT_SCALE_VALUE = "auto";
+ exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
+ const DEFAULT_SCALE = 1.0;
+ exports.DEFAULT_SCALE = DEFAULT_SCALE;
+ const DEFAULT_SCALE_DELTA = 1.1;
+ exports.DEFAULT_SCALE_DELTA = DEFAULT_SCALE_DELTA;
+ const MIN_SCALE = 0.1;
+ exports.MIN_SCALE = MIN_SCALE;
+ const MAX_SCALE = 10.0;
+ exports.MAX_SCALE = MAX_SCALE;
+ const UNKNOWN_SCALE = 0;
+ exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
+ const MAX_AUTO_SCALE = 1.25;
+ exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
+ const SCROLLBAR_PADDING = 40;
+ exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
+ const VERTICAL_PADDING = 5;
+ exports.VERTICAL_PADDING = VERTICAL_PADDING;
+ const RenderingStates = {
+ INITIAL: 0,
+ RUNNING: 1,
+ PAUSED: 2,
+ FINISHED: 3
+ };
+ exports.RenderingStates = RenderingStates;
+ const PresentationModeState = {
+ UNKNOWN: 0,
+ NORMAL: 1,
+ CHANGING: 2,
+ FULLSCREEN: 3
+ };
+ exports.PresentationModeState = PresentationModeState;
+ const SidebarView = {
+ UNKNOWN: -1,
+ NONE: 0,
+ THUMBS: 1,
+ OUTLINE: 2,
+ ATTACHMENTS: 3,
+ LAYERS: 4
+ };
+ exports.SidebarView = SidebarView;
+ const TextLayerMode = {
+ DISABLE: 0,
+ ENABLE: 1,
+ ENABLE_PERMISSIONS: 2
+ };
+ exports.TextLayerMode = TextLayerMode;
+ const ScrollMode = {
+ UNKNOWN: -1,
+ VERTICAL: 0,
+ HORIZONTAL: 1,
+ WRAPPED: 2,
+ PAGE: 3
+ };
+ exports.ScrollMode = ScrollMode;
+ const SpreadMode = {
+ UNKNOWN: -1,
+ NONE: 0,
+ ODD: 1,
+ EVEN: 2
+ };
+ exports.SpreadMode = SpreadMode;
+ const CursorTool = {
+ SELECT: 0,
+ HAND: 1,
+ ZOOM: 2
+ };
+ exports.CursorTool = CursorTool;
+ const AutoPrintRegExp = /\bprint\s*\(/;
+ exports.AutoPrintRegExp = AutoPrintRegExp;
+
+ class OutputScale {
+ constructor() {
+ const pixelRatio = window.devicePixelRatio || 1;
+ this.sx = pixelRatio;
+ this.sy = pixelRatio;
+ }
+
+ get scaled() {
+ return this.sx !== 1 || this.sy !== 1;
+ }
+ }
+
+ exports.OutputScale = OutputScale;
+
+ function scrollIntoView(element, spot, scrollMatches = false) {
+ let parent = element.offsetParent;
+ if (!parent) {
+ console.error("offsetParent is not set -- cannot scroll");
+ return;
+ }
+ let offsetY = element.offsetTop + element.clientTop;
+ let offsetX = element.offsetLeft + element.clientLeft;
+ while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
+ offsetY += parent.offsetTop;
+ offsetX += parent.offsetLeft;
+ parent = parent.offsetParent;
+ if (!parent) {
+ return;
+ }
+ }
+ if (spot) {
+ if (spot.top !== undefined) {
+ offsetY += spot.top;
+ }
+ if (spot.left !== undefined) {
+ offsetX += spot.left;
+ parent.scrollLeft = offsetX;
+ }
+ }
+ parent.scrollTop = offsetY;
+ }
+
+ function watchScroll(viewAreaElement, callback) {
+ const debounceScroll = function (evt) {
+ if (rAF) {
+ return;
+ }
+ rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
+ rAF = null;
+ const currentX = viewAreaElement.scrollLeft;
+ const lastX = state.lastX;
+ if (currentX !== lastX) {
+ state.right = currentX > lastX;
+ }
+ state.lastX = currentX;
+ const currentY = viewAreaElement.scrollTop;
+ const lastY = state.lastY;
+ if (currentY !== lastY) {
+ state.down = currentY > lastY;
+ }
+ state.lastY = currentY;
+ callback(state);
+ });
+ };
+ const state = {
+ right: true,
+ down: true,
+ lastX: viewAreaElement.scrollLeft,
+ lastY: viewAreaElement.scrollTop,
+ _eventHandler: debounceScroll
+ };
+ let rAF = null;
+ viewAreaElement.addEventListener("scroll", debounceScroll, true);
+ return state;
+ }
+
+ function parseQueryString(query) {
+ const params = new Map();
+ for (const [key, value] of new URLSearchParams(query)) {
+ params.set(key.toLowerCase(), value);
+ }
+ return params;
+ }
+
+ const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
+
+ function removeNullCharacters(str, replaceInvisible = false) {
+ if (typeof str !== "string") {
+ console.error(`The argument must be a string.`);
+ return str;
+ }
+ if (replaceInvisible) {
+ str = str.replaceAll(InvisibleCharactersRegExp, " ");
+ }
+ return str.replaceAll("\x00", "");
+ }
+
+ function binarySearchFirstItem(items, condition, start = 0) {
+ let minIndex = start;
+ let maxIndex = items.length - 1;
+ if (maxIndex < 0 || !condition(items[maxIndex])) {
+ return items.length;
+ }
+ if (condition(items[minIndex])) {
+ return minIndex;
+ }
+ while (minIndex < maxIndex) {
+ const currentIndex = minIndex + maxIndex >> 1;
+ const currentItem = items[currentIndex];
+ if (condition(currentItem)) {
+ maxIndex = currentIndex;
+ } else {
+ minIndex = currentIndex + 1;
+ }
+ }
+ return minIndex;
+ }
+
+ function approximateFraction(x) {
+ if (Math.floor(x) === x) {
+ return [x, 1];
+ }
+ const xinv = 1 / x;
+ const limit = 8;
+ if (xinv > limit) {
+ return [1, limit];
+ } else if (Math.floor(xinv) === xinv) {
+ return [1, xinv];
+ }
+ const x_ = x > 1 ? xinv : x;
+ let a = 0,
+ b = 1,
+ c = 1,
+ d = 1;
+ while (true) {
+ const p = a + c,
+ q = b + d;
+ if (q > limit) {
+ break;
+ }
+ if (x_ <= p / q) {
+ c = p;
+ d = q;
+ } else {
+ a = p;
+ b = q;
+ }
+ }
+ let result;
+ if (x_ - a / b < c / d - x_) {
+ result = x_ === x ? [a, b] : [b, a];
+ } else {
+ result = x_ === x ? [c, d] : [d, c];
+ }
+ return result;
+ }
+
+ function roundToDivide(x, div) {
+ const r = x % div;
+ return r === 0 ? x : Math.round(x - r + div);
+ }
+
+ function getPageSizeInches({
+ view,
+ userUnit,
+ rotate
+ }) {
+ const [x1, y1, x2, y2] = view;
+ const changeOrientation = rotate % 180 !== 0;
+ const width = (x2 - x1) / 72 * userUnit;
+ const height = (y2 - y1) / 72 * userUnit;
+ return {
+ width: changeOrientation ? height : width,
+ height: changeOrientation ? width : height
+ };
+ }
+
+ function backtrackBeforeAllVisibleElements(index, views, top) {
+ if (index < 2) {
+ return index;
+ }
+ let elt = views[index].div;
+ let pageTop = elt.offsetTop + elt.clientTop;
+ if (pageTop >= top) {
+ elt = views[index - 1].div;
+ pageTop = elt.offsetTop + elt.clientTop;
+ }
+ for (let i = index - 2; i >= 0; --i) {
+ elt = views[i].div;
+ if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
+ break;
+ }
+ index = i;
+ }
+ return index;
+ }
+
+ function getVisibleElements({
+ scrollEl,
+ views,
+ sortByVisibility = false,
+ horizontal = false,
+ rtl = false
+ }) {
+ const top = scrollEl.scrollTop,
+ bottom = top + scrollEl.clientHeight;
+ const left = scrollEl.scrollLeft,
+ right = left + scrollEl.clientWidth;
+
+ function isElementBottomAfterViewTop(view) {
+ const element = view.div;
+ const elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
+ return elementBottom > top;
+ }
+
+ function isElementNextAfterViewHorizontally(view) {
+ const element = view.div;
+ const elementLeft = element.offsetLeft + element.clientLeft;
+ const elementRight = elementLeft + element.clientWidth;
+ return rtl ? elementLeft < right : elementRight > left;
+ }
+
+ const visible = [],
+ ids = new Set(),
+ numViews = views.length;
+ let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
+ if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
+ firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
+ }
+ let lastEdge = horizontal ? right : -1;
+ for (let i = firstVisibleElementInd; i < numViews; i++) {
+ const view = views[i],
+ element = view.div;
+ const currentWidth = element.offsetLeft + element.clientLeft;
+ const currentHeight = element.offsetTop + element.clientTop;
+ const viewWidth = element.clientWidth,
+ viewHeight = element.clientHeight;
+ const viewRight = currentWidth + viewWidth;
+ const viewBottom = currentHeight + viewHeight;
+ if (lastEdge === -1) {
+ if (viewBottom >= bottom) {
+ lastEdge = viewBottom;
+ }
+ } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
+ break;
+ }
+ if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
+ continue;
+ }
+ const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
+ const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
+ const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
+ fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
+ const percent = fractionHeight * fractionWidth * 100 | 0;
+ visible.push({
+ id: view.id,
+ x: currentWidth,
+ y: currentHeight,
+ view,
+ percent,
+ widthPercent: fractionWidth * 100 | 0
+ });
+ ids.add(view.id);
+ }
+ const first = visible[0],
+ last = visible.at(-1);
+ if (sortByVisibility) {
+ visible.sort(function (a, b) {
+ const pc = a.percent - b.percent;
+ if (Math.abs(pc) > 0.001) {
+ return -pc;
+ }
+ return a.id - b.id;
+ });
+ }
+ return {
+ first,
+ last,
+ views: visible,
+ ids
+ };
+ }
+
+ function normalizeWheelEventDirection(evt) {
+ let delta = Math.hypot(evt.deltaX, evt.deltaY);
+ const angle = Math.atan2(evt.deltaY, evt.deltaX);
+ if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
+ delta = -delta;
+ }
+ return delta;
+ }
+
+ function normalizeWheelEventDelta(evt) {
+ const deltaMode = evt.deltaMode;
+ let delta = normalizeWheelEventDirection(evt);
+ const MOUSE_PIXELS_PER_LINE = 30;
+ const MOUSE_LINES_PER_PAGE = 30;
+ if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
+ delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
+ } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {
+ delta /= MOUSE_LINES_PER_PAGE;
+ }
+ return delta;
+ }
+
+ function isValidRotation(angle) {
+ return Number.isInteger(angle) && angle % 90 === 0;
+ }
+
+ function isValidScrollMode(mode) {
+ return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
+ }
+
+ function isValidSpreadMode(mode) {
+ return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
+ }
+
+ function isPortraitOrientation(size) {
+ return size.width <= size.height;
+ }
+
+ const animationStarted = new Promise(function (resolve) {
+ window.requestAnimationFrame(resolve);
+ });
+ exports.animationStarted = animationStarted;
+ const docStyle = document.documentElement.style;
+ exports.docStyle = docStyle;
+
+ function clamp(v, min, max) {
+ return Math.min(Math.max(v, min), max);
+ }
+
+ class ProgressBar {
+ #classList = null;
+ #disableAutoFetchTimeout = null;
+ #percent = 0;
+ #style = null;
+ #visible = true;
+
+ constructor(bar) {
+ this.#classList = bar.classList;
+ this.#style = bar.style;
+ }
+
+ get percent() {
+ return this.#percent;
+ }
+
+ set percent(val) {
+ this.#percent = clamp(val, 0, 100);
+ if (isNaN(val)) {
+ this.#classList.add("indeterminate");
+ return;
+ }
+ this.#classList.remove("indeterminate");
+ this.#style.setProperty("--progressBar-percent", `${this.#percent}%`);
+ }
+
+ setWidth(viewer) {
+ if (!viewer) {
+ return;
+ }
+ const container = viewer.parentNode;
+ const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
+ if (scrollbarWidth > 0) {
+ this.#style.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`);
+ }
+ }
+
+ setDisableAutoFetch(delay = 5000) {
+ if (isNaN(this.#percent)) {
+ return;
+ }
+ if (this.#disableAutoFetchTimeout) {
+ clearTimeout(this.#disableAutoFetchTimeout);
+ }
+ this.show();
+ this.#disableAutoFetchTimeout = setTimeout(() => {
+ this.#disableAutoFetchTimeout = null;
+ this.hide();
+ }, delay);
+ }
+
+ hide() {
+ if (!this.#visible) {
+ return;
+ }
+ this.#visible = false;
+ this.#classList.add("hidden");
+ }
+
+ show() {
+ if (this.#visible) {
+ return;
+ }
+ this.#visible = true;
+ this.#classList.remove("hidden");
+ }
+ }
+
+ exports.ProgressBar = ProgressBar;
+
+ function getActiveOrFocusedElement() {
+ let curRoot = document;
+ let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
+ while (curActiveOrFocused?.shadowRoot) {
+ curRoot = curActiveOrFocused.shadowRoot;
+ curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
+ }
+ return curActiveOrFocused;
+ }
+
+ function apiPageLayoutToViewerModes(layout) {
+ let scrollMode = ScrollMode.VERTICAL,
+ spreadMode = SpreadMode.NONE;
+ switch (layout) {
+ case "SinglePage":
+ scrollMode = ScrollMode.PAGE;
+ break;
+ case "OneColumn":
+ break;
+ case "TwoPageLeft":
+ scrollMode = ScrollMode.PAGE;
+ case "TwoColumnLeft":
+ spreadMode = SpreadMode.ODD;
+ break;
+ case "TwoPageRight":
+ scrollMode = ScrollMode.PAGE;
+ case "TwoColumnRight":
+ spreadMode = SpreadMode.EVEN;
+ break;
+ }
+ return {
+ scrollMode,
+ spreadMode
+ };
+ }
+
+ function apiPageModeToSidebarView(mode) {
+ switch (mode) {
+ case "UseNone":
+ return SidebarView.NONE;
+ case "UseThumbs":
+ return SidebarView.THUMBS;
+ case "UseOutlines":
+ return SidebarView.OUTLINE;
+ case "UseAttachments":
+ return SidebarView.ATTACHMENTS;
+ case "UseOC":
+ return SidebarView.LAYERS;
+ }
+ return SidebarView.NONE;
+ }
+
+ function toggleCheckedBtn(button, toggle, view = null) {
+ button.classList.toggle("toggled", toggle);
+ button.setAttribute("aria-checked", toggle);
+ view?.classList.toggle("hidden", !toggle);
+ }
+
+ function toggleExpandedBtn(button, toggle, view = null) {
+ button.classList.toggle("toggled", toggle);
+ button.setAttribute("aria-expanded", toggle);
+ view?.classList.toggle("hidden", !toggle);
+ }
+
+ /***/
+ }),
+ /* 4 */
+ /***/ ((module) => {
+
+
+ module.exports = globalThis.pdfjsLib;
+
+ /***/
+ }),
+ /* 5 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.compatibilityParams = exports.OptionKind = exports.AppOptions = void 0;
+ const compatibilityParams = Object.create(null);
+ exports.compatibilityParams = compatibilityParams;
+ {
+ const userAgent = navigator.userAgent || "";
+ const platform = navigator.platform || "";
+ const maxTouchPoints = navigator.maxTouchPoints || 1;
+ const isAndroid = /Android/.test(userAgent);
+ const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
+ (function checkCanvasSizeLimitation() {
+ if (isIOS || isAndroid) {
+ compatibilityParams.maxCanvasPixels = 5242880;
+ }
+ })();
+ }
+ const OptionKind = {
+ VIEWER: 0x02,
+ API: 0x04,
+ WORKER: 0x08,
+ PREFERENCE: 0x80
+ };
+ exports.OptionKind = OptionKind;
+ const defaultOptions = {
+ annotationEditorMode: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ annotationMode: {
+ value: 2,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ cursorToolOnLoad: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ defaultZoomDelay: {
+ value: 400,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ defaultZoomValue: {
+ value: "",
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ disableHistory: {
+ value: false,
+ kind: OptionKind.VIEWER
+ },
+ disablePageLabels: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enablePermissions: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enablePrintAutoRotate: {
+ value: true,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enableScripting: {
+ value: true,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enableStampEditor: {
+ value: true,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ externalLinkRel: {
+ value: "noopener noreferrer nofollow",
+ kind: OptionKind.VIEWER
+ },
+ externalLinkTarget: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ historyUpdateUrl: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ ignoreDestinationZoom: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ imageResourcesPath: {
+ value: "./images/",
+ kind: OptionKind.VIEWER
+ },
+ maxCanvasPixels: {
+ value: 16777216,
+ kind: OptionKind.VIEWER
+ },
+ forcePageColors: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ pageColorsBackground: {
+ value: "Canvas",
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ pageColorsForeground: {
+ value: "CanvasText",
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ pdfBugEnabled: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ printResolution: {
+ value: 150,
+ kind: OptionKind.VIEWER
+ },
+ sidebarViewOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ scrollModeOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ spreadModeOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ textLayerMode: {
+ value: 1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ viewerCssTheme: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ viewOnLoad: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ cMapPacked: {
+ value: true,
+ kind: OptionKind.API
+ },
+ cMapUrl: {
+ value: "../web/cmaps/",
+ kind: OptionKind.API
+ },
+ disableAutoFetch: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableFontFace: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableRange: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableStream: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ docBaseUrl: {
+ value: "",
+ kind: OptionKind.API
+ },
+ enableXfa: {
+ value: true,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ fontExtraProperties: {
+ value: false,
+ kind: OptionKind.API
+ },
+ isEvalSupported: {
+ value: true,
+ kind: OptionKind.API
+ },
+ isOffscreenCanvasSupported: {
+ value: true,
+ kind: OptionKind.API
+ },
+ maxImageSize: {
+ value: -1,
+ kind: OptionKind.API
+ },
+ pdfBug: {
+ value: false,
+ kind: OptionKind.API
+ },
+ standardFontDataUrl: {
+ value: "../web/standard_fonts/",
+ kind: OptionKind.API
+ },
+ verbosity: {
+ value: 1,
+ kind: OptionKind.API
+ },
+ workerPort: {
+ value: null,
+ kind: OptionKind.WORKER
+ },
+ workerSrc: {
+ value: "/pdfjs/pdf.worker.js",
+ kind: OptionKind.WORKER
+ }
+ };
+ {
+ defaultOptions.defaultUrl = {
+ value: "/pdfjs/example/Welcome.pdf",
+ kind: OptionKind.VIEWER
+ };
+ defaultOptions.disablePreferences = {
+ value: false,
+ kind: OptionKind.VIEWER
+ };
+ defaultOptions.locale = {
+ value: navigator.language || "en-US",
+ kind: OptionKind.VIEWER
+ };
+ defaultOptions.sandboxBundleSrc = {
+ value: "../build/pdf.sandbox.js",
+ kind: OptionKind.VIEWER
+ };
+ }
+ const userOptions = Object.create(null);
+
+ class AppOptions {
+ constructor() {
+ throw new Error("Cannot initialize AppOptions.");
+ }
+
+ static get(name) {
+ const userOption = userOptions[name];
+ if (userOption !== undefined) {
+ return userOption;
+ }
+ const defaultOption = defaultOptions[name];
+ if (defaultOption !== undefined) {
+ return compatibilityParams[name] ?? defaultOption.value;
+ }
+ return undefined;
+ }
+
+ static getAll(kind = null) {
+ const options = Object.create(null);
+ for (const name in defaultOptions) {
+ const defaultOption = defaultOptions[name];
+ if (kind) {
+ if ((kind & defaultOption.kind) === 0) {
+ continue;
+ }
+ if (kind === OptionKind.PREFERENCE) {
+ const value = defaultOption.value,
+ valueType = typeof value;
+ if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) {
+ options[name] = value;
+ continue;
+ }
+ throw new Error(`Invalid type for preference: ${name}`);
+ }
+ }
+ const userOption = userOptions[name];
+ options[name] = userOption !== undefined ? userOption : compatibilityParams[name] ?? defaultOption.value;
+ }
+ return options;
+ }
+
+ static set(name, value) {
+ userOptions[name] = value;
+ }
+
+ static setAll(options) {
+ for (const name in options) {
+ userOptions[name] = options[name];
+ }
+ }
+
+ static remove(name) {
+ delete userOptions[name];
+ }
+ }
+
+ exports.AppOptions = AppOptions;
+ {
+ AppOptions._hasUserOptions = function () {
+ return Object.keys(userOptions).length > 0;
+ };
+ }
+
+ /***/
+ }),
+ /* 6 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.WaitOnType = exports.EventBus = exports.AutomationEventBus = void 0;
+ exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
+ const WaitOnType = {
+ EVENT: "event",
+ TIMEOUT: "timeout"
+ };
+ exports.WaitOnType = WaitOnType;
+
+ function waitOnEventOrTimeout({
+ target,
+ name,
+ delay = 0
+ }) {
+ return new Promise(function (resolve, reject) {
+ if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
+ throw new Error("waitOnEventOrTimeout - invalid parameters.");
+ }
+
+ function handler(type) {
+ if (target instanceof EventBus) {
+ target._off(name, eventHandler);
+ } else {
+ target.removeEventListener(name, eventHandler);
+ }
+ if (timeout) {
+ clearTimeout(timeout);
+ }
+ resolve(type);
+ }
+
+ const eventHandler = handler.bind(null, WaitOnType.EVENT);
+ if (target instanceof EventBus) {
+ target._on(name, eventHandler);
+ } else {
+ target.addEventListener(name, eventHandler);
+ }
+ const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
+ const timeout = setTimeout(timeoutHandler, delay);
+ });
+ }
+
+ class EventBus {
+ #listeners = Object.create(null);
+
+ on(eventName, listener, options = null) {
+ this._on(eventName, listener, {
+ external: true,
+ once: options?.once
+ });
+ }
+
+ off(eventName, listener, options = null) {
+ this._off(eventName, listener, {
+ external: true,
+ once: options?.once
+ });
+ }
+
+ dispatch(eventName, data) {
+ const eventListeners = this.#listeners[eventName];
+ if (!eventListeners || eventListeners.length === 0) {
+ return;
+ }
+ let externalListeners;
+ for (const {
+ listener,
+ external,
+ once
+ } of eventListeners.slice(0)) {
+ if (once) {
+ this._off(eventName, listener);
+ }
+ if (external) {
+ (externalListeners ||= []).push(listener);
+ continue;
+ }
+ listener(data);
+ }
+ if (externalListeners) {
+ for (const listener of externalListeners) {
+ listener(data);
+ }
+ externalListeners = null;
+ }
+ }
+
+ _on(eventName, listener, options = null) {
+ const eventListeners = this.#listeners[eventName] ||= [];
+ eventListeners.push({
+ listener,
+ external: options?.external === true,
+ once: options?.once === true
+ });
+ }
+
+ _off(eventName, listener, options = null) {
+ const eventListeners = this.#listeners[eventName];
+ if (!eventListeners) {
+ return;
+ }
+ for (let i = 0, ii = eventListeners.length; i < ii; i++) {
+ if (eventListeners[i].listener === listener) {
+ eventListeners.splice(i, 1);
+ return;
+ }
+ }
+ }
+ }
+
+ exports.EventBus = EventBus;
+
+ class AutomationEventBus extends EventBus {
+ dispatch(eventName, data) {
+ throw new Error("Not implemented: AutomationEventBus.dispatch");
+ }
+ }
+
+ exports.AutomationEventBus = AutomationEventBus;
+
+ /***/
+ }),
+ /* 7 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.SimpleLinkService = exports.PDFLinkService = exports.LinkTarget = void 0;
+ var _ui_utils = __webpack_require__(3);
+ const DEFAULT_LINK_REL = "noopener noreferrer nofollow";
+ const LinkTarget = {
+ NONE: 0,
+ SELF: 1,
+ BLANK: 2,
+ PARENT: 3,
+ TOP: 4
+ };
+ exports.LinkTarget = LinkTarget;
+
+ function addLinkAttributes(link, {
+ url,
+ target,
+ rel,
+ enabled = true
+ } = {}) {
+ if (!url || typeof url !== "string") {
+ throw new Error('A valid "url" parameter must provided.');
+ }
+ if (enabled) {
+ link.href = link.title = url;
+ } else {
+ link.href = "";
+ link.title = `Disabled: ${url}`;
+ link.onclick = () => {
+ return false;
+ };
+ }
+ let targetStr = "";
+ switch (target) {
+ case LinkTarget.NONE:
+ break;
+ case LinkTarget.SELF:
+ targetStr = "_self";
+ break;
+ case LinkTarget.BLANK:
+ targetStr = "_blank";
+ break;
+ case LinkTarget.PARENT:
+ targetStr = "_parent";
+ break;
+ case LinkTarget.TOP:
+ targetStr = "_top";
+ break;
+ }
+ link.target = targetStr;
+ link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
+ }
+
+ class PDFLinkService {
+ #pagesRefCache = new Map();
+
+ constructor({
+ eventBus,
+ externalLinkTarget = null,
+ externalLinkRel = null,
+ ignoreDestinationZoom = false
+ } = {}) {
+ this.eventBus = eventBus;
+ this.externalLinkTarget = externalLinkTarget;
+ this.externalLinkRel = externalLinkRel;
+ this.externalLinkEnabled = true;
+ this._ignoreDestinationZoom = ignoreDestinationZoom;
+ this.baseUrl = null;
+ this.pdfDocument = null;
+ this.pdfViewer = null;
+ this.pdfHistory = null;
+ }
+
+ setDocument(pdfDocument, baseUrl = null) {
+ this.baseUrl = baseUrl;
+ this.pdfDocument = pdfDocument;
+ this.#pagesRefCache.clear();
+ }
+
+ setViewer(pdfViewer) {
+ this.pdfViewer = pdfViewer;
+ }
+
+ setHistory(pdfHistory) {
+ this.pdfHistory = pdfHistory;
+ }
+
+ get pagesCount() {
+ return this.pdfDocument ? this.pdfDocument.numPages : 0;
+ }
+
+ get page() {
+ return this.pdfViewer.currentPageNumber;
+ }
+
+ set page(value) {
+ this.pdfViewer.currentPageNumber = value;
+ }
+
+ get rotation() {
+ return this.pdfViewer.pagesRotation;
+ }
+
+ set rotation(value) {
+ this.pdfViewer.pagesRotation = value;
+ }
+
+ get isInPresentationMode() {
+ return this.pdfViewer.isInPresentationMode;
+ }
+
+ #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {
+ const destRef = explicitDest[0];
+ let pageNumber;
+ if (typeof destRef === "object" && destRef !== null) {
+ pageNumber = this._cachedPageNumber(destRef);
+ if (!pageNumber) {
+ this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
+ this.cachePageRef(pageIndex + 1, destRef);
+ this.#goToDestinationHelper(rawDest, namedDest, explicitDest);
+ }).catch(() => {
+ console.error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not ` + `a valid page reference, for dest="${rawDest}".`);
+ });
+ return;
+ }
+ } else if (Number.isInteger(destRef)) {
+ pageNumber = destRef + 1;
+ } else {
+ console.error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not ` + `a valid destination reference, for dest="${rawDest}".`);
+ return;
+ }
+ if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
+ console.error(`PDFLinkService.#goToDestinationHelper: "${pageNumber}" is not ` + `a valid page number, for dest="${rawDest}".`);
+ return;
+ }
+ if (this.pdfHistory) {
+ this.pdfHistory.pushCurrentPosition();
+ this.pdfHistory.push({
+ namedDest,
+ explicitDest,
+ pageNumber
+ });
+ }
+ this.pdfViewer.scrollPageIntoView({
+ pageNumber,
+ destArray: explicitDest,
+ ignoreDestinationZoom: this._ignoreDestinationZoom
+ });
+ }
+
+ async goToDestination(dest) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ let namedDest, explicitDest;
+ if (typeof dest === "string") {
+ namedDest = dest;
+ explicitDest = await this.pdfDocument.getDestination(dest);
+ } else {
+ namedDest = null;
+ explicitDest = await dest;
+ }
+ if (!Array.isArray(explicitDest)) {
+ console.error(`PDFLinkService.goToDestination: "${explicitDest}" is not ` + `a valid destination array, for dest="${dest}".`);
+ return;
+ }
+ this.#goToDestinationHelper(dest, namedDest, explicitDest);
+ }
+
+ goToPage(val) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
+ if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
+ console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);
+ return;
+ }
+ if (this.pdfHistory) {
+ this.pdfHistory.pushCurrentPosition();
+ this.pdfHistory.pushPage(pageNumber);
+ }
+ this.pdfViewer.scrollPageIntoView({
+ pageNumber
+ });
+ }
+
+ addLinkAttributes(link, url, newWindow = false) {
+ addLinkAttributes(link, {
+ url,
+ target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,
+ rel: this.externalLinkRel,
+ enabled: this.externalLinkEnabled
+ });
+ }
+
+ getDestinationHash(dest) {
+ if (typeof dest === "string") {
+ if (dest.length > 0) {
+ return this.getAnchorUrl("#" + escape(dest));
+ }
+ } else if (Array.isArray(dest)) {
+ const str = JSON.stringify(dest);
+ if (str.length > 0) {
+ return this.getAnchorUrl("#" + escape(str));
+ }
+ }
+ return this.getAnchorUrl("");
+ }
+
+ getAnchorUrl(anchor) {
+ return this.baseUrl ? this.baseUrl + anchor : anchor;
+ }
+
+ setHash(hash) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ let pageNumber, dest;
+ if (hash.includes("=")) {
+ const params = (0, _ui_utils.parseQueryString)(hash);
+ if (params.has("search")) {
+ const query = params.get("search").replaceAll('"', ""),
+ phrase = params.get("phrase") === "true";
+ this.eventBus.dispatch("findfromurlhash", {
+ source: this,
+ query: phrase ? query : query.match(/\S+/g)
+ });
+ }
+ if (params.has("page")) {
+ pageNumber = params.get("page") | 0 || 1;
+ }
+ if (params.has("zoom")) {
+ const zoomArgs = params.get("zoom").split(",");
+ const zoomArg = zoomArgs[0];
+ const zoomArgNumber = parseFloat(zoomArg);
+ if (!zoomArg.includes("Fit")) {
+ dest = [null, {
+ name: "XYZ"
+ }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
+ } else if (zoomArg === "Fit" || zoomArg === "FitB") {
+ dest = [null, {
+ name: zoomArg
+ }];
+ } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
+ dest = [null, {
+ name: zoomArg
+ }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
+ } else if (zoomArg === "FitR") {
+ if (zoomArgs.length !== 5) {
+ console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
+ } else {
+ dest = [null, {
+ name: zoomArg
+ }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
+ }
+ } else {
+ console.error(`PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.`);
+ }
+ }
+ if (dest) {
+ this.pdfViewer.scrollPageIntoView({
+ pageNumber: pageNumber || this.page,
+ destArray: dest,
+ allowNegativeOffset: true
+ });
+ } else if (pageNumber) {
+ this.page = pageNumber;
+ }
+ if (params.has("pagemode")) {
+ this.eventBus.dispatch("pagemode", {
+ source: this,
+ mode: params.get("pagemode")
+ });
+ }
+ if (params.has("nameddest")) {
+ this.goToDestination(params.get("nameddest"));
+ }
+ } else {
+ dest = unescape(hash);
+ try {
+ dest = JSON.parse(dest);
+ if (!Array.isArray(dest)) {
+ dest = dest.toString();
+ }
+ } catch {
+ }
+ if (typeof dest === "string" || PDFLinkService.#isValidExplicitDestination(dest)) {
+ this.goToDestination(dest);
+ return;
+ }
+ console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`);
+ }
+ }
+
+ executeNamedAction(action) {
+ switch (action) {
+ case "GoBack":
+ this.pdfHistory?.back();
+ break;
+ case "GoForward":
+ this.pdfHistory?.forward();
+ break;
+ case "NextPage":
+ this.pdfViewer.nextPage();
+ break;
+ case "PrevPage":
+ this.pdfViewer.previousPage();
+ break;
+ case "LastPage":
+ this.page = this.pagesCount;
+ break;
+ case "FirstPage":
+ this.page = 1;
+ break;
+ default:
+ break;
+ }
+ this.eventBus.dispatch("namedaction", {
+ source: this,
+ action
+ });
+ }
+
+ async executeSetOCGState(action) {
+ const pdfDocument = this.pdfDocument;
+ const optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ let operator;
+ for (const elem of action.state) {
+ switch (elem) {
+ case "ON":
+ case "OFF":
+ case "Toggle":
+ operator = elem;
+ continue;
+ }
+ switch (operator) {
+ case "ON":
+ optionalContentConfig.setVisibility(elem, true);
+ break;
+ case "OFF":
+ optionalContentConfig.setVisibility(elem, false);
+ break;
+ case "Toggle":
+ const group = optionalContentConfig.getGroup(elem);
+ if (group) {
+ optionalContentConfig.setVisibility(elem, !group.visible);
+ }
+ break;
+ }
+ }
+ this.pdfViewer.optionalContentConfigPromise = Promise.resolve(optionalContentConfig);
+ }
+
+ cachePageRef(pageNum, pageRef) {
+ if (!pageRef) {
+ return;
+ }
+ const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
+ this.#pagesRefCache.set(refStr, pageNum);
+ }
+
+ _cachedPageNumber(pageRef) {
+ if (!pageRef) {
+ return null;
+ }
+ const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
+ return this.#pagesRefCache.get(refStr) || null;
+ }
+
+ static #isValidExplicitDestination(dest) {
+ if (!Array.isArray(dest)) {
+ return false;
+ }
+ const destLength = dest.length;
+ if (destLength < 2) {
+ return false;
+ }
+ const page = dest[0];
+ if (!(typeof page === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
+ return false;
+ }
+ const zoom = dest[1];
+ if (!(typeof zoom === "object" && typeof zoom.name === "string")) {
+ return false;
+ }
+ let allowNull = true;
+ switch (zoom.name) {
+ case "XYZ":
+ if (destLength !== 5) {
+ return false;
+ }
+ break;
+ case "Fit":
+ case "FitB":
+ return destLength === 2;
+ case "FitH":
+ case "FitBH":
+ case "FitV":
+ case "FitBV":
+ if (destLength !== 3) {
+ return false;
+ }
+ break;
+ case "FitR":
+ if (destLength !== 6) {
+ return false;
+ }
+ allowNull = false;
+ break;
+ default:
+ return false;
+ }
+ for (let i = 2; i < destLength; i++) {
+ const param = dest[i];
+ if (!(typeof param === "number" || allowNull && param === null)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ exports.PDFLinkService = PDFLinkService;
+
+ class SimpleLinkService {
+ constructor() {
+ this.externalLinkEnabled = true;
+ }
+
+ get pagesCount() {
+ return 0;
+ }
+
+ get page() {
+ return 0;
+ }
+
+ set page(value) {
+ }
+
+ get rotation() {
+ return 0;
+ }
+
+ set rotation(value) {
+ }
+
+ get isInPresentationMode() {
+ return false;
+ }
+
+ async goToDestination(dest) {
+ }
+
+ goToPage(val) {
+ }
+
+ addLinkAttributes(link, url, newWindow = false) {
+ addLinkAttributes(link, {
+ url,
+ enabled: this.externalLinkEnabled
+ });
+ }
+
+ getDestinationHash(dest) {
+ return "#";
+ }
+
+ getAnchorUrl(hash) {
+ return "#";
+ }
+
+ setHash(hash) {
+ }
+
+ executeNamedAction(action) {
+ }
+
+ executeSetOCGState(action) {
+ }
+
+ cachePageRef(pageNum, pageRef) {
+ }
+ }
+
+ exports.SimpleLinkService = SimpleLinkService;
+
+ /***/
+ }),
+ /* 8 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.AltTextManager = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+
+ class AltTextManager {
+ #boundUpdateUIState = this.#updateUIState.bind(this);
+ #boundSetPosition = this.#setPosition.bind(this);
+ #boundOnClick = this.#onClick.bind(this);
+ #currentEditor = null;
+ #cancelButton;
+ #dialog;
+ #eventBus;
+ #hasUsedPointer = false;
+ #optionDescription;
+ #optionDecorative;
+ #overlayManager;
+ #saveButton;
+ #textarea;
+ #uiManager;
+ #previousAltText = null;
+ #svgElement = null;
+ #rectElement = null;
+ #container;
+ #telemetryData = null;
+
+ constructor({
+ dialog,
+ optionDescription,
+ optionDecorative,
+ textarea,
+ cancelButton,
+ saveButton
+ }, container, overlayManager, eventBus) {
+ this.#dialog = dialog;
+ this.#optionDescription = optionDescription;
+ this.#optionDecorative = optionDecorative;
+ this.#textarea = textarea;
+ this.#cancelButton = cancelButton;
+ this.#saveButton = saveButton;
+ this.#overlayManager = overlayManager;
+ this.#eventBus = eventBus;
+ this.#container = container;
+ dialog.addEventListener("close", this.#close.bind(this));
+ dialog.addEventListener("contextmenu", event => {
+ if (event.target !== this.#textarea) {
+ event.preventDefault();
+ }
+ });
+ cancelButton.addEventListener("click", this.#finish.bind(this));
+ saveButton.addEventListener("click", this.#save.bind(this));
+ optionDescription.addEventListener("change", this.#boundUpdateUIState);
+ optionDecorative.addEventListener("change", this.#boundUpdateUIState);
+ this.#overlayManager.register(dialog);
+ }
+
+ get _elements() {
+ return (0, _pdfjsLib.shadow)(this, "_elements", [this.#optionDescription, this.#optionDecorative, this.#textarea, this.#saveButton, this.#cancelButton]);
+ }
+
+ #createSVGElement() {
+ if (this.#svgElement) {
+ return;
+ }
+ const svgFactory = new _pdfjsLib.DOMSVGFactory();
+ const svg = this.#svgElement = svgFactory.createElement("svg");
+ svg.setAttribute("width", "0");
+ svg.setAttribute("height", "0");
+ const defs = svgFactory.createElement("defs");
+ svg.append(defs);
+ const mask = svgFactory.createElement("mask");
+ defs.append(mask);
+ mask.setAttribute("id", "alttext-manager-mask");
+ mask.setAttribute("maskContentUnits", "objectBoundingBox");
+ let rect = svgFactory.createElement("rect");
+ mask.append(rect);
+ rect.setAttribute("fill", "white");
+ rect.setAttribute("width", "1");
+ rect.setAttribute("height", "1");
+ rect.setAttribute("x", "0");
+ rect.setAttribute("y", "0");
+ rect = this.#rectElement = svgFactory.createElement("rect");
+ mask.append(rect);
+ rect.setAttribute("fill", "black");
+ this.#dialog.append(svg);
+ }
+
+ async editAltText(uiManager, editor) {
+ if (this.#currentEditor || !editor) {
+ return;
+ }
+ this.#createSVGElement();
+ this.#hasUsedPointer = false;
+ for (const element of this._elements) {
+ element.addEventListener("click", this.#boundOnClick);
+ }
+ const {
+ altText,
+ decorative
+ } = editor.altTextData;
+ if (decorative === true) {
+ this.#optionDecorative.checked = true;
+ this.#optionDescription.checked = false;
+ } else {
+ this.#optionDecorative.checked = false;
+ this.#optionDescription.checked = true;
+ }
+ this.#previousAltText = this.#textarea.value = altText?.trim() || "";
+ this.#updateUIState();
+ this.#currentEditor = editor;
+ this.#uiManager = uiManager;
+ this.#uiManager.removeEditListeners();
+ this.#eventBus._on("resize", this.#boundSetPosition);
+ try {
+ await this.#overlayManager.open(this.#dialog);
+ this.#setPosition();
+ } catch (ex) {
+ this.#close();
+ throw ex;
+ }
+ }
+
+ #setPosition() {
+ if (!this.#currentEditor) {
+ return;
+ }
+ const dialog = this.#dialog;
+ const {
+ style
+ } = dialog;
+ const {
+ x: containerX,
+ y: containerY,
+ width: containerW,
+ height: containerH
+ } = this.#container.getBoundingClientRect();
+ const {
+ innerWidth: windowW,
+ innerHeight: windowH
+ } = window;
+ const {
+ width: dialogW,
+ height: dialogH
+ } = dialog.getBoundingClientRect();
+ const {
+ x,
+ y,
+ width,
+ height
+ } = this.#currentEditor.getClientDimensions();
+ const MARGIN = 10;
+ const isLTR = this.#uiManager.direction === "ltr";
+ const xs = Math.max(x, containerX);
+ const xe = Math.min(x + width, containerX + containerW);
+ const ys = Math.max(y, containerY);
+ const ye = Math.min(y + height, containerY + containerH);
+ this.#rectElement.setAttribute("width", `${(xe - xs) / windowW}`);
+ this.#rectElement.setAttribute("height", `${(ye - ys) / windowH}`);
+ this.#rectElement.setAttribute("x", `${xs / windowW}`);
+ this.#rectElement.setAttribute("y", `${ys / windowH}`);
+ let left = null;
+ let top = Math.max(y, 0);
+ top += Math.min(windowH - (top + dialogH), 0);
+ if (isLTR) {
+ if (x + width + MARGIN + dialogW < windowW) {
+ left = x + width + MARGIN;
+ } else if (x > dialogW + MARGIN) {
+ left = x - dialogW - MARGIN;
+ }
+ } else if (x > dialogW + MARGIN) {
+ left = x - dialogW - MARGIN;
+ } else if (x + width + MARGIN + dialogW < windowW) {
+ left = x + width + MARGIN;
+ }
+ if (left === null) {
+ top = null;
+ left = Math.max(x, 0);
+ left += Math.min(windowW - (left + dialogW), 0);
+ if (y > dialogH + MARGIN) {
+ top = y - dialogH - MARGIN;
+ } else if (y + height + MARGIN + dialogH < windowH) {
+ top = y + height + MARGIN;
+ }
+ }
+ if (top !== null) {
+ dialog.classList.add("positioned");
+ if (isLTR) {
+ style.left = `${left}px`;
+ } else {
+ style.right = `${windowW - left - dialogW}px`;
+ }
+ style.top = `${top}px`;
+ } else {
+ dialog.classList.remove("positioned");
+ style.left = "";
+ style.top = "";
+ }
+ }
+
+ #finish() {
+ if (this.#overlayManager.active === this.#dialog) {
+ this.#overlayManager.close(this.#dialog);
+ }
+ }
+
+ #close() {
+ this.#eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "editing",
+ subtype: this.#currentEditor.editorType,
+ data: this.#telemetryData || {
+ action: "alt_text_cancel",
+ alt_text_keyboard: !this.#hasUsedPointer
+ }
+ }
+ });
+ this.#telemetryData = null;
+ this.#removeOnClickListeners();
+ this.#uiManager?.addEditListeners();
+ this.#eventBus._off("resize", this.#boundSetPosition);
+ this.#currentEditor = null;
+ this.#uiManager = null;
+ }
+
+ #updateUIState() {
+ this.#textarea.disabled = this.#optionDecorative.checked;
+ }
+
+ #save() {
+ const altText = this.#textarea.value.trim();
+ const decorative = this.#optionDecorative.checked;
+ this.#currentEditor.altTextData = {
+ altText,
+ decorative
+ };
+ this.#telemetryData = {
+ action: "alt_text_save",
+ alt_text_description: !!altText,
+ alt_text_edit: !!this.#previousAltText && this.#previousAltText !== altText,
+ alt_text_decorative: decorative,
+ alt_text_keyboard: !this.#hasUsedPointer
+ };
+ this.#finish();
+ }
+
+ #onClick(evt) {
+ if (evt.detail === 0) {
+ return;
+ }
+ this.#hasUsedPointer = true;
+ this.#removeOnClickListeners();
+ }
+
+ #removeOnClickListeners() {
+ for (const element of this._elements) {
+ element.removeEventListener("click", this.#boundOnClick);
+ }
+ }
+
+ destroy() {
+ this.#uiManager = null;
+ this.#finish();
+ this.#svgElement?.remove();
+ this.#svgElement = this.#rectElement = null;
+ }
+ }
+
+ exports.AltTextManager = AltTextManager;
+
+ /***/
+ }),
+ /* 9 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.AnnotationEditorParams = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+
+ class AnnotationEditorParams {
+ constructor(options, eventBus) {
+ this.eventBus = eventBus;
+ this.#bindListeners(options);
+ }
+
+ #bindListeners({
+ editorFreeTextFontSize,
+ editorFreeTextColor,
+ editorInkColor,
+ editorInkThickness,
+ editorInkOpacity,
+ editorStampAddImage
+ }) {
+ const dispatchEvent = (typeStr, value) => {
+ this.eventBus.dispatch("switchannotationeditorparams", {
+ source: this,
+ type: _pdfjsLib.AnnotationEditorParamsType[typeStr],
+ value
+ });
+ };
+ editorFreeTextFontSize.addEventListener("input", function () {
+ dispatchEvent("FREETEXT_SIZE", this.valueAsNumber);
+ });
+ editorFreeTextColor.addEventListener("input", function () {
+ dispatchEvent("FREETEXT_COLOR", this.value);
+ });
+ editorInkColor.addEventListener("input", function () {
+ dispatchEvent("INK_COLOR", this.value);
+ });
+ editorInkThickness.addEventListener("input", function () {
+ dispatchEvent("INK_THICKNESS", this.valueAsNumber);
+ });
+ editorInkOpacity.addEventListener("input", function () {
+ dispatchEvent("INK_OPACITY", this.valueAsNumber);
+ });
+ editorStampAddImage.addEventListener("click", () => {
+ dispatchEvent("CREATE");
+ });
+ this.eventBus._on("annotationeditorparamschanged", evt => {
+ for (const [type, value] of evt.details) {
+ switch (type) {
+ case _pdfjsLib.AnnotationEditorParamsType.FREETEXT_SIZE:
+ editorFreeTextFontSize.value = value;
+ break;
+ case _pdfjsLib.AnnotationEditorParamsType.FREETEXT_COLOR:
+ editorFreeTextColor.value = value;
+ break;
+ case _pdfjsLib.AnnotationEditorParamsType.INK_COLOR:
+ editorInkColor.value = value;
+ break;
+ case _pdfjsLib.AnnotationEditorParamsType.INK_THICKNESS:
+ editorInkThickness.value = value;
+ break;
+ case _pdfjsLib.AnnotationEditorParamsType.INK_OPACITY:
+ editorInkOpacity.value = value;
+ break;
+ }
+ }
+ });
+ }
+ }
+
+ exports.AnnotationEditorParams = AnnotationEditorParams;
+
+ /***/
+ }),
+ /* 10 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.OverlayManager = void 0;
+
+ class OverlayManager {
+ #overlays = new WeakMap();
+ #active = null;
+ get active() {
+ return this.#active;
+ }
+
+ async register(dialog, canForceClose = false) {
+ if (typeof dialog !== "object") {
+ throw new Error("Not enough parameters.");
+ } else if (this.#overlays.has(dialog)) {
+ throw new Error("The overlay is already registered.");
+ }
+ this.#overlays.set(dialog, {
+ canForceClose
+ });
+ dialog.addEventListener("cancel", evt => {
+ this.#active = null;
+ });
+ }
+
+ async open(dialog) {
+ if (!this.#overlays.has(dialog)) {
+ throw new Error("The overlay does not exist.");
+ } else if (this.#active) {
+ if (this.#active === dialog) {
+ throw new Error("The overlay is already active.");
+ } else if (this.#overlays.get(dialog).canForceClose) {
+ await this.close();
+ } else {
+ throw new Error("Another overlay is currently active.");
+ }
+ }
+ this.#active = dialog;
+ dialog.showModal();
+ }
+
+ async close(dialog = this.#active) {
+ if (!this.#overlays.has(dialog)) {
+ throw new Error("The overlay does not exist.");
+ } else if (!this.#active) {
+ throw new Error("The overlay is currently not active.");
+ } else if (this.#active !== dialog) {
+ throw new Error("Another overlay is currently active.");
+ }
+ dialog.close();
+ this.#active = null;
+ }
+ }
+
+ exports.OverlayManager = OverlayManager;
+
+ /***/
+ }),
+ /* 11 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PasswordPrompt = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+
+ class PasswordPrompt {
+ #activeCapability = null;
+ #updateCallback = null;
+ #reason = null;
+
+ constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
+ this.dialog = options.dialog;
+ this.label = options.label;
+ this.input = options.input;
+ this.submitButton = options.submitButton;
+ this.cancelButton = options.cancelButton;
+ this.overlayManager = overlayManager;
+ this.l10n = l10n;
+ this._isViewerEmbedded = isViewerEmbedded;
+ this.submitButton.addEventListener("click", this.#verify.bind(this));
+ this.cancelButton.addEventListener("click", this.close.bind(this));
+ this.input.addEventListener("keydown", e => {
+ if (e.keyCode === 13) {
+ this.#verify();
+ }
+ });
+ this.overlayManager.register(this.dialog, true);
+ this.dialog.addEventListener("close", this.#cancel.bind(this));
+ }
+
+ async open() {
+ if (this.#activeCapability) {
+ await this.#activeCapability.promise;
+ }
+ this.#activeCapability = new _pdfjsLib.PromiseCapability();
+ try {
+ await this.overlayManager.open(this.dialog);
+ } catch (ex) {
+ this.#activeCapability.resolve();
+ throw ex;
+ }
+ const passwordIncorrect = this.#reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD;
+ if (!this._isViewerEmbedded || passwordIncorrect) {
+ this.input.focus();
+ }
+ this.label.textContent = await this.l10n.get(`password_${passwordIncorrect ? "invalid" : "label"}`);
+ }
+
+ async close() {
+ if (this.overlayManager.active === this.dialog) {
+ this.overlayManager.close(this.dialog);
+ }
+ }
+
+ #verify() {
+ const password = this.input.value;
+ if (password?.length > 0) {
+ this.#invokeCallback(password);
+ }
+ }
+
+ #cancel() {
+ this.#invokeCallback(new Error("PasswordPrompt cancelled."));
+ this.#activeCapability.resolve();
+ }
+
+ #invokeCallback(password) {
+ if (!this.#updateCallback) {
+ return;
+ }
+ this.close();
+ this.input.value = "";
+ this.#updateCallback(password);
+ this.#updateCallback = null;
+ }
+
+ async setUpdateCallback(updateCallback, reason) {
+ if (this.#activeCapability) {
+ await this.#activeCapability.promise;
+ }
+ this.#updateCallback = updateCallback;
+ this.#reason = reason;
+ }
+ }
+
+ exports.PasswordPrompt = PasswordPrompt;
+
+ /***/
+ }),
+ /* 12 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFAttachmentViewer = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _base_tree_viewer = __webpack_require__(13);
+ var _event_utils = __webpack_require__(6);
+
+ class PDFAttachmentViewer extends _base_tree_viewer.BaseTreeViewer {
+ constructor(options) {
+ super(options);
+ this.downloadManager = options.downloadManager;
+ this.eventBus._on("fileattachmentannotation", this.#appendAttachment.bind(this));
+ }
+
+ reset(keepRenderedCapability = false) {
+ super.reset();
+ this._attachments = null;
+ if (!keepRenderedCapability) {
+ this._renderedCapability = new _pdfjsLib.PromiseCapability();
+ }
+ this._pendingDispatchEvent = false;
+ }
+
+ async _dispatchEvent(attachmentsCount) {
+ this._renderedCapability.resolve();
+ if (attachmentsCount === 0 && !this._pendingDispatchEvent) {
+ this._pendingDispatchEvent = true;
+ await (0, _event_utils.waitOnEventOrTimeout)({
+ target: this.eventBus,
+ name: "annotationlayerrendered",
+ delay: 1000
+ });
+ if (!this._pendingDispatchEvent) {
+ return;
+ }
+ }
+ this._pendingDispatchEvent = false;
+ this.eventBus.dispatch("attachmentsloaded", {
+ source: this,
+ attachmentsCount
+ });
+ }
+
+ _bindLink(element, {
+ content,
+ filename
+ }) {
+ element.onclick = () => {
+ this.downloadManager.openOrDownloadData(element, content, filename);
+ return false;
+ };
+ }
+
+ render({
+ attachments,
+ keepRenderedCapability = false
+ }) {
+ if (this._attachments) {
+ this.reset(keepRenderedCapability);
+ }
+ this._attachments = attachments || null;
+ if (!attachments) {
+ this._dispatchEvent(0);
+ return;
+ }
+ const fragment = document.createDocumentFragment();
+ let attachmentsCount = 0;
+ for (const name in attachments) {
+ const item = attachments[name];
+ const content = item.content,
+ filename = (0, _pdfjsLib.getFilenameFromUrl)(item.filename, true);
+ const div = document.createElement("div");
+ div.className = "treeItem";
+ const element = document.createElement("a");
+ this._bindLink(element, {
+ content,
+ filename
+ });
+ element.textContent = this._normalizeTextContent(filename);
+ div.append(element);
+ fragment.append(div);
+ attachmentsCount++;
+ }
+ this._finishRendering(fragment, attachmentsCount);
+ }
+
+ #appendAttachment({
+ filename,
+ content
+ }) {
+ const renderedPromise = this._renderedCapability.promise;
+ renderedPromise.then(() => {
+ if (renderedPromise !== this._renderedCapability.promise) {
+ return;
+ }
+ const attachments = this._attachments || Object.create(null);
+ for (const name in attachments) {
+ if (filename === name) {
+ return;
+ }
+ }
+ attachments[filename] = {
+ filename,
+ content
+ };
+ this.render({
+ attachments,
+ keepRenderedCapability: true
+ });
+ });
+ }
+ }
+
+ exports.PDFAttachmentViewer = PDFAttachmentViewer;
+
+ /***/
+ }),
+ /* 13 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.BaseTreeViewer = void 0;
+ var _ui_utils = __webpack_require__(3);
+ const TREEITEM_OFFSET_TOP = -100;
+ const TREEITEM_SELECTED_CLASS = "selected";
+
+ class BaseTreeViewer {
+ constructor(options) {
+ if (this.constructor === BaseTreeViewer) {
+ throw new Error("Cannot initialize BaseTreeViewer.");
+ }
+ this.container = options.container;
+ this.eventBus = options.eventBus;
+ this.reset();
+ }
+
+ reset() {
+ this._pdfDocument = null;
+ this._lastToggleIsShow = true;
+ this._currentTreeItem = null;
+ this.container.textContent = "";
+ this.container.classList.remove("treeWithDeepNesting");
+ }
+
+ _dispatchEvent(count) {
+ throw new Error("Not implemented: _dispatchEvent");
+ }
+
+ _bindLink(element, params) {
+ throw new Error("Not implemented: _bindLink");
+ }
+
+ _normalizeTextContent(str) {
+ return (0, _ui_utils.removeNullCharacters)(str, true) || "\u2013";
+ }
+
+ _addToggleButton(div, hidden = false) {
+ const toggler = document.createElement("div");
+ toggler.className = "treeItemToggler";
+ if (hidden) {
+ toggler.classList.add("treeItemsHidden");
+ }
+ toggler.onclick = evt => {
+ evt.stopPropagation();
+ toggler.classList.toggle("treeItemsHidden");
+ if (evt.shiftKey) {
+ const shouldShowAll = !toggler.classList.contains("treeItemsHidden");
+ this._toggleTreeItem(div, shouldShowAll);
+ }
+ };
+ div.prepend(toggler);
+ }
+
+ _toggleTreeItem(root, show = false) {
+ this._lastToggleIsShow = show;
+ for (const toggler of root.querySelectorAll(".treeItemToggler")) {
+ toggler.classList.toggle("treeItemsHidden", !show);
+ }
+ }
+
+ _toggleAllTreeItems() {
+ this._toggleTreeItem(this.container, !this._lastToggleIsShow);
+ }
+
+ _finishRendering(fragment, count, hasAnyNesting = false) {
+ if (hasAnyNesting) {
+ this.container.classList.add("treeWithDeepNesting");
+ this._lastToggleIsShow = !fragment.querySelector(".treeItemsHidden");
+ }
+ this.container.append(fragment);
+ this._dispatchEvent(count);
+ }
+
+ render(params) {
+ throw new Error("Not implemented: render");
+ }
+
+ _updateCurrentTreeItem(treeItem = null) {
+ if (this._currentTreeItem) {
+ this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);
+ this._currentTreeItem = null;
+ }
+ if (treeItem) {
+ treeItem.classList.add(TREEITEM_SELECTED_CLASS);
+ this._currentTreeItem = treeItem;
+ }
+ }
+
+ _scrollToCurrentTreeItem(treeItem) {
+ if (!treeItem) {
+ return;
+ }
+ let currentNode = treeItem.parentNode;
+ while (currentNode && currentNode !== this.container) {
+ if (currentNode.classList.contains("treeItem")) {
+ const toggler = currentNode.firstElementChild;
+ toggler?.classList.remove("treeItemsHidden");
+ }
+ currentNode = currentNode.parentNode;
+ }
+ this._updateCurrentTreeItem(treeItem);
+ this.container.scrollTo(treeItem.offsetLeft, treeItem.offsetTop + TREEITEM_OFFSET_TOP);
+ }
+ }
+
+ exports.BaseTreeViewer = BaseTreeViewer;
+
+ /***/
+ }),
+ /* 14 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFCursorTools = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+ var _grab_to_pan = __webpack_require__(15);
+
+ class PDFCursorTools {
+ #active = _ui_utils.CursorTool.SELECT;
+ #prevActive = null;
+
+ constructor({
+ container,
+ eventBus,
+ cursorToolOnLoad = _ui_utils.CursorTool.SELECT
+ }) {
+ this.container = container;
+ this.eventBus = eventBus;
+ this.#addEventListeners();
+ Promise.resolve().then(() => {
+ this.switchTool(cursorToolOnLoad);
+ });
+ }
+
+ get activeTool() {
+ return this.#active;
+ }
+
+ switchTool(tool) {
+ if (this.#prevActive !== null) {
+ return;
+ }
+ if (tool === this.#active) {
+ return;
+ }
+ const disableActiveTool = () => {
+ switch (this.#active) {
+ case _ui_utils.CursorTool.SELECT:
+ break;
+ case _ui_utils.CursorTool.HAND:
+ this._handTool.deactivate();
+ break;
+ case _ui_utils.CursorTool.ZOOM:
+ }
+ };
+ switch (tool) {
+ case _ui_utils.CursorTool.SELECT:
+ disableActiveTool();
+ break;
+ case _ui_utils.CursorTool.HAND:
+ disableActiveTool();
+ this._handTool.activate();
+ break;
+ case _ui_utils.CursorTool.ZOOM:
+ default:
+ console.error(`switchTool: "${tool}" is an unsupported value.`);
+ return;
+ }
+ this.#active = tool;
+ this.eventBus.dispatch("cursortoolchanged", {
+ source: this,
+ tool
+ });
+ }
+
+ #addEventListeners() {
+ this.eventBus._on("switchcursortool", evt => {
+ this.switchTool(evt.tool);
+ });
+ let annotationEditorMode = _pdfjsLib.AnnotationEditorType.NONE,
+ presentationModeState = _ui_utils.PresentationModeState.NORMAL;
+ const disableActive = () => {
+ const prevActive = this.#active;
+ this.switchTool(_ui_utils.CursorTool.SELECT);
+ this.#prevActive ??= prevActive;
+ };
+ const enableActive = () => {
+ const prevActive = this.#prevActive;
+ if (prevActive !== null && annotationEditorMode === _pdfjsLib.AnnotationEditorType.NONE && presentationModeState === _ui_utils.PresentationModeState.NORMAL) {
+ this.#prevActive = null;
+ this.switchTool(prevActive);
+ }
+ };
+ this.eventBus._on("secondarytoolbarreset", evt => {
+ if (this.#prevActive !== null) {
+ annotationEditorMode = _pdfjsLib.AnnotationEditorType.NONE;
+ presentationModeState = _ui_utils.PresentationModeState.NORMAL;
+ enableActive();
+ }
+ });
+ this.eventBus._on("annotationeditormodechanged", ({
+ mode
+ }) => {
+ annotationEditorMode = mode;
+ if (mode === _pdfjsLib.AnnotationEditorType.NONE) {
+ enableActive();
+ } else {
+ disableActive();
+ }
+ });
+ this.eventBus._on("presentationmodechanged", ({
+ state
+ }) => {
+ presentationModeState = state;
+ if (state === _ui_utils.PresentationModeState.NORMAL) {
+ enableActive();
+ } else if (state === _ui_utils.PresentationModeState.FULLSCREEN) {
+ disableActive();
+ }
+ });
+ }
+
+ get _handTool() {
+ return (0, _pdfjsLib.shadow)(this, "_handTool", new _grab_to_pan.GrabToPan({
+ element: this.container
+ }));
+ }
+ }
+
+ exports.PDFCursorTools = PDFCursorTools;
+
+ /***/
+ }),
+ /* 15 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.GrabToPan = void 0;
+ const CSS_CLASS_GRAB = "grab-to-pan-grab";
+
+ class GrabToPan {
+ constructor({
+ element
+ }) {
+ this.element = element;
+ this.document = element.ownerDocument;
+ this.activate = this.activate.bind(this);
+ this.deactivate = this.deactivate.bind(this);
+ this.toggle = this.toggle.bind(this);
+ this._onMouseDown = this.#onMouseDown.bind(this);
+ this._onMouseMove = this.#onMouseMove.bind(this);
+ this._endPan = this.#endPan.bind(this);
+ const overlay = this.overlay = document.createElement("div");
+ overlay.className = "grab-to-pan-grabbing";
+ }
+
+ activate() {
+ if (!this.active) {
+ this.active = true;
+ this.element.addEventListener("mousedown", this._onMouseDown, true);
+ this.element.classList.add(CSS_CLASS_GRAB);
+ }
+ }
+
+ deactivate() {
+ if (this.active) {
+ this.active = false;
+ this.element.removeEventListener("mousedown", this._onMouseDown, true);
+ this._endPan();
+ this.element.classList.remove(CSS_CLASS_GRAB);
+ }
+ }
+
+ toggle() {
+ if (this.active) {
+ this.deactivate();
+ } else {
+ this.activate();
+ }
+ }
+
+ ignoreTarget(node) {
+ return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option");
+ }
+
+ #onMouseDown(event) {
+ if (event.button !== 0 || this.ignoreTarget(event.target)) {
+ return;
+ }
+ if (event.originalTarget) {
+ try {
+ event.originalTarget.tagName;
+ } catch {
+ return;
+ }
+ }
+ this.scrollLeftStart = this.element.scrollLeft;
+ this.scrollTopStart = this.element.scrollTop;
+ this.clientXStart = event.clientX;
+ this.clientYStart = event.clientY;
+ this.document.addEventListener("mousemove", this._onMouseMove, true);
+ this.document.addEventListener("mouseup", this._endPan, true);
+ this.element.addEventListener("scroll", this._endPan, true);
+ event.preventDefault();
+ event.stopPropagation();
+ const focusedElement = document.activeElement;
+ if (focusedElement && !focusedElement.contains(event.target)) {
+ focusedElement.blur();
+ }
+ }
+
+ #onMouseMove(event) {
+ this.element.removeEventListener("scroll", this._endPan, true);
+ if (!(event.buttons & 1)) {
+ this._endPan();
+ return;
+ }
+ const xDiff = event.clientX - this.clientXStart;
+ const yDiff = event.clientY - this.clientYStart;
+ this.element.scrollTo({
+ top: this.scrollTopStart - yDiff,
+ left: this.scrollLeftStart - xDiff,
+ behavior: "instant"
+ });
+ if (!this.overlay.parentNode) {
+ document.body.append(this.overlay);
+ }
+ }
+
+ #endPan() {
+ this.element.removeEventListener("scroll", this._endPan, true);
+ this.document.removeEventListener("mousemove", this._onMouseMove, true);
+ this.document.removeEventListener("mouseup", this._endPan, true);
+ this.overlay.remove();
+ }
+ }
+
+ exports.GrabToPan = GrabToPan;
+
+ /***/
+ }),
+ /* 16 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFDocumentProperties = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+ const DEFAULT_FIELD_CONTENT = "-";
+ const NON_METRIC_LOCALES = ["en-us", "en-lr", "my"];
+ const US_PAGE_NAMES = {
+ "8.5x11": "Letter",
+ "8.5x14": "Legal"
+ };
+ const METRIC_PAGE_NAMES = {
+ "297x420": "A3",
+ "210x297": "A4"
+ };
+
+ function getPageName(size, isPortrait, pageNames) {
+ const width = isPortrait ? size.width : size.height;
+ const height = isPortrait ? size.height : size.width;
+ return pageNames[`${width}x${height}`];
+ }
+
+ class PDFDocumentProperties {
+ #fieldData = null;
+
+ constructor({
+ dialog,
+ fields,
+ closeButton
+ }, overlayManager, eventBus, l10n, fileNameLookup) {
+ this.dialog = dialog;
+ this.fields = fields;
+ this.overlayManager = overlayManager;
+ this.l10n = l10n;
+ this._fileNameLookup = fileNameLookup;
+ this.#reset();
+ closeButton.addEventListener("click", this.close.bind(this));
+ this.overlayManager.register(this.dialog);
+ eventBus._on("pagechanging", evt => {
+ this._currentPageNumber = evt.pageNumber;
+ });
+ eventBus._on("rotationchanging", evt => {
+ this._pagesRotation = evt.pagesRotation;
+ });
+ this._isNonMetricLocale = true;
+ l10n.getLanguage().then(locale => {
+ this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);
+ });
+ }
+
+ async open() {
+ await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]);
+ const currentPageNumber = this._currentPageNumber;
+ const pagesRotation = this._pagesRotation;
+ if (this.#fieldData && currentPageNumber === this.#fieldData._currentPageNumber && pagesRotation === this.#fieldData._pagesRotation) {
+ this.#updateUI();
+ return;
+ }
+ const {
+ info,
+ contentLength
+ } = await this.pdfDocument.getMetadata();
+ const [fileName, fileSize, creationDate, modificationDate, pageSize, isLinearized] = await Promise.all([this._fileNameLookup(), this.#parseFileSize(contentLength), this.#parseDate(info.CreationDate), this.#parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
+ return this.#parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation);
+ }), this.#parseLinearization(info.IsLinearized)]);
+ this.#fieldData = Object.freeze({
+ fileName,
+ fileSize,
+ title: info.Title,
+ author: info.Author,
+ subject: info.Subject,
+ keywords: info.Keywords,
+ creationDate,
+ modificationDate,
+ creator: info.Creator,
+ producer: info.Producer,
+ version: info.PDFFormatVersion,
+ pageCount: this.pdfDocument.numPages,
+ pageSize,
+ linearized: isLinearized,
+ _currentPageNumber: currentPageNumber,
+ _pagesRotation: pagesRotation
+ });
+ this.#updateUI();
+ const {
+ length
+ } = await this.pdfDocument.getDownloadInfo();
+ if (contentLength === length) {
+ return;
+ }
+ const data = Object.assign(Object.create(null), this.#fieldData);
+ data.fileSize = await this.#parseFileSize(length);
+ this.#fieldData = Object.freeze(data);
+ this.#updateUI();
+ }
+
+ async close() {
+ this.overlayManager.close(this.dialog);
+ }
+
+ setDocument(pdfDocument) {
+ if (this.pdfDocument) {
+ this.#reset();
+ this.#updateUI(true);
+ }
+ if (!pdfDocument) {
+ return;
+ }
+ this.pdfDocument = pdfDocument;
+ this._dataAvailableCapability.resolve();
+ }
+
+ #reset() {
+ this.pdfDocument = null;
+ this.#fieldData = null;
+ this._dataAvailableCapability = new _pdfjsLib.PromiseCapability();
+ this._currentPageNumber = 1;
+ this._pagesRotation = 0;
+ }
+
+ #updateUI(reset = false) {
+ if (reset || !this.#fieldData) {
+ for (const id in this.fields) {
+ this.fields[id].textContent = DEFAULT_FIELD_CONTENT;
+ }
+ return;
+ }
+ if (this.overlayManager.active !== this.dialog) {
+ return;
+ }
+ for (const id in this.fields) {
+ const content = this.#fieldData[id];
+ this.fields[id].textContent = content || content === 0 ? content : DEFAULT_FIELD_CONTENT;
+ }
+ }
+
+ async #parseFileSize(fileSize = 0) {
+ const kb = fileSize / 1024,
+ mb = kb / 1024;
+ if (!kb) {
+ return undefined;
+ }
+ return this.l10n.get(`document_properties_${mb >= 1 ? "mb" : "kb"}`, {
+ size_mb: mb >= 1 && (+mb.toPrecision(3)).toLocaleString(),
+ size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(),
+ size_b: fileSize.toLocaleString()
+ });
+ }
+
+ async #parsePageSize(pageSizeInches, pagesRotation) {
+ if (!pageSizeInches) {
+ return undefined;
+ }
+ if (pagesRotation % 180 !== 0) {
+ pageSizeInches = {
+ width: pageSizeInches.height,
+ height: pageSizeInches.width
+ };
+ }
+ const isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches);
+ let sizeInches = {
+ width: Math.round(pageSizeInches.width * 100) / 100,
+ height: Math.round(pageSizeInches.height * 100) / 100
+ };
+ let sizeMillimeters = {
+ width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,
+ height: Math.round(pageSizeInches.height * 25.4 * 10) / 10
+ };
+ let rawName = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);
+ if (!rawName && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {
+ const exactMillimeters = {
+ width: pageSizeInches.width * 25.4,
+ height: pageSizeInches.height * 25.4
+ };
+ const intMillimeters = {
+ width: Math.round(sizeMillimeters.width),
+ height: Math.round(sizeMillimeters.height)
+ };
+ if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {
+ rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);
+ if (rawName) {
+ sizeInches = {
+ width: Math.round(intMillimeters.width / 25.4 * 100) / 100,
+ height: Math.round(intMillimeters.height / 25.4 * 100) / 100
+ };
+ sizeMillimeters = intMillimeters;
+ }
+ }
+ }
+ const [{
+ width,
+ height
+ }, unit, name, orientation] = await Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get(`document_properties_page_size_unit_${this._isNonMetricLocale ? "inches" : "millimeters"}`), rawName && this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}`), this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}`)]);
+ return this.l10n.get(`document_properties_page_size_dimension_${name ? "name_" : ""}string`, {
+ width: width.toLocaleString(),
+ height: height.toLocaleString(),
+ unit,
+ name,
+ orientation
+ });
+ }
+
+ async #parseDate(inputDate) {
+ const dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate);
+ if (!dateObject) {
+ return undefined;
+ }
+ return this.l10n.get("document_properties_date_string", {
+ date: dateObject.toLocaleDateString(),
+ time: dateObject.toLocaleTimeString()
+ });
+ }
+
+ #parseLinearization(isLinearized) {
+ return this.l10n.get(`document_properties_linearized_${isLinearized ? "yes" : "no"}`);
+ }
+ }
+
+ exports.PDFDocumentProperties = PDFDocumentProperties;
+
+ /***/
+ }),
+ /* 17 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFFindBar = void 0;
+ var _pdf_find_controller = __webpack_require__(18);
+ var _ui_utils = __webpack_require__(3);
+ const MATCHES_COUNT_LIMIT = 1000;
+
+ class PDFFindBar {
+ constructor(options, eventBus, l10n) {
+ this.opened = false;
+ this.bar = options.bar;
+ this.toggleButton = options.toggleButton;
+ this.findField = options.findField;
+ this.highlightAll = options.highlightAllCheckbox;
+ this.caseSensitive = options.caseSensitiveCheckbox;
+ this.matchDiacritics = options.matchDiacriticsCheckbox;
+ this.entireWord = options.entireWordCheckbox;
+ this.findMsg = options.findMsg;
+ this.findResultsCount = options.findResultsCount;
+ this.findPreviousButton = options.findPreviousButton;
+ this.findNextButton = options.findNextButton;
+ this.eventBus = eventBus;
+ this.l10n = l10n;
+ this.toggleButton.addEventListener("click", () => {
+ this.toggle();
+ });
+ this.findField.addEventListener("input", () => {
+ this.dispatchEvent("");
+ });
+ this.bar.addEventListener("keydown", e => {
+ switch (e.keyCode) {
+ case 13:
+ if (e.target === this.findField) {
+ this.dispatchEvent("again", e.shiftKey);
+ }
+ break;
+ case 27:
+ this.close();
+ break;
+ }
+ });
+ this.findPreviousButton.addEventListener("click", () => {
+ this.dispatchEvent("again", true);
+ });
+ this.findNextButton.addEventListener("click", () => {
+ this.dispatchEvent("again", false);
+ });
+ this.highlightAll.addEventListener("click", () => {
+ this.dispatchEvent("highlightallchange");
+ });
+ this.caseSensitive.addEventListener("click", () => {
+ this.dispatchEvent("casesensitivitychange");
+ });
+ this.entireWord.addEventListener("click", () => {
+ this.dispatchEvent("entirewordchange");
+ });
+ this.matchDiacritics.addEventListener("click", () => {
+ this.dispatchEvent("diacriticmatchingchange");
+ });
+ this.eventBus._on("resize", this.#adjustWidth.bind(this));
+ }
+
+ reset() {
+ this.updateUIState();
+ }
+
+ dispatchEvent(type, findPrev = false) {
+ this.eventBus.dispatch("find", {
+ source: this,
+ type,
+ query: this.findField.value,
+ caseSensitive: this.caseSensitive.checked,
+ entireWord: this.entireWord.checked,
+ highlightAll: this.highlightAll.checked,
+ findPrevious: findPrev,
+ matchDiacritics: this.matchDiacritics.checked
+ });
+ }
+
+ updateUIState(state, previous, matchesCount) {
+ let findMsg = Promise.resolve("");
+ let status = "";
+ switch (state) {
+ case _pdf_find_controller.FindState.FOUND:
+ break;
+ case _pdf_find_controller.FindState.PENDING:
+ status = "pending";
+ break;
+ case _pdf_find_controller.FindState.NOT_FOUND:
+ findMsg = this.l10n.get("find_not_found");
+ status = "notFound";
+ break;
+ case _pdf_find_controller.FindState.WRAPPED:
+ findMsg = this.l10n.get(`find_reached_${previous ? "top" : "bottom"}`);
+ break;
+ }
+ this.findField.setAttribute("data-status", status);
+ this.findField.setAttribute("aria-invalid", state === _pdf_find_controller.FindState.NOT_FOUND);
+ findMsg.then(msg => {
+ this.findMsg.setAttribute("data-status", status);
+ this.findMsg.textContent = msg;
+ this.#adjustWidth();
+ });
+ this.updateResultsCount(matchesCount);
+ }
+
+ updateResultsCount({
+ current = 0,
+ total = 0
+ } = {}) {
+ const limit = MATCHES_COUNT_LIMIT;
+ let matchCountMsg = Promise.resolve("");
+ if (total > 0) {
+ if (total > limit) {
+ let key = "find_match_count_limit";
+ matchCountMsg = this.l10n.get(key, {
+ limit
+ });
+ } else {
+ let key = "find_match_count";
+ matchCountMsg = this.l10n.get(key, {
+ current,
+ total
+ });
+ }
+ }
+ matchCountMsg.then(msg => {
+ this.findResultsCount.textContent = msg;
+ this.#adjustWidth();
+ });
+ }
+
+ open() {
+ if (!this.opened) {
+ this.opened = true;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, true, this.bar);
+ }
+ this.findField.select();
+ this.findField.focus();
+ this.#adjustWidth();
+ }
+
+ close() {
+ if (!this.opened) {
+ return;
+ }
+ this.opened = false;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, false, this.bar);
+ this.eventBus.dispatch("findbarclose", {
+ source: this
+ });
+ }
+
+ toggle() {
+ if (this.opened) {
+ this.close();
+ } else {
+ this.open();
+ }
+ }
+
+ #adjustWidth() {
+ if (!this.opened) {
+ return;
+ }
+ this.bar.classList.remove("wrapContainers");
+ const findbarHeight = this.bar.clientHeight;
+ const inputContainerHeight = this.bar.firstElementChild.clientHeight;
+ if (findbarHeight > inputContainerHeight) {
+ this.bar.classList.add("wrapContainers");
+ }
+ }
+ }
+
+ exports.PDFFindBar = PDFFindBar;
+
+ /***/
+ }),
+ /* 18 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFFindController = exports.FindState = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdf_find_utils = __webpack_require__(19);
+ var _pdfjsLib = __webpack_require__(4);
+ const FindState = {
+ FOUND: 0,
+ NOT_FOUND: 1,
+ WRAPPED: 2,
+ PENDING: 3
+ };
+ exports.FindState = FindState;
+ const FIND_TIMEOUT = 250;
+ const MATCH_SCROLL_OFFSET_TOP = -50;
+ const MATCH_SCROLL_OFFSET_LEFT = -400;
+ const CHARACTERS_TO_NORMALIZE = {
+ "\u2010": "-",
+ "\u2018": "'",
+ "\u2019": "'",
+ "\u201A": "'",
+ "\u201B": "'",
+ "\u201C": '"',
+ "\u201D": '"',
+ "\u201E": '"',
+ "\u201F": '"',
+ "\u00BC": "1/4",
+ "\u00BD": "1/2",
+ "\u00BE": "3/4"
+ };
+ const DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);
+ let DIACRITICS_EXCEPTION_STR;
+ const DIACRITICS_REG_EXP = /\p{M}+/gu;
+ const SPECIAL_CHARS_REG_EXP = /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu;
+ const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u;
+ const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u;
+ const SYLLABLES_REG_EXP = /[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g;
+ const SYLLABLES_LENGTHS = new Map();
+ const FIRST_CHAR_SYLLABLES_REG_EXP = "[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]";
+ const NFKC_CHARS_TO_NORMALIZE = new Map();
+ let noSyllablesRegExp = null;
+ let withSyllablesRegExp = null;
+
+ function normalize(text) {
+ const syllablePositions = [];
+ let m;
+ while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {
+ let {
+ index
+ } = m;
+ for (const char of m[0]) {
+ let len = SYLLABLES_LENGTHS.get(char);
+ if (!len) {
+ len = char.normalize("NFD").length;
+ SYLLABLES_LENGTHS.set(char, len);
+ }
+ syllablePositions.push([len, index++]);
+ }
+ }
+ let normalizationRegex;
+ if (syllablePositions.length === 0 && noSyllablesRegExp) {
+ normalizationRegex = noSyllablesRegExp;
+ } else if (syllablePositions.length > 0 && withSyllablesRegExp) {
+ normalizationRegex = withSyllablesRegExp;
+ } else {
+ const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
+ const toNormalizeWithNFKC = (0, _pdf_find_utils.getNormalizeWithNFKC)();
+ const CJK = "(?:\\p{Ideographic}|[\u3040-\u30FF])";
+ const HKDiacritics = "(?:\u3099|\u309A)";
+ const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`;
+ if (syllablePositions.length === 0) {
+ normalizationRegex = noSyllablesRegExp = new RegExp(regexp + "|(\\u0000)", "gum");
+ } else {
+ normalizationRegex = withSyllablesRegExp = new RegExp(regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, "gum");
+ }
+ }
+ const rawDiacriticsPositions = [];
+ while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {
+ rawDiacriticsPositions.push([m[0].length, m.index]);
+ }
+ let normalized = text.normalize("NFD");
+ const positions = [[0, 0]];
+ let rawDiacriticsIndex = 0;
+ let syllableIndex = 0;
+ let shift = 0;
+ let shiftOrigin = 0;
+ let eol = 0;
+ let hasDiacritics = false;
+ normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => {
+ i -= shiftOrigin;
+ if (p1) {
+ const replacement = CHARACTERS_TO_NORMALIZE[p1];
+ const jj = replacement.length;
+ for (let j = 1; j < jj; j++) {
+ positions.push([i - shift + j, shift - j]);
+ }
+ shift -= jj - 1;
+ return replacement;
+ }
+ if (p2) {
+ let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);
+ if (!replacement) {
+ replacement = p2.normalize("NFKC");
+ NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);
+ }
+ const jj = replacement.length;
+ for (let j = 1; j < jj; j++) {
+ positions.push([i - shift + j, shift - j]);
+ }
+ shift -= jj - 1;
+ return replacement;
+ }
+ if (p3) {
+ hasDiacritics = true;
+ if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {
+ ++rawDiacriticsIndex;
+ } else {
+ positions.push([i - 1 - shift + 1, shift - 1]);
+ shift -= 1;
+ shiftOrigin += 1;
+ }
+ positions.push([i - shift + 1, shift]);
+ shiftOrigin += 1;
+ eol += 1;
+ return p3.charAt(0);
+ }
+ if (p4) {
+ const hasTrailingDashEOL = p4.endsWith("\n");
+ const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;
+ hasDiacritics = true;
+ let jj = len;
+ if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {
+ jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];
+ ++rawDiacriticsIndex;
+ }
+ for (let j = 1; j <= jj; j++) {
+ positions.push([i - 1 - shift + j, shift - j]);
+ }
+ shift -= jj;
+ shiftOrigin += jj;
+ if (hasTrailingDashEOL) {
+ i += len - 1;
+ positions.push([i - shift + 1, 1 + shift]);
+ shift += 1;
+ shiftOrigin += 1;
+ eol += 1;
+ return p4.slice(0, len);
+ }
+ return p4;
+ }
+ if (p5) {
+ const len = p5.length - 2;
+ positions.push([i - shift + len, 1 + shift]);
+ shift += 1;
+ shiftOrigin += 1;
+ eol += 1;
+ return p5.slice(0, -2);
+ }
+ if (p6) {
+ const len = p6.length - 1;
+ positions.push([i - shift + len, shift]);
+ shiftOrigin += 1;
+ eol += 1;
+ return p6.slice(0, -1);
+ }
+ if (p7) {
+ positions.push([i - shift + 1, shift - 1]);
+ shift -= 1;
+ shiftOrigin += 1;
+ eol += 1;
+ return " ";
+ }
+ if (i + eol === syllablePositions[syllableIndex]?.[1]) {
+ const newCharLen = syllablePositions[syllableIndex][0] - 1;
+ ++syllableIndex;
+ for (let j = 1; j <= newCharLen; j++) {
+ positions.push([i - (shift - j), shift - j]);
+ }
+ shift -= newCharLen;
+ shiftOrigin += newCharLen;
+ }
+ return p8;
+ });
+ positions.push([normalized.length, shift]);
+ return [normalized, positions, hasDiacritics];
+ }
+
+ function getOriginalIndex(diffs, pos, len) {
+ if (!diffs) {
+ return [pos, len];
+ }
+ const start = pos;
+ const end = pos + len - 1;
+ let i = (0, _ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= start);
+ if (diffs[i][0] > start) {
+ --i;
+ }
+ let j = (0, _ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= end, i);
+ if (diffs[j][0] > end) {
+ --j;
+ }
+ const oldStart = start + diffs[i][1];
+ const oldEnd = end + diffs[j][1];
+ const oldLen = oldEnd + 1 - oldStart;
+ return [oldStart, oldLen];
+ }
+
+ class PDFFindController {
+ #state = null;
+ #updateMatchesCountOnProgress = true;
+ #visitedPagesCount = 0;
+
+ constructor({
+ linkService,
+ eventBus,
+ updateMatchesCountOnProgress = true
+ }) {
+ this._linkService = linkService;
+ this._eventBus = eventBus;
+ this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;
+ this.onIsPageVisible = null;
+ this.#reset();
+ eventBus._on("find", this.#onFind.bind(this));
+ eventBus._on("findbarclose", this.#onFindBarClose.bind(this));
+ }
+
+ get highlightMatches() {
+ return this._highlightMatches;
+ }
+
+ get pageMatches() {
+ return this._pageMatches;
+ }
+
+ get pageMatchesLength() {
+ return this._pageMatchesLength;
+ }
+
+ get selected() {
+ return this._selected;
+ }
+
+ get state() {
+ return this.#state;
+ }
+
+ setDocument(pdfDocument) {
+ if (this._pdfDocument) {
+ this.#reset();
+ }
+ if (!pdfDocument) {
+ return;
+ }
+ this._pdfDocument = pdfDocument;
+ this._firstPageCapability.resolve();
+ }
+
+ #onFind(state) {
+ if (!state) {
+ return;
+ }
+ if (state.phraseSearch === false) {
+ console.error("The `phraseSearch`-parameter was removed, please provide " + "an Array of strings in the `query`-parameter instead.");
+ if (typeof state.query === "string") {
+ state.query = state.query.match(/\S+/g);
+ }
+ }
+ const pdfDocument = this._pdfDocument;
+ const {
+ type
+ } = state;
+ if (this.#state === null || this.#shouldDirtyMatch(state)) {
+ this._dirtyMatch = true;
+ }
+ this.#state = state;
+ if (type !== "highlightallchange") {
+ this.#updateUIState(FindState.PENDING);
+ }
+ this._firstPageCapability.promise.then(() => {
+ if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {
+ return;
+ }
+ this.#extractText();
+ const findbarClosed = !this._highlightMatches;
+ const pendingTimeout = !!this._findTimeout;
+ if (this._findTimeout) {
+ clearTimeout(this._findTimeout);
+ this._findTimeout = null;
+ }
+ if (!type) {
+ this._findTimeout = setTimeout(() => {
+ this.#nextMatch();
+ this._findTimeout = null;
+ }, FIND_TIMEOUT);
+ } else if (this._dirtyMatch) {
+ this.#nextMatch();
+ } else if (type === "again") {
+ this.#nextMatch();
+ if (findbarClosed && this.#state.highlightAll) {
+ this.#updateAllPages();
+ }
+ } else if (type === "highlightallchange") {
+ if (pendingTimeout) {
+ this.#nextMatch();
+ } else {
+ this._highlightMatches = true;
+ }
+ this.#updateAllPages();
+ } else {
+ this.#nextMatch();
+ }
+ });
+ }
+
+ scrollMatchIntoView({
+ element = null,
+ selectedLeft = 0,
+ pageIndex = -1,
+ matchIndex = -1
+ }) {
+ if (!this._scrollMatches || !element) {
+ return;
+ } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
+ return;
+ } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
+ return;
+ }
+ this._scrollMatches = false;
+ const spot = {
+ top: MATCH_SCROLL_OFFSET_TOP,
+ left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
+ };
+ (0, _ui_utils.scrollIntoView)(element, spot, true);
+ }
+
+ #reset() {
+ this._highlightMatches = false;
+ this._scrollMatches = false;
+ this._pdfDocument = null;
+ this._pageMatches = [];
+ this._pageMatchesLength = [];
+ this.#visitedPagesCount = 0;
+ this.#state = null;
+ this._selected = {
+ pageIdx: -1,
+ matchIdx: -1
+ };
+ this._offset = {
+ pageIdx: null,
+ matchIdx: null,
+ wrapped: false
+ };
+ this._extractTextPromises = [];
+ this._pageContents = [];
+ this._pageDiffs = [];
+ this._hasDiacritics = [];
+ this._matchesCountTotal = 0;
+ this._pagesToSearch = null;
+ this._pendingFindMatches = new Set();
+ this._resumePageIdx = null;
+ this._dirtyMatch = false;
+ clearTimeout(this._findTimeout);
+ this._findTimeout = null;
+ this._firstPageCapability = new _pdfjsLib.PromiseCapability();
+ }
+
+ get #query() {
+ const {
+ query
+ } = this.#state;
+ if (typeof query === "string") {
+ if (query !== this._rawQuery) {
+ this._rawQuery = query;
+ [this._normalizedQuery] = normalize(query);
+ }
+ return this._normalizedQuery;
+ }
+ return (query || []).filter(q => !!q).map(q => normalize(q)[0]);
+ }
+
+ #shouldDirtyMatch(state) {
+ const newQuery = state.query,
+ prevQuery = this.#state.query;
+ const newType = typeof newQuery,
+ prevType = typeof prevQuery;
+ if (newType !== prevType) {
+ return true;
+ }
+ if (newType === "string") {
+ if (newQuery !== prevQuery) {
+ return true;
+ }
+ } else if (JSON.stringify(newQuery) !== JSON.stringify(prevQuery)) {
+ return true;
+ }
+ switch (state.type) {
+ case "again":
+ const pageNumber = this._selected.pageIdx + 1;
+ const linkService = this._linkService;
+ return pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !(this.onIsPageVisible?.(pageNumber) ?? true);
+ case "highlightallchange":
+ return false;
+ }
+ return true;
+ }
+
+ #isEntireWord(content, startIdx, length) {
+ let match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP);
+ if (match) {
+ const first = content.charCodeAt(startIdx);
+ const limit = match[1].charCodeAt(0);
+ if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
+ return false;
+ }
+ }
+ match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP);
+ if (match) {
+ const last = content.charCodeAt(startIdx + length - 1);
+ const limit = match[1].charCodeAt(0);
+ if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(limit)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {
+ const matches = this._pageMatches[pageIndex] = [];
+ const matchesLength = this._pageMatchesLength[pageIndex] = [];
+ if (!query) {
+ return;
+ }
+ const diffs = this._pageDiffs[pageIndex];
+ let match;
+ while ((match = query.exec(pageContent)) !== null) {
+ if (entireWord && !this.#isEntireWord(pageContent, match.index, match[0].length)) {
+ continue;
+ }
+ const [matchPos, matchLen] = getOriginalIndex(diffs, match.index, match[0].length);
+ if (matchLen) {
+ matches.push(matchPos);
+ matchesLength.push(matchLen);
+ }
+ }
+ }
+
+ #convertToRegExpString(query, hasDiacritics) {
+ const {
+ matchDiacritics
+ } = this.#state;
+ let isUnicode = false;
+ query = query.replaceAll(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => {
+ if (p1) {
+ return `[ ]*\\${p1}[ ]*`;
+ }
+ if (p2) {
+ return `[ ]*${p2}[ ]*`;
+ }
+ if (p3) {
+ return "[ ]+";
+ }
+ if (matchDiacritics) {
+ return p4 || p5;
+ }
+ if (p4) {
+ return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
+ }
+ if (hasDiacritics) {
+ isUnicode = true;
+ return `${p5}\\p{M}*`;
+ }
+ return p5;
+ });
+ const trailingSpaces = "[ ]*";
+ if (query.endsWith(trailingSpaces)) {
+ query = query.slice(0, query.length - trailingSpaces.length);
+ }
+ if (matchDiacritics) {
+ if (hasDiacritics) {
+ DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION);
+ isUnicode = true;
+ query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
+ }
+ }
+ return [isUnicode, query];
+ }
+
+ #calculateMatch(pageIndex) {
+ let query = this.#query;
+ if (query.length === 0) {
+ return;
+ }
+ const {
+ caseSensitive,
+ entireWord
+ } = this.#state;
+ const pageContent = this._pageContents[pageIndex];
+ const hasDiacritics = this._hasDiacritics[pageIndex];
+ let isUnicode = false;
+ if (typeof query === "string") {
+ [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);
+ } else {
+ query = query.sort().reverse().map(q => {
+ const [isUnicodePart, queryPart] = this.#convertToRegExpString(q, hasDiacritics);
+ isUnicode ||= isUnicodePart;
+ return `(${queryPart})`;
+ }).join("|");
+ }
+ const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`;
+ query = query ? new RegExp(query, flags) : null;
+ this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);
+ if (this.#state.highlightAll) {
+ this.#updatePage(pageIndex);
+ }
+ if (this._resumePageIdx === pageIndex) {
+ this._resumePageIdx = null;
+ this.#nextPageMatch();
+ }
+ const pageMatchesCount = this._pageMatches[pageIndex].length;
+ this._matchesCountTotal += pageMatchesCount;
+ if (this.#updateMatchesCountOnProgress) {
+ if (pageMatchesCount > 0) {
+ this.#updateUIResultsCount();
+ }
+ } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {
+ this.#updateUIResultsCount();
+ }
+ }
+
+ #extractText() {
+ if (this._extractTextPromises.length > 0) {
+ return;
+ }
+ let promise = Promise.resolve();
+ const textOptions = {
+ disableNormalization: true
+ };
+ for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
+ const extractTextCapability = new _pdfjsLib.PromiseCapability();
+ this._extractTextPromises[i] = extractTextCapability.promise;
+ promise = promise.then(() => {
+ return this._pdfDocument.getPage(i + 1).then(pdfPage => {
+ return pdfPage.getTextContent(textOptions);
+ }).then(textContent => {
+ const strBuf = [];
+ for (const textItem of textContent.items) {
+ strBuf.push(textItem.str);
+ if (textItem.hasEOL) {
+ strBuf.push("\n");
+ }
+ }
+ [this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join(""));
+ extractTextCapability.resolve();
+ }, reason => {
+ console.error(`Unable to get text content for page ${i + 1}`, reason);
+ this._pageContents[i] = "";
+ this._pageDiffs[i] = null;
+ this._hasDiacritics[i] = false;
+ extractTextCapability.resolve();
+ });
+ });
+ }
+ }
+
+ #updatePage(index) {
+ if (this._scrollMatches && this._selected.pageIdx === index) {
+ this._linkService.page = index + 1;
+ }
+ this._eventBus.dispatch("updatetextlayermatches", {
+ source: this,
+ pageIndex: index
+ });
+ }
+
+ #updateAllPages() {
+ this._eventBus.dispatch("updatetextlayermatches", {
+ source: this,
+ pageIndex: -1
+ });
+ }
+
+ #nextMatch() {
+ const previous = this.#state.findPrevious;
+ const currentPageIndex = this._linkService.page - 1;
+ const numPages = this._linkService.pagesCount;
+ this._highlightMatches = true;
+ if (this._dirtyMatch) {
+ this._dirtyMatch = false;
+ this._selected.pageIdx = this._selected.matchIdx = -1;
+ this._offset.pageIdx = currentPageIndex;
+ this._offset.matchIdx = null;
+ this._offset.wrapped = false;
+ this._resumePageIdx = null;
+ this._pageMatches.length = 0;
+ this._pageMatchesLength.length = 0;
+ this.#visitedPagesCount = 0;
+ this._matchesCountTotal = 0;
+ this.#updateAllPages();
+ for (let i = 0; i < numPages; i++) {
+ if (this._pendingFindMatches.has(i)) {
+ continue;
+ }
+ this._pendingFindMatches.add(i);
+ this._extractTextPromises[i].then(() => {
+ this._pendingFindMatches.delete(i);
+ this.#calculateMatch(i);
+ });
+ }
+ }
+ const query = this.#query;
+ if (query.length === 0) {
+ this.#updateUIState(FindState.FOUND);
+ return;
+ }
+ if (this._resumePageIdx) {
+ return;
+ }
+ const offset = this._offset;
+ this._pagesToSearch = numPages;
+ if (offset.matchIdx !== null) {
+ const numPageMatches = this._pageMatches[offset.pageIdx].length;
+ if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
+ offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
+ this.#updateMatch(true);
+ return;
+ }
+ this.#advanceOffsetPage(previous);
+ }
+ this.#nextPageMatch();
+ }
+
+ #matchesReady(matches) {
+ const offset = this._offset;
+ const numMatches = matches.length;
+ const previous = this.#state.findPrevious;
+ if (numMatches) {
+ offset.matchIdx = previous ? numMatches - 1 : 0;
+ this.#updateMatch(true);
+ return true;
+ }
+ this.#advanceOffsetPage(previous);
+ if (offset.wrapped) {
+ offset.matchIdx = null;
+ if (this._pagesToSearch < 0) {
+ this.#updateMatch(false);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ #nextPageMatch() {
+ if (this._resumePageIdx !== null) {
+ console.error("There can only be one pending page.");
+ }
+ let matches = null;
+ do {
+ const pageIdx = this._offset.pageIdx;
+ matches = this._pageMatches[pageIdx];
+ if (!matches) {
+ this._resumePageIdx = pageIdx;
+ break;
+ }
+ } while (!this.#matchesReady(matches));
+ }
+
+ #advanceOffsetPage(previous) {
+ const offset = this._offset;
+ const numPages = this._linkService.pagesCount;
+ offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
+ offset.matchIdx = null;
+ this._pagesToSearch--;
+ if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
+ offset.pageIdx = previous ? numPages - 1 : 0;
+ offset.wrapped = true;
+ }
+ }
+
+ #updateMatch(found = false) {
+ let state = FindState.NOT_FOUND;
+ const wrapped = this._offset.wrapped;
+ this._offset.wrapped = false;
+ if (found) {
+ const previousPage = this._selected.pageIdx;
+ this._selected.pageIdx = this._offset.pageIdx;
+ this._selected.matchIdx = this._offset.matchIdx;
+ state = wrapped ? FindState.WRAPPED : FindState.FOUND;
+ if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
+ this.#updatePage(previousPage);
+ }
+ }
+ this.#updateUIState(state, this.#state.findPrevious);
+ if (this._selected.pageIdx !== -1) {
+ this._scrollMatches = true;
+ this.#updatePage(this._selected.pageIdx);
+ }
+ }
+
+ #onFindBarClose(evt) {
+ const pdfDocument = this._pdfDocument;
+ this._firstPageCapability.promise.then(() => {
+ if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {
+ return;
+ }
+ if (this._findTimeout) {
+ clearTimeout(this._findTimeout);
+ this._findTimeout = null;
+ }
+ if (this._resumePageIdx) {
+ this._resumePageIdx = null;
+ this._dirtyMatch = true;
+ }
+ this.#updateUIState(FindState.FOUND);
+ this._highlightMatches = false;
+ this.#updateAllPages();
+ });
+ }
+
+ #requestMatchesCount() {
+ const {
+ pageIdx,
+ matchIdx
+ } = this._selected;
+ let current = 0,
+ total = this._matchesCountTotal;
+ if (matchIdx !== -1) {
+ for (let i = 0; i < pageIdx; i++) {
+ current += this._pageMatches[i]?.length || 0;
+ }
+ current += matchIdx + 1;
+ }
+ if (current < 1 || current > total) {
+ current = total = 0;
+ }
+ return {
+ current,
+ total
+ };
+ }
+
+ #updateUIResultsCount() {
+ this._eventBus.dispatch("updatefindmatchescount", {
+ source: this,
+ matchesCount: this.#requestMatchesCount()
+ });
+ }
+
+ #updateUIState(state, previous = false) {
+ if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) {
+ return;
+ }
+ this._eventBus.dispatch("updatefindcontrolstate", {
+ source: this,
+ state,
+ previous,
+ matchesCount: this.#requestMatchesCount(),
+ rawQuery: this.#state?.query ?? null
+ });
+ }
+ }
+
+ exports.PDFFindController = PDFFindController;
+
+ /***/
+ }),
+ /* 19 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.CharacterType = void 0;
+ exports.getCharacterType = getCharacterType;
+ exports.getNormalizeWithNFKC = getNormalizeWithNFKC;
+ const CharacterType = {
+ SPACE: 0,
+ ALPHA_LETTER: 1,
+ PUNCT: 2,
+ HAN_LETTER: 3,
+ KATAKANA_LETTER: 4,
+ HIRAGANA_LETTER: 5,
+ HALFWIDTH_KATAKANA_LETTER: 6,
+ THAI_LETTER: 7
+ };
+ exports.CharacterType = CharacterType;
+
+ function isAlphabeticalScript(charCode) {
+ return charCode < 0x2e80;
+ }
+
+ function isAscii(charCode) {
+ return (charCode & 0xff80) === 0;
+ }
+
+ function isAsciiAlpha(charCode) {
+ return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;
+ }
+
+ function isAsciiDigit(charCode) {
+ return charCode >= 0x30 && charCode <= 0x39;
+ }
+
+ function isAsciiSpace(charCode) {
+ return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
+ }
+
+ function isHan(charCode) {
+ return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
+ }
+
+ function isKatakana(charCode) {
+ return charCode >= 0x30a0 && charCode <= 0x30ff;
+ }
+
+ function isHiragana(charCode) {
+ return charCode >= 0x3040 && charCode <= 0x309f;
+ }
+
+ function isHalfwidthKatakana(charCode) {
+ return charCode >= 0xff60 && charCode <= 0xff9f;
+ }
+
+ function isThai(charCode) {
+ return (charCode & 0xff80) === 0x0e00;
+ }
+
+ function getCharacterType(charCode) {
+ if (isAlphabeticalScript(charCode)) {
+ if (isAscii(charCode)) {
+ if (isAsciiSpace(charCode)) {
+ return CharacterType.SPACE;
+ } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
+ return CharacterType.ALPHA_LETTER;
+ }
+ return CharacterType.PUNCT;
+ } else if (isThai(charCode)) {
+ return CharacterType.THAI_LETTER;
+ } else if (charCode === 0xa0) {
+ return CharacterType.SPACE;
+ }
+ return CharacterType.ALPHA_LETTER;
+ }
+ if (isHan(charCode)) {
+ return CharacterType.HAN_LETTER;
+ } else if (isKatakana(charCode)) {
+ return CharacterType.KATAKANA_LETTER;
+ } else if (isHiragana(charCode)) {
+ return CharacterType.HIRAGANA_LETTER;
+ } else if (isHalfwidthKatakana(charCode)) {
+ return CharacterType.HALFWIDTH_KATAKANA_LETTER;
+ }
+ return CharacterType.ALPHA_LETTER;
+ }
+
+ let NormalizeWithNFKC;
+
+ function getNormalizeWithNFKC() {
+ NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;
+ return NormalizeWithNFKC;
+ }
+
+ /***/
+ }),
+ /* 20 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFHistory = void 0;
+ exports.isDestArraysEqual = isDestArraysEqual;
+ exports.isDestHashesEqual = isDestHashesEqual;
+ var _ui_utils = __webpack_require__(3);
+ var _event_utils = __webpack_require__(6);
+ const HASH_CHANGE_TIMEOUT = 1000;
+ const POSITION_UPDATED_THRESHOLD = 50;
+ const UPDATE_VIEWAREA_TIMEOUT = 1000;
+
+ function getCurrentHash() {
+ return document.location.hash;
+ }
+
+ class PDFHistory {
+ constructor({
+ linkService,
+ eventBus
+ }) {
+ this.linkService = linkService;
+ this.eventBus = eventBus;
+ this._initialized = false;
+ this._fingerprint = "";
+ this.reset();
+ this._boundEvents = null;
+ this.eventBus._on("pagesinit", () => {
+ this._isPagesLoaded = false;
+ this.eventBus._on("pagesloaded", evt => {
+ this._isPagesLoaded = !!evt.pagesCount;
+ }, {
+ once: true
+ });
+ });
+ }
+
+ initialize({
+ fingerprint,
+ resetHistory = false,
+ updateUrl = false
+ }) {
+ if (!fingerprint || typeof fingerprint !== "string") {
+ console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
+ return;
+ }
+ if (this._initialized) {
+ this.reset();
+ }
+ const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
+ this._fingerprint = fingerprint;
+ this._updateUrl = updateUrl === true;
+ this._initialized = true;
+ this._bindEvents();
+ const state = window.history.state;
+ this._popStateInProgress = false;
+ this._blockHashChange = 0;
+ this._currentHash = getCurrentHash();
+ this._numPositionUpdates = 0;
+ this._uid = this._maxUid = 0;
+ this._destination = null;
+ this._position = null;
+ if (!this._isValidState(state, true) || resetHistory) {
+ const {
+ hash,
+ page,
+ rotation
+ } = this._parseCurrentHash(true);
+ if (!hash || reInitialized || resetHistory) {
+ this._pushOrReplaceState(null, true);
+ return;
+ }
+ this._pushOrReplaceState({
+ hash,
+ page,
+ rotation
+ }, true);
+ return;
+ }
+ const destination = state.destination;
+ this._updateInternalState(destination, state.uid, true);
+ if (destination.rotation !== undefined) {
+ this._initialRotation = destination.rotation;
+ }
+ if (destination.dest) {
+ this._initialBookmark = JSON.stringify(destination.dest);
+ this._destination.page = null;
+ } else if (destination.hash) {
+ this._initialBookmark = destination.hash;
+ } else if (destination.page) {
+ this._initialBookmark = `page=${destination.page}`;
+ }
+ }
+
+ reset() {
+ if (this._initialized) {
+ this._pageHide();
+ this._initialized = false;
+ this._unbindEvents();
+ }
+ if (this._updateViewareaTimeout) {
+ clearTimeout(this._updateViewareaTimeout);
+ this._updateViewareaTimeout = null;
+ }
+ this._initialBookmark = null;
+ this._initialRotation = null;
+ }
+
+ push({
+ namedDest = null,
+ explicitDest,
+ pageNumber
+ }) {
+ if (!this._initialized) {
+ return;
+ }
+ if (namedDest && typeof namedDest !== "string") {
+ console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`);
+ return;
+ } else if (!Array.isArray(explicitDest)) {
+ console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`);
+ return;
+ } else if (!this._isValidPage(pageNumber)) {
+ if (pageNumber !== null || this._destination) {
+ console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`);
+ return;
+ }
+ }
+ const hash = namedDest || JSON.stringify(explicitDest);
+ if (!hash) {
+ return;
+ }
+ let forceReplace = false;
+ if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
+ if (this._destination.page) {
+ return;
+ }
+ forceReplace = true;
+ }
+ if (this._popStateInProgress && !forceReplace) {
+ return;
+ }
+ this._pushOrReplaceState({
+ dest: explicitDest,
+ hash,
+ page: pageNumber,
+ rotation: this.linkService.rotation
+ }, forceReplace);
+ if (!this._popStateInProgress) {
+ this._popStateInProgress = true;
+ Promise.resolve().then(() => {
+ this._popStateInProgress = false;
+ });
+ }
+ }
+
+ pushPage(pageNumber) {
+ if (!this._initialized) {
+ return;
+ }
+ if (!this._isValidPage(pageNumber)) {
+ console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`);
+ return;
+ }
+ if (this._destination?.page === pageNumber) {
+ return;
+ }
+ if (this._popStateInProgress) {
+ return;
+ }
+ this._pushOrReplaceState({
+ dest: null,
+ hash: `page=${pageNumber}`,
+ page: pageNumber,
+ rotation: this.linkService.rotation
+ });
+ if (!this._popStateInProgress) {
+ this._popStateInProgress = true;
+ Promise.resolve().then(() => {
+ this._popStateInProgress = false;
+ });
+ }
+ }
+
+ pushCurrentPosition() {
+ if (!this._initialized || this._popStateInProgress) {
+ return;
+ }
+ this._tryPushCurrentPosition();
+ }
+
+ back() {
+ if (!this._initialized || this._popStateInProgress) {
+ return;
+ }
+ const state = window.history.state;
+ if (this._isValidState(state) && state.uid > 0) {
+ window.history.back();
+ }
+ }
+
+ forward() {
+ if (!this._initialized || this._popStateInProgress) {
+ return;
+ }
+ const state = window.history.state;
+ if (this._isValidState(state) && state.uid < this._maxUid) {
+ window.history.forward();
+ }
+ }
+
+ get popStateInProgress() {
+ return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
+ }
+
+ get initialBookmark() {
+ return this._initialized ? this._initialBookmark : null;
+ }
+
+ get initialRotation() {
+ return this._initialized ? this._initialRotation : null;
+ }
+
+ _pushOrReplaceState(destination, forceReplace = false) {
+ const shouldReplace = forceReplace || !this._destination;
+ const newState = {
+ fingerprint: this._fingerprint,
+ uid: shouldReplace ? this._uid : this._uid + 1,
+ destination
+ };
+ this._updateInternalState(destination, newState.uid);
+ let newUrl;
+ if (this._updateUrl && destination?.hash) {
+ const baseUrl = document.location.href.split("#")[0];
+ if (!baseUrl.startsWith("file://")) {
+ newUrl = `${baseUrl}#${destination.hash}`;
+ }
+ }
+ if (shouldReplace) {
+ window.history.replaceState(newState, "", newUrl);
+ } else {
+ window.history.pushState(newState, "", newUrl);
+ }
+ }
+
+ _tryPushCurrentPosition(temporary = false) {
+ if (!this._position) {
+ return;
+ }
+ let position = this._position;
+ if (temporary) {
+ position = Object.assign(Object.create(null), this._position);
+ position.temporary = true;
+ }
+ if (!this._destination) {
+ this._pushOrReplaceState(position);
+ return;
+ }
+ if (this._destination.temporary) {
+ this._pushOrReplaceState(position, true);
+ return;
+ }
+ if (this._destination.hash === position.hash) {
+ return;
+ }
+ if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
+ return;
+ }
+ let forceReplace = false;
+ if (this._destination.page >= position.first && this._destination.page <= position.page) {
+ if (this._destination.dest !== undefined || !this._destination.first) {
+ return;
+ }
+ forceReplace = true;
+ }
+ this._pushOrReplaceState(position, forceReplace);
+ }
+
+ _isValidPage(val) {
+ return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
+ }
+
+ _isValidState(state, checkReload = false) {
+ if (!state) {
+ return false;
+ }
+ if (state.fingerprint !== this._fingerprint) {
+ if (checkReload) {
+ if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
+ return false;
+ }
+ const [perfEntry] = performance.getEntriesByType("navigation");
+ if (perfEntry?.type !== "reload") {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ if (!Number.isInteger(state.uid) || state.uid < 0) {
+ return false;
+ }
+ if (state.destination === null || typeof state.destination !== "object") {
+ return false;
+ }
+ return true;
+ }
+
+ _updateInternalState(destination, uid, removeTemporary = false) {
+ if (this._updateViewareaTimeout) {
+ clearTimeout(this._updateViewareaTimeout);
+ this._updateViewareaTimeout = null;
+ }
+ if (removeTemporary && destination?.temporary) {
+ delete destination.temporary;
+ }
+ this._destination = destination;
+ this._uid = uid;
+ this._maxUid = Math.max(this._maxUid, uid);
+ this._numPositionUpdates = 0;
+ }
+
+ _parseCurrentHash(checkNameddest = false) {
+ const hash = unescape(getCurrentHash()).substring(1);
+ const params = (0, _ui_utils.parseQueryString)(hash);
+ const nameddest = params.get("nameddest") || "";
+ let page = params.get("page") | 0;
+ if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
+ page = null;
+ }
+ return {
+ hash,
+ page,
+ rotation: this.linkService.rotation
+ };
+ }
+
+ _updateViewarea({
+ location
+ }) {
+ if (this._updateViewareaTimeout) {
+ clearTimeout(this._updateViewareaTimeout);
+ this._updateViewareaTimeout = null;
+ }
+ this._position = {
+ hash: location.pdfOpenParams.substring(1),
+ page: this.linkService.page,
+ first: location.pageNumber,
+ rotation: location.rotation
+ };
+ if (this._popStateInProgress) {
+ return;
+ }
+ if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
+ this._numPositionUpdates++;
+ }
+ if (UPDATE_VIEWAREA_TIMEOUT > 0) {
+ this._updateViewareaTimeout = setTimeout(() => {
+ if (!this._popStateInProgress) {
+ this._tryPushCurrentPosition(true);
+ }
+ this._updateViewareaTimeout = null;
+ }, UPDATE_VIEWAREA_TIMEOUT);
+ }
+ }
+
+ _popState({
+ state
+ }) {
+ const newHash = getCurrentHash(),
+ hashChanged = this._currentHash !== newHash;
+ this._currentHash = newHash;
+ if (!state) {
+ this._uid++;
+ const {
+ hash,
+ page,
+ rotation
+ } = this._parseCurrentHash();
+ this._pushOrReplaceState({
+ hash,
+ page,
+ rotation
+ }, true);
+ return;
+ }
+ if (!this._isValidState(state)) {
+ return;
+ }
+ this._popStateInProgress = true;
+ if (hashChanged) {
+ this._blockHashChange++;
+ (0, _event_utils.waitOnEventOrTimeout)({
+ target: window,
+ name: "hashchange",
+ delay: HASH_CHANGE_TIMEOUT
+ }).then(() => {
+ this._blockHashChange--;
+ });
+ }
+ const destination = state.destination;
+ this._updateInternalState(destination, state.uid, true);
+ if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
+ this.linkService.rotation = destination.rotation;
+ }
+ if (destination.dest) {
+ this.linkService.goToDestination(destination.dest);
+ } else if (destination.hash) {
+ this.linkService.setHash(destination.hash);
+ } else if (destination.page) {
+ this.linkService.page = destination.page;
+ }
+ Promise.resolve().then(() => {
+ this._popStateInProgress = false;
+ });
+ }
+
+ _pageHide() {
+ if (!this._destination || this._destination.temporary) {
+ this._tryPushCurrentPosition();
+ }
+ }
+
+ _bindEvents() {
+ if (this._boundEvents) {
+ return;
+ }
+ this._boundEvents = {
+ updateViewarea: this._updateViewarea.bind(this),
+ popState: this._popState.bind(this),
+ pageHide: this._pageHide.bind(this)
+ };
+ this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
+ window.addEventListener("popstate", this._boundEvents.popState);
+ window.addEventListener("pagehide", this._boundEvents.pageHide);
+ }
+
+ _unbindEvents() {
+ if (!this._boundEvents) {
+ return;
+ }
+ this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
+ window.removeEventListener("popstate", this._boundEvents.popState);
+ window.removeEventListener("pagehide", this._boundEvents.pageHide);
+ this._boundEvents = null;
+ }
+ }
+
+ exports.PDFHistory = PDFHistory;
+
+ function isDestHashesEqual(destHash, pushHash) {
+ if (typeof destHash !== "string" || typeof pushHash !== "string") {
+ return false;
+ }
+ if (destHash === pushHash) {
+ return true;
+ }
+ const nameddest = (0, _ui_utils.parseQueryString)(destHash).get("nameddest");
+ if (nameddest === pushHash) {
+ return true;
+ }
+ return false;
+ }
+
+ function isDestArraysEqual(firstDest, secondDest) {
+ function isEntryEqual(first, second) {
+ if (typeof first !== typeof second) {
+ return false;
+ }
+ if (Array.isArray(first) || Array.isArray(second)) {
+ return false;
+ }
+ if (first !== null && typeof first === "object" && second !== null) {
+ if (Object.keys(first).length !== Object.keys(second).length) {
+ return false;
+ }
+ for (const key in first) {
+ if (!isEntryEqual(first[key], second[key])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return first === second || Number.isNaN(first) && Number.isNaN(second);
+ }
+
+ if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
+ return false;
+ }
+ if (firstDest.length !== secondDest.length) {
+ return false;
+ }
+ for (let i = 0, ii = firstDest.length; i < ii; i++) {
+ if (!isEntryEqual(firstDest[i], secondDest[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /***/
+ }),
+ /* 21 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFLayerViewer = void 0;
+ var _base_tree_viewer = __webpack_require__(13);
+
+ class PDFLayerViewer extends _base_tree_viewer.BaseTreeViewer {
+ constructor(options) {
+ super(options);
+ this.l10n = options.l10n;
+ this.eventBus._on("optionalcontentconfigchanged", evt => {
+ this.#updateLayers(evt.promise);
+ });
+ this.eventBus._on("resetlayers", () => {
+ this.#updateLayers();
+ });
+ this.eventBus._on("togglelayerstree", this._toggleAllTreeItems.bind(this));
+ }
+
+ reset() {
+ super.reset();
+ this._optionalContentConfig = null;
+ this._optionalContentHash = null;
+ }
+
+ _dispatchEvent(layersCount) {
+ this.eventBus.dispatch("layersloaded", {
+ source: this,
+ layersCount
+ });
+ }
+
+ _bindLink(element, {
+ groupId,
+ input
+ }) {
+ const setVisibility = () => {
+ this._optionalContentConfig.setVisibility(groupId, input.checked);
+ this._optionalContentHash = this._optionalContentConfig.getHash();
+ this.eventBus.dispatch("optionalcontentconfig", {
+ source: this,
+ promise: Promise.resolve(this._optionalContentConfig)
+ });
+ };
+ element.onclick = evt => {
+ if (evt.target === input) {
+ setVisibility();
+ return true;
+ } else if (evt.target !== element) {
+ return true;
+ }
+ input.checked = !input.checked;
+ setVisibility();
+ return false;
+ };
+ }
+
+ async _setNestedName(element, {
+ name = null
+ }) {
+ if (typeof name === "string") {
+ element.textContent = this._normalizeTextContent(name);
+ return;
+ }
+ element.textContent = await this.l10n.get("additional_layers");
+ element.style.fontStyle = "italic";
+ }
+
+ _addToggleButton(div, {
+ name = null
+ }) {
+ super._addToggleButton(div, name === null);
+ }
+
+ _toggleAllTreeItems() {
+ if (!this._optionalContentConfig) {
+ return;
+ }
+ super._toggleAllTreeItems();
+ }
+
+ render({
+ optionalContentConfig,
+ pdfDocument
+ }) {
+ if (this._optionalContentConfig) {
+ this.reset();
+ }
+ this._optionalContentConfig = optionalContentConfig || null;
+ this._pdfDocument = pdfDocument || null;
+ const groups = optionalContentConfig?.getOrder();
+ if (!groups) {
+ this._dispatchEvent(0);
+ return;
+ }
+ this._optionalContentHash = optionalContentConfig.getHash();
+ const fragment = document.createDocumentFragment(),
+ queue = [{
+ parent: fragment,
+ groups
+ }];
+ let layersCount = 0,
+ hasAnyNesting = false;
+ while (queue.length > 0) {
+ const levelData = queue.shift();
+ for (const groupId of levelData.groups) {
+ const div = document.createElement("div");
+ div.className = "treeItem";
+ const element = document.createElement("a");
+ div.append(element);
+ if (typeof groupId === "object") {
+ hasAnyNesting = true;
+ this._addToggleButton(div, groupId);
+ this._setNestedName(element, groupId);
+ const itemsDiv = document.createElement("div");
+ itemsDiv.className = "treeItems";
+ div.append(itemsDiv);
+ queue.push({
+ parent: itemsDiv,
+ groups: groupId.order
+ });
+ } else {
+ const group = optionalContentConfig.getGroup(groupId);
+ const input = document.createElement("input");
+ this._bindLink(element, {
+ groupId,
+ input
+ });
+ input.type = "checkbox";
+ input.checked = group.visible;
+ const label = document.createElement("label");
+ label.textContent = this._normalizeTextContent(group.name);
+ label.append(input);
+ element.append(label);
+ layersCount++;
+ }
+ levelData.parent.append(div);
+ }
+ }
+ this._finishRendering(fragment, layersCount, hasAnyNesting);
+ }
+
+ async #updateLayers(promise = null) {
+ if (!this._optionalContentConfig) {
+ return;
+ }
+ const pdfDocument = this._pdfDocument;
+ const optionalContentConfig = await (promise || pdfDocument.getOptionalContentConfig());
+ if (pdfDocument !== this._pdfDocument) {
+ return;
+ }
+ if (promise) {
+ if (optionalContentConfig.getHash() === this._optionalContentHash) {
+ return;
+ }
+ } else {
+ this.eventBus.dispatch("optionalcontentconfig", {
+ source: this,
+ promise: Promise.resolve(optionalContentConfig)
+ });
+ }
+ this.render({
+ optionalContentConfig,
+ pdfDocument: this._pdfDocument
+ });
+ }
+ }
+
+ exports.PDFLayerViewer = PDFLayerViewer;
+
+ /***/
+ }),
+ /* 22 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFOutlineViewer = void 0;
+ var _base_tree_viewer = __webpack_require__(13);
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+
+ class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer {
+ constructor(options) {
+ super(options);
+ this.linkService = options.linkService;
+ this.downloadManager = options.downloadManager;
+ this.eventBus._on("toggleoutlinetree", this._toggleAllTreeItems.bind(this));
+ this.eventBus._on("currentoutlineitem", this._currentOutlineItem.bind(this));
+ this.eventBus._on("pagechanging", evt => {
+ this._currentPageNumber = evt.pageNumber;
+ });
+ this.eventBus._on("pagesloaded", evt => {
+ this._isPagesLoaded = !!evt.pagesCount;
+ if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) {
+ this._currentOutlineItemCapability.resolve(this._isPagesLoaded);
+ }
+ });
+ this.eventBus._on("sidebarviewchanged", evt => {
+ this._sidebarView = evt.view;
+ });
+ }
+
+ reset() {
+ super.reset();
+ this._outline = null;
+ this._pageNumberToDestHashCapability = null;
+ this._currentPageNumber = 1;
+ this._isPagesLoaded = null;
+ if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) {
+ this._currentOutlineItemCapability.resolve(false);
+ }
+ this._currentOutlineItemCapability = null;
+ }
+
+ _dispatchEvent(outlineCount) {
+ this._currentOutlineItemCapability = new _pdfjsLib.PromiseCapability();
+ if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) {
+ this._currentOutlineItemCapability.resolve(false);
+ } else if (this._isPagesLoaded !== null) {
+ this._currentOutlineItemCapability.resolve(this._isPagesLoaded);
+ }
+ this.eventBus.dispatch("outlineloaded", {
+ source: this,
+ outlineCount,
+ currentOutlineItemPromise: this._currentOutlineItemCapability.promise
+ });
+ }
+
+ _bindLink(element, {
+ url,
+ newWindow,
+ action,
+ attachment,
+ dest,
+ setOCGState
+ }) {
+ const {
+ linkService
+ } = this;
+ if (url) {
+ linkService.addLinkAttributes(element, url, newWindow);
+ return;
+ }
+ if (action) {
+ element.href = linkService.getAnchorUrl("");
+ element.onclick = () => {
+ linkService.executeNamedAction(action);
+ return false;
+ };
+ return;
+ }
+ if (attachment) {
+ element.href = linkService.getAnchorUrl("");
+ element.onclick = () => {
+ this.downloadManager.openOrDownloadData(element, attachment.content, attachment.filename);
+ return false;
+ };
+ return;
+ }
+ if (setOCGState) {
+ element.href = linkService.getAnchorUrl("");
+ element.onclick = () => {
+ linkService.executeSetOCGState(setOCGState);
+ return false;
+ };
+ return;
+ }
+ element.href = linkService.getDestinationHash(dest);
+ element.onclick = evt => {
+ this._updateCurrentTreeItem(evt.target.parentNode);
+ if (dest) {
+ linkService.goToDestination(dest);
+ }
+ return false;
+ };
+ }
+
+ _setStyles(element, {
+ bold,
+ italic
+ }) {
+ if (bold) {
+ element.style.fontWeight = "bold";
+ }
+ if (italic) {
+ element.style.fontStyle = "italic";
+ }
+ }
+
+ _addToggleButton(div, {
+ count,
+ items
+ }) {
+ let hidden = false;
+ if (count < 0) {
+ let totalCount = items.length;
+ if (totalCount > 0) {
+ const queue = [...items];
+ while (queue.length > 0) {
+ const {
+ count: nestedCount,
+ items: nestedItems
+ } = queue.shift();
+ if (nestedCount > 0 && nestedItems.length > 0) {
+ totalCount += nestedItems.length;
+ queue.push(...nestedItems);
+ }
+ }
+ }
+ if (Math.abs(count) === totalCount) {
+ hidden = true;
+ }
+ }
+ super._addToggleButton(div, hidden);
+ }
+
+ _toggleAllTreeItems() {
+ if (!this._outline) {
+ return;
+ }
+ super._toggleAllTreeItems();
+ }
+
+ render({
+ outline,
+ pdfDocument
+ }) {
+ if (this._outline) {
+ this.reset();
+ }
+ this._outline = outline || null;
+ this._pdfDocument = pdfDocument || null;
+ if (!outline) {
+ this._dispatchEvent(0);
+ return;
+ }
+ const fragment = document.createDocumentFragment();
+ const queue = [{
+ parent: fragment,
+ items: outline
+ }];
+ let outlineCount = 0,
+ hasAnyNesting = false;
+ while (queue.length > 0) {
+ const levelData = queue.shift();
+ for (const item of levelData.items) {
+ const div = document.createElement("div");
+ div.className = "treeItem";
+ const element = document.createElement("a");
+ this._bindLink(element, item);
+ this._setStyles(element, item);
+ element.textContent = this._normalizeTextContent(item.title);
+ div.append(element);
+ if (item.items.length > 0) {
+ hasAnyNesting = true;
+ this._addToggleButton(div, item);
+ const itemsDiv = document.createElement("div");
+ itemsDiv.className = "treeItems";
+ div.append(itemsDiv);
+ queue.push({
+ parent: itemsDiv,
+ items: item.items
+ });
+ }
+ levelData.parent.append(div);
+ outlineCount++;
+ }
+ }
+ this._finishRendering(fragment, outlineCount, hasAnyNesting);
+ }
+
+ async _currentOutlineItem() {
+ if (!this._isPagesLoaded) {
+ throw new Error("_currentOutlineItem: All pages have not been loaded.");
+ }
+ if (!this._outline || !this._pdfDocument) {
+ return;
+ }
+ const pageNumberToDestHash = await this._getPageNumberToDestHash(this._pdfDocument);
+ if (!pageNumberToDestHash) {
+ return;
+ }
+ this._updateCurrentTreeItem(null);
+ if (this._sidebarView !== _ui_utils.SidebarView.OUTLINE) {
+ return;
+ }
+ for (let i = this._currentPageNumber; i > 0; i--) {
+ const destHash = pageNumberToDestHash.get(i);
+ if (!destHash) {
+ continue;
+ }
+ const linkElement = this.container.querySelector(`a[href="${destHash}"]`);
+ if (!linkElement) {
+ continue;
+ }
+ this._scrollToCurrentTreeItem(linkElement.parentNode);
+ break;
+ }
+ }
+
+ async _getPageNumberToDestHash(pdfDocument) {
+ if (this._pageNumberToDestHashCapability) {
+ return this._pageNumberToDestHashCapability.promise;
+ }
+ this._pageNumberToDestHashCapability = new _pdfjsLib.PromiseCapability();
+ const pageNumberToDestHash = new Map(),
+ pageNumberNesting = new Map();
+ const queue = [{
+ nesting: 0,
+ items: this._outline
+ }];
+ while (queue.length > 0) {
+ const levelData = queue.shift(),
+ currentNesting = levelData.nesting;
+ for (const {
+ dest,
+ items
+ } of levelData.items) {
+ let explicitDest, pageNumber;
+ if (typeof dest === "string") {
+ explicitDest = await pdfDocument.getDestination(dest);
+ if (pdfDocument !== this._pdfDocument) {
+ return null;
+ }
+ } else {
+ explicitDest = dest;
+ }
+ if (Array.isArray(explicitDest)) {
+ const [destRef] = explicitDest;
+ if (typeof destRef === "object" && destRef !== null) {
+ pageNumber = this.linkService._cachedPageNumber(destRef);
+ if (!pageNumber) {
+ try {
+ pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1;
+ if (pdfDocument !== this._pdfDocument) {
+ return null;
+ }
+ this.linkService.cachePageRef(pageNumber, destRef);
+ } catch {
+ }
+ }
+ } else if (Number.isInteger(destRef)) {
+ pageNumber = destRef + 1;
+ }
+ if (Number.isInteger(pageNumber) && (!pageNumberToDestHash.has(pageNumber) || currentNesting > pageNumberNesting.get(pageNumber))) {
+ const destHash = this.linkService.getDestinationHash(dest);
+ pageNumberToDestHash.set(pageNumber, destHash);
+ pageNumberNesting.set(pageNumber, currentNesting);
+ }
+ }
+ if (items.length > 0) {
+ queue.push({
+ nesting: currentNesting + 1,
+ items
+ });
+ }
+ }
+ }
+ this._pageNumberToDestHashCapability.resolve(pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null);
+ return this._pageNumberToDestHashCapability.promise;
+ }
+ }
+
+ exports.PDFOutlineViewer = PDFOutlineViewer;
+
+ /***/
+ }),
+ /* 23 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFPresentationMode = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+ const DELAY_BEFORE_HIDING_CONTROLS = 3000;
+ const ACTIVE_SELECTOR = "pdfPresentationMode";
+ const CONTROLS_SELECTOR = "pdfPresentationModeControls";
+ const MOUSE_SCROLL_COOLDOWN_TIME = 50;
+ const PAGE_SWITCH_THRESHOLD = 0.1;
+ const SWIPE_MIN_DISTANCE_THRESHOLD = 50;
+ const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
+
+ class PDFPresentationMode {
+ #state = _ui_utils.PresentationModeState.UNKNOWN;
+ #args = null;
+
+ constructor({
+ container,
+ pdfViewer,
+ eventBus
+ }) {
+ this.container = container;
+ this.pdfViewer = pdfViewer;
+ this.eventBus = eventBus;
+ this.contextMenuOpen = false;
+ this.mouseScrollTimeStamp = 0;
+ this.mouseScrollDelta = 0;
+ this.touchSwipeState = null;
+ }
+
+ async request() {
+ const {
+ container,
+ pdfViewer
+ } = this;
+ if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {
+ return false;
+ }
+ this.#addFullscreenChangeListeners();
+ this.#notifyStateChange(_ui_utils.PresentationModeState.CHANGING);
+ const promise = container.requestFullscreen();
+ this.#args = {
+ pageNumber: pdfViewer.currentPageNumber,
+ scaleValue: pdfViewer.currentScaleValue,
+ scrollMode: pdfViewer.scrollMode,
+ spreadMode: null,
+ annotationEditorMode: null
+ };
+ if (pdfViewer.spreadMode !== _ui_utils.SpreadMode.NONE && !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)) {
+ console.warn("Ignoring Spread modes when entering PresentationMode, " + "since the document may contain varying page sizes.");
+ this.#args.spreadMode = pdfViewer.spreadMode;
+ }
+ if (pdfViewer.annotationEditorMode !== _pdfjsLib.AnnotationEditorType.DISABLE) {
+ this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;
+ }
+ try {
+ await promise;
+ pdfViewer.focus();
+ return true;
+ } catch {
+ this.#removeFullscreenChangeListeners();
+ this.#notifyStateChange(_ui_utils.PresentationModeState.NORMAL);
+ }
+ return false;
+ }
+
+ get active() {
+ return this.#state === _ui_utils.PresentationModeState.CHANGING || this.#state === _ui_utils.PresentationModeState.FULLSCREEN;
+ }
+
+ #mouseWheel(evt) {
+ if (!this.active) {
+ return;
+ }
+ evt.preventDefault();
+ const delta = (0, _ui_utils.normalizeWheelEventDelta)(evt);
+ const currentTime = Date.now();
+ const storedTime = this.mouseScrollTimeStamp;
+ if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
+ return;
+ }
+ if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) {
+ this.#resetMouseScrollState();
+ }
+ this.mouseScrollDelta += delta;
+ if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {
+ const totalDelta = this.mouseScrollDelta;
+ this.#resetMouseScrollState();
+ const success = totalDelta > 0 ? this.pdfViewer.previousPage() : this.pdfViewer.nextPage();
+ if (success) {
+ this.mouseScrollTimeStamp = currentTime;
+ }
+ }
+ }
+
+ #notifyStateChange(state) {
+ this.#state = state;
+ this.eventBus.dispatch("presentationmodechanged", {
+ source: this,
+ state
+ });
+ }
+
+ #enter() {
+ this.#notifyStateChange(_ui_utils.PresentationModeState.FULLSCREEN);
+ this.container.classList.add(ACTIVE_SELECTOR);
+ setTimeout(() => {
+ this.pdfViewer.scrollMode = _ui_utils.ScrollMode.PAGE;
+ if (this.#args.spreadMode !== null) {
+ this.pdfViewer.spreadMode = _ui_utils.SpreadMode.NONE;
+ }
+ this.pdfViewer.currentPageNumber = this.#args.pageNumber;
+ this.pdfViewer.currentScaleValue = "page-fit";
+ if (this.#args.annotationEditorMode !== null) {
+ this.pdfViewer.annotationEditorMode = {
+ mode: _pdfjsLib.AnnotationEditorType.NONE
+ };
+ }
+ }, 0);
+ this.#addWindowListeners();
+ this.#showControls();
+ this.contextMenuOpen = false;
+ window.getSelection().removeAllRanges();
+ }
+
+ #exit() {
+ const pageNumber = this.pdfViewer.currentPageNumber;
+ this.container.classList.remove(ACTIVE_SELECTOR);
+ setTimeout(() => {
+ this.#removeFullscreenChangeListeners();
+ this.#notifyStateChange(_ui_utils.PresentationModeState.NORMAL);
+ this.pdfViewer.scrollMode = this.#args.scrollMode;
+ if (this.#args.spreadMode !== null) {
+ this.pdfViewer.spreadMode = this.#args.spreadMode;
+ }
+ this.pdfViewer.currentScaleValue = this.#args.scaleValue;
+ this.pdfViewer.currentPageNumber = pageNumber;
+ if (this.#args.annotationEditorMode !== null) {
+ this.pdfViewer.annotationEditorMode = {
+ mode: this.#args.annotationEditorMode
+ };
+ }
+ this.#args = null;
+ }, 0);
+ this.#removeWindowListeners();
+ this.#hideControls();
+ this.#resetMouseScrollState();
+ this.contextMenuOpen = false;
+ }
+
+ #mouseDown(evt) {
+ if (this.contextMenuOpen) {
+ this.contextMenuOpen = false;
+ evt.preventDefault();
+ return;
+ }
+ if (evt.button !== 0) {
+ return;
+ }
+ if (evt.target.href && evt.target.parentNode?.hasAttribute("data-internal-link")) {
+ return;
+ }
+ evt.preventDefault();
+ if (evt.shiftKey) {
+ this.pdfViewer.previousPage();
+ } else {
+ this.pdfViewer.nextPage();
+ }
+ }
+
+ #contextMenu() {
+ this.contextMenuOpen = true;
+ }
+
+ #showControls() {
+ if (this.controlsTimeout) {
+ clearTimeout(this.controlsTimeout);
+ } else {
+ this.container.classList.add(CONTROLS_SELECTOR);
+ }
+ this.controlsTimeout = setTimeout(() => {
+ this.container.classList.remove(CONTROLS_SELECTOR);
+ delete this.controlsTimeout;
+ }, DELAY_BEFORE_HIDING_CONTROLS);
+ }
+
+ #hideControls() {
+ if (!this.controlsTimeout) {
+ return;
+ }
+ clearTimeout(this.controlsTimeout);
+ this.container.classList.remove(CONTROLS_SELECTOR);
+ delete this.controlsTimeout;
+ }
+
+ #resetMouseScrollState() {
+ this.mouseScrollTimeStamp = 0;
+ this.mouseScrollDelta = 0;
+ }
+
+ #touchSwipe(evt) {
+ if (!this.active) {
+ return;
+ }
+ if (evt.touches.length > 1) {
+ this.touchSwipeState = null;
+ return;
+ }
+ switch (evt.type) {
+ case "touchstart":
+ this.touchSwipeState = {
+ startX: evt.touches[0].pageX,
+ startY: evt.touches[0].pageY,
+ endX: evt.touches[0].pageX,
+ endY: evt.touches[0].pageY
+ };
+ break;
+ case "touchmove":
+ if (this.touchSwipeState === null) {
+ return;
+ }
+ this.touchSwipeState.endX = evt.touches[0].pageX;
+ this.touchSwipeState.endY = evt.touches[0].pageY;
+ evt.preventDefault();
+ break;
+ case "touchend":
+ if (this.touchSwipeState === null) {
+ return;
+ }
+ let delta = 0;
+ const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;
+ const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;
+ const absAngle = Math.abs(Math.atan2(dy, dx));
+ if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) {
+ delta = dx;
+ } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) {
+ delta = dy;
+ }
+ if (delta > 0) {
+ this.pdfViewer.previousPage();
+ } else if (delta < 0) {
+ this.pdfViewer.nextPage();
+ }
+ break;
+ }
+ }
+
+ #addWindowListeners() {
+ this.showControlsBind = this.#showControls.bind(this);
+ this.mouseDownBind = this.#mouseDown.bind(this);
+ this.mouseWheelBind = this.#mouseWheel.bind(this);
+ this.resetMouseScrollStateBind = this.#resetMouseScrollState.bind(this);
+ this.contextMenuBind = this.#contextMenu.bind(this);
+ this.touchSwipeBind = this.#touchSwipe.bind(this);
+ window.addEventListener("mousemove", this.showControlsBind);
+ window.addEventListener("mousedown", this.mouseDownBind);
+ window.addEventListener("wheel", this.mouseWheelBind, {
+ passive: false
+ });
+ window.addEventListener("keydown", this.resetMouseScrollStateBind);
+ window.addEventListener("contextmenu", this.contextMenuBind);
+ window.addEventListener("touchstart", this.touchSwipeBind);
+ window.addEventListener("touchmove", this.touchSwipeBind);
+ window.addEventListener("touchend", this.touchSwipeBind);
+ }
+
+ #removeWindowListeners() {
+ window.removeEventListener("mousemove", this.showControlsBind);
+ window.removeEventListener("mousedown", this.mouseDownBind);
+ window.removeEventListener("wheel", this.mouseWheelBind, {
+ passive: false
+ });
+ window.removeEventListener("keydown", this.resetMouseScrollStateBind);
+ window.removeEventListener("contextmenu", this.contextMenuBind);
+ window.removeEventListener("touchstart", this.touchSwipeBind);
+ window.removeEventListener("touchmove", this.touchSwipeBind);
+ window.removeEventListener("touchend", this.touchSwipeBind);
+ delete this.showControlsBind;
+ delete this.mouseDownBind;
+ delete this.mouseWheelBind;
+ delete this.resetMouseScrollStateBind;
+ delete this.contextMenuBind;
+ delete this.touchSwipeBind;
+ }
+
+ #fullscreenChange() {
+ if (document.fullscreenElement) {
+ this.#enter();
+ } else {
+ this.#exit();
+ }
+ }
+
+ #addFullscreenChangeListeners() {
+ this.fullscreenChangeBind = this.#fullscreenChange.bind(this);
+ window.addEventListener("fullscreenchange", this.fullscreenChangeBind);
+ }
+
+ #removeFullscreenChangeListeners() {
+ window.removeEventListener("fullscreenchange", this.fullscreenChangeBind);
+ delete this.fullscreenChangeBind;
+ }
+ }
+
+ exports.PDFPresentationMode = PDFPresentationMode;
+
+ /***/
+ }),
+ /* 24 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFRenderingQueue = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+ const CLEANUP_TIMEOUT = 30000;
+
+ class PDFRenderingQueue {
+ constructor() {
+ this.pdfViewer = null;
+ this.pdfThumbnailViewer = null;
+ this.onIdle = null;
+ this.highestPriorityPage = null;
+ this.idleTimeout = null;
+ this.printing = false;
+ this.isThumbnailViewEnabled = false;
+ Object.defineProperty(this, "hasViewer", {
+ value: () => !!this.pdfViewer
+ });
+ }
+
+ setViewer(pdfViewer) {
+ this.pdfViewer = pdfViewer;
+ }
+
+ setThumbnailViewer(pdfThumbnailViewer) {
+ this.pdfThumbnailViewer = pdfThumbnailViewer;
+ }
+
+ isHighestPriority(view) {
+ return this.highestPriorityPage === view.renderingId;
+ }
+
+ renderHighestPriority(currentlyVisiblePages) {
+ if (this.idleTimeout) {
+ clearTimeout(this.idleTimeout);
+ this.idleTimeout = null;
+ }
+ if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
+ return;
+ }
+ if (this.isThumbnailViewEnabled && this.pdfThumbnailViewer?.forceRendering()) {
+ return;
+ }
+ if (this.printing) {
+ return;
+ }
+ if (this.onIdle) {
+ this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
+ }
+ }
+
+ getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {
+ const visibleViews = visible.views,
+ numVisible = visibleViews.length;
+ if (numVisible === 0) {
+ return null;
+ }
+ for (let i = 0; i < numVisible; i++) {
+ const view = visibleViews[i].view;
+ if (!this.isViewFinished(view)) {
+ return view;
+ }
+ }
+ const firstId = visible.first.id,
+ lastId = visible.last.id;
+ if (lastId - firstId + 1 > numVisible) {
+ const visibleIds = visible.ids;
+ for (let i = 1, ii = lastId - firstId; i < ii; i++) {
+ const holeId = scrolledDown ? firstId + i : lastId - i;
+ if (visibleIds.has(holeId)) {
+ continue;
+ }
+ const holeView = views[holeId - 1];
+ if (!this.isViewFinished(holeView)) {
+ return holeView;
+ }
+ }
+ }
+ let preRenderIndex = scrolledDown ? lastId : firstId - 2;
+ let preRenderView = views[preRenderIndex];
+ if (preRenderView && !this.isViewFinished(preRenderView)) {
+ return preRenderView;
+ }
+ if (preRenderExtra) {
+ preRenderIndex += scrolledDown ? 1 : -1;
+ preRenderView = views[preRenderIndex];
+ if (preRenderView && !this.isViewFinished(preRenderView)) {
+ return preRenderView;
+ }
+ }
+ return null;
+ }
+
+ isViewFinished(view) {
+ return view.renderingState === _ui_utils.RenderingStates.FINISHED;
+ }
+
+ renderView(view) {
+ switch (view.renderingState) {
+ case _ui_utils.RenderingStates.FINISHED:
+ return false;
+ case _ui_utils.RenderingStates.PAUSED:
+ this.highestPriorityPage = view.renderingId;
+ view.resume();
+ break;
+ case _ui_utils.RenderingStates.RUNNING:
+ this.highestPriorityPage = view.renderingId;
+ break;
+ case _ui_utils.RenderingStates.INITIAL:
+ this.highestPriorityPage = view.renderingId;
+ view.draw().finally(() => {
+ this.renderHighestPriority();
+ }).catch(reason => {
+ if (reason instanceof _pdfjsLib.RenderingCancelledException) {
+ return;
+ }
+ console.error(`renderView: "${reason}"`);
+ });
+ break;
+ }
+ return true;
+ }
+ }
+
+ exports.PDFRenderingQueue = PDFRenderingQueue;
+
+ /***/
+ }),
+ /* 25 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFScriptingManager = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+
+ class PDFScriptingManager {
+ #closeCapability = null;
+ #destroyCapability = null;
+ #docProperties = null;
+ #eventBus = null;
+ #externalServices = null;
+ #pdfDocument = null;
+ #pdfViewer = null;
+ #ready = false;
+ #sandboxBundleSrc = null;
+ #scripting = null;
+ #willPrintCapability = null;
+
+ constructor({
+ eventBus,
+ sandboxBundleSrc = null,
+ externalServices = null,
+ docProperties = null
+ }) {
+ this.#eventBus = eventBus;
+ this.#sandboxBundleSrc = sandboxBundleSrc;
+ this.#externalServices = externalServices;
+ this.#docProperties = docProperties;
+ }
+
+ setViewer(pdfViewer) {
+ this.#pdfViewer = pdfViewer;
+ }
+
+ async setDocument(pdfDocument) {
+ if (this.#pdfDocument) {
+ await this.#destroyScripting();
+ }
+ this.#pdfDocument = pdfDocument;
+ if (!pdfDocument) {
+ return;
+ }
+ const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
+ if (!objects && !docActions) {
+ await this.#destroyScripting();
+ return;
+ }
+ if (pdfDocument !== this.#pdfDocument) {
+ return;
+ }
+ try {
+ this.#scripting = this.#initScripting();
+ } catch (error) {
+ console.error(`setDocument: "${error.message}".`);
+ await this.#destroyScripting();
+ return;
+ }
+ this._internalEvents.set("updatefromsandbox", event => {
+ if (event?.source === window) {
+ this.#updateFromSandbox(event.detail);
+ }
+ });
+ this._internalEvents.set("dispatcheventinsandbox", event => {
+ this.#scripting?.dispatchEventInSandbox(event.detail);
+ });
+ this._internalEvents.set("pagechanging", ({
+ pageNumber,
+ previous
+ }) => {
+ if (pageNumber === previous) {
+ return;
+ }
+ this.#dispatchPageClose(previous);
+ this.#dispatchPageOpen(pageNumber);
+ });
+ this._internalEvents.set("pagerendered", ({
+ pageNumber
+ }) => {
+ if (!this._pageOpenPending.has(pageNumber)) {
+ return;
+ }
+ if (pageNumber !== this.#pdfViewer.currentPageNumber) {
+ return;
+ }
+ this.#dispatchPageOpen(pageNumber);
+ });
+ this._internalEvents.set("pagesdestroy", async () => {
+ await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);
+ await this.#scripting?.dispatchEventInSandbox({
+ id: "doc",
+ name: "WillClose"
+ });
+ this.#closeCapability?.resolve();
+ });
+ for (const [name, listener] of this._internalEvents) {
+ this.#eventBus._on(name, listener);
+ }
+ try {
+ const docProperties = await this.#docProperties(pdfDocument);
+ if (pdfDocument !== this.#pdfDocument) {
+ return;
+ }
+ await this.#scripting.createSandbox({
+ objects,
+ calculationOrder,
+ appInfo: {
+ platform: navigator.platform,
+ language: navigator.language
+ },
+ docInfo: {
+ ...docProperties,
+ actions: docActions
+ }
+ });
+ this.#eventBus.dispatch("sandboxcreated", {
+ source: this
+ });
+ } catch (error) {
+ console.error(`setDocument: "${error.message}".`);
+ await this.#destroyScripting();
+ return;
+ }
+ await this.#scripting?.dispatchEventInSandbox({
+ id: "doc",
+ name: "Open"
+ });
+ await this.#dispatchPageOpen(this.#pdfViewer.currentPageNumber, true);
+ Promise.resolve().then(() => {
+ if (pdfDocument === this.#pdfDocument) {
+ this.#ready = true;
+ }
+ });
+ }
+
+ async dispatchWillSave() {
+ return this.#scripting?.dispatchEventInSandbox({
+ id: "doc",
+ name: "WillSave"
+ });
+ }
+
+ async dispatchDidSave() {
+ return this.#scripting?.dispatchEventInSandbox({
+ id: "doc",
+ name: "DidSave"
+ });
+ }
+
+ async dispatchWillPrint() {
+ if (!this.#scripting) {
+ return;
+ }
+ await this.#willPrintCapability?.promise;
+ this.#willPrintCapability = new _pdfjsLib.PromiseCapability();
+ try {
+ await this.#scripting.dispatchEventInSandbox({
+ id: "doc",
+ name: "WillPrint"
+ });
+ } catch (ex) {
+ this.#willPrintCapability.resolve();
+ this.#willPrintCapability = null;
+ throw ex;
+ }
+ await this.#willPrintCapability.promise;
+ }
+
+ async dispatchDidPrint() {
+ return this.#scripting?.dispatchEventInSandbox({
+ id: "doc",
+ name: "DidPrint"
+ });
+ }
+
+ get destroyPromise() {
+ return this.#destroyCapability?.promise || null;
+ }
+
+ get ready() {
+ return this.#ready;
+ }
+
+ get _internalEvents() {
+ return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map());
+ }
+
+ get _pageOpenPending() {
+ return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set());
+ }
+
+ get _visitedPages() {
+ return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
+ }
+
+ async #updateFromSandbox(detail) {
+ const pdfViewer = this.#pdfViewer;
+ const isInPresentationMode = pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;
+ const {
+ id,
+ siblings,
+ command,
+ value
+ } = detail;
+ if (!id) {
+ switch (command) {
+ case "clear":
+ console.clear();
+ break;
+ case "error":
+ console.error(value);
+ break;
+ case "layout":
+ if (!isInPresentationMode) {
+ const modes = (0, _ui_utils.apiPageLayoutToViewerModes)(value);
+ pdfViewer.spreadMode = modes.spreadMode;
+ }
+ break;
+ case "page-num":
+ pdfViewer.currentPageNumber = value + 1;
+ break;
+ case "print":
+ await pdfViewer.pagesPromise;
+ this.#eventBus.dispatch("print", {
+ source: this
+ });
+ break;
+ case "println":
+ console.log(value);
+ break;
+ case "zoom":
+ if (!isInPresentationMode) {
+ pdfViewer.currentScaleValue = value;
+ }
+ break;
+ case "SaveAs":
+ this.#eventBus.dispatch("download", {
+ source: this
+ });
+ break;
+ case "FirstPage":
+ pdfViewer.currentPageNumber = 1;
+ break;
+ case "LastPage":
+ pdfViewer.currentPageNumber = pdfViewer.pagesCount;
+ break;
+ case "NextPage":
+ pdfViewer.nextPage();
+ break;
+ case "PrevPage":
+ pdfViewer.previousPage();
+ break;
+ case "ZoomViewIn":
+ if (!isInPresentationMode) {
+ pdfViewer.increaseScale();
+ }
+ break;
+ case "ZoomViewOut":
+ if (!isInPresentationMode) {
+ pdfViewer.decreaseScale();
+ }
+ break;
+ case "WillPrintFinished":
+ this.#willPrintCapability?.resolve();
+ this.#willPrintCapability = null;
+ break;
+ }
+ return;
+ }
+ if (isInPresentationMode && detail.focus) {
+ return;
+ }
+ delete detail.id;
+ delete detail.siblings;
+ const ids = siblings ? [id, ...siblings] : [id];
+ for (const elementId of ids) {
+ const element = document.querySelector(`[data-element-id="${elementId}"]`);
+ if (element) {
+ element.dispatchEvent(new CustomEvent("updatefromsandbox", {
+ detail
+ }));
+ } else {
+ this.#pdfDocument?.annotationStorage.setValue(elementId, detail);
+ }
+ }
+ }
+
+ async #dispatchPageOpen(pageNumber, initialize = false) {
+ const pdfDocument = this.#pdfDocument,
+ visitedPages = this._visitedPages;
+ if (initialize) {
+ this.#closeCapability = new _pdfjsLib.PromiseCapability();
+ }
+ if (!this.#closeCapability) {
+ return;
+ }
+ const pageView = this.#pdfViewer.getPageView(pageNumber - 1);
+ if (pageView?.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ this._pageOpenPending.add(pageNumber);
+ return;
+ }
+ this._pageOpenPending.delete(pageNumber);
+ const actionsPromise = (async () => {
+ const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null);
+ if (pdfDocument !== this.#pdfDocument) {
+ return;
+ }
+ await this.#scripting?.dispatchEventInSandbox({
+ id: "page",
+ name: "PageOpen",
+ pageNumber,
+ actions
+ });
+ })();
+ visitedPages.set(pageNumber, actionsPromise);
+ }
+
+ async #dispatchPageClose(pageNumber) {
+ const pdfDocument = this.#pdfDocument,
+ visitedPages = this._visitedPages;
+ if (!this.#closeCapability) {
+ return;
+ }
+ if (this._pageOpenPending.has(pageNumber)) {
+ return;
+ }
+ const actionsPromise = visitedPages.get(pageNumber);
+ if (!actionsPromise) {
+ return;
+ }
+ visitedPages.set(pageNumber, null);
+ await actionsPromise;
+ if (pdfDocument !== this.#pdfDocument) {
+ return;
+ }
+ await this.#scripting?.dispatchEventInSandbox({
+ id: "page",
+ name: "PageClose",
+ pageNumber
+ });
+ }
+
+ #initScripting() {
+ this.#destroyCapability = new _pdfjsLib.PromiseCapability();
+ if (this.#scripting) {
+ throw new Error("#initScripting: Scripting already exists.");
+ }
+ return this.#externalServices.createScripting({
+ sandboxBundleSrc: this.#sandboxBundleSrc
+ });
+ }
+
+ async #destroyScripting() {
+ if (!this.#scripting) {
+ this.#pdfDocument = null;
+ this.#destroyCapability?.resolve();
+ return;
+ }
+ if (this.#closeCapability) {
+ await Promise.race([this.#closeCapability.promise, new Promise(resolve => {
+ setTimeout(resolve, 1000);
+ })]).catch(() => {
+ });
+ this.#closeCapability = null;
+ }
+ this.#pdfDocument = null;
+ try {
+ await this.#scripting.destroySandbox();
+ } catch {
+ }
+ this.#willPrintCapability?.reject(new Error("Scripting destroyed."));
+ this.#willPrintCapability = null;
+ for (const [name, listener] of this._internalEvents) {
+ this.#eventBus._off(name, listener);
+ }
+ this._internalEvents.clear();
+ this._pageOpenPending.clear();
+ this._visitedPages.clear();
+ this.#scripting = null;
+ this.#ready = false;
+ this.#destroyCapability?.resolve();
+ }
+ }
+
+ exports.PDFScriptingManager = PDFScriptingManager;
+
+ /***/
+ }),
+ /* 26 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFSidebar = void 0;
+ var _ui_utils = __webpack_require__(3);
+ const SIDEBAR_WIDTH_VAR = "--sidebar-width";
+ const SIDEBAR_MIN_WIDTH = 200;
+ const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
+ const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
+
+ class PDFSidebar {
+ #isRTL = false;
+ #mouseMoveBound = this.#mouseMove.bind(this);
+ #mouseUpBound = this.#mouseUp.bind(this);
+ #outerContainerWidth = null;
+ #width = null;
+
+ constructor({
+ elements,
+ eventBus,
+ l10n
+ }) {
+ this.isOpen = false;
+ this.active = _ui_utils.SidebarView.THUMBS;
+ this.isInitialViewSet = false;
+ this.isInitialEventDispatched = false;
+ this.onToggled = null;
+ this.onUpdateThumbnails = null;
+ this.outerContainer = elements.outerContainer;
+ this.sidebarContainer = elements.sidebarContainer;
+ this.toggleButton = elements.toggleButton;
+ this.resizer = elements.resizer;
+ this.thumbnailButton = elements.thumbnailButton;
+ this.outlineButton = elements.outlineButton;
+ this.attachmentsButton = elements.attachmentsButton;
+ this.layersButton = elements.layersButton;
+ this.thumbnailView = elements.thumbnailView;
+ this.outlineView = elements.outlineView;
+ this.attachmentsView = elements.attachmentsView;
+ this.layersView = elements.layersView;
+ this._outlineOptionsContainer = elements.outlineOptionsContainer;
+ this._currentOutlineItemButton = elements.currentOutlineItemButton;
+ this.eventBus = eventBus;
+ this.l10n = l10n;
+ l10n.getDirection().then(dir => {
+ this.#isRTL = dir === "rtl";
+ });
+ this.#addEventListeners();
+ }
+
+ reset() {
+ this.isInitialViewSet = false;
+ this.isInitialEventDispatched = false;
+ this.#hideUINotification(true);
+ this.switchView(_ui_utils.SidebarView.THUMBS);
+ this.outlineButton.disabled = false;
+ this.attachmentsButton.disabled = false;
+ this.layersButton.disabled = false;
+ this._currentOutlineItemButton.disabled = true;
+ }
+
+ get visibleView() {
+ return this.isOpen ? this.active : _ui_utils.SidebarView.NONE;
+ }
+
+ setInitialView(view = _ui_utils.SidebarView.NONE) {
+ if (this.isInitialViewSet) {
+ return;
+ }
+ this.isInitialViewSet = true;
+ if (view === _ui_utils.SidebarView.NONE || view === _ui_utils.SidebarView.UNKNOWN) {
+ this.#dispatchEvent();
+ return;
+ }
+ this.switchView(view, true);
+ if (!this.isInitialEventDispatched) {
+ this.#dispatchEvent();
+ }
+ }
+
+ switchView(view, forceOpen = false) {
+ const isViewChanged = view !== this.active;
+ let forceRendering = false;
+ switch (view) {
+ case _ui_utils.SidebarView.NONE:
+ if (this.isOpen) {
+ this.close();
+ }
+ return;
+ case _ui_utils.SidebarView.THUMBS:
+ if (this.isOpen && isViewChanged) {
+ forceRendering = true;
+ }
+ break;
+ case _ui_utils.SidebarView.OUTLINE:
+ if (this.outlineButton.disabled) {
+ return;
+ }
+ break;
+ case _ui_utils.SidebarView.ATTACHMENTS:
+ if (this.attachmentsButton.disabled) {
+ return;
+ }
+ break;
+ case _ui_utils.SidebarView.LAYERS:
+ if (this.layersButton.disabled) {
+ return;
+ }
+ break;
+ default:
+ console.error(`PDFSidebar.switchView: "${view}" is not a valid view.`);
+ return;
+ }
+ this.active = view;
+ (0, _ui_utils.toggleCheckedBtn)(this.thumbnailButton, view === _ui_utils.SidebarView.THUMBS, this.thumbnailView);
+ (0, _ui_utils.toggleCheckedBtn)(this.outlineButton, view === _ui_utils.SidebarView.OUTLINE, this.outlineView);
+ (0, _ui_utils.toggleCheckedBtn)(this.attachmentsButton, view === _ui_utils.SidebarView.ATTACHMENTS, this.attachmentsView);
+ (0, _ui_utils.toggleCheckedBtn)(this.layersButton, view === _ui_utils.SidebarView.LAYERS, this.layersView);
+ this._outlineOptionsContainer.classList.toggle("hidden", view !== _ui_utils.SidebarView.OUTLINE);
+ if (forceOpen && !this.isOpen) {
+ this.open();
+ return;
+ }
+ if (forceRendering) {
+ this.onUpdateThumbnails();
+ this.onToggled();
+ }
+ if (isViewChanged) {
+ this.#dispatchEvent();
+ }
+ }
+
+ open() {
+ if (this.isOpen) {
+ return;
+ }
+ this.isOpen = true;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, true);
+ this.outerContainer.classList.add("sidebarMoving", "sidebarOpen");
+ if (this.active === _ui_utils.SidebarView.THUMBS) {
+ this.onUpdateThumbnails();
+ }
+ this.onToggled();
+ this.#dispatchEvent();
+ this.#hideUINotification();
+ }
+
+ close() {
+ if (!this.isOpen) {
+ return;
+ }
+ this.isOpen = false;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, false);
+ this.outerContainer.classList.add("sidebarMoving");
+ this.outerContainer.classList.remove("sidebarOpen");
+ this.onToggled();
+ this.#dispatchEvent();
+ }
+
+ toggle() {
+ if (this.isOpen) {
+ this.close();
+ } else {
+ this.open();
+ }
+ }
+
+ #dispatchEvent() {
+ if (this.isInitialViewSet) {
+ this.isInitialEventDispatched ||= true;
+ }
+ this.eventBus.dispatch("sidebarviewchanged", {
+ source: this,
+ view: this.visibleView
+ });
+ }
+
+ #showUINotification() {
+ this.toggleButton.setAttribute("data-l10n-id", "toggle_sidebar_notification2");
+ this.l10n.translate(this.toggleButton);
+ if (!this.isOpen) {
+ this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
+ }
+ }
+
+ #hideUINotification(reset = false) {
+ if (this.isOpen || reset) {
+ this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);
+ }
+ if (reset) {
+ this.toggleButton.setAttribute("data-l10n-id", "toggle_sidebar");
+ this.l10n.translate(this.toggleButton);
+ }
+ }
+
+ #addEventListeners() {
+ this.sidebarContainer.addEventListener("transitionend", evt => {
+ if (evt.target === this.sidebarContainer) {
+ this.outerContainer.classList.remove("sidebarMoving");
+ }
+ });
+ this.toggleButton.addEventListener("click", () => {
+ this.toggle();
+ });
+ this.thumbnailButton.addEventListener("click", () => {
+ this.switchView(_ui_utils.SidebarView.THUMBS);
+ });
+ this.outlineButton.addEventListener("click", () => {
+ this.switchView(_ui_utils.SidebarView.OUTLINE);
+ });
+ this.outlineButton.addEventListener("dblclick", () => {
+ this.eventBus.dispatch("toggleoutlinetree", {
+ source: this
+ });
+ });
+ this.attachmentsButton.addEventListener("click", () => {
+ this.switchView(_ui_utils.SidebarView.ATTACHMENTS);
+ });
+ this.layersButton.addEventListener("click", () => {
+ this.switchView(_ui_utils.SidebarView.LAYERS);
+ });
+ this.layersButton.addEventListener("dblclick", () => {
+ this.eventBus.dispatch("resetlayers", {
+ source: this
+ });
+ });
+ this._currentOutlineItemButton.addEventListener("click", () => {
+ this.eventBus.dispatch("currentoutlineitem", {
+ source: this
+ });
+ });
+ const onTreeLoaded = (count, button, view) => {
+ button.disabled = !count;
+ if (count) {
+ this.#showUINotification();
+ } else if (this.active === view) {
+ this.switchView(_ui_utils.SidebarView.THUMBS);
+ }
+ };
+ this.eventBus._on("outlineloaded", evt => {
+ onTreeLoaded(evt.outlineCount, this.outlineButton, _ui_utils.SidebarView.OUTLINE);
+ evt.currentOutlineItemPromise.then(enabled => {
+ if (!this.isInitialViewSet) {
+ return;
+ }
+ this._currentOutlineItemButton.disabled = !enabled;
+ });
+ });
+ this.eventBus._on("attachmentsloaded", evt => {
+ onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, _ui_utils.SidebarView.ATTACHMENTS);
+ });
+ this.eventBus._on("layersloaded", evt => {
+ onTreeLoaded(evt.layersCount, this.layersButton, _ui_utils.SidebarView.LAYERS);
+ });
+ this.eventBus._on("presentationmodechanged", evt => {
+ if (evt.state === _ui_utils.PresentationModeState.NORMAL && this.visibleView === _ui_utils.SidebarView.THUMBS) {
+ this.onUpdateThumbnails();
+ }
+ });
+ this.resizer.addEventListener("mousedown", evt => {
+ if (evt.button !== 0) {
+ return;
+ }
+ this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
+ window.addEventListener("mousemove", this.#mouseMoveBound);
+ window.addEventListener("mouseup", this.#mouseUpBound);
+ });
+ this.eventBus._on("resize", evt => {
+ if (evt.source !== window) {
+ return;
+ }
+ this.#outerContainerWidth = null;
+ if (!this.#width) {
+ return;
+ }
+ if (!this.isOpen) {
+ this.#updateWidth(this.#width);
+ return;
+ }
+ this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
+ const updated = this.#updateWidth(this.#width);
+ Promise.resolve().then(() => {
+ this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
+ if (updated) {
+ this.eventBus.dispatch("resize", {
+ source: this
+ });
+ }
+ });
+ });
+ }
+
+ get outerContainerWidth() {
+ return this.#outerContainerWidth ||= this.outerContainer.clientWidth;
+ }
+
+ #updateWidth(width = 0) {
+ const maxWidth = Math.floor(this.outerContainerWidth / 2);
+ if (width > maxWidth) {
+ width = maxWidth;
+ }
+ if (width < SIDEBAR_MIN_WIDTH) {
+ width = SIDEBAR_MIN_WIDTH;
+ }
+ if (width === this.#width) {
+ return false;
+ }
+ this.#width = width;
+ _ui_utils.docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
+ return true;
+ }
+
+ #mouseMove(evt) {
+ let width = evt.clientX;
+ if (this.#isRTL) {
+ width = this.outerContainerWidth - width;
+ }
+ this.#updateWidth(width);
+ }
+
+ #mouseUp(evt) {
+ this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
+ this.eventBus.dispatch("resize", {
+ source: this
+ });
+ window.removeEventListener("mousemove", this.#mouseMoveBound);
+ window.removeEventListener("mouseup", this.#mouseUpBound);
+ }
+ }
+
+ exports.PDFSidebar = PDFSidebar;
+
+ /***/
+ }),
+ /* 27 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFThumbnailViewer = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdf_thumbnail_view = __webpack_require__(28);
+ const THUMBNAIL_SCROLL_MARGIN = -19;
+ const THUMBNAIL_SELECTED_CLASS = "selected";
+
+ class PDFThumbnailViewer {
+ constructor({
+ container,
+ eventBus,
+ linkService,
+ renderingQueue,
+ l10n,
+ pageColors
+ }) {
+ this.container = container;
+ this.eventBus = eventBus;
+ this.linkService = linkService;
+ this.renderingQueue = renderingQueue;
+ this.l10n = l10n;
+ this.pageColors = pageColors || null;
+ this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this));
+ this._resetView();
+ }
+
+ _scrollUpdated() {
+ this.renderingQueue.renderHighestPriority();
+ }
+
+ getThumbnail(index) {
+ return this._thumbnails[index];
+ }
+
+ _getVisibleThumbs() {
+ return (0, _ui_utils.getVisibleElements)({
+ scrollEl: this.container,
+ views: this._thumbnails
+ });
+ }
+
+ scrollThumbnailIntoView(pageNumber) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ const thumbnailView = this._thumbnails[pageNumber - 1];
+ if (!thumbnailView) {
+ console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');
+ return;
+ }
+ if (pageNumber !== this._currentPageNumber) {
+ const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];
+ prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);
+ thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
+ }
+ const {
+ first,
+ last,
+ views
+ } = this._getVisibleThumbs();
+ if (views.length > 0) {
+ let shouldScroll = false;
+ if (pageNumber <= first.id || pageNumber >= last.id) {
+ shouldScroll = true;
+ } else {
+ for (const {
+ id,
+ percent
+ } of views) {
+ if (id !== pageNumber) {
+ continue;
+ }
+ shouldScroll = percent < 100;
+ break;
+ }
+ }
+ if (shouldScroll) {
+ (0, _ui_utils.scrollIntoView)(thumbnailView.div, {
+ top: THUMBNAIL_SCROLL_MARGIN
+ });
+ }
+ }
+ this._currentPageNumber = pageNumber;
+ }
+
+ get pagesRotation() {
+ return this._pagesRotation;
+ }
+
+ set pagesRotation(rotation) {
+ if (!(0, _ui_utils.isValidRotation)(rotation)) {
+ throw new Error("Invalid thumbnails rotation angle.");
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ if (this._pagesRotation === rotation) {
+ return;
+ }
+ this._pagesRotation = rotation;
+ const updateArgs = {
+ rotation
+ };
+ for (const thumbnail of this._thumbnails) {
+ thumbnail.update(updateArgs);
+ }
+ }
+
+ cleanup() {
+ for (const thumbnail of this._thumbnails) {
+ if (thumbnail.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ thumbnail.reset();
+ }
+ }
+ _pdf_thumbnail_view.TempImageFactory.destroyCanvas();
+ }
+
+ _resetView() {
+ this._thumbnails = [];
+ this._currentPageNumber = 1;
+ this._pageLabels = null;
+ this._pagesRotation = 0;
+ this.container.textContent = "";
+ }
+
+ setDocument(pdfDocument) {
+ if (this.pdfDocument) {
+ this._cancelRendering();
+ this._resetView();
+ }
+ this.pdfDocument = pdfDocument;
+ if (!pdfDocument) {
+ return;
+ }
+ const firstPagePromise = pdfDocument.getPage(1);
+ const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
+ firstPagePromise.then(firstPdfPage => {
+ const pagesCount = pdfDocument.numPages;
+ const viewport = firstPdfPage.getViewport({
+ scale: 1
+ });
+ for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
+ const thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({
+ container: this.container,
+ eventBus: this.eventBus,
+ id: pageNum,
+ defaultViewport: viewport.clone(),
+ optionalContentConfigPromise,
+ linkService: this.linkService,
+ renderingQueue: this.renderingQueue,
+ l10n: this.l10n,
+ pageColors: this.pageColors
+ });
+ this._thumbnails.push(thumbnail);
+ }
+ this._thumbnails[0]?.setPdfPage(firstPdfPage);
+ const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
+ thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
+ }).catch(reason => {
+ console.error("Unable to initialize thumbnail viewer", reason);
+ });
+ }
+
+ _cancelRendering() {
+ for (const thumbnail of this._thumbnails) {
+ thumbnail.cancelRendering();
+ }
+ }
+
+ setPageLabels(labels) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ if (!labels) {
+ this._pageLabels = null;
+ } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
+ this._pageLabels = null;
+ console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.");
+ } else {
+ this._pageLabels = labels;
+ }
+ for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
+ this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);
+ }
+ }
+
+ async #ensurePdfPageLoaded(thumbView) {
+ if (thumbView.pdfPage) {
+ return thumbView.pdfPage;
+ }
+ try {
+ const pdfPage = await this.pdfDocument.getPage(thumbView.id);
+ if (!thumbView.pdfPage) {
+ thumbView.setPdfPage(pdfPage);
+ }
+ return pdfPage;
+ } catch (reason) {
+ console.error("Unable to get page for thumb view", reason);
+ return null;
+ }
+ }
+
+ #getScrollAhead(visible) {
+ if (visible.first?.id === 1) {
+ return true;
+ } else if (visible.last?.id === this._thumbnails.length) {
+ return false;
+ }
+ return this.scroll.down;
+ }
+
+ forceRendering() {
+ const visibleThumbs = this._getVisibleThumbs();
+ const scrollAhead = this.#getScrollAhead(visibleThumbs);
+ const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, scrollAhead);
+ if (thumbView) {
+ this.#ensurePdfPageLoaded(thumbView).then(() => {
+ this.renderingQueue.renderView(thumbView);
+ });
+ return true;
+ }
+ return false;
+ }
+ }
+
+ exports.PDFThumbnailViewer = PDFThumbnailViewer;
+
+ /***/
+ }),
+ /* 28 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.TempImageFactory = exports.PDFThumbnailView = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+ const DRAW_UPSCALE_FACTOR = 2;
+ const MAX_NUM_SCALING_STEPS = 3;
+ const THUMBNAIL_WIDTH = 98;
+
+ class TempImageFactory {
+ static #tempCanvas = null;
+
+ static getCanvas(width, height) {
+ const tempCanvas = this.#tempCanvas ||= document.createElement("canvas");
+ tempCanvas.width = width;
+ tempCanvas.height = height;
+ const ctx = tempCanvas.getContext("2d", {
+ alpha: false
+ });
+ ctx.save();
+ ctx.fillStyle = "rgb(255, 255, 255)";
+ ctx.fillRect(0, 0, width, height);
+ ctx.restore();
+ return [tempCanvas, tempCanvas.getContext("2d")];
+ }
+
+ static destroyCanvas() {
+ const tempCanvas = this.#tempCanvas;
+ if (tempCanvas) {
+ tempCanvas.width = 0;
+ tempCanvas.height = 0;
+ }
+ this.#tempCanvas = null;
+ }
+ }
+
+ exports.TempImageFactory = TempImageFactory;
+
+ class PDFThumbnailView {
+ constructor({
+ container,
+ eventBus,
+ id,
+ defaultViewport,
+ optionalContentConfigPromise,
+ linkService,
+ renderingQueue,
+ l10n,
+ pageColors
+ }) {
+ this.id = id;
+ this.renderingId = "thumbnail" + id;
+ this.pageLabel = null;
+ this.pdfPage = null;
+ this.rotation = 0;
+ this.viewport = defaultViewport;
+ this.pdfPageRotate = defaultViewport.rotation;
+ this._optionalContentConfigPromise = optionalContentConfigPromise || null;
+ this.pageColors = pageColors || null;
+ this.eventBus = eventBus;
+ this.linkService = linkService;
+ this.renderingQueue = renderingQueue;
+ this.renderTask = null;
+ this.renderingState = _ui_utils.RenderingStates.INITIAL;
+ this.resume = null;
+ this.l10n = l10n;
+ const anchor = document.createElement("a");
+ anchor.href = linkService.getAnchorUrl("#page=" + id);
+ this._thumbPageTitle.then(msg => {
+ anchor.title = msg;
+ });
+ anchor.onclick = function () {
+ linkService.goToPage(id);
+ return false;
+ };
+ this.anchor = anchor;
+ const div = document.createElement("div");
+ div.className = "thumbnail";
+ div.setAttribute("data-page-number", this.id);
+ this.div = div;
+ this.#updateDims();
+ const img = document.createElement("div");
+ img.className = "thumbnailImage";
+ this._placeholderImg = img;
+ div.append(img);
+ anchor.append(div);
+ container.append(anchor);
+ }
+
+ #updateDims() {
+ const {
+ width,
+ height
+ } = this.viewport;
+ const ratio = width / height;
+ this.canvasWidth = THUMBNAIL_WIDTH;
+ this.canvasHeight = this.canvasWidth / ratio | 0;
+ this.scale = this.canvasWidth / width;
+ const {
+ style
+ } = this.div;
+ style.setProperty("--thumbnail-width", `${this.canvasWidth}px`);
+ style.setProperty("--thumbnail-height", `${this.canvasHeight}px`);
+ }
+
+ setPdfPage(pdfPage) {
+ this.pdfPage = pdfPage;
+ this.pdfPageRotate = pdfPage.rotate;
+ const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
+ this.viewport = pdfPage.getViewport({
+ scale: 1,
+ rotation: totalRotation
+ });
+ this.reset();
+ }
+
+ reset() {
+ this.cancelRendering();
+ this.renderingState = _ui_utils.RenderingStates.INITIAL;
+ this.div.removeAttribute("data-loaded");
+ this.image?.replaceWith(this._placeholderImg);
+ this.#updateDims();
+ if (this.image) {
+ this.image.removeAttribute("src");
+ delete this.image;
+ }
+ }
+
+ update({
+ rotation = null
+ }) {
+ if (typeof rotation === "number") {
+ this.rotation = rotation;
+ }
+ const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
+ this.viewport = this.viewport.clone({
+ scale: 1,
+ rotation: totalRotation
+ });
+ this.reset();
+ }
+
+ cancelRendering() {
+ if (this.renderTask) {
+ this.renderTask.cancel();
+ this.renderTask = null;
+ }
+ this.resume = null;
+ }
+
+ _getPageDrawContext(upscaleFactor = 1) {
+ const canvas = document.createElement("canvas");
+ const ctx = canvas.getContext("2d", {
+ alpha: false
+ });
+ const outputScale = new _ui_utils.OutputScale();
+ canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0;
+ canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0;
+ const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
+ return {
+ ctx,
+ canvas,
+ transform
+ };
+ }
+
+ _convertCanvasToImage(canvas) {
+ if (this.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ throw new Error("_convertCanvasToImage: Rendering has not finished.");
+ }
+ const reducedCanvas = this._reduceImage(canvas);
+ const image = document.createElement("img");
+ image.className = "thumbnailImage";
+ this._thumbPageCanvas.then(msg => {
+ image.setAttribute("aria-label", msg);
+ });
+ image.src = reducedCanvas.toDataURL();
+ this.image = image;
+ this.div.setAttribute("data-loaded", true);
+ this._placeholderImg.replaceWith(image);
+ reducedCanvas.width = 0;
+ reducedCanvas.height = 0;
+ }
+
+ async #finishRenderTask(renderTask, canvas, error = null) {
+ if (renderTask === this.renderTask) {
+ this.renderTask = null;
+ }
+ if (error instanceof _pdfjsLib.RenderingCancelledException) {
+ return;
+ }
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ this._convertCanvasToImage(canvas);
+ if (error) {
+ throw error;
+ }
+ }
+
+ async draw() {
+ if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
+ console.error("Must be in new state before drawing");
+ return undefined;
+ }
+ const {
+ pdfPage
+ } = this;
+ if (!pdfPage) {
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ throw new Error("pdfPage is not loaded");
+ }
+ this.renderingState = _ui_utils.RenderingStates.RUNNING;
+ const {
+ ctx,
+ canvas,
+ transform
+ } = this._getPageDrawContext(DRAW_UPSCALE_FACTOR);
+ const drawViewport = this.viewport.clone({
+ scale: DRAW_UPSCALE_FACTOR * this.scale
+ });
+ const renderContinueCallback = cont => {
+ if (!this.renderingQueue.isHighestPriority(this)) {
+ this.renderingState = _ui_utils.RenderingStates.PAUSED;
+ this.resume = () => {
+ this.renderingState = _ui_utils.RenderingStates.RUNNING;
+ cont();
+ };
+ return;
+ }
+ cont();
+ };
+ const renderContext = {
+ canvasContext: ctx,
+ transform,
+ viewport: drawViewport,
+ optionalContentConfigPromise: this._optionalContentConfigPromise,
+ pageColors: this.pageColors
+ };
+ const renderTask = this.renderTask = pdfPage.render(renderContext);
+ renderTask.onContinue = renderContinueCallback;
+ const resultPromise = renderTask.promise.then(() => this.#finishRenderTask(renderTask, canvas), error => this.#finishRenderTask(renderTask, canvas, error));
+ resultPromise.finally(() => {
+ canvas.width = 0;
+ canvas.height = 0;
+ this.eventBus.dispatch("thumbnailrendered", {
+ source: this,
+ pageNumber: this.id,
+ pdfPage: this.pdfPage
+ });
+ });
+ return resultPromise;
+ }
+
+ setImage(pageView) {
+ if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
+ return;
+ }
+ const {
+ thumbnailCanvas: canvas,
+ pdfPage,
+ scale
+ } = pageView;
+ if (!canvas) {
+ return;
+ }
+ if (!this.pdfPage) {
+ this.setPdfPage(pdfPage);
+ }
+ if (scale < this.scale) {
+ return;
+ }
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ this._convertCanvasToImage(canvas);
+ }
+
+ _reduceImage(img) {
+ const {
+ ctx,
+ canvas
+ } = this._getPageDrawContext();
+ if (img.width <= 2 * canvas.width) {
+ ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
+ return canvas;
+ }
+ let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
+ let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
+ const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
+ while (reducedWidth > img.width || reducedHeight > img.height) {
+ reducedWidth >>= 1;
+ reducedHeight >>= 1;
+ }
+ reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight);
+ while (reducedWidth > 2 * canvas.width) {
+ reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1);
+ reducedWidth >>= 1;
+ reducedHeight >>= 1;
+ }
+ ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);
+ return canvas;
+ }
+
+ get _thumbPageTitle() {
+ return this.l10n.get("thumb_page_title", {
+ page: this.pageLabel ?? this.id
+ });
+ }
+
+ get _thumbPageCanvas() {
+ return this.l10n.get("thumb_page_canvas", {
+ page: this.pageLabel ?? this.id
+ });
+ }
+
+ setPageLabel(label) {
+ this.pageLabel = typeof label === "string" ? label : null;
+ this._thumbPageTitle.then(msg => {
+ this.anchor.title = msg;
+ });
+ if (this.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ return;
+ }
+ this._thumbPageCanvas.then(msg => {
+ this.image?.setAttribute("aria-label", msg);
+ });
+ }
+ }
+
+ exports.PDFThumbnailView = PDFThumbnailView;
+
+ /***/
+ }),
+ /* 29 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PagesCountLimit = exports.PDFViewer = exports.PDFPageViewBuffer = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+ var _l10n_utils = __webpack_require__(30);
+ var _pdf_page_view = __webpack_require__(31);
+ var _pdf_rendering_queue = __webpack_require__(24);
+ var _pdf_link_service = __webpack_require__(7);
+ const DEFAULT_CACHE_SIZE = 10;
+ const PagesCountLimit = {
+ FORCE_SCROLL_MODE_PAGE: 15000,
+ FORCE_LAZY_PAGE_INIT: 7500,
+ PAUSE_EAGER_PAGE_INIT: 250
+ };
+ exports.PagesCountLimit = PagesCountLimit;
+
+ function isValidAnnotationEditorMode(mode) {
+ return Object.values(_pdfjsLib.AnnotationEditorType).includes(mode) && mode !== _pdfjsLib.AnnotationEditorType.DISABLE;
+ }
+
+ class PDFPageViewBuffer {
+ #buf = new Set();
+ #size = 0;
+
+ constructor(size) {
+ this.#size = size;
+ }
+
+ push(view) {
+ const buf = this.#buf;
+ if (buf.has(view)) {
+ buf.delete(view);
+ }
+ buf.add(view);
+ if (buf.size > this.#size) {
+ this.#destroyFirstView();
+ }
+ }
+
+ resize(newSize, idsToKeep = null) {
+ this.#size = newSize;
+ const buf = this.#buf;
+ if (idsToKeep) {
+ const ii = buf.size;
+ let i = 1;
+ for (const view of buf) {
+ if (idsToKeep.has(view.id)) {
+ buf.delete(view);
+ buf.add(view);
+ }
+ if (++i > ii) {
+ break;
+ }
+ }
+ }
+ while (buf.size > this.#size) {
+ this.#destroyFirstView();
+ }
+ }
+
+ has(view) {
+ return this.#buf.has(view);
+ }
+
+ [Symbol.iterator]() {
+ return this.#buf.keys();
+ }
+
+ #destroyFirstView() {
+ const firstView = this.#buf.keys().next().value;
+ firstView?.destroy();
+ this.#buf.delete(firstView);
+ }
+ }
+
+ exports.PDFPageViewBuffer = PDFPageViewBuffer;
+
+ class PDFViewer {
+ #buffer = null;
+ #altTextManager = null;
+ #annotationEditorMode = _pdfjsLib.AnnotationEditorType.NONE;
+ #annotationEditorUIManager = null;
+ #annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+ #containerTopLeft = null;
+ #copyCallbackBound = null;
+ #enablePermissions = false;
+ #getAllTextInProgress = false;
+ #hiddenCopyElement = null;
+ #interruptCopyCondition = false;
+ #previousContainerHeight = 0;
+ #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));
+ #scrollModePageState = null;
+ #onVisibilityChange = null;
+ #scaleTimeoutId = null;
+ #textLayerMode = _ui_utils.TextLayerMode.ENABLE;
+
+ constructor(options) {
+ const viewerVersion = '3.11.174';
+ if (_pdfjsLib.version !== viewerVersion) {
+ throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
+ }
+ this.container = options.container;
+ this.viewer = options.viewer || options.container.firstElementChild;
+ if (this.container?.tagName !== "DIV" || this.viewer?.tagName !== "DIV") {
+ throw new Error("Invalid `container` and/or `viewer` option.");
+ }
+ if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
+ throw new Error("The `container` must be absolutely positioned.");
+ }
+ this.#resizeObserver.observe(this.container);
+ this.eventBus = options.eventBus;
+ this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
+ this.downloadManager = options.downloadManager || null;
+ this.findController = options.findController || null;
+ this.#altTextManager = options.altTextManager || null;
+ if (this.findController) {
+ this.findController.onIsPageVisible = pageNumber => this._getVisiblePages().ids.has(pageNumber);
+ }
+ this._scriptingManager = options.scriptingManager || null;
+ this.#textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
+ this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+ this.#annotationEditorMode = options.annotationEditorMode ?? _pdfjsLib.AnnotationEditorType.NONE;
+ this.imageResourcesPath = options.imageResourcesPath || "";
+ this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
+ this.removePageBorders = options.removePageBorders || false;
+ if (options.useOnlyCssZoom) {
+ console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead.");
+ options.maxCanvasPixels = 0;
+ }
+ this.isOffscreenCanvasSupported = options.isOffscreenCanvasSupported ?? true;
+ this.maxCanvasPixels = options.maxCanvasPixels;
+ this.l10n = options.l10n || _l10n_utils.NullL10n;
+ this.#enablePermissions = options.enablePermissions || false;
+ this.pageColors = options.pageColors || null;
+ this.defaultRenderingQueue = !options.renderingQueue;
+ if (this.defaultRenderingQueue) {
+ this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
+ this.renderingQueue.setViewer(this);
+ } else {
+ this.renderingQueue = options.renderingQueue;
+ }
+ this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
+ this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
+ this._onBeforeDraw = this._onAfterDraw = null;
+ this._resetView();
+ if (this.removePageBorders) {
+ this.viewer.classList.add("removePageBorders");
+ }
+ this.#updateContainerHeightCss();
+ this.eventBus._on("thumbnailrendered", ({
+ pageNumber,
+ pdfPage
+ }) => {
+ const pageView = this._pages[pageNumber - 1];
+ if (!this.#buffer.has(pageView)) {
+ pdfPage?.cleanup();
+ }
+ });
+ }
+
+ get pagesCount() {
+ return this._pages.length;
+ }
+
+ getPageView(index) {
+ return this._pages[index];
+ }
+
+ getCachedPageViews() {
+ return new Set(this.#buffer);
+ }
+
+ get pageViewsReady() {
+ return this._pagesCapability.settled && this._pages.every(pageView => pageView?.pdfPage);
+ }
+
+ get renderForms() {
+ return this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+ }
+
+ get enableScripting() {
+ return !!this._scriptingManager;
+ }
+
+ get currentPageNumber() {
+ return this._currentPageNumber;
+ }
+
+ set currentPageNumber(val) {
+ if (!Number.isInteger(val)) {
+ throw new Error("Invalid page number.");
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ if (!this._setCurrentPageNumber(val, true)) {
+ console.error(`currentPageNumber: "${val}" is not a valid page.`);
+ }
+ }
+
+ _setCurrentPageNumber(val, resetCurrentPageView = false) {
+ if (this._currentPageNumber === val) {
+ if (resetCurrentPageView) {
+ this.#resetCurrentPageView();
+ }
+ return true;
+ }
+ if (!(0 < val && val <= this.pagesCount)) {
+ return false;
+ }
+ const previous = this._currentPageNumber;
+ this._currentPageNumber = val;
+ this.eventBus.dispatch("pagechanging", {
+ source: this,
+ pageNumber: val,
+ pageLabel: this._pageLabels?.[val - 1] ?? null,
+ previous
+ });
+ if (resetCurrentPageView) {
+ this.#resetCurrentPageView();
+ }
+ return true;
+ }
+
+ get currentPageLabel() {
+ return this._pageLabels?.[this._currentPageNumber - 1] ?? null;
+ }
+
+ set currentPageLabel(val) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ let page = val | 0;
+ if (this._pageLabels) {
+ const i = this._pageLabels.indexOf(val);
+ if (i >= 0) {
+ page = i + 1;
+ }
+ }
+ if (!this._setCurrentPageNumber(page, true)) {
+ console.error(`currentPageLabel: "${val}" is not a valid page.`);
+ }
+ }
+
+ get currentScale() {
+ return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE;
+ }
+
+ set currentScale(val) {
+ if (isNaN(val)) {
+ throw new Error("Invalid numeric scale.");
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ this.#setScale(val, {
+ noScroll: false
+ });
+ }
+
+ get currentScaleValue() {
+ return this._currentScaleValue;
+ }
+
+ set currentScaleValue(val) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ this.#setScale(val, {
+ noScroll: false
+ });
+ }
+
+ get pagesRotation() {
+ return this._pagesRotation;
+ }
+
+ set pagesRotation(rotation) {
+ if (!(0, _ui_utils.isValidRotation)(rotation)) {
+ throw new Error("Invalid pages rotation angle.");
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ rotation %= 360;
+ if (rotation < 0) {
+ rotation += 360;
+ }
+ if (this._pagesRotation === rotation) {
+ return;
+ }
+ this._pagesRotation = rotation;
+ const pageNumber = this._currentPageNumber;
+ this.refresh(true, {
+ rotation
+ });
+ if (this._currentScaleValue) {
+ this.#setScale(this._currentScaleValue, {
+ noScroll: true
+ });
+ }
+ this.eventBus.dispatch("rotationchanging", {
+ source: this,
+ pagesRotation: rotation,
+ pageNumber
+ });
+ if (this.defaultRenderingQueue) {
+ this.update();
+ }
+ }
+
+ get firstPagePromise() {
+ return this.pdfDocument ? this._firstPageCapability.promise : null;
+ }
+
+ get onePageRendered() {
+ return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
+ }
+
+ get pagesPromise() {
+ return this.pdfDocument ? this._pagesCapability.promise : null;
+ }
+
+ #layerProperties() {
+ const self = this;
+ return {
+ get annotationEditorUIManager() {
+ return self.#annotationEditorUIManager;
+ },
+ get annotationStorage() {
+ return self.pdfDocument?.annotationStorage;
+ },
+ get downloadManager() {
+ return self.downloadManager;
+ },
+ get enableScripting() {
+ return !!self._scriptingManager;
+ },
+ get fieldObjectsPromise() {
+ return self.pdfDocument?.getFieldObjects();
+ },
+ get findController() {
+ return self.findController;
+ },
+ get hasJSActionsPromise() {
+ return self.pdfDocument?.hasJSActions();
+ },
+ get linkService() {
+ return self.linkService;
+ }
+ };
+ }
+
+ #initializePermissions(permissions) {
+ const params = {
+ annotationEditorMode: this.#annotationEditorMode,
+ annotationMode: this.#annotationMode,
+ textLayerMode: this.#textLayerMode
+ };
+ if (!permissions) {
+ return params;
+ }
+ if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY) && this.#textLayerMode === _ui_utils.TextLayerMode.ENABLE) {
+ params.textLayerMode = _ui_utils.TextLayerMode.ENABLE_PERMISSIONS;
+ }
+ if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_CONTENTS)) {
+ params.annotationEditorMode = _pdfjsLib.AnnotationEditorType.DISABLE;
+ }
+ if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(_pdfjsLib.PermissionFlag.FILL_INTERACTIVE_FORMS) && this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS) {
+ params.annotationMode = _pdfjsLib.AnnotationMode.ENABLE;
+ }
+ return params;
+ }
+
+ #onePageRenderedOrForceFetch() {
+ if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) {
+ return Promise.resolve();
+ }
+ const visibilityChangePromise = new Promise(resolve => {
+ this.#onVisibilityChange = () => {
+ if (document.visibilityState !== "hidden") {
+ return;
+ }
+ resolve();
+ document.removeEventListener("visibilitychange", this.#onVisibilityChange);
+ this.#onVisibilityChange = null;
+ };
+ document.addEventListener("visibilitychange", this.#onVisibilityChange);
+ });
+ return Promise.race([this._onePageRenderedCapability.promise, visibilityChangePromise]);
+ }
+
+ async getAllText() {
+ const texts = [];
+ const buffer = [];
+ for (let pageNum = 1, pagesCount = this.pdfDocument.numPages; pageNum <= pagesCount; ++pageNum) {
+ if (this.#interruptCopyCondition) {
+ return null;
+ }
+ buffer.length = 0;
+ const page = await this.pdfDocument.getPage(pageNum);
+ const {
+ items
+ } = await page.getTextContent();
+ for (const item of items) {
+ if (item.str) {
+ buffer.push(item.str);
+ }
+ if (item.hasEOL) {
+ buffer.push("\n");
+ }
+ }
+ texts.push((0, _ui_utils.removeNullCharacters)(buffer.join("")));
+ }
+ return texts.join("\n");
+ }
+
+ #copyCallback(textLayerMode, event) {
+ const selection = document.getSelection();
+ const {
+ focusNode,
+ anchorNode
+ } = selection;
+ if (anchorNode && focusNode && selection.containsNode(this.#hiddenCopyElement)) {
+ if (this.#getAllTextInProgress || textLayerMode === _ui_utils.TextLayerMode.ENABLE_PERMISSIONS) {
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ this.#getAllTextInProgress = true;
+ const savedCursor = this.container.style.cursor;
+ this.container.style.cursor = "wait";
+ const interruptCopy = ev => this.#interruptCopyCondition = ev.key === "Escape";
+ window.addEventListener("keydown", interruptCopy);
+ this.getAllText().then(async text => {
+ if (text !== null) {
+ await navigator.clipboard.writeText(text);
+ }
+ }).catch(reason => {
+ console.warn(`Something goes wrong when extracting the text: ${reason.message}`);
+ }).finally(() => {
+ this.#getAllTextInProgress = false;
+ this.#interruptCopyCondition = false;
+ window.removeEventListener("keydown", interruptCopy);
+ this.container.style.cursor = savedCursor;
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ setDocument(pdfDocument) {
+ if (this.pdfDocument) {
+ this.eventBus.dispatch("pagesdestroy", {
+ source: this
+ });
+ this._cancelRendering();
+ this._resetView();
+ this.findController?.setDocument(null);
+ this._scriptingManager?.setDocument(null);
+ if (this.#annotationEditorUIManager) {
+ this.#annotationEditorUIManager.destroy();
+ this.#annotationEditorUIManager = null;
+ }
+ }
+ this.pdfDocument = pdfDocument;
+ if (!pdfDocument) {
+ return;
+ }
+ const pagesCount = pdfDocument.numPages;
+ const firstPagePromise = pdfDocument.getPage(1);
+ const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
+ const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve();
+ if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
+ console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
+ const mode = this._scrollMode = _ui_utils.ScrollMode.PAGE;
+ this.eventBus.dispatch("scrollmodechanged", {
+ source: this,
+ mode
+ });
+ }
+ this._pagesCapability.promise.then(() => {
+ this.eventBus.dispatch("pagesloaded", {
+ source: this,
+ pagesCount
+ });
+ }, () => {
+ });
+ this._onBeforeDraw = evt => {
+ const pageView = this._pages[evt.pageNumber - 1];
+ if (!pageView) {
+ return;
+ }
+ this.#buffer.push(pageView);
+ };
+ this.eventBus._on("pagerender", this._onBeforeDraw);
+ this._onAfterDraw = evt => {
+ if (evt.cssTransform || this._onePageRenderedCapability.settled) {
+ return;
+ }
+ this._onePageRenderedCapability.resolve({
+ timestamp: evt.timestamp
+ });
+ this.eventBus._off("pagerendered", this._onAfterDraw);
+ this._onAfterDraw = null;
+ if (this.#onVisibilityChange) {
+ document.removeEventListener("visibilitychange", this.#onVisibilityChange);
+ this.#onVisibilityChange = null;
+ }
+ };
+ this.eventBus._on("pagerendered", this._onAfterDraw);
+ Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ this._firstPageCapability.resolve(firstPdfPage);
+ this._optionalContentConfigPromise = optionalContentConfigPromise;
+ const {
+ annotationEditorMode,
+ annotationMode,
+ textLayerMode
+ } = this.#initializePermissions(permissions);
+ if (textLayerMode !== _ui_utils.TextLayerMode.DISABLE) {
+ const element = this.#hiddenCopyElement = document.createElement("div");
+ element.id = "hiddenCopyElement";
+ this.viewer.before(element);
+ }
+ if (annotationEditorMode !== _pdfjsLib.AnnotationEditorType.DISABLE) {
+ const mode = annotationEditorMode;
+ if (pdfDocument.isPureXfa) {
+ console.warn("Warning: XFA-editing is not implemented.");
+ } else if (isValidAnnotationEditorMode(mode)) {
+ this.#annotationEditorUIManager = new _pdfjsLib.AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors);
+ if (mode !== _pdfjsLib.AnnotationEditorType.NONE) {
+ this.#annotationEditorUIManager.updateMode(mode);
+ }
+ } else {
+ console.error(`Invalid AnnotationEditor mode: ${mode}`);
+ }
+ }
+ const layerProperties = this.#layerProperties.bind(this);
+ const viewerElement = this._scrollMode === _ui_utils.ScrollMode.PAGE ? null : this.viewer;
+ const scale = this.currentScale;
+ const viewport = firstPdfPage.getViewport({
+ scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
+ });
+ this.viewer.style.setProperty("--scale-factor", viewport.scale);
+ if (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas") {
+ this.viewer.style.setProperty("--hcm-highligh-filter", pdfDocument.filterFactory.addHighlightHCMFilter("CanvasText", "Canvas", "HighlightText", "Highlight"));
+ }
+ for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
+ const pageView = new _pdf_page_view.PDFPageView({
+ container: viewerElement,
+ eventBus: this.eventBus,
+ id: pageNum,
+ scale,
+ defaultViewport: viewport.clone(),
+ optionalContentConfigPromise,
+ renderingQueue: this.renderingQueue,
+ textLayerMode,
+ annotationMode,
+ imageResourcesPath: this.imageResourcesPath,
+ isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,
+ maxCanvasPixels: this.maxCanvasPixels,
+ pageColors: this.pageColors,
+ l10n: this.l10n,
+ layerProperties
+ });
+ this._pages.push(pageView);
+ }
+ const firstPageView = this._pages[0];
+ if (firstPageView) {
+ firstPageView.setPdfPage(firstPdfPage);
+ this.linkService.cachePageRef(1, firstPdfPage.ref);
+ }
+ if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+ this.#ensurePageViewVisible();
+ } else if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
+ this._updateSpreadMode();
+ }
+ this.#onePageRenderedOrForceFetch().then(async () => {
+ this.findController?.setDocument(pdfDocument);
+ this._scriptingManager?.setDocument(pdfDocument);
+ if (this.#hiddenCopyElement) {
+ this.#copyCallbackBound = this.#copyCallback.bind(this, textLayerMode);
+ document.addEventListener("copy", this.#copyCallbackBound);
+ }
+ if (this.#annotationEditorUIManager) {
+ this.eventBus.dispatch("annotationeditormodechanged", {
+ source: this,
+ mode: this.#annotationEditorMode
+ });
+ }
+ if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) {
+ this._pagesCapability.resolve();
+ return;
+ }
+ let getPagesLeft = pagesCount - 1;
+ if (getPagesLeft <= 0) {
+ this._pagesCapability.resolve();
+ return;
+ }
+ for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {
+ const promise = pdfDocument.getPage(pageNum).then(pdfPage => {
+ const pageView = this._pages[pageNum - 1];
+ if (!pageView.pdfPage) {
+ pageView.setPdfPage(pdfPage);
+ }
+ this.linkService.cachePageRef(pageNum, pdfPage.ref);
+ if (--getPagesLeft === 0) {
+ this._pagesCapability.resolve();
+ }
+ }, reason => {
+ console.error(`Unable to get page ${pageNum} to initialize viewer`, reason);
+ if (--getPagesLeft === 0) {
+ this._pagesCapability.resolve();
+ }
+ });
+ if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {
+ await promise;
+ }
+ }
+ });
+ this.eventBus.dispatch("pagesinit", {
+ source: this
+ });
+ pdfDocument.getMetadata().then(({
+ info
+ }) => {
+ if (pdfDocument !== this.pdfDocument) {
+ return;
+ }
+ if (info.Language) {
+ this.viewer.lang = info.Language;
+ }
+ });
+ if (this.defaultRenderingQueue) {
+ this.update();
+ }
+ }).catch(reason => {
+ console.error("Unable to initialize viewer", reason);
+ this._pagesCapability.reject(reason);
+ });
+ }
+
+ setPageLabels(labels) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ if (!labels) {
+ this._pageLabels = null;
+ } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
+ this._pageLabels = null;
+ console.error(`setPageLabels: Invalid page labels.`);
+ } else {
+ this._pageLabels = labels;
+ }
+ for (let i = 0, ii = this._pages.length; i < ii; i++) {
+ this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);
+ }
+ }
+
+ _resetView() {
+ this._pages = [];
+ this._currentPageNumber = 1;
+ this._currentScale = _ui_utils.UNKNOWN_SCALE;
+ this._currentScaleValue = null;
+ this._pageLabels = null;
+ this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
+ this._location = null;
+ this._pagesRotation = 0;
+ this._optionalContentConfigPromise = null;
+ this._firstPageCapability = new _pdfjsLib.PromiseCapability();
+ this._onePageRenderedCapability = new _pdfjsLib.PromiseCapability();
+ this._pagesCapability = new _pdfjsLib.PromiseCapability();
+ this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
+ this._previousScrollMode = _ui_utils.ScrollMode.UNKNOWN;
+ this._spreadMode = _ui_utils.SpreadMode.NONE;
+ this.#scrollModePageState = {
+ previousPageNumber: 1,
+ scrollDown: true,
+ pages: []
+ };
+ if (this._onBeforeDraw) {
+ this.eventBus._off("pagerender", this._onBeforeDraw);
+ this._onBeforeDraw = null;
+ }
+ if (this._onAfterDraw) {
+ this.eventBus._off("pagerendered", this._onAfterDraw);
+ this._onAfterDraw = null;
+ }
+ if (this.#onVisibilityChange) {
+ document.removeEventListener("visibilitychange", this.#onVisibilityChange);
+ this.#onVisibilityChange = null;
+ }
+ this.viewer.textContent = "";
+ this._updateScrollMode();
+ this.viewer.removeAttribute("lang");
+ if (this.#hiddenCopyElement) {
+ document.removeEventListener("copy", this.#copyCallbackBound);
+ this.#copyCallbackBound = null;
+ this.#hiddenCopyElement.remove();
+ this.#hiddenCopyElement = null;
+ }
+ }
+
+ #ensurePageViewVisible() {
+ if (this._scrollMode !== _ui_utils.ScrollMode.PAGE) {
+ throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
+ }
+ const pageNumber = this._currentPageNumber,
+ state = this.#scrollModePageState,
+ viewer = this.viewer;
+ viewer.textContent = "";
+ state.pages.length = 0;
+ if (this._spreadMode === _ui_utils.SpreadMode.NONE && !this.isInPresentationMode) {
+ const pageView = this._pages[pageNumber - 1];
+ viewer.append(pageView.div);
+ state.pages.push(pageView);
+ } else {
+ const pageIndexSet = new Set(),
+ parity = this._spreadMode - 1;
+ if (parity === -1) {
+ pageIndexSet.add(pageNumber - 1);
+ } else if (pageNumber % 2 !== parity) {
+ pageIndexSet.add(pageNumber - 1);
+ pageIndexSet.add(pageNumber);
+ } else {
+ pageIndexSet.add(pageNumber - 2);
+ pageIndexSet.add(pageNumber - 1);
+ }
+ const spread = document.createElement("div");
+ spread.className = "spread";
+ if (this.isInPresentationMode) {
+ const dummyPage = document.createElement("div");
+ dummyPage.className = "dummyPage";
+ spread.append(dummyPage);
+ }
+ for (const i of pageIndexSet) {
+ const pageView = this._pages[i];
+ if (!pageView) {
+ continue;
+ }
+ spread.append(pageView.div);
+ state.pages.push(pageView);
+ }
+ viewer.append(spread);
+ }
+ state.scrollDown = pageNumber >= state.previousPageNumber;
+ state.previousPageNumber = pageNumber;
+ }
+
+ _scrollUpdate() {
+ if (this.pagesCount === 0) {
+ return;
+ }
+ this.update();
+ }
+
+ #scrollIntoView(pageView, pageSpot = null) {
+ const {
+ div,
+ id
+ } = pageView;
+ if (this._currentPageNumber !== id) {
+ this._setCurrentPageNumber(id);
+ }
+ if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+ this.#ensurePageViewVisible();
+ this.update();
+ }
+ if (!pageSpot && !this.isInPresentationMode) {
+ const left = div.offsetLeft + div.clientLeft,
+ right = left + div.clientWidth;
+ const {
+ scrollLeft,
+ clientWidth
+ } = this.container;
+ if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
+ pageSpot = {
+ left: 0,
+ top: 0
+ };
+ }
+ }
+ (0, _ui_utils.scrollIntoView)(div, pageSpot);
+ if (!this._currentScaleValue && this._location) {
+ this._location = null;
+ }
+ }
+
+ #isSameScale(newScale) {
+ return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
+ }
+
+ #setScaleUpdatePages(newScale, newValue, {
+ noScroll = false,
+ preset = false,
+ drawingDelay = -1
+ }) {
+ this._currentScaleValue = newValue.toString();
+ if (this.#isSameScale(newScale)) {
+ if (preset) {
+ this.eventBus.dispatch("scalechanging", {
+ source: this,
+ scale: newScale,
+ presetValue: newValue
+ });
+ }
+ return;
+ }
+ this.viewer.style.setProperty("--scale-factor", newScale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
+ const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;
+ this.refresh(true, {
+ scale: newScale,
+ drawingDelay: postponeDrawing ? drawingDelay : -1
+ });
+ if (postponeDrawing) {
+ this.#scaleTimeoutId = setTimeout(() => {
+ this.#scaleTimeoutId = null;
+ this.refresh();
+ }, drawingDelay);
+ }
+ this._currentScale = newScale;
+ if (!noScroll) {
+ let page = this._currentPageNumber,
+ dest;
+ if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
+ page = this._location.pageNumber;
+ dest = [null, {
+ name: "XYZ"
+ }, this._location.left, this._location.top, null];
+ }
+ this.scrollPageIntoView({
+ pageNumber: page,
+ destArray: dest,
+ allowNegativeOffset: true
+ });
+ }
+ this.eventBus.dispatch("scalechanging", {
+ source: this,
+ scale: newScale,
+ presetValue: preset ? newValue : undefined
+ });
+ if (this.defaultRenderingQueue) {
+ this.update();
+ }
+ }
+
+ get #pageWidthScaleFactor() {
+ if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL) {
+ return 2;
+ }
+ return 1;
+ }
+
+ #setScale(value, options) {
+ let scale = parseFloat(value);
+ if (scale > 0) {
+ options.preset = false;
+ this.#setScaleUpdatePages(scale, value, options);
+ } else {
+ const currentPage = this._pages[this._currentPageNumber - 1];
+ if (!currentPage) {
+ return;
+ }
+ let hPadding = _ui_utils.SCROLLBAR_PADDING,
+ vPadding = _ui_utils.VERTICAL_PADDING;
+ if (this.isInPresentationMode) {
+ hPadding = vPadding = 4;
+ if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
+ hPadding *= 2;
+ }
+ } else if (this.removePageBorders) {
+ hPadding = vPadding = 0;
+ } else if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
+ [hPadding, vPadding] = [vPadding, hPadding];
+ }
+ const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor;
+ const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
+ switch (value) {
+ case "page-actual":
+ scale = 1;
+ break;
+ case "page-width":
+ scale = pageWidthScale;
+ break;
+ case "page-height":
+ scale = pageHeightScale;
+ break;
+ case "page-fit":
+ scale = Math.min(pageWidthScale, pageHeightScale);
+ break;
+ case "auto":
+ const horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
+ scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
+ break;
+ default:
+ console.error(`#setScale: "${value}" is an unknown zoom value.`);
+ return;
+ }
+ options.preset = true;
+ this.#setScaleUpdatePages(scale, value, options);
+ }
+ }
+
+ #resetCurrentPageView() {
+ const pageView = this._pages[this._currentPageNumber - 1];
+ if (this.isInPresentationMode) {
+ this.#setScale(this._currentScaleValue, {
+ noScroll: true
+ });
+ }
+ this.#scrollIntoView(pageView);
+ }
+
+ pageLabelToPageNumber(label) {
+ if (!this._pageLabels) {
+ return null;
+ }
+ const i = this._pageLabels.indexOf(label);
+ if (i < 0) {
+ return null;
+ }
+ return i + 1;
+ }
+
+ scrollPageIntoView({
+ pageNumber,
+ destArray = null,
+ allowNegativeOffset = false,
+ ignoreDestinationZoom = false
+ }) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
+ if (!pageView) {
+ console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`);
+ return;
+ }
+ if (this.isInPresentationMode || !destArray) {
+ this._setCurrentPageNumber(pageNumber, true);
+ return;
+ }
+ let x = 0,
+ y = 0;
+ let width = 0,
+ height = 0,
+ widthScale,
+ heightScale;
+ const changeOrientation = pageView.rotation % 180 !== 0;
+ const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
+ const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
+ let scale = 0;
+ switch (destArray[1].name) {
+ case "XYZ":
+ x = destArray[2];
+ y = destArray[3];
+ scale = destArray[4];
+ x = x !== null ? x : 0;
+ y = y !== null ? y : pageHeight;
+ break;
+ case "Fit":
+ case "FitB":
+ scale = "page-fit";
+ break;
+ case "FitH":
+ case "FitBH":
+ y = destArray[2];
+ scale = "page-width";
+ if (y === null && this._location) {
+ x = this._location.left;
+ y = this._location.top;
+ } else if (typeof y !== "number" || y < 0) {
+ y = pageHeight;
+ }
+ break;
+ case "FitV":
+ case "FitBV":
+ x = destArray[2];
+ width = pageWidth;
+ height = pageHeight;
+ scale = "page-height";
+ break;
+ case "FitR":
+ x = destArray[2];
+ y = destArray[3];
+ width = destArray[4] - x;
+ height = destArray[5] - y;
+ let hPadding = _ui_utils.SCROLLBAR_PADDING,
+ vPadding = _ui_utils.VERTICAL_PADDING;
+ if (this.removePageBorders) {
+ hPadding = vPadding = 0;
+ }
+ widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
+ heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
+ scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
+ break;
+ default:
+ console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`);
+ return;
+ }
+ if (!ignoreDestinationZoom) {
+ if (scale && scale !== this._currentScale) {
+ this.currentScaleValue = scale;
+ } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) {
+ this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
+ }
+ }
+ if (scale === "page-fit" && !destArray[4]) {
+ this.#scrollIntoView(pageView);
+ return;
+ }
+ const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
+ let left = Math.min(boundingRect[0][0], boundingRect[1][0]);
+ let top = Math.min(boundingRect[0][1], boundingRect[1][1]);
+ if (!allowNegativeOffset) {
+ left = Math.max(left, 0);
+ top = Math.max(top, 0);
+ }
+ this.#scrollIntoView(pageView, {
+ left,
+ top
+ });
+ }
+
+ _updateLocation(firstPage) {
+ const currentScale = this._currentScale;
+ const currentScaleValue = this._currentScaleValue;
+ const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
+ const pageNumber = firstPage.id;
+ const currentPageView = this._pages[pageNumber - 1];
+ const container = this.container;
+ const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
+ const intLeft = Math.round(topLeft[0]);
+ const intTop = Math.round(topLeft[1]);
+ let pdfOpenParams = `#page=${pageNumber}`;
+ if (!this.isInPresentationMode) {
+ pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;
+ }
+ this._location = {
+ pageNumber,
+ scale: normalizedScaleValue,
+ top: intTop,
+ left: intLeft,
+ rotation: this._pagesRotation,
+ pdfOpenParams
+ };
+ }
+
+ update() {
+ const visible = this._getVisiblePages();
+ const visiblePages = visible.views,
+ numVisiblePages = visiblePages.length;
+ if (numVisiblePages === 0) {
+ return;
+ }
+ const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
+ this.#buffer.resize(newCacheSize, visible.ids);
+ this.renderingQueue.renderHighestPriority(visible);
+ const isSimpleLayout = this._spreadMode === _ui_utils.SpreadMode.NONE && (this._scrollMode === _ui_utils.ScrollMode.PAGE || this._scrollMode === _ui_utils.ScrollMode.VERTICAL);
+ const currentId = this._currentPageNumber;
+ let stillFullyVisible = false;
+ for (const page of visiblePages) {
+ if (page.percent < 100) {
+ break;
+ }
+ if (page.id === currentId && isSimpleLayout) {
+ stillFullyVisible = true;
+ break;
+ }
+ }
+ this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id);
+ this._updateLocation(visible.first);
+ this.eventBus.dispatch("updateviewarea", {
+ source: this,
+ location: this._location
+ });
+ }
+
+ containsElement(element) {
+ return this.container.contains(element);
+ }
+
+ focus() {
+ this.container.focus();
+ }
+
+ get _isContainerRtl() {
+ return getComputedStyle(this.container).direction === "rtl";
+ }
+
+ get isInPresentationMode() {
+ return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
+ }
+
+ get isChangingPresentationMode() {
+ return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING;
+ }
+
+ get isHorizontalScrollbarEnabled() {
+ return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
+ }
+
+ get isVerticalScrollbarEnabled() {
+ return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
+ }
+
+ _getVisiblePages() {
+ const views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages,
+ horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
+ rtl = horizontal && this._isContainerRtl;
+ return (0, _ui_utils.getVisibleElements)({
+ scrollEl: this.container,
+ views,
+ sortByVisibility: true,
+ horizontal,
+ rtl
+ });
+ }
+
+ cleanup() {
+ for (const pageView of this._pages) {
+ if (pageView.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ pageView.reset();
+ }
+ }
+ }
+
+ _cancelRendering() {
+ for (const pageView of this._pages) {
+ pageView.cancelRendering();
+ }
+ }
+
+ async #ensurePdfPageLoaded(pageView) {
+ if (pageView.pdfPage) {
+ return pageView.pdfPage;
+ }
+ try {
+ const pdfPage = await this.pdfDocument.getPage(pageView.id);
+ if (!pageView.pdfPage) {
+ pageView.setPdfPage(pdfPage);
+ }
+ if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {
+ this.linkService.cachePageRef(pageView.id, pdfPage.ref);
+ }
+ return pdfPage;
+ } catch (reason) {
+ console.error("Unable to get page for page view", reason);
+ return null;
+ }
+ }
+
+ #getScrollAhead(visible) {
+ if (visible.first?.id === 1) {
+ return true;
+ } else if (visible.last?.id === this.pagesCount) {
+ return false;
+ }
+ switch (this._scrollMode) {
+ case _ui_utils.ScrollMode.PAGE:
+ return this.#scrollModePageState.scrollDown;
+ case _ui_utils.ScrollMode.HORIZONTAL:
+ return this.scroll.right;
+ }
+ return this.scroll.down;
+ }
+
+ forceRendering(currentlyVisiblePages) {
+ const visiblePages = currentlyVisiblePages || this._getVisiblePages();
+ const scrollAhead = this.#getScrollAhead(visiblePages);
+ const preRenderExtra = this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL;
+ const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
+ if (pageView) {
+ this.#ensurePdfPageLoaded(pageView).then(() => {
+ this.renderingQueue.renderView(pageView);
+ });
+ return true;
+ }
+ return false;
+ }
+
+ get hasEqualPageSizes() {
+ const firstPageView = this._pages[0];
+ for (let i = 1, ii = this._pages.length; i < ii; ++i) {
+ const pageView = this._pages[i];
+ if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ getPagesOverview() {
+ let initialOrientation;
+ return this._pages.map(pageView => {
+ const viewport = pageView.pdfPage.getViewport({
+ scale: 1
+ });
+ const orientation = (0, _ui_utils.isPortraitOrientation)(viewport);
+ if (initialOrientation === undefined) {
+ initialOrientation = orientation;
+ } else if (this.enablePrintAutoRotate && orientation !== initialOrientation) {
+ return {
+ width: viewport.height,
+ height: viewport.width,
+ rotation: (viewport.rotation - 90) % 360
+ };
+ }
+ return {
+ width: viewport.width,
+ height: viewport.height,
+ rotation: viewport.rotation
+ };
+ });
+ }
+
+ get optionalContentConfigPromise() {
+ if (!this.pdfDocument) {
+ return Promise.resolve(null);
+ }
+ if (!this._optionalContentConfigPromise) {
+ console.error("optionalContentConfigPromise: Not initialized yet.");
+ return this.pdfDocument.getOptionalContentConfig();
+ }
+ return this._optionalContentConfigPromise;
+ }
+
+ set optionalContentConfigPromise(promise) {
+ if (!(promise instanceof Promise)) {
+ throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ if (!this._optionalContentConfigPromise) {
+ return;
+ }
+ this._optionalContentConfigPromise = promise;
+ this.refresh(false, {
+ optionalContentConfigPromise: promise
+ });
+ this.eventBus.dispatch("optionalcontentconfigchanged", {
+ source: this,
+ promise
+ });
+ }
+
+ get scrollMode() {
+ return this._scrollMode;
+ }
+
+ set scrollMode(mode) {
+ if (this._scrollMode === mode) {
+ return;
+ }
+ if (!(0, _ui_utils.isValidScrollMode)(mode)) {
+ throw new Error(`Invalid scroll mode: ${mode}`);
+ }
+ if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
+ return;
+ }
+ this._previousScrollMode = this._scrollMode;
+ this._scrollMode = mode;
+ this.eventBus.dispatch("scrollmodechanged", {
+ source: this,
+ mode
+ });
+ this._updateScrollMode(this._currentPageNumber);
+ }
+
+ _updateScrollMode(pageNumber = null) {
+ const scrollMode = this._scrollMode,
+ viewer = this.viewer;
+ viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL);
+ viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED);
+ if (!this.pdfDocument || !pageNumber) {
+ return;
+ }
+ if (scrollMode === _ui_utils.ScrollMode.PAGE) {
+ this.#ensurePageViewVisible();
+ } else if (this._previousScrollMode === _ui_utils.ScrollMode.PAGE) {
+ this._updateSpreadMode();
+ }
+ if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
+ this.#setScale(this._currentScaleValue, {
+ noScroll: true
+ });
+ }
+ this._setCurrentPageNumber(pageNumber, true);
+ this.update();
+ }
+
+ get spreadMode() {
+ return this._spreadMode;
+ }
+
+ set spreadMode(mode) {
+ if (this._spreadMode === mode) {
+ return;
+ }
+ if (!(0, _ui_utils.isValidSpreadMode)(mode)) {
+ throw new Error(`Invalid spread mode: ${mode}`);
+ }
+ this._spreadMode = mode;
+ this.eventBus.dispatch("spreadmodechanged", {
+ source: this,
+ mode
+ });
+ this._updateSpreadMode(this._currentPageNumber);
+ }
+
+ _updateSpreadMode(pageNumber = null) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ const viewer = this.viewer,
+ pages = this._pages;
+ if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+ this.#ensurePageViewVisible();
+ } else {
+ viewer.textContent = "";
+ if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
+ for (const pageView of this._pages) {
+ viewer.append(pageView.div);
+ }
+ } else {
+ const parity = this._spreadMode - 1;
+ let spread = null;
+ for (let i = 0, ii = pages.length; i < ii; ++i) {
+ if (spread === null) {
+ spread = document.createElement("div");
+ spread.className = "spread";
+ viewer.append(spread);
+ } else if (i % 2 === parity) {
+ spread = spread.cloneNode(false);
+ viewer.append(spread);
+ }
+ spread.append(pages[i].div);
+ }
+ }
+ }
+ if (!pageNumber) {
+ return;
+ }
+ if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
+ this.#setScale(this._currentScaleValue, {
+ noScroll: true
+ });
+ }
+ this._setCurrentPageNumber(pageNumber, true);
+ this.update();
+ }
+
+ _getPageAdvance(currentPageNumber, previous = false) {
+ switch (this._scrollMode) {
+ case _ui_utils.ScrollMode.WRAPPED: {
+ const {
+ views
+ } = this._getVisiblePages(),
+ pageLayout = new Map();
+ for (const {
+ id,
+ y,
+ percent,
+ widthPercent
+ } of views) {
+ if (percent === 0 || widthPercent < 100) {
+ continue;
+ }
+ let yArray = pageLayout.get(y);
+ if (!yArray) {
+ pageLayout.set(y, yArray ||= []);
+ }
+ yArray.push(id);
+ }
+ for (const yArray of pageLayout.values()) {
+ const currentIndex = yArray.indexOf(currentPageNumber);
+ if (currentIndex === -1) {
+ continue;
+ }
+ const numPages = yArray.length;
+ if (numPages === 1) {
+ break;
+ }
+ if (previous) {
+ for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {
+ const currentId = yArray[i],
+ expectedId = yArray[i + 1] - 1;
+ if (currentId < expectedId) {
+ return currentPageNumber - expectedId;
+ }
+ }
+ } else {
+ for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {
+ const currentId = yArray[i],
+ expectedId = yArray[i - 1] + 1;
+ if (currentId > expectedId) {
+ return expectedId - currentPageNumber;
+ }
+ }
+ }
+ if (previous) {
+ const firstId = yArray[0];
+ if (firstId < currentPageNumber) {
+ return currentPageNumber - firstId + 1;
+ }
+ } else {
+ const lastId = yArray[numPages - 1];
+ if (lastId > currentPageNumber) {
+ return lastId - currentPageNumber + 1;
+ }
+ }
+ break;
+ }
+ break;
+ }
+ case _ui_utils.ScrollMode.HORIZONTAL: {
+ break;
+ }
+ case _ui_utils.ScrollMode.PAGE:
+ case _ui_utils.ScrollMode.VERTICAL: {
+ if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
+ break;
+ }
+ const parity = this._spreadMode - 1;
+ if (previous && currentPageNumber % 2 !== parity) {
+ break;
+ } else if (!previous && currentPageNumber % 2 === parity) {
+ break;
+ }
+ const {
+ views
+ } = this._getVisiblePages(),
+ expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;
+ for (const {
+ id,
+ percent,
+ widthPercent
+ } of views) {
+ if (id !== expectedId) {
+ continue;
+ }
+ if (percent > 0 && widthPercent === 100) {
+ return 2;
+ }
+ break;
+ }
+ break;
+ }
+ }
+ return 1;
+ }
+
+ nextPage() {
+ const currentPageNumber = this._currentPageNumber,
+ pagesCount = this.pagesCount;
+ if (currentPageNumber >= pagesCount) {
+ return false;
+ }
+ const advance = this._getPageAdvance(currentPageNumber, false) || 1;
+ this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
+ return true;
+ }
+
+ previousPage() {
+ const currentPageNumber = this._currentPageNumber;
+ if (currentPageNumber <= 1) {
+ return false;
+ }
+ const advance = this._getPageAdvance(currentPageNumber, true) || 1;
+ this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
+ return true;
+ }
+
+ increaseScale({
+ drawingDelay,
+ scaleFactor,
+ steps
+ } = {}) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ let newScale = this._currentScale;
+ if (scaleFactor > 1) {
+ newScale = Math.round(newScale * scaleFactor * 100) / 100;
+ } else {
+ steps ??= 1;
+ do {
+ newScale = Math.ceil((newScale * _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
+ } while (--steps > 0 && newScale < _ui_utils.MAX_SCALE);
+ }
+ this.#setScale(Math.min(_ui_utils.MAX_SCALE, newScale), {
+ noScroll: false,
+ drawingDelay
+ });
+ }
+
+ decreaseScale({
+ drawingDelay,
+ scaleFactor,
+ steps
+ } = {}) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ let newScale = this._currentScale;
+ if (scaleFactor > 0 && scaleFactor < 1) {
+ newScale = Math.round(newScale * scaleFactor * 100) / 100;
+ } else {
+ steps ??= 1;
+ do {
+ newScale = Math.floor((newScale / _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
+ } while (--steps > 0 && newScale > _ui_utils.MIN_SCALE);
+ }
+ this.#setScale(Math.max(_ui_utils.MIN_SCALE, newScale), {
+ noScroll: false,
+ drawingDelay
+ });
+ }
+
+ #updateContainerHeightCss(height = this.container.clientHeight) {
+ if (height !== this.#previousContainerHeight) {
+ this.#previousContainerHeight = height;
+ _ui_utils.docStyle.setProperty("--viewer-container-height", `${height}px`);
+ }
+ }
+
+ #resizeObserverCallback(entries) {
+ for (const entry of entries) {
+ if (entry.target === this.container) {
+ this.#updateContainerHeightCss(Math.floor(entry.borderBoxSize[0].blockSize));
+ this.#containerTopLeft = null;
+ break;
+ }
+ }
+ }
+
+ get containerTopLeft() {
+ return this.#containerTopLeft ||= [this.container.offsetTop, this.container.offsetLeft];
+ }
+
+ get annotationEditorMode() {
+ return this.#annotationEditorUIManager ? this.#annotationEditorMode : _pdfjsLib.AnnotationEditorType.DISABLE;
+ }
+
+ set annotationEditorMode({
+ mode,
+ editId = null
+ }) {
+ if (!this.#annotationEditorUIManager) {
+ throw new Error(`The AnnotationEditor is not enabled.`);
+ }
+ if (this.#annotationEditorMode === mode) {
+ return;
+ }
+ if (!isValidAnnotationEditorMode(mode)) {
+ throw new Error(`Invalid AnnotationEditor mode: ${mode}`);
+ }
+ if (!this.pdfDocument) {
+ return;
+ }
+ this.#annotationEditorMode = mode;
+ this.eventBus.dispatch("annotationeditormodechanged", {
+ source: this,
+ mode
+ });
+ this.#annotationEditorUIManager.updateMode(mode, editId);
+ }
+
+ set annotationEditorParams({
+ type,
+ value
+ }) {
+ if (!this.#annotationEditorUIManager) {
+ throw new Error(`The AnnotationEditor is not enabled.`);
+ }
+ this.#annotationEditorUIManager.updateParams(type, value);
+ }
+
+ refresh(noUpdate = false, updateArgs = Object.create(null)) {
+ if (!this.pdfDocument) {
+ return;
+ }
+ for (const pageView of this._pages) {
+ pageView.update(updateArgs);
+ }
+ if (this.#scaleTimeoutId !== null) {
+ clearTimeout(this.#scaleTimeoutId);
+ this.#scaleTimeoutId = null;
+ }
+ if (!noUpdate) {
+ this.update();
+ }
+ }
+ }
+
+ exports.PDFViewer = PDFViewer;
+
+ /***/
+ }),
+ /* 30 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.NullL10n = void 0;
+ exports.getL10nFallback = getL10nFallback;
+ const DEFAULT_L10N_STRINGS = {
+ of_pages: "of {{pagesCount}}",
+ page_of_pages: "({{pageNumber}} of {{pagesCount}})",
+ document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
+ document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
+ document_properties_date_string: "{{date}}, {{time}}",
+ document_properties_page_size_unit_inches: "in",
+ document_properties_page_size_unit_millimeters: "mm",
+ document_properties_page_size_orientation_portrait: "portrait",
+ document_properties_page_size_orientation_landscape: "landscape",
+ document_properties_page_size_name_a3: "A3",
+ document_properties_page_size_name_a4: "A4",
+ document_properties_page_size_name_letter: "Letter",
+ document_properties_page_size_name_legal: "Legal",
+ document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
+ document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
+ document_properties_linearized_yes: "Yes",
+ document_properties_linearized_no: "No",
+ additional_layers: "Additional Layers",
+ page_landmark: "Page {{page}}",
+ thumb_page_title: "Page {{page}}",
+ thumb_page_canvas: "Thumbnail of Page {{page}}",
+ find_reached_top: "Reached top of document, continued from bottom",
+ find_reached_bottom: "Reached end of document, continued from top",
+ "find_match_count[one]": "{{current}} of {{total}} match",
+ "find_match_count[other]": "{{current}} of {{total}} matches",
+ "find_match_count_limit[one]": "More than {{limit}} match",
+ "find_match_count_limit[other]": "More than {{limit}} matches",
+ find_not_found: "Phrase not found",
+ page_scale_width: "Page Width",
+ page_scale_fit: "Page Fit",
+ page_scale_auto: "Automatic Zoom",
+ page_scale_actual: "Actual Size",
+ page_scale_percent: "{{scale}}%",
+ loading_error: "An error occurred while loading the PDF.",
+ invalid_file_error: "Invalid or corrupted PDF file.",
+ missing_file_error: "Missing PDF file.",
+ unexpected_response_error: "Unexpected server response.",
+ rendering_error: "An error occurred while rendering the page.",
+ annotation_date_string: "{{date}}, {{time}}",
+ printing_not_supported: "Warning: Printing is not fully supported by this browser.",
+ printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
+ web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.",
+ free_text2_default_content: "Start typing…",
+ editor_free_text2_aria_label: "Text Editor",
+ editor_ink2_aria_label: "Draw Editor",
+ editor_ink_canvas_aria_label: "User-created image",
+ editor_alt_text_button_label: "Alt text",
+ editor_alt_text_edit_button_label: "Edit alt text",
+ editor_alt_text_decorative_tooltip: "Marked as decorative"
+ };
+ {
+ DEFAULT_L10N_STRINGS.print_progress_percent = "{{progress}}%";
+ }
+
+ function getL10nFallback(key, args) {
+ switch (key) {
+ case "find_match_count":
+ key = `find_match_count[${args.total === 1 ? "one" : "other"}]`;
+ break;
+ case "find_match_count_limit":
+ key = `find_match_count_limit[${args.limit === 1 ? "one" : "other"}]`;
+ break;
+ }
+ return DEFAULT_L10N_STRINGS[key] || "";
+ }
+
+ function formatL10nValue(text, args) {
+ if (!args) {
+ return text;
+ }
+ return text.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => {
+ return name in args ? args[name] : "{{" + name + "}}";
+ });
+ }
+
+ const NullL10n = {
+ async getLanguage() {
+ return "en-us";
+ },
+ async getDirection() {
+ return "ltr";
+ },
+ async get(key, args = null, fallback = getL10nFallback(key, args)) {
+ return formatL10nValue(fallback, args);
+ },
+ async translate(element) {
+ }
+ };
+ exports.NullL10n = NullL10n;
+
+ /***/
+ }),
+ /* 31 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFPageView = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+ var _annotation_editor_layer_builder = __webpack_require__(32);
+ var _annotation_layer_builder = __webpack_require__(33);
+ var _app_options = __webpack_require__(5);
+ var _l10n_utils = __webpack_require__(30);
+ var _pdf_link_service = __webpack_require__(7);
+ var _struct_tree_layer_builder = __webpack_require__(34);
+ var _text_accessibility = __webpack_require__(35);
+ var _text_highlighter = __webpack_require__(36);
+ var _text_layer_builder = __webpack_require__(37);
+ var _xfa_layer_builder = __webpack_require__(38);
+ const MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
+ const DEFAULT_LAYER_PROPERTIES = () => {
+ return null;
+ };
+
+ class PDFPageView {
+ #annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+ #hasRestrictedScaling = false;
+ #layerProperties = null;
+ #loadingId = null;
+ #previousRotation = null;
+ #renderError = null;
+ #renderingState = _ui_utils.RenderingStates.INITIAL;
+ #textLayerMode = _ui_utils.TextLayerMode.ENABLE;
+ #useThumbnailCanvas = {
+ directDrawing: true,
+ initialOptionalContent: true,
+ regularAnnotations: true
+ };
+ #viewportMap = new WeakMap();
+
+ constructor(options) {
+ const container = options.container;
+ const defaultViewport = options.defaultViewport;
+ this.id = options.id;
+ this.renderingId = "page" + this.id;
+ this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;
+ this.pdfPage = null;
+ this.pageLabel = null;
+ this.rotation = 0;
+ this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
+ this.viewport = defaultViewport;
+ this.pdfPageRotate = defaultViewport.rotation;
+ this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
+ this.#textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
+ this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+ this.imageResourcesPath = options.imageResourcesPath || "";
+ this.isOffscreenCanvasSupported = options.isOffscreenCanvasSupported ?? true;
+ this.maxCanvasPixels = options.maxCanvasPixels ?? MAX_CANVAS_PIXELS;
+ this.pageColors = options.pageColors || null;
+ this.eventBus = options.eventBus;
+ this.renderingQueue = options.renderingQueue;
+ this.l10n = options.l10n || _l10n_utils.NullL10n;
+ this.renderTask = null;
+ this.resume = null;
+ this._isStandalone = !this.renderingQueue?.hasViewer();
+ this._container = container;
+ if (options.useOnlyCssZoom) {
+ console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead.");
+ this.maxCanvasPixels = 0;
+ }
+ this._annotationCanvasMap = null;
+ this.annotationLayer = null;
+ this.annotationEditorLayer = null;
+ this.textLayer = null;
+ this.zoomLayer = null;
+ this.xfaLayer = null;
+ this.structTreeLayer = null;
+ const div = document.createElement("div");
+ div.className = "page";
+ div.setAttribute("data-page-number", this.id);
+ div.setAttribute("role", "region");
+ this.l10n.get("page_landmark", {
+ page: this.id
+ }).then(msg => {
+ div.setAttribute("aria-label", msg);
+ });
+ this.div = div;
+ this.#setDimensions();
+ container?.append(div);
+ if (this._isStandalone) {
+ container?.style.setProperty("--scale-factor", this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
+ const {
+ optionalContentConfigPromise
+ } = options;
+ if (optionalContentConfigPromise) {
+ optionalContentConfigPromise.then(optionalContentConfig => {
+ if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
+ return;
+ }
+ this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
+ });
+ }
+ }
+ }
+
+ get renderingState() {
+ return this.#renderingState;
+ }
+
+ set renderingState(state) {
+ if (state === this.#renderingState) {
+ return;
+ }
+ this.#renderingState = state;
+ if (this.#loadingId) {
+ clearTimeout(this.#loadingId);
+ this.#loadingId = null;
+ }
+ switch (state) {
+ case _ui_utils.RenderingStates.PAUSED:
+ this.div.classList.remove("loading");
+ break;
+ case _ui_utils.RenderingStates.RUNNING:
+ this.div.classList.add("loadingIcon");
+ this.#loadingId = setTimeout(() => {
+ this.div.classList.add("loading");
+ this.#loadingId = null;
+ }, 0);
+ break;
+ case _ui_utils.RenderingStates.INITIAL:
+ case _ui_utils.RenderingStates.FINISHED:
+ this.div.classList.remove("loadingIcon", "loading");
+ break;
+ }
+ }
+
+ #setDimensions() {
+ const {
+ viewport
+ } = this;
+ if (this.pdfPage) {
+ if (this.#previousRotation === viewport.rotation) {
+ return;
+ }
+ this.#previousRotation = viewport.rotation;
+ }
+ (0, _pdfjsLib.setLayerDimensions)(this.div, viewport, true, false);
+ }
+
+ setPdfPage(pdfPage) {
+ if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) {
+ this._container?.style.setProperty("--hcm-highligh-filter", pdfPage.filterFactory.addHighlightHCMFilter("CanvasText", "Canvas", "HighlightText", "Highlight"));
+ }
+ this.pdfPage = pdfPage;
+ this.pdfPageRotate = pdfPage.rotate;
+ const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
+ this.viewport = pdfPage.getViewport({
+ scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
+ rotation: totalRotation
+ });
+ this.#setDimensions();
+ this.reset();
+ }
+
+ destroy() {
+ this.reset();
+ this.pdfPage?.cleanup();
+ }
+
+ get _textHighlighter() {
+ return (0, _pdfjsLib.shadow)(this, "_textHighlighter", new _text_highlighter.TextHighlighter({
+ pageIndex: this.id - 1,
+ eventBus: this.eventBus,
+ findController: this.#layerProperties().findController
+ }));
+ }
+
+ async #renderAnnotationLayer() {
+ let error = null;
+ try {
+ await this.annotationLayer.render(this.viewport, "display");
+ } catch (ex) {
+ console.error(`#renderAnnotationLayer: "${ex}".`);
+ error = ex;
+ } finally {
+ this.eventBus.dispatch("annotationlayerrendered", {
+ source: this,
+ pageNumber: this.id,
+ error
+ });
+ }
+ }
+
+ async #renderAnnotationEditorLayer() {
+ let error = null;
+ try {
+ await this.annotationEditorLayer.render(this.viewport, "display");
+ } catch (ex) {
+ console.error(`#renderAnnotationEditorLayer: "${ex}".`);
+ error = ex;
+ } finally {
+ this.eventBus.dispatch("annotationeditorlayerrendered", {
+ source: this,
+ pageNumber: this.id,
+ error
+ });
+ }
+ }
+
+ async #renderXfaLayer() {
+ let error = null;
+ try {
+ const result = await this.xfaLayer.render(this.viewport, "display");
+ if (result?.textDivs && this._textHighlighter) {
+ this.#buildXfaTextContentItems(result.textDivs);
+ }
+ } catch (ex) {
+ console.error(`#renderXfaLayer: "${ex}".`);
+ error = ex;
+ } finally {
+ this.eventBus.dispatch("xfalayerrendered", {
+ source: this,
+ pageNumber: this.id,
+ error
+ });
+ }
+ }
+
+ async #renderTextLayer() {
+ const {
+ pdfPage,
+ textLayer,
+ viewport
+ } = this;
+ if (!textLayer) {
+ return;
+ }
+ let error = null;
+ try {
+ if (!textLayer.renderingDone) {
+ const readableStream = pdfPage.streamTextContent({
+ includeMarkedContent: true,
+ disableNormalization: true
+ });
+ textLayer.setTextContentSource(readableStream);
+ }
+ await textLayer.render(viewport);
+ } catch (ex) {
+ if (ex instanceof _pdfjsLib.AbortException) {
+ return;
+ }
+ console.error(`#renderTextLayer: "${ex}".`);
+ error = ex;
+ }
+ this.eventBus.dispatch("textlayerrendered", {
+ source: this,
+ pageNumber: this.id,
+ numTextDivs: textLayer.numTextDivs,
+ error
+ });
+ this.#renderStructTreeLayer();
+ }
+
+ async #renderStructTreeLayer() {
+ if (!this.textLayer) {
+ return;
+ }
+ this.structTreeLayer ||= new _struct_tree_layer_builder.StructTreeLayerBuilder();
+ const tree = await (!this.structTreeLayer.renderingDone ? this.pdfPage.getStructTree() : null);
+ const treeDom = this.structTreeLayer?.render(tree);
+ if (treeDom) {
+ this.canvas?.append(treeDom);
+ }
+ this.structTreeLayer?.show();
+ }
+
+ async #buildXfaTextContentItems(textDivs) {
+ const text = await this.pdfPage.getTextContent();
+ const items = [];
+ for (const item of text.items) {
+ items.push(item.str);
+ }
+ this._textHighlighter.setTextMapping(textDivs, items);
+ this._textHighlighter.enable();
+ }
+
+ _resetZoomLayer(removeFromDOM = false) {
+ if (!this.zoomLayer) {
+ return;
+ }
+ const zoomLayerCanvas = this.zoomLayer.firstChild;
+ this.#viewportMap.delete(zoomLayerCanvas);
+ zoomLayerCanvas.width = 0;
+ zoomLayerCanvas.height = 0;
+ if (removeFromDOM) {
+ this.zoomLayer.remove();
+ }
+ this.zoomLayer = null;
+ }
+
+ reset({
+ keepZoomLayer = false,
+ keepAnnotationLayer = false,
+ keepAnnotationEditorLayer = false,
+ keepXfaLayer = false,
+ keepTextLayer = false
+ } = {}) {
+ this.cancelRendering({
+ keepAnnotationLayer,
+ keepAnnotationEditorLayer,
+ keepXfaLayer,
+ keepTextLayer
+ });
+ this.renderingState = _ui_utils.RenderingStates.INITIAL;
+ const div = this.div;
+ const childNodes = div.childNodes,
+ zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
+ annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null,
+ annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null,
+ xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null,
+ textLayerNode = keepTextLayer && this.textLayer?.div || null;
+ for (let i = childNodes.length - 1; i >= 0; i--) {
+ const node = childNodes[i];
+ switch (node) {
+ case zoomLayerNode:
+ case annotationLayerNode:
+ case annotationEditorLayerNode:
+ case xfaLayerNode:
+ case textLayerNode:
+ continue;
+ }
+ node.remove();
+ }
+ div.removeAttribute("data-loaded");
+ if (annotationLayerNode) {
+ this.annotationLayer.hide();
+ }
+ if (annotationEditorLayerNode) {
+ this.annotationEditorLayer.hide();
+ }
+ if (xfaLayerNode) {
+ this.xfaLayer.hide();
+ }
+ if (textLayerNode) {
+ this.textLayer.hide();
+ }
+ this.structTreeLayer?.hide();
+ if (!zoomLayerNode) {
+ if (this.canvas) {
+ this.#viewportMap.delete(this.canvas);
+ this.canvas.width = 0;
+ this.canvas.height = 0;
+ delete this.canvas;
+ }
+ this._resetZoomLayer();
+ }
+ }
+
+ update({
+ scale = 0,
+ rotation = null,
+ optionalContentConfigPromise = null,
+ drawingDelay = -1
+ }) {
+ this.scale = scale || this.scale;
+ if (typeof rotation === "number") {
+ this.rotation = rotation;
+ }
+ if (optionalContentConfigPromise instanceof Promise) {
+ this._optionalContentConfigPromise = optionalContentConfigPromise;
+ optionalContentConfigPromise.then(optionalContentConfig => {
+ if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
+ return;
+ }
+ this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
+ });
+ }
+ this.#useThumbnailCanvas.directDrawing = true;
+ const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
+ this.viewport = this.viewport.clone({
+ scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
+ rotation: totalRotation
+ });
+ this.#setDimensions();
+ if (this._isStandalone) {
+ this._container?.style.setProperty("--scale-factor", this.viewport.scale);
+ }
+ if (this.canvas) {
+ let onlyCssZoom = false;
+ if (this.#hasRestrictedScaling) {
+ if (this.maxCanvasPixels === 0) {
+ onlyCssZoom = true;
+ } else if (this.maxCanvasPixels > 0) {
+ const {
+ width,
+ height
+ } = this.viewport;
+ const {
+ sx,
+ sy
+ } = this.outputScale;
+ onlyCssZoom = (Math.floor(width) * sx | 0) * (Math.floor(height) * sy | 0) > this.maxCanvasPixels;
+ }
+ }
+ const postponeDrawing = !onlyCssZoom && drawingDelay >= 0 && drawingDelay < 1000;
+ if (postponeDrawing || onlyCssZoom) {
+ if (postponeDrawing && this.renderingState !== _ui_utils.RenderingStates.FINISHED) {
+ this.cancelRendering({
+ keepZoomLayer: true,
+ keepAnnotationLayer: true,
+ keepAnnotationEditorLayer: true,
+ keepXfaLayer: true,
+ keepTextLayer: true,
+ cancelExtraDelay: drawingDelay
+ });
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ this.#useThumbnailCanvas.directDrawing = false;
+ }
+ this.cssTransform({
+ target: this.canvas,
+ redrawAnnotationLayer: true,
+ redrawAnnotationEditorLayer: true,
+ redrawXfaLayer: true,
+ redrawTextLayer: !postponeDrawing,
+ hideTextLayer: postponeDrawing
+ });
+ if (postponeDrawing) {
+ return;
+ }
+ this.eventBus.dispatch("pagerendered", {
+ source: this,
+ pageNumber: this.id,
+ cssTransform: true,
+ timestamp: performance.now(),
+ error: this.#renderError
+ });
+ return;
+ }
+ if (!this.zoomLayer && !this.canvas.hidden) {
+ this.zoomLayer = this.canvas.parentNode;
+ this.zoomLayer.style.position = "absolute";
+ }
+ }
+ if (this.zoomLayer) {
+ this.cssTransform({
+ target: this.zoomLayer.firstChild
+ });
+ }
+ this.reset({
+ keepZoomLayer: true,
+ keepAnnotationLayer: true,
+ keepAnnotationEditorLayer: true,
+ keepXfaLayer: true,
+ keepTextLayer: true
+ });
+ }
+
+ cancelRendering({
+ keepAnnotationLayer = false,
+ keepAnnotationEditorLayer = false,
+ keepXfaLayer = false,
+ keepTextLayer = false,
+ cancelExtraDelay = 0
+ } = {}) {
+ if (this.renderTask) {
+ this.renderTask.cancel(cancelExtraDelay);
+ this.renderTask = null;
+ }
+ this.resume = null;
+ if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {
+ this.textLayer.cancel();
+ this.textLayer = null;
+ }
+ if (this.structTreeLayer && !this.textLayer) {
+ this.structTreeLayer = null;
+ }
+ if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
+ this.annotationLayer.cancel();
+ this.annotationLayer = null;
+ this._annotationCanvasMap = null;
+ }
+ if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) {
+ this.annotationEditorLayer.cancel();
+ this.annotationEditorLayer = null;
+ }
+ if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
+ this.xfaLayer.cancel();
+ this.xfaLayer = null;
+ this._textHighlighter?.disable();
+ }
+ }
+
+ cssTransform({
+ target,
+ redrawAnnotationLayer = false,
+ redrawAnnotationEditorLayer = false,
+ redrawXfaLayer = false,
+ redrawTextLayer = false,
+ hideTextLayer = false
+ }) {
+ if (!target.hasAttribute("zooming")) {
+ target.setAttribute("zooming", true);
+ const {
+ style
+ } = target;
+ style.width = style.height = "";
+ }
+ const originalViewport = this.#viewportMap.get(target);
+ if (this.viewport !== originalViewport) {
+ const relativeRotation = this.viewport.rotation - originalViewport.rotation;
+ const absRotation = Math.abs(relativeRotation);
+ let scaleX = 1,
+ scaleY = 1;
+ if (absRotation === 90 || absRotation === 270) {
+ const {
+ width,
+ height
+ } = this.viewport;
+ scaleX = height / width;
+ scaleY = width / height;
+ }
+ target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
+ }
+ if (redrawAnnotationLayer && this.annotationLayer) {
+ this.#renderAnnotationLayer();
+ }
+ if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {
+ this.#renderAnnotationEditorLayer();
+ }
+ if (redrawXfaLayer && this.xfaLayer) {
+ this.#renderXfaLayer();
+ }
+ if (this.textLayer) {
+ if (hideTextLayer) {
+ this.textLayer.hide();
+ this.structTreeLayer?.hide();
+ } else if (redrawTextLayer) {
+ this.#renderTextLayer();
+ }
+ }
+ }
+
+ get width() {
+ return this.viewport.width;
+ }
+
+ get height() {
+ return this.viewport.height;
+ }
+
+ getPagePoint(x, y) {
+ return this.viewport.convertToPdfPoint(x, y);
+ }
+
+ async #finishRenderTask(renderTask, error = null) {
+ if (renderTask === this.renderTask) {
+ this.renderTask = null;
+ }
+ if (error instanceof _pdfjsLib.RenderingCancelledException) {
+ this.#renderError = null;
+ return;
+ }
+ this.#renderError = error;
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ this._resetZoomLayer(true);
+ this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;
+ this.eventBus.dispatch("pagerendered", {
+ source: this,
+ pageNumber: this.id,
+ cssTransform: false,
+ timestamp: performance.now(),
+ error: this.#renderError
+ });
+ if (error) {
+ throw error;
+ }
+ }
+
+ async draw() {
+ if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
+ console.error("Must be in new state before drawing");
+ this.reset();
+ }
+ const {
+ div,
+ l10n,
+ pageColors,
+ pdfPage,
+ viewport
+ } = this;
+ if (!pdfPage) {
+ this.renderingState = _ui_utils.RenderingStates.FINISHED;
+ throw new Error("pdfPage is not loaded");
+ }
+ this.renderingState = _ui_utils.RenderingStates.RUNNING;
+ const canvasWrapper = document.createElement("div");
+ canvasWrapper.classList.add("canvasWrapper");
+ div.append(canvasWrapper);
+ if (!this.textLayer && this.#textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
+ this._accessibilityManager ||= new _text_accessibility.TextAccessibilityManager();
+ this.textLayer = new _text_layer_builder.TextLayerBuilder({
+ highlighter: this._textHighlighter,
+ accessibilityManager: this._accessibilityManager,
+ isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,
+ enablePermissions: this.#textLayerMode === _ui_utils.TextLayerMode.ENABLE_PERMISSIONS
+ });
+ div.append(this.textLayer.div);
+ }
+ if (!this.annotationLayer && this.#annotationMode !== _pdfjsLib.AnnotationMode.DISABLE) {
+ const {
+ annotationStorage,
+ downloadManager,
+ enableScripting,
+ fieldObjectsPromise,
+ hasJSActionsPromise,
+ linkService
+ } = this.#layerProperties();
+ this._annotationCanvasMap ||= new Map();
+ this.annotationLayer = new _annotation_layer_builder.AnnotationLayerBuilder({
+ pageDiv: div,
+ pdfPage,
+ annotationStorage,
+ imageResourcesPath: this.imageResourcesPath,
+ renderForms: this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS,
+ linkService,
+ downloadManager,
+ l10n,
+ enableScripting,
+ hasJSActionsPromise,
+ fieldObjectsPromise,
+ annotationCanvasMap: this._annotationCanvasMap,
+ accessibilityManager: this._accessibilityManager
+ });
+ }
+ const renderContinueCallback = cont => {
+ showCanvas?.(false);
+ if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) {
+ this.renderingState = _ui_utils.RenderingStates.PAUSED;
+ this.resume = () => {
+ this.renderingState = _ui_utils.RenderingStates.RUNNING;
+ cont();
+ };
+ return;
+ }
+ cont();
+ };
+ const {
+ width,
+ height
+ } = viewport;
+ const canvas = document.createElement("canvas");
+ canvas.setAttribute("role", "presentation");
+ canvas.hidden = true;
+ const hasHCM = !!(pageColors?.background && pageColors?.foreground);
+ let showCanvas = isLastShow => {
+ if (!hasHCM || isLastShow) {
+ canvas.hidden = false;
+ showCanvas = null;
+ }
+ };
+ canvasWrapper.append(canvas);
+ this.canvas = canvas;
+ const ctx = canvas.getContext("2d", {
+ alpha: false
+ });
+ const outputScale = this.outputScale = new _ui_utils.OutputScale();
+ if (this.maxCanvasPixels === 0) {
+ const invScale = 1 / this.scale;
+ outputScale.sx *= invScale;
+ outputScale.sy *= invScale;
+ this.#hasRestrictedScaling = true;
+ } else if (this.maxCanvasPixels > 0) {
+ const pixelsInViewport = width * height;
+ const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
+ if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
+ outputScale.sx = maxScale;
+ outputScale.sy = maxScale;
+ this.#hasRestrictedScaling = true;
+ } else {
+ this.#hasRestrictedScaling = false;
+ }
+ }
+ const sfx = (0, _ui_utils.approximateFraction)(outputScale.sx);
+ const sfy = (0, _ui_utils.approximateFraction)(outputScale.sy);
+ canvas.width = (0, _ui_utils.roundToDivide)(width * outputScale.sx, sfx[0]);
+ canvas.height = (0, _ui_utils.roundToDivide)(height * outputScale.sy, sfy[0]);
+ const {
+ style
+ } = canvas;
+ style.width = (0, _ui_utils.roundToDivide)(width, sfx[1]) + "px";
+ style.height = (0, _ui_utils.roundToDivide)(height, sfy[1]) + "px";
+ this.#viewportMap.set(canvas, viewport);
+ const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
+ const renderContext = {
+ canvasContext: ctx,
+ transform,
+ viewport,
+ annotationMode: this.#annotationMode,
+ optionalContentConfigPromise: this._optionalContentConfigPromise,
+ annotationCanvasMap: this._annotationCanvasMap,
+ pageColors
+ };
+ const renderTask = this.renderTask = this.pdfPage.render(renderContext);
+ renderTask.onContinue = renderContinueCallback;
+ const resultPromise = renderTask.promise.then(async () => {
+ showCanvas?.(true);
+ await this.#finishRenderTask(renderTask);
+ this.#renderTextLayer();
+ if (this.annotationLayer) {
+ await this.#renderAnnotationLayer();
+ }
+ if (!this.annotationEditorLayer) {
+ const {
+ annotationEditorUIManager
+ } = this.#layerProperties();
+ if (!annotationEditorUIManager) {
+ return;
+ }
+ this.annotationEditorLayer = new _annotation_editor_layer_builder.AnnotationEditorLayerBuilder({
+ uiManager: annotationEditorUIManager,
+ pageDiv: div,
+ pdfPage,
+ l10n,
+ accessibilityManager: this._accessibilityManager,
+ annotationLayer: this.annotationLayer?.annotationLayer
+ });
+ }
+ this.#renderAnnotationEditorLayer();
+ }, error => {
+ if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
+ showCanvas?.(true);
+ }
+ return this.#finishRenderTask(renderTask, error);
+ });
+ if (pdfPage.isPureXfa) {
+ if (!this.xfaLayer) {
+ const {
+ annotationStorage,
+ linkService
+ } = this.#layerProperties();
+ this.xfaLayer = new _xfa_layer_builder.XfaLayerBuilder({
+ pageDiv: div,
+ pdfPage,
+ annotationStorage,
+ linkService
+ });
+ } else if (this.xfaLayer.div) {
+ div.append(this.xfaLayer.div);
+ }
+ this.#renderXfaLayer();
+ }
+ div.setAttribute("data-loaded", true);
+ this.eventBus.dispatch("pagerender", {
+ source: this,
+ pageNumber: this.id
+ });
+ return resultPromise;
+ }
+
+ setPageLabel(label) {
+ this.pageLabel = typeof label === "string" ? label : null;
+ if (this.pageLabel !== null) {
+ this.div.setAttribute("data-page-label", this.pageLabel);
+ } else {
+ this.div.removeAttribute("data-page-label");
+ }
+ }
+
+ get thumbnailCanvas() {
+ const {
+ directDrawing,
+ initialOptionalContent,
+ regularAnnotations
+ } = this.#useThumbnailCanvas;
+ return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null;
+ }
+ }
+
+ exports.PDFPageView = PDFPageView;
+
+ /***/
+ }),
+ /* 32 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.AnnotationEditorLayerBuilder = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _l10n_utils = __webpack_require__(30);
+
+ class AnnotationEditorLayerBuilder {
+ #annotationLayer = null;
+ #uiManager;
+
+ constructor(options) {
+ this.pageDiv = options.pageDiv;
+ this.pdfPage = options.pdfPage;
+ this.accessibilityManager = options.accessibilityManager;
+ this.l10n = options.l10n || _l10n_utils.NullL10n;
+ this.annotationEditorLayer = null;
+ this.div = null;
+ this._cancelled = false;
+ this.#uiManager = options.uiManager;
+ this.#annotationLayer = options.annotationLayer || null;
+ }
+
+ async render(viewport, intent = "display") {
+ if (intent !== "display") {
+ return;
+ }
+ if (this._cancelled) {
+ return;
+ }
+ const clonedViewport = viewport.clone({
+ dontFlip: true
+ });
+ if (this.div) {
+ this.annotationEditorLayer.update({
+ viewport: clonedViewport
+ });
+ this.show();
+ return;
+ }
+ const div = this.div = document.createElement("div");
+ div.className = "annotationEditorLayer";
+ div.tabIndex = 0;
+ div.hidden = true;
+ div.dir = this.#uiManager.direction;
+ this.pageDiv.append(div);
+ this.annotationEditorLayer = new _pdfjsLib.AnnotationEditorLayer({
+ uiManager: this.#uiManager,
+ div,
+ accessibilityManager: this.accessibilityManager,
+ pageIndex: this.pdfPage.pageNumber - 1,
+ l10n: this.l10n,
+ viewport: clonedViewport,
+ annotationLayer: this.#annotationLayer
+ });
+ const parameters = {
+ viewport: clonedViewport,
+ div,
+ annotations: null,
+ intent
+ };
+ this.annotationEditorLayer.render(parameters);
+ this.show();
+ }
+
+ cancel() {
+ this._cancelled = true;
+ if (!this.div) {
+ return;
+ }
+ this.pageDiv = null;
+ this.annotationEditorLayer.destroy();
+ this.div.remove();
+ }
+
+ hide() {
+ if (!this.div) {
+ return;
+ }
+ this.div.hidden = true;
+ }
+
+ show() {
+ if (!this.div || this.annotationEditorLayer.isEmpty) {
+ return;
+ }
+ this.div.hidden = false;
+ }
+ }
+
+ exports.AnnotationEditorLayerBuilder = AnnotationEditorLayerBuilder;
+
+ /***/
+ }),
+ /* 33 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.AnnotationLayerBuilder = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _l10n_utils = __webpack_require__(30);
+ var _ui_utils = __webpack_require__(3);
+
+ class AnnotationLayerBuilder {
+ #onPresentationModeChanged = null;
+
+ constructor({
+ pageDiv,
+ pdfPage,
+ linkService,
+ downloadManager,
+ annotationStorage = null,
+ imageResourcesPath = "",
+ renderForms = true,
+ l10n = _l10n_utils.NullL10n,
+ enableScripting = false,
+ hasJSActionsPromise = null,
+ fieldObjectsPromise = null,
+ annotationCanvasMap = null,
+ accessibilityManager = null
+ }) {
+ this.pageDiv = pageDiv;
+ this.pdfPage = pdfPage;
+ this.linkService = linkService;
+ this.downloadManager = downloadManager;
+ this.imageResourcesPath = imageResourcesPath;
+ this.renderForms = renderForms;
+ this.l10n = l10n;
+ this.annotationStorage = annotationStorage;
+ this.enableScripting = enableScripting;
+ this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);
+ this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);
+ this._annotationCanvasMap = annotationCanvasMap;
+ this._accessibilityManager = accessibilityManager;
+ this.annotationLayer = null;
+ this.div = null;
+ this._cancelled = false;
+ this._eventBus = linkService.eventBus;
+ }
+
+ async render(viewport, intent = "display") {
+ if (this.div) {
+ if (this._cancelled || !this.annotationLayer) {
+ return;
+ }
+ this.annotationLayer.update({
+ viewport: viewport.clone({
+ dontFlip: true
+ })
+ });
+ return;
+ }
+ const [annotations, hasJSActions, fieldObjects] = await Promise.all([this.pdfPage.getAnnotations({
+ intent
+ }), this._hasJSActionsPromise, this._fieldObjectsPromise]);
+ if (this._cancelled) {
+ return;
+ }
+ const div = this.div = document.createElement("div");
+ div.className = "annotationLayer";
+ this.pageDiv.append(div);
+ if (annotations.length === 0) {
+ this.hide();
+ return;
+ }
+ this.annotationLayer = new _pdfjsLib.AnnotationLayer({
+ div,
+ accessibilityManager: this._accessibilityManager,
+ annotationCanvasMap: this._annotationCanvasMap,
+ l10n: this.l10n,
+ page: this.pdfPage,
+ viewport: viewport.clone({
+ dontFlip: true
+ })
+ });
+ await this.annotationLayer.render({
+ annotations,
+ imageResourcesPath: this.imageResourcesPath,
+ renderForms: this.renderForms,
+ linkService: this.linkService,
+ downloadManager: this.downloadManager,
+ annotationStorage: this.annotationStorage,
+ enableScripting: this.enableScripting,
+ hasJSActions,
+ fieldObjects
+ });
+ if (this.linkService.isInPresentationMode) {
+ this.#updatePresentationModeState(_ui_utils.PresentationModeState.FULLSCREEN);
+ }
+ if (!this.#onPresentationModeChanged) {
+ this.#onPresentationModeChanged = evt => {
+ this.#updatePresentationModeState(evt.state);
+ };
+ this._eventBus?._on("presentationmodechanged", this.#onPresentationModeChanged);
+ }
+ }
+
+ cancel() {
+ this._cancelled = true;
+ if (this.#onPresentationModeChanged) {
+ this._eventBus?._off("presentationmodechanged", this.#onPresentationModeChanged);
+ this.#onPresentationModeChanged = null;
+ }
+ }
+
+ hide() {
+ if (!this.div) {
+ return;
+ }
+ this.div.hidden = true;
+ }
+
+ #updatePresentationModeState(state) {
+ if (!this.div) {
+ return;
+ }
+ let disableFormElements = false;
+ switch (state) {
+ case _ui_utils.PresentationModeState.FULLSCREEN:
+ disableFormElements = true;
+ break;
+ case _ui_utils.PresentationModeState.NORMAL:
+ break;
+ default:
+ return;
+ }
+ for (const section of this.div.childNodes) {
+ if (section.hasAttribute("data-internal-link")) {
+ continue;
+ }
+ section.inert = disableFormElements;
+ }
+ }
+ }
+
+ exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
+
+ /***/
+ }),
+ /* 34 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.StructTreeLayerBuilder = void 0;
+ var _ui_utils = __webpack_require__(3);
+ const PDF_ROLE_TO_HTML_ROLE = {
+ Document: null,
+ DocumentFragment: null,
+ Part: "group",
+ Sect: "group",
+ Div: "group",
+ Aside: "note",
+ NonStruct: "none",
+ P: null,
+ H: "heading",
+ Title: null,
+ FENote: "note",
+ Sub: "group",
+ Lbl: null,
+ Span: null,
+ Em: null,
+ Strong: null,
+ Link: "link",
+ Annot: "note",
+ Form: "form",
+ Ruby: null,
+ RB: null,
+ RT: null,
+ RP: null,
+ Warichu: null,
+ WT: null,
+ WP: null,
+ L: "list",
+ LI: "listitem",
+ LBody: null,
+ Table: "table",
+ TR: "row",
+ TH: "columnheader",
+ TD: "cell",
+ THead: "columnheader",
+ TBody: null,
+ TFoot: null,
+ Caption: null,
+ Figure: "figure",
+ Formula: null,
+ Artifact: null
+ };
+ const HEADING_PATTERN = /^H(\d+)$/;
+
+ class StructTreeLayerBuilder {
+ #treeDom = undefined;
+
+ get renderingDone() {
+ return this.#treeDom !== undefined;
+ }
+
+ render(structTree) {
+ if (this.#treeDom !== undefined) {
+ return this.#treeDom;
+ }
+ const treeDom = this.#walk(structTree);
+ treeDom?.classList.add("structTree");
+ return this.#treeDom = treeDom;
+ }
+
+ hide() {
+ if (this.#treeDom && !this.#treeDom.hidden) {
+ this.#treeDom.hidden = true;
+ }
+ }
+
+ show() {
+ if (this.#treeDom?.hidden) {
+ this.#treeDom.hidden = false;
+ }
+ }
+
+ #setAttributes(structElement, htmlElement) {
+ const {
+ alt,
+ id,
+ lang
+ } = structElement;
+ if (alt !== undefined) {
+ htmlElement.setAttribute("aria-label", (0, _ui_utils.removeNullCharacters)(alt));
+ }
+ if (id !== undefined) {
+ htmlElement.setAttribute("aria-owns", id);
+ }
+ if (lang !== undefined) {
+ htmlElement.setAttribute("lang", (0, _ui_utils.removeNullCharacters)(lang, true));
+ }
+ }
+
+ #walk(node) {
+ if (!node) {
+ return null;
+ }
+ const element = document.createElement("span");
+ if ("role" in node) {
+ const {
+ role
+ } = node;
+ const match = role.match(HEADING_PATTERN);
+ if (match) {
+ element.setAttribute("role", "heading");
+ element.setAttribute("aria-level", match[1]);
+ } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
+ element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
+ }
+ }
+ this.#setAttributes(node, element);
+ if (node.children) {
+ if (node.children.length === 1 && "id" in node.children[0]) {
+ this.#setAttributes(node.children[0], element);
+ } else {
+ for (const kid of node.children) {
+ element.append(this.#walk(kid));
+ }
+ }
+ }
+ return element;
+ }
+ }
+
+ exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
+
+ /***/
+ }),
+ /* 35 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.TextAccessibilityManager = void 0;
+ var _ui_utils = __webpack_require__(3);
+
+ class TextAccessibilityManager {
+ #enabled = false;
+ #textChildren = null;
+ #textNodes = new Map();
+ #waitingElements = new Map();
+
+ setTextMapping(textDivs) {
+ this.#textChildren = textDivs;
+ }
+
+ static #compareElementPositions(e1, e2) {
+ const rect1 = e1.getBoundingClientRect();
+ const rect2 = e2.getBoundingClientRect();
+ if (rect1.width === 0 && rect1.height === 0) {
+ return +1;
+ }
+ if (rect2.width === 0 && rect2.height === 0) {
+ return -1;
+ }
+ const top1 = rect1.y;
+ const bot1 = rect1.y + rect1.height;
+ const mid1 = rect1.y + rect1.height / 2;
+ const top2 = rect2.y;
+ const bot2 = rect2.y + rect2.height;
+ const mid2 = rect2.y + rect2.height / 2;
+ if (mid1 <= top2 && mid2 >= bot1) {
+ return -1;
+ }
+ if (mid2 <= top1 && mid1 >= bot2) {
+ return +1;
+ }
+ const centerX1 = rect1.x + rect1.width / 2;
+ const centerX2 = rect2.x + rect2.width / 2;
+ return centerX1 - centerX2;
+ }
+
+ enable() {
+ if (this.#enabled) {
+ throw new Error("TextAccessibilityManager is already enabled.");
+ }
+ if (!this.#textChildren) {
+ throw new Error("Text divs and strings have not been set.");
+ }
+ this.#enabled = true;
+ this.#textChildren = this.#textChildren.slice();
+ this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);
+ if (this.#textNodes.size > 0) {
+ const textChildren = this.#textChildren;
+ for (const [id, nodeIndex] of this.#textNodes) {
+ const element = document.getElementById(id);
+ if (!element) {
+ this.#textNodes.delete(id);
+ continue;
+ }
+ this.#addIdToAriaOwns(id, textChildren[nodeIndex]);
+ }
+ }
+ for (const [element, isRemovable] of this.#waitingElements) {
+ this.addPointerInTextLayer(element, isRemovable);
+ }
+ this.#waitingElements.clear();
+ }
+
+ disable() {
+ if (!this.#enabled) {
+ return;
+ }
+ this.#waitingElements.clear();
+ this.#textChildren = null;
+ this.#enabled = false;
+ }
+
+ removePointerInTextLayer(element) {
+ if (!this.#enabled) {
+ this.#waitingElements.delete(element);
+ return;
+ }
+ const children = this.#textChildren;
+ if (!children || children.length === 0) {
+ return;
+ }
+ const {
+ id
+ } = element;
+ const nodeIndex = this.#textNodes.get(id);
+ if (nodeIndex === undefined) {
+ return;
+ }
+ const node = children[nodeIndex];
+ this.#textNodes.delete(id);
+ let owns = node.getAttribute("aria-owns");
+ if (owns?.includes(id)) {
+ owns = owns.split(" ").filter(x => x !== id).join(" ");
+ if (owns) {
+ node.setAttribute("aria-owns", owns);
+ } else {
+ node.removeAttribute("aria-owns");
+ node.setAttribute("role", "presentation");
+ }
+ }
+ }
+
+ #addIdToAriaOwns(id, node) {
+ const owns = node.getAttribute("aria-owns");
+ if (!owns?.includes(id)) {
+ node.setAttribute("aria-owns", owns ? `${owns} ${id}` : id);
+ }
+ node.removeAttribute("role");
+ }
+
+ addPointerInTextLayer(element, isRemovable) {
+ const {
+ id
+ } = element;
+ if (!id) {
+ return null;
+ }
+ if (!this.#enabled) {
+ this.#waitingElements.set(element, isRemovable);
+ return null;
+ }
+ if (isRemovable) {
+ this.removePointerInTextLayer(element);
+ }
+ const children = this.#textChildren;
+ if (!children || children.length === 0) {
+ return null;
+ }
+ const index = (0, _ui_utils.binarySearchFirstItem)(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0);
+ const nodeIndex = Math.max(0, index - 1);
+ const child = children[nodeIndex];
+ this.#addIdToAriaOwns(id, child);
+ this.#textNodes.set(id, nodeIndex);
+ const parent = child.parentNode;
+ return parent?.classList.contains("markedContent") ? parent.id : null;
+ }
+
+ moveElementInDOM(container, element, contentElement, isRemovable) {
+ const id = this.addPointerInTextLayer(contentElement, isRemovable);
+ if (!container.hasChildNodes()) {
+ container.append(element);
+ return id;
+ }
+ const children = Array.from(container.childNodes).filter(node => node !== element);
+ if (children.length === 0) {
+ return id;
+ }
+ const elementToCompare = contentElement || element;
+ const index = (0, _ui_utils.binarySearchFirstItem)(children, node => TextAccessibilityManager.#compareElementPositions(elementToCompare, node) < 0);
+ if (index === 0) {
+ children[0].before(element);
+ } else {
+ children[index - 1].after(element);
+ }
+ return id;
+ }
+ }
+
+ exports.TextAccessibilityManager = TextAccessibilityManager;
+
+ /***/
+ }),
+ /* 36 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.TextHighlighter = void 0;
+
+ class TextHighlighter {
+ constructor({
+ findController,
+ eventBus,
+ pageIndex
+ }) {
+ this.findController = findController;
+ this.matches = [];
+ this.eventBus = eventBus;
+ this.pageIdx = pageIndex;
+ this._onUpdateTextLayerMatches = null;
+ this.textDivs = null;
+ this.textContentItemsStr = null;
+ this.enabled = false;
+ }
+
+ setTextMapping(divs, texts) {
+ this.textDivs = divs;
+ this.textContentItemsStr = texts;
+ }
+
+ enable() {
+ if (!this.textDivs || !this.textContentItemsStr) {
+ throw new Error("Text divs and strings have not been set.");
+ }
+ if (this.enabled) {
+ throw new Error("TextHighlighter is already enabled.");
+ }
+ this.enabled = true;
+ if (!this._onUpdateTextLayerMatches) {
+ this._onUpdateTextLayerMatches = evt => {
+ if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {
+ this._updateMatches();
+ }
+ };
+ this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
+ }
+ this._updateMatches();
+ }
+
+ disable() {
+ if (!this.enabled) {
+ return;
+ }
+ this.enabled = false;
+ if (this._onUpdateTextLayerMatches) {
+ this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
+ this._onUpdateTextLayerMatches = null;
+ }
+ this._updateMatches(true);
+ }
+
+ _convertMatches(matches, matchesLength) {
+ if (!matches) {
+ return [];
+ }
+ const {
+ textContentItemsStr
+ } = this;
+ let i = 0,
+ iIndex = 0;
+ const end = textContentItemsStr.length - 1;
+ const result = [];
+ for (let m = 0, mm = matches.length; m < mm; m++) {
+ let matchIdx = matches[m];
+ while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
+ iIndex += textContentItemsStr[i].length;
+ i++;
+ }
+ if (i === textContentItemsStr.length) {
+ console.error("Could not find a matching mapping");
+ }
+ const match = {
+ begin: {
+ divIdx: i,
+ offset: matchIdx - iIndex
+ }
+ };
+ matchIdx += matchesLength[m];
+ while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
+ iIndex += textContentItemsStr[i].length;
+ i++;
+ }
+ match.end = {
+ divIdx: i,
+ offset: matchIdx - iIndex
+ };
+ result.push(match);
+ }
+ return result;
+ }
+
+ _renderMatches(matches) {
+ if (matches.length === 0) {
+ return;
+ }
+ const {
+ findController,
+ pageIdx
+ } = this;
+ const {
+ textContentItemsStr,
+ textDivs
+ } = this;
+ const isSelectedPage = pageIdx === findController.selected.pageIdx;
+ const selectedMatchIdx = findController.selected.matchIdx;
+ const highlightAll = findController.state.highlightAll;
+ let prevEnd = null;
+ const infinity = {
+ divIdx: -1,
+ offset: undefined
+ };
+
+ function beginText(begin, className) {
+ const divIdx = begin.divIdx;
+ textDivs[divIdx].textContent = "";
+ return appendTextToDiv(divIdx, 0, begin.offset, className);
+ }
+
+ function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
+ let div = textDivs[divIdx];
+ if (div.nodeType === Node.TEXT_NODE) {
+ const span = document.createElement("span");
+ div.before(span);
+ span.append(div);
+ textDivs[divIdx] = span;
+ div = span;
+ }
+ const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
+ const node = document.createTextNode(content);
+ if (className) {
+ const span = document.createElement("span");
+ span.className = `${className} appended`;
+ span.append(node);
+ div.append(span);
+ return className.includes("selected") ? span.offsetLeft : 0;
+ }
+ div.append(node);
+ return 0;
+ }
+
+ let i0 = selectedMatchIdx,
+ i1 = i0 + 1;
+ if (highlightAll) {
+ i0 = 0;
+ i1 = matches.length;
+ } else if (!isSelectedPage) {
+ return;
+ }
+ let lastDivIdx = -1;
+ let lastOffset = -1;
+ for (let i = i0; i < i1; i++) {
+ const match = matches[i];
+ const begin = match.begin;
+ if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) {
+ continue;
+ }
+ lastDivIdx = begin.divIdx;
+ lastOffset = begin.offset;
+ const end = match.end;
+ const isSelected = isSelectedPage && i === selectedMatchIdx;
+ const highlightSuffix = isSelected ? " selected" : "";
+ let selectedLeft = 0;
+ if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
+ if (prevEnd !== null) {
+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
+ }
+ beginText(begin);
+ } else {
+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
+ }
+ if (begin.divIdx === end.divIdx) {
+ selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
+ } else {
+ selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
+ for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
+ textDivs[n0].className = "highlight middle" + highlightSuffix;
+ }
+ beginText(end, "highlight end" + highlightSuffix);
+ }
+ prevEnd = end;
+ if (isSelected) {
+ findController.scrollMatchIntoView({
+ element: textDivs[begin.divIdx],
+ selectedLeft,
+ pageIndex: pageIdx,
+ matchIndex: selectedMatchIdx
+ });
+ }
+ }
+ if (prevEnd) {
+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
+ }
+ }
+
+ _updateMatches(reset = false) {
+ if (!this.enabled && !reset) {
+ return;
+ }
+ const {
+ findController,
+ matches,
+ pageIdx
+ } = this;
+ const {
+ textContentItemsStr,
+ textDivs
+ } = this;
+ let clearedUntilDivIdx = -1;
+ for (const match of matches) {
+ const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
+ for (let n = begin, end = match.end.divIdx; n <= end; n++) {
+ const div = textDivs[n];
+ div.textContent = textContentItemsStr[n];
+ div.className = "";
+ }
+ clearedUntilDivIdx = match.end.divIdx + 1;
+ }
+ if (!findController?.highlightMatches || reset) {
+ return;
+ }
+ const pageMatches = findController.pageMatches[pageIdx] || null;
+ const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
+ this.matches = this._convertMatches(pageMatches, pageMatchesLength);
+ this._renderMatches(this.matches);
+ }
+ }
+
+ exports.TextHighlighter = TextHighlighter;
+
+ /***/
+ }),
+ /* 37 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.TextLayerBuilder = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _ui_utils = __webpack_require__(3);
+
+ class TextLayerBuilder {
+ #enablePermissions = false;
+ #rotation = 0;
+ #scale = 0;
+ #textContentSource = null;
+
+ constructor({
+ highlighter = null,
+ accessibilityManager = null,
+ isOffscreenCanvasSupported = true,
+ enablePermissions = false
+ }) {
+ this.textContentItemsStr = [];
+ this.renderingDone = false;
+ this.textDivs = [];
+ this.textDivProperties = new WeakMap();
+ this.textLayerRenderTask = null;
+ this.highlighter = highlighter;
+ this.accessibilityManager = accessibilityManager;
+ this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;
+ this.#enablePermissions = enablePermissions === true;
+ this.div = document.createElement("div");
+ this.div.className = "textLayer";
+ this.hide();
+ }
+
+ #finishRendering() {
+ this.renderingDone = true;
+ const endOfContent = document.createElement("div");
+ endOfContent.className = "endOfContent";
+ this.div.append(endOfContent);
+ this.#bindMouse();
+ }
+
+ get numTextDivs() {
+ return this.textDivs.length;
+ }
+
+ async render(viewport) {
+ if (!this.#textContentSource) {
+ throw new Error('No "textContentSource" parameter specified.');
+ }
+ const scale = viewport.scale * (globalThis.devicePixelRatio || 1);
+ const {
+ rotation
+ } = viewport;
+ if (this.renderingDone) {
+ const mustRotate = rotation !== this.#rotation;
+ const mustRescale = scale !== this.#scale;
+ if (mustRotate || mustRescale) {
+ this.hide();
+ (0, _pdfjsLib.updateTextLayer)({
+ container: this.div,
+ viewport,
+ textDivs: this.textDivs,
+ textDivProperties: this.textDivProperties,
+ isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,
+ mustRescale,
+ mustRotate
+ });
+ this.#scale = scale;
+ this.#rotation = rotation;
+ }
+ this.show();
+ return;
+ }
+ this.cancel();
+ this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);
+ this.accessibilityManager?.setTextMapping(this.textDivs);
+ this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
+ textContentSource: this.#textContentSource,
+ container: this.div,
+ viewport,
+ textDivs: this.textDivs,
+ textDivProperties: this.textDivProperties,
+ textContentItemsStr: this.textContentItemsStr,
+ isOffscreenCanvasSupported: this.isOffscreenCanvasSupported
+ });
+ await this.textLayerRenderTask.promise;
+ this.#finishRendering();
+ this.#scale = scale;
+ this.#rotation = rotation;
+ this.show();
+ this.accessibilityManager?.enable();
+ }
+
+ hide() {
+ if (!this.div.hidden) {
+ this.highlighter?.disable();
+ this.div.hidden = true;
+ }
+ }
+
+ show() {
+ if (this.div.hidden && this.renderingDone) {
+ this.div.hidden = false;
+ this.highlighter?.enable();
+ }
+ }
+
+ cancel() {
+ if (this.textLayerRenderTask) {
+ this.textLayerRenderTask.cancel();
+ this.textLayerRenderTask = null;
+ }
+ this.highlighter?.disable();
+ this.accessibilityManager?.disable();
+ this.textContentItemsStr.length = 0;
+ this.textDivs.length = 0;
+ this.textDivProperties = new WeakMap();
+ }
+
+ setTextContentSource(source) {
+ this.cancel();
+ this.#textContentSource = source;
+ }
+
+ #bindMouse() {
+ const {
+ div
+ } = this;
+ div.addEventListener("mousedown", evt => {
+ const end = div.querySelector(".endOfContent");
+ if (!end) {
+ return;
+ }
+ let adjustTop = evt.target !== div;
+ adjustTop &&= getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
+ if (adjustTop) {
+ const divBounds = div.getBoundingClientRect();
+ const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
+ end.style.top = (r * 100).toFixed(2) + "%";
+ }
+ end.classList.add("active");
+ });
+ div.addEventListener("mouseup", () => {
+ const end = div.querySelector(".endOfContent");
+ if (!end) {
+ return;
+ }
+ end.style.top = "";
+ end.classList.remove("active");
+ });
+ div.addEventListener("copy", event => {
+ if (!this.#enablePermissions) {
+ const selection = document.getSelection();
+ event.clipboardData.setData("text/plain", (0, _ui_utils.removeNullCharacters)((0, _pdfjsLib.normalizeUnicode)(selection.toString())));
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ });
+ }
+ }
+
+ exports.TextLayerBuilder = TextLayerBuilder;
+
+ /***/
+ }),
+ /* 38 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.XfaLayerBuilder = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+
+ class XfaLayerBuilder {
+ constructor({
+ pageDiv,
+ pdfPage,
+ annotationStorage = null,
+ linkService,
+ xfaHtml = null
+ }) {
+ this.pageDiv = pageDiv;
+ this.pdfPage = pdfPage;
+ this.annotationStorage = annotationStorage;
+ this.linkService = linkService;
+ this.xfaHtml = xfaHtml;
+ this.div = null;
+ this._cancelled = false;
+ }
+
+ async render(viewport, intent = "display") {
+ if (intent === "print") {
+ const parameters = {
+ viewport: viewport.clone({
+ dontFlip: true
+ }),
+ div: this.div,
+ xfaHtml: this.xfaHtml,
+ annotationStorage: this.annotationStorage,
+ linkService: this.linkService,
+ intent
+ };
+ const div = document.createElement("div");
+ this.pageDiv.append(div);
+ parameters.div = div;
+ return _pdfjsLib.XfaLayer.render(parameters);
+ }
+ const xfaHtml = await this.pdfPage.getXfa();
+ if (this._cancelled || !xfaHtml) {
+ return {
+ textDivs: []
+ };
+ }
+ const parameters = {
+ viewport: viewport.clone({
+ dontFlip: true
+ }),
+ div: this.div,
+ xfaHtml,
+ annotationStorage: this.annotationStorage,
+ linkService: this.linkService,
+ intent
+ };
+ if (this.div) {
+ return _pdfjsLib.XfaLayer.update(parameters);
+ }
+ this.div = document.createElement("div");
+ this.pageDiv.append(this.div);
+ parameters.div = this.div;
+ return _pdfjsLib.XfaLayer.render(parameters);
+ }
+
+ cancel() {
+ this._cancelled = true;
+ }
+
+ hide() {
+ if (!this.div) {
+ return;
+ }
+ this.div.hidden = true;
+ }
+ }
+
+ exports.XfaLayerBuilder = XfaLayerBuilder;
+
+ /***/
+ }),
+ /* 39 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.SecondaryToolbar = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdf_viewer = __webpack_require__(29);
+
+ class SecondaryToolbar {
+ constructor(options, eventBus) {
+ this.toolbar = options.toolbar;
+ this.toggleButton = options.toggleButton;
+ this.buttons = [{
+ element: options.presentationModeButton,
+ eventName: "presentationmode",
+ close: true
+ }, {
+ element: options.printButton,
+ eventName: "print",
+ close: true
+ }, {
+ element: options.downloadButton,
+ eventName: "download",
+ close: true
+ }, {
+ element: options.viewBookmarkButton,
+ eventName: null,
+ close: true
+ }, {
+ element: options.firstPageButton,
+ eventName: "firstpage",
+ close: true
+ }, {
+ element: options.lastPageButton,
+ eventName: "lastpage",
+ close: true
+ }, {
+ element: options.pageRotateCwButton,
+ eventName: "rotatecw",
+ close: false
+ }, {
+ element: options.pageRotateCcwButton,
+ eventName: "rotateccw",
+ close: false
+ }, {
+ element: options.cursorSelectToolButton,
+ eventName: "switchcursortool",
+ eventDetails: {
+ tool: _ui_utils.CursorTool.SELECT
+ },
+ close: true
+ }, {
+ element: options.cursorHandToolButton,
+ eventName: "switchcursortool",
+ eventDetails: {
+ tool: _ui_utils.CursorTool.HAND
+ },
+ close: true
+ }, {
+ element: options.scrollPageButton,
+ eventName: "switchscrollmode",
+ eventDetails: {
+ mode: _ui_utils.ScrollMode.PAGE
+ },
+ close: true
+ }, {
+ element: options.scrollVerticalButton,
+ eventName: "switchscrollmode",
+ eventDetails: {
+ mode: _ui_utils.ScrollMode.VERTICAL
+ },
+ close: true
+ }, {
+ element: options.scrollHorizontalButton,
+ eventName: "switchscrollmode",
+ eventDetails: {
+ mode: _ui_utils.ScrollMode.HORIZONTAL
+ },
+ close: true
+ }, {
+ element: options.scrollWrappedButton,
+ eventName: "switchscrollmode",
+ eventDetails: {
+ mode: _ui_utils.ScrollMode.WRAPPED
+ },
+ close: true
+ }, {
+ element: options.spreadNoneButton,
+ eventName: "switchspreadmode",
+ eventDetails: {
+ mode: _ui_utils.SpreadMode.NONE
+ },
+ close: true
+ }, {
+ element: options.spreadOddButton,
+ eventName: "switchspreadmode",
+ eventDetails: {
+ mode: _ui_utils.SpreadMode.ODD
+ },
+ close: true
+ }, {
+ element: options.spreadEvenButton,
+ eventName: "switchspreadmode",
+ eventDetails: {
+ mode: _ui_utils.SpreadMode.EVEN
+ },
+ close: true
+ }, {
+ element: options.documentPropertiesButton,
+ eventName: "documentproperties",
+ close: true
+ }];
+ this.buttons.push({
+ element: options.openFileButton,
+ eventName: "openfile",
+ close: true
+ });
+ this.items = {
+ firstPage: options.firstPageButton,
+ lastPage: options.lastPageButton,
+ pageRotateCw: options.pageRotateCwButton,
+ pageRotateCcw: options.pageRotateCcwButton
+ };
+ this.eventBus = eventBus;
+ this.opened = false;
+ this.#bindClickListeners();
+ this.#bindCursorToolsListener(options);
+ this.#bindScrollModeListener(options);
+ this.#bindSpreadModeListener(options);
+ this.reset();
+ }
+
+ get isOpen() {
+ return this.opened;
+ }
+
+ setPageNumber(pageNumber) {
+ this.pageNumber = pageNumber;
+ this.#updateUIState();
+ }
+
+ setPagesCount(pagesCount) {
+ this.pagesCount = pagesCount;
+ this.#updateUIState();
+ }
+
+ reset() {
+ this.pageNumber = 0;
+ this.pagesCount = 0;
+ this.#updateUIState();
+ this.eventBus.dispatch("secondarytoolbarreset", {
+ source: this
+ });
+ }
+
+ #updateUIState() {
+ this.items.firstPage.disabled = this.pageNumber <= 1;
+ this.items.lastPage.disabled = this.pageNumber >= this.pagesCount;
+ this.items.pageRotateCw.disabled = this.pagesCount === 0;
+ this.items.pageRotateCcw.disabled = this.pagesCount === 0;
+ }
+
+ #bindClickListeners() {
+ this.toggleButton.addEventListener("click", this.toggle.bind(this));
+ for (const {
+ element,
+ eventName,
+ close,
+ eventDetails
+ } of this.buttons) {
+ element.addEventListener("click", evt => {
+ if (eventName !== null) {
+ this.eventBus.dispatch(eventName, {
+ source: this,
+ ...eventDetails
+ });
+ }
+ if (close) {
+ this.close();
+ }
+ this.eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "buttons",
+ data: {
+ id: element.id
+ }
+ }
+ });
+ });
+ }
+ }
+
+ #bindCursorToolsListener({
+ cursorSelectToolButton,
+ cursorHandToolButton
+ }) {
+ this.eventBus._on("cursortoolchanged", ({
+ tool
+ }) => {
+ (0, _ui_utils.toggleCheckedBtn)(cursorSelectToolButton, tool === _ui_utils.CursorTool.SELECT);
+ (0, _ui_utils.toggleCheckedBtn)(cursorHandToolButton, tool === _ui_utils.CursorTool.HAND);
+ });
+ }
+
+ #bindScrollModeListener({
+ scrollPageButton,
+ scrollVerticalButton,
+ scrollHorizontalButton,
+ scrollWrappedButton,
+ spreadNoneButton,
+ spreadOddButton,
+ spreadEvenButton
+ }) {
+ const scrollModeChanged = ({
+ mode
+ }) => {
+ (0, _ui_utils.toggleCheckedBtn)(scrollPageButton, mode === _ui_utils.ScrollMode.PAGE);
+ (0, _ui_utils.toggleCheckedBtn)(scrollVerticalButton, mode === _ui_utils.ScrollMode.VERTICAL);
+ (0, _ui_utils.toggleCheckedBtn)(scrollHorizontalButton, mode === _ui_utils.ScrollMode.HORIZONTAL);
+ (0, _ui_utils.toggleCheckedBtn)(scrollWrappedButton, mode === _ui_utils.ScrollMode.WRAPPED);
+ const forceScrollModePage = this.pagesCount > _pdf_viewer.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;
+ scrollPageButton.disabled = forceScrollModePage;
+ scrollVerticalButton.disabled = forceScrollModePage;
+ scrollHorizontalButton.disabled = forceScrollModePage;
+ scrollWrappedButton.disabled = forceScrollModePage;
+ const isHorizontal = mode === _ui_utils.ScrollMode.HORIZONTAL;
+ spreadNoneButton.disabled = isHorizontal;
+ spreadOddButton.disabled = isHorizontal;
+ spreadEvenButton.disabled = isHorizontal;
+ };
+ this.eventBus._on("scrollmodechanged", scrollModeChanged);
+ this.eventBus._on("secondarytoolbarreset", evt => {
+ if (evt.source === this) {
+ scrollModeChanged({
+ mode: _ui_utils.ScrollMode.VERTICAL
+ });
+ }
+ });
+ }
+
+ #bindSpreadModeListener({
+ spreadNoneButton,
+ spreadOddButton,
+ spreadEvenButton
+ }) {
+ const spreadModeChanged = ({
+ mode
+ }) => {
+ (0, _ui_utils.toggleCheckedBtn)(spreadNoneButton, mode === _ui_utils.SpreadMode.NONE);
+ (0, _ui_utils.toggleCheckedBtn)(spreadOddButton, mode === _ui_utils.SpreadMode.ODD);
+ (0, _ui_utils.toggleCheckedBtn)(spreadEvenButton, mode === _ui_utils.SpreadMode.EVEN);
+ };
+ this.eventBus._on("spreadmodechanged", spreadModeChanged);
+ this.eventBus._on("secondarytoolbarreset", evt => {
+ if (evt.source === this) {
+ spreadModeChanged({
+ mode: _ui_utils.SpreadMode.NONE
+ });
+ }
+ });
+ }
+
+ open() {
+ if (this.opened) {
+ return;
+ }
+ this.opened = true;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, true, this.toolbar);
+ }
+
+ close() {
+ if (!this.opened) {
+ return;
+ }
+ this.opened = false;
+ (0, _ui_utils.toggleExpandedBtn)(this.toggleButton, false, this.toolbar);
+ }
+
+ toggle() {
+ if (this.opened) {
+ this.close();
+ } else {
+ this.open();
+ }
+ }
+ }
+
+ exports.SecondaryToolbar = SecondaryToolbar;
+
+ /***/
+ }),
+ /* 40 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.Toolbar = void 0;
+ var _ui_utils = __webpack_require__(3);
+ var _pdfjsLib = __webpack_require__(4);
+ const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
+
+ class Toolbar {
+ #wasLocalized = false;
+
+ constructor(options, eventBus, l10n) {
+ this.toolbar = options.container;
+ this.eventBus = eventBus;
+ this.l10n = l10n;
+ this.buttons = [{
+ element: options.previous,
+ eventName: "previouspage"
+ }, {
+ element: options.next,
+ eventName: "nextpage"
+ }, {
+ element: options.zoomIn,
+ eventName: "zoomin"
+ }, {
+ element: options.zoomOut,
+ eventName: "zoomout"
+ }, {
+ element: options.print,
+ eventName: "print"
+ }, {
+ element: options.download,
+ eventName: "download"
+ }, {
+ element: options.editorFreeTextButton,
+ eventName: "switchannotationeditormode",
+ eventDetails: {
+ get mode() {
+ const {
+ classList
+ } = options.editorFreeTextButton;
+ return classList.contains("toggled") ? _pdfjsLib.AnnotationEditorType.NONE : _pdfjsLib.AnnotationEditorType.FREETEXT;
+ }
+ }
+ }, {
+ element: options.editorInkButton,
+ eventName: "switchannotationeditormode",
+ eventDetails: {
+ get mode() {
+ const {
+ classList
+ } = options.editorInkButton;
+ return classList.contains("toggled") ? _pdfjsLib.AnnotationEditorType.NONE : _pdfjsLib.AnnotationEditorType.INK;
+ }
+ }
+ }, {
+ element: options.editorStampButton,
+ eventName: "switchannotationeditormode",
+ eventDetails: {
+ get mode() {
+ const {
+ classList
+ } = options.editorStampButton;
+ return classList.contains("toggled") ? _pdfjsLib.AnnotationEditorType.NONE : _pdfjsLib.AnnotationEditorType.STAMP;
+ }
+ }
+ }];
+ this.buttons.push({
+ element: options.openFile,
+ eventName: "openfile"
+ });
+ this.items = {
+ numPages: options.numPages,
+ pageNumber: options.pageNumber,
+ scaleSelect: options.scaleSelect,
+ customScaleOption: options.customScaleOption,
+ previous: options.previous,
+ next: options.next,
+ zoomIn: options.zoomIn,
+ zoomOut: options.zoomOut
+ };
+ this.#bindListeners(options);
+ this.reset();
+ }
+
+ setPageNumber(pageNumber, pageLabel) {
+ this.pageNumber = pageNumber;
+ this.pageLabel = pageLabel;
+ this.#updateUIState(false);
+ }
+
+ setPagesCount(pagesCount, hasPageLabels) {
+ this.pagesCount = pagesCount;
+ this.hasPageLabels = hasPageLabels;
+ this.#updateUIState(true);
+ }
+
+ setPageScale(pageScaleValue, pageScale) {
+ this.pageScaleValue = (pageScaleValue || pageScale).toString();
+ this.pageScale = pageScale;
+ this.#updateUIState(false);
+ }
+
+ reset() {
+ this.pageNumber = 0;
+ this.pageLabel = null;
+ this.hasPageLabels = false;
+ this.pagesCount = 0;
+ this.pageScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
+ this.pageScale = _ui_utils.DEFAULT_SCALE;
+ this.#updateUIState(true);
+ this.updateLoadingIndicatorState();
+ this.eventBus.dispatch("toolbarreset", {
+ source: this
+ });
+ }
+
+ #bindListeners(options) {
+ const {
+ pageNumber,
+ scaleSelect
+ } = this.items;
+ const self = this;
+ for (const {
+ element,
+ eventName,
+ eventDetails
+ } of this.buttons) {
+ element.addEventListener("click", evt => {
+ if (eventName !== null) {
+ this.eventBus.dispatch(eventName, {
+ source: this,
+ ...eventDetails
+ });
+ }
+ });
+ }
+ pageNumber.addEventListener("click", function () {
+ this.select();
+ });
+ pageNumber.addEventListener("change", function () {
+ self.eventBus.dispatch("pagenumberchanged", {
+ source: self,
+ value: this.value
+ });
+ });
+ scaleSelect.addEventListener("change", function () {
+ if (this.value === "custom") {
+ return;
+ }
+ self.eventBus.dispatch("scalechanged", {
+ source: self,
+ value: this.value
+ });
+ });
+ scaleSelect.addEventListener("click", function (evt) {
+ const target = evt.target;
+ if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") {
+ this.blur();
+ }
+ });
+ scaleSelect.oncontextmenu = _pdfjsLib.noContextMenu;
+ this.eventBus._on("localized", () => {
+ this.#wasLocalized = true;
+ this.#adjustScaleWidth();
+ this.#updateUIState(true);
+ });
+ this.#bindEditorToolsListener(options);
+ }
+
+ #bindEditorToolsListener({
+ editorFreeTextButton,
+ editorFreeTextParamsToolbar,
+ editorInkButton,
+ editorInkParamsToolbar,
+ editorStampButton,
+ editorStampParamsToolbar
+ }) {
+ const editorModeChanged = ({
+ mode
+ }) => {
+ (0, _ui_utils.toggleCheckedBtn)(editorFreeTextButton, mode === _pdfjsLib.AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar);
+ (0, _ui_utils.toggleCheckedBtn)(editorInkButton, mode === _pdfjsLib.AnnotationEditorType.INK, editorInkParamsToolbar);
+ (0, _ui_utils.toggleCheckedBtn)(editorStampButton, mode === _pdfjsLib.AnnotationEditorType.STAMP, editorStampParamsToolbar);
+ const isDisable = mode === _pdfjsLib.AnnotationEditorType.DISABLE;
+ editorFreeTextButton.disabled = isDisable;
+ editorInkButton.disabled = isDisable;
+ editorStampButton.disabled = isDisable;
+ };
+ this.eventBus._on("annotationeditormodechanged", editorModeChanged);
+ this.eventBus._on("toolbarreset", evt => {
+ if (evt.source === this) {
+ editorModeChanged({
+ mode: _pdfjsLib.AnnotationEditorType.DISABLE
+ });
+ }
+ });
+ }
+
+ #updateUIState(resetNumPages = false) {
+ if (!this.#wasLocalized) {
+ return;
+ }
+ const {
+ pageNumber,
+ pagesCount,
+ pageScaleValue,
+ pageScale,
+ items
+ } = this;
+ if (resetNumPages) {
+ if (this.hasPageLabels) {
+ items.pageNumber.type = "text";
+ } else {
+ items.pageNumber.type = "number";
+ this.l10n.get("of_pages", {
+ pagesCount
+ }).then(msg => {
+ items.numPages.textContent = msg;
+ });
+ }
+ items.pageNumber.max = pagesCount;
+ }
+ if (this.hasPageLabels) {
+ items.pageNumber.value = this.pageLabel;
+ this.l10n.get("page_of_pages", {
+ pageNumber,
+ pagesCount
+ }).then(msg => {
+ items.numPages.textContent = msg;
+ });
+ } else {
+ items.pageNumber.value = pageNumber;
+ }
+ items.previous.disabled = pageNumber <= 1;
+ items.next.disabled = pageNumber >= pagesCount;
+ items.zoomOut.disabled = pageScale <= _ui_utils.MIN_SCALE;
+ items.zoomIn.disabled = pageScale >= _ui_utils.MAX_SCALE;
+ this.l10n.get("page_scale_percent", {
+ scale: Math.round(pageScale * 10000) / 100
+ }).then(msg => {
+ let predefinedValueFound = false;
+ for (const option of items.scaleSelect.options) {
+ if (option.value !== pageScaleValue) {
+ option.selected = false;
+ continue;
+ }
+ option.selected = true;
+ predefinedValueFound = true;
+ }
+ if (!predefinedValueFound) {
+ items.customScaleOption.textContent = msg;
+ items.customScaleOption.selected = true;
+ }
+ });
+ }
+
+ updateLoadingIndicatorState(loading = false) {
+ const {
+ pageNumber
+ } = this.items;
+ pageNumber.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);
+ }
+
+ async #adjustScaleWidth() {
+ const {
+ items,
+ l10n
+ } = this;
+ const predefinedValuesPromise = Promise.all([l10n.get("page_scale_auto"), l10n.get("page_scale_actual"), l10n.get("page_scale_fit"), l10n.get("page_scale_width")]);
+ await _ui_utils.animationStarted;
+ const style = getComputedStyle(items.scaleSelect);
+ const scaleSelectWidth = parseFloat(style.getPropertyValue("--scale-select-width"));
+ const canvas = document.createElement("canvas");
+ const ctx = canvas.getContext("2d", {
+ alpha: false
+ });
+ ctx.font = `${style.fontSize} ${style.fontFamily}`;
+ let maxWidth = 0;
+ for (const predefinedValue of await predefinedValuesPromise) {
+ const {
+ width
+ } = ctx.measureText(predefinedValue);
+ if (width > maxWidth) {
+ maxWidth = width;
+ }
+ }
+ maxWidth += 0.3 * scaleSelectWidth;
+ if (maxWidth > scaleSelectWidth) {
+ const container = items.scaleSelect.parentNode;
+ container.style.setProperty("--scale-select-width", `${maxWidth}px`);
+ }
+ canvas.width = 0;
+ canvas.height = 0;
+ }
+ }
+
+ exports.Toolbar = Toolbar;
+
+ /***/
+ }),
+ /* 41 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.ViewHistory = void 0;
+ const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
+
+ class ViewHistory {
+ constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {
+ this.fingerprint = fingerprint;
+ this.cacheSize = cacheSize;
+ this._initializedPromise = this._readFromStorage().then(databaseStr => {
+ const database = JSON.parse(databaseStr || "{}");
+ let index = -1;
+ if (!Array.isArray(database.files)) {
+ database.files = [];
+ } else {
+ while (database.files.length >= this.cacheSize) {
+ database.files.shift();
+ }
+ for (let i = 0, ii = database.files.length; i < ii; i++) {
+ const branch = database.files[i];
+ if (branch.fingerprint === this.fingerprint) {
+ index = i;
+ break;
+ }
+ }
+ }
+ if (index === -1) {
+ index = database.files.push({
+ fingerprint: this.fingerprint
+ }) - 1;
+ }
+ this.file = database.files[index];
+ this.database = database;
+ });
+ }
+
+ async _writeToStorage() {
+ const databaseStr = JSON.stringify(this.database);
+ localStorage.setItem("pdfjs.history", databaseStr);
+ }
+
+ async _readFromStorage() {
+ return localStorage.getItem("pdfjs.history");
+ }
+
+ async set(name, val) {
+ await this._initializedPromise;
+ this.file[name] = val;
+ return this._writeToStorage();
+ }
+
+ async setMultiple(properties) {
+ await this._initializedPromise;
+ for (const name in properties) {
+ this.file[name] = properties[name];
+ }
+ return this._writeToStorage();
+ }
+
+ async get(name, defaultValue) {
+ await this._initializedPromise;
+ const val = this.file[name];
+ return val !== undefined ? val : defaultValue;
+ }
+
+ async getMultiple(properties) {
+ await this._initializedPromise;
+ const values = Object.create(null);
+ for (const name in properties) {
+ const val = this.file[name];
+ values[name] = val !== undefined ? val : properties[name];
+ }
+ return values;
+ }
+ }
+
+ exports.ViewHistory = ViewHistory;
+
+ /***/
+ }),
+ /* 42 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.BasePreferences = void 0;
+ var _app_options = __webpack_require__(5);
+
+ class BasePreferences {
+ #defaults = Object.freeze({
+ "annotationEditorMode": 0,
+ "annotationMode": 2,
+ "cursorToolOnLoad": 0,
+ "defaultZoomDelay": 400,
+ "defaultZoomValue": "",
+ "disablePageLabels": false,
+ "enablePermissions": false,
+ "enablePrintAutoRotate": true,
+ "enableScripting": true,
+ "enableStampEditor": true,
+ "externalLinkTarget": 0,
+ "historyUpdateUrl": false,
+ "ignoreDestinationZoom": false,
+ "forcePageColors": false,
+ "pageColorsBackground": "Canvas",
+ "pageColorsForeground": "CanvasText",
+ "pdfBugEnabled": false,
+ "sidebarViewOnLoad": -1,
+ "scrollModeOnLoad": -1,
+ "spreadModeOnLoad": -1,
+ "textLayerMode": 1,
+ "viewerCssTheme": 0,
+ "viewOnLoad": 0,
+ "disableAutoFetch": false,
+ "disableFontFace": false,
+ "disableRange": false,
+ "disableStream": false,
+ "enableXfa": true
+ });
+ #prefs = Object.create(null);
+ #initializedPromise = null;
+
+ constructor() {
+ if (this.constructor === BasePreferences) {
+ throw new Error("Cannot initialize BasePreferences.");
+ }
+ this.#initializedPromise = this._readFromStorage(this.#defaults).then(prefs => {
+ for (const name in this.#defaults) {
+ const prefValue = prefs?.[name];
+ if (typeof prefValue === typeof this.#defaults[name]) {
+ this.#prefs[name] = prefValue;
+ }
+ }
+ });
+ }
+
+ async _writeToStorage(prefObj) {
+ throw new Error("Not implemented: _writeToStorage");
+ }
+
+ async _readFromStorage(prefObj) {
+ throw new Error("Not implemented: _readFromStorage");
+ }
+
+ async reset() {
+ await this.#initializedPromise;
+ const prefs = this.#prefs;
+ this.#prefs = Object.create(null);
+ return this._writeToStorage(this.#defaults).catch(reason => {
+ this.#prefs = prefs;
+ throw reason;
+ });
+ }
+
+ async set(name, value) {
+ await this.#initializedPromise;
+ const defaultValue = this.#defaults[name],
+ prefs = this.#prefs;
+ if (defaultValue === undefined) {
+ throw new Error(`Set preference: "${name}" is undefined.`);
+ } else if (value === undefined) {
+ throw new Error("Set preference: no value is specified.");
+ }
+ const valueType = typeof value,
+ defaultType = typeof defaultValue;
+ if (valueType !== defaultType) {
+ if (valueType === "number" && defaultType === "string") {
+ value = value.toString();
+ } else {
+ throw new Error(`Set preference: "${value}" is a ${valueType}, expected a ${defaultType}.`);
+ }
+ } else if (valueType === "number" && !Number.isInteger(value)) {
+ throw new Error(`Set preference: "${value}" must be an integer.`);
+ }
+ this.#prefs[name] = value;
+ return this._writeToStorage(this.#prefs).catch(reason => {
+ this.#prefs = prefs;
+ throw reason;
+ });
+ }
+
+ async get(name) {
+ await this.#initializedPromise;
+ const defaultValue = this.#defaults[name];
+ if (defaultValue === undefined) {
+ throw new Error(`Get preference: "${name}" is undefined.`);
+ }
+ return this.#prefs[name] ?? defaultValue;
+ }
+
+ async getAll() {
+ await this.#initializedPromise;
+ const obj = Object.create(null);
+ for (const name in this.#defaults) {
+ obj[name] = this.#prefs[name] ?? this.#defaults[name];
+ }
+ return obj;
+ }
+ }
+
+ exports.BasePreferences = BasePreferences;
+
+ /***/
+ }),
+ /* 43 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.DownloadManager = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ ;
+
+ function download(blobUrl, filename) {
+ const a = document.createElement("a");
+ if (!a.click) {
+ throw new Error('DownloadManager: "a.click()" is not supported.');
+ }
+ a.href = blobUrl;
+ a.target = "_parent";
+ if ("download" in a) {
+ a.download = filename;
+ }
+ (document.body || document.documentElement).append(a);
+ a.click();
+ a.remove();
+ }
+
+ class DownloadManager {
+ #openBlobUrls = new WeakMap();
+
+ downloadUrl(url, filename, _options) {
+ if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
+ console.error(`downloadUrl - not a valid URL: ${url}`);
+ return;
+ }
+ download(url + "#pdfjs.action=download", filename);
+ }
+
+ downloadData(data, filename, contentType) {
+ const blobUrl = URL.createObjectURL(new Blob([data], {
+ type: contentType
+ }));
+ download(blobUrl, filename);
+ }
+
+ openOrDownloadData(element, data, filename) {
+ const isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
+ const contentType = isPdfData ? "application/pdf" : "";
+ if (isPdfData) {
+ let blobUrl = this.#openBlobUrls.get(element);
+ if (!blobUrl) {
+ blobUrl = URL.createObjectURL(new Blob([data], {
+ type: contentType
+ }));
+ this.#openBlobUrls.set(element, blobUrl);
+ }
+ let viewerUrl;
+ viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
+ try {
+ window.open(viewerUrl);
+ return true;
+ } catch (ex) {
+ console.error(`openOrDownloadData: ${ex}`);
+ URL.revokeObjectURL(blobUrl);
+ this.#openBlobUrls.delete(element);
+ }
+ }
+ this.downloadData(data, filename, contentType);
+ return false;
+ }
+
+ download(blob, url, filename, _options) {
+ const blobUrl = URL.createObjectURL(blob);
+ download(blobUrl, filename);
+ }
+ }
+
+ exports.DownloadManager = DownloadManager;
+
+ /***/
+ }),
+ /* 44 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.GenericL10n = void 0;
+ __webpack_require__(45);
+ var _l10n_utils = __webpack_require__(30);
+ const PARTIAL_LANG_CODES = {
+ en: "en-US",
+ es: "es-ES",
+ fy: "fy-NL",
+ ga: "ga-IE",
+ gu: "gu-IN",
+ hi: "hi-IN",
+ hy: "hy-AM",
+ nb: "nb-NO",
+ ne: "ne-NP",
+ nn: "nn-NO",
+ pa: "pa-IN",
+ pt: "pt-PT",
+ sv: "sv-SE",
+ zh: "zh-CN"
+ };
+
+ function fixupLangCode(langCode) {
+ return PARTIAL_LANG_CODES[langCode?.toLowerCase()] || langCode;
+ }
+
+ class GenericL10n {
+ constructor(lang) {
+ const {
+ webL10n
+ } = document;
+ this._lang = lang;
+ this._ready = new Promise((resolve, reject) => {
+ webL10n.setLanguage(fixupLangCode(lang), () => {
+ resolve(webL10n);
+ });
+ });
+ }
+
+ async getLanguage() {
+ const l10n = await this._ready;
+ return l10n.getLanguage();
+ }
+
+ async getDirection() {
+ const l10n = await this._ready;
+ return l10n.getDirection();
+ }
+
+ async get(key, args = null, fallback = (0, _l10n_utils.getL10nFallback)(key, args)) {
+ const l10n = await this._ready;
+ return l10n.get(key, args, fallback);
+ }
+
+ async translate(element) {
+ const l10n = await this._ready;
+ return l10n.translate(element);
+ }
+ }
+
+ exports.GenericL10n = GenericL10n;
+
+ /***/
+ }),
+ /* 45 */
+ /***/ (() => {
+
+
+ document.webL10n = function (window, document) {
+ var gL10nData = {};
+ var gTextData = '';
+ var gTextProp = 'textContent';
+ var gLanguage = '';
+ var gMacros = {};
+ var gReadyState = 'loading';
+ var gAsyncResourceLoading = true;
+
+ function getL10nResourceLinks() {
+ return document.querySelectorAll('link[type="application/l10n"]');
+ }
+
+ function getL10nDictionary() {
+ var script = document.querySelector('script[type="application/l10n"]');
+ return script ? JSON.parse(script.innerHTML) : null;
+ }
+
+ function getTranslatableChildren(element) {
+ return element ? element.querySelectorAll('*[data-l10n-id]') : [];
+ }
+
+ function getL10nAttributes(element) {
+ if (!element) return {};
+ var l10nId = element.getAttribute('data-l10n-id');
+ var l10nArgs = element.getAttribute('data-l10n-args');
+ var args = {};
+ if (l10nArgs) {
+ try {
+ args = JSON.parse(l10nArgs);
+ } catch (e) {
+ console.warn('could not parse arguments for #' + l10nId);
+ }
+ }
+ return {
+ id: l10nId,
+ args: args
+ };
+ }
+
+ function xhrLoadText(url, onSuccess, onFailure) {
+ onSuccess = onSuccess || function _onSuccess(data) {
+ };
+ onFailure = onFailure || function _onFailure() {
+ };
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, gAsyncResourceLoading);
+ if (xhr.overrideMimeType) {
+ xhr.overrideMimeType('text/plain; charset=utf-8');
+ }
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200 || xhr.status === 0) {
+ onSuccess(xhr.responseText);
+ } else {
+ onFailure();
+ }
+ }
+ };
+ xhr.onerror = onFailure;
+ xhr.ontimeout = onFailure;
+ try {
+ xhr.send(null);
+ } catch (e) {
+ onFailure();
+ }
+ }
+
+ function parseResource(href, lang, successCallback, failureCallback) {
+ var baseURL = href.replace(/[^\/]*$/, '') || './';
+
+ function evalString(text) {
+ if (text.lastIndexOf('\\') < 0) return text;
+ return text.replace(/\\\\/g, '\\').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\b/g, '\b').replace(/\\f/g, '\f').replace(/\\{/g, '{').replace(/\\}/g, '}').replace(/\\"/g, '"').replace(/\\'/g, "'");
+ }
+
+ function parseProperties(text, parsedPropertiesCallback) {
+ var dictionary = {};
+ var reBlank = /^\s*|\s*$/;
+ var reComment = /^\s*#|^\s*$/;
+ var reSection = /^\s*\[(.*)\]\s*$/;
+ var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
+ var reSplit = /^([^=\s]*)\s*=\s*(.+)$/;
+
+ function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
+ var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
+ var currentLang = '*';
+ var genericLang = lang.split('-', 1)[0];
+ var skipLang = false;
+ var match = '';
+
+ function nextEntry() {
+ while (true) {
+ if (!entries.length) {
+ parsedRawLinesCallback();
+ return;
+ }
+ var line = entries.shift();
+ if (reComment.test(line)) continue;
+ if (extendedSyntax) {
+ match = reSection.exec(line);
+ if (match) {
+ currentLang = match[1].toLowerCase();
+ skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang;
+ continue;
+ } else if (skipLang) {
+ continue;
+ }
+ match = reImport.exec(line);
+ if (match) {
+ loadImport(baseURL + match[1], nextEntry);
+ return;
+ }
+ }
+ var tmp = line.match(reSplit);
+ if (tmp && tmp.length == 3) {
+ dictionary[tmp[1]] = evalString(tmp[2]);
+ }
+ }
+ }
+
+ nextEntry();
+ }
+
+ function loadImport(url, callback) {
+ xhrLoadText(url, function (content) {
+ parseRawLines(content, false, callback);
+ }, function () {
+ console.warn(url + ' not found.');
+ callback();
+ });
+ }
+
+ parseRawLines(text, true, function () {
+ parsedPropertiesCallback(dictionary);
+ });
+ }
+
+ xhrLoadText(href, function (response) {
+ gTextData += response;
+ parseProperties(response, function (data) {
+ for (var key in data) {
+ var id,
+ prop,
+ index = key.lastIndexOf('.');
+ if (index > 0) {
+ id = key.substring(0, index);
+ prop = key.substring(index + 1);
+ } else {
+ id = key;
+ prop = gTextProp;
+ }
+ if (!gL10nData[id]) {
+ gL10nData[id] = {};
+ }
+ gL10nData[id][prop] = data[key];
+ }
+ if (successCallback) {
+ successCallback();
+ }
+ });
+ }, failureCallback);
+ }
+
+ function loadLocale(lang, callback) {
+ if (lang) {
+ lang = lang.toLowerCase();
+ }
+ callback = callback || function _callback() {
+ };
+ clear();
+ gLanguage = lang;
+ var langLinks = getL10nResourceLinks();
+ var langCount = langLinks.length;
+ if (langCount === 0) {
+ var dict = getL10nDictionary();
+ if (dict && dict.locales && dict.default_locale) {
+ console.log('using the embedded JSON directory, early way out');
+ gL10nData = dict.locales[lang];
+ if (!gL10nData) {
+ var defaultLocale = dict.default_locale.toLowerCase();
+ for (var anyCaseLang in dict.locales) {
+ anyCaseLang = anyCaseLang.toLowerCase();
+ if (anyCaseLang === lang) {
+ gL10nData = dict.locales[lang];
+ break;
+ } else if (anyCaseLang === defaultLocale) {
+ gL10nData = dict.locales[defaultLocale];
+ }
+ }
+ }
+ callback();
+ } else {
+ console.log('no resource to load, early way out');
+ }
+ gReadyState = 'complete';
+ return;
+ }
+ var onResourceLoaded = null;
+ var gResourceCount = 0;
+ onResourceLoaded = function () {
+ gResourceCount++;
+ if (gResourceCount >= langCount) {
+ callback();
+ gReadyState = 'complete';
+ }
+ };
+
+ function L10nResourceLink(link) {
+ var href = link.href;
+ this.load = function (lang, callback) {
+ parseResource(href, lang, callback, function () {
+ console.warn(href + ' not found.');
+ console.warn('"' + lang + '" resource not found');
+ gLanguage = '';
+ callback();
+ });
+ };
+ }
+
+ for (var i = 0; i < langCount; i++) {
+ var resource = new L10nResourceLink(langLinks[i]);
+ resource.load(lang, onResourceLoaded);
+ }
+ }
+
+ function clear() {
+ gL10nData = {};
+ gTextData = '';
+ gLanguage = '';
+ }
+
+ function getPluralRules(lang) {
+ var locales2rules = {
+ 'af': 3,
+ 'ak': 4,
+ 'am': 4,
+ 'ar': 1,
+ 'asa': 3,
+ 'az': 0,
+ 'be': 11,
+ 'bem': 3,
+ 'bez': 3,
+ 'bg': 3,
+ 'bh': 4,
+ 'bm': 0,
+ 'bn': 3,
+ 'bo': 0,
+ 'br': 20,
+ 'brx': 3,
+ 'bs': 11,
+ 'ca': 3,
+ 'cgg': 3,
+ 'chr': 3,
+ 'cs': 12,
+ 'cy': 17,
+ 'da': 3,
+ 'de': 3,
+ 'dv': 3,
+ 'dz': 0,
+ 'ee': 3,
+ 'el': 3,
+ 'en': 3,
+ 'eo': 3,
+ 'es': 3,
+ 'et': 3,
+ 'eu': 3,
+ 'fa': 0,
+ 'ff': 5,
+ 'fi': 3,
+ 'fil': 4,
+ 'fo': 3,
+ 'fr': 5,
+ 'fur': 3,
+ 'fy': 3,
+ 'ga': 8,
+ 'gd': 24,
+ 'gl': 3,
+ 'gsw': 3,
+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': 3,
+ 'ssy': 3,
+ 'st': 3,
+ 'sv': 3,
+ 'sw': 3,
+ 'syr': 3,
+ 'ta': 3,
+ 'te': 3,
+ 'teo': 3,
+ 'th': 0,
+ 'ti': 4,
+ 'tig': 3,
+ 'tk': 3,
+ 'tl': 4,
+ 'tn': 3,
+ 'to': 0,
+ 'tr': 0,
+ 'ts': 3,
+ 'tzm': 22,
+ 'uk': 11,
+ 'ur': 3,
+ 've': 3,
+ 'vi': 0,
+ 'vun': 3,
+ 'wa': 4,
+ 'wae': 3,
+ 'wo': 0,
+ 'xh': 3,
+ 'xog': 3,
+ 'yo': 0,
+ 'zh': 0,
+ 'zu': 3
+ };
+
+ function isIn(n, list) {
+ return list.indexOf(n) !== -1;
+ }
+
+ function isBetween(n, start, end) {
+ return start <= n && n <= end;
+ }
+
+ var pluralRules = {
+ '0': function (n) {
+ return 'other';
+ },
+ '1': function (n) {
+ if (isBetween(n % 100, 3, 10)) return 'few';
+ if (n === 0) return 'zero';
+ if (isBetween(n % 100, 11, 99)) return 'many';
+ if (n == 2) return 'two';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '2': function (n) {
+ if (n !== 0 && n % 10 === 0) return 'many';
+ if (n == 2) return 'two';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '3': function (n) {
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '4': function (n) {
+ if (isBetween(n, 0, 1)) return 'one';
+ return 'other';
+ },
+ '5': function (n) {
+ if (isBetween(n, 0, 2) && n != 2) return 'one';
+ return 'other';
+ },
+ '6': function (n) {
+ if (n === 0) return 'zero';
+ if (n % 10 == 1 && n % 100 != 11) return 'one';
+ return 'other';
+ },
+ '7': function (n) {
+ if (n == 2) return 'two';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '8': function (n) {
+ if (isBetween(n, 3, 6)) return 'few';
+ if (isBetween(n, 7, 10)) return 'many';
+ if (n == 2) return 'two';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '9': function (n) {
+ if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '10': function (n) {
+ if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few';
+ if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one';
+ return 'other';
+ },
+ '11': function (n) {
+ if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
+ if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many';
+ if (n % 10 == 1 && n % 100 != 11) return 'one';
+ return 'other';
+ },
+ '12': function (n) {
+ if (isBetween(n, 2, 4)) return 'few';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '13': function (n) {
+ if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
+ if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '14': function (n) {
+ if (isBetween(n % 100, 3, 4)) return 'few';
+ if (n % 100 == 2) return 'two';
+ if (n % 100 == 1) return 'one';
+ return 'other';
+ },
+ '15': function (n) {
+ if (n === 0 || isBetween(n % 100, 2, 10)) return 'few';
+ if (isBetween(n % 100, 11, 19)) return 'many';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '16': function (n) {
+ if (n % 10 == 1 && n != 11) return 'one';
+ return 'other';
+ },
+ '17': function (n) {
+ if (n == 3) return 'few';
+ if (n === 0) return 'zero';
+ if (n == 6) return 'many';
+ if (n == 2) return 'two';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '18': function (n) {
+ if (n === 0) return 'zero';
+ if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one';
+ return 'other';
+ },
+ '19': function (n) {
+ if (isBetween(n, 2, 10)) return 'few';
+ if (isBetween(n, 0, 1)) return 'one';
+ return 'other';
+ },
+ '20': function (n) {
+ if ((isBetween(n % 10, 3, 4) || n % 10 == 9) && !(isBetween(n % 100, 10, 19) || isBetween(n % 100, 70, 79) || isBetween(n % 100, 90, 99))) return 'few';
+ if (n % 1000000 === 0 && n !== 0) return 'many';
+ if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two';
+ if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one';
+ return 'other';
+ },
+ '21': function (n) {
+ if (n === 0) return 'zero';
+ if (n == 1) return 'one';
+ return 'other';
+ },
+ '22': function (n) {
+ if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one';
+ return 'other';
+ },
+ '23': function (n) {
+ if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one';
+ return 'other';
+ },
+ '24': function (n) {
+ if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few';
+ if (isIn(n, [2, 12])) return 'two';
+ if (isIn(n, [1, 11])) return 'one';
+ return 'other';
+ }
+ };
+ var index = locales2rules[lang.replace(/-.*$/, '')];
+ if (!(index in pluralRules)) {
+ console.warn('plural form unknown for [' + lang + ']');
+ return function () {
+ return 'other';
+ };
+ }
+ return pluralRules[index];
+ }
+
+ gMacros.plural = function (str, param, key, prop) {
+ var n = parseFloat(param);
+ if (isNaN(n)) return str;
+ if (prop != gTextProp) return str;
+ if (!gMacros._pluralRules) {
+ gMacros._pluralRules = getPluralRules(gLanguage);
+ }
+ var index = '[' + gMacros._pluralRules(n) + ']';
+ if (n === 0 && key + '[zero]' in gL10nData) {
+ str = gL10nData[key + '[zero]'][prop];
+ } else if (n == 1 && key + '[one]' in gL10nData) {
+ str = gL10nData[key + '[one]'][prop];
+ } else if (n == 2 && key + '[two]' in gL10nData) {
+ str = gL10nData[key + '[two]'][prop];
+ } else if (key + index in gL10nData) {
+ str = gL10nData[key + index][prop];
+ } else if (key + '[other]' in gL10nData) {
+ str = gL10nData[key + '[other]'][prop];
+ }
+ return str;
+ };
+
+ function getL10nData(key, args, fallback) {
+ var data = gL10nData[key];
+ if (!data) {
+ console.warn('#' + key + ' is undefined.');
+ if (!fallback) {
+ return null;
+ }
+ data = fallback;
+ }
+ var rv = {};
+ for (var prop in data) {
+ var str = data[prop];
+ str = substIndexes(str, args, key, prop);
+ str = substArguments(str, args, key);
+ rv[prop] = str;
+ }
+ return rv;
+ }
+
+ function substIndexes(str, args, key, prop) {
+ var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/;
+ var reMatch = reIndex.exec(str);
+ if (!reMatch || !reMatch.length) return str;
+ var macroName = reMatch[1];
+ var paramName = reMatch[2];
+ var param;
+ if (args && paramName in args) {
+ param = args[paramName];
+ } else if (paramName in gL10nData) {
+ param = gL10nData[paramName];
+ }
+ if (macroName in gMacros) {
+ var macro = gMacros[macroName];
+ str = macro(str, param, key, prop);
+ }
+ return str;
+ }
+
+ function substArguments(str, args, key) {
+ var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
+ return str.replace(reArgs, function (matched_text, arg) {
+ if (args && arg in args) {
+ return args[arg];
+ }
+ if (arg in gL10nData) {
+ return gL10nData[arg];
+ }
+ console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');
+ return matched_text;
+ });
+ }
+
+ function translateElement(element) {
+ var l10n = getL10nAttributes(element);
+ if (!l10n.id) return;
+ var data = getL10nData(l10n.id, l10n.args);
+ if (!data) {
+ console.warn('#' + l10n.id + ' is undefined.');
+ return;
+ }
+ if (data[gTextProp]) {
+ if (getChildElementCount(element) === 0) {
+ element[gTextProp] = data[gTextProp];
+ } else {
+ var children = element.childNodes;
+ var found = false;
+ for (var i = 0, l = children.length; i < l; i++) {
+ if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) {
+ if (found) {
+ children[i].nodeValue = '';
+ } else {
+ children[i].nodeValue = data[gTextProp];
+ found = true;
+ }
+ }
+ }
+ if (!found) {
+ var textNode = document.createTextNode(data[gTextProp]);
+ element.prepend(textNode);
+ }
+ }
+ delete data[gTextProp];
+ }
+ for (var k in data) {
+ element[k] = data[k];
+ }
+ }
+
+ function getChildElementCount(element) {
+ if (element.children) {
+ return element.children.length;
+ }
+ if (typeof element.childElementCount !== 'undefined') {
+ return element.childElementCount;
+ }
+ var count = 0;
+ for (var i = 0; i < element.childNodes.length; i++) {
+ count += element.nodeType === 1 ? 1 : 0;
+ }
+ return count;
+ }
+
+ function translateFragment(element) {
+ element = element || document.documentElement;
+ var children = getTranslatableChildren(element);
+ var elementCount = children.length;
+ for (var i = 0; i < elementCount; i++) {
+ translateElement(children[i]);
+ }
+ translateElement(element);
+ }
+
+ return {
+ get: function (key, args, fallbackString) {
+ var index = key.lastIndexOf('.');
+ var prop = gTextProp;
+ if (index > 0) {
+ prop = key.substring(index + 1);
+ key = key.substring(0, index);
+ }
+ var fallback;
+ if (fallbackString) {
+ fallback = {};
+ fallback[prop] = fallbackString;
+ }
+ var data = getL10nData(key, args, fallback);
+ if (data && prop in data) {
+ return data[prop];
+ }
+ return '{{' + key + '}}';
+ },
+ getData: function () {
+ return gL10nData;
+ },
+ getText: function () {
+ return gTextData;
+ },
+ getLanguage: function () {
+ return gLanguage;
+ },
+ setLanguage: function (lang, callback) {
+ loadLocale(lang, function () {
+ if (callback) callback();
+ });
+ },
+ getDirection: function () {
+ var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
+ var shortCode = gLanguage.split('-', 1)[0];
+ return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr';
+ },
+ translate: translateFragment,
+ getReadyState: function () {
+ return gReadyState;
+ },
+ ready: function (callback) {
+ if (!callback) {
+ return;
+ } else if (gReadyState == 'complete' || gReadyState == 'interactive') {
+ window.setTimeout(function () {
+ callback();
+ });
+ } else if (document.addEventListener) {
+ document.addEventListener('localized', function once() {
+ document.removeEventListener('localized', once);
+ callback();
+ });
+ }
+ }
+ };
+ }(window, document);
+
+ /***/
+ }),
+ /* 46 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.GenericScripting = void 0;
+ exports.docProperties = docProperties;
+ var _pdfjsLib = __webpack_require__(4);
+
+ async function docProperties(pdfDocument) {
+ const url = "",
+ baseUrl = url.split("#")[0];
+ let {
+ info,
+ metadata,
+ contentDispositionFilename,
+ contentLength
+ } = await pdfDocument.getMetadata();
+ if (!contentLength) {
+ const {
+ length
+ } = await pdfDocument.getDownloadInfo();
+ contentLength = length;
+ }
+ return {
+ ...info,
+ baseURL: baseUrl,
+ filesize: contentLength,
+ filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url),
+ metadata: metadata?.getRaw(),
+ authors: metadata?.get("dc:creator"),
+ numPages: pdfDocument.numPages,
+ URL: url
+ };
+ }
+
+ class GenericScripting {
+ constructor(sandboxBundleSrc) {
+ this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(() => {
+ return window.pdfjsSandbox.QuickJSSandbox();
+ });
+ }
+
+ async createSandbox(data) {
+ const sandbox = await this._ready;
+ sandbox.create(data);
+ }
+
+ async dispatchEventInSandbox(event) {
+ const sandbox = await this._ready;
+ setTimeout(() => sandbox.dispatchEvent(event), 0);
+ }
+
+ async destroySandbox() {
+ const sandbox = await this._ready;
+ sandbox.nukeSandbox();
+ }
+ }
+
+ exports.GenericScripting = GenericScripting;
+
+ /***/
+ }),
+ /* 47 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.PDFPrintService = void 0;
+ var _pdfjsLib = __webpack_require__(4);
+ var _app = __webpack_require__(2);
+ var _print_utils = __webpack_require__(48);
+ let activeService = null;
+ let dialog = null;
+ let overlayManager = null;
+
+ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) {
+ const scratchCanvas = activeService.scratchCanvas;
+ const PRINT_UNITS = printResolution / _pdfjsLib.PixelsPerInch.PDF;
+ scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);
+ scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);
+ const ctx = scratchCanvas.getContext("2d");
+ ctx.save();
+ ctx.fillStyle = "rgb(255, 255, 255)";
+ ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);
+ ctx.restore();
+ return Promise.all([pdfDocument.getPage(pageNumber), printAnnotationStoragePromise]).then(function ([pdfPage, printAnnotationStorage]) {
+ const renderContext = {
+ canvasContext: ctx,
+ transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
+ viewport: pdfPage.getViewport({
+ scale: 1,
+ rotation: size.rotation
+ }),
+ intent: "print",
+ annotationMode: _pdfjsLib.AnnotationMode.ENABLE_STORAGE,
+ optionalContentConfigPromise,
+ printAnnotationStorage
+ };
+ return pdfPage.render(renderContext).promise;
+ });
+ }
+
+ class PDFPrintService {
+ constructor(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise = null, printAnnotationStoragePromise = null, l10n) {
+ this.pdfDocument = pdfDocument;
+ this.pagesOverview = pagesOverview;
+ this.printContainer = printContainer;
+ this._printResolution = printResolution || 150;
+ this._optionalContentConfigPromise = optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();
+ this._printAnnotationStoragePromise = printAnnotationStoragePromise || Promise.resolve();
+ this.l10n = l10n;
+ this.currentPage = -1;
+ this.scratchCanvas = document.createElement("canvas");
+ }
+
+ layout() {
+ this.throwIfInactive();
+ const body = document.querySelector("body");
+ body.setAttribute("data-pdfjsprinting", true);
+ const {
+ width,
+ height
+ } = this.pagesOverview[0];
+ const hasEqualPageSizes = this.pagesOverview.every(size => size.width === width && size.height === height);
+ if (!hasEqualPageSizes) {
+ console.warn("Not all pages have the same size. The printed result may be incorrect!");
+ }
+ this.pageStyleSheet = document.createElement("style");
+ this.pageStyleSheet.textContent = `@page { size: ${width}pt ${height}pt;}`;
+ body.append(this.pageStyleSheet);
+ }
+
+ destroy() {
+ if (activeService !== this) {
+ return;
+ }
+ this.printContainer.textContent = "";
+ const body = document.querySelector("body");
+ body.removeAttribute("data-pdfjsprinting");
+ if (this.pageStyleSheet) {
+ this.pageStyleSheet.remove();
+ this.pageStyleSheet = null;
+ }
+ this.scratchCanvas.width = this.scratchCanvas.height = 0;
+ this.scratchCanvas = null;
+ activeService = null;
+ ensureOverlay().then(function () {
+ if (overlayManager.active === dialog) {
+ overlayManager.close(dialog);
+ }
+ });
+ }
+
+ renderPages() {
+ if (this.pdfDocument.isPureXfa) {
+ (0, _print_utils.getXfaHtmlForPrinting)(this.printContainer, this.pdfDocument);
+ return Promise.resolve();
+ }
+ const pageCount = this.pagesOverview.length;
+ const renderNextPage = (resolve, reject) => {
+ this.throwIfInactive();
+ if (++this.currentPage >= pageCount) {
+ renderProgress(pageCount, pageCount, this.l10n);
+ resolve();
+ return;
+ }
+ const index = this.currentPage;
+ renderProgress(index, pageCount, this.l10n);
+ renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index], this._printResolution, this._optionalContentConfigPromise, this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function () {
+ renderNextPage(resolve, reject);
+ }, reject);
+ };
+ return new Promise(renderNextPage);
+ }
+
+ useRenderedPage() {
+ this.throwIfInactive();
+ const img = document.createElement("img");
+ const scratchCanvas = this.scratchCanvas;
+ if ("toBlob" in scratchCanvas) {
+ scratchCanvas.toBlob(function (blob) {
+ img.src = URL.createObjectURL(blob);
+ });
+ } else {
+ img.src = scratchCanvas.toDataURL();
+ }
+ const wrapper = document.createElement("div");
+ wrapper.className = "printedPage";
+ wrapper.append(img);
+ this.printContainer.append(wrapper);
+ return new Promise(function (resolve, reject) {
+ img.onload = resolve;
+ img.onerror = reject;
+ });
+ }
+
+ performPrint() {
+ this.throwIfInactive();
+ return new Promise(resolve => {
+ setTimeout(() => {
+ if (!this.active) {
+ resolve();
+ return;
+ }
+ print.call(window);
+ setTimeout(resolve, 20);
+ }, 0);
+ });
+ }
+
+ get active() {
+ return this === activeService;
+ }
+
+ throwIfInactive() {
+ if (!this.active) {
+ throw new Error("This print request was cancelled or completed.");
+ }
+ }
+ }
+
+ exports.PDFPrintService = PDFPrintService;
+ const print = window.print;
+ window.print = function () {
+ if (activeService) {
+ console.warn("Ignored window.print() because of a pending print job.");
+ return;
+ }
+ ensureOverlay().then(function () {
+ if (activeService) {
+ overlayManager.open(dialog);
+ }
+ });
+ try {
+ dispatchEvent("beforeprint");
+ } finally {
+ if (!activeService) {
+ console.error("Expected print service to be initialized.");
+ ensureOverlay().then(function () {
+ if (overlayManager.active === dialog) {
+ overlayManager.close(dialog);
+ }
+ });
+ return;
+ }
+ const activeServiceOnEntry = activeService;
+ activeService.renderPages().then(function () {
+ return activeServiceOnEntry.performPrint();
+ }).catch(function () {
+ }).then(function () {
+ if (activeServiceOnEntry.active) {
+ abort();
+ }
+ });
+ }
+ };
+
+ function dispatchEvent(eventType) {
+ const event = new CustomEvent(eventType, {
+ bubbles: false,
+ cancelable: false,
+ detail: "custom"
+ });
+ window.dispatchEvent(event);
+ }
+
+ function abort() {
+ if (activeService) {
+ activeService.destroy();
+ dispatchEvent("afterprint");
+ }
+ }
+
+ function renderProgress(index, total, l10n) {
+ dialog ||= document.getElementById("printServiceDialog");
+ const progress = Math.round(100 * index / total);
+ const progressBar = dialog.querySelector("progress");
+ const progressPerc = dialog.querySelector(".relative-progress");
+ progressBar.value = progress;
+ l10n.get("print_progress_percent", {
+ progress
+ }).then(msg => {
+ progressPerc.textContent = msg;
+ });
+ }
+
+ window.addEventListener("keydown", function (event) {
+ if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
+ window.print();
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ }, true);
+ if ("onbeforeprint" in window) {
+ const stopPropagationIfNeeded = function (event) {
+ if (event.detail !== "custom") {
+ event.stopImmediatePropagation();
+ }
+ };
+ window.addEventListener("beforeprint", stopPropagationIfNeeded);
+ window.addEventListener("afterprint", stopPropagationIfNeeded);
+ }
+ let overlayPromise;
+
+ function ensureOverlay() {
+ if (!overlayPromise) {
+ overlayManager = _app.PDFViewerApplication.overlayManager;
+ if (!overlayManager) {
+ throw new Error("The overlay manager has not yet been initialized.");
+ }
+ dialog ||= document.getElementById("printServiceDialog");
+ overlayPromise = overlayManager.register(dialog, true);
+ document.getElementById("printCancel").onclick = abort;
+ dialog.addEventListener("close", abort);
+ }
+ return overlayPromise;
+ }
+
+ _app.PDFPrintServiceFactory.instance = {
+ supportsPrinting: true,
+ createPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise, l10n) {
+ if (activeService) {
+ throw new Error("The print service is created and active.");
+ }
+ activeService = new PDFPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise, l10n);
+ return activeService;
+ }
+ };
+
+ /***/
+ }),
+ /* 48 */
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.getXfaHtmlForPrinting = getXfaHtmlForPrinting;
+ var _pdfjsLib = __webpack_require__(4);
+ var _pdf_link_service = __webpack_require__(7);
+ var _xfa_layer_builder = __webpack_require__(38);
+
+ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
+ const xfaHtml = pdfDocument.allXfaHtml;
+ const linkService = new _pdf_link_service.SimpleLinkService();
+ const scale = Math.round(_pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;
+ for (const xfaPage of xfaHtml.children) {
+ const page = document.createElement("div");
+ page.className = "xfaPrintedPage";
+ printContainer.append(page);
+ const builder = new _xfa_layer_builder.XfaLayerBuilder({
+ pageDiv: page,
+ pdfPage: null,
+ annotationStorage: pdfDocument.annotationStorage,
+ linkService,
+ xfaHtml: xfaPage
+ });
+ const viewport = (0, _pdfjsLib.getXfaPageViewport)(xfaPage, {
+ scale
+ });
+ builder.render(viewport, "print");
+ }
+ }
+
+ /***/
+ })
+ /******/]);
+ /************************************************************************/
+ /******/ // The module cache
+ /******/
+ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/
+ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/
+ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/
+ if (cachedModule !== undefined) {
+ /******/
+ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/
+ var module = __webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {}
+ /******/
+ };
+ /******/
+ /******/ // Execute the module function
+ /******/
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+ /******/
+ /******/ // Return the exports of the module
+ /******/
+ return module.exports;
+ /******/
+ }
+
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+ (() => {
+ var exports = __webpack_exports__;
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ Object.defineProperty(exports, "PDFViewerApplication", ({
+ enumerable: true,
+ get: function () {
+ return _app.PDFViewerApplication;
+ }
+ }));
+ exports.PDFViewerApplicationConstants = void 0;
+ Object.defineProperty(exports, "PDFViewerApplicationOptions", ({
+ enumerable: true,
+ get: function () {
+ return _app_options.AppOptions;
+ }
+ }));
+ __webpack_require__(1);
+ __webpack_require__(47);
+ var _ui_utils = __webpack_require__(3);
+ var _app_options = __webpack_require__(5);
+ var _pdf_link_service = __webpack_require__(7);
+ var _app = __webpack_require__(2);
+ const pdfjsVersion = '3.11.174';
+ const pdfjsBuild = 'ce8716743';
+ const AppConstants = {
+ LinkTarget: _pdf_link_service.LinkTarget,
+ RenderingStates: _ui_utils.RenderingStates,
+ ScrollMode: _ui_utils.ScrollMode,
+ SpreadMode: _ui_utils.SpreadMode
+ };
+ exports.PDFViewerApplicationConstants = AppConstants;
+ window.PDFViewerApplication = _app.PDFViewerApplication;
+ window.PDFViewerApplicationConstants = AppConstants;
+ window.PDFViewerApplicationOptions = _app_options.AppOptions;
+
+ function getViewerConfiguration() {
+ return {
+ appContainer: document.body,
+ mainContainer: document.getElementById("viewerContainer"),
+ viewerContainer: document.getElementById("viewer"),
+ toolbar: {
+ container: document.getElementById("toolbarViewer"),
+ numPages: document.getElementById("numPages"),
+ pageNumber: document.getElementById("pageNumber"),
+ scaleSelect: document.getElementById("scaleSelect"),
+ customScaleOption: document.getElementById("customScaleOption"),
+ previous: document.getElementById("previous"),
+ next: document.getElementById("next"),
+ zoomIn: document.getElementById("zoomIn"),
+ zoomOut: document.getElementById("zoomOut"),
+ viewFind: document.getElementById("viewFind"),
+ openFile: document.getElementById("openFile"),
+ print: document.getElementById("print"),
+ editorFreeTextButton: document.getElementById("editorFreeText"),
+ editorFreeTextParamsToolbar: document.getElementById("editorFreeTextParamsToolbar"),
+ editorInkButton: document.getElementById("editorInk"),
+ editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"),
+ editorStampButton: document.getElementById("editorStamp"),
+ editorStampParamsToolbar: document.getElementById("editorStampParamsToolbar"),
+ download: document.getElementById("download")
+ },
+ secondaryToolbar: {
+ toolbar: document.getElementById("secondaryToolbar"),
+ toggleButton: document.getElementById("secondaryToolbarToggle"),
+ presentationModeButton: document.getElementById("presentationMode"),
+ openFileButton: document.getElementById("secondaryOpenFile"),
+ printButton: document.getElementById("secondaryPrint"),
+ downloadButton: document.getElementById("secondaryDownload"),
+ viewBookmarkButton: document.getElementById("viewBookmark"),
+ firstPageButton: document.getElementById("firstPage"),
+ lastPageButton: document.getElementById("lastPage"),
+ pageRotateCwButton: document.getElementById("pageRotateCw"),
+ pageRotateCcwButton: document.getElementById("pageRotateCcw"),
+ cursorSelectToolButton: document.getElementById("cursorSelectTool"),
+ cursorHandToolButton: document.getElementById("cursorHandTool"),
+ scrollPageButton: document.getElementById("scrollPage"),
+ scrollVerticalButton: document.getElementById("scrollVertical"),
+ scrollHorizontalButton: document.getElementById("scrollHorizontal"),
+ scrollWrappedButton: document.getElementById("scrollWrapped"),
+ spreadNoneButton: document.getElementById("spreadNone"),
+ spreadOddButton: document.getElementById("spreadOdd"),
+ spreadEvenButton: document.getElementById("spreadEven"),
+ documentPropertiesButton: document.getElementById("documentProperties")
+ },
+ sidebar: {
+ outerContainer: document.getElementById("outerContainer"),
+ sidebarContainer: document.getElementById("sidebarContainer"),
+ toggleButton: document.getElementById("sidebarToggle"),
+ resizer: document.getElementById("sidebarResizer"),
+ thumbnailButton: document.getElementById("viewThumbnail"),
+ outlineButton: document.getElementById("viewOutline"),
+ attachmentsButton: document.getElementById("viewAttachments"),
+ layersButton: document.getElementById("viewLayers"),
+ thumbnailView: document.getElementById("thumbnailView"),
+ outlineView: document.getElementById("outlineView"),
+ attachmentsView: document.getElementById("attachmentsView"),
+ layersView: document.getElementById("layersView"),
+ outlineOptionsContainer: document.getElementById("outlineOptionsContainer"),
+ currentOutlineItemButton: document.getElementById("currentOutlineItem")
+ },
+ findBar: {
+ bar: document.getElementById("findbar"),
+ toggleButton: document.getElementById("viewFind"),
+ findField: document.getElementById("findInput"),
+ highlightAllCheckbox: document.getElementById("findHighlightAll"),
+ caseSensitiveCheckbox: document.getElementById("findMatchCase"),
+ matchDiacriticsCheckbox: document.getElementById("findMatchDiacritics"),
+ entireWordCheckbox: document.getElementById("findEntireWord"),
+ findMsg: document.getElementById("findMsg"),
+ findResultsCount: document.getElementById("findResultsCount"),
+ findPreviousButton: document.getElementById("findPrevious"),
+ findNextButton: document.getElementById("findNext")
+ },
+ passwordOverlay: {
+ dialog: document.getElementById("passwordDialog"),
+ label: document.getElementById("passwordText"),
+ input: document.getElementById("password"),
+ submitButton: document.getElementById("passwordSubmit"),
+ cancelButton: document.getElementById("passwordCancel")
+ },
+ documentProperties: {
+ dialog: document.getElementById("documentPropertiesDialog"),
+ closeButton: document.getElementById("documentPropertiesClose"),
+ fields: {
+ fileName: document.getElementById("fileNameField"),
+ fileSize: document.getElementById("fileSizeField"),
+ title: document.getElementById("titleField"),
+ author: document.getElementById("authorField"),
+ subject: document.getElementById("subjectField"),
+ keywords: document.getElementById("keywordsField"),
+ creationDate: document.getElementById("creationDateField"),
+ modificationDate: document.getElementById("modificationDateField"),
+ creator: document.getElementById("creatorField"),
+ producer: document.getElementById("producerField"),
+ version: document.getElementById("versionField"),
+ pageCount: document.getElementById("pageCountField"),
+ pageSize: document.getElementById("pageSizeField"),
+ linearized: document.getElementById("linearizedField")
+ }
+ },
+ altTextDialog: {
+ dialog: document.getElementById("altTextDialog"),
+ optionDescription: document.getElementById("descriptionButton"),
+ optionDecorative: document.getElementById("decorativeButton"),
+ textarea: document.getElementById("descriptionTextarea"),
+ cancelButton: document.getElementById("altTextCancel"),
+ saveButton: document.getElementById("altTextSave")
+ },
+ annotationEditorParams: {
+ editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"),
+ editorFreeTextColor: document.getElementById("editorFreeTextColor"),
+ editorInkColor: document.getElementById("editorInkColor"),
+ editorInkThickness: document.getElementById("editorInkThickness"),
+ editorInkOpacity: document.getElementById("editorInkOpacity"),
+ editorStampAddImage: document.getElementById("editorStampAddImage")
+ },
+ printContainer: document.getElementById("printContainer"),
+ openFileInput: document.getElementById("fileInput"),
+ debuggerScriptPath: "./debugger.js"
+ };
+ }
+
+ function webViewerLoad() {
+ const config = getViewerConfiguration();
+ const event = new CustomEvent("webviewerloaded", {
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ source: window
+ }
+ });
+ try {
+ parent.document.dispatchEvent(event);
+ } catch (ex) {
+ console.error(`webviewerloaded: ${ex}`);
+ document.dispatchEvent(event);
+ }
+ _app.PDFViewerApplication.run(config);
+ }
+
+ document.blockUnblockOnload?.(true);
+ if (document.readyState === "interactive" || document.readyState === "complete") {
+ webViewerLoad();
+ } else {
+ document.addEventListener("DOMContentLoaded", webViewerLoad, true);
+ }
+ })();
+
+ /******/
+})()
+;
+//# sourceMappingURL=viewer.js.map
\ No newline at end of file
diff --git a/src/main/resources/static/pdfjs/pdf.js b/src/main/resources/static/pdfjs/pdf.js
index 71bd285e..a4ebde2a 100644
--- a/src/main/resources/static/pdfjs/pdf.js
+++ b/src/main/resources/static/pdfjs/pdf.js
@@ -22,11 +22,13 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
+ module.exports = root.pdfjsLib = factory();
else if(typeof define === 'function' && define.amd)
- define("pdfjs-dist/build/pdf", [], factory);
+ define("pdfjs-dist/build/pdf", [], () => {
+ return (root.pdfjsLib = factory());
+ });
else if(typeof exports === 'object')
- exports["pdfjs-dist/build/pdf"] = factory();
+ exports["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
else
root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
})(globalThis, () => {
@@ -42,18 +44,18 @@ return /******/ (() => { // webpackBootstrap
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
-exports.arrayByteLength = arrayByteLength;
-exports.arraysToBytes = arraysToBytes;
+ exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PromiseCapability = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.MAX_IMAGE_SIZE_TO_CACHE = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationReplyType = exports.AnnotationPrefix = exports.AnnotationMode = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
exports.assert = assert;
exports.bytesToString = bytesToString;
-exports.createPromiseCapability = createPromiseCapability;
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
exports.getModificationDate = getModificationDate;
+ exports.getUuid = getUuid;
exports.getVerbosityLevel = getVerbosityLevel;
exports.info = info;
exports.isArrayBuffer = isArrayBuffer;
exports.isArrayEqual = isArrayEqual;
+ exports.isNodeJS = void 0;
+ exports.normalizeUnicode = normalizeUnicode;
exports.objectFromMap = objectFromMap;
exports.objectSize = objectSize;
exports.setVerbosityLevel = setVerbosityLevel;
@@ -65,11 +67,14 @@ exports.stringToUTF8String = stringToUTF8String;
exports.unreachable = unreachable;
exports.utf8StringToString = utf8StringToString;
exports.warn = warn;
-;
+ const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
+ exports.isNodeJS = isNodeJS;
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
+ const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
+ exports.MAX_IMAGE_SIZE_TO_CACHE = MAX_IMAGE_SIZE_TO_CACHE;
const LINE_FACTOR = 1.35;
exports.LINE_FACTOR = LINE_FACTOR;
const LINE_DESCENT_FACTOR = 0.35;
@@ -100,16 +105,19 @@ const AnnotationEditorType = {
DISABLE: -1,
NONE: 0,
FREETEXT: 3,
+ STAMP: 13,
INK: 15
};
exports.AnnotationEditorType = AnnotationEditorType;
const AnnotationEditorParamsType = {
- FREETEXT_SIZE: 1,
- FREETEXT_COLOR: 2,
- FREETEXT_OPACITY: 3,
- INK_COLOR: 11,
- INK_THICKNESS: 12,
- INK_OPACITY: 13
+ RESIZE: 1,
+ CREATE: 2,
+ FREETEXT_SIZE: 11,
+ FREETEXT_COLOR: 12,
+ FREETEXT_OPACITY: 13,
+ INK_COLOR: 21,
+ INK_THICKNESS: 22,
+ INK_OPACITY: 23
};
exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
const PermissionFlag = {
@@ -171,24 +179,6 @@ const AnnotationType = {
REDACT: 26
};
exports.AnnotationType = AnnotationType;
-const AnnotationStateModelType = {
- MARKED: "Marked",
- REVIEW: "Review"
-};
-exports.AnnotationStateModelType = AnnotationStateModelType;
-const AnnotationMarkedState = {
- MARKED: "Marked",
- UNMARKED: "Unmarked"
-};
-exports.AnnotationMarkedState = AnnotationMarkedState;
-const AnnotationReviewState = {
- ACCEPTED: "Accepted",
- REJECTED: "Rejected",
- CANCELLED: "Cancelled",
- COMPLETED: "Completed",
- NONE: "None"
-};
-exports.AnnotationReviewState = AnnotationReviewState;
const AnnotationReplyType = {
GROUP: "Group",
REPLY: "R"
@@ -369,29 +359,6 @@ const OPS = {
constructPath: 91
};
exports.OPS = OPS;
-const UNSUPPORTED_FEATURES = {
- forms: "forms",
- javaScript: "javaScript",
- signatures: "signatures",
- smask: "smask",
- shadingPattern: "shadingPattern",
- errorTilingPattern: "errorTilingPattern",
- errorExtGState: "errorExtGState",
- errorXObject: "errorXObject",
- errorFontLoadType3: "errorFontLoadType3",
- errorFontState: "errorFontState",
- errorFontMissing: "errorFontMissing",
- errorFontTranslate: "errorFontTranslate",
- errorColorSpace: "errorColorSpace",
- errorOperatorList: "errorOperatorList",
- errorFontToUnicode: "errorFontToUnicode",
- errorFontLoadNative: "errorFontLoadNative",
- errorFontBuildPath: "errorFontBuildPath",
- errorFontGetPath: "errorFontGetPath",
- errorMarkedContent: "errorMarkedContent",
- errorContentSubStream: "errorContentSubStream"
-};
-exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
const PasswordResponses = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2
@@ -425,10 +392,7 @@ function assert(cond, msg) {
}
}
function _isValidProtocol(url) {
- if (!url) {
- return false;
- }
- switch (url.protocol) {
+ switch (url?.protocol) {
case "http:":
case "https:":
case "ftp:":
@@ -447,21 +411,23 @@ function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
if (options && typeof url === "string") {
if (options.addDefaultProtocol && url.startsWith("www.")) {
const dots = url.match(/\./g);
- if (dots && dots.length >= 2) {
+ if (dots?.length >= 2) {
url = `http://${url}`;
}
}
if (options.tryConvertEncoding) {
try {
url = stringToUTF8String(url);
- } catch (ex) {}
+ } catch {
+ }
}
}
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
if (_isValidProtocol(absoluteUrl)) {
return absoluteUrl;
}
- } catch (ex) {}
+ } catch {
+ }
return null;
}
function shadow(obj, prop, value, nonSerializable = false) {
@@ -532,7 +498,7 @@ class AbortException extends BaseException {
}
exports.AbortException = AbortException;
function bytesToString(bytes) {
- if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
+ if (typeof bytes !== "object" || bytes?.length === undefined) {
unreachable("Invalid argument for bytesToString");
}
const length = bytes.length;
@@ -559,41 +525,6 @@ function stringToBytes(str) {
}
return bytes;
}
-function arrayByteLength(arr) {
- if (arr.length !== undefined) {
- return arr.length;
- }
- if (arr.byteLength !== undefined) {
- return arr.byteLength;
- }
- unreachable("Invalid argument for arrayByteLength");
-}
-function arraysToBytes(arr) {
- const length = arr.length;
- if (length === 1 && arr[0] instanceof Uint8Array) {
- return arr[0];
- }
- let resultLength = 0;
- for (let i = 0; i < length; i++) {
- resultLength += arrayByteLength(arr[i]);
- }
- let pos = 0;
- const data = new Uint8Array(resultLength);
- for (let i = 0; i < length; i++) {
- let item = arr[i];
- if (!(item instanceof Uint8Array)) {
- if (typeof item === "string") {
- item = stringToBytes(item);
- } else {
- item = new Uint8Array(item);
- }
- }
- const itemLength = item.byteLength;
- data.set(item, pos);
- pos += itemLength;
- }
- return data;
-}
function string32(value) {
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
}
@@ -617,7 +548,7 @@ function isEvalSupported() {
try {
new Function("");
return true;
- } catch (e) {
+ } catch {
return false;
}
}
@@ -643,6 +574,10 @@ class FeatureTest {
isMac: navigator.platform.includes("Mac")
});
}
+
+ static get isCSSRoundSupported() {
+ return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
+ }
}
exports.FeatureTest = FeatureTest;
const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
@@ -709,10 +644,10 @@ class Util {
return [xt, yt];
}
static getAxialAlignedBoundingBox(r, m) {
- const p1 = Util.applyTransform(r, m);
- const p2 = Util.applyTransform(r.slice(2, 4), m);
- const p3 = Util.applyTransform([r[0], r[3]], m);
- const p4 = Util.applyTransform([r[2], r[1]], m);
+ const p1 = this.applyTransform(r, m);
+ const p2 = this.applyTransform(r.slice(2, 4), m);
+ const p3 = this.applyTransform([r[0], r[3]], m);
+ const p4 = this.applyTransform([r[2], r[1]], m);
return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
}
static inverseTransform(m) {
@@ -849,7 +784,7 @@ function utf8StringToString(str) {
return unescape(encodeURIComponent(str));
}
function isArrayBuffer(v) {
- return typeof v === "object" && v !== null && v.byteLength !== undefined;
+ return typeof v === "object" && v?.byteLength !== undefined;
}
function isArrayEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
@@ -866,26 +801,59 @@ function getModificationDate(date = new Date()) {
const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
return buffer.join("");
}
-function createPromiseCapability() {
- const capability = Object.create(null);
- let isSettled = false;
- Object.defineProperty(capability, "settled", {
- get() {
- return isSettled;
- }
- });
- capability.promise = new Promise(function (resolve, reject) {
- capability.resolve = function (data) {
- isSettled = true;
- resolve(data);
- };
- capability.reject = function (reason) {
- isSettled = true;
- reject(reason);
- };
- });
- return capability;
-}
+
+ class PromiseCapability {
+ #settled = false;
+
+ constructor() {
+ this.promise = new Promise((resolve, reject) => {
+ this.resolve = data => {
+ this.#settled = true;
+ resolve(data);
+ };
+ this.reject = reason => {
+ this.#settled = true;
+ reject(reason);
+ };
+ });
+ }
+
+ get settled() {
+ return this.#settled;
+ }
+ }
+
+ exports.PromiseCapability = PromiseCapability;
+ let NormalizeRegex = null;
+ let NormalizationMap = null;
+
+ function normalizeUnicode(str) {
+ if (!NormalizeRegex) {
+ NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
+ NormalizationMap = new Map([["ſt", "ſt"]]);
+ }
+ return str.replaceAll(NormalizeRegex, (_, p1, p2) => {
+ return p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2);
+ });
+ }
+
+ function getUuid() {
+ if (typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function") {
+ return crypto.randomUUID();
+ }
+ const buf = new Uint8Array(32);
+ if (typeof crypto !== "undefined" && typeof crypto?.getRandomValues === "function") {
+ crypto.getRandomValues(buf);
+ } else {
+ for (let i = 0; i < 32; i++) {
+ buf[i] = Math.floor(Math.random() * 255);
+ }
+ }
+ return bytesToString(buf);
+ }
+
+ const AnnotationPrefix = "pdfjs_internal_id_";
+ exports.AnnotationPrefix = AnnotationPrefix;
/***/ }),
/* 2 */
@@ -896,60 +864,43 @@ function createPromiseCapability() {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.build = exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0;
+ exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultFilterFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0;
+ Object.defineProperty(exports, "SVGGraphics", ({
+ enumerable: true,
+ get: function () {
+ return _displaySvg.SVGGraphics;
+ }
+ }));
+ exports.build = void 0;
exports.getDocument = getDocument;
exports.version = void 0;
var _util = __w_pdfjs_require__(1);
var _annotation_storage = __w_pdfjs_require__(3);
var _display_utils = __w_pdfjs_require__(6);
var _font_loader = __w_pdfjs_require__(9);
+ var _displayNode_utils = __w_pdfjs_require__(10);
var _canvas = __w_pdfjs_require__(11);
var _worker_options = __w_pdfjs_require__(14);
-var _is_node = __w_pdfjs_require__(10);
var _message_handler = __w_pdfjs_require__(15);
var _metadata = __w_pdfjs_require__(16);
var _optional_content_config = __w_pdfjs_require__(17);
var _transport_stream = __w_pdfjs_require__(18);
-var _xfa_text = __w_pdfjs_require__(19);
+ var _displayFetch_stream = __w_pdfjs_require__(19);
+ var _displayNetwork = __w_pdfjs_require__(22);
+ var _displayNode_stream = __w_pdfjs_require__(23);
+ var _displaySvg = __w_pdfjs_require__(24);
+ var _xfa_text = __w_pdfjs_require__(25);
const DEFAULT_RANGE_CHUNK_SIZE = 65536;
const RENDERING_CANCELLED_TIMEOUT = 100;
-let DefaultCanvasFactory = _display_utils.DOMCanvasFactory;
+ const DELAYED_CLEANUP_TIMEOUT = 5000;
+ const DefaultCanvasFactory = _util.isNodeJS ? _displayNode_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory;
exports.DefaultCanvasFactory = DefaultCanvasFactory;
-let DefaultCMapReaderFactory = _display_utils.DOMCMapReaderFactory;
+ const DefaultCMapReaderFactory = _util.isNodeJS ? _displayNode_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory;
exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory;
-let DefaultStandardFontDataFactory = _display_utils.DOMStandardFontDataFactory;
+ const DefaultFilterFactory = _util.isNodeJS ? _displayNode_utils.NodeFilterFactory : _display_utils.DOMFilterFactory;
+ exports.DefaultFilterFactory = DefaultFilterFactory;
+ const DefaultStandardFontDataFactory = _util.isNodeJS ? _displayNode_utils.NodeStandardFontDataFactory : _display_utils.DOMStandardFontDataFactory;
exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory;
-if (_is_node.isNodeJS) {
- const {
- NodeCanvasFactory,
- NodeCMapReaderFactory,
- NodeStandardFontDataFactory
- } = __w_pdfjs_require__(20);
- exports.DefaultCanvasFactory = DefaultCanvasFactory = NodeCanvasFactory;
- exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory = NodeCMapReaderFactory;
- exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory = NodeStandardFontDataFactory;
-}
-let createPDFNetworkStream;
-{
- if (_is_node.isNodeJS) {
- const {
- PDFNodeStream
- } = __w_pdfjs_require__(21);
- createPDFNetworkStream = params => {
- return new PDFNodeStream(params);
- };
- } else {
- const {
- PDFNetworkStream
- } = __w_pdfjs_require__(24);
- const {
- PDFFetchStream
- } = __w_pdfjs_require__(25);
- createPDFNetworkStream = params => {
- return (0, _display_utils.isValidFetchUrl)(params.url) ? new PDFFetchStream(params) : new PDFNetworkStream(params);
- };
- }
-}
function getDocument(src) {
if (typeof src === "string" || src instanceof URL) {
src = {
@@ -959,145 +910,143 @@ function getDocument(src) {
src = {
data: src
};
- } else if (src instanceof PDFDataRangeTransport) {
- (0, _display_utils.deprecated)("`PDFDataRangeTransport`-instance, " + "please use a parameter object with `range`-property instead.");
- src = {
- range: src
- };
- } else {
+ }
if (typeof src !== "object") {
- throw new Error("Invalid parameter in getDocument, " + "need either string, URL, TypedArray, or parameter object.");
- }
+ throw new Error("Invalid parameter in getDocument, need parameter object.");
}
if (!src.url && !src.data && !src.range) {
throw new Error("Invalid parameter object: need either .data, .range or .url");
}
const task = new PDFDocumentLoadingTask();
- const params = Object.create(null);
- let rangeTransport = null,
- worker = null;
- for (const key in src) {
- const val = src[key];
- switch (key) {
- case "url":
- if (val instanceof URL) {
- params[key] = val.href;
- continue;
- }
- try {
- params[key] = new URL(val, window.location).href;
- continue;
- } catch (ex) {
- if (_is_node.isNodeJS && typeof val === "string") {
- break;
- }
- }
- throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property.");
- case "range":
- rangeTransport = val;
- continue;
- case "worker":
- worker = val;
- continue;
- case "data":
- if (_is_node.isNodeJS && typeof Buffer !== "undefined" && val instanceof Buffer) {
- params[key] = new Uint8Array(val);
- } else if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
- break;
- } else if (typeof val === "string") {
- params[key] = (0, _util.stringToBytes)(val);
- } else if (typeof val === "object" && val !== null && !isNaN(val.length) || (0, _util.isArrayBuffer)(val)) {
- params[key] = new Uint8Array(val);
- } else {
- throw new Error("Invalid PDF binary data: either TypedArray, " + "string, or array-like object is expected in the data property.");
- }
- continue;
- }
- params[key] = val;
+ const {
+ docId
+ } = task;
+ const url = src.url ? getUrlProp(src.url) : null;
+ const data = src.data ? getDataProp(src.data) : null;
+ const httpHeaders = src.httpHeaders || null;
+ const withCredentials = src.withCredentials === true;
+ const password = src.password ?? null;
+ const rangeTransport = src.range instanceof PDFDataRangeTransport ? src.range : null;
+ const rangeChunkSize = Number.isInteger(src.rangeChunkSize) && src.rangeChunkSize > 0 ? src.rangeChunkSize : DEFAULT_RANGE_CHUNK_SIZE;
+ let worker = src.worker instanceof PDFWorker ? src.worker : null;
+ const verbosity = src.verbosity;
+ const docBaseUrl = typeof src.docBaseUrl === "string" && !(0, _display_utils.isDataScheme)(src.docBaseUrl) ? src.docBaseUrl : null;
+ const cMapUrl = typeof src.cMapUrl === "string" ? src.cMapUrl : null;
+ const cMapPacked = src.cMapPacked !== false;
+ const CMapReaderFactory = src.CMapReaderFactory || DefaultCMapReaderFactory;
+ const standardFontDataUrl = typeof src.standardFontDataUrl === "string" ? src.standardFontDataUrl : null;
+ const StandardFontDataFactory = src.StandardFontDataFactory || DefaultStandardFontDataFactory;
+ const ignoreErrors = src.stopAtErrors !== true;
+ const maxImageSize = Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 ? src.maxImageSize : -1;
+ const isEvalSupported = src.isEvalSupported !== false;
+ const isOffscreenCanvasSupported = typeof src.isOffscreenCanvasSupported === "boolean" ? src.isOffscreenCanvasSupported : !_util.isNodeJS;
+ const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes) ? src.canvasMaxAreaInBytes : -1;
+ const disableFontFace = typeof src.disableFontFace === "boolean" ? src.disableFontFace : _util.isNodeJS;
+ const fontExtraProperties = src.fontExtraProperties === true;
+ const enableXfa = src.enableXfa === true;
+ const ownerDocument = src.ownerDocument || globalThis.document;
+ const disableRange = src.disableRange === true;
+ const disableStream = src.disableStream === true;
+ const disableAutoFetch = src.disableAutoFetch === true;
+ const pdfBug = src.pdfBug === true;
+ const length = rangeTransport ? rangeTransport.length : src.length ?? NaN;
+ const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !_util.isNodeJS && !disableFontFace;
+ const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : CMapReaderFactory === _display_utils.DOMCMapReaderFactory && StandardFontDataFactory === _display_utils.DOMStandardFontDataFactory && cMapUrl && standardFontDataUrl && (0, _display_utils.isValidFetchUrl)(cMapUrl, document.baseURI) && (0, _display_utils.isValidFetchUrl)(standardFontDataUrl, document.baseURI);
+ const canvasFactory = src.canvasFactory || new DefaultCanvasFactory({
+ ownerDocument
+ });
+ const filterFactory = src.filterFactory || new DefaultFilterFactory({
+ docId,
+ ownerDocument
+ });
+ const styleElement = null;
+ (0, _util.setVerbosityLevel)(verbosity);
+ const transportFactory = {
+ canvasFactory,
+ filterFactory
+ };
+ if (!useWorkerFetch) {
+ transportFactory.cMapReaderFactory = new CMapReaderFactory({
+ baseUrl: cMapUrl,
+ isCompressed: cMapPacked
+ });
+ transportFactory.standardFontDataFactory = new StandardFontDataFactory({
+ baseUrl: standardFontDataUrl
+ });
}
- params.CMapReaderFactory = params.CMapReaderFactory || DefaultCMapReaderFactory;
- params.StandardFontDataFactory = params.StandardFontDataFactory || DefaultStandardFontDataFactory;
- params.ignoreErrors = params.stopAtErrors !== true;
- params.fontExtraProperties = params.fontExtraProperties === true;
- params.pdfBug = params.pdfBug === true;
- params.enableXfa = params.enableXfa === true;
- if (!Number.isInteger(params.rangeChunkSize) || params.rangeChunkSize < 1) {
- params.rangeChunkSize = DEFAULT_RANGE_CHUNK_SIZE;
- }
- if (typeof params.docBaseUrl !== "string" || (0, _display_utils.isDataScheme)(params.docBaseUrl)) {
- params.docBaseUrl = null;
- }
- if (!Number.isInteger(params.maxImageSize) || params.maxImageSize < -1) {
- params.maxImageSize = -1;
- }
- if (typeof params.cMapUrl !== "string") {
- params.cMapUrl = null;
- }
- if (typeof params.standardFontDataUrl !== "string") {
- params.standardFontDataUrl = null;
- }
- if (typeof params.useWorkerFetch !== "boolean") {
- params.useWorkerFetch = params.CMapReaderFactory === _display_utils.DOMCMapReaderFactory && params.StandardFontDataFactory === _display_utils.DOMStandardFontDataFactory && (0, _display_utils.isValidFetchUrl)(params.cMapUrl, document.baseURI) && (0, _display_utils.isValidFetchUrl)(params.standardFontDataUrl, document.baseURI);
- }
- if (typeof params.isEvalSupported !== "boolean") {
- params.isEvalSupported = true;
- }
- if (typeof params.isOffscreenCanvasSupported !== "boolean") {
- params.isOffscreenCanvasSupported = !_is_node.isNodeJS;
- }
- if (typeof params.disableFontFace !== "boolean") {
- params.disableFontFace = _is_node.isNodeJS;
- }
- if (typeof params.useSystemFonts !== "boolean") {
- params.useSystemFonts = !_is_node.isNodeJS && !params.disableFontFace;
- }
- if (typeof params.ownerDocument !== "object" || params.ownerDocument === null) {
- params.ownerDocument = globalThis.document;
- }
- if (typeof params.disableRange !== "boolean") {
- params.disableRange = false;
- }
- if (typeof params.disableStream !== "boolean") {
- params.disableStream = false;
- }
- if (typeof params.disableAutoFetch !== "boolean") {
- params.disableAutoFetch = false;
- }
- (0, _util.setVerbosityLevel)(params.verbosity);
if (!worker) {
const workerParams = {
- verbosity: params.verbosity,
+ verbosity,
port: _worker_options.GlobalWorkerOptions.workerPort
};
worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
task._worker = worker;
}
- const docId = task.docId;
+ const fetchDocParams = {
+ docId,
+ apiVersion: '3.11.174',
+ data,
+ password,
+ disableAutoFetch,
+ rangeChunkSize,
+ length,
+ docBaseUrl,
+ enableXfa,
+ evaluatorOptions: {
+ maxImageSize,
+ disableFontFace,
+ ignoreErrors,
+ isEvalSupported,
+ isOffscreenCanvasSupported,
+ canvasMaxAreaInBytes,
+ fontExtraProperties,
+ useSystemFonts,
+ cMapUrl: useWorkerFetch ? cMapUrl : null,
+ standardFontDataUrl: useWorkerFetch ? standardFontDataUrl : null
+ }
+ };
+ const transportParams = {
+ ignoreErrors,
+ isEvalSupported,
+ disableFontFace,
+ fontExtraProperties,
+ enableXfa,
+ ownerDocument,
+ disableAutoFetch,
+ pdfBug,
+ styleElement
+ };
worker.promise.then(function () {
if (task.destroyed) {
throw new Error("Loading aborted");
}
- const workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId);
+ const workerIdPromise = _fetchDocument(worker, fetchDocParams);
const networkStreamPromise = new Promise(function (resolve) {
let networkStream;
if (rangeTransport) {
networkStream = new _transport_stream.PDFDataTransportStream({
- length: params.length,
- initialData: params.initialData,
- progressiveDone: params.progressiveDone,
- contentDispositionFilename: params.contentDispositionFilename,
- disableRange: params.disableRange,
- disableStream: params.disableStream
+ length,
+ initialData: rangeTransport.initialData,
+ progressiveDone: rangeTransport.progressiveDone,
+ contentDispositionFilename: rangeTransport.contentDispositionFilename,
+ disableRange,
+ disableStream
}, rangeTransport);
- } else if (!params.data) {
+ } else if (!data) {
+ const createPDFNetworkStream = params => {
+ if (_util.isNodeJS) {
+ return new _displayNode_stream.PDFNodeStream(params);
+ }
+ return (0, _display_utils.isValidFetchUrl)(params.url) ? new _displayFetch_stream.PDFFetchStream(params) : new _displayNetwork.PDFNetworkStream(params);
+ };
networkStream = createPDFNetworkStream({
- url: params.url,
- length: params.length,
- httpHeaders: params.httpHeaders,
- withCredentials: params.withCredentials,
- rangeChunkSize: params.rangeChunkSize,
- disableRange: params.disableRange,
- disableStream: params.disableStream
+ url,
+ length,
+ httpHeaders,
+ withCredentials,
+ rangeChunkSize,
+ disableRange,
+ disableStream
});
}
resolve(networkStream);
@@ -1107,56 +1056,58 @@ function getDocument(src) {
throw new Error("Loading aborted");
}
const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
- const transport = new WorkerTransport(messageHandler, task, networkStream, params);
+ const transport = new WorkerTransport(messageHandler, task, networkStream, transportParams, transportFactory);
task._transport = transport;
messageHandler.send("Ready", null);
});
}).catch(task._capability.reject);
return task;
}
-async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
+
+ async function _fetchDocument(worker, source) {
if (worker.destroyed) {
throw new Error("Worker was destroyed");
}
- if (pdfDataRangeTransport) {
- source.length = pdfDataRangeTransport.length;
- source.initialData = pdfDataRangeTransport.initialData;
- source.progressiveDone = pdfDataRangeTransport.progressiveDone;
- source.contentDispositionFilename = pdfDataRangeTransport.contentDispositionFilename;
- }
- const transfers = source.data ? [source.data.buffer] : null;
- const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
- docId,
- apiVersion: '3.3.122',
- data: source.data,
- password: source.password,
- disableAutoFetch: source.disableAutoFetch,
- rangeChunkSize: source.rangeChunkSize,
- length: source.length,
- docBaseUrl: source.docBaseUrl,
- enableXfa: source.enableXfa,
- evaluatorOptions: {
- maxImageSize: source.maxImageSize,
- disableFontFace: source.disableFontFace,
- ignoreErrors: source.ignoreErrors,
- isEvalSupported: source.isEvalSupported,
- isOffscreenCanvasSupported: source.isOffscreenCanvasSupported,
- fontExtraProperties: source.fontExtraProperties,
- useSystemFonts: source.useSystemFonts,
- cMapUrl: source.useWorkerFetch ? source.cMapUrl : null,
- standardFontDataUrl: source.useWorkerFetch ? source.standardFontDataUrl : null
- }
- }, transfers);
+ const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", source, source.data ? [source.data.buffer] : null);
if (worker.destroyed) {
throw new Error("Worker was destroyed");
}
return workerId;
}
+
+ function getUrlProp(val) {
+ if (val instanceof URL) {
+ return val.href;
+ }
+ try {
+ return new URL(val, window.location).href;
+ } catch {
+ if (_util.isNodeJS && typeof val === "string") {
+ return val;
+ }
+ }
+ throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property.");
+ }
+
+ function getDataProp(val) {
+ if (_util.isNodeJS && typeof Buffer !== "undefined" && val instanceof Buffer) {
+ throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
+ }
+ if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
+ return val;
+ }
+ if (typeof val === "string") {
+ return (0, _util.stringToBytes)(val);
+ }
+ if (typeof val === "object" && !isNaN(val?.length) || (0, _util.isArrayBuffer)(val)) {
+ return new Uint8Array(val);
+ }
+ throw new Error("Invalid PDF binary data: either TypedArray, " + "string, or array-like object is expected in the data property.");
+ }
class PDFDocumentLoadingTask {
static #docId = 0;
- #onUnsupportedFeature = null;
constructor() {
- this._capability = (0, _util.createPromiseCapability)();
+ this._capability = new _util.PromiseCapability();
this._transport = null;
this._worker = null;
this.docId = `d${PDFDocumentLoadingTask.#docId++}`;
@@ -1164,19 +1115,22 @@ class PDFDocumentLoadingTask {
this.onPassword = null;
this.onProgress = null;
}
- get onUnsupportedFeature() {
- return this.#onUnsupportedFeature;
- }
- set onUnsupportedFeature(callback) {
- (0, _display_utils.deprecated)("The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future.");
- this.#onUnsupportedFeature = callback;
- }
get promise() {
return this._capability.promise;
}
async destroy() {
this.destroyed = true;
- await this._transport?.destroy();
+ try {
+ if (this._worker?.port) {
+ this._worker._pendingDestroy = true;
+ }
+ await this._transport?.destroy();
+ } catch (ex) {
+ if (this._worker?.port) {
+ delete this._worker._pendingDestroy;
+ }
+ throw ex;
+ }
this._transport = null;
if (this._worker) {
this._worker.destroy();
@@ -1195,7 +1149,7 @@ class PDFDataRangeTransport {
this._progressListeners = [];
this._progressiveReadListeners = [];
this._progressiveDoneListeners = [];
- this._readyCapability = (0, _util.createPromiseCapability)();
+ this._readyCapability = new _util.PromiseCapability();
}
addRangeListener(listener) {
this._rangeListeners.push(listener);
@@ -1248,10 +1202,29 @@ class PDFDocumentProxy {
constructor(pdfInfo, transport) {
this._pdfInfo = pdfInfo;
this._transport = transport;
+ Object.defineProperty(this, "getJavaScript", {
+ value: () => {
+ (0, _display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, " + "please use `PDFDocumentProxy.getJSActions` instead.");
+ return this.getJSActions().then(js => {
+ if (!js) {
+ return js;
+ }
+ const jsArr = [];
+ for (const name in js) {
+ jsArr.push(...js[name]);
+ }
+ return jsArr;
+ });
+ }
+ });
}
get annotationStorage() {
return this._transport.annotationStorage;
}
+
+ get filterFactory() {
+ return this._transport.filterFactory;
+ }
get numPages() {
return this._pdfInfo.numPages;
}
@@ -1294,9 +1267,6 @@ class PDFDocumentProxy {
getAttachments() {
return this._transport.getAttachments();
}
- getJavaScript() {
- return this._transport.getJavaScript();
- }
getJSActions() {
return this._transport.getDocJSActions();
}
@@ -1348,18 +1318,18 @@ class PDFDocumentProxy {
}
exports.PDFDocumentProxy = PDFDocumentProxy;
class PDFPageProxy {
- constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) {
+ #delayedCleanupTimeout = null;
+ #pendingCleanup = false;
+
+ constructor(pageIndex, pageInfo, transport, pdfBug = false) {
this._pageIndex = pageIndex;
this._pageInfo = pageInfo;
- this._ownerDocument = ownerDocument;
this._transport = transport;
this._stats = pdfBug ? new _display_utils.StatTimer() : null;
this._pdfBug = pdfBug;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
- this._bitmaps = new Set();
- this.cleanupAfterRender = false;
- this.pendingCleanup = false;
+ this._maybeCleanupAfterRender = false;
this._intentStates = new Map();
this.destroyed = false;
}
@@ -1403,6 +1373,10 @@ class PDFPageProxy {
getJSActions() {
return this._transport.getPageJSActions(this._pageIndex);
}
+
+ get filterFactory() {
+ return this._transport.filterFactory;
+ }
get isPureXfa() {
return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
}
@@ -1415,7 +1389,6 @@ class PDFPageProxy {
intent = "display",
annotationMode = _util.AnnotationMode.ENABLE,
transform = null,
- canvasFactory = null,
background = null,
optionalContentConfigPromise = null,
annotationCanvasMap = null,
@@ -1424,7 +1397,8 @@ class PDFPageProxy {
}) {
this._stats?.time("Overall");
const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage);
- this.pendingCleanup = false;
+ this.#pendingCleanup = false;
+ this.#abortDelayedCleanup();
if (!optionalContentConfigPromise) {
optionalContentConfigPromise = this._transport.getOptionalContentConfig();
}
@@ -1437,12 +1411,9 @@ class PDFPageProxy {
clearTimeout(intentState.streamReaderCancelTimeout);
intentState.streamReaderCancelTimeout = null;
}
- const canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory({
- ownerDocument: this._ownerDocument
- });
const intentPrint = !!(intentArgs.renderingIntent & _util.RenderingIntentFlag.PRINT);
if (!intentState.displayReadyCapability) {
- intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
+ intentState.displayReadyCapability = new _util.PromiseCapability();
intentState.operatorList = {
fnArray: [],
argsArray: [],
@@ -1454,10 +1425,10 @@ class PDFPageProxy {
}
const complete = error => {
intentState.renderTasks.delete(internalRenderTask);
- if (this.cleanupAfterRender || intentPrint) {
- this.pendingCleanup = true;
+ if (this._maybeCleanupAfterRender || intentPrint) {
+ this.#pendingCleanup = true;
}
- this._tryCleanup();
+ this.#tryCleanup(!intentPrint);
if (error) {
internalRenderTask.capability.reject(error);
this._abortOperatorList({
@@ -1483,7 +1454,8 @@ class PDFPageProxy {
annotationCanvasMap,
operatorList: intentState.operatorList,
pageIndex: this._pageIndex,
- canvasFactory: canvasFactoryInstance,
+ canvasFactory: this._transport.canvasFactory,
+ filterFactory: this._transport.filterFactory,
useRequestAnimationFrame: !intentPrint,
pdfBug: this._pdfBug,
pageColors
@@ -1491,7 +1463,7 @@ class PDFPageProxy {
(intentState.renderTasks ||= new Set()).add(internalRenderTask);
const renderTask = internalRenderTask.task;
Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
- if (this.pendingCleanup) {
+ if (this.destroyed) {
complete();
return;
}
@@ -1525,7 +1497,7 @@ class PDFPageProxy {
if (!intentState.opListReadCapability) {
opListTask = Object.create(null);
opListTask.operatorListChanged = operatorListChanged;
- intentState.opListReadCapability = (0, _util.createPromiseCapability)();
+ intentState.opListReadCapability = new _util.PromiseCapability();
(intentState.renderTasks ||= new Set()).add(opListTask);
intentState.operatorList = {
fnArray: [],
@@ -1539,14 +1511,14 @@ class PDFPageProxy {
return intentState.opListReadCapability.promise;
}
streamTextContent({
- disableCombineTextItems = false,
- includeMarkedContent = false
+ includeMarkedContent = false,
+ disableNormalization = false
} = {}) {
const TEXT_CONTENT_CHUNK_SIZE = 100;
return this._transport.messageHandler.sendWithStream("GetTextContent", {
pageIndex: this._pageIndex,
- combineTextItems: disableCombineTextItems !== true,
- includeMarkedContent: includeMarkedContent === true
+ includeMarkedContent: includeMarkedContent === true,
+ disableNormalization: disableNormalization === true
}, {
highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
size(textContent) {
@@ -1605,19 +1577,29 @@ class PDFPageProxy {
}
}
this.objs.clear();
- for (const bitmap of this._bitmaps) {
- bitmap.close();
- }
- this._bitmaps.clear();
- this.pendingCleanup = false;
+ this.#pendingCleanup = false;
+ this.#abortDelayedCleanup();
return Promise.all(waitOn);
}
cleanup(resetStats = false) {
- this.pendingCleanup = true;
- return this._tryCleanup(resetStats);
+ this.#pendingCleanup = true;
+ const success = this.#tryCleanup(false);
+ if (resetStats && success) {
+ this._stats &&= new _display_utils.StatTimer();
+ }
+ return success;
}
- _tryCleanup(resetStats = false) {
- if (!this.pendingCleanup) {
+
+ #tryCleanup(delayed = false) {
+ this.#abortDelayedCleanup();
+ if (!this.#pendingCleanup || this.destroyed) {
+ return false;
+ }
+ if (delayed) {
+ this.#delayedCleanupTimeout = setTimeout(() => {
+ this.#delayedCleanupTimeout = null;
+ this.#tryCleanup(false);
+ }, DELAYED_CLEANUP_TIMEOUT);
return false;
}
for (const {
@@ -1630,16 +1612,16 @@ class PDFPageProxy {
}
this._intentStates.clear();
this.objs.clear();
- if (resetStats && this._stats) {
- this._stats = new _display_utils.StatTimer();
- }
- for (const bitmap of this._bitmaps) {
- bitmap.close();
- }
- this._bitmaps.clear();
- this.pendingCleanup = false;
+ this.#pendingCleanup = false;
return true;
}
+
+ #abortDelayedCleanup() {
+ if (this.#delayedCleanupTimeout) {
+ clearTimeout(this.#delayedCleanupTimeout);
+ this.#delayedCleanupTimeout = null;
+ }
+ }
_startRenderPage(transparency, cacheKey) {
const intentState = this._intentStates.get(cacheKey);
if (!intentState) {
@@ -1659,20 +1641,24 @@ class PDFPageProxy {
internalRenderTask.operatorListChanged();
}
if (operatorListChunk.lastChunk) {
- this._tryCleanup();
+ this.#tryCleanup(true);
}
}
_pumpOperatorList({
renderingIntent,
cacheKey,
- annotationStorageMap
+ annotationStorageSerializable
}) {
+ const {
+ map,
+ transfers
+ } = annotationStorageSerializable;
const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
pageIndex: this._pageIndex,
intent: renderingIntent,
cacheKey,
- annotationStorage: annotationStorageMap
- });
+ annotationStorage: map
+ }, transfers);
const reader = readableStream.getReader();
const intentState = this._intentStates.get(cacheKey);
intentState.streamReader = reader;
@@ -1700,7 +1686,7 @@ class PDFPageProxy {
for (const internalRenderTask of intentState.renderTasks) {
internalRenderTask.operatorListChanged();
}
- this._tryCleanup();
+ this.#tryCleanup(true);
}
if (intentState.displayReadyCapability) {
intentState.displayReadyCapability.reject(reason);
@@ -1764,11 +1750,14 @@ class PDFPageProxy {
}
exports.PDFPageProxy = PDFPageProxy;
class LoopbackPort {
- #listeners = [];
+ #listeners = new Set();
#deferred = Promise.resolve();
- postMessage(obj, transfers) {
+
+ postMessage(obj, transfer) {
const event = {
- data: structuredClone(obj, transfers)
+ data: structuredClone(obj, transfer ? {
+ transfer
+ } : null)
};
this.#deferred.then(() => {
for (const listener of this.#listeners) {
@@ -1777,14 +1766,13 @@ class LoopbackPort {
});
}
addEventListener(name, listener) {
- this.#listeners.push(listener);
+ this.#listeners.add(listener);
}
removeEventListener(name, listener) {
- const i = this.#listeners.indexOf(listener);
- this.#listeners.splice(i, 1);
+ this.#listeners.delete(listener);
}
terminate() {
- this.#listeners.length = 0;
+ this.#listeners.clear();
}
}
exports.LoopbackPort = LoopbackPort;
@@ -1795,7 +1783,7 @@ const PDFWorkerUtil = {
};
exports.PDFWorkerUtil = PDFWorkerUtil;
{
- if (_is_node.isNodeJS && typeof require === "function") {
+ if (_util.isNodeJS && typeof require === "function") {
PDFWorkerUtil.isWorkerDisabled = true;
PDFWorkerUtil.fallbackWorkerSrc = "./pdf.worker.js";
} else if (typeof document === "object") {
@@ -1811,7 +1799,7 @@ exports.PDFWorkerUtil = PDFWorkerUtil;
if (!base.origin || base.origin === "null") {
return false;
}
- } catch (e) {
+ } catch {
return false;
}
const other = new URL(otherUrl, base);
@@ -1823,24 +1811,24 @@ exports.PDFWorkerUtil = PDFWorkerUtil;
};
}
class PDFWorker {
- static #workerPorts = new WeakMap();
+ static #workerPorts;
constructor({
name = null,
port = null,
verbosity = (0, _util.getVerbosityLevel)()
} = {}) {
- if (port && PDFWorker.#workerPorts.has(port)) {
- throw new Error("Cannot use more than one PDFWorker per port.");
- }
this.name = name;
this.destroyed = false;
this.verbosity = verbosity;
- this._readyCapability = (0, _util.createPromiseCapability)();
+ this._readyCapability = new _util.PromiseCapability();
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
- PDFWorker.#workerPorts.set(port, this);
+ if (PDFWorker.#workerPorts?.has(port)) {
+ throw new Error("Cannot use more than one PDFWorker per port.");
+ }
+ (PDFWorker.#workerPorts ||= new WeakMap()).set(port, this);
this._initializeFromPort(port);
return;
}
@@ -1919,7 +1907,7 @@ class PDFWorker {
}
try {
sendTest();
- } catch (e) {
+ } catch {
this._setupFakeWorker();
}
});
@@ -1929,7 +1917,7 @@ class PDFWorker {
};
sendTest();
return;
- } catch (e) {
+ } catch {
(0, _util.info)("The worker has been disabled.");
}
}
@@ -1966,7 +1954,7 @@ class PDFWorker {
this._webWorker.terminate();
this._webWorker = null;
}
- PDFWorker.#workerPorts.delete(this._port);
+ PDFWorker.#workerPorts?.delete(this._port);
this._port = null;
if (this._messageHandler) {
this._messageHandler.destroy();
@@ -1977,8 +1965,12 @@ class PDFWorker {
if (!params?.port) {
throw new Error("PDFWorker.fromPort - invalid method signature.");
}
- if (this.#workerPorts.has(params.port)) {
- return this.#workerPorts.get(params.port);
+ const cachedPort = this.#workerPorts?.get(params.port);
+ if (cachedPort) {
+ if (cachedPort._pendingDestroy) {
+ throw new Error("PDFWorker.fromPort - the worker is being destroyed.\n" + "Please remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
+ }
+ return cachedPort;
}
return new PDFWorker(params);
}
@@ -1987,7 +1979,7 @@ class PDFWorker {
return _worker_options.GlobalWorkerOptions.workerSrc;
}
if (PDFWorkerUtil.fallbackWorkerSrc !== null) {
- if (!_is_node.isNodeJS) {
+ if (!_util.isNodeJS) {
(0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');
}
return PDFWorkerUtil.fallbackWorkerSrc;
@@ -1997,7 +1989,7 @@ class PDFWorker {
static get _mainThreadWorkerMessageHandler() {
try {
return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
- } catch (ex) {
+ } catch {
return null;
}
}
@@ -2007,7 +1999,7 @@ class PDFWorker {
if (mainWorkerMessageHandler) {
return mainWorkerMessageHandler;
}
- if (_is_node.isNodeJS && typeof require === "function") {
+ if (_util.isNodeJS && typeof require === "function") {
const worker = eval("require")(this.workerSrc);
return worker.WorkerMessageHandler;
}
@@ -2019,43 +2011,48 @@ class PDFWorker {
}
exports.PDFWorker = PDFWorker;
class WorkerTransport {
+ #methodPromises = new Map();
#pageCache = new Map();
#pagePromises = new Map();
- #metadataPromise = null;
- constructor(messageHandler, loadingTask, networkStream, params) {
+ #passwordCapability = null;
+
+ constructor(messageHandler, loadingTask, networkStream, params, factory) {
this.messageHandler = messageHandler;
this.loadingTask = loadingTask;
this.commonObjs = new PDFObjects();
this.fontLoader = new _font_loader.FontLoader({
- onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
ownerDocument: params.ownerDocument,
styleElement: params.styleElement
});
this._params = params;
- if (!params.useWorkerFetch) {
- this.CMapReaderFactory = new params.CMapReaderFactory({
- baseUrl: params.cMapUrl,
- isCompressed: params.cMapPacked
- });
- this.StandardFontDataFactory = new params.StandardFontDataFactory({
- baseUrl: params.standardFontDataUrl
- });
- }
+ this.canvasFactory = factory.canvasFactory;
+ this.filterFactory = factory.filterFactory;
+ this.cMapReaderFactory = factory.cMapReaderFactory;
+ this.standardFontDataFactory = factory.standardFontDataFactory;
this.destroyed = false;
this.destroyCapability = null;
- this._passwordCapability = null;
this._networkStream = networkStream;
this._fullReader = null;
this._lastProgress = null;
- this.downloadInfoCapability = (0, _util.createPromiseCapability)();
+ this.downloadInfoCapability = new _util.PromiseCapability();
this.setupMessageHandler();
}
+
+ #cacheSimpleMethod(name, data = null) {
+ const cachedPromise = this.#methodPromises.get(name);
+ if (cachedPromise) {
+ return cachedPromise;
+ }
+ const promise = this.messageHandler.sendWithPromise(name, data);
+ this.#methodPromises.set(name, promise);
+ return promise;
+ }
get annotationStorage() {
return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
}
getRenderingIntent(intent, annotationMode = _util.AnnotationMode.ENABLE, printAnnotationStorage = null, isOpList = false) {
let renderingIntent = _util.RenderingIntentFlag.DISPLAY;
- let annotationMap = null;
+ let annotationStorageSerializable = _annotation_storage.SerializableEmpty;
switch (intent) {
case "any":
renderingIntent = _util.RenderingIntentFlag.ANY;
@@ -2080,7 +2077,7 @@ class WorkerTransport {
case _util.AnnotationMode.ENABLE_STORAGE:
renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE;
const annotationStorage = renderingIntent & _util.RenderingIntentFlag.PRINT && printAnnotationStorage instanceof _annotation_storage.PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
- annotationMap = annotationStorage.serializable;
+ annotationStorageSerializable = annotationStorage.serializable;
break;
default:
(0, _util.warn)(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
@@ -2090,8 +2087,8 @@ class WorkerTransport {
}
return {
renderingIntent,
- cacheKey: `${renderingIntent}_${_annotation_storage.AnnotationStorage.getHash(annotationMap)}`,
- annotationStorageMap: annotationMap
+ cacheKey: `${renderingIntent}_${annotationStorageSerializable.hash}`,
+ annotationStorageSerializable
};
}
destroy() {
@@ -2099,10 +2096,8 @@ class WorkerTransport {
return this.destroyCapability.promise;
}
this.destroyed = true;
- this.destroyCapability = (0, _util.createPromiseCapability)();
- if (this._passwordCapability) {
- this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));
- }
+ this.destroyCapability = new _util.PromiseCapability();
+ this.#passwordCapability?.reject(new Error("Worker was destroyed during onPassword callback"));
const waitOn = [];
for (const page of this.#pageCache.values()) {
waitOn.push(page._destroy());
@@ -2117,12 +2112,9 @@ class WorkerTransport {
Promise.all(waitOn).then(() => {
this.commonObjs.clear();
this.fontLoader.clear();
- this.#metadataPromise = null;
- this._getFieldObjectsPromise = null;
- this._hasJSActionsPromise = null;
- if (this._networkStream) {
- this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));
- }
+ this.#methodPromises.clear();
+ this.filterFactory.destroy();
+ this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated."));
if (this.messageHandler) {
this.messageHandler.destroy();
this.messageHandler = null;
@@ -2171,7 +2163,7 @@ class WorkerTransport {
};
});
messageHandler.on("ReaderHeadersReady", data => {
- const headersCapability = (0, _util.createPromiseCapability)();
+ const headersCapability = new _util.PromiseCapability();
const fullReader = this._fullReader;
fullReader.headersReady.then(() => {
if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
@@ -2257,13 +2249,13 @@ class WorkerTransport {
loadingTask._capability.reject(reason);
});
messageHandler.on("PasswordRequest", exception => {
- this._passwordCapability = (0, _util.createPromiseCapability)();
+ this.#passwordCapability = new _util.PromiseCapability();
if (loadingTask.onPassword) {
const updatePassword = password => {
if (password instanceof Error) {
- this._passwordCapability.reject(password);
+ this.#passwordCapability.reject(password);
} else {
- this._passwordCapability.resolve({
+ this.#passwordCapability.resolve({
password
});
}
@@ -2271,12 +2263,12 @@ class WorkerTransport {
try {
loadingTask.onPassword(updatePassword, exception.code);
} catch (ex) {
- this._passwordCapability.reject(ex);
+ this.#passwordCapability.reject(ex);
}
} else {
- this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
+ this.#passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
}
- return this._passwordCapability.promise;
+ return this.#passwordCapability.promise;
});
messageHandler.on("DataLoaded", data => {
loadingTask.onProgress?.({
@@ -2308,20 +2300,12 @@ class WorkerTransport {
this.commonObjs.resolve(id, exportedError);
break;
}
- let fontRegistry = null;
- if (params.pdfBug && globalThis.FontInspector?.enabled) {
- fontRegistry = {
- registerFont(font, url) {
- globalThis.FontInspector.fontAdded(font, url);
- }
- };
- }
+ const inspectFont = params.pdfBug && globalThis.FontInspector?.enabled ? (font, url) => globalThis.FontInspector.fontAdded(font, url) : null;
const font = new _font_loader.FontFaceObject(exportedData, {
isEvalSupported: params.isEvalSupported,
disableFontFace: params.disableFontFace,
ignoreErrors: params.ignoreErrors,
- onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
- fontRegistry
+ inspectFont
});
this.fontLoader.bind(font).catch(reason => {
return messageHandler.sendWithPromise("FontFallback", {
@@ -2336,6 +2320,7 @@ class WorkerTransport {
break;
case "FontPath":
case "Image":
+ case "Pattern":
this.commonObjs.resolve(id, exportedData);
break;
default:
@@ -2353,22 +2338,19 @@ class WorkerTransport {
switch (type) {
case "Image":
pageProxy.objs.resolve(id, imageData);
- const MAX_IMAGE_SIZE_TO_STORE = 8000000;
if (imageData) {
let length;
if (imageData.bitmap) {
const {
- bitmap,
width,
height
} = imageData;
length = width * height * 4;
- pageProxy._bitmaps.add(bitmap);
} else {
length = imageData.data?.length || 0;
}
- if (length > MAX_IMAGE_SIZE_TO_STORE) {
- pageProxy.cleanupAfterRender = true;
+ if (length > _util.MAX_IMAGE_SIZE_TO_CACHE) {
+ pageProxy._maybeCleanupAfterRender = true;
}
}
break;
@@ -2388,34 +2370,25 @@ class WorkerTransport {
total: data.total
});
});
- messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
messageHandler.on("FetchBuiltInCMap", data => {
if (this.destroyed) {
return Promise.reject(new Error("Worker was destroyed."));
}
- if (!this.CMapReaderFactory) {
+ if (!this.cMapReaderFactory) {
return Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."));
}
- return this.CMapReaderFactory.fetch(data);
+ return this.cMapReaderFactory.fetch(data);
});
messageHandler.on("FetchStandardFontData", data => {
if (this.destroyed) {
return Promise.reject(new Error("Worker was destroyed."));
}
- if (!this.StandardFontDataFactory) {
+ if (!this.standardFontDataFactory) {
return Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."));
}
- return this.StandardFontDataFactory.fetch(data);
+ return this.standardFontDataFactory.fetch(data);
});
}
- _onUnsupportedFeature({
- featureId
- }) {
- if (this.destroyed) {
- return;
- }
- this.loadingTask.onUnsupportedFeature?.(featureId);
- }
getData() {
return this.messageHandler.sendWithPromise("GetData", null);
}
@@ -2423,12 +2396,16 @@ class WorkerTransport {
if (this.annotationStorage.size <= 0) {
(0, _util.warn)("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead.");
}
+ const {
+ map,
+ transfers
+ } = this.annotationStorage.serializable;
return this.messageHandler.sendWithPromise("SaveDocument", {
isPureXfa: !!this._htmlForXfa,
numPages: this._numPages,
- annotationStorage: this.annotationStorage.serializable,
+ annotationStorage: map,
filename: this._fullReader?.filename ?? null
- }).finally(() => {
+ }, transfers).finally(() => {
this.annotationStorage.resetModified();
});
}
@@ -2447,7 +2424,7 @@ class WorkerTransport {
if (this.destroyed) {
throw new Error("Transport destroyed");
}
- const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.ownerDocument, this._params.pdfBug);
+ const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug);
this.#pageCache.set(pageIndex, page);
return page;
});
@@ -2470,10 +2447,10 @@ class WorkerTransport {
});
}
getFieldObjects() {
- return this._getFieldObjectsPromise ||= this.messageHandler.sendWithPromise("GetFieldObjects", null);
+ return this.#cacheSimpleMethod("GetFieldObjects");
}
hasJSActions() {
- return this._hasJSActionsPromise ||= this.messageHandler.sendWithPromise("HasJSActions", null);
+ return this.#cacheSimpleMethod("HasJSActions");
}
getCalculationOrderIds() {
return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
@@ -2507,11 +2484,8 @@ class WorkerTransport {
getAttachments() {
return this.messageHandler.sendWithPromise("GetAttachments", null);
}
- getJavaScript() {
- return this.messageHandler.sendWithPromise("GetJavaScript", null);
- }
getDocJSActions() {
- return this.messageHandler.sendWithPromise("GetDocJSActions", null);
+ return this.#cacheSimpleMethod("GetDocJSActions");
}
getPageJSActions(pageIndex) {
return this.messageHandler.sendWithPromise("GetPageJSActions", {
@@ -2535,7 +2509,12 @@ class WorkerTransport {
return this.messageHandler.sendWithPromise("GetPermissions", null);
}
getMetadata() {
- return this.#metadataPromise ||= this.messageHandler.sendWithPromise("GetMetadata", null).then(results => {
+ const name = "GetMetadata",
+ cachedPromise = this.#methodPromises.get(name);
+ if (cachedPromise) {
+ return cachedPromise;
+ }
+ const promise = this.messageHandler.sendWithPromise(name, null).then(results => {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
@@ -2543,6 +2522,8 @@ class WorkerTransport {
contentLength: this._fullReader?.contentLength ?? null
};
});
+ this.#methodPromises.set(name, promise);
+ return promise;
}
getMarkInfo() {
return this.messageHandler.sendWithPromise("GetMarkInfo", null);
@@ -2562,27 +2543,25 @@ class WorkerTransport {
if (!keepLoadedFonts) {
this.fontLoader.clear();
}
- this.#metadataPromise = null;
- this._getFieldObjectsPromise = null;
- this._hasJSActionsPromise = null;
+ this.#methodPromises.clear();
+ this.filterFactory.destroy(true);
}
get loadingParams() {
- const params = this._params;
+ const {
+ disableAutoFetch,
+ enableXfa
+ } = this._params;
return (0, _util.shadow)(this, "loadingParams", {
- disableAutoFetch: params.disableAutoFetch,
- enableXfa: params.enableXfa
+ disableAutoFetch,
+ enableXfa
});
}
}
class PDFObjects {
#objs = Object.create(null);
#ensureObj(objId) {
- const obj = this.#objs[objId];
- if (obj) {
- return obj;
- }
- return this.#objs[objId] = {
- capability: (0, _util.createPromiseCapability)(),
+ return this.#objs[objId] ||= {
+ capability: new _util.PromiseCapability(),
data: null
};
}
@@ -2608,6 +2587,12 @@ class PDFObjects {
obj.capability.resolve();
}
clear() {
+ for (const objId in this.#objs) {
+ const {
+ data
+ } = this.#objs[objId];
+ data?.bitmap?.close();
+ }
this.#objs = Object.create(null);
}
}
@@ -2648,6 +2633,7 @@ class InternalRenderTask {
operatorList,
pageIndex,
canvasFactory,
+ filterFactory,
useRequestAnimationFrame = false,
pdfBug = false,
pageColors = null
@@ -2661,6 +2647,7 @@ class InternalRenderTask {
this.operatorList = operatorList;
this._pageIndex = pageIndex;
this.canvasFactory = canvasFactory;
+ this.filterFactory = filterFactory;
this._pdfBug = pdfBug;
this.pageColors = pageColors;
this.running = false;
@@ -2668,7 +2655,7 @@ class InternalRenderTask {
this.graphicsReady = false;
this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
this.cancelled = false;
- this.capability = (0, _util.createPromiseCapability)();
+ this.capability = new _util.PromiseCapability();
this.task = new RenderTask(this);
this._cancelBound = this.cancel.bind(this);
this._continueBound = this._continue.bind(this);
@@ -2703,7 +2690,7 @@ class InternalRenderTask {
transform,
background
} = this.params;
- this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, {
+ this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
optionalContentConfig
}, this.annotationCanvasMap, this.pageColors);
this.gfx.beginDrawing({
@@ -2720,16 +2707,12 @@ class InternalRenderTask {
this.running = false;
this.cancelled = true;
this.gfx?.endDrawing();
- if (this._canvas) {
InternalRenderTask.#canvasInUse.delete(this._canvas);
- }
- this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, "canvas", extraDelay));
+ this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, extraDelay));
}
operatorListChanged() {
if (!this.graphicsReady) {
- if (!this.graphicsReadyCallback) {
- this.graphicsReadyCallback = this._continueBound;
- }
+ this.graphicsReadyCallback ||= this._continueBound;
return;
}
this.stepper?.updateOperatorList(this.operatorList);
@@ -2767,17 +2750,16 @@ class InternalRenderTask {
this.running = false;
if (this.operatorList.lastChunk) {
this.gfx.endDrawing();
- if (this._canvas) {
InternalRenderTask.#canvasInUse.delete(this._canvas);
- }
this.callback();
}
}
}
}
-const version = '3.3.122';
+
+ const version = '3.11.174';
exports.version = version;
-const build = '562045607';
+ const build = 'ce8716743';
exports.build = build;
/***/ }),
@@ -2789,10 +2771,16 @@ exports.build = build;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.PrintAnnotationStorage = exports.AnnotationStorage = void 0;
+ exports.SerializableEmpty = exports.PrintAnnotationStorage = exports.AnnotationStorage = void 0;
var _util = __w_pdfjs_require__(1);
var _editor = __w_pdfjs_require__(4);
var _murmurhash = __w_pdfjs_require__(8);
+ const SerializableEmpty = Object.freeze({
+ map: null,
+ hash: "",
+ transfers: undefined
+ });
+ exports.SerializableEmpty = SerializableEmpty;
class AnnotationStorage {
#modified = false;
#storage = new Map();
@@ -2852,6 +2840,12 @@ class AnnotationStorage {
getAll() {
return this.#storage.size > 0 ? (0, _util.objectFromMap)(this.#storage) : null;
}
+
+ setAll(obj) {
+ for (const [key, val] of Object.entries(obj)) {
+ this.setValue(key, val);
+ }
+ }
get size() {
return this.#storage.size;
}
@@ -2876,34 +2870,53 @@ class AnnotationStorage {
}
get serializable() {
if (this.#storage.size === 0) {
- return null;
+ return SerializableEmpty;
}
- const clone = new Map();
+ const map = new Map(),
+ hash = new _murmurhash.MurmurHash3_64(),
+ transfers = [];
+ const context = Object.create(null);
+ let hasBitmap = false;
for (const [key, val] of this.#storage) {
- const serialized = val instanceof _editor.AnnotationEditor ? val.serialize() : val;
+ const serialized = val instanceof _editor.AnnotationEditor ? val.serialize(false, context) : val;
if (serialized) {
- clone.set(key, serialized);
+ map.set(key, serialized);
+ hash.update(`${key}:${JSON.stringify(serialized)}`);
+ hasBitmap ||= !!serialized.bitmap;
}
}
- return clone;
- }
- static getHash(map) {
- if (!map) {
- return "";
+ if (hasBitmap) {
+ for (const value of map.values()) {
+ if (value.bitmap) {
+ transfers.push(value.bitmap);
+ }
+ }
}
- const hash = new _murmurhash.MurmurHash3_64();
- for (const [key, val] of map) {
- hash.update(`${key}:${JSON.stringify(val)}`);
- }
- return hash.hexdigest();
+ return map.size > 0 ? {
+ map,
+ hash: hash.hexdigest(),
+ transfers
+ } : SerializableEmpty;
}
}
exports.AnnotationStorage = AnnotationStorage;
class PrintAnnotationStorage extends AnnotationStorage {
- #serializable = null;
+ #serializable;
constructor(parent) {
super();
- this.#serializable = structuredClone(parent.serializable);
+ const {
+ map,
+ hash,
+ transfers
+ } = parent.serializable;
+ const clone = structuredClone(map, transfers ? {
+ transfer: transfers
+ } : null);
+ this.#serializable = {
+ map: clone,
+ hash,
+ transfers
+ };
}
get print() {
(0, _util.unreachable)("Should not call PrintAnnotationStorage.print");
@@ -2926,16 +2939,30 @@ Object.defineProperty(exports, "__esModule", ({
exports.AnnotationEditor = void 0;
var _tools = __w_pdfjs_require__(5);
var _util = __w_pdfjs_require__(1);
+ var _display_utils = __w_pdfjs_require__(6);
class AnnotationEditor {
+ #altText = "";
+ #altTextDecorative = false;
+ #altTextButton = null;
+ #altTextTooltip = null;
+ #altTextTooltipTimeout = null;
+ #keepAspectRatio = false;
+ #resizersDiv = null;
#boundFocusin = this.focusin.bind(this);
#boundFocusout = this.focusout.bind(this);
- #hasBeenSelected = false;
+ #hasBeenClicked = false;
#isEditing = false;
#isInEditMode = false;
+ _initialOptions = Object.create(null);
_uiManager = null;
+ _focusEventsAllowed = true;
+ _l10nPromise = null;
+ #isDraggable = false;
#zIndex = AnnotationEditor._zIndex++;
+ static _borderLineWidth = -1;
static _colorManager = new _tools.ColorManager();
static _zIndex = 1;
+ static SMALL_EDITOR_SIZE = 0;
constructor(parameters) {
if (this.constructor === AnnotationEditor) {
(0, _util.unreachable)("Cannot initialize AnnotationEditor.");
@@ -2947,6 +2974,10 @@ class AnnotationEditor {
this.name = parameters.name;
this.div = null;
this._uiManager = parameters.uiManager;
+ this.annotationElementId = null;
+ this._willKeepAspectRatio = false;
+ this._initialOptions.isCentered = parameters.isCentered;
+ this._structTreeParentId = null;
const {
rotation,
rawDims: {
@@ -2957,16 +2988,98 @@ class AnnotationEditor {
}
} = this.parent.viewport;
this.rotation = rotation;
+ this.pageRotation = (360 + rotation - this._uiManager.viewParameters.rotation) % 360;
this.pageDimensions = [pageWidth, pageHeight];
this.pageTranslation = [pageX, pageY];
const [width, height] = this.parentDimensions;
this.x = parameters.x / width;
this.y = parameters.y / height;
this.isAttachedToDOM = false;
+ this.deleted = false;
+ }
+
+ get editorType() {
+ return Object.getPrototypeOf(this).constructor._type;
}
static get _defaultLineColor() {
return (0, _util.shadow)(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
}
+
+ static deleteAnnotationElement(editor) {
+ const fakeEditor = new FakeEditor({
+ id: editor.parent.getNextId(),
+ parent: editor.parent,
+ uiManager: editor._uiManager
+ });
+ fakeEditor.annotationElementId = editor.annotationElementId;
+ fakeEditor.deleted = true;
+ fakeEditor._uiManager.addToAnnotationStorage(fakeEditor);
+ }
+
+ static initialize(l10n, options = null) {
+ AnnotationEditor._l10nPromise ||= new Map(["editor_alt_text_button_label", "editor_alt_text_edit_button_label", "editor_alt_text_decorative_tooltip"].map(str => [str, l10n.get(str)]));
+ if (options?.strings) {
+ for (const str of options.strings) {
+ AnnotationEditor._l10nPromise.set(str, l10n.get(str));
+ }
+ }
+ if (AnnotationEditor._borderLineWidth !== -1) {
+ return;
+ }
+ const style = getComputedStyle(document.documentElement);
+ AnnotationEditor._borderLineWidth = parseFloat(style.getPropertyValue("--outline-width")) || 0;
+ }
+
+ static updateDefaultParams(_type, _value) {
+ }
+
+ static get defaultPropertiesToUpdate() {
+ return [];
+ }
+
+ static isHandlingMimeForPasting(mime) {
+ return false;
+ }
+
+ static paste(item, parent) {
+ (0, _util.unreachable)("Not implemented");
+ }
+
+ get propertiesToUpdate() {
+ return [];
+ }
+
+ get _isDraggable() {
+ return this.#isDraggable;
+ }
+
+ set _isDraggable(value) {
+ this.#isDraggable = value;
+ this.div?.classList.toggle("draggable", value);
+ }
+
+ center() {
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ switch (this.parentRotation) {
+ case 90:
+ this.x -= this.height * pageHeight / (pageWidth * 2);
+ this.y += this.width * pageWidth / (pageHeight * 2);
+ break;
+ case 180:
+ this.x += this.width / 2;
+ this.y += this.height / 2;
+ break;
+ case 270:
+ this.x += this.height * pageHeight / (pageWidth * 2);
+ this.y -= this.width * pageWidth / (pageHeight * 2);
+ break;
+ default:
+ this.x -= this.width / 2;
+ this.y -= this.height / 2;
+ break;
+ }
+ this.fixAndSetPosition();
+ }
addCommands(params) {
this._uiManager.addCommands(params);
}
@@ -2987,13 +3100,19 @@ class AnnotationEditor {
this.parent = parent;
}
focusin(event) {
- if (!this.#hasBeenSelected) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
+ if (!this.#hasBeenClicked) {
this.parent.setSelected(this);
} else {
- this.#hasBeenSelected = false;
+ this.#hasBeenClicked = false;
}
}
focusout(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
if (!this.isAttachedToDOM) {
return;
}
@@ -3019,31 +3138,124 @@ class AnnotationEditor {
addToAnnotationStorage() {
this._uiManager.addToAnnotationStorage(this);
}
- dragstart(event) {
- const rect = this.parent.div.getBoundingClientRect();
- this.startX = event.clientX - rect.x;
- this.startY = event.clientY - rect.y;
- event.dataTransfer.setData("text/plain", this.id);
- event.dataTransfer.effectAllowed = "move";
- }
setAt(x, y, tx, ty) {
const [width, height] = this.parentDimensions;
[tx, ty] = this.screenToPageTranslation(tx, ty);
this.x = (x + tx) / width;
this.y = (y + ty) / height;
- this.div.style.left = `${100 * this.x}%`;
- this.div.style.top = `${100 * this.y}%`;
+ this.fixAndSetPosition();
}
- translate(x, y) {
- const [width, height] = this.parentDimensions;
+
+ #translate([width, height], x, y) {
[x, y] = this.screenToPageTranslation(x, y);
this.x += x / width;
this.y += y / height;
- this.div.style.left = `${100 * this.x}%`;
- this.div.style.top = `${100 * this.y}%`;
+ this.fixAndSetPosition();
+ }
+
+ translate(x, y) {
+ this.#translate(this.parentDimensions, x, y);
}
- screenToPageTranslation(x, y) {
- switch (this.parentRotation) {
+
+ translateInPage(x, y) {
+ this.#translate(this.pageDimensions, x, y);
+ this.div.scrollIntoView({
+ block: "nearest"
+ });
+ }
+
+ drag(tx, ty) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.x += tx / parentWidth;
+ this.y += ty / parentHeight;
+ if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
+ const {
+ x,
+ y
+ } = this.div.getBoundingClientRect();
+ if (this.parent.findNewParent(this, x, y)) {
+ this.x -= Math.floor(this.x);
+ this.y -= Math.floor(this.y);
+ }
+ }
+ let {
+ x,
+ y
+ } = this;
+ const [bx, by] = this.#getBaseTranslation();
+ x += bx;
+ y += by;
+ this.div.style.left = `${(100 * x).toFixed(2)}%`;
+ this.div.style.top = `${(100 * y).toFixed(2)}%`;
+ this.div.scrollIntoView({
+ block: "nearest"
+ });
+ }
+
+ #getBaseTranslation() {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ const {
+ _borderLineWidth
+ } = AnnotationEditor;
+ const x = _borderLineWidth / parentWidth;
+ const y = _borderLineWidth / parentHeight;
+ switch (this.rotation) {
+ case 90:
+ return [-x, y];
+ case 180:
+ return [x, y];
+ case 270:
+ return [x, -y];
+ default:
+ return [-x, -y];
+ }
+ }
+
+ fixAndSetPosition() {
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ let {
+ x,
+ y,
+ width,
+ height
+ } = this;
+ width *= pageWidth;
+ height *= pageHeight;
+ x *= pageWidth;
+ y *= pageHeight;
+ switch (this.rotation) {
+ case 0:
+ x = Math.max(0, Math.min(pageWidth - width, x));
+ y = Math.max(0, Math.min(pageHeight - height, y));
+ break;
+ case 90:
+ x = Math.max(0, Math.min(pageWidth - height, x));
+ y = Math.min(pageHeight, Math.max(width, y));
+ break;
+ case 180:
+ x = Math.min(pageWidth, Math.max(width, x));
+ y = Math.min(pageHeight, Math.max(height, y));
+ break;
+ case 270:
+ x = Math.min(pageWidth, Math.max(height, x));
+ y = Math.max(0, Math.min(pageHeight - width, y));
+ break;
+ }
+ this.x = x /= pageWidth;
+ this.y = y /= pageHeight;
+ const [bx, by] = this.#getBaseTranslation();
+ x += bx;
+ y += by;
+ const {
+ style
+ } = this.div;
+ style.left = `${(100 * x).toFixed(2)}%`;
+ style.top = `${(100 * y).toFixed(2)}%`;
+ this.moveInDOM();
+ }
+
+ static #rotatePoint(x, y, angle) {
+ switch (angle) {
case 90:
return [y, -x];
case 180:
@@ -3054,23 +3266,53 @@ class AnnotationEditor {
return [x, y];
}
}
+
+ screenToPageTranslation(x, y) {
+ return AnnotationEditor.#rotatePoint(x, y, this.parentRotation);
+ }
+
+ pageTranslationToScreen(x, y) {
+ return AnnotationEditor.#rotatePoint(x, y, 360 - this.parentRotation);
+ }
+
+ #getRotationMatrix(rotation) {
+ switch (rotation) {
+ case 90: {
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];
+ }
+ case 180:
+ return [-1, 0, 0, -1];
+ case 270: {
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];
+ }
+ default:
+ return [1, 0, 0, 1];
+ }
+ }
get parentScale() {
return this._uiManager.viewParameters.realScale;
}
get parentRotation() {
- return this._uiManager.viewParameters.rotation;
+ return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
}
get parentDimensions() {
const {
- realScale
- } = this._uiManager.viewParameters;
- const [pageWidth, pageHeight] = this.pageDimensions;
- return [pageWidth * realScale, pageHeight * realScale];
+ parentScale,
+ pageDimensions: [pageWidth, pageHeight]
+ } = this;
+ const scaledWidth = pageWidth * parentScale;
+ const scaledHeight = pageHeight * parentScale;
+ return _util.FeatureTest.isCSSRoundSupported ? [Math.round(scaledWidth), Math.round(scaledHeight)] : [scaledWidth, scaledHeight];
}
setDims(width, height) {
const [parentWidth, parentHeight] = this.parentDimensions;
- this.div.style.width = `${100 * width / parentWidth}%`;
- this.div.style.height = `${100 * height / parentHeight}%`;
+ this.div.style.width = `${(100 * width / parentWidth).toFixed(2)}%`;
+ if (!this.#keepAspectRatio) {
+ this.div.style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
+ }
+ this.#altTextButton?.classList.toggle("small", width < AnnotationEditor.SMALL_EDITOR_SIZE || height < AnnotationEditor.SMALL_EDITOR_SIZE);
}
fixDims() {
const {
@@ -3081,21 +3323,296 @@ class AnnotationEditor {
width
} = style;
const widthPercent = width.endsWith("%");
- const heightPercent = height.endsWith("%");
+ const heightPercent = !this.#keepAspectRatio && height.endsWith("%");
if (widthPercent && heightPercent) {
return;
}
const [parentWidth, parentHeight] = this.parentDimensions;
if (!widthPercent) {
- style.width = `${100 * parseFloat(width) / parentWidth}%`;
+ style.width = `${(100 * parseFloat(width) / parentWidth).toFixed(2)}%`;
}
- if (!heightPercent) {
- style.height = `${100 * parseFloat(height) / parentHeight}%`;
+ if (!this.#keepAspectRatio && !heightPercent) {
+ style.height = `${(100 * parseFloat(height) / parentHeight).toFixed(2)}%`;
}
}
getInitialTranslation() {
return [0, 0];
}
+
+ #createResizers() {
+ if (this.#resizersDiv) {
+ return;
+ }
+ this.#resizersDiv = document.createElement("div");
+ this.#resizersDiv.classList.add("resizers");
+ const classes = ["topLeft", "topRight", "bottomRight", "bottomLeft"];
+ if (!this._willKeepAspectRatio) {
+ classes.push("topMiddle", "middleRight", "bottomMiddle", "middleLeft");
+ }
+ for (const name of classes) {
+ const div = document.createElement("div");
+ this.#resizersDiv.append(div);
+ div.classList.add("resizer", name);
+ div.addEventListener("pointerdown", this.#resizerPointerdown.bind(this, name));
+ div.addEventListener("contextmenu", _display_utils.noContextMenu);
+ }
+ this.div.prepend(this.#resizersDiv);
+ }
+
+ #resizerPointerdown(name, event) {
+ event.preventDefault();
+ const {
+ isMac
+ } = _util.FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ return;
+ }
+ const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
+ const savedDraggable = this._isDraggable;
+ this._isDraggable = false;
+ const pointerMoveOptions = {
+ passive: true,
+ capture: true
+ };
+ window.addEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
+ const savedX = this.x;
+ const savedY = this.y;
+ const savedWidth = this.width;
+ const savedHeight = this.height;
+ const savedParentCursor = this.parent.div.style.cursor;
+ const savedCursor = this.div.style.cursor;
+ this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
+ const pointerUpCallback = () => {
+ this._isDraggable = savedDraggable;
+ window.removeEventListener("pointerup", pointerUpCallback);
+ window.removeEventListener("blur", pointerUpCallback);
+ window.removeEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
+ this.parent.div.style.cursor = savedParentCursor;
+ this.div.style.cursor = savedCursor;
+ const newX = this.x;
+ const newY = this.y;
+ const newWidth = this.width;
+ const newHeight = this.height;
+ if (newX === savedX && newY === savedY && newWidth === savedWidth && newHeight === savedHeight) {
+ return;
+ }
+ this.addCommands({
+ cmd: () => {
+ this.width = newWidth;
+ this.height = newHeight;
+ this.x = newX;
+ this.y = newY;
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(parentWidth * newWidth, parentHeight * newHeight);
+ this.fixAndSetPosition();
+ },
+ undo: () => {
+ this.width = savedWidth;
+ this.height = savedHeight;
+ this.x = savedX;
+ this.y = savedY;
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(parentWidth * savedWidth, parentHeight * savedHeight);
+ this.fixAndSetPosition();
+ },
+ mustExec: true
+ });
+ };
+ window.addEventListener("pointerup", pointerUpCallback);
+ window.addEventListener("blur", pointerUpCallback);
+ }
+
+ #resizerPointermove(name, event) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ const savedX = this.x;
+ const savedY = this.y;
+ const savedWidth = this.width;
+ const savedHeight = this.height;
+ const minWidth = AnnotationEditor.MIN_SIZE / parentWidth;
+ const minHeight = AnnotationEditor.MIN_SIZE / parentHeight;
+ const round = x => Math.round(x * 10000) / 10000;
+ const rotationMatrix = this.#getRotationMatrix(this.rotation);
+ const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
+ const invRotationMatrix = this.#getRotationMatrix(360 - this.rotation);
+ const invTransf = (x, y) => [invRotationMatrix[0] * x + invRotationMatrix[2] * y, invRotationMatrix[1] * x + invRotationMatrix[3] * y];
+ let getPoint;
+ let getOpposite;
+ let isDiagonal = false;
+ let isHorizontal = false;
+ switch (name) {
+ case "topLeft":
+ isDiagonal = true;
+ getPoint = (w, h) => [0, 0];
+ getOpposite = (w, h) => [w, h];
+ break;
+ case "topMiddle":
+ getPoint = (w, h) => [w / 2, 0];
+ getOpposite = (w, h) => [w / 2, h];
+ break;
+ case "topRight":
+ isDiagonal = true;
+ getPoint = (w, h) => [w, 0];
+ getOpposite = (w, h) => [0, h];
+ break;
+ case "middleRight":
+ isHorizontal = true;
+ getPoint = (w, h) => [w, h / 2];
+ getOpposite = (w, h) => [0, h / 2];
+ break;
+ case "bottomRight":
+ isDiagonal = true;
+ getPoint = (w, h) => [w, h];
+ getOpposite = (w, h) => [0, 0];
+ break;
+ case "bottomMiddle":
+ getPoint = (w, h) => [w / 2, h];
+ getOpposite = (w, h) => [w / 2, 0];
+ break;
+ case "bottomLeft":
+ isDiagonal = true;
+ getPoint = (w, h) => [0, h];
+ getOpposite = (w, h) => [w, 0];
+ break;
+ case "middleLeft":
+ isHorizontal = true;
+ getPoint = (w, h) => [0, h / 2];
+ getOpposite = (w, h) => [w, h / 2];
+ break;
+ }
+ const point = getPoint(savedWidth, savedHeight);
+ const oppositePoint = getOpposite(savedWidth, savedHeight);
+ let transfOppositePoint = transf(...oppositePoint);
+ const oppositeX = round(savedX + transfOppositePoint[0]);
+ const oppositeY = round(savedY + transfOppositePoint[1]);
+ let ratioX = 1;
+ let ratioY = 1;
+ let [deltaX, deltaY] = this.screenToPageTranslation(event.movementX, event.movementY);
+ [deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);
+ if (isDiagonal) {
+ const oldDiag = Math.hypot(savedWidth, savedHeight);
+ ratioX = ratioY = Math.max(Math.min(Math.hypot(oppositePoint[0] - point[0] - deltaX, oppositePoint[1] - point[1] - deltaY) / oldDiag, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
+ } else if (isHorizontal) {
+ ratioX = Math.max(minWidth, Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))) / savedWidth;
+ } else {
+ ratioY = Math.max(minHeight, Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY))) / savedHeight;
+ }
+ const newWidth = round(savedWidth * ratioX);
+ const newHeight = round(savedHeight * ratioY);
+ transfOppositePoint = transf(...getOpposite(newWidth, newHeight));
+ const newX = oppositeX - transfOppositePoint[0];
+ const newY = oppositeY - transfOppositePoint[1];
+ this.width = newWidth;
+ this.height = newHeight;
+ this.x = newX;
+ this.y = newY;
+ this.setDims(parentWidth * newWidth, parentHeight * newHeight);
+ this.fixAndSetPosition();
+ }
+
+ async addAltTextButton() {
+ if (this.#altTextButton) {
+ return;
+ }
+ const altText = this.#altTextButton = document.createElement("button");
+ altText.className = "altText";
+ const msg = await AnnotationEditor._l10nPromise.get("editor_alt_text_button_label");
+ altText.textContent = msg;
+ altText.setAttribute("aria-label", msg);
+ altText.tabIndex = "0";
+ altText.addEventListener("contextmenu", _display_utils.noContextMenu);
+ altText.addEventListener("pointerdown", event => event.stopPropagation());
+ altText.addEventListener("click", event => {
+ event.preventDefault();
+ this._uiManager.editAltText(this);
+ }, {
+ capture: true
+ });
+ altText.addEventListener("keydown", event => {
+ if (event.target === altText && event.key === "Enter") {
+ event.preventDefault();
+ this._uiManager.editAltText(this);
+ }
+ });
+ this.#setAltTextButtonState();
+ this.div.append(altText);
+ if (!AnnotationEditor.SMALL_EDITOR_SIZE) {
+ const PERCENT = 40;
+ AnnotationEditor.SMALL_EDITOR_SIZE = Math.min(128, Math.round(altText.getBoundingClientRect().width * (1 + PERCENT / 100)));
+ }
+ }
+
+ async #setAltTextButtonState() {
+ const button = this.#altTextButton;
+ if (!button) {
+ return;
+ }
+ if (!this.#altText && !this.#altTextDecorative) {
+ button.classList.remove("done");
+ this.#altTextTooltip?.remove();
+ return;
+ }
+ AnnotationEditor._l10nPromise.get("editor_alt_text_edit_button_label").then(msg => {
+ button.setAttribute("aria-label", msg);
+ });
+ let tooltip = this.#altTextTooltip;
+ if (!tooltip) {
+ this.#altTextTooltip = tooltip = document.createElement("span");
+ tooltip.className = "tooltip";
+ tooltip.setAttribute("role", "tooltip");
+ const id = tooltip.id = `alt-text-tooltip-${this.id}`;
+ button.setAttribute("aria-describedby", id);
+ const DELAY_TO_SHOW_TOOLTIP = 100;
+ button.addEventListener("mouseenter", () => {
+ this.#altTextTooltipTimeout = setTimeout(() => {
+ this.#altTextTooltipTimeout = null;
+ this.#altTextTooltip.classList.add("show");
+ this._uiManager._eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "editing",
+ subtype: this.editorType,
+ data: {
+ action: "alt_text_tooltip"
+ }
+ }
+ });
+ }, DELAY_TO_SHOW_TOOLTIP);
+ });
+ button.addEventListener("mouseleave", () => {
+ clearTimeout(this.#altTextTooltipTimeout);
+ this.#altTextTooltipTimeout = null;
+ this.#altTextTooltip?.classList.remove("show");
+ });
+ }
+ button.classList.add("done");
+ tooltip.innerText = this.#altTextDecorative ? await AnnotationEditor._l10nPromise.get("editor_alt_text_decorative_tooltip") : this.#altText;
+ if (!tooltip.parentNode) {
+ button.append(tooltip);
+ }
+ }
+
+ getClientDimensions() {
+ return this.div.getBoundingClientRect();
+ }
+
+ get altTextData() {
+ return {
+ altText: this.#altText,
+ decorative: this.#altTextDecorative
+ };
+ }
+
+ set altTextData({
+ altText,
+ decorative
+ }) {
+ if (this.#altText === altText && this.#altTextDecorative === decorative) {
+ return;
+ }
+ this.#altText = altText;
+ this.#altTextDecorative = decorative;
+ this.#setAltTextButtonState();
+ }
render() {
this.div = document.createElement("div");
this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
@@ -3105,9 +3622,14 @@ class AnnotationEditor {
this.setInForeground();
this.div.addEventListener("focusin", this.#boundFocusin);
this.div.addEventListener("focusout", this.#boundFocusout);
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ if (this.parentRotation % 180 !== 0) {
+ this.div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(2)}%`;
+ this.div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
+ }
const [tx, ty] = this.getInitialTranslation();
this.translate(tx, ty);
- (0, _tools.bindEvents)(this, this.div, ["dragstart", "pointerdown"]);
+ (0, _tools.bindEvents)(this, this.div, ["pointerdown"]);
return this.div;
}
pointerdown(event) {
@@ -3118,12 +3640,59 @@ class AnnotationEditor {
event.preventDefault();
return;
}
- if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
- this.parent.toggleSelected(this);
- } else {
- this.parent.setSelected(this);
+ this.#hasBeenClicked = true;
+ this.#setUpDragSession(event);
+ }
+
+ #setUpDragSession(event) {
+ if (!this._isDraggable) {
+ return;
+ }
+ const isSelected = this._uiManager.isSelected(this);
+ this._uiManager.setUpDragSession();
+ let pointerMoveOptions, pointerMoveCallback;
+ if (isSelected) {
+ pointerMoveOptions = {
+ passive: true,
+ capture: true
+ };
+ pointerMoveCallback = e => {
+ const [tx, ty] = this.screenToPageTranslation(e.movementX, e.movementY);
+ this._uiManager.dragSelectedEditors(tx, ty);
+ };
+ window.addEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
+ }
+ const pointerUpCallback = () => {
+ window.removeEventListener("pointerup", pointerUpCallback);
+ window.removeEventListener("blur", pointerUpCallback);
+ if (isSelected) {
+ window.removeEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
+ }
+ this.#hasBeenClicked = false;
+ if (!this._uiManager.endDragSession()) {
+ const {
+ isMac
+ } = _util.FeatureTest.platform;
+ if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
+ this.parent.toggleSelected(this);
+ } else {
+ this.parent.setSelected(this);
+ }
+ }
+ };
+ window.addEventListener("pointerup", pointerUpCallback);
+ window.addEventListener("blur", pointerUpCallback);
}
- this.#hasBeenSelected = true;
+
+ moveInDOM() {
+ this.parent?.moveEditorInDOM(this);
+ }
+
+ _setParentAndPosition(parent, x, y) {
+ parent.changeParent(this);
+ this.x = x;
+ this.y = y;
+ this.fixAndSetPosition();
}
getRect(tx, ty) {
const scale = this.parentScale;
@@ -3186,8 +3755,10 @@ class AnnotationEditor {
}
rebuild() {
this.div?.addEventListener("focusin", this.#boundFocusin);
+ this.div?.addEventListener("focusout", this.#boundFocusout);
}
- serialize() {
+
+ serialize(isForCopying = false, context = null) {
(0, _util.unreachable)("An editor must be serializable");
}
static deserialize(data, parent, uiManager) {
@@ -3211,20 +3782,53 @@ class AnnotationEditor {
if (!this.isEmpty()) {
this.commit();
}
- this.parent.remove(this);
+ if (this.parent) {
+ this.parent.remove(this);
+ } else {
+ this._uiManager.removeEditor(this);
+ }
+ this.#altTextButton?.remove();
+ this.#altTextButton = null;
+ this.#altTextTooltip = null;
+ }
+
+ get isResizable() {
+ return false;
+ }
+
+ makeResizable() {
+ if (this.isResizable) {
+ this.#createResizers();
+ this.#resizersDiv.classList.remove("hidden");
+ }
}
select() {
+ this.makeResizable();
this.div?.classList.add("selectedEditor");
}
unselect() {
+ this.#resizersDiv?.classList.add("hidden");
this.div?.classList.remove("selectedEditor");
+ if (this.div?.contains(document.activeElement)) {
+ this._uiManager.currentLayer.div.focus();
+ }
}
updateParams(type, value) {}
- disableEditing() {}
- enableEditing() {}
- get propertiesToUpdate() {
- return {};
+
+ disableEditing() {
+ if (this.#altTextButton) {
+ this.#altTextButton.hidden = true;
+ }
}
+
+ enableEditing() {
+ if (this.#altTextButton) {
+ this.#altTextButton.hidden = false;
+ }
+ }
+
+ enterInEditMode() {
+ }
get contentDiv() {
return this.div;
}
@@ -3233,6 +3837,9 @@ class AnnotationEditor {
}
set isEditing(value) {
this.#isEditing = value;
+ if (!this.parent) {
+ return;
+ }
if (value) {
this.parent.setSelected(this);
this.parent.setActiveEditor(this);
@@ -3240,9 +3847,39 @@ class AnnotationEditor {
this.parent.setActiveEditor(null);
}
}
+
+ setAspectRatio(width, height) {
+ this.#keepAspectRatio = true;
+ const aspectRatio = width / height;
+ const {
+ style
+ } = this.div;
+ style.aspectRatio = aspectRatio;
+ style.height = "auto";
+ }
+
+ static get MIN_SIZE() {
+ return 16;
+ }
}
exports.AnnotationEditor = AnnotationEditor;
+ class FakeEditor extends AnnotationEditor {
+ constructor(params) {
+ super(params);
+ this.annotationElementId = params.annotationElementId;
+ this.deleted = true;
+ }
+
+ serialize() {
+ return {
+ id: this.annotationElementId,
+ deleted: true,
+ pageIndex: this.pageIndex
+ };
+ }
+ }
+
/***/ }),
/* 5 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -3271,6 +3908,141 @@ class IdManager {
return `${_util.AnnotationEditorPrefix}${this.#id++}`;
}
}
+
+ class ImageManager {
+ #baseId = (0, _util.getUuid)();
+ #id = 0;
+ #cache = null;
+
+ static get _isSVGFittingCanvas() {
+ const svg = `data:image/svg+xml;charset=UTF-8,`;
+ const canvas = new OffscreenCanvas(1, 3);
+ const ctx = canvas.getContext("2d");
+ const image = new Image();
+ image.src = svg;
+ const promise = image.decode().then(() => {
+ ctx.drawImage(image, 0, 0, 1, 1, 0, 0, 1, 3);
+ return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
+ });
+ return (0, _util.shadow)(this, "_isSVGFittingCanvas", promise);
+ }
+
+ async #get(key, rawData) {
+ this.#cache ||= new Map();
+ let data = this.#cache.get(key);
+ if (data === null) {
+ return null;
+ }
+ if (data?.bitmap) {
+ data.refCounter += 1;
+ return data;
+ }
+ try {
+ data ||= {
+ bitmap: null,
+ id: `image_${this.#baseId}_${this.#id++}`,
+ refCounter: 0,
+ isSvg: false
+ };
+ let image;
+ if (typeof rawData === "string") {
+ data.url = rawData;
+ const response = await fetch(rawData);
+ if (!response.ok) {
+ throw new Error(response.statusText);
+ }
+ image = await response.blob();
+ } else {
+ image = data.file = rawData;
+ }
+ if (image.type === "image/svg+xml") {
+ const mustRemoveAspectRatioPromise = ImageManager._isSVGFittingCanvas;
+ const fileReader = new FileReader();
+ const imageElement = new Image();
+ const imagePromise = new Promise((resolve, reject) => {
+ imageElement.onload = () => {
+ data.bitmap = imageElement;
+ data.isSvg = true;
+ resolve();
+ };
+ fileReader.onload = async () => {
+ const url = data.svgUrl = fileReader.result;
+ imageElement.src = (await mustRemoveAspectRatioPromise) ? `${url}#svgView(preserveAspectRatio(none))` : url;
+ };
+ imageElement.onerror = fileReader.onerror = reject;
+ });
+ fileReader.readAsDataURL(image);
+ await imagePromise;
+ } else {
+ data.bitmap = await createImageBitmap(image);
+ }
+ data.refCounter = 1;
+ } catch (e) {
+ console.error(e);
+ data = null;
+ }
+ this.#cache.set(key, data);
+ if (data) {
+ this.#cache.set(data.id, data);
+ }
+ return data;
+ }
+
+ async getFromFile(file) {
+ const {
+ lastModified,
+ name,
+ size,
+ type
+ } = file;
+ return this.#get(`${lastModified}_${name}_${size}_${type}`, file);
+ }
+
+ async getFromUrl(url) {
+ return this.#get(url, url);
+ }
+
+ async getFromId(id) {
+ this.#cache ||= new Map();
+ const data = this.#cache.get(id);
+ if (!data) {
+ return null;
+ }
+ if (data.bitmap) {
+ data.refCounter += 1;
+ return data;
+ }
+ if (data.file) {
+ return this.getFromFile(data.file);
+ }
+ return this.getFromUrl(data.url);
+ }
+
+ getSvgUrl(id) {
+ const data = this.#cache.get(id);
+ if (!data?.isSvg) {
+ return null;
+ }
+ return data.svgUrl;
+ }
+
+ deleteId(id) {
+ this.#cache ||= new Map();
+ const data = this.#cache.get(id);
+ if (!data) {
+ return;
+ }
+ data.refCounter -= 1;
+ if (data.refCounter !== 0) {
+ return;
+ }
+ data.bitmap = null;
+ }
+
+ isValidId(id) {
+ return id.startsWith(`image_${this.#baseId}_`);
+ }
+ }
class CommandManager {
#commands = [];
#locked = false;
@@ -3360,14 +4132,20 @@ class KeyboardManager {
const {
isMac
} = _util.FeatureTest.platform;
- for (const [keys, callback] of callbacks) {
+ for (const [keys, callback, options = {}] of callbacks) {
for (const key of keys) {
const isMacKey = key.startsWith("mac+");
if (isMac && isMacKey) {
- this.callbacks.set(key.slice(4), callback);
+ this.callbacks.set(key.slice(4), {
+ callback,
+ options
+ });
this.allKeys.add(key.split("+").at(-1));
} else if (!isMac && !isMacKey) {
- this.callbacks.set(key, callback);
+ this.callbacks.set(key, {
+ callback,
+ options
+ });
this.allKeys.add(key.split("+").at(-1));
}
}
@@ -3395,13 +4173,26 @@ class KeyboardManager {
if (!this.allKeys.has(event.key)) {
return;
}
- const callback = this.callbacks.get(this.#serialize(event));
- if (!callback) {
+ const info = this.callbacks.get(this.#serialize(event));
+ if (!info) {
return;
}
- callback.bind(self)();
- event.stopPropagation();
- event.preventDefault();
+ const {
+ callback,
+ options: {
+ bubbles = false,
+ args = [],
+ checker = null
+ }
+ } = info;
+ if (checker && !checker(self, event)) {
+ return;
+ }
+ callback.bind(self, ...args)();
+ if (!bubbles) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
}
}
exports.KeyboardManager = KeyboardManager;
@@ -3437,16 +4228,24 @@ class AnnotationEditorUIManager {
#activeEditor = null;
#allEditors = new Map();
#allLayers = new Map();
+ #altTextManager = null;
#annotationStorage = null;
#commandManager = new CommandManager();
#currentPageIndex = 0;
+ #deletedAnnotationsElementIds = new Set();
+ #draggingEditors = null;
#editorTypes = null;
#editorsToRescale = new Set();
- #eventBus = null;
+ #filterFactory = null;
#idManager = new IdManager();
#isEnabled = false;
+ #isWaiting = false;
+ #lastActiveElement = null;
#mode = _util.AnnotationEditorType.NONE;
#selectedEditors = new Set();
+ #pageColors = null;
+ #boundBlur = this.blur.bind(this);
+ #boundFocus = this.focus.bind(this);
#boundCopy = this.copy.bind(this);
#boundCut = this.cut.bind(this);
#boundPaste = this.paste.bind(this);
@@ -3462,16 +4261,62 @@ class AnnotationEditorUIManager {
hasSomethingToRedo: false,
hasSelectedEditor: false
};
+ #translation = [0, 0];
+ #translationTimeoutId = null;
#container = null;
- static _keyboardManager = new KeyboardManager([[["ctrl+a", "mac+meta+a"], AnnotationEditorUIManager.prototype.selectAll], [["ctrl+z", "mac+meta+z"], AnnotationEditorUIManager.prototype.undo], [["ctrl+y", "ctrl+shift+Z", "mac+meta+shift+Z"], AnnotationEditorUIManager.prototype.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete"], AnnotationEditorUIManager.prototype.delete], [["Escape", "mac+Escape"], AnnotationEditorUIManager.prototype.unselectAll]]);
- constructor(container, eventBus, annotationStorage) {
+ #viewer = null;
+ static TRANSLATE_SMALL = 1;
+ static TRANSLATE_BIG = 10;
+
+ static get _keyboardManager() {
+ const proto = AnnotationEditorUIManager.prototype;
+ const arrowChecker = self => {
+ const {
+ activeElement
+ } = document;
+ return activeElement && self.#container.contains(activeElement) && self.hasSomethingToControl();
+ };
+ const small = this.TRANSLATE_SMALL;
+ const big = this.TRANSLATE_BIG;
+ return (0, _util.shadow)(this, "_keyboardManager", new KeyboardManager([[["ctrl+a", "mac+meta+a"], proto.selectAll], [["ctrl+z", "mac+meta+z"], proto.undo], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], proto.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], proto.delete], [["Escape", "mac+Escape"], proto.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], proto.translateSelectedEditors, {
+ args: [-small, 0],
+ checker: arrowChecker
+ }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto.translateSelectedEditors, {
+ args: [-big, 0],
+ checker: arrowChecker
+ }], [["ArrowRight", "mac+ArrowRight"], proto.translateSelectedEditors, {
+ args: [small, 0],
+ checker: arrowChecker
+ }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto.translateSelectedEditors, {
+ args: [big, 0],
+ checker: arrowChecker
+ }], [["ArrowUp", "mac+ArrowUp"], proto.translateSelectedEditors, {
+ args: [0, -small],
+ checker: arrowChecker
+ }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto.translateSelectedEditors, {
+ args: [0, -big],
+ checker: arrowChecker
+ }], [["ArrowDown", "mac+ArrowDown"], proto.translateSelectedEditors, {
+ args: [0, small],
+ checker: arrowChecker
+ }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto.translateSelectedEditors, {
+ args: [0, big],
+ checker: arrowChecker
+ }]]));
+ }
+
+ constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors) {
this.#container = container;
- this.#eventBus = eventBus;
- this.#eventBus._on("editingaction", this.#boundOnEditingAction);
- this.#eventBus._on("pagechanging", this.#boundOnPageChanging);
- this.#eventBus._on("scalechanging", this.#boundOnScaleChanging);
- this.#eventBus._on("rotationchanging", this.#boundOnRotationChanging);
- this.#annotationStorage = annotationStorage;
+ this.#viewer = viewer;
+ this.#altTextManager = altTextManager;
+ this._eventBus = eventBus;
+ this._eventBus._on("editingaction", this.#boundOnEditingAction);
+ this._eventBus._on("pagechanging", this.#boundOnPageChanging);
+ this._eventBus._on("scalechanging", this.#boundOnScaleChanging);
+ this._eventBus._on("rotationchanging", this.#boundOnRotationChanging);
+ this.#annotationStorage = pdfDocument.annotationStorage;
+ this.#filterFactory = pdfDocument.filterFactory;
+ this.#pageColors = pageColors;
this.viewParameters = {
realScale: _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS,
rotation: 0
@@ -3479,10 +4324,11 @@ class AnnotationEditorUIManager {
}
destroy() {
this.#removeKeyboardManager();
- this.#eventBus._off("editingaction", this.#boundOnEditingAction);
- this.#eventBus._off("pagechanging", this.#boundOnPageChanging);
- this.#eventBus._off("scalechanging", this.#boundOnScaleChanging);
- this.#eventBus._off("rotationchanging", this.#boundOnRotationChanging);
+ this.#removeFocusManager();
+ this._eventBus._off("editingaction", this.#boundOnEditingAction);
+ this._eventBus._off("pagechanging", this.#boundOnPageChanging);
+ this._eventBus._off("scalechanging", this.#boundOnScaleChanging);
+ this._eventBus._off("rotationchanging", this.#boundOnRotationChanging);
for (const layer of this.#allLayers.values()) {
layer.destroy();
}
@@ -3492,6 +4338,19 @@ class AnnotationEditorUIManager {
this.#activeEditor = null;
this.#selectedEditors.clear();
this.#commandManager.destroy();
+ this.#altTextManager.destroy();
+ }
+
+ get hcmFilter() {
+ return (0, _util.shadow)(this, "hcmFilter", this.#pageColors ? this.#filterFactory.addHCMFilter(this.#pageColors.foreground, this.#pageColors.background) : "none");
+ }
+
+ get direction() {
+ return (0, _util.shadow)(this, "direction", getComputedStyle(this.#container).direction);
+ }
+
+ editAltText(editor) {
+ this.#altTextManager?.editAltText(this, editor);
}
onPageChanging({
pageNumber
@@ -3501,6 +4360,25 @@ class AnnotationEditorUIManager {
focusMainContainer() {
this.#container.focus();
}
+
+ findParent(x, y) {
+ for (const layer of this.#allLayers.values()) {
+ const {
+ x: layerX,
+ y: layerY,
+ width,
+ height
+ } = layer.div.getBoundingClientRect();
+ if (x >= layerX && x <= layerX + width && y >= layerY && y <= layerY + height) {
+ return layer;
+ }
+ }
+ return null;
+ }
+
+ disableUserSelect(value = false) {
+ this.#viewer.classList.toggle("noUserSelect", value);
+ }
addShouldRescale(editor) {
this.#editorsToRescale.add(editor);
}
@@ -3527,11 +4405,55 @@ class AnnotationEditorUIManager {
this.#annotationStorage.setValue(editor.id, editor);
}
}
+
+ #addFocusManager() {
+ window.addEventListener("focus", this.#boundFocus);
+ window.addEventListener("blur", this.#boundBlur);
+ }
+
+ #removeFocusManager() {
+ window.removeEventListener("focus", this.#boundFocus);
+ window.removeEventListener("blur", this.#boundBlur);
+ }
+
+ blur() {
+ if (!this.hasSelection) {
+ return;
+ }
+ const {
+ activeElement
+ } = document;
+ for (const editor of this.#selectedEditors) {
+ if (editor.div.contains(activeElement)) {
+ this.#lastActiveElement = [editor, activeElement];
+ editor._focusEventsAllowed = false;
+ break;
+ }
+ }
+ }
+
+ focus() {
+ if (!this.#lastActiveElement) {
+ return;
+ }
+ const [lastEditor, lastActiveElement] = this.#lastActiveElement;
+ this.#lastActiveElement = null;
+ lastActiveElement.addEventListener("focusin", () => {
+ lastEditor._focusEventsAllowed = true;
+ }, {
+ once: true
+ });
+ lastActiveElement.focus();
+ }
#addKeyboardManager() {
- this.#container.addEventListener("keydown", this.#boundKeydown);
+ window.addEventListener("keydown", this.#boundKeydown, {
+ capture: true
+ });
}
#removeKeyboardManager() {
- this.#container.removeEventListener("keydown", this.#boundKeydown);
+ window.removeEventListener("keydown", this.#boundKeydown, {
+ capture: true
+ });
}
#addCopyPasteListeners() {
document.addEventListener("copy", this.#boundCopy);
@@ -3543,18 +4465,27 @@ class AnnotationEditorUIManager {
document.removeEventListener("cut", this.#boundCut);
document.removeEventListener("paste", this.#boundPaste);
}
+
+ addEditListeners() {
+ this.#addKeyboardManager();
+ this.#addCopyPasteListeners();
+ }
+
+ removeEditListeners() {
+ this.#removeKeyboardManager();
+ this.#removeCopyPasteListeners();
+ }
copy(event) {
event.preventDefault();
- if (this.#activeEditor) {
- this.#activeEditor.commitOrRemove();
- }
+ this.#activeEditor?.commitOrRemove();
if (!this.hasSelection) {
return;
}
const editors = [];
for (const editor of this.#selectedEditors) {
- if (!editor.isEmpty()) {
- editors.push(editor.serialize());
+ const serialized = editor.serialize(true);
+ if (serialized) {
+ editors.push(serialized);
}
}
if (editors.length === 0) {
@@ -3568,7 +4499,18 @@ class AnnotationEditorUIManager {
}
paste(event) {
event.preventDefault();
- let data = event.clipboardData.getData("application/pdfjs");
+ const {
+ clipboardData
+ } = event;
+ for (const item of clipboardData.items) {
+ for (const editorType of this.#editorTypes) {
+ if (editorType.isHandlingMimeForPasting(item.type)) {
+ editorType.paste(item, this.currentLayer);
+ return;
+ }
+ }
+ }
+ let data = clipboardData.getData("application/pdfjs");
if (!data) {
return;
}
@@ -3582,7 +4524,7 @@ class AnnotationEditorUIManager {
return;
}
this.unselectAll();
- const layer = this.#allLayers.get(this.#currentPageIndex);
+ const layer = this.currentLayer;
try {
const newEditors = [];
for (const editor of data) {
@@ -3625,20 +4567,21 @@ class AnnotationEditorUIManager {
#dispatchUpdateStates(details) {
const hasChanged = Object.entries(details).some(([key, value]) => this.#previousStates[key] !== value);
if (hasChanged) {
- this.#eventBus.dispatch("annotationeditorstateschanged", {
+ this._eventBus.dispatch("annotationeditorstateschanged", {
source: this,
details: Object.assign(this.#previousStates, details)
});
}
}
#dispatchUpdateUI(details) {
- this.#eventBus.dispatch("annotationeditorparamschanged", {
+ this._eventBus.dispatch("annotationeditorparamschanged", {
source: this,
details
});
}
setEditingState(isEditing) {
if (isEditing) {
+ this.#addFocusManager();
this.#addKeyboardManager();
this.#addCopyPasteListeners();
this.#dispatchUpdateStates({
@@ -3649,11 +4592,13 @@ class AnnotationEditorUIManager {
hasSelectedEditor: false
});
} else {
+ this.#removeFocusManager();
this.#removeKeyboardManager();
this.#removeCopyPasteListeners();
this.#dispatchUpdateStates({
isEditing: false
});
+ this.disableUserSelect(false);
}
}
registerEditorTypes(types) {
@@ -3671,6 +4616,10 @@ class AnnotationEditorUIManager {
get currentLayer() {
return this.#allLayers.get(this.#currentPageIndex);
}
+
+ getLayer(pageIndex) {
+ return this.#allLayers.get(pageIndex);
+ }
get currentPageIndex() {
return this.#currentPageIndex;
}
@@ -3685,16 +4634,31 @@ class AnnotationEditorUIManager {
removeLayer(layer) {
this.#allLayers.delete(layer.pageIndex);
}
- updateMode(mode) {
+
+ updateMode(mode, editId = null) {
+ if (this.#mode === mode) {
+ return;
+ }
this.#mode = mode;
if (mode === _util.AnnotationEditorType.NONE) {
this.setEditingState(false);
this.#disableAll();
- } else {
- this.setEditingState(true);
- this.#enableAll();
- for (const layer of this.#allLayers.values()) {
- layer.updateMode(mode);
+ return;
+ }
+ this.setEditingState(true);
+ this.#enableAll();
+ this.unselectAll();
+ for (const layer of this.#allLayers.values()) {
+ layer.updateMode(mode);
+ }
+ if (!editId) {
+ return;
+ }
+ for (const editor of this.#allEditors.values()) {
+ if (editor.annotationElementId === editId) {
+ this.setSelected(editor);
+ editor.enterInEditMode();
+ break;
}
}
}
@@ -3702,7 +4666,7 @@ class AnnotationEditorUIManager {
if (mode === this.#mode) {
return;
}
- this.#eventBus.dispatch("switchannotationeditormode", {
+ this._eventBus.dispatch("switchannotationeditormode", {
source: this,
mode
});
@@ -3710,6 +4674,10 @@ class AnnotationEditorUIManager {
updateParams(type, value) {
if (!this.#editorTypes) {
return;
+ }
+ if (type === _util.AnnotationEditorParamsType.CREATE) {
+ this.currentLayer.addNewEditor(type);
+ return;
}
for (const editor of this.#selectedEditors) {
editor.updateParams(type, value);
@@ -3718,6 +4686,21 @@ class AnnotationEditorUIManager {
editorType.updateDefaultParams(type, value);
}
}
+
+ enableWaiting(mustWait = false) {
+ if (this.#isWaiting === mustWait) {
+ return;
+ }
+ this.#isWaiting = mustWait;
+ for (const layer of this.#allLayers.values()) {
+ if (mustWait) {
+ layer.disableClick();
+ } else {
+ layer.enableClick();
+ }
+ layer.div.classList.toggle("waiting", mustWait);
+ }
+ }
#enableAll() {
if (!this.#isEnabled) {
this.#isEnabled = true;
@@ -3753,7 +4736,23 @@ class AnnotationEditorUIManager {
removeEditor(editor) {
this.#allEditors.delete(editor.id);
this.unselect(editor);
- this.#annotationStorage?.remove(editor.id);
+ if (!editor.annotationElementId || !this.#deletedAnnotationsElementIds.has(editor.annotationElementId)) {
+ this.#annotationStorage?.remove(editor.id);
+ }
+ }
+
+ addDeletedAnnotationElement(editor) {
+ this.#deletedAnnotationsElementIds.add(editor.annotationElementId);
+ editor.deleted = true;
+ }
+
+ isDeletedAnnotationElement(annotationElementId) {
+ return this.#deletedAnnotationsElementIds.has(annotationElementId);
+ }
+
+ removeDeletedAnnotationElement(editor) {
+ this.#deletedAnnotationsElementIds.delete(editor.annotationElementId);
+ editor.deleted = false;
}
#addEditorToLayer(editor) {
const layer = this.#allLayers.get(editor.pageIndex);
@@ -3875,6 +4874,10 @@ class AnnotationEditorUIManager {
commitOrRemove() {
this.#activeEditor?.commitOrRemove();
}
+
+ hasSomethingToControl() {
+ return this.#activeEditor || this.hasSelection;
+ }
#selectEditors(editors) {
this.#selectedEditors.clear();
for (const editor of editors) {
@@ -3899,7 +4902,7 @@ class AnnotationEditorUIManager {
this.#activeEditor.commitOrRemove();
return;
}
- if (this.#selectedEditors.size === 0) {
+ if (!this.hasSelection) {
return;
}
for (const editor of this.#selectedEditors) {
@@ -3910,6 +4913,147 @@ class AnnotationEditorUIManager {
hasSelectedEditor: false
});
}
+
+ translateSelectedEditors(x, y, noCommit = false) {
+ if (!noCommit) {
+ this.commitOrRemove();
+ }
+ if (!this.hasSelection) {
+ return;
+ }
+ this.#translation[0] += x;
+ this.#translation[1] += y;
+ const [totalX, totalY] = this.#translation;
+ const editors = [...this.#selectedEditors];
+ const TIME_TO_WAIT = 1000;
+ if (this.#translationTimeoutId) {
+ clearTimeout(this.#translationTimeoutId);
+ }
+ this.#translationTimeoutId = setTimeout(() => {
+ this.#translationTimeoutId = null;
+ this.#translation[0] = this.#translation[1] = 0;
+ this.addCommands({
+ cmd: () => {
+ for (const editor of editors) {
+ if (this.#allEditors.has(editor.id)) {
+ editor.translateInPage(totalX, totalY);
+ }
+ }
+ },
+ undo: () => {
+ for (const editor of editors) {
+ if (this.#allEditors.has(editor.id)) {
+ editor.translateInPage(-totalX, -totalY);
+ }
+ }
+ },
+ mustExec: false
+ });
+ }, TIME_TO_WAIT);
+ for (const editor of editors) {
+ editor.translateInPage(x, y);
+ }
+ }
+
+ setUpDragSession() {
+ if (!this.hasSelection) {
+ return;
+ }
+ this.disableUserSelect(true);
+ this.#draggingEditors = new Map();
+ for (const editor of this.#selectedEditors) {
+ this.#draggingEditors.set(editor, {
+ savedX: editor.x,
+ savedY: editor.y,
+ savedPageIndex: editor.pageIndex,
+ newX: 0,
+ newY: 0,
+ newPageIndex: -1
+ });
+ }
+ }
+
+ endDragSession() {
+ if (!this.#draggingEditors) {
+ return false;
+ }
+ this.disableUserSelect(false);
+ const map = this.#draggingEditors;
+ this.#draggingEditors = null;
+ let mustBeAddedInUndoStack = false;
+ for (const [{
+ x,
+ y,
+ pageIndex
+ }, value] of map) {
+ value.newX = x;
+ value.newY = y;
+ value.newPageIndex = pageIndex;
+ mustBeAddedInUndoStack ||= x !== value.savedX || y !== value.savedY || pageIndex !== value.savedPageIndex;
+ }
+ if (!mustBeAddedInUndoStack) {
+ return false;
+ }
+ const move = (editor, x, y, pageIndex) => {
+ if (this.#allEditors.has(editor.id)) {
+ const parent = this.#allLayers.get(pageIndex);
+ if (parent) {
+ editor._setParentAndPosition(parent, x, y);
+ } else {
+ editor.pageIndex = pageIndex;
+ editor.x = x;
+ editor.y = y;
+ }
+ }
+ };
+ this.addCommands({
+ cmd: () => {
+ for (const [editor, {
+ newX,
+ newY,
+ newPageIndex
+ }] of map) {
+ move(editor, newX, newY, newPageIndex);
+ }
+ },
+ undo: () => {
+ for (const [editor, {
+ savedX,
+ savedY,
+ savedPageIndex
+ }] of map) {
+ move(editor, savedX, savedY, savedPageIndex);
+ }
+ },
+ mustExec: true
+ });
+ return true;
+ }
+
+ dragSelectedEditors(tx, ty) {
+ if (!this.#draggingEditors) {
+ return;
+ }
+ for (const editor of this.#draggingEditors.keys()) {
+ editor.drag(tx, ty);
+ }
+ }
+
+ rebuild(editor) {
+ if (editor.parent === null) {
+ const parent = this.getLayer(editor.pageIndex);
+ if (parent) {
+ parent.changeParent(editor);
+ parent.addOrRebuild(editor);
+ } else {
+ this.addEditor(editor);
+ this.addToAnnotationStorage(editor);
+ editor.rebuild();
+ }
+ } else {
+ editor.parent.addOrRebuild(editor);
+ }
+ }
isActive(editor) {
return this.#activeEditor === editor;
}
@@ -3919,6 +5063,10 @@ class AnnotationEditorUIManager {
getMode() {
return this.#mode;
}
+
+ get imageManager() {
+ return (0, _util.shadow)(this, "imageManager", new ImageManager());
+ }
}
exports.AnnotationEditorUIManager = AnnotationEditorUIManager;
@@ -3931,7 +5079,7 @@ exports.AnnotationEditorUIManager = AnnotationEditorUIManager;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = exports.PDFDateString = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = exports.AnnotationPrefix = void 0;
+ exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = exports.PDFDateString = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = exports.DOMFilterFactory = exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = void 0;
exports.deprecated = deprecated;
exports.getColorValues = getColorValues;
exports.getCurrentTransform = getCurrentTransform;
@@ -3944,18 +5092,253 @@ exports.isDataScheme = isDataScheme;
exports.isPdfFile = isPdfFile;
exports.isValidFetchUrl = isValidFetchUrl;
exports.loadScript = loadScript;
+ exports.noContextMenu = noContextMenu;
exports.setLayerDimensions = setLayerDimensions;
var _base_factory = __w_pdfjs_require__(7);
var _util = __w_pdfjs_require__(1);
const SVG_NS = "http://www.w3.org/2000/svg";
-const AnnotationPrefix = "pdfjs_internal_id_";
-exports.AnnotationPrefix = AnnotationPrefix;
class PixelsPerInch {
static CSS = 96.0;
static PDF = 72.0;
static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
}
exports.PixelsPerInch = PixelsPerInch;
+
+ class DOMFilterFactory extends _base_factory.BaseFilterFactory {
+ #_cache;
+ #_defs;
+ #docId;
+ #document;
+ #hcmFilter;
+ #hcmKey;
+ #hcmUrl;
+ #hcmHighlightFilter;
+ #hcmHighlightKey;
+ #hcmHighlightUrl;
+ #id = 0;
+
+ constructor({
+ docId,
+ ownerDocument = globalThis.document
+ } = {}) {
+ super();
+ this.#docId = docId;
+ this.#document = ownerDocument;
+ }
+
+ get #cache() {
+ return this.#_cache ||= new Map();
+ }
+
+ get #defs() {
+ if (!this.#_defs) {
+ const div = this.#document.createElement("div");
+ const {
+ style
+ } = div;
+ style.visibility = "hidden";
+ style.contain = "strict";
+ style.width = style.height = 0;
+ style.position = "absolute";
+ style.top = style.left = 0;
+ style.zIndex = -1;
+ const svg = this.#document.createElementNS(SVG_NS, "svg");
+ svg.setAttribute("width", 0);
+ svg.setAttribute("height", 0);
+ this.#_defs = this.#document.createElementNS(SVG_NS, "defs");
+ div.append(svg);
+ svg.append(this.#_defs);
+ this.#document.body.append(div);
+ }
+ return this.#_defs;
+ }
+
+ addFilter(maps) {
+ if (!maps) {
+ return "none";
+ }
+ let value = this.#cache.get(maps);
+ if (value) {
+ return value;
+ }
+ let tableR, tableG, tableB, key;
+ if (maps.length === 1) {
+ const mapR = maps[0];
+ const buffer = new Array(256);
+ for (let i = 0; i < 256; i++) {
+ buffer[i] = mapR[i] / 255;
+ }
+ key = tableR = tableG = tableB = buffer.join(",");
+ } else {
+ const [mapR, mapG, mapB] = maps;
+ const bufferR = new Array(256);
+ const bufferG = new Array(256);
+ const bufferB = new Array(256);
+ for (let i = 0; i < 256; i++) {
+ bufferR[i] = mapR[i] / 255;
+ bufferG[i] = mapG[i] / 255;
+ bufferB[i] = mapB[i] / 255;
+ }
+ tableR = bufferR.join(",");
+ tableG = bufferG.join(",");
+ tableB = bufferB.join(",");
+ key = `${tableR}${tableG}${tableB}`;
+ }
+ value = this.#cache.get(key);
+ if (value) {
+ this.#cache.set(maps, value);
+ return value;
+ }
+ const id = `g_${this.#docId}_transfer_map_${this.#id++}`;
+ const url = `url(#${id})`;
+ this.#cache.set(maps, url);
+ this.#cache.set(key, url);
+ const filter = this.#createFilter(id);
+ this.#addTransferMapConversion(tableR, tableG, tableB, filter);
+ return url;
+ }
+
+ addHCMFilter(fgColor, bgColor) {
+ const key = `${fgColor}-${bgColor}`;
+ if (this.#hcmKey === key) {
+ return this.#hcmUrl;
+ }
+ this.#hcmKey = key;
+ this.#hcmUrl = "none";
+ this.#hcmFilter?.remove();
+ if (!fgColor || !bgColor) {
+ return this.#hcmUrl;
+ }
+ const fgRGB = this.#getRGB(fgColor);
+ fgColor = _util.Util.makeHexColor(...fgRGB);
+ const bgRGB = this.#getRGB(bgColor);
+ bgColor = _util.Util.makeHexColor(...bgRGB);
+ this.#defs.style.color = "";
+ if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
+ return this.#hcmUrl;
+ }
+ const map = new Array(256);
+ for (let i = 0; i <= 255; i++) {
+ const x = i / 255;
+ map[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
+ }
+ const table = map.join(",");
+ const id = `g_${this.#docId}_hcm_filter`;
+ const filter = this.#hcmHighlightFilter = this.#createFilter(id);
+ this.#addTransferMapConversion(table, table, table, filter);
+ this.#addGrayConversion(filter);
+ const getSteps = (c, n) => {
+ const start = fgRGB[c] / 255;
+ const end = bgRGB[c] / 255;
+ const arr = new Array(n + 1);
+ for (let i = 0; i <= n; i++) {
+ arr[i] = start + i / n * (end - start);
+ }
+ return arr.join(",");
+ };
+ this.#addTransferMapConversion(getSteps(0, 5), getSteps(1, 5), getSteps(2, 5), filter);
+ this.#hcmUrl = `url(#${id})`;
+ return this.#hcmUrl;
+ }
+
+ addHighlightHCMFilter(fgColor, bgColor, newFgColor, newBgColor) {
+ const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;
+ if (this.#hcmHighlightKey === key) {
+ return this.#hcmHighlightUrl;
+ }
+ this.#hcmHighlightKey = key;
+ this.#hcmHighlightUrl = "none";
+ this.#hcmHighlightFilter?.remove();
+ if (!fgColor || !bgColor) {
+ return this.#hcmHighlightUrl;
+ }
+ const [fgRGB, bgRGB] = [fgColor, bgColor].map(this.#getRGB.bind(this));
+ let fgGray = Math.round(0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]);
+ let bgGray = Math.round(0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]);
+ let [newFgRGB, newBgRGB] = [newFgColor, newBgColor].map(this.#getRGB.bind(this));
+ if (bgGray < fgGray) {
+ [fgGray, bgGray, newFgRGB, newBgRGB] = [bgGray, fgGray, newBgRGB, newFgRGB];
+ }
+ this.#defs.style.color = "";
+ const getSteps = (fg, bg, n) => {
+ const arr = new Array(256);
+ const step = (bgGray - fgGray) / n;
+ const newStart = fg / 255;
+ const newStep = (bg - fg) / (255 * n);
+ let prev = 0;
+ for (let i = 0; i <= n; i++) {
+ const k = Math.round(fgGray + i * step);
+ const value = newStart + i * newStep;
+ for (let j = prev; j <= k; j++) {
+ arr[j] = value;
+ }
+ prev = k + 1;
+ }
+ for (let i = prev; i < 256; i++) {
+ arr[i] = arr[prev - 1];
+ }
+ return arr.join(",");
+ };
+ const id = `g_${this.#docId}_hcm_highlight_filter`;
+ const filter = this.#hcmHighlightFilter = this.#createFilter(id);
+ this.#addGrayConversion(filter);
+ this.#addTransferMapConversion(getSteps(newFgRGB[0], newBgRGB[0], 5), getSteps(newFgRGB[1], newBgRGB[1], 5), getSteps(newFgRGB[2], newBgRGB[2], 5), filter);
+ this.#hcmHighlightUrl = `url(#${id})`;
+ return this.#hcmHighlightUrl;
+ }
+
+ destroy(keepHCM = false) {
+ if (keepHCM && (this.#hcmUrl || this.#hcmHighlightUrl)) {
+ return;
+ }
+ if (this.#_defs) {
+ this.#_defs.parentNode.parentNode.remove();
+ this.#_defs = null;
+ }
+ if (this.#_cache) {
+ this.#_cache.clear();
+ this.#_cache = null;
+ }
+ this.#id = 0;
+ }
+
+ #addGrayConversion(filter) {
+ const feColorMatrix = this.#document.createElementNS(SVG_NS, "feColorMatrix");
+ feColorMatrix.setAttribute("type", "matrix");
+ feColorMatrix.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");
+ filter.append(feColorMatrix);
+ }
+
+ #createFilter(id) {
+ const filter = this.#document.createElementNS(SVG_NS, "filter");
+ filter.setAttribute("color-interpolation-filters", "sRGB");
+ filter.setAttribute("id", id);
+ this.#defs.append(filter);
+ return filter;
+ }
+
+ #appendFeFunc(feComponentTransfer, func, table) {
+ const feFunc = this.#document.createElementNS(SVG_NS, func);
+ feFunc.setAttribute("type", "discrete");
+ feFunc.setAttribute("tableValues", table);
+ feComponentTransfer.append(feFunc);
+ }
+
+ #addTransferMapConversion(rTable, gTable, bTable, filter) {
+ const feComponentTransfer = this.#document.createElementNS(SVG_NS, "feComponentTransfer");
+ filter.append(feComponentTransfer);
+ this.#appendFeFunc(feComponentTransfer, "feFuncR", rTable);
+ this.#appendFeFunc(feComponentTransfer, "feFuncG", gTable);
+ this.#appendFeFunc(feComponentTransfer, "feFuncB", bTable);
+ }
+
+ #getRGB(color) {
+ this.#defs.style.color = color;
+ return getRGB(getComputedStyle(this.#defs).getPropertyValue("color"));
+ }
+ }
+
+ exports.DOMFilterFactory = DOMFilterFactory;
class DOMCanvasFactory extends _base_factory.BaseCanvasFactory {
constructor({
ownerDocument = globalThis.document
@@ -4140,9 +5523,8 @@ class PageViewport {
}
exports.PageViewport = PageViewport;
class RenderingCancelledException extends _util.BaseException {
- constructor(msg, type, extraDelay = 0) {
+ constructor(msg, extraDelay = 0) {
super(msg, "RenderingCancelledException");
- this.type = type;
this.extraDelay = extraDelay;
}
}
@@ -4181,7 +5563,8 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
if (suggestedFilename.includes("%")) {
try {
suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
- } catch (ex) {}
+ } catch {
+ }
}
}
return suggestedFilename || defaultFilename;
@@ -4231,10 +5614,14 @@ function isValidFetchUrl(url, baseUrl) {
protocol
} = baseUrl ? new URL(url, baseUrl) : new URL(url);
return protocol === "http:" || protocol === "https:";
- } catch (ex) {
+ } catch {
return false;
}
}
+
+ function noContextMenu(e) {
+ e.preventDefault();
+ }
function loadScript(src, removeScriptElement = false) {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
@@ -4260,9 +5647,7 @@ class PDFDateString {
if (!input || typeof input !== "string") {
return null;
}
- if (!pdfDateStringRegex) {
- pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
- }
+ pdfDateStringRegex ||= new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
const matches = pdfDateStringRegex.exec(input);
if (!matches) {
return null;
@@ -4365,8 +5750,11 @@ function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true)
const {
style
} = div;
- const widthStr = `calc(var(--scale-factor) * ${pageWidth}px)`;
- const heightStr = `calc(var(--scale-factor) * ${pageHeight}px)`;
+ const useRound = _util.FeatureTest.isCSSRoundSupported;
+ const w = `var(--scale-factor) * ${pageWidth}px`,
+ h = `var(--scale-factor) * ${pageHeight}px`;
+ const widthStr = useRound ? `round(${w}, 1px)` : `calc(${w})`,
+ heightStr = useRound ? `round(${h}, 1px)` : `calc(${h})`;
if (!mustFlip || viewport.rotation % 180 === 0) {
style.width = widthStr;
style.height = heightStr;
@@ -4389,8 +5777,33 @@ function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true)
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseCanvasFactory = exports.BaseCMapReaderFactory = void 0;
+ exports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseFilterFactory = exports.BaseCanvasFactory = exports.BaseCMapReaderFactory = void 0;
var _util = __w_pdfjs_require__(1);
+
+ class BaseFilterFactory {
+ constructor() {
+ if (this.constructor === BaseFilterFactory) {
+ (0, _util.unreachable)("Cannot initialize BaseFilterFactory.");
+ }
+ }
+
+ addFilter(maps) {
+ return "none";
+ }
+
+ addHCMFilter(fgColor, bgColor) {
+ return "none";
+ }
+
+ addHighlightHCMFilter(fgColor, bgColor, newFgColor, newBgColor) {
+ return "none";
+ }
+
+ destroy(keepHCM = false) {
+ }
+ }
+
+ exports.BaseFilterFactory = BaseFilterFactory;
class BaseCanvasFactory {
constructor() {
if (this.constructor === BaseCanvasFactory) {
@@ -4434,7 +5847,7 @@ exports.BaseCanvasFactory = BaseCanvasFactory;
class BaseCMapReaderFactory {
constructor({
baseUrl = null,
- isCompressed = false
+ isCompressed = true
}) {
if (this.constructor === BaseCMapReaderFactory) {
(0, _util.unreachable)("Cannot initialize BaseCMapReaderFactory.");
@@ -4637,24 +6050,27 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.FontLoader = exports.FontFaceObject = void 0;
var _util = __w_pdfjs_require__(1);
-var _is_node = __w_pdfjs_require__(10);
class FontLoader {
+ #systemFonts = new Set();
constructor({
- onUnsupportedFeature,
ownerDocument = globalThis.document,
styleElement = null
}) {
- this._onUnsupportedFeature = onUnsupportedFeature;
this._document = ownerDocument;
- this.nativeFontFaces = [];
+ this.nativeFontFaces = new Set();
this.styleElement = null;
this.loadingRequests = [];
this.loadTestFontId = 0;
}
addNativeFontFace(nativeFontFace) {
- this.nativeFontFaces.push(nativeFontFace);
+ this.nativeFontFaces.add(nativeFontFace);
this._document.fonts.add(nativeFontFace);
}
+
+ removeNativeFontFace(nativeFontFace) {
+ this.nativeFontFaces.delete(nativeFontFace);
+ this._document.fonts.delete(nativeFontFace);
+ }
insertRule(rule) {
if (!this.styleElement) {
this.styleElement = this._document.createElement("style");
@@ -4667,17 +6083,47 @@ class FontLoader {
for (const nativeFontFace of this.nativeFontFaces) {
this._document.fonts.delete(nativeFontFace);
}
- this.nativeFontFaces.length = 0;
+ this.nativeFontFaces.clear();
+ this.#systemFonts.clear();
if (this.styleElement) {
this.styleElement.remove();
this.styleElement = null;
}
}
+
+ async loadSystemFont(info) {
+ if (!info || this.#systemFonts.has(info.loadedName)) {
+ return;
+ }
+ (0, _util.assert)(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set.");
+ if (this.isFontLoadingAPISupported) {
+ const {
+ loadedName,
+ src,
+ style
+ } = info;
+ const fontFace = new FontFace(loadedName, src, style);
+ this.addNativeFontFace(fontFace);
+ try {
+ await fontFace.load();
+ this.#systemFonts.add(loadedName);
+ } catch {
+ (0, _util.warn)(`Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`);
+ this.removeNativeFontFace(fontFace);
+ }
+ return;
+ }
+ (0, _util.unreachable)("Not implemented: loadSystemFont without the Font Loading API.");
+ }
async bind(font) {
- if (font.attached || font.missingFile) {
+ if (font.attached || font.missingFile && !font.systemFontInfo) {
return;
}
font.attached = true;
+ if (font.systemFontInfo) {
+ await this.loadSystemFont(font.systemFontInfo);
+ return;
+ }
if (this.isFontLoadingAPISupported) {
const nativeFontFace = font.createNativeFontFace();
if (nativeFontFace) {
@@ -4685,9 +6131,6 @@ class FontLoader {
try {
await nativeFontFace.loaded;
} catch (ex) {
- this._onUnsupportedFeature({
- featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative
- });
(0, _util.warn)(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
font.disableFontFace = true;
throw ex;
@@ -4713,7 +6156,7 @@ class FontLoader {
}
get isSyncFontLoadingSupported() {
let supported = false;
- if (_is_node.isNodeJS) {
+ if (_util.isNodeJS) {
supported = true;
} else if (typeof navigator !== "undefined" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) {
supported = true;
@@ -4815,8 +6258,7 @@ class FontFaceObject {
isEvalSupported = true,
disableFontFace = false,
ignoreErrors = false,
- onUnsupportedFeature,
- fontRegistry = null
+ inspectFont = null
}) {
this.compiledGlyphs = Object.create(null);
for (const i in translatedData) {
@@ -4825,8 +6267,7 @@ class FontFaceObject {
this.isEvalSupported = isEvalSupported !== false;
this.disableFontFace = disableFontFace === true;
this.ignoreErrors = ignoreErrors === true;
- this._onUnsupportedFeature = onUnsupportedFeature;
- this.fontRegistry = fontRegistry;
+ this._inspectFont = inspectFont;
}
createNativeFontFace() {
if (!this.data || this.disableFontFace) {
@@ -4844,7 +6285,7 @@ class FontFaceObject {
}
nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);
}
- this.fontRegistry?.registerFont(this);
+ this._inspectFont?.(this);
return nativeFontFace;
}
createFontFaceRule() {
@@ -4863,7 +6304,7 @@ class FontFaceObject {
}
rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css}src:${url}}`;
}
- this.fontRegistry?.registerFont(this, url);
+ this._inspectFont?.(this, url);
return rule;
}
getPathGenerator(objs, character) {
@@ -4877,9 +6318,6 @@ class FontFaceObject {
if (!this.ignoreErrors) {
throw ex;
}
- this._onUnsupportedFeature({
- featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath
- });
(0, _util.warn)(`getPathGenerator - ignoring character: "${ex}".`);
return this.compiledGlyphs[character] = function (c, size) {};
}
@@ -4905,16 +6343,65 @@ exports.FontFaceObject = FontFaceObject;
/***/ }),
/* 10 */
-/***/ ((__unused_webpack_module, exports) => {
+ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.isNodeJS = void 0;
-const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
-exports.isNodeJS = isNodeJS;
+ exports.NodeStandardFontDataFactory = exports.NodeFilterFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;
+ var _base_factory = __w_pdfjs_require__(7);
+ var _util = __w_pdfjs_require__(1);
+ ;
+ ;
+ const fetchData = function (url) {
+ return new Promise((resolve, reject) => {
+ const fs = require("fs");
+ fs.readFile(url, (error, data) => {
+ if (error || !data) {
+ reject(new Error(error));
+ return;
+ }
+ resolve(new Uint8Array(data));
+ });
+ });
+ };
+
+ class NodeFilterFactory extends _base_factory.BaseFilterFactory {
+ }
+
+ exports.NodeFilterFactory = NodeFilterFactory;
+
+ class NodeCanvasFactory extends _base_factory.BaseCanvasFactory {
+ _createCanvas(width, height) {
+ const Canvas = require("canvas");
+ return Canvas.createCanvas(width, height);
+ }
+ }
+
+ exports.NodeCanvasFactory = NodeCanvasFactory;
+
+ class NodeCMapReaderFactory extends _base_factory.BaseCMapReaderFactory {
+ _fetchData(url, compressionType) {
+ return fetchData(url).then(data => {
+ return {
+ cMapData: data,
+ compressionType
+ };
+ });
+ }
+ }
+
+ exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
+
+ class NodeStandardFontDataFactory extends _base_factory.BaseStandardFontDataFactory {
+ _fetchData(url) {
+ return fetchData(url);
+ }
+ }
+
+ exports.NodeStandardFontDataFactory = NodeStandardFontDataFactory;
/***/ }),
/* 11 */
@@ -5252,7 +6739,7 @@ class CanvasExtraState {
this.strokeAlpha = 1;
this.lineWidth = 1;
this.activeSMask = null;
- this.transferMaps = null;
+ this.transferMaps = "none";
this.startNewPathAndClipBox([0, 0, width, height]);
}
clone() {
@@ -5331,7 +6818,8 @@ class CanvasExtraState {
return _util.Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
}
}
-function putBinaryImageData(ctx, imgData, transferMaps = null) {
+
+ function putBinaryImageData(ctx, imgData) {
if (typeof ImageData !== "undefined" && imgData instanceof ImageData) {
ctx.putImageData(imgData, 0, 0);
return;
@@ -5347,35 +6835,13 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
const src = imgData.data;
const dest = chunkImgData.data;
let i, j, thisChunkHeight, elemsInThisChunk;
- let transferMapRed, transferMapGreen, transferMapBlue, transferMapGray;
- if (transferMaps) {
- switch (transferMaps.length) {
- case 1:
- transferMapRed = transferMaps[0];
- transferMapGreen = transferMaps[0];
- transferMapBlue = transferMaps[0];
- transferMapGray = transferMaps[0];
- break;
- case 4:
- transferMapRed = transferMaps[0];
- transferMapGreen = transferMaps[1];
- transferMapBlue = transferMaps[2];
- transferMapGray = transferMaps[3];
- break;
- }
- }
if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {
const srcLength = src.byteLength;
const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
const dest32DataLength = dest32.length;
const fullSrcDiff = width + 7 >> 3;
- let white = 0xffffffff;
- let black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
- if (transferMapGray) {
- if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {
- [white, black] = [black, white];
- }
- }
+ const white = 0xffffffff;
+ const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
for (i = 0; i < totalChunks; i++) {
thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
destPos = 0;
@@ -5412,48 +6878,20 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
}
} else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {
- const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);
j = 0;
elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
for (i = 0; i < fullChunks; i++) {
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
srcPos += elemsInThisChunk;
- if (hasTransferMaps) {
- for (let k = 0; k < elemsInThisChunk; k += 4) {
- if (transferMapRed) {
- dest[k + 0] = transferMapRed[dest[k + 0]];
- }
- if (transferMapGreen) {
- dest[k + 1] = transferMapGreen[dest[k + 1]];
- }
- if (transferMapBlue) {
- dest[k + 2] = transferMapBlue[dest[k + 2]];
- }
- }
- }
ctx.putImageData(chunkImgData, 0, j);
j += FULL_CHUNK_HEIGHT;
}
if (i < totalChunks) {
elemsInThisChunk = width * partialChunkHeight * 4;
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
- if (hasTransferMaps) {
- for (let k = 0; k < elemsInThisChunk; k += 4) {
- if (transferMapRed) {
- dest[k + 0] = transferMapRed[dest[k + 0]];
- }
- if (transferMapGreen) {
- dest[k + 1] = transferMapGreen[dest[k + 1]];
- }
- if (transferMapBlue) {
- dest[k + 2] = transferMapBlue[dest[k + 2]];
- }
- }
- }
ctx.putImageData(chunkImgData, 0, j);
}
} else if (imgData.kind === _util.ImageKind.RGB_24BPP) {
- const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);
thisChunkHeight = FULL_CHUNK_HEIGHT;
elemsInThisChunk = width * thisChunkHeight;
for (i = 0; i < totalChunks; i++) {
@@ -5468,19 +6906,6 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
dest[destPos++] = src[srcPos++];
dest[destPos++] = 255;
}
- if (hasTransferMaps) {
- for (let k = 0; k < destPos; k += 4) {
- if (transferMapRed) {
- dest[k + 0] = transferMapRed[dest[k + 0]];
- }
- if (transferMapGreen) {
- dest[k + 1] = transferMapGreen[dest[k + 1]];
- }
- if (transferMapBlue) {
- dest[k + 2] = transferMapBlue[dest[k + 2]];
- }
- }
- }
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
}
} else {
@@ -5505,18 +6930,19 @@ function putBinaryImageMask(ctx, imgData) {
const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
({
srcPos
- } = (0, _image_utils.applyMaskImageData)({
+ } = (0, _image_utils.convertBlackAndWhiteToRGBA)({
src,
srcPos,
dest,
width,
- height: thisChunkHeight
+ height: thisChunkHeight,
+ nonBlackColor: 0
}));
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
}
}
function copyCtxState(sourceCtx, destCtx) {
- const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"];
+ const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
for (const property of properties) {
if (sourceCtx[property] !== undefined) {
destCtx[property] = sourceCtx[property];
@@ -5527,8 +6953,9 @@ function copyCtxState(sourceCtx, destCtx) {
destCtx.lineDashOffset = sourceCtx.lineDashOffset;
}
}
-function resetCtxToDefault(ctx, foregroundColor) {
- ctx.strokeStyle = ctx.fillStyle = foregroundColor || "#000000";
+
+ function resetCtxToDefault(ctx) {
+ ctx.strokeStyle = ctx.fillStyle = "#000000";
ctx.fillRule = "nonzero";
ctx.globalAlpha = 1;
ctx.lineWidth = 1;
@@ -5541,6 +6968,14 @@ function resetCtxToDefault(ctx, foregroundColor) {
ctx.setLineDash([]);
ctx.lineDashOffset = 0;
}
+ if (!_util.isNodeJS) {
+ const {
+ filter
+ } = ctx;
+ if (filter !== "none" && filter !== "") {
+ ctx.filter = "none";
+ }
+ }
}
function composeSMaskBackdrop(bytes, r0, g0, b0) {
const length = bytes.length;
@@ -5578,12 +7013,7 @@ function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop
const r0 = hasBackdrop ? backdrop[0] : 0;
const g0 = hasBackdrop ? backdrop[1] : 0;
const b0 = hasBackdrop ? backdrop[2] : 0;
- let composeFn;
- if (subtype === "Luminosity") {
- composeFn = composeSMaskLuminosity;
- } else {
- composeFn = composeSMaskAlpha;
- }
+ const composeFn = subtype === "Luminosity" ? composeSMaskLuminosity : composeSMaskAlpha;
const PIXELS_TO_PROCESS = 1048576;
const chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
for (let row = 0; row < height; row += chunkSize) {
@@ -5630,7 +7060,7 @@ const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
const NORMAL_CLIP = {};
const EO_CLIP = {};
class CanvasGraphics {
- constructor(canvasCtx, commonObjs, objs, canvasFactory, {
+ constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
optionalContentConfig,
markedContentStack = null
}, annotationCanvasMap, pageColors) {
@@ -5644,6 +7074,7 @@ class CanvasGraphics {
this.commonObjs = commonObjs;
this.objs = objs;
this.canvasFactory = canvasFactory;
+ this.filterFactory = filterFactory;
this.groupStack = [];
this.processingType3 = null;
this.baseTransform = null;
@@ -5662,9 +7093,8 @@ class CanvasGraphics {
this.viewportScale = 1;
this.outputScaleX = 1;
this.outputScaleY = 1;
- this.backgroundColor = pageColors?.background || null;
- this.foregroundColor = pageColors?.foreground || null;
- this._cachedScaleForStroking = null;
+ this.pageColors = pageColors;
+ this._cachedScaleForStroking = [-1, 0];
this._cachedGetSinglePixelWidth = null;
this._cachedBitmapsMap = new Map();
}
@@ -5682,36 +7112,10 @@ class CanvasGraphics {
}) {
const width = this.ctx.canvas.width;
const height = this.ctx.canvas.height;
- const defaultBackgroundColor = background || "#ffffff";
- this.ctx.save();
- if (this.foregroundColor && this.backgroundColor) {
- this.ctx.fillStyle = this.foregroundColor;
- const fg = this.foregroundColor = this.ctx.fillStyle;
- this.ctx.fillStyle = this.backgroundColor;
- const bg = this.backgroundColor = this.ctx.fillStyle;
- let isValidDefaultBg = true;
- let defaultBg = defaultBackgroundColor;
- this.ctx.fillStyle = defaultBackgroundColor;
- defaultBg = this.ctx.fillStyle;
- isValidDefaultBg = typeof defaultBg === "string" && /^#[0-9A-Fa-f]{6}$/.test(defaultBg);
- if (fg === "#000000" && bg === "#ffffff" || fg === bg || !isValidDefaultBg) {
- this.foregroundColor = this.backgroundColor = null;
- } else {
- const [rB, gB, bB] = (0, _display_utils.getRGB)(defaultBg);
- const newComp = x => {
- x /= 255;
- return x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
- };
- const lumB = Math.round(0.2126 * newComp(rB) + 0.7152 * newComp(gB) + 0.0722 * newComp(bB));
- this.selectColor = (r, g, b) => {
- const lumC = 0.2126 * newComp(r) + 0.7152 * newComp(g) + 0.0722 * newComp(b);
- return Math.round(lumC) === lumB ? bg : fg;
- };
- }
- }
- this.ctx.fillStyle = this.backgroundColor || defaultBackgroundColor;
+ const savedFillStyle = this.ctx.fillStyle;
+ this.ctx.fillStyle = background || "#ffffff";
this.ctx.fillRect(0, 0, width, height);
- this.ctx.restore();
+ this.ctx.fillStyle = savedFillStyle;
if (transparency) {
const transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height);
this.compositeCtx = this.ctx;
@@ -5721,7 +7125,7 @@ class CanvasGraphics {
this.ctx.transform(...(0, _display_utils.getCurrentTransform)(this.compositeCtx));
}
this.ctx.save();
- resetCtxToDefault(this.ctx, this.foregroundColor);
+ resetCtxToDefault(this.ctx);
if (transform) {
this.ctx.transform(...transform);
this.outputScaleX = transform[0];
@@ -5802,6 +7206,19 @@ class CanvasGraphics {
cache.clear();
}
this._cachedBitmapsMap.clear();
+ this.#drawFilter();
+ }
+
+ #drawFilter() {
+ if (this.pageColors) {
+ const hcmFilterId = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
+ if (hcmFilterId !== "none") {
+ const savedFilter = this.ctx.filter;
+ this.ctx.filter = hcmFilterId;
+ this.ctx.drawImage(this.ctx.canvas, 0, 0);
+ this.ctx.filter = savedFilter;
+ }
+ }
}
_scaleImage(img, inverseTransform) {
const width = img.width;
@@ -5816,11 +7233,11 @@ class CanvasGraphics {
let newWidth = paintWidth,
newHeight = paintHeight;
if (widthScale > 2 && paintWidth > 1) {
- newWidth = Math.ceil(paintWidth / 2);
+ newWidth = paintWidth >= 16384 ? Math.floor(paintWidth / 2) - 1 || 1 : Math.ceil(paintWidth / 2);
widthScale /= paintWidth / newWidth;
}
if (heightScale > 2 && paintHeight > 1) {
- newHeight = Math.ceil(paintHeight / 2);
+ newHeight = paintHeight >= 16384 ? Math.floor(paintHeight / 2) - 1 || 1 : Math.ceil(paintHeight) / 2;
heightScale /= paintHeight / newHeight;
}
tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
@@ -5910,7 +7327,7 @@ class CanvasGraphics {
}
setLineWidth(width) {
if (width !== this.current.lineWidth) {
- this._cachedScaleForStroking = null;
+ this._cachedScaleForStroking[0] = -1;
}
this.current.lineWidth = width;
this.ctx.lineWidth = width;
@@ -5976,7 +7393,8 @@ class CanvasGraphics {
this.checkSMaskState();
break;
case "TR":
- this.current.transferMaps = value;
+ this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
+ break;
}
}
}
@@ -6061,13 +7479,13 @@ class CanvasGraphics {
}
this.checkSMaskState();
this.pendingClip = null;
- this._cachedScaleForStroking = null;
+ this._cachedScaleForStroking[0] = -1;
this._cachedGetSinglePixelWidth = null;
}
}
transform(a, b, c, d, e, f) {
this.ctx.transform(a, b, c, d, e, f);
- this._cachedScaleForStroking = null;
+ this._cachedScaleForStroking[0] = -1;
this._cachedGetSinglePixelWidth = null;
}
constructPath(ops, args, minMax) {
@@ -6296,6 +7714,7 @@ class CanvasGraphics {
return;
}
const name = fontObj.loadedName || "sans-serif";
+ const typeface = fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
let bold = "normal";
if (fontObj.black) {
bold = "900";
@@ -6303,7 +7722,6 @@ class CanvasGraphics {
bold = "bold";
}
const italic = fontObj.italic ? "italic" : "normal";
- const typeface = `"${name}", ${fontObj.fallbackName}`;
let browserFontSize = size;
if (size < MIN_FONT_SIZE) {
browserFontSize = MIN_FONT_SIZE;
@@ -6373,7 +7791,7 @@ class CanvasGraphics {
}
}
if (isAddToPathSet) {
- const paths = this.pendingTextPaths || (this.pendingTextPaths = []);
+ const paths = this.pendingTextPaths ||= [];
paths.push({
transform: (0, _display_utils.getCurrentTransform)(ctx),
x,
@@ -6514,12 +7932,7 @@ class CanvasGraphics {
}
}
}
- let charWidth;
- if (vertical) {
- charWidth = width * widthAdvanceScale - spacing * fontDirection;
- } else {
- charWidth = width * widthAdvanceScale + spacing * fontDirection;
- }
+ const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
x += charWidth;
if (restoreNeeded) {
ctx.restore();
@@ -6551,7 +7964,7 @@ class CanvasGraphics {
if (isTextInvisible || fontSize === 0) {
return;
}
- this._cachedScaleForStroking = null;
+ this._cachedScaleForStroking[0] = -1;
this._cachedGetSinglePixelWidth = null;
ctx.save();
ctx.transform(...current.textMatrix);
@@ -6600,7 +8013,7 @@ class CanvasGraphics {
const baseTransform = this.baseTransform || (0, _display_utils.getCurrentTransform)(this.ctx);
const canvasGraphicsFactory = {
createCanvasGraphics: ctx => {
- return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, {
+ return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
optionalContentConfig: this.optionalContentConfig,
markedContentStack: this.markedContentStack
});
@@ -6620,12 +8033,12 @@ class CanvasGraphics {
this.current.patternFill = true;
}
setStrokeRGBColor(r, g, b) {
- const color = this.selectColor?.(r, g, b) || _util.Util.makeHexColor(r, g, b);
+ const color = _util.Util.makeHexColor(r, g, b);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
}
setFillRGBColor(r, g, b) {
- const color = this.selectColor?.(r, g, b) || _util.Util.makeHexColor(r, g, b);
+ const color = _util.Util.makeHexColor(r, g, b);
this.ctx.fillStyle = color;
this.current.fillColor = color;
this.current.patternFill = false;
@@ -6635,7 +8048,7 @@ class CanvasGraphics {
if (this.cachedPatterns.has(objId)) {
pattern = this.cachedPatterns.get(objId);
} else {
- pattern = (0, _pattern_helper.getShadingPattern)(this.objs.get(objId));
+ pattern = (0, _pattern_helper.getShadingPattern)(this.getObject(objId));
this.cachedPatterns.set(objId, pattern);
}
if (matrix) {
@@ -6653,17 +8066,11 @@ class CanvasGraphics {
ctx.fillStyle = pattern.getPattern(ctx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.SHADING);
const inv = (0, _display_utils.getCurrentTransformInverse)(ctx);
if (inv) {
- const canvas = ctx.canvas;
- const width = canvas.width;
- const height = canvas.height;
- const bl = _util.Util.applyTransform([0, 0], inv);
- const br = _util.Util.applyTransform([0, height], inv);
- const ul = _util.Util.applyTransform([width, 0], inv);
- const ur = _util.Util.applyTransform([width, height], inv);
- const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
- const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
- const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
- const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
+ const {
+ width,
+ height
+ } = ctx.canvas;
+ const [x0, y0, x1, y1] = _util.Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
} else {
this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
@@ -6804,7 +8211,7 @@ class CanvasGraphics {
}
beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
this.#restoreInitialState();
- resetCtxToDefault(this.ctx, this.foregroundColor);
+ resetCtxToDefault(this.ctx);
this.ctx.save();
this.save();
if (this.baseTransform) {
@@ -6835,10 +8242,11 @@ class CanvasGraphics {
this.annotationCanvasMap.set(id, canvas);
this.annotationCanvas.savedCtx = this.ctx;
this.ctx = context;
+ this.ctx.save();
this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
- resetCtxToDefault(this.ctx, this.foregroundColor);
+ resetCtxToDefault(this.ctx);
} else {
- resetCtxToDefault(this.ctx, this.foregroundColor);
+ resetCtxToDefault(this.ctx);
this.ctx.rect(rect[0], rect[1], width, height);
this.ctx.clip();
this.endPath();
@@ -6850,6 +8258,8 @@ class CanvasGraphics {
}
endAnnotation() {
if (this.annotationCanvas) {
+ this.ctx.restore();
+ this.#drawFilter();
this.ctx = this.annotationCanvas.savedCtx;
delete this.annotationCanvas.savedCtx;
delete this.annotationCanvas;
@@ -6965,6 +8375,32 @@ class CanvasGraphics {
}
this.paintInlineImageXObjectGroup(imgData, map);
}
+
+ applyTransferMapsToCanvas(ctx) {
+ if (this.current.transferMaps !== "none") {
+ ctx.filter = this.current.transferMaps;
+ ctx.drawImage(ctx.canvas, 0, 0);
+ ctx.filter = "none";
+ }
+ return ctx.canvas;
+ }
+
+ applyTransferMapsToBitmap(imgData) {
+ if (this.current.transferMaps === "none") {
+ return imgData.bitmap;
+ }
+ const {
+ bitmap,
+ width,
+ height
+ } = imgData;
+ const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
+ const tmpCtx = tmpCanvas.context;
+ tmpCtx.filter = this.current.transferMaps;
+ tmpCtx.drawImage(bitmap, 0, 0);
+ tmpCtx.filter = "none";
+ return tmpCanvas.canvas;
+ }
paintInlineImageXObject(imgData) {
if (!this.contentVisible) {
return;
@@ -6973,15 +8409,25 @@ class CanvasGraphics {
const height = imgData.height;
const ctx = this.ctx;
this.save();
+ if (!_util.isNodeJS) {
+ const {
+ filter
+ } = ctx;
+ if (filter !== "none" && filter !== "") {
+ ctx.filter = "none";
+ }
+ }
ctx.scale(1 / width, -1 / height);
let imgToPaint;
- if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
+ if (imgData.bitmap) {
+ imgToPaint = this.applyTransferMapsToBitmap(imgData);
+ } else if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
imgToPaint = imgData;
} else {
const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
const tmpCtx = tmpCanvas.context;
- putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);
- imgToPaint = tmpCanvas.canvas;
+ putBinaryImageData(tmpCtx, imgData);
+ imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
}
const scaled = this._scaleImage(imgToPaint, (0, _display_utils.getCurrentTransformInverse)(ctx));
ctx.imageSmoothingEnabled = getImageSmoothingEnabled((0, _display_utils.getCurrentTransform)(ctx), imgData.interpolate);
@@ -6994,16 +8440,22 @@ class CanvasGraphics {
return;
}
const ctx = this.ctx;
- const w = imgData.width;
- const h = imgData.height;
- const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
- const tmpCtx = tmpCanvas.context;
- putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);
+ let imgToPaint;
+ if (imgData.bitmap) {
+ imgToPaint = imgData.bitmap;
+ } else {
+ const w = imgData.width;
+ const h = imgData.height;
+ const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
+ const tmpCtx = tmpCanvas.context;
+ putBinaryImageData(tmpCtx, imgData);
+ imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
+ }
for (const entry of map) {
ctx.save();
ctx.transform(...entry.transform);
ctx.scale(1, -1);
- drawImageAtIntegerCoords(ctx, tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
+ drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
ctx.restore();
}
this.compose();
@@ -7077,16 +8529,28 @@ class CanvasGraphics {
return this._cachedGetSinglePixelWidth;
}
getScaleForStroking() {
- if (!this._cachedScaleForStroking) {
+ if (this._cachedScaleForStroking[0] === -1) {
const {
lineWidth
} = this.current;
- const m = (0, _display_utils.getCurrentTransform)(this.ctx);
+ const {
+ a,
+ b,
+ c,
+ d
+ } = this.ctx.getTransform();
let scaleX, scaleY;
- if (m[1] === 0 && m[2] === 0) {
- const normX = Math.abs(m[0]);
- const normY = Math.abs(m[3]);
- if (lineWidth === 0) {
+ if (b === 0 && c === 0) {
+ const normX = Math.abs(a);
+ const normY = Math.abs(d);
+ if (normX === normY) {
+ if (lineWidth === 0) {
+ scaleX = scaleY = 1 / normX;
+ } else {
+ const scaledLineWidth = normX * lineWidth;
+ scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
+ }
+ } else if (lineWidth === 0) {
scaleX = 1 / normX;
scaleY = 1 / normY;
} else {
@@ -7096,9 +8560,9 @@ class CanvasGraphics {
scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
}
} else {
- const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
- const normX = Math.hypot(m[0], m[1]);
- const normY = Math.hypot(m[2], m[3]);
+ const absDet = Math.abs(a * d - b * c);
+ const normX = Math.hypot(a, b);
+ const normY = Math.hypot(c, d);
if (lineWidth === 0) {
scaleX = normY / absDet;
scaleY = normX / absDet;
@@ -7108,7 +8572,8 @@ class CanvasGraphics {
scaleY = normX > baseArea ? normX / baseArea : 1;
}
}
- this._cachedScaleForStroking = [scaleX, scaleY];
+ this._cachedScaleForStroking[0] = scaleX;
+ this._cachedScaleForStroking[1] = scaleY;
}
return this._cachedScaleForStroking;
}
@@ -7125,21 +8590,19 @@ class CanvasGraphics {
ctx.stroke();
return;
}
- let savedMatrix, savedDashes, savedDashOffset;
+ const dashes = ctx.getLineDash();
if (saveRestore) {
- savedMatrix = (0, _display_utils.getCurrentTransform)(ctx);
- savedDashes = ctx.getLineDash().slice();
- savedDashOffset = ctx.lineDashOffset;
+ ctx.save();
}
ctx.scale(scaleX, scaleY);
- const scale = Math.max(scaleX, scaleY);
- ctx.setLineDash(ctx.getLineDash().map(x => x / scale));
- ctx.lineDashOffset /= scale;
+ if (dashes.length > 0) {
+ const scale = Math.max(scaleX, scaleY);
+ ctx.setLineDash(dashes.map(x => x / scale));
+ ctx.lineDashOffset /= scale;
+ }
ctx.stroke();
if (saveRestore) {
- ctx.setTransform(...savedMatrix);
- ctx.setLineDash(savedDashes);
- ctx.lineDashOffset = savedDashOffset;
+ ctx.restore();
}
}
isContentVisible() {
@@ -7305,12 +8768,7 @@ function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
let xb, cbr, cbg, cbb;
for (let y = minY; y <= maxY; y++) {
if (y < y2) {
- let k;
- if (y < y1) {
- k = 0;
- } else {
- k = (y1 - y) / (y1 - y2);
- }
+ const k = y < y1 ? 0 : (y1 - y) / (y1 - y2);
xa = x1 - (x1 - x2) * k;
car = c1r - (c1r - c2r) * k;
cag = c1g - (c1g - c2g) * k;
@@ -7487,9 +8945,7 @@ const PaintType = {
UNCOLORED: 2
};
class TilingPattern {
- static get MAX_PATTERN_SIZE() {
- return (0, _util.shadow)(this, "MAX_PATTERN_SIZE", 3000);
- }
+ static MAX_PATTERN_SIZE = 3000;
constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
this.operatorList = IR[2];
this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
@@ -7626,23 +9082,37 @@ exports.TilingPattern = TilingPattern;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.applyMaskImageData = applyMaskImageData;
+ exports.convertBlackAndWhiteToRGBA = convertBlackAndWhiteToRGBA;
+ exports.convertToRGBA = convertToRGBA;
+ exports.grayToRGBA = grayToRGBA;
var _util = __w_pdfjs_require__(1);
-function applyMaskImageData({
+
+ function convertToRGBA(params) {
+ switch (params.kind) {
+ case _util.ImageKind.GRAYSCALE_1BPP:
+ return convertBlackAndWhiteToRGBA(params);
+ case _util.ImageKind.RGB_24BPP:
+ return convertRGBToRGBA(params);
+ }
+ return null;
+ }
+
+ function convertBlackAndWhiteToRGBA({
src,
srcPos = 0,
dest,
- destPos = 0,
width,
height,
+ nonBlackColor = 0xffffffff,
inverseDecode = false
}) {
- const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
- const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
+ const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
+ const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
const widthInSource = width >> 3;
const widthRemainder = width & 7;
const srcLength = src.length;
dest = new Uint32Array(dest.buffer);
+ let destPos = 0;
for (let i = 0; i < height; i++) {
for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
const elem = srcPos < srcLength ? src[srcPos] : 255;
@@ -7669,6 +9139,62 @@ function applyMaskImageData({
};
}
+ function convertRGBToRGBA({
+ src,
+ srcPos = 0,
+ dest,
+ destPos = 0,
+ width,
+ height
+ }) {
+ let i = 0;
+ const len32 = src.length >> 2;
+ const src32 = new Uint32Array(src.buffer, srcPos, len32);
+ if (_util.FeatureTest.isLittleEndian) {
+ for (; i < len32 - 2; i += 3, destPos += 4) {
+ const s1 = src32[i];
+ const s2 = src32[i + 1];
+ const s3 = src32[i + 2];
+ dest[destPos] = s1 | 0xff000000;
+ dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000;
+ dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000;
+ dest[destPos + 3] = s3 >>> 8 | 0xff000000;
+ }
+ for (let j = i * 4, jj = src.length; j < jj; j += 3) {
+ dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000;
+ }
+ } else {
+ for (; i < len32 - 2; i += 3, destPos += 4) {
+ const s1 = src32[i];
+ const s2 = src32[i + 1];
+ const s3 = src32[i + 2];
+ dest[destPos] = s1 | 0xff;
+ dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff;
+ dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff;
+ dest[destPos + 3] = s3 << 8 | 0xff;
+ }
+ for (let j = i * 4, jj = src.length; j < jj; j += 3) {
+ dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
+ }
+ }
+ return {
+ srcPos,
+ destPos
+ };
+ }
+
+ function grayToRGBA(src, dest) {
+ if (_util.FeatureTest.isLittleEndian) {
+ for (let i = 0, ii = src.length; i < ii; i++) {
+ dest[i] = src[i] * 0x10101 | 0xff000000;
+ }
+ } else {
+ for (let i = 0, ii = src.length; i < ii; i++) {
+ dest[i] = src[i] * 0x1010100 | 0x000000ff;
+ }
+ }
+ }
+
/***/ }),
/* 14 */
/***/ ((__unused_webpack_module, exports) => {
@@ -7747,7 +9273,7 @@ class MessageHandler {
return;
}
if (data.stream) {
- this._processStreamMessage(data);
+ this.#processStreamMessage(data);
return;
}
if (data.callback) {
@@ -7795,7 +9321,7 @@ class MessageHandler {
return;
}
if (data.streamId) {
- this._createStreamSink(data);
+ this.#createStreamSink(data);
return;
}
action(data.data);
@@ -7819,7 +9345,7 @@ class MessageHandler {
}
sendWithPromise(actionName, data, transfers) {
const callbackId = this.callbackId++;
- const capability = (0, _util.createPromiseCapability)();
+ const capability = new _util.PromiseCapability();
this.callbackCapabilities[callbackId] = capability;
try {
this.comObj.postMessage({
@@ -7841,7 +9367,7 @@ class MessageHandler {
comObj = this.comObj;
return new ReadableStream({
start: controller => {
- const startCapability = (0, _util.createPromiseCapability)();
+ const startCapability = new _util.PromiseCapability();
this.streamControllers[streamId] = {
controller,
startCall: startCapability,
@@ -7860,7 +9386,7 @@ class MessageHandler {
return startCapability.promise;
},
pull: controller => {
- const pullCapability = (0, _util.createPromiseCapability)();
+ const pullCapability = new _util.PromiseCapability();
this.streamControllers[streamId].pullCall = pullCapability;
comObj.postMessage({
sourceName,
@@ -7873,7 +9399,7 @@ class MessageHandler {
},
cancel: reason => {
(0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
- const cancelCapability = (0, _util.createPromiseCapability)();
+ const cancelCapability = new _util.PromiseCapability();
this.streamControllers[streamId].cancelCall = cancelCapability;
this.streamControllers[streamId].isClosed = true;
comObj.postMessage({
@@ -7887,7 +9413,8 @@ class MessageHandler {
}
}, queueingStrategy);
}
- _createStreamSink(data) {
+
+ #createStreamSink(data) {
const streamId = data.streamId,
sourceName = this.sourceName,
targetName = data.sourceName,
@@ -7902,7 +9429,7 @@ class MessageHandler {
const lastDesiredSize = this.desiredSize;
this.desiredSize -= size;
if (lastDesiredSize > 0 && this.desiredSize <= 0) {
- this.sinkCapability = (0, _util.createPromiseCapability)();
+ this.sinkCapability = new _util.PromiseCapability();
this.ready = this.sinkCapability.promise;
}
comObj.postMessage({
@@ -7940,7 +9467,7 @@ class MessageHandler {
reason: wrapReason(reason)
});
},
- sinkCapability: (0, _util.createPromiseCapability)(),
+ sinkCapability: new _util.PromiseCapability(),
onPull: null,
onCancel: null,
isCancelled: false,
@@ -7970,7 +9497,8 @@ class MessageHandler {
});
});
}
- _processStreamMessage(data) {
+
+ #processStreamMessage(data) {
const streamId = data.streamId,
sourceName = this.sourceName,
targetName = data.sourceName,
@@ -8008,7 +9536,7 @@ class MessageHandler {
}
streamSink.desiredSize = data.desiredSize;
new Promise(function (resolve) {
- resolve(streamSink.onPull && streamSink.onPull());
+ resolve(streamSink.onPull?.());
}).then(function () {
comObj.postMessage({
sourceName,
@@ -8041,12 +9569,12 @@ class MessageHandler {
}
streamController.isClosed = true;
streamController.controller.close();
- this._deleteStreamController(streamController, streamId);
+ this.#deleteStreamController(streamController, streamId);
break;
case StreamKind.ERROR:
(0, _util.assert)(streamController, "error should have stream controller");
streamController.controller.error(wrapReason(data.reason));
- this._deleteStreamController(streamController, streamId);
+ this.#deleteStreamController(streamController, streamId);
break;
case StreamKind.CANCEL_COMPLETE:
if (data.success) {
@@ -8054,14 +9582,14 @@ class MessageHandler {
} else {
streamController.cancelCall.reject(wrapReason(data.reason));
}
- this._deleteStreamController(streamController, streamId);
+ this.#deleteStreamController(streamController, streamId);
break;
case StreamKind.CANCEL:
if (!streamSink) {
break;
}
new Promise(function (resolve) {
- resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
+ resolve(streamSink.onCancel?.(wrapReason(data.reason)));
}).then(function () {
comObj.postMessage({
sourceName,
@@ -8087,8 +9615,9 @@ class MessageHandler {
throw new Error("Unexpected stream case");
}
}
- async _deleteStreamController(streamController, streamId) {
- await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
+
+ async #deleteStreamController(streamController, streamId) {
+ await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
delete this.streamControllers[streamId];
}
destroy() {
@@ -8306,7 +9835,7 @@ class OptionalContentConfig {
this.#cachedGetHash = null;
}
get hasInitialVisibility() {
- return this.getHash() === this.#initialHash;
+ return this.#initialHash === null || this.getHash() === this.#initialHash;
}
getOrder() {
if (!this.#groups.size) {
@@ -8523,7 +10052,7 @@ class PDFDataTransportStreamReader {
done: true
};
}
- const requestCapability = (0, _util.createPromiseCapability)();
+ const requestCapability = new _util.PromiseCapability();
this._requests.push(requestCapability);
return requestCapability.promise;
}
@@ -8595,7 +10124,7 @@ class PDFDataTransportStreamRangeReader {
done: true
};
}
- const requestCapability = (0, _util.createPromiseCapability)();
+ const requestCapability = new _util.PromiseCapability();
this._requests.push(requestCapability);
return requestCapability.promise;
}
@@ -8614,59 +10143,6 @@ class PDFDataTransportStreamRangeReader {
/***/ }),
/* 19 */
-/***/ ((__unused_webpack_module, exports) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.XfaText = void 0;
-class XfaText {
- static textContent(xfa) {
- const items = [];
- const output = {
- items,
- styles: Object.create(null)
- };
- function walk(node) {
- if (!node) {
- return;
- }
- let str = null;
- const name = node.name;
- if (name === "#text") {
- str = node.value;
- } else if (!XfaText.shouldBuildText(name)) {
- return;
- } else if (node?.attributes?.textContent) {
- str = node.attributes.textContent;
- } else if (node.value) {
- str = node.value;
- }
- if (str !== null) {
- items.push({
- str
- });
- }
- if (!node.children) {
- return;
- }
- for (const child of node.children) {
- walk(child);
- }
- }
- walk(xfa);
- return output;
- }
- static shouldBuildText(name) {
- return !(name === "textarea" || name === "input" || name === "option" || name === "select");
- }
-}
-exports.XfaText = XfaText;
-
-/***/ }),
-/* 20 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -8674,83 +10150,49 @@ exports.XfaText = XfaText;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.NodeStandardFontDataFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;
-var _base_factory = __w_pdfjs_require__(7);
+ exports.PDFFetchStream = void 0;
+ var _util = __w_pdfjs_require__(1);
+ var _network_utils = __w_pdfjs_require__(20);
;
-const fetchData = function (url) {
- return new Promise((resolve, reject) => {
- const fs = require("fs");
- fs.readFile(url, (error, data) => {
- if (error || !data) {
- reject(new Error(error));
- return;
- }
- resolve(new Uint8Array(data));
- });
- });
-};
-class NodeCanvasFactory extends _base_factory.BaseCanvasFactory {
- _createCanvas(width, height) {
- const Canvas = require("canvas");
- return Canvas.createCanvas(width, height);
- }
-}
-exports.NodeCanvasFactory = NodeCanvasFactory;
-class NodeCMapReaderFactory extends _base_factory.BaseCMapReaderFactory {
- _fetchData(url, compressionType) {
- return fetchData(url).then(data => {
- return {
- cMapData: data,
- compressionType
- };
- });
- }
-}
-exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
-class NodeStandardFontDataFactory extends _base_factory.BaseStandardFontDataFactory {
- _fetchData(url) {
- return fetchData(url);
- }
-}
-exports.NodeStandardFontDataFactory = NodeStandardFontDataFactory;
-/***/ }),
-/* 21 */
-/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
+ function createFetchOptions(headers, withCredentials, abortController) {
+ return {
+ method: "GET",
+ headers,
+ signal: abortController.signal,
+ mode: "cors",
+ credentials: withCredentials ? "include" : "same-origin",
+ redirect: "follow"
+ };
+ }
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.PDFNodeStream = void 0;
-var _util = __w_pdfjs_require__(1);
-var _network_utils = __w_pdfjs_require__(22);
-;
-const fs = require("fs");
-const http = require("http");
-const https = require("https");
-const url = require("url");
-const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
-function parseUrl(sourceUrl) {
- const parsedUrl = url.parse(sourceUrl);
- if (parsedUrl.protocol === "file:" || parsedUrl.host) {
- return parsedUrl;
+ function createHeaders(httpHeaders) {
+ const headers = new Headers();
+ for (const property in httpHeaders) {
+ const value = httpHeaders[property];
+ if (value === undefined) {
+ continue;
+ }
+ headers.append(property, value);
}
- if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
- return url.parse(`file:///${sourceUrl}`);
- }
- if (!parsedUrl.host) {
- parsedUrl.protocol = "file:";
- }
- return parsedUrl;
+ return headers;
}
-class PDFNodeStream {
+
+ function getArrayBuffer(val) {
+ if (val instanceof Uint8Array) {
+ return val.buffer;
+ }
+ if (val instanceof ArrayBuffer) {
+ return val;
+ }
+ (0, _util.warn)(`getArrayBuffer - unexpected data format: ${val}`);
+ return new Uint8Array(val).buffer;
+ }
+
+ class PDFFetchStream {
constructor(source) {
this.source = source;
- this.url = parseUrl(source.url);
- this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
- this.isFsUrl = this.url.protocol === "file:";
+ this.isHttp = /^https?:/i.test(source.url);
this.httpHeaders = this.isHttp && source.httpHeaders || {};
this._fullRequestReader = null;
this._rangeRequestReaders = [];
@@ -8759,17 +10201,18 @@ class PDFNodeStream {
return this._fullRequestReader?._loaded ?? 0;
}
getFullReader() {
- (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
- this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
+ (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
+ this._fullRequestReader = new PDFFetchStreamReader(this);
return this._fullRequestReader;
}
- getRangeReader(start, end) {
+
+ getRangeReader(begin, end) {
if (end <= this._progressiveDataLength) {
return null;
}
- const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
- this._rangeRequestReaders.push(rangeReader);
- return rangeReader;
+ const reader = new PDFFetchStreamRangeReader(this, begin, end);
+ this._rangeRequestReaders.push(reader);
+ return reader;
}
cancelAllRequests(reason) {
this._fullRequestReader?.cancel(reason);
@@ -8778,27 +10221,55 @@ class PDFNodeStream {
}
}
}
-exports.PDFNodeStream = PDFNodeStream;
-class BaseFullReader {
+
+ exports.PDFFetchStream = PDFFetchStream;
+
+ class PDFFetchStreamReader {
constructor(stream) {
- this._url = stream.url;
- this._done = false;
- this._storedError = null;
- this.onProgress = null;
+ this._stream = stream;
+ this._reader = null;
+ this._loaded = 0;
+ this._filename = null;
const source = stream.source;
+ this._withCredentials = source.withCredentials || false;
this._contentLength = source.length;
- this._loaded = 0;
- this._filename = null;
+ this._headersCapability = new _util.PromiseCapability();
this._disableRange = source.disableRange || false;
this._rangeChunkSize = source.rangeChunkSize;
if (!this._rangeChunkSize && !this._disableRange) {
this._disableRange = true;
}
+ this._abortController = new AbortController();
this._isStreamingSupported = !source.disableStream;
this._isRangeSupported = !source.disableRange;
- this._readableStream = null;
- this._readCapability = (0, _util.createPromiseCapability)();
- this._headersCapability = (0, _util.createPromiseCapability)();
+ this._headers = createHeaders(this._stream.httpHeaders);
+ const url = source.url;
+ fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
+ if (!(0, _network_utils.validateResponseStatus)(response.status)) {
+ throw (0, _network_utils.createResponseStatusError)(response.status, url);
+ }
+ this._reader = response.body.getReader();
+ this._headersCapability.resolve();
+ const getResponseHeader = name => {
+ return response.headers.get(name);
+ };
+ const {
+ allowRangeRequests,
+ suggestedLength
+ } = (0, _network_utils.validateRangeRequestCapabilities)({
+ getResponseHeader,
+ isHttp: this._stream.isHttp,
+ rangeChunkSize: this._rangeChunkSize,
+ disableRange: this._disableRange
+ });
+ this._isRangeSupported = allowRangeRequests;
+ this._contentLength = suggestedLength || this._contentLength;
+ this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
+ if (!this._isStreamingSupported && this._isRangeSupported) {
+ this.cancel(new _util.AbortException("Streaming is disabled."));
+ }
+ }).catch(this._headersCapability.reject);
+ this.onProgress = null;
}
get headersReady() {
return this._headersCapability.promise;
@@ -8816,256 +10287,87 @@ class BaseFullReader {
return this._isStreamingSupported;
}
async read() {
- await this._readCapability.promise;
- if (this._done) {
+ await this._headersCapability.promise;
+ const {
+ value,
+ done
+ } = await this._reader.read();
+ if (done) {
return {
- value: undefined,
- done: true
+ value,
+ done
};
}
- if (this._storedError) {
- throw this._storedError;
- }
- const chunk = this._readableStream.read();
- if (chunk === null) {
- this._readCapability = (0, _util.createPromiseCapability)();
- return this.read();
- }
- this._loaded += chunk.length;
+ this._loaded += value.byteLength;
this.onProgress?.({
loaded: this._loaded,
total: this._contentLength
});
- const buffer = new Uint8Array(chunk).buffer;
return {
- value: buffer,
+ value: getArrayBuffer(value),
done: false
};
}
cancel(reason) {
- if (!this._readableStream) {
- this._error(reason);
- return;
- }
- this._readableStream.destroy(reason);
+ this._reader?.cancel(reason);
+ this._abortController.abort();
}
- _error(reason) {
- this._storedError = reason;
- this._readCapability.resolve();
- }
- _setReadableStream(readableStream) {
- this._readableStream = readableStream;
- readableStream.on("readable", () => {
- this._readCapability.resolve();
- });
- readableStream.on("end", () => {
- readableStream.destroy();
- this._done = true;
- this._readCapability.resolve();
- });
- readableStream.on("error", reason => {
- this._error(reason);
- });
- if (!this._isStreamingSupported && this._isRangeSupported) {
- this._error(new _util.AbortException("streaming is disabled"));
- }
- if (this._storedError) {
- this._readableStream.destroy(this._storedError);
- }
- }
-}
-class BaseRangeReader {
- constructor(stream) {
- this._url = stream.url;
- this._done = false;
- this._storedError = null;
- this.onProgress = null;
+ }
+
+ class PDFFetchStreamRangeReader {
+ constructor(stream, begin, end) {
+ this._stream = stream;
+ this._reader = null;
this._loaded = 0;
- this._readableStream = null;
- this._readCapability = (0, _util.createPromiseCapability)();
const source = stream.source;
+ this._withCredentials = source.withCredentials || false;
+ this._readCapability = new _util.PromiseCapability();
this._isStreamingSupported = !source.disableStream;
+ this._abortController = new AbortController();
+ this._headers = createHeaders(this._stream.httpHeaders);
+ this._headers.append("Range", `bytes=${begin}-${end - 1}`);
+ const url = source.url;
+ fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
+ if (!(0, _network_utils.validateResponseStatus)(response.status)) {
+ throw (0, _network_utils.createResponseStatusError)(response.status, url);
+ }
+ this._readCapability.resolve();
+ this._reader = response.body.getReader();
+ }).catch(this._readCapability.reject);
+ this.onProgress = null;
}
get isStreamingSupported() {
return this._isStreamingSupported;
}
async read() {
await this._readCapability.promise;
- if (this._done) {
+ const {
+ value,
+ done
+ } = await this._reader.read();
+ if (done) {
return {
- value: undefined,
- done: true
+ value,
+ done
};
}
- if (this._storedError) {
- throw this._storedError;
- }
- const chunk = this._readableStream.read();
- if (chunk === null) {
- this._readCapability = (0, _util.createPromiseCapability)();
- return this.read();
- }
- this._loaded += chunk.length;
+ this._loaded += value.byteLength;
this.onProgress?.({
loaded: this._loaded
});
- const buffer = new Uint8Array(chunk).buffer;
return {
- value: buffer,
+ value: getArrayBuffer(value),
done: false
};
}
cancel(reason) {
- if (!this._readableStream) {
- this._error(reason);
- return;
- }
- this._readableStream.destroy(reason);
- }
- _error(reason) {
- this._storedError = reason;
- this._readCapability.resolve();
- }
- _setReadableStream(readableStream) {
- this._readableStream = readableStream;
- readableStream.on("readable", () => {
- this._readCapability.resolve();
- });
- readableStream.on("end", () => {
- readableStream.destroy();
- this._done = true;
- this._readCapability.resolve();
- });
- readableStream.on("error", reason => {
- this._error(reason);
- });
- if (this._storedError) {
- this._readableStream.destroy(this._storedError);
- }
- }
-}
-function createRequestOptions(parsedUrl, headers) {
- return {
- protocol: parsedUrl.protocol,
- auth: parsedUrl.auth,
- host: parsedUrl.hostname,
- port: parsedUrl.port,
- path: parsedUrl.path,
- method: "GET",
- headers
- };
-}
-class PDFNodeStreamFullReader extends BaseFullReader {
- constructor(stream) {
- super(stream);
- const handleResponse = response => {
- if (response.statusCode === 404) {
- const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
- this._storedError = error;
- this._headersCapability.reject(error);
- return;
- }
- this._headersCapability.resolve();
- this._setReadableStream(response);
- const getResponseHeader = name => {
- return this._readableStream.headers[name.toLowerCase()];
- };
- const {
- allowRangeRequests,
- suggestedLength
- } = (0, _network_utils.validateRangeRequestCapabilities)({
- getResponseHeader,
- isHttp: stream.isHttp,
- rangeChunkSize: this._rangeChunkSize,
- disableRange: this._disableRange
- });
- this._isRangeSupported = allowRangeRequests;
- this._contentLength = suggestedLength || this._contentLength;
- this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
- };
- this._request = null;
- if (this._url.protocol === "http:") {
- this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
- } else {
- this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
- }
- this._request.on("error", reason => {
- this._storedError = reason;
- this._headersCapability.reject(reason);
- });
- this._request.end();
- }
-}
-class PDFNodeStreamRangeReader extends BaseRangeReader {
- constructor(stream, start, end) {
- super(stream);
- this._httpHeaders = {};
- for (const property in stream.httpHeaders) {
- const value = stream.httpHeaders[property];
- if (value === undefined) {
- continue;
- }
- this._httpHeaders[property] = value;
- }
- this._httpHeaders.Range = `bytes=${start}-${end - 1}`;
- const handleResponse = response => {
- if (response.statusCode === 404) {
- const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
- this._storedError = error;
- return;
- }
- this._setReadableStream(response);
- };
- this._request = null;
- if (this._url.protocol === "http:") {
- this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
- } else {
- this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
- }
- this._request.on("error", reason => {
- this._storedError = reason;
- });
- this._request.end();
- }
-}
-class PDFNodeStreamFsFullReader extends BaseFullReader {
- constructor(stream) {
- super(stream);
- let path = decodeURIComponent(this._url.path);
- if (fileUriRegex.test(this._url.href)) {
- path = path.replace(/^\//, "");
- }
- fs.lstat(path, (error, stat) => {
- if (error) {
- if (error.code === "ENOENT") {
- error = new _util.MissingPDFException(`Missing PDF "${path}".`);
- }
- this._storedError = error;
- this._headersCapability.reject(error);
- return;
- }
- this._contentLength = stat.size;
- this._setReadableStream(fs.createReadStream(path));
- this._headersCapability.resolve();
- });
- }
-}
-class PDFNodeStreamFsRangeReader extends BaseRangeReader {
- constructor(stream, start, end) {
- super(stream);
- let path = decodeURIComponent(this._url.path);
- if (fileUriRegex.test(this._url.href)) {
- path = path.replace(/^\//, "");
- }
- this._setReadableStream(fs.createReadStream(path, {
- start,
- end: end - 1
- }));
+ this._reader?.cancel(reason);
+ this._abortController.abort();
}
}
/***/ }),
-/* 22 */
+ /* 20 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -9078,7 +10380,7 @@ exports.extractFilenameFromHeader = extractFilenameFromHeader;
exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
exports.validateResponseStatus = validateResponseStatus;
var _util = __w_pdfjs_require__(1);
-var _content_disposition = __w_pdfjs_require__(23);
+ var _content_disposition = __w_pdfjs_require__(21);
var _display_utils = __w_pdfjs_require__(6);
function validateRangeRequestCapabilities({
getResponseHeader,
@@ -9118,7 +10420,8 @@ function extractFilenameFromHeader(getResponseHeader) {
if (filename.includes("%")) {
try {
filename = decodeURIComponent(filename);
- } catch (ex) {}
+ } catch {
+ }
}
if ((0, _display_utils.isPdfFile)(filename)) {
return filename;
@@ -9137,7 +10440,7 @@ function validateResponseStatus(status) {
}
/***/ }),
-/* 23 */
+ /* 21 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -9185,7 +10488,8 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
const buffer = (0, _util.stringToBytes)(value);
value = decoder.decode(buffer);
needsEncodingFixup = false;
- } catch (e) {}
+ } catch {
+ }
}
return value;
}
@@ -9239,7 +10543,7 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
parts[i] = parts[i].slice(0, quotindex);
parts.length = i + 1;
}
- parts[i] = parts[i].replace(/\\(.)/g, "$1");
+ parts[i] = parts[i].replaceAll(/\\(.)/g, "$1");
}
value = parts.join('"');
}
@@ -9259,17 +10563,18 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
return value;
}
- return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
+ return value.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
if (encoding === "q" || encoding === "Q") {
- text = text.replace(/_/g, " ");
- text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {
+ text = text.replaceAll("_", " ");
+ text = text.replaceAll(/=([0-9a-fA-F]{2})/g, function (match, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
return textdecode(charset, text);
}
try {
text = atob(text);
- } catch (e) {}
+ } catch {
+ }
return textdecode(charset, text);
});
}
@@ -9277,7 +10582,7 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
}
/***/ }),
-/* 24 */
+ /* 22 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -9287,7 +10592,7 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.PDFNetworkStream = void 0;
var _util = __w_pdfjs_require__(1);
-var _network_utils = __w_pdfjs_require__(22);
+ var _network_utils = __w_pdfjs_require__(20);
;
const OK_RESPONSE = 200;
const PARTIAL_CONTENT_RESPONSE = 206;
@@ -9304,9 +10609,6 @@ class NetworkManager {
this.isHttp = /^https?:/i.test(url);
this.httpHeaders = this.isHttp && args.httpHeaders || Object.create(null);
this.withCredentials = args.withCredentials || false;
- this.getXhr = args.getXhr || function NetworkManager_getXhr() {
- return new XMLHttpRequest();
- };
this.currXhrId = 0;
this.pendingRequests = Object.create(null);
}
@@ -9324,7 +10626,7 @@ class NetworkManager {
return this.request(listeners);
}
request(args) {
- const xhr = this.getXhr();
+ const xhr = new XMLHttpRequest();
const xhrId = this.currXhrId++;
const pendingRequest = this.pendingRequests[xhrId] = {
xhr
@@ -9469,7 +10771,7 @@ class PDFNetworkStreamFullRequestReader {
};
this._url = source.url;
this._fullRequestId = manager.requestFull(args);
- this._headersReceivedCapability = (0, _util.createPromiseCapability)();
+ this._headersReceivedCapability = new _util.PromiseCapability();
this._disableRange = source.disableRange || false;
this._contentLength = source.length;
this._rangeChunkSize = source.rangeChunkSize;
@@ -9581,7 +10883,7 @@ class PDFNetworkStreamFullRequestReader {
done: true
};
}
- const requestCapability = (0, _util.createPromiseCapability)();
+ const requestCapability = new _util.PromiseCapability();
this._requests.push(requestCapability);
return requestCapability.promise;
}
@@ -9678,7 +10980,7 @@ class PDFNetworkStreamRangeRequestReader {
done: true
};
}
- const requestCapability = (0, _util.createPromiseCapability)();
+ const requestCapability = new _util.PromiseCapability();
this._requests.push(requestCapability);
return requestCapability.promise;
}
@@ -9699,7 +11001,7 @@ class PDFNetworkStreamRangeRequestReader {
}
/***/ }),
-/* 25 */
+ /* 23 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -9707,45 +11009,33 @@ class PDFNetworkStreamRangeRequestReader {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.PDFFetchStream = void 0;
+ exports.PDFNodeStream = void 0;
var _util = __w_pdfjs_require__(1);
-var _network_utils = __w_pdfjs_require__(22);
+ var _network_utils = __w_pdfjs_require__(20);
;
-function createFetchOptions(headers, withCredentials, abortController) {
- return {
- method: "GET",
- headers,
- signal: abortController.signal,
- mode: "cors",
- credentials: withCredentials ? "include" : "same-origin",
- redirect: "follow"
- };
-}
-function createHeaders(httpHeaders) {
- const headers = new Headers();
- for (const property in httpHeaders) {
- const value = httpHeaders[property];
- if (value === undefined) {
- continue;
- }
- headers.append(property, value);
+ const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
+
+ function parseUrl(sourceUrl) {
+ const url = require("url");
+ const parsedUrl = url.parse(sourceUrl);
+ if (parsedUrl.protocol === "file:" || parsedUrl.host) {
+ return parsedUrl;
+ }
+ if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
+ return url.parse(`file:///${sourceUrl}`);
}
- return headers;
-}
-function getArrayBuffer(val) {
- if (val instanceof Uint8Array) {
- return val.buffer;
- }
- if (val instanceof ArrayBuffer) {
- return val;
- }
- (0, _util.warn)(`getArrayBuffer - unexpected data format: ${val}`);
- return new Uint8Array(val).buffer;
-}
-class PDFFetchStream {
+ if (!parsedUrl.host) {
+ parsedUrl.protocol = "file:";
+ }
+ return parsedUrl;
+ }
+
+ class PDFNodeStream {
constructor(source) {
this.source = source;
- this.isHttp = /^https?:/i.test(source.url);
+ this.url = parseUrl(source.url);
+ this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
+ this.isFsUrl = this.url.protocol === "file:";
this.httpHeaders = this.isHttp && source.httpHeaders || {};
this._fullRequestReader = null;
this._rangeRequestReaders = [];
@@ -9754,17 +11044,18 @@ class PDFFetchStream {
return this._fullRequestReader?._loaded ?? 0;
}
getFullReader() {
- (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
- this._fullRequestReader = new PDFFetchStreamReader(this);
+ (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
+ this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
return this._fullRequestReader;
}
- getRangeReader(begin, end) {
+
+ getRangeReader(start, end) {
if (end <= this._progressiveDataLength) {
return null;
}
- const reader = new PDFFetchStreamRangeReader(this, begin, end);
- this._rangeRequestReaders.push(reader);
- return reader;
+ const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
+ this._rangeRequestReaders.push(rangeReader);
+ return rangeReader;
}
cancelAllRequests(reason) {
this._fullRequestReader?.cancel(reason);
@@ -9773,53 +11064,29 @@ class PDFFetchStream {
}
}
}
-exports.PDFFetchStream = PDFFetchStream;
-class PDFFetchStreamReader {
+
+ exports.PDFNodeStream = PDFNodeStream;
+
+ class BaseFullReader {
constructor(stream) {
- this._stream = stream;
- this._reader = null;
- this._loaded = 0;
- this._filename = null;
+ this._url = stream.url;
+ this._done = false;
+ this._storedError = null;
+ this.onProgress = null;
const source = stream.source;
- this._withCredentials = source.withCredentials || false;
this._contentLength = source.length;
- this._headersCapability = (0, _util.createPromiseCapability)();
+ this._loaded = 0;
+ this._filename = null;
this._disableRange = source.disableRange || false;
this._rangeChunkSize = source.rangeChunkSize;
if (!this._rangeChunkSize && !this._disableRange) {
this._disableRange = true;
}
- this._abortController = new AbortController();
this._isStreamingSupported = !source.disableStream;
this._isRangeSupported = !source.disableRange;
- this._headers = createHeaders(this._stream.httpHeaders);
- const url = source.url;
- fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
- if (!(0, _network_utils.validateResponseStatus)(response.status)) {
- throw (0, _network_utils.createResponseStatusError)(response.status, url);
- }
- this._reader = response.body.getReader();
- this._headersCapability.resolve();
- const getResponseHeader = name => {
- return response.headers.get(name);
- };
- const {
- allowRangeRequests,
- suggestedLength
- } = (0, _network_utils.validateRangeRequestCapabilities)({
- getResponseHeader,
- isHttp: this._stream.isHttp,
- rangeChunkSize: this._rangeChunkSize,
- disableRange: this._disableRange
- });
- this._isRangeSupported = allowRangeRequests;
- this._contentLength = suggestedLength || this._contentLength;
- this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
- if (!this._isStreamingSupported && this._isRangeSupported) {
- this.cancel(new _util.AbortException("Streaming is disabled."));
- }
- }).catch(this._headersCapability.reject);
- this.onProgress = null;
+ this._readableStream = null;
+ this._readCapability = new _util.PromiseCapability();
+ this._headersCapability = new _util.PromiseCapability();
}
get headersReady() {
return this._headersCapability.promise;
@@ -9837,83 +11104,1657 @@ class PDFFetchStreamReader {
return this._isStreamingSupported;
}
async read() {
- await this._headersCapability.promise;
- const {
- value,
- done
- } = await this._reader.read();
- if (done) {
+ await this._readCapability.promise;
+ if (this._done) {
return {
- value,
- done
+ value: undefined,
+ done: true
};
}
- this._loaded += value.byteLength;
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ const chunk = this._readableStream.read();
+ if (chunk === null) {
+ this._readCapability = new _util.PromiseCapability();
+ return this.read();
+ }
+ this._loaded += chunk.length;
this.onProgress?.({
loaded: this._loaded,
total: this._contentLength
});
+ const buffer = new Uint8Array(chunk).buffer;
return {
- value: getArrayBuffer(value),
+ value: buffer,
done: false
};
}
cancel(reason) {
- this._reader?.cancel(reason);
- this._abortController.abort();
- }
-}
-class PDFFetchStreamRangeReader {
- constructor(stream, begin, end) {
- this._stream = stream;
- this._reader = null;
- this._loaded = 0;
- const source = stream.source;
- this._withCredentials = source.withCredentials || false;
- this._readCapability = (0, _util.createPromiseCapability)();
- this._isStreamingSupported = !source.disableStream;
- this._abortController = new AbortController();
- this._headers = createHeaders(this._stream.httpHeaders);
- this._headers.append("Range", `bytes=${begin}-${end - 1}`);
- const url = source.url;
- fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
- if (!(0, _network_utils.validateResponseStatus)(response.status)) {
- throw (0, _network_utils.createResponseStatusError)(response.status, url);
+ if (!this._readableStream) {
+ this._error(reason);
+ return;
}
- this._readCapability.resolve();
- this._reader = response.body.getReader();
- }).catch(this._readCapability.reject);
- this.onProgress = null;
+ this._readableStream.destroy(reason);
+ }
+
+ _error(reason) {
+ this._storedError = reason;
+ this._readCapability.resolve();
+ }
+
+ _setReadableStream(readableStream) {
+ this._readableStream = readableStream;
+ readableStream.on("readable", () => {
+ this._readCapability.resolve();
+ });
+ readableStream.on("end", () => {
+ readableStream.destroy();
+ this._done = true;
+ this._readCapability.resolve();
+ });
+ readableStream.on("error", reason => {
+ this._error(reason);
+ });
+ if (!this._isStreamingSupported && this._isRangeSupported) {
+ this._error(new _util.AbortException("streaming is disabled"));
+ }
+ if (this._storedError) {
+ this._readableStream.destroy(this._storedError);
+ }
+ }
+ }
+
+ class BaseRangeReader {
+ constructor(stream) {
+ this._url = stream.url;
+ this._done = false;
+ this._storedError = null;
+ this.onProgress = null;
+ this._loaded = 0;
+ this._readableStream = null;
+ this._readCapability = new _util.PromiseCapability();
+ const source = stream.source;
+ this._isStreamingSupported = !source.disableStream;
}
get isStreamingSupported() {
return this._isStreamingSupported;
}
async read() {
await this._readCapability.promise;
- const {
- value,
- done
- } = await this._reader.read();
- if (done) {
+ if (this._done) {
return {
- value,
- done
+ value: undefined,
+ done: true
};
}
- this._loaded += value.byteLength;
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ const chunk = this._readableStream.read();
+ if (chunk === null) {
+ this._readCapability = new _util.PromiseCapability();
+ return this.read();
+ }
+ this._loaded += chunk.length;
this.onProgress?.({
loaded: this._loaded
});
+ const buffer = new Uint8Array(chunk).buffer;
return {
- value: getArrayBuffer(value),
+ value: buffer,
done: false
};
}
cancel(reason) {
- this._reader?.cancel(reason);
- this._abortController.abort();
+ if (!this._readableStream) {
+ this._error(reason);
+ return;
+ }
+ this._readableStream.destroy(reason);
}
-}
+
+ _error(reason) {
+ this._storedError = reason;
+ this._readCapability.resolve();
+ }
+
+ _setReadableStream(readableStream) {
+ this._readableStream = readableStream;
+ readableStream.on("readable", () => {
+ this._readCapability.resolve();
+ });
+ readableStream.on("end", () => {
+ readableStream.destroy();
+ this._done = true;
+ this._readCapability.resolve();
+ });
+ readableStream.on("error", reason => {
+ this._error(reason);
+ });
+ if (this._storedError) {
+ this._readableStream.destroy(this._storedError);
+ }
+ }
+ }
+
+ function createRequestOptions(parsedUrl, headers) {
+ return {
+ protocol: parsedUrl.protocol,
+ auth: parsedUrl.auth,
+ host: parsedUrl.hostname,
+ port: parsedUrl.port,
+ path: parsedUrl.path,
+ method: "GET",
+ headers
+ };
+ }
+
+ class PDFNodeStreamFullReader extends BaseFullReader {
+ constructor(stream) {
+ super(stream);
+ const handleResponse = response => {
+ if (response.statusCode === 404) {
+ const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
+ this._storedError = error;
+ this._headersCapability.reject(error);
+ return;
+ }
+ this._headersCapability.resolve();
+ this._setReadableStream(response);
+ const getResponseHeader = name => {
+ return this._readableStream.headers[name.toLowerCase()];
+ };
+ const {
+ allowRangeRequests,
+ suggestedLength
+ } = (0, _network_utils.validateRangeRequestCapabilities)({
+ getResponseHeader,
+ isHttp: stream.isHttp,
+ rangeChunkSize: this._rangeChunkSize,
+ disableRange: this._disableRange
+ });
+ this._isRangeSupported = allowRangeRequests;
+ this._contentLength = suggestedLength || this._contentLength;
+ this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
+ };
+ this._request = null;
+ if (this._url.protocol === "http:") {
+ const http = require("http");
+ this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
+ } else {
+ const https = require("https");
+ this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
+ }
+ this._request.on("error", reason => {
+ this._storedError = reason;
+ this._headersCapability.reject(reason);
+ });
+ this._request.end();
+ }
+ }
+
+ class PDFNodeStreamRangeReader extends BaseRangeReader {
+ constructor(stream, start, end) {
+ super(stream);
+ this._httpHeaders = {};
+ for (const property in stream.httpHeaders) {
+ const value = stream.httpHeaders[property];
+ if (value === undefined) {
+ continue;
+ }
+ this._httpHeaders[property] = value;
+ }
+ this._httpHeaders.Range = `bytes=${start}-${end - 1}`;
+ const handleResponse = response => {
+ if (response.statusCode === 404) {
+ const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
+ this._storedError = error;
+ return;
+ }
+ this._setReadableStream(response);
+ };
+ this._request = null;
+ if (this._url.protocol === "http:") {
+ const http = require("http");
+ this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
+ } else {
+ const https = require("https");
+ this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
+ }
+ this._request.on("error", reason => {
+ this._storedError = reason;
+ });
+ this._request.end();
+ }
+ }
+
+ class PDFNodeStreamFsFullReader extends BaseFullReader {
+ constructor(stream) {
+ super(stream);
+ let path = decodeURIComponent(this._url.path);
+ if (fileUriRegex.test(this._url.href)) {
+ path = path.replace(/^\//, "");
+ }
+ const fs = require("fs");
+ fs.lstat(path, (error, stat) => {
+ if (error) {
+ if (error.code === "ENOENT") {
+ error = new _util.MissingPDFException(`Missing PDF "${path}".`);
+ }
+ this._storedError = error;
+ this._headersCapability.reject(error);
+ return;
+ }
+ this._contentLength = stat.size;
+ this._setReadableStream(fs.createReadStream(path));
+ this._headersCapability.resolve();
+ });
+ }
+ }
+
+ class PDFNodeStreamFsRangeReader extends BaseRangeReader {
+ constructor(stream, start, end) {
+ super(stream);
+ let path = decodeURIComponent(this._url.path);
+ if (fileUriRegex.test(this._url.href)) {
+ path = path.replace(/^\//, "");
+ }
+ const fs = require("fs");
+ this._setReadableStream(fs.createReadStream(path, {
+ start,
+ end: end - 1
+ }));
+ }
+ }
+
+ /***/
+ }),
+ /* 24 */
+ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.SVGGraphics = void 0;
+ var _display_utils = __w_pdfjs_require__(6);
+ var _util = __w_pdfjs_require__(1);
+ ;
+ const SVG_DEFAULTS = {
+ fontStyle: "normal",
+ fontWeight: "normal",
+ fillColor: "#000000"
+ };
+ const XML_NS = "http://www.w3.org/XML/1998/namespace";
+ const XLINK_NS = "http://www.w3.org/1999/xlink";
+ const LINE_CAP_STYLES = ["butt", "round", "square"];
+ const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
+ const createObjectURL = function (data, contentType = "", forceDataSchema = false) {
+ if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
+ return URL.createObjectURL(new Blob([data], {
+ type: contentType
+ }));
+ }
+ const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ let buffer = `data:${contentType};base64,`;
+ for (let i = 0, ii = data.length; i < ii; i += 3) {
+ const b1 = data[i] & 0xff;
+ const b2 = data[i + 1] & 0xff;
+ const b3 = data[i + 2] & 0xff;
+ const d1 = b1 >> 2,
+ d2 = (b1 & 3) << 4 | b2 >> 4;
+ const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
+ const d4 = i + 2 < ii ? b3 & 0x3f : 64;
+ buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
+ }
+ return buffer;
+ };
+ const convertImgDataToPng = function () {
+ const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
+ const CHUNK_WRAPPER_SIZE = 12;
+ const crcTable = new Int32Array(256);
+ for (let i = 0; i < 256; i++) {
+ let c = i;
+ for (let h = 0; h < 8; h++) {
+ c = c & 1 ? 0xedb88320 ^ c >> 1 & 0x7fffffff : c >> 1 & 0x7fffffff;
+ }
+ crcTable[i] = c;
+ }
+
+ function crc32(data, start, end) {
+ let crc = -1;
+ for (let i = start; i < end; i++) {
+ const a = (crc ^ data[i]) & 0xff;
+ const b = crcTable[a];
+ crc = crc >>> 8 ^ b;
+ }
+ return crc ^ -1;
+ }
+
+ function writePngChunk(type, body, data, offset) {
+ let p = offset;
+ const len = body.length;
+ data[p] = len >> 24 & 0xff;
+ data[p + 1] = len >> 16 & 0xff;
+ data[p + 2] = len >> 8 & 0xff;
+ data[p + 3] = len & 0xff;
+ p += 4;
+ data[p] = type.charCodeAt(0) & 0xff;
+ data[p + 1] = type.charCodeAt(1) & 0xff;
+ data[p + 2] = type.charCodeAt(2) & 0xff;
+ data[p + 3] = type.charCodeAt(3) & 0xff;
+ p += 4;
+ data.set(body, p);
+ p += body.length;
+ const crc = crc32(data, offset + 4, p);
+ data[p] = crc >> 24 & 0xff;
+ data[p + 1] = crc >> 16 & 0xff;
+ data[p + 2] = crc >> 8 & 0xff;
+ data[p + 3] = crc & 0xff;
+ }
+
+ function adler32(data, start, end) {
+ let a = 1;
+ let b = 0;
+ for (let i = start; i < end; ++i) {
+ a = (a + (data[i] & 0xff)) % 65521;
+ b = (b + a) % 65521;
+ }
+ return b << 16 | a;
+ }
+
+ function deflateSync(literals) {
+ if (!_util.isNodeJS) {
+ return deflateSyncUncompressed(literals);
+ }
+ try {
+ const input = parseInt(process.versions.node) >= 8 ? literals : Buffer.from(literals);
+ const output = require("zlib").deflateSync(input, {
+ level: 9
+ });
+ return output instanceof Uint8Array ? output : new Uint8Array(output);
+ } catch (e) {
+ (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e);
+ }
+ return deflateSyncUncompressed(literals);
+ }
+
+ function deflateSyncUncompressed(literals) {
+ let len = literals.length;
+ const maxBlockLength = 0xffff;
+ const deflateBlocks = Math.ceil(len / maxBlockLength);
+ const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
+ let pi = 0;
+ idat[pi++] = 0x78;
+ idat[pi++] = 0x9c;
+ let pos = 0;
+ while (len > maxBlockLength) {
+ idat[pi++] = 0x00;
+ idat[pi++] = 0xff;
+ idat[pi++] = 0xff;
+ idat[pi++] = 0x00;
+ idat[pi++] = 0x00;
+ idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
+ pi += maxBlockLength;
+ pos += maxBlockLength;
+ len -= maxBlockLength;
+ }
+ idat[pi++] = 0x01;
+ idat[pi++] = len & 0xff;
+ idat[pi++] = len >> 8 & 0xff;
+ idat[pi++] = ~len & 0xffff & 0xff;
+ idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
+ idat.set(literals.subarray(pos), pi);
+ pi += literals.length - pos;
+ const adler = adler32(literals, 0, literals.length);
+ idat[pi++] = adler >> 24 & 0xff;
+ idat[pi++] = adler >> 16 & 0xff;
+ idat[pi++] = adler >> 8 & 0xff;
+ idat[pi++] = adler & 0xff;
+ return idat;
+ }
+
+ function encode(imgData, kind, forceDataSchema, isMask) {
+ const width = imgData.width;
+ const height = imgData.height;
+ let bitDepth, colorType, lineSize;
+ const bytes = imgData.data;
+ switch (kind) {
+ case _util.ImageKind.GRAYSCALE_1BPP:
+ colorType = 0;
+ bitDepth = 1;
+ lineSize = width + 7 >> 3;
+ break;
+ case _util.ImageKind.RGB_24BPP:
+ colorType = 2;
+ bitDepth = 8;
+ lineSize = width * 3;
+ break;
+ case _util.ImageKind.RGBA_32BPP:
+ colorType = 6;
+ bitDepth = 8;
+ lineSize = width * 4;
+ break;
+ default:
+ throw new Error("invalid format");
+ }
+ const literals = new Uint8Array((1 + lineSize) * height);
+ let offsetLiterals = 0,
+ offsetBytes = 0;
+ for (let y = 0; y < height; ++y) {
+ literals[offsetLiterals++] = 0;
+ literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
+ offsetBytes += lineSize;
+ offsetLiterals += lineSize;
+ }
+ if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
+ offsetLiterals = 0;
+ for (let y = 0; y < height; y++) {
+ offsetLiterals++;
+ for (let i = 0; i < lineSize; i++) {
+ literals[offsetLiterals++] ^= 0xff;
+ }
+ }
+ }
+ const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);
+ const idat = deflateSync(literals);
+ const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
+ const data = new Uint8Array(pngLength);
+ let offset = 0;
+ data.set(PNG_HEADER, offset);
+ offset += PNG_HEADER.length;
+ writePngChunk("IHDR", ihdr, data, offset);
+ offset += CHUNK_WRAPPER_SIZE + ihdr.length;
+ writePngChunk("IDATA", idat, data, offset);
+ offset += CHUNK_WRAPPER_SIZE + idat.length;
+ writePngChunk("IEND", new Uint8Array(0), data, offset);
+ return createObjectURL(data, "image/png", forceDataSchema);
+ }
+
+ return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
+ const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
+ return encode(imgData, kind, forceDataSchema, isMask);
+ };
+ }();
+
+ class SVGExtraState {
+ constructor() {
+ this.fontSizeScale = 1;
+ this.fontWeight = SVG_DEFAULTS.fontWeight;
+ this.fontSize = 0;
+ this.textMatrix = _util.IDENTITY_MATRIX;
+ this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
+ this.leading = 0;
+ this.textRenderingMode = _util.TextRenderingMode.FILL;
+ this.textMatrixScale = 1;
+ this.x = 0;
+ this.y = 0;
+ this.lineX = 0;
+ this.lineY = 0;
+ this.charSpacing = 0;
+ this.wordSpacing = 0;
+ this.textHScale = 1;
+ this.textRise = 0;
+ this.fillColor = SVG_DEFAULTS.fillColor;
+ this.strokeColor = "#000000";
+ this.fillAlpha = 1;
+ this.strokeAlpha = 1;
+ this.lineWidth = 1;
+ this.lineJoin = "";
+ this.lineCap = "";
+ this.miterLimit = 0;
+ this.dashArray = [];
+ this.dashPhase = 0;
+ this.dependencies = [];
+ this.activeClipUrl = null;
+ this.clipGroup = null;
+ this.maskId = "";
+ }
+
+ clone() {
+ return Object.create(this);
+ }
+
+ setCurrentPoint(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+ }
+
+ function opListToTree(opList) {
+ let opTree = [];
+ const tmp = [];
+ for (const opListElement of opList) {
+ if (opListElement.fn === "save") {
+ opTree.push({
+ fnId: 92,
+ fn: "group",
+ items: []
+ });
+ tmp.push(opTree);
+ opTree = opTree.at(-1).items;
+ continue;
+ }
+ if (opListElement.fn === "restore") {
+ opTree = tmp.pop();
+ } else {
+ opTree.push(opListElement);
+ }
+ }
+ return opTree;
+ }
+
+ function pf(value) {
+ if (Number.isInteger(value)) {
+ return value.toString();
+ }
+ const s = value.toFixed(10);
+ let i = s.length - 1;
+ if (s[i] !== "0") {
+ return s;
+ }
+ do {
+ i--;
+ } while (s[i] === "0");
+ return s.substring(0, s[i] === "." ? i : i + 1);
+ }
+
+ function pm(m) {
+ if (m[4] === 0 && m[5] === 0) {
+ if (m[1] === 0 && m[2] === 0) {
+ if (m[0] === 1 && m[3] === 1) {
+ return "";
+ }
+ return `scale(${pf(m[0])} ${pf(m[3])})`;
+ }
+ if (m[0] === m[3] && m[1] === -m[2]) {
+ const a = Math.acos(m[0]) * 180 / Math.PI;
+ return `rotate(${pf(a)})`;
+ }
+ } else if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {
+ return `translate(${pf(m[4])} ${pf(m[5])})`;
+ }
+ return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`;
+ }
+
+ let clipCount = 0;
+ let maskCount = 0;
+ let shadingCount = 0;
+
+ class SVGGraphics {
+ constructor(commonObjs, objs, forceDataSchema = false) {
+ (0, _display_utils.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");
+ this.svgFactory = new _display_utils.DOMSVGFactory();
+ this.current = new SVGExtraState();
+ this.transformMatrix = _util.IDENTITY_MATRIX;
+ this.transformStack = [];
+ this.extraStack = [];
+ this.commonObjs = commonObjs;
+ this.objs = objs;
+ this.pendingClip = null;
+ this.pendingEOFill = false;
+ this.embedFonts = false;
+ this.embeddedFonts = Object.create(null);
+ this.cssStyle = null;
+ this.forceDataSchema = !!forceDataSchema;
+ this._operatorIdMapping = [];
+ for (const op in _util.OPS) {
+ this._operatorIdMapping[_util.OPS[op]] = op;
+ }
+ }
+
+ getObject(data, fallback = null) {
+ if (typeof data === "string") {
+ return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
+ }
+ return fallback;
+ }
+
+ save() {
+ this.transformStack.push(this.transformMatrix);
+ const old = this.current;
+ this.extraStack.push(old);
+ this.current = old.clone();
+ }
+
+ restore() {
+ this.transformMatrix = this.transformStack.pop();
+ this.current = this.extraStack.pop();
+ this.pendingClip = null;
+ this.tgrp = null;
+ }
+
+ group(items) {
+ this.save();
+ this.executeOpTree(items);
+ this.restore();
+ }
+
+ loadDependencies(operatorList) {
+ const fnArray = operatorList.fnArray;
+ const argsArray = operatorList.argsArray;
+ for (let i = 0, ii = fnArray.length; i < ii; i++) {
+ if (fnArray[i] !== _util.OPS.dependency) {
+ continue;
+ }
+ for (const obj of argsArray[i]) {
+ const objsPool = obj.startsWith("g_") ? this.commonObjs : this.objs;
+ const promise = new Promise(resolve => {
+ objsPool.get(obj, resolve);
+ });
+ this.current.dependencies.push(promise);
+ }
+ }
+ return Promise.all(this.current.dependencies);
+ }
+
+ transform(a, b, c, d, e, f) {
+ const transformMatrix = [a, b, c, d, e, f];
+ this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
+ this.tgrp = null;
+ }
+
+ getSVG(operatorList, viewport) {
+ this.viewport = viewport;
+ const svgElement = this._initialize(viewport);
+ return this.loadDependencies(operatorList).then(() => {
+ this.transformMatrix = _util.IDENTITY_MATRIX;
+ this.executeOpTree(this.convertOpList(operatorList));
+ return svgElement;
+ });
+ }
+
+ convertOpList(operatorList) {
+ const operatorIdMapping = this._operatorIdMapping;
+ const argsArray = operatorList.argsArray;
+ const fnArray = operatorList.fnArray;
+ const opList = [];
+ for (let i = 0, ii = fnArray.length; i < ii; i++) {
+ const fnId = fnArray[i];
+ opList.push({
+ fnId,
+ fn: operatorIdMapping[fnId],
+ args: argsArray[i]
+ });
+ }
+ return opListToTree(opList);
+ }
+
+ executeOpTree(opTree) {
+ for (const opTreeElement of opTree) {
+ const fn = opTreeElement.fn;
+ const fnId = opTreeElement.fnId;
+ const args = opTreeElement.args;
+ switch (fnId | 0) {
+ case _util.OPS.beginText:
+ this.beginText();
+ break;
+ case _util.OPS.dependency:
+ break;
+ case _util.OPS.setLeading:
+ this.setLeading(args);
+ break;
+ case _util.OPS.setLeadingMoveText:
+ this.setLeadingMoveText(args[0], args[1]);
+ break;
+ case _util.OPS.setFont:
+ this.setFont(args);
+ break;
+ case _util.OPS.showText:
+ this.showText(args[0]);
+ break;
+ case _util.OPS.showSpacedText:
+ this.showText(args[0]);
+ break;
+ case _util.OPS.endText:
+ this.endText();
+ break;
+ case _util.OPS.moveText:
+ this.moveText(args[0], args[1]);
+ break;
+ case _util.OPS.setCharSpacing:
+ this.setCharSpacing(args[0]);
+ break;
+ case _util.OPS.setWordSpacing:
+ this.setWordSpacing(args[0]);
+ break;
+ case _util.OPS.setHScale:
+ this.setHScale(args[0]);
+ break;
+ case _util.OPS.setTextMatrix:
+ this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
+ break;
+ case _util.OPS.setTextRise:
+ this.setTextRise(args[0]);
+ break;
+ case _util.OPS.setTextRenderingMode:
+ this.setTextRenderingMode(args[0]);
+ break;
+ case _util.OPS.setLineWidth:
+ this.setLineWidth(args[0]);
+ break;
+ case _util.OPS.setLineJoin:
+ this.setLineJoin(args[0]);
+ break;
+ case _util.OPS.setLineCap:
+ this.setLineCap(args[0]);
+ break;
+ case _util.OPS.setMiterLimit:
+ this.setMiterLimit(args[0]);
+ break;
+ case _util.OPS.setFillRGBColor:
+ this.setFillRGBColor(args[0], args[1], args[2]);
+ break;
+ case _util.OPS.setStrokeRGBColor:
+ this.setStrokeRGBColor(args[0], args[1], args[2]);
+ break;
+ case _util.OPS.setStrokeColorN:
+ this.setStrokeColorN(args);
+ break;
+ case _util.OPS.setFillColorN:
+ this.setFillColorN(args);
+ break;
+ case _util.OPS.shadingFill:
+ this.shadingFill(args[0]);
+ break;
+ case _util.OPS.setDash:
+ this.setDash(args[0], args[1]);
+ break;
+ case _util.OPS.setRenderingIntent:
+ this.setRenderingIntent(args[0]);
+ break;
+ case _util.OPS.setFlatness:
+ this.setFlatness(args[0]);
+ break;
+ case _util.OPS.setGState:
+ this.setGState(args[0]);
+ break;
+ case _util.OPS.fill:
+ this.fill();
+ break;
+ case _util.OPS.eoFill:
+ this.eoFill();
+ break;
+ case _util.OPS.stroke:
+ this.stroke();
+ break;
+ case _util.OPS.fillStroke:
+ this.fillStroke();
+ break;
+ case _util.OPS.eoFillStroke:
+ this.eoFillStroke();
+ break;
+ case _util.OPS.clip:
+ this.clip("nonzero");
+ break;
+ case _util.OPS.eoClip:
+ this.clip("evenodd");
+ break;
+ case _util.OPS.paintSolidColorImageMask:
+ this.paintSolidColorImageMask();
+ break;
+ case _util.OPS.paintImageXObject:
+ this.paintImageXObject(args[0]);
+ break;
+ case _util.OPS.paintInlineImageXObject:
+ this.paintInlineImageXObject(args[0]);
+ break;
+ case _util.OPS.paintImageMaskXObject:
+ this.paintImageMaskXObject(args[0]);
+ break;
+ case _util.OPS.paintFormXObjectBegin:
+ this.paintFormXObjectBegin(args[0], args[1]);
+ break;
+ case _util.OPS.paintFormXObjectEnd:
+ this.paintFormXObjectEnd();
+ break;
+ case _util.OPS.closePath:
+ this.closePath();
+ break;
+ case _util.OPS.closeStroke:
+ this.closeStroke();
+ break;
+ case _util.OPS.closeFillStroke:
+ this.closeFillStroke();
+ break;
+ case _util.OPS.closeEOFillStroke:
+ this.closeEOFillStroke();
+ break;
+ case _util.OPS.nextLine:
+ this.nextLine();
+ break;
+ case _util.OPS.transform:
+ this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
+ break;
+ case _util.OPS.constructPath:
+ this.constructPath(args[0], args[1]);
+ break;
+ case _util.OPS.endPath:
+ this.endPath();
+ break;
+ case 92:
+ this.group(opTreeElement.items);
+ break;
+ default:
+ (0, _util.warn)(`Unimplemented operator ${fn}`);
+ break;
+ }
+ }
+ }
+
+ setWordSpacing(wordSpacing) {
+ this.current.wordSpacing = wordSpacing;
+ }
+
+ setCharSpacing(charSpacing) {
+ this.current.charSpacing = charSpacing;
+ }
+
+ nextLine() {
+ this.moveText(0, this.current.leading);
+ }
+
+ setTextMatrix(a, b, c, d, e, f) {
+ const current = this.current;
+ current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];
+ current.textMatrixScale = Math.hypot(a, b);
+ current.x = current.lineX = 0;
+ current.y = current.lineY = 0;
+ current.xcoords = [];
+ current.ycoords = [];
+ current.tspan = this.svgFactory.createElement("svg:tspan");
+ current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
+ current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
+ current.tspan.setAttributeNS(null, "y", pf(-current.y));
+ current.txtElement = this.svgFactory.createElement("svg:text");
+ current.txtElement.append(current.tspan);
+ }
+
+ beginText() {
+ const current = this.current;
+ current.x = current.lineX = 0;
+ current.y = current.lineY = 0;
+ current.textMatrix = _util.IDENTITY_MATRIX;
+ current.lineMatrix = _util.IDENTITY_MATRIX;
+ current.textMatrixScale = 1;
+ current.tspan = this.svgFactory.createElement("svg:tspan");
+ current.txtElement = this.svgFactory.createElement("svg:text");
+ current.txtgrp = this.svgFactory.createElement("svg:g");
+ current.xcoords = [];
+ current.ycoords = [];
+ }
+
+ moveText(x, y) {
+ const current = this.current;
+ current.x = current.lineX += x;
+ current.y = current.lineY += y;
+ current.xcoords = [];
+ current.ycoords = [];
+ current.tspan = this.svgFactory.createElement("svg:tspan");
+ current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
+ current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
+ current.tspan.setAttributeNS(null, "y", pf(-current.y));
+ }
+
+ showText(glyphs) {
+ const current = this.current;
+ const font = current.font;
+ const fontSize = current.fontSize;
+ if (fontSize === 0) {
+ return;
+ }
+ const fontSizeScale = current.fontSizeScale;
+ const charSpacing = current.charSpacing;
+ const wordSpacing = current.wordSpacing;
+ const fontDirection = current.fontDirection;
+ const textHScale = current.textHScale * fontDirection;
+ const vertical = font.vertical;
+ const spacingDir = vertical ? 1 : -1;
+ const defaultVMetrics = font.defaultVMetrics;
+ const widthAdvanceScale = fontSize * current.fontMatrix[0];
+ let x = 0;
+ for (const glyph of glyphs) {
+ if (glyph === null) {
+ x += fontDirection * wordSpacing;
+ continue;
+ } else if (typeof glyph === "number") {
+ x += spacingDir * glyph * fontSize / 1000;
+ continue;
+ }
+ const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
+ const character = glyph.fontChar;
+ let scaledX, scaledY;
+ let width = glyph.width;
+ if (vertical) {
+ let vx;
+ const vmetric = glyph.vmetric || defaultVMetrics;
+ vx = glyph.vmetric ? vmetric[1] : width * 0.5;
+ vx = -vx * widthAdvanceScale;
+ const vy = vmetric[2] * widthAdvanceScale;
+ width = vmetric ? -vmetric[0] : width;
+ scaledX = vx / fontSizeScale;
+ scaledY = (x + vy) / fontSizeScale;
+ } else {
+ scaledX = x / fontSizeScale;
+ scaledY = 0;
+ }
+ if (glyph.isInFont || font.missingFile) {
+ current.xcoords.push(current.x + scaledX);
+ if (vertical) {
+ current.ycoords.push(-current.y + scaledY);
+ }
+ current.tspan.textContent += character;
+ } else {
+ }
+ const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
+ x += charWidth;
+ }
+ current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
+ if (vertical) {
+ current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
+ } else {
+ current.tspan.setAttributeNS(null, "y", pf(-current.y));
+ }
+ if (vertical) {
+ current.y -= x;
+ } else {
+ current.x += x * textHScale;
+ }
+ current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
+ current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
+ if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
+ current.tspan.setAttributeNS(null, "font-style", current.fontStyle);
+ }
+ if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
+ current.tspan.setAttributeNS(null, "font-weight", current.fontWeight);
+ }
+ const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
+ if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
+ if (current.fillColor !== SVG_DEFAULTS.fillColor) {
+ current.tspan.setAttributeNS(null, "fill", current.fillColor);
+ }
+ if (current.fillAlpha < 1) {
+ current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha);
+ }
+ } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
+ current.tspan.setAttributeNS(null, "fill", "transparent");
+ } else {
+ current.tspan.setAttributeNS(null, "fill", "none");
+ }
+ if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
+ const lineWidthScale = 1 / (current.textMatrixScale || 1);
+ this._setStrokeAttributes(current.tspan, lineWidthScale);
+ }
+ let textMatrix = current.textMatrix;
+ if (current.textRise !== 0) {
+ textMatrix = textMatrix.slice();
+ textMatrix[5] += current.textRise;
+ }
+ current.txtElement.setAttributeNS(null, "transform", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`);
+ current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
+ current.txtElement.append(current.tspan);
+ current.txtgrp.append(current.txtElement);
+ this._ensureTransformGroup().append(current.txtElement);
+ }
+
+ setLeadingMoveText(x, y) {
+ this.setLeading(-y);
+ this.moveText(x, y);
+ }
+
+ addFontStyle(fontObj) {
+ if (!fontObj.data) {
+ throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
+ }
+ if (!this.cssStyle) {
+ this.cssStyle = this.svgFactory.createElement("svg:style");
+ this.cssStyle.setAttributeNS(null, "type", "text/css");
+ this.defs.append(this.cssStyle);
+ }
+ const url = createObjectURL(fontObj.data, fontObj.mimetype, this.forceDataSchema);
+ this.cssStyle.textContent += `@font-face { font-family: "${fontObj.loadedName}";` + ` src: url(${url}); }\n`;
+ }
+
+ setFont(details) {
+ const current = this.current;
+ const fontObj = this.commonObjs.get(details[0]);
+ let size = details[1];
+ current.font = fontObj;
+ if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
+ this.addFontStyle(fontObj);
+ this.embeddedFonts[fontObj.loadedName] = fontObj;
+ }
+ current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
+ let bold = "normal";
+ if (fontObj.black) {
+ bold = "900";
+ } else if (fontObj.bold) {
+ bold = "bold";
+ }
+ const italic = fontObj.italic ? "italic" : "normal";
+ if (size < 0) {
+ size = -size;
+ current.fontDirection = -1;
+ } else {
+ current.fontDirection = 1;
+ }
+ current.fontSize = size;
+ current.fontFamily = fontObj.loadedName;
+ current.fontWeight = bold;
+ current.fontStyle = italic;
+ current.tspan = this.svgFactory.createElement("svg:tspan");
+ current.tspan.setAttributeNS(null, "y", pf(-current.y));
+ current.xcoords = [];
+ current.ycoords = [];
+ }
+
+ endText() {
+ const current = this.current;
+ if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement?.hasChildNodes()) {
+ current.element = current.txtElement;
+ this.clip("nonzero");
+ this.endPath();
+ }
+ }
+
+ setLineWidth(width) {
+ if (width > 0) {
+ this.current.lineWidth = width;
+ }
+ }
+
+ setLineCap(style) {
+ this.current.lineCap = LINE_CAP_STYLES[style];
+ }
+
+ setLineJoin(style) {
+ this.current.lineJoin = LINE_JOIN_STYLES[style];
+ }
+
+ setMiterLimit(limit) {
+ this.current.miterLimit = limit;
+ }
+
+ setStrokeAlpha(strokeAlpha) {
+ this.current.strokeAlpha = strokeAlpha;
+ }
+
+ setStrokeRGBColor(r, g, b) {
+ this.current.strokeColor = _util.Util.makeHexColor(r, g, b);
+ }
+
+ setFillAlpha(fillAlpha) {
+ this.current.fillAlpha = fillAlpha;
+ }
+
+ setFillRGBColor(r, g, b) {
+ this.current.fillColor = _util.Util.makeHexColor(r, g, b);
+ this.current.tspan = this.svgFactory.createElement("svg:tspan");
+ this.current.xcoords = [];
+ this.current.ycoords = [];
+ }
+
+ setStrokeColorN(args) {
+ this.current.strokeColor = this._makeColorN_Pattern(args);
+ }
+
+ setFillColorN(args) {
+ this.current.fillColor = this._makeColorN_Pattern(args);
+ }
+
+ shadingFill(args) {
+ const {
+ width,
+ height
+ } = this.viewport;
+ const inv = _util.Util.inverseTransform(this.transformMatrix);
+ const [x0, y0, x1, y1] = _util.Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
+ const rect = this.svgFactory.createElement("svg:rect");
+ rect.setAttributeNS(null, "x", x0);
+ rect.setAttributeNS(null, "y", y0);
+ rect.setAttributeNS(null, "width", x1 - x0);
+ rect.setAttributeNS(null, "height", y1 - y0);
+ rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
+ if (this.current.fillAlpha < 1) {
+ rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
+ }
+ this._ensureTransformGroup().append(rect);
+ }
+
+ _makeColorN_Pattern(args) {
+ if (args[0] === "TilingPattern") {
+ return this._makeTilingPattern(args);
+ }
+ return this._makeShadingPattern(args);
+ }
+
+ _makeTilingPattern(args) {
+ const color = args[1];
+ const operatorList = args[2];
+ const matrix = args[3] || _util.IDENTITY_MATRIX;
+ const [x0, y0, x1, y1] = args[4];
+ const xstep = args[5];
+ const ystep = args[6];
+ const paintType = args[7];
+ const tilingId = `shading${shadingCount++}`;
+ const [tx0, ty0, tx1, ty1] = _util.Util.normalizeRect([..._util.Util.applyTransform([x0, y0], matrix), ..._util.Util.applyTransform([x1, y1], matrix)]);
+ const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix);
+ const txstep = xstep * xscale;
+ const tystep = ystep * yscale;
+ const tiling = this.svgFactory.createElement("svg:pattern");
+ tiling.setAttributeNS(null, "id", tilingId);
+ tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
+ tiling.setAttributeNS(null, "width", txstep);
+ tiling.setAttributeNS(null, "height", tystep);
+ tiling.setAttributeNS(null, "x", `${tx0}`);
+ tiling.setAttributeNS(null, "y", `${ty0}`);
+ const svg = this.svg;
+ const transformMatrix = this.transformMatrix;
+ const fillColor = this.current.fillColor;
+ const strokeColor = this.current.strokeColor;
+ const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);
+ this.svg = bbox;
+ this.transformMatrix = matrix;
+ if (paintType === 2) {
+ const cssColor = _util.Util.makeHexColor(...color);
+ this.current.fillColor = cssColor;
+ this.current.strokeColor = cssColor;
+ }
+ this.executeOpTree(this.convertOpList(operatorList));
+ this.svg = svg;
+ this.transformMatrix = transformMatrix;
+ this.current.fillColor = fillColor;
+ this.current.strokeColor = strokeColor;
+ tiling.append(bbox.childNodes[0]);
+ this.defs.append(tiling);
+ return `url(#${tilingId})`;
+ }
+
+ _makeShadingPattern(args) {
+ if (typeof args === "string") {
+ args = this.objs.get(args);
+ }
+ switch (args[0]) {
+ case "RadialAxial":
+ const shadingId = `shading${shadingCount++}`;
+ const colorStops = args[3];
+ let gradient;
+ switch (args[1]) {
+ case "axial":
+ const point0 = args[4];
+ const point1 = args[5];
+ gradient = this.svgFactory.createElement("svg:linearGradient");
+ gradient.setAttributeNS(null, "id", shadingId);
+ gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
+ gradient.setAttributeNS(null, "x1", point0[0]);
+ gradient.setAttributeNS(null, "y1", point0[1]);
+ gradient.setAttributeNS(null, "x2", point1[0]);
+ gradient.setAttributeNS(null, "y2", point1[1]);
+ break;
+ case "radial":
+ const focalPoint = args[4];
+ const circlePoint = args[5];
+ const focalRadius = args[6];
+ const circleRadius = args[7];
+ gradient = this.svgFactory.createElement("svg:radialGradient");
+ gradient.setAttributeNS(null, "id", shadingId);
+ gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
+ gradient.setAttributeNS(null, "cx", circlePoint[0]);
+ gradient.setAttributeNS(null, "cy", circlePoint[1]);
+ gradient.setAttributeNS(null, "r", circleRadius);
+ gradient.setAttributeNS(null, "fx", focalPoint[0]);
+ gradient.setAttributeNS(null, "fy", focalPoint[1]);
+ gradient.setAttributeNS(null, "fr", focalRadius);
+ break;
+ default:
+ throw new Error(`Unknown RadialAxial type: ${args[1]}`);
+ }
+ for (const colorStop of colorStops) {
+ const stop = this.svgFactory.createElement("svg:stop");
+ stop.setAttributeNS(null, "offset", colorStop[0]);
+ stop.setAttributeNS(null, "stop-color", colorStop[1]);
+ gradient.append(stop);
+ }
+ this.defs.append(gradient);
+ return `url(#${shadingId})`;
+ case "Mesh":
+ (0, _util.warn)("Unimplemented pattern Mesh");
+ return null;
+ case "Dummy":
+ return "hotpink";
+ default:
+ throw new Error(`Unknown IR type: ${args[0]}`);
+ }
+ }
+
+ setDash(dashArray, dashPhase) {
+ this.current.dashArray = dashArray;
+ this.current.dashPhase = dashPhase;
+ }
+
+ constructPath(ops, args) {
+ const current = this.current;
+ let x = current.x,
+ y = current.y;
+ let d = [];
+ let j = 0;
+ for (const op of ops) {
+ switch (op | 0) {
+ case _util.OPS.rectangle:
+ x = args[j++];
+ y = args[j++];
+ const width = args[j++];
+ const height = args[j++];
+ const xw = x + width;
+ const yh = y + height;
+ d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z");
+ break;
+ case _util.OPS.moveTo:
+ x = args[j++];
+ y = args[j++];
+ d.push("M", pf(x), pf(y));
+ break;
+ case _util.OPS.lineTo:
+ x = args[j++];
+ y = args[j++];
+ d.push("L", pf(x), pf(y));
+ break;
+ case _util.OPS.curveTo:
+ x = args[j + 4];
+ y = args[j + 5];
+ d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));
+ j += 6;
+ break;
+ case _util.OPS.curveTo2:
+ d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));
+ x = args[j + 2];
+ y = args[j + 3];
+ j += 4;
+ break;
+ case _util.OPS.curveTo3:
+ x = args[j + 2];
+ y = args[j + 3];
+ d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));
+ j += 4;
+ break;
+ case _util.OPS.closePath:
+ d.push("Z");
+ break;
+ }
+ }
+ d = d.join(" ");
+ if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {
+ d = current.path.getAttributeNS(null, "d") + d;
+ } else {
+ current.path = this.svgFactory.createElement("svg:path");
+ this._ensureTransformGroup().append(current.path);
+ }
+ current.path.setAttributeNS(null, "d", d);
+ current.path.setAttributeNS(null, "fill", "none");
+ current.element = current.path;
+ current.setCurrentPoint(x, y);
+ }
+
+ endPath() {
+ const current = this.current;
+ current.path = null;
+ if (!this.pendingClip) {
+ return;
+ }
+ if (!current.element) {
+ this.pendingClip = null;
+ return;
+ }
+ const clipId = `clippath${clipCount++}`;
+ const clipPath = this.svgFactory.createElement("svg:clipPath");
+ clipPath.setAttributeNS(null, "id", clipId);
+ clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix));
+ const clipElement = current.element.cloneNode(true);
+ if (this.pendingClip === "evenodd") {
+ clipElement.setAttributeNS(null, "clip-rule", "evenodd");
+ } else {
+ clipElement.setAttributeNS(null, "clip-rule", "nonzero");
+ }
+ this.pendingClip = null;
+ clipPath.append(clipElement);
+ this.defs.append(clipPath);
+ if (current.activeClipUrl) {
+ current.clipGroup = null;
+ for (const prev of this.extraStack) {
+ prev.clipGroup = null;
+ }
+ clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl);
+ }
+ current.activeClipUrl = `url(#${clipId})`;
+ this.tgrp = null;
+ }
+
+ clip(type) {
+ this.pendingClip = type;
+ }
+
+ closePath() {
+ const current = this.current;
+ if (current.path) {
+ const d = `${current.path.getAttributeNS(null, "d")}Z`;
+ current.path.setAttributeNS(null, "d", d);
+ }
+ }
+
+ setLeading(leading) {
+ this.current.leading = -leading;
+ }
+
+ setTextRise(textRise) {
+ this.current.textRise = textRise;
+ }
+
+ setTextRenderingMode(textRenderingMode) {
+ this.current.textRenderingMode = textRenderingMode;
+ }
+
+ setHScale(scale) {
+ this.current.textHScale = scale / 100;
+ }
+
+ setRenderingIntent(intent) {
+ }
+
+ setFlatness(flatness) {
+ }
+
+ setGState(states) {
+ for (const [key, value] of states) {
+ switch (key) {
+ case "LW":
+ this.setLineWidth(value);
+ break;
+ case "LC":
+ this.setLineCap(value);
+ break;
+ case "LJ":
+ this.setLineJoin(value);
+ break;
+ case "ML":
+ this.setMiterLimit(value);
+ break;
+ case "D":
+ this.setDash(value[0], value[1]);
+ break;
+ case "RI":
+ this.setRenderingIntent(value);
+ break;
+ case "FL":
+ this.setFlatness(value);
+ break;
+ case "Font":
+ this.setFont(value);
+ break;
+ case "CA":
+ this.setStrokeAlpha(value);
+ break;
+ case "ca":
+ this.setFillAlpha(value);
+ break;
+ default:
+ (0, _util.warn)(`Unimplemented graphic state operator ${key}`);
+ break;
+ }
+ }
+ }
+
+ fill() {
+ const current = this.current;
+ if (current.element) {
+ current.element.setAttributeNS(null, "fill", current.fillColor);
+ current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha);
+ this.endPath();
+ }
+ }
+
+ stroke() {
+ const current = this.current;
+ if (current.element) {
+ this._setStrokeAttributes(current.element);
+ current.element.setAttributeNS(null, "fill", "none");
+ this.endPath();
+ }
+ }
+
+ _setStrokeAttributes(element, lineWidthScale = 1) {
+ const current = this.current;
+ let dashArray = current.dashArray;
+ if (lineWidthScale !== 1 && dashArray.length > 0) {
+ dashArray = dashArray.map(function (value) {
+ return lineWidthScale * value;
+ });
+ }
+ element.setAttributeNS(null, "stroke", current.strokeColor);
+ element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha);
+ element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit));
+ element.setAttributeNS(null, "stroke-linecap", current.lineCap);
+ element.setAttributeNS(null, "stroke-linejoin", current.lineJoin);
+ element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px");
+ element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" "));
+ element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px");
+ }
+
+ eoFill() {
+ this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
+ this.fill();
+ }
+
+ fillStroke() {
+ this.stroke();
+ this.fill();
+ }
+
+ eoFillStroke() {
+ this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
+ this.fillStroke();
+ }
+
+ closeStroke() {
+ this.closePath();
+ this.stroke();
+ }
+
+ closeFillStroke() {
+ this.closePath();
+ this.fillStroke();
+ }
+
+ closeEOFillStroke() {
+ this.closePath();
+ this.eoFillStroke();
+ }
+
+ paintSolidColorImageMask() {
+ const rect = this.svgFactory.createElement("svg:rect");
+ rect.setAttributeNS(null, "x", "0");
+ rect.setAttributeNS(null, "y", "0");
+ rect.setAttributeNS(null, "width", "1px");
+ rect.setAttributeNS(null, "height", "1px");
+ rect.setAttributeNS(null, "fill", this.current.fillColor);
+ this._ensureTransformGroup().append(rect);
+ }
+
+ paintImageXObject(objId) {
+ const imgData = this.getObject(objId);
+ if (!imgData) {
+ (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`);
+ return;
+ }
+ this.paintInlineImageXObject(imgData);
+ }
+
+ paintInlineImageXObject(imgData, mask) {
+ const width = imgData.width;
+ const height = imgData.height;
+ const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
+ const cliprect = this.svgFactory.createElement("svg:rect");
+ cliprect.setAttributeNS(null, "x", "0");
+ cliprect.setAttributeNS(null, "y", "0");
+ cliprect.setAttributeNS(null, "width", pf(width));
+ cliprect.setAttributeNS(null, "height", pf(height));
+ this.current.element = cliprect;
+ this.clip("nonzero");
+ const imgEl = this.svgFactory.createElement("svg:image");
+ imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc);
+ imgEl.setAttributeNS(null, "x", "0");
+ imgEl.setAttributeNS(null, "y", pf(-height));
+ imgEl.setAttributeNS(null, "width", pf(width) + "px");
+ imgEl.setAttributeNS(null, "height", pf(height) + "px");
+ imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / width)} ${pf(-1 / height)})`);
+ if (mask) {
+ mask.append(imgEl);
+ } else {
+ this._ensureTransformGroup().append(imgEl);
+ }
+ }
+
+ paintImageMaskXObject(img) {
+ const imgData = this.getObject(img.data, img);
+ if (imgData.bitmap) {
+ (0, _util.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, " + "ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");
+ return;
+ }
+ const current = this.current;
+ const width = imgData.width;
+ const height = imgData.height;
+ const fillColor = current.fillColor;
+ current.maskId = `mask${maskCount++}`;
+ const mask = this.svgFactory.createElement("svg:mask");
+ mask.setAttributeNS(null, "id", current.maskId);
+ const rect = this.svgFactory.createElement("svg:rect");
+ rect.setAttributeNS(null, "x", "0");
+ rect.setAttributeNS(null, "y", "0");
+ rect.setAttributeNS(null, "width", pf(width));
+ rect.setAttributeNS(null, "height", pf(height));
+ rect.setAttributeNS(null, "fill", fillColor);
+ rect.setAttributeNS(null, "mask", `url(#${current.maskId})`);
+ this.defs.append(mask);
+ this._ensureTransformGroup().append(rect);
+ this.paintInlineImageXObject(imgData, mask);
+ }
+
+ paintFormXObjectBegin(matrix, bbox) {
+ if (Array.isArray(matrix) && matrix.length === 6) {
+ this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
+ }
+ if (bbox) {
+ const width = bbox[2] - bbox[0];
+ const height = bbox[3] - bbox[1];
+ const cliprect = this.svgFactory.createElement("svg:rect");
+ cliprect.setAttributeNS(null, "x", bbox[0]);
+ cliprect.setAttributeNS(null, "y", bbox[1]);
+ cliprect.setAttributeNS(null, "width", pf(width));
+ cliprect.setAttributeNS(null, "height", pf(height));
+ this.current.element = cliprect;
+ this.clip("nonzero");
+ this.endPath();
+ }
+ }
+
+ paintFormXObjectEnd() {
+ }
+
+ _initialize(viewport) {
+ const svg = this.svgFactory.create(viewport.width, viewport.height);
+ const definitions = this.svgFactory.createElement("svg:defs");
+ svg.append(definitions);
+ this.defs = definitions;
+ const rootGroup = this.svgFactory.createElement("svg:g");
+ rootGroup.setAttributeNS(null, "transform", pm(viewport.transform));
+ svg.append(rootGroup);
+ this.svg = rootGroup;
+ return svg;
+ }
+
+ _ensureClipGroup() {
+ if (!this.current.clipGroup) {
+ const clipGroup = this.svgFactory.createElement("svg:g");
+ clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl);
+ this.svg.append(clipGroup);
+ this.current.clipGroup = clipGroup;
+ }
+ return this.current.clipGroup;
+ }
+
+ _ensureTransformGroup() {
+ if (!this.tgrp) {
+ this.tgrp = this.svgFactory.createElement("svg:g");
+ this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix));
+ if (this.current.activeClipUrl) {
+ this._ensureClipGroup().append(this.tgrp);
+ } else {
+ this.svg.append(this.tgrp);
+ }
+ }
+ return this.tgrp;
+ }
+ }
+
+ exports.SVGGraphics = SVGGraphics;
+
+ /***/
+ }),
+ /* 25 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.XfaText = void 0;
+
+ class XfaText {
+ static textContent(xfa) {
+ const items = [];
+ const output = {
+ items,
+ styles: Object.create(null)
+ };
+
+ function walk(node) {
+ if (!node) {
+ return;
+ }
+ let str = null;
+ const name = node.name;
+ if (name === "#text") {
+ str = node.value;
+ } else if (!XfaText.shouldBuildText(name)) {
+ return;
+ } else if (node?.attributes?.textContent) {
+ str = node.attributes.textContent;
+ } else if (node.value) {
+ str = node.value;
+ }
+ if (str !== null) {
+ items.push({
+ str
+ });
+ }
+ if (!node.children) {
+ return;
+ }
+ for (const child of node.children) {
+ walk(child);
+ }
+ }
+
+ walk(xfa);
+ return output;
+ }
+
+ static shouldBuildText(name) {
+ return !(name === "textarea" || name === "input" || name === "option" || name === "select");
+ }
+ }
+
+ exports.XfaText = XfaText;
/***/ }),
/* 26 */
@@ -10132,11 +12973,12 @@ class TextLayerRenderTask {
this._container = this._rootContainer = container;
this._textDivs = textDivs || [];
this._textContentItemsStr = textContentItemsStr || [];
+ this._isOffscreenCanvasSupported = isOffscreenCanvasSupported;
this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled;
this._reader = null;
this._textDivProperties = textDivProperties || new WeakMap();
this._canceled = false;
- this._capability = (0, _util.createPromiseCapability)();
+ this._capability = new _util.PromiseCapability();
this._layoutTextParams = {
prevFontSize: null,
prevFontFamily: null,
@@ -10204,7 +13046,7 @@ class TextLayerRenderTask {
}
}
_render() {
- const capability = (0, _util.createPromiseCapability)();
+ const capability = new _util.PromiseCapability();
let styleCache = Object.create(null);
if (this._isReadableStream) {
const pump = () => {
@@ -10245,6 +13087,16 @@ function renderTextLayer(params) {
(0, _display_utils.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters " + "will be removed in the future, please use `textContentSource` instead.");
params.textContentSource = params.textContent || params.textContentStream;
}
+ const {
+ container,
+ viewport
+ } = params;
+ const style = getComputedStyle(container);
+ const visibility = style.getPropertyValue("visibility");
+ const scaleFactor = parseFloat(style.getPropertyValue("--scale-factor"));
+ if (visibility === "visible" && (!scaleFactor || Math.abs(scaleFactor - viewport.scale) > 1e-5)) {
+ console.error("The `--scale-factor` CSS-variable must be set, " + "to the same value as `viewport.scale`, " + "either on the `container`-element itself or higher up in the DOM.");
+ }
const task = new TextLayerRenderTask(params);
task._render();
return task;
@@ -10293,33 +13145,53 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.AnnotationEditorLayer = void 0;
var _util = __w_pdfjs_require__(1);
-var _tools = __w_pdfjs_require__(5);
+ var _editor = __w_pdfjs_require__(4);
var _freetext = __w_pdfjs_require__(28);
-var _ink = __w_pdfjs_require__(29);
+ var _ink = __w_pdfjs_require__(33);
var _display_utils = __w_pdfjs_require__(6);
+ var _stamp = __w_pdfjs_require__(34);
class AnnotationEditorLayer {
#accessibilityManager;
#allowClick = false;
+ #annotationLayer = null;
#boundPointerup = this.pointerup.bind(this);
#boundPointerdown = this.pointerdown.bind(this);
#editors = new Map();
#hadPointerDown = false;
#isCleaningUp = false;
+ #isDisabling = false;
#uiManager;
static _initialized = false;
- constructor(options) {
+
+ constructor({
+ uiManager,
+ pageIndex,
+ div,
+ accessibilityManager,
+ annotationLayer,
+ viewport,
+ l10n
+ }) {
+ const editorTypes = [_freetext.FreeTextEditor, _ink.InkEditor, _stamp.StampEditor];
if (!AnnotationEditorLayer._initialized) {
AnnotationEditorLayer._initialized = true;
- _freetext.FreeTextEditor.initialize(options.l10n);
- _ink.InkEditor.initialize(options.l10n);
+ for (const editorType of editorTypes) {
+ editorType.initialize(l10n);
+ }
}
- options.uiManager.registerEditorTypes([_freetext.FreeTextEditor, _ink.InkEditor]);
- this.#uiManager = options.uiManager;
- this.pageIndex = options.pageIndex;
- this.div = options.div;
- this.#accessibilityManager = options.accessibilityManager;
+ uiManager.registerEditorTypes(editorTypes);
+ this.#uiManager = uiManager;
+ this.pageIndex = pageIndex;
+ this.div = div;
+ this.#accessibilityManager = accessibilityManager;
+ this.#annotationLayer = annotationLayer;
+ this.viewport = viewport;
this.#uiManager.addLayer(this);
}
+
+ get isEmpty() {
+ return this.#editors.size === 0;
+ }
updateToolbar(mode) {
this.#uiManager.updateToolbar(mode);
}
@@ -10331,9 +13203,12 @@ class AnnotationEditorLayer {
} else {
this.enableClick();
}
- this.#uiManager.unselectAll();
- this.div.classList.toggle("freeTextEditing", mode === _util.AnnotationEditorType.FREETEXT);
- this.div.classList.toggle("inkEditing", mode === _util.AnnotationEditorType.INK);
+ if (mode !== _util.AnnotationEditorType.NONE) {
+ this.div.classList.toggle("freeTextEditing", mode === _util.AnnotationEditorType.FREETEXT);
+ this.div.classList.toggle("inkEditing", mode === _util.AnnotationEditorType.INK);
+ this.div.classList.toggle("stampEditing", mode === _util.AnnotationEditorType.STAMP);
+ this.div.hidden = false;
+ }
}
addInkEditorIfNeeded(isCommitting) {
if (!isCommitting && this.#uiManager.getMode() !== _util.AnnotationEditorType.INK) {
@@ -10350,7 +13225,7 @@ class AnnotationEditorLayer {
const editor = this.#createAndAddNewEditor({
offsetX: 0,
offsetY: 0
- });
+ }, false);
editor.setInBackground();
}
setEditingState(isEditing) {
@@ -10361,15 +13236,67 @@ class AnnotationEditorLayer {
}
enable() {
this.div.style.pointerEvents = "auto";
+ const annotationElementIds = new Set();
for (const editor of this.#editors.values()) {
editor.enableEditing();
+ if (editor.annotationElementId) {
+ annotationElementIds.add(editor.annotationElementId);
+ }
+ }
+ if (!this.#annotationLayer) {
+ return;
+ }
+ const editables = this.#annotationLayer.getEditableAnnotations();
+ for (const editable of editables) {
+ editable.hide();
+ if (this.#uiManager.isDeletedAnnotationElement(editable.data.id)) {
+ continue;
+ }
+ if (annotationElementIds.has(editable.data.id)) {
+ continue;
+ }
+ const editor = this.deserialize(editable);
+ if (!editor) {
+ continue;
+ }
+ this.addOrRebuild(editor);
+ editor.enableEditing();
}
}
disable() {
+ this.#isDisabling = true;
this.div.style.pointerEvents = "none";
+ const hiddenAnnotationIds = new Set();
for (const editor of this.#editors.values()) {
editor.disableEditing();
+ if (!editor.annotationElementId || editor.serialize() !== null) {
+ hiddenAnnotationIds.add(editor.annotationElementId);
+ continue;
+ }
+ this.getEditableAnnotation(editor.annotationElementId)?.show();
+ editor.remove();
}
+ if (this.#annotationLayer) {
+ const editables = this.#annotationLayer.getEditableAnnotations();
+ for (const editable of editables) {
+ const {
+ id
+ } = editable.data;
+ if (hiddenAnnotationIds.has(id) || this.#uiManager.isDeletedAnnotationElement(id)) {
+ continue;
+ }
+ editable.show();
+ }
+ }
+ this.#cleanup();
+ if (this.isEmpty) {
+ this.div.hidden = true;
+ }
+ this.#isDisabling = false;
+ }
+
+ getEditableAnnotation(id) {
+ return this.#annotationLayer?.getEditableAnnotation(id) || null;
}
setActiveEditor(editor) {
const currentActive = this.#uiManager.getActive();
@@ -10388,31 +13315,44 @@ class AnnotationEditorLayer {
}
attach(editor) {
this.#editors.set(editor.id, editor);
+ const {
+ annotationElementId
+ } = editor;
+ if (annotationElementId && this.#uiManager.isDeletedAnnotationElement(annotationElementId)) {
+ this.#uiManager.removeDeletedAnnotationElement(editor);
+ }
}
detach(editor) {
this.#editors.delete(editor.id);
this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
+ if (!this.#isDisabling && editor.annotationElementId) {
+ this.#uiManager.addDeletedAnnotationElement(editor);
+ }
}
remove(editor) {
- this.#uiManager.removeEditor(editor);
this.detach(editor);
- editor.div.style.display = "none";
- setTimeout(() => {
- editor.div.style.display = "";
+ this.#uiManager.removeEditor(editor);
+ if (editor.div.contains(document.activeElement)) {
+ setTimeout(() => {
+ this.#uiManager.focusMainContainer();
+ }, 0);
+ }
editor.div.remove();
editor.isAttachedToDOM = false;
- if (document.activeElement === document.body) {
- this.#uiManager.focusMainContainer();
- }
- }, 0);
if (!this.#isCleaningUp) {
this.addInkEditorIfNeeded(false);
}
}
- #changeParent(editor) {
+
+ changeParent(editor) {
if (editor.parent === this) {
return;
}
+ if (editor.annotationElementId) {
+ this.#uiManager.addDeletedAnnotationElement(editor.annotationElementId);
+ _editor.AnnotationEditor.deleteAnnotationElement(editor);
+ editor.annotationElementId = null;
+ }
this.attach(editor);
editor.parent?.detach(editor);
editor.setParent(this);
@@ -10422,7 +13362,7 @@ class AnnotationEditorLayer {
}
}
add(editor) {
- this.#changeParent(editor);
+ this.changeParent(editor);
this.#uiManager.addEditor(editor);
this.attach(editor);
if (!editor.isAttachedToDOM) {
@@ -10430,12 +13370,33 @@ class AnnotationEditorLayer {
this.div.append(div);
editor.isAttachedToDOM = true;
}
- this.moveEditorInDOM(editor);
+ editor.fixAndSetPosition();
editor.onceAdded();
this.#uiManager.addToAnnotationStorage(editor);
}
moveEditorInDOM(editor) {
- this.#accessibilityManager?.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
+ if (!editor.isAttachedToDOM) {
+ return;
+ }
+ const {
+ activeElement
+ } = document;
+ if (editor.div.contains(activeElement)) {
+ editor._focusEventsAllowed = false;
+ setTimeout(() => {
+ if (!editor.div.contains(document.activeElement)) {
+ editor.div.addEventListener("focusin", () => {
+ editor._focusEventsAllowed = true;
+ }, {
+ once: true
+ });
+ activeElement.focus();
+ } else {
+ editor._focusEventsAllowed = true;
+ }
+ }, 0);
+ }
+ editor._structTreeParentId = this.#accessibilityManager?.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
}
addOrRebuild(editor) {
if (editor.needsToBeRebuilt()) {
@@ -10444,23 +13405,8 @@ class AnnotationEditorLayer {
this.add(editor);
}
}
- addANewEditor(editor) {
- const cmd = () => {
- this.addOrRebuild(editor);
- };
- const undo = () => {
- editor.remove();
- };
- this.addCommands({
- cmd,
- undo,
- mustExec: true
- });
- }
addUndoableEditor(editor) {
- const cmd = () => {
- this.addOrRebuild(editor);
- };
+ const cmd = () => editor._uiManager.rebuild(editor);
const undo = () => {
editor.remove();
};
@@ -10479,32 +13425,84 @@ class AnnotationEditorLayer {
return new _freetext.FreeTextEditor(params);
case _util.AnnotationEditorType.INK:
return new _ink.InkEditor(params);
+ case _util.AnnotationEditorType.STAMP:
+ return new _stamp.StampEditor(params);
}
return null;
}
+
+ pasteEditor(mode, params) {
+ this.#uiManager.updateToolbar(mode);
+ this.#uiManager.updateMode(mode);
+ const {
+ offsetX,
+ offsetY
+ } = this.#getCenterPoint();
+ const id = this.getNextId();
+ const editor = this.#createNewEditor({
+ parent: this,
+ id,
+ x: offsetX,
+ y: offsetY,
+ uiManager: this.#uiManager,
+ isCentered: true,
+ ...params
+ });
+ if (editor) {
+ this.add(editor);
+ }
+ }
deserialize(data) {
- switch (data.annotationType) {
+ switch (data.annotationType ?? data.annotationEditorType) {
case _util.AnnotationEditorType.FREETEXT:
return _freetext.FreeTextEditor.deserialize(data, this, this.#uiManager);
case _util.AnnotationEditorType.INK:
return _ink.InkEditor.deserialize(data, this, this.#uiManager);
+ case _util.AnnotationEditorType.STAMP:
+ return _stamp.StampEditor.deserialize(data, this, this.#uiManager);
}
return null;
}
- #createAndAddNewEditor(event) {
+
+ #createAndAddNewEditor(event, isCentered) {
const id = this.getNextId();
const editor = this.#createNewEditor({
parent: this,
id,
x: event.offsetX,
y: event.offsetY,
- uiManager: this.#uiManager
+ uiManager: this.#uiManager,
+ isCentered
});
if (editor) {
this.add(editor);
}
return editor;
}
+
+ #getCenterPoint() {
+ const {
+ x,
+ y,
+ width,
+ height
+ } = this.div.getBoundingClientRect();
+ const tlX = Math.max(0, x);
+ const tlY = Math.max(0, y);
+ const brX = Math.min(window.innerWidth, x + width);
+ const brY = Math.min(window.innerHeight, y + height);
+ const centerX = (tlX + brX) / 2 - x;
+ const centerY = (tlY + brY) / 2 - y;
+ const [offsetX, offsetY] = this.viewport.rotation % 180 === 0 ? [centerX, centerY] : [centerY, centerX];
+ return {
+ offsetX,
+ offsetY
+ };
+ }
+
+ addNewEditor() {
+ this.#createAndAddNewEditor(this.#getCenterPoint(), true);
+ }
setSelected(editor) {
this.#uiManager.setSelected(editor);
}
@@ -10535,9 +13533,17 @@ class AnnotationEditorLayer {
this.#allowClick = true;
return;
}
- this.#createAndAddNewEditor(event);
+ if (this.#uiManager.getMode() === _util.AnnotationEditorType.STAMP) {
+ this.#uiManager.unselectAll();
+ return;
+ }
+ this.#createAndAddNewEditor(event, false);
}
pointerdown(event) {
+ if (this.#hadPointerDown) {
+ this.#hadPointerDown = false;
+ return;
+ }
const {
isMac
} = _util.FeatureTest.platform;
@@ -10551,27 +13557,18 @@ class AnnotationEditorLayer {
const editor = this.#uiManager.getActive();
this.#allowClick = !editor || editor.isEmpty();
}
- drop(event) {
- const id = event.dataTransfer.getData("text/plain");
- const editor = this.#uiManager.getEditor(id);
- if (!editor) {
- return;
+
+ findNewParent(editor, x, y) {
+ const layer = this.#uiManager.findParent(x, y);
+ if (layer === null || layer === this) {
+ return false;
}
- event.preventDefault();
- event.dataTransfer.dropEffect = "move";
- this.#changeParent(editor);
- const rect = this.div.getBoundingClientRect();
- const endX = event.clientX - rect.x;
- const endY = event.clientY - rect.y;
- editor.translate(endX - editor.startX, endY - editor.startY);
- this.moveEditorInDOM(editor);
- editor.div.focus();
- }
- dragover(event) {
- event.preventDefault();
+ layer.changeParent(editor);
+ return true;
}
destroy() {
if (this.#uiManager.getActive()?.parent === this) {
+ this.#uiManager.commitOrRemove();
this.#uiManager.setActiveEditor(null);
}
for (const editor of this.#editors.values()) {
@@ -10598,7 +13595,6 @@ class AnnotationEditorLayer {
}) {
this.viewport = viewport;
(0, _display_utils.setLayerDimensions)(this.div, viewport);
- (0, _tools.bindEvents)(this, this.div, ["dragover", "drop"]);
for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
this.add(editor);
}
@@ -10637,6 +13633,7 @@ exports.FreeTextEditor = void 0;
var _util = __w_pdfjs_require__(1);
var _tools = __w_pdfjs_require__(5);
var _editor = __w_pdfjs_require__(4);
+ var _annotation_layer = __w_pdfjs_require__(29);
class FreeTextEditor extends _editor.AnnotationEditor {
#boundEditorDivBlur = this.editorDivBlur.bind(this);
#boundEditorDivFocus = this.editorDivFocus.bind(this);
@@ -10645,14 +13642,46 @@ class FreeTextEditor extends _editor.AnnotationEditor {
#color;
#content = "";
#editorDivId = `${this.id}-editor`;
- #hasAlreadyBeenCommitted = false;
#fontSize;
+ #initialData = null;
static _freeTextDefaultContent = "";
- static _l10nPromise;
static _internalPadding = 0;
static _defaultColor = null;
static _defaultFontSize = 10;
- static _keyboardManager = new _tools.KeyboardManager([[["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], FreeTextEditor.prototype.commitOrRemove]]);
+
+ static get _keyboardManager() {
+ const proto = FreeTextEditor.prototype;
+ const arrowChecker = self => self.isEmpty();
+ const small = _tools.AnnotationEditorUIManager.TRANSLATE_SMALL;
+ const big = _tools.AnnotationEditorUIManager.TRANSLATE_BIG;
+ return (0, _util.shadow)(this, "_keyboardManager", new _tools.KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], proto.commitOrRemove, {
+ bubbles: true
+ }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], proto.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], proto._translateEmpty, {
+ args: [-small, 0],
+ checker: arrowChecker
+ }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto._translateEmpty, {
+ args: [-big, 0],
+ checker: arrowChecker
+ }], [["ArrowRight", "mac+ArrowRight"], proto._translateEmpty, {
+ args: [small, 0],
+ checker: arrowChecker
+ }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto._translateEmpty, {
+ args: [big, 0],
+ checker: arrowChecker
+ }], [["ArrowUp", "mac+ArrowUp"], proto._translateEmpty, {
+ args: [0, -small],
+ checker: arrowChecker
+ }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto._translateEmpty, {
+ args: [0, -big],
+ checker: arrowChecker
+ }], [["ArrowDown", "mac+ArrowDown"], proto._translateEmpty, {
+ args: [0, small],
+ checker: arrowChecker
+ }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto._translateEmpty, {
+ args: [0, big],
+ checker: arrowChecker
+ }]]));
+ }
static _type = "freetext";
constructor(params) {
super({
@@ -10663,7 +13692,9 @@ class FreeTextEditor extends _editor.AnnotationEditor {
this.#fontSize = params.fontSize || FreeTextEditor._defaultFontSize;
}
static initialize(l10n) {
- this._l10nPromise = new Map(["free_text2_default_content", "editor_free_text2_aria_label"].map(str => [str, l10n.get(str)]));
+ _editor.AnnotationEditor.initialize(l10n, {
+ strings: ["free_text2_default_content", "editor_free_text2_aria_label"]
+ });
const style = getComputedStyle(document.documentElement);
this._internalPadding = parseFloat(style.getPropertyValue("--freetext-padding"));
}
@@ -10729,11 +13760,18 @@ class FreeTextEditor extends _editor.AnnotationEditor {
keepUndo: true
});
}
+
+ _translateEmpty(x, y) {
+ this._uiManager.translateSelectedEditors(x, y, true);
+ }
getInitialTranslation() {
const scale = this.parentScale;
return [-FreeTextEditor._internalPadding * scale, -(FreeTextEditor._internalPadding + this.#fontSize) * scale];
}
rebuild() {
+ if (!this.parent) {
+ return;
+ }
super.rebuild();
if (this.div === null) {
return;
@@ -10751,7 +13789,7 @@ class FreeTextEditor extends _editor.AnnotationEditor {
super.enableEditMode();
this.overlayDiv.classList.remove("enabled");
this.editorDiv.contentEditable = true;
- this.div.draggable = false;
+ this._isDraggable = false;
this.div.removeAttribute("aria-activedescendant");
this.editorDiv.addEventListener("keydown", this.#boundEditorDivKeydown);
this.editorDiv.addEventListener("focus", this.#boundEditorDivFocus);
@@ -10767,7 +13805,7 @@ class FreeTextEditor extends _editor.AnnotationEditor {
this.overlayDiv.classList.add("enabled");
this.editorDiv.contentEditable = false;
this.div.setAttribute("aria-activedescendant", this.#editorDivId);
- this.div.draggable = true;
+ this._isDraggable = true;
this.editorDiv.removeEventListener("keydown", this.#boundEditorDivKeydown);
this.editorDiv.removeEventListener("focus", this.#boundEditorDivFocus);
this.editorDiv.removeEventListener("blur", this.#boundEditorDivBlur);
@@ -10779,6 +13817,9 @@ class FreeTextEditor extends _editor.AnnotationEditor {
this.parent.div.classList.add("freeTextEditing");
}
focusin(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
super.focusin(event);
if (event.target !== this.editorDiv) {
this.editorDiv.focus();
@@ -10786,18 +13827,25 @@ class FreeTextEditor extends _editor.AnnotationEditor {
}
onceAdded() {
if (this.width) {
+ this.#cheatInitialRect();
return;
}
this.enableEditMode();
this.editorDiv.focus();
+ if (this._initialOptions?.isCentered) {
+ this.center();
+ }
+ this._initialOptions = null;
}
isEmpty() {
return !this.editorDiv || this.editorDiv.innerText.trim() === "";
}
remove() {
this.isEditing = false;
- this.parent.setEditingState(true);
- this.parent.div.classList.add("freeTextEditing");
+ if (this.parent) {
+ this.parent.setEditingState(true);
+ this.parent.div.classList.add("freeTextEditing");
+ }
super.remove();
}
#extractText() {
@@ -10828,33 +13876,63 @@ class FreeTextEditor extends _editor.AnnotationEditor {
div.remove();
div.style.display = savedDisplay;
}
- this.width = rect.width / parentWidth;
- this.height = rect.height / parentHeight;
+ if (this.rotation % 180 === this.parentRotation % 180) {
+ this.width = rect.width / parentWidth;
+ this.height = rect.height / parentHeight;
+ } else {
+ this.width = rect.height / parentWidth;
+ this.height = rect.width / parentHeight;
+ }
+ this.fixAndSetPosition();
}
commit() {
if (!this.isInEditMode()) {
return;
}
super.commit();
- if (!this.#hasAlreadyBeenCommitted) {
- this.#hasAlreadyBeenCommitted = true;
- this.parent.addUndoableEditor(this);
- }
this.disableEditMode();
- this.#content = this.#extractText().trimEnd();
+ const savedText = this.#content;
+ const newText = this.#content = this.#extractText().trimEnd();
+ if (savedText === newText) {
+ return;
+ }
+ const setText = text => {
+ this.#content = text;
+ if (!text) {
+ this.remove();
+ return;
+ }
+ this.#setContent();
+ this._uiManager.rebuild(this);
+ this.#setEditorDimensions();
+ };
+ this.addCommands({
+ cmd: () => {
+ setText(newText);
+ },
+ undo: () => {
+ setText(savedText);
+ },
+ mustExec: false
+ });
this.#setEditorDimensions();
}
shouldGetKeyboardEvents() {
return this.isInEditMode();
}
- dblclick(event) {
+
+ enterInEditMode() {
this.enableEditMode();
this.editorDiv.focus();
}
+
+ dblclick(event) {
+ this.enterInEditMode();
+ }
keydown(event) {
if (event.target === this.div && event.key === "Enter") {
- this.enableEditMode();
- this.editorDiv.focus();
+ this.enterInEditMode();
+ event.preventDefault();
}
}
editorDivKeydown(event) {
@@ -10891,8 +13969,8 @@ class FreeTextEditor extends _editor.AnnotationEditor {
this.editorDiv.className = "internal";
this.editorDiv.setAttribute("id", this.#editorDivId);
this.enableEditing();
- FreeTextEditor._l10nPromise.get("editor_free_text2_aria_label").then(msg => this.editorDiv?.setAttribute("aria-label", msg));
- FreeTextEditor._l10nPromise.get("free_text2_default_content").then(msg => this.editorDiv?.setAttribute("default-content", msg));
+ _editor.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(msg => this.editorDiv?.setAttribute("aria-label", msg));
+ _editor.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(msg => this.editorDiv?.setAttribute("default-content", msg));
this.editorDiv.contentEditable = true;
const {
style
@@ -10906,751 +13984,173 @@ class FreeTextEditor extends _editor.AnnotationEditor {
(0, _tools.bindEvents)(this, this.div, ["dblclick", "keydown"]);
if (this.width) {
const [parentWidth, parentHeight] = this.parentDimensions;
- this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
- for (const line of this.#content.split("\n")) {
- const div = document.createElement("div");
- div.append(line ? document.createTextNode(line) : document.createElement("br"));
- this.editorDiv.append(div);
+ if (this.annotationElementId) {
+ const {
+ position
+ } = this.#initialData;
+ let [tx, ty] = this.getInitialTranslation();
+ [tx, ty] = this.pageTranslationToScreen(tx, ty);
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ const [pageX, pageY] = this.pageTranslation;
+ let posX, posY;
+ switch (this.rotation) {
+ case 0:
+ posX = baseX + (position[0] - pageX) / pageWidth;
+ posY = baseY + this.height - (position[1] - pageY) / pageHeight;
+ break;
+ case 90:
+ posX = baseX + (position[0] - pageX) / pageWidth;
+ posY = baseY - (position[1] - pageY) / pageHeight;
+ [tx, ty] = [ty, -tx];
+ break;
+ case 180:
+ posX = baseX - this.width + (position[0] - pageX) / pageWidth;
+ posY = baseY - (position[1] - pageY) / pageHeight;
+ [tx, ty] = [-tx, -ty];
+ break;
+ case 270:
+ posX = baseX + (position[0] - pageX - this.height * pageHeight) / pageWidth;
+ posY = baseY + (position[1] - pageY - this.width * pageWidth) / pageHeight;
+ [tx, ty] = [-ty, tx];
+ break;
+ }
+ this.setAt(posX * parentWidth, posY * parentHeight, tx, ty);
+ } else {
+ this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
}
- this.div.draggable = true;
+ this.#setContent();
+ this._isDraggable = true;
this.editorDiv.contentEditable = false;
} else {
- this.div.draggable = false;
+ this._isDraggable = false;
this.editorDiv.contentEditable = true;
}
return this.div;
}
+
+ #setContent() {
+ this.editorDiv.replaceChildren();
+ if (!this.#content) {
+ return;
+ }
+ for (const line of this.#content.split("\n")) {
+ const div = document.createElement("div");
+ div.append(line ? document.createTextNode(line) : document.createElement("br"));
+ this.editorDiv.append(div);
+ }
+ }
get contentDiv() {
return this.editorDiv;
}
static deserialize(data, parent, uiManager) {
+ let initialData = null;
+ if (data instanceof _annotation_layer.FreeTextAnnotationElement) {
+ const {
+ data: {
+ defaultAppearanceData: {
+ fontSize,
+ fontColor
+ },
+ rect,
+ rotation,
+ id
+ },
+ textContent,
+ textPosition,
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ if (!textContent || textContent.length === 0) {
+ return null;
+ }
+ initialData = data = {
+ annotationType: _util.AnnotationEditorType.FREETEXT,
+ color: Array.from(fontColor),
+ fontSize,
+ value: textContent.join("\n"),
+ position: textPosition,
+ pageIndex: pageNumber - 1,
+ rect,
+ rotation,
+ id,
+ deleted: false
+ };
+ }
const editor = super.deserialize(data, parent, uiManager);
editor.#fontSize = data.fontSize;
editor.#color = _util.Util.makeHexColor(...data.color);
editor.#content = data.value;
+ editor.annotationElementId = data.id || null;
+ editor.#initialData = initialData;
return editor;
}
- serialize() {
+
+ serialize(isForCopying = false) {
if (this.isEmpty()) {
return null;
}
+ if (this.deleted) {
+ return {
+ pageIndex: this.pageIndex,
+ id: this.annotationElementId,
+ deleted: true
+ };
+ }
const padding = FreeTextEditor._internalPadding * this.parentScale;
const rect = this.getRect(padding, padding);
const color = _editor.AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : this.#color);
- return {
+ const serialized = {
annotationType: _util.AnnotationEditorType.FREETEXT,
color,
fontSize: this.#fontSize,
value: this.#content,
pageIndex: this.pageIndex,
rect,
- rotation: this.rotation
+ rotation: this.rotation,
+ structTreeParentId: this._structTreeParentId
};
+ if (isForCopying) {
+ return serialized;
+ }
+ if (this.annotationElementId && !this.#hasElementChanged(serialized)) {
+ return null;
+ }
+ serialized.id = this.annotationElementId;
+ return serialized;
}
-}
-exports.FreeTextEditor = FreeTextEditor;
-/***/ }),
-/* 29 */
-/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.InkEditor = void 0;
-Object.defineProperty(exports, "fitCurve", ({
- enumerable: true,
- get: function () {
- return _pdfjsFitCurve.fitCurve;
- }
-}));
-var _util = __w_pdfjs_require__(1);
-var _editor = __w_pdfjs_require__(4);
-var _pdfjsFitCurve = __w_pdfjs_require__(30);
-var _tools = __w_pdfjs_require__(5);
-const RESIZER_SIZE = 16;
-const TIME_TO_WAIT_BEFORE_FIXING_DIMS = 100;
-class InkEditor extends _editor.AnnotationEditor {
- #aspectRatio = 0;
- #baseHeight = 0;
- #baseWidth = 0;
- #boundCanvasPointermove = this.canvasPointermove.bind(this);
- #boundCanvasPointerleave = this.canvasPointerleave.bind(this);
- #boundCanvasPointerup = this.canvasPointerup.bind(this);
- #boundCanvasPointerdown = this.canvasPointerdown.bind(this);
- #disableEditing = false;
- #isCanvasInitialized = false;
- #lastPoint = null;
- #observer = null;
- #realWidth = 0;
- #realHeight = 0;
- #requestFrameCallback = null;
- static _defaultColor = null;
- static _defaultOpacity = 1;
- static _defaultThickness = 1;
- static _l10nPromise;
- static _type = "ink";
- constructor(params) {
- super({
- ...params,
- name: "inkEditor"
- });
- this.color = params.color || null;
- this.thickness = params.thickness || null;
- this.opacity = params.opacity || null;
- this.paths = [];
- this.bezierPath2D = [];
- this.currentPath = [];
- this.scaleFactor = 1;
- this.translationX = this.translationY = 0;
- this.x = 0;
- this.y = 0;
- }
- static initialize(l10n) {
- this._l10nPromise = new Map(["editor_ink_canvas_aria_label", "editor_ink2_aria_label"].map(str => [str, l10n.get(str)]));
- }
- static updateDefaultParams(type, value) {
- switch (type) {
- case _util.AnnotationEditorParamsType.INK_THICKNESS:
- InkEditor._defaultThickness = value;
- break;
- case _util.AnnotationEditorParamsType.INK_COLOR:
- InkEditor._defaultColor = value;
- break;
- case _util.AnnotationEditorParamsType.INK_OPACITY:
- InkEditor._defaultOpacity = value / 100;
- break;
- }
- }
- updateParams(type, value) {
- switch (type) {
- case _util.AnnotationEditorParamsType.INK_THICKNESS:
- this.#updateThickness(value);
- break;
- case _util.AnnotationEditorParamsType.INK_COLOR:
- this.#updateColor(value);
- break;
- case _util.AnnotationEditorParamsType.INK_OPACITY:
- this.#updateOpacity(value);
- break;
- }
- }
- static get defaultPropertiesToUpdate() {
- return [[_util.AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(InkEditor._defaultOpacity * 100)]];
- }
- get propertiesToUpdate() {
- return [[_util.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? InkEditor._defaultOpacity))]];
- }
- #updateThickness(thickness) {
- const savedThickness = this.thickness;
- this.addCommands({
- cmd: () => {
- this.thickness = thickness;
- this.#fitToContent();
- },
- undo: () => {
- this.thickness = savedThickness;
- this.#fitToContent();
- },
- mustExec: true,
- type: _util.AnnotationEditorParamsType.INK_THICKNESS,
- overwriteIfSameType: true,
- keepUndo: true
- });
- }
- #updateColor(color) {
- const savedColor = this.color;
- this.addCommands({
- cmd: () => {
- this.color = color;
- this.#redraw();
- },
- undo: () => {
- this.color = savedColor;
- this.#redraw();
- },
- mustExec: true,
- type: _util.AnnotationEditorParamsType.INK_COLOR,
- overwriteIfSameType: true,
- keepUndo: true
- });
- }
- #updateOpacity(opacity) {
- opacity /= 100;
- const savedOpacity = this.opacity;
- this.addCommands({
- cmd: () => {
- this.opacity = opacity;
- this.#redraw();
- },
- undo: () => {
- this.opacity = savedOpacity;
- this.#redraw();
- },
- mustExec: true,
- type: _util.AnnotationEditorParamsType.INK_OPACITY,
- overwriteIfSameType: true,
- keepUndo: true
- });
- }
- rebuild() {
- super.rebuild();
- if (this.div === null) {
- return;
- }
- if (!this.canvas) {
- this.#createCanvas();
- this.#createObserver();
- }
- if (!this.isAttachedToDOM) {
- this.parent.add(this);
- this.#setCanvasDims();
- }
- this.#fitToContent();
- }
- remove() {
- if (this.canvas === null) {
- return;
- }
- if (!this.isEmpty()) {
- this.commit();
- }
- this.canvas.width = this.canvas.height = 0;
- this.canvas.remove();
- this.canvas = null;
- this.#observer.disconnect();
- this.#observer = null;
- super.remove();
- }
- setParent(parent) {
- if (!this.parent && parent) {
- this._uiManager.removeShouldRescale(this);
- } else if (this.parent && parent === null) {
- this._uiManager.addShouldRescale(this);
- }
- super.setParent(parent);
- }
- onScaleChanging() {
- const [parentWidth, parentHeight] = this.parentDimensions;
- const width = this.width * parentWidth;
- const height = this.height * parentHeight;
- this.setDimensions(width, height);
- }
- enableEditMode() {
- if (this.#disableEditing || this.canvas === null) {
- return;
- }
- super.enableEditMode();
- this.div.draggable = false;
- this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
- this.canvas.addEventListener("pointerup", this.#boundCanvasPointerup);
- }
- disableEditMode() {
- if (!this.isInEditMode() || this.canvas === null) {
- return;
- }
- super.disableEditMode();
- this.div.draggable = !this.isEmpty();
- this.div.classList.remove("editing");
- this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
- this.canvas.removeEventListener("pointerup", this.#boundCanvasPointerup);
- }
- onceAdded() {
- this.div.draggable = !this.isEmpty();
- }
- isEmpty() {
- return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
- }
- #getInitialBBox() {
+ #hasElementChanged(serialized) {
const {
- parentRotation,
- parentDimensions: [width, height]
- } = this;
- switch (parentRotation) {
- case 90:
- return [0, height, height, width];
- case 180:
- return [width, height, width, height];
- case 270:
- return [width, 0, height, width];
- default:
- return [0, 0, width, height];
- }
- }
- #setStroke() {
- const {
- ctx,
+ value,
+ fontSize,
color,
- opacity,
- thickness,
- parentScale,
- scaleFactor
- } = this;
- ctx.lineWidth = thickness * parentScale / scaleFactor;
- ctx.lineCap = "round";
- ctx.lineJoin = "round";
- ctx.miterLimit = 10;
- ctx.strokeStyle = `${color}${(0, _tools.opacityToHex)(opacity)}`;
- }
- #startDrawing(x, y) {
- this.isEditing = true;
- if (!this.#isCanvasInitialized) {
- this.#isCanvasInitialized = true;
- this.#setCanvasDims();
- this.thickness ||= InkEditor._defaultThickness;
- this.color ||= InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor;
- this.opacity ??= InkEditor._defaultOpacity;
+ rect,
+ pageIndex
+ } = this.#initialData;
+ return serialized.value !== value || serialized.fontSize !== fontSize || serialized.rect.some((x, i) => Math.abs(x - rect[i]) >= 1) || serialized.color.some((c, i) => c !== color[i]) || serialized.pageIndex !== pageIndex;
}
- this.currentPath.push([x, y]);
- this.#lastPoint = null;
- this.#setStroke();
- this.ctx.beginPath();
- this.ctx.moveTo(x, y);
- this.#requestFrameCallback = () => {
- if (!this.#requestFrameCallback) {
- return;
- }
- if (this.#lastPoint) {
- if (this.isEmpty()) {
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
- this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
- } else {
- this.#redraw();
- }
- this.ctx.lineTo(...this.#lastPoint);
- this.#lastPoint = null;
- this.ctx.stroke();
- }
- window.requestAnimationFrame(this.#requestFrameCallback);
- };
- window.requestAnimationFrame(this.#requestFrameCallback);
- }
- #draw(x, y) {
- const [lastX, lastY] = this.currentPath.at(-1);
- if (x === lastX && y === lastY) {
+
+ #cheatInitialRect(delayed = false) {
+ if (!this.annotationElementId) {
return;
}
- this.currentPath.push([x, y]);
- this.#lastPoint = [x, y];
- }
- #stopDrawing(x, y) {
- this.ctx.closePath();
- this.#requestFrameCallback = null;
- x = Math.min(Math.max(x, 0), this.canvas.width);
- y = Math.min(Math.max(y, 0), this.canvas.height);
- const [lastX, lastY] = this.currentPath.at(-1);
- if (x !== lastX || y !== lastY) {
- this.currentPath.push([x, y]);
- }
- let bezier;
- if (this.currentPath.length !== 1) {
- bezier = (0, _pdfjsFitCurve.fitCurve)(this.currentPath, 30, null);
- } else {
- const xy = [x, y];
- bezier = [[xy, xy.slice(), xy.slice(), xy]];
- }
- const path2D = InkEditor.#buildPath2D(bezier);
- this.currentPath.length = 0;
- const cmd = () => {
- this.paths.push(bezier);
- this.bezierPath2D.push(path2D);
- this.rebuild();
- };
- const undo = () => {
- this.paths.pop();
- this.bezierPath2D.pop();
- if (this.paths.length === 0) {
- this.remove();
- } else {
- if (!this.canvas) {
- this.#createCanvas();
- this.#createObserver();
- }
- this.#fitToContent();
- }
- };
- this.addCommands({
- cmd,
- undo,
- mustExec: true
- });
- }
- #redraw() {
- if (this.isEmpty()) {
- this.#updateTransform();
+ this.#setEditorDimensions();
+ if (!delayed && (this.width === 0 || this.height === 0)) {
+ setTimeout(() => this.#cheatInitialRect(true), 0);
return;
}
- this.#setStroke();
- const {
- canvas,
- ctx
- } = this;
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- this.#updateTransform();
- for (const path of this.bezierPath2D) {
- ctx.stroke(path);
- }
- }
- commit() {
- if (this.#disableEditing) {
- return;
- }
- super.commit();
- this.isEditing = false;
- this.disableEditMode();
- this.setInForeground();
- this.#disableEditing = true;
- this.div.classList.add("disabled");
- this.#fitToContent(true);
- this.parent.addInkEditorIfNeeded(true);
- this.parent.moveEditorInDOM(this);
- this.div.focus({
- preventScroll: true
- });
- }
- focusin(event) {
- super.focusin(event);
- this.enableEditMode();
- }
- canvasPointerdown(event) {
- if (event.button !== 0 || !this.isInEditMode() || this.#disableEditing) {
- return;
- }
- this.setInForeground();
- if (event.type !== "mouse") {
- this.div.focus();
- }
- event.stopPropagation();
- this.canvas.addEventListener("pointerleave", this.#boundCanvasPointerleave);
- this.canvas.addEventListener("pointermove", this.#boundCanvasPointermove);
- this.#startDrawing(event.offsetX, event.offsetY);
- }
- canvasPointermove(event) {
- event.stopPropagation();
- this.#draw(event.offsetX, event.offsetY);
- }
- canvasPointerup(event) {
- if (event.button !== 0) {
- return;
- }
- if (this.isInEditMode() && this.currentPath.length !== 0) {
- event.stopPropagation();
- this.#endDrawing(event);
- this.setInBackground();
- }
- }
- canvasPointerleave(event) {
- this.#endDrawing(event);
- this.setInBackground();
- }
- #endDrawing(event) {
- this.#stopDrawing(event.offsetX, event.offsetY);
- this.canvas.removeEventListener("pointerleave", this.#boundCanvasPointerleave);
- this.canvas.removeEventListener("pointermove", this.#boundCanvasPointermove);
- this.addToAnnotationStorage();
- }
- #createCanvas() {
- this.canvas = document.createElement("canvas");
- this.canvas.width = this.canvas.height = 0;
- this.canvas.className = "inkEditorCanvas";
- InkEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(msg => this.canvas?.setAttribute("aria-label", msg));
- this.div.append(this.canvas);
- this.ctx = this.canvas.getContext("2d");
- }
- #createObserver() {
- let timeoutId = null;
- this.#observer = new ResizeObserver(entries => {
- const rect = entries[0].contentRect;
- if (rect.width && rect.height) {
- if (timeoutId !== null) {
- clearTimeout(timeoutId);
- }
- timeoutId = setTimeout(() => {
- this.fixDims();
- timeoutId = null;
- }, TIME_TO_WAIT_BEFORE_FIXING_DIMS);
- this.setDimensions(rect.width, rect.height);
- }
- });
- this.#observer.observe(this.div);
- }
- render() {
- if (this.div) {
- return this.div;
- }
- let baseX, baseY;
- if (this.width) {
- baseX = this.x;
- baseY = this.y;
- }
- super.render();
- InkEditor._l10nPromise.get("editor_ink2_aria_label").then(msg => this.div?.setAttribute("aria-label", msg));
- const [x, y, w, h] = this.#getInitialBBox();
- this.setAt(x, y, 0, 0);
- this.setDims(w, h);
- this.#createCanvas();
- if (this.width) {
- const [parentWidth, parentHeight] = this.parentDimensions;
- this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
- this.#isCanvasInitialized = true;
- this.#setCanvasDims();
- this.setDims(this.width * parentWidth, this.height * parentHeight);
- this.#redraw();
- this.#setMinDims();
- this.div.classList.add("disabled");
- } else {
- this.div.classList.add("editing");
- this.enableEditMode();
- }
- this.#createObserver();
- return this.div;
- }
- #setCanvasDims() {
- if (!this.#isCanvasInitialized) {
- return;
- }
- const [parentWidth, parentHeight] = this.parentDimensions;
- this.canvas.width = Math.ceil(this.width * parentWidth);
- this.canvas.height = Math.ceil(this.height * parentHeight);
- this.#updateTransform();
- }
- setDimensions(width, height) {
- const roundedWidth = Math.round(width);
- const roundedHeight = Math.round(height);
- if (this.#realWidth === roundedWidth && this.#realHeight === roundedHeight) {
- return;
- }
- this.#realWidth = roundedWidth;
- this.#realHeight = roundedHeight;
- this.canvas.style.visibility = "hidden";
- if (this.#aspectRatio && Math.abs(this.#aspectRatio - width / height) > 1e-2) {
- height = Math.ceil(width / this.#aspectRatio);
- this.setDims(width, height);
- }
- const [parentWidth, parentHeight] = this.parentDimensions;
- this.width = width / parentWidth;
- this.height = height / parentHeight;
- if (this.#disableEditing) {
- this.#setScaleFactor(width, height);
- }
- this.#setCanvasDims();
- this.#redraw();
- this.canvas.style.visibility = "visible";
- }
- #setScaleFactor(width, height) {
- const padding = this.#getPadding();
- const scaleFactorW = (width - padding) / this.#baseWidth;
- const scaleFactorH = (height - padding) / this.#baseHeight;
- this.scaleFactor = Math.min(scaleFactorW, scaleFactorH);
- }
- #updateTransform() {
- const padding = this.#getPadding() / 2;
- this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + padding, this.translationY * this.scaleFactor + padding);
- }
- static #buildPath2D(bezier) {
- const path2D = new Path2D();
- for (let i = 0, ii = bezier.length; i < ii; i++) {
- const [first, control1, control2, second] = bezier[i];
- if (i === 0) {
- path2D.moveTo(...first);
- }
- path2D.bezierCurveTo(control1[0], control1[1], control2[0], control2[1], second[0], second[1]);
- }
- return path2D;
- }
- #serializePaths(s, tx, ty, h) {
- const NUMBER_OF_POINTS_ON_BEZIER_CURVE = 4;
- const paths = [];
- const padding = this.thickness / 2;
- let buffer, points;
- for (const bezier of this.paths) {
- buffer = [];
- points = [];
- for (let i = 0, ii = bezier.length; i < ii; i++) {
- const [first, control1, control2, second] = bezier[i];
- const p10 = s * (first[0] + tx) + padding;
- const p11 = h - s * (first[1] + ty) - padding;
- const p20 = s * (control1[0] + tx) + padding;
- const p21 = h - s * (control1[1] + ty) - padding;
- const p30 = s * (control2[0] + tx) + padding;
- const p31 = h - s * (control2[1] + ty) - padding;
- const p40 = s * (second[0] + tx) + padding;
- const p41 = h - s * (second[1] + ty) - padding;
- if (i === 0) {
- buffer.push(p10, p11);
- points.push(p10, p11);
- }
- buffer.push(p20, p21, p30, p31, p40, p41);
- this.#extractPointsOnBezier(p10, p11, p20, p21, p30, p31, p40, p41, NUMBER_OF_POINTS_ON_BEZIER_CURVE, points);
- }
- paths.push({
- bezier: buffer,
- points
- });
- }
- return paths;
- }
- #extractPointsOnBezier(p10, p11, p20, p21, p30, p31, p40, p41, n, points) {
- if (this.#isAlmostFlat(p10, p11, p20, p21, p30, p31, p40, p41)) {
- points.push(p40, p41);
- return;
- }
- for (let i = 1; i < n - 1; i++) {
- const t = i / n;
- const mt = 1 - t;
- let q10 = t * p10 + mt * p20;
- let q11 = t * p11 + mt * p21;
- let q20 = t * p20 + mt * p30;
- let q21 = t * p21 + mt * p31;
- const q30 = t * p30 + mt * p40;
- const q31 = t * p31 + mt * p41;
- q10 = t * q10 + mt * q20;
- q11 = t * q11 + mt * q21;
- q20 = t * q20 + mt * q30;
- q21 = t * q21 + mt * q31;
- q10 = t * q10 + mt * q20;
- q11 = t * q11 + mt * q21;
- points.push(q10, q11);
- }
- points.push(p40, p41);
- }
- #isAlmostFlat(p10, p11, p20, p21, p30, p31, p40, p41) {
- const tol = 10;
- const ax = (3 * p20 - 2 * p10 - p40) ** 2;
- const ay = (3 * p21 - 2 * p11 - p41) ** 2;
- const bx = (3 * p30 - p10 - 2 * p40) ** 2;
- const by = (3 * p31 - p11 - 2 * p41) ** 2;
- return Math.max(ax, bx) + Math.max(ay, by) <= tol;
- }
- #getBbox() {
- let xMin = Infinity;
- let xMax = -Infinity;
- let yMin = Infinity;
- let yMax = -Infinity;
- for (const path of this.paths) {
- for (const [first, control1, control2, second] of path) {
- const bbox = _util.Util.bezierBoundingBox(...first, ...control1, ...control2, ...second);
- xMin = Math.min(xMin, bbox[0]);
- yMin = Math.min(yMin, bbox[1]);
- xMax = Math.max(xMax, bbox[2]);
- yMax = Math.max(yMax, bbox[3]);
- }
- }
- return [xMin, yMin, xMax, yMax];
- }
- #getPadding() {
- return this.#disableEditing ? Math.ceil(this.thickness * this.parentScale) : 0;
- }
- #fitToContent(firstTime = false) {
- if (this.isEmpty()) {
- return;
- }
- if (!this.#disableEditing) {
- this.#redraw();
- return;
- }
- const bbox = this.#getBbox();
- const padding = this.#getPadding();
- this.#baseWidth = Math.max(RESIZER_SIZE, bbox[2] - bbox[0]);
- this.#baseHeight = Math.max(RESIZER_SIZE, bbox[3] - bbox[1]);
- const width = Math.ceil(padding + this.#baseWidth * this.scaleFactor);
- const height = Math.ceil(padding + this.#baseHeight * this.scaleFactor);
- const [parentWidth, parentHeight] = this.parentDimensions;
- this.width = width / parentWidth;
- this.height = height / parentHeight;
- this.#aspectRatio = width / height;
- this.#setMinDims();
- const prevTranslationX = this.translationX;
- const prevTranslationY = this.translationY;
- this.translationX = -bbox[0];
- this.translationY = -bbox[1];
- this.#setCanvasDims();
- this.#redraw();
- this.#realWidth = width;
- this.#realHeight = height;
- this.setDims(width, height);
- const unscaledPadding = firstTime ? padding / this.scaleFactor / 2 : 0;
- this.translate(prevTranslationX - this.translationX - unscaledPadding, prevTranslationY - this.translationY - unscaledPadding);
- }
- #setMinDims() {
- const {
- style
- } = this.div;
- if (this.#aspectRatio >= 1) {
- style.minHeight = `${RESIZER_SIZE}px`;
- style.minWidth = `${Math.round(this.#aspectRatio * RESIZER_SIZE)}px`;
- } else {
- style.minWidth = `${RESIZER_SIZE}px`;
- style.minHeight = `${Math.round(RESIZER_SIZE / this.#aspectRatio)}px`;
- }
- }
- static deserialize(data, parent, uiManager) {
- const editor = super.deserialize(data, parent, uiManager);
- editor.thickness = data.thickness;
- editor.color = _util.Util.makeHexColor(...data.color);
- editor.opacity = data.opacity;
- const [pageWidth, pageHeight] = editor.pageDimensions;
- const width = editor.width * pageWidth;
- const height = editor.height * pageHeight;
- const scaleFactor = editor.parentScale;
- const padding = data.thickness / 2;
- editor.#aspectRatio = width / height;
- editor.#disableEditing = true;
- editor.#realWidth = Math.round(width);
- editor.#realHeight = Math.round(height);
- for (const {
- bezier
- } of data.paths) {
- const path = [];
- editor.paths.push(path);
- let p0 = scaleFactor * (bezier[0] - padding);
- let p1 = scaleFactor * (height - bezier[1] - padding);
- for (let i = 2, ii = bezier.length; i < ii; i += 6) {
- const p10 = scaleFactor * (bezier[i] - padding);
- const p11 = scaleFactor * (height - bezier[i + 1] - padding);
- const p20 = scaleFactor * (bezier[i + 2] - padding);
- const p21 = scaleFactor * (height - bezier[i + 3] - padding);
- const p30 = scaleFactor * (bezier[i + 4] - padding);
- const p31 = scaleFactor * (height - bezier[i + 5] - padding);
- path.push([[p0, p1], [p10, p11], [p20, p21], [p30, p31]]);
- p0 = p30;
- p1 = p31;
- }
- const path2D = this.#buildPath2D(path);
- editor.bezierPath2D.push(path2D);
- }
- const bbox = editor.#getBbox();
- editor.#baseWidth = Math.max(RESIZER_SIZE, bbox[2] - bbox[0]);
- editor.#baseHeight = Math.max(RESIZER_SIZE, bbox[3] - bbox[1]);
- editor.#setScaleFactor(width, height);
- return editor;
- }
- serialize() {
- if (this.isEmpty()) {
- return null;
- }
- const rect = this.getRect(0, 0);
- const height = this.rotation % 180 === 0 ? rect[3] - rect[1] : rect[2] - rect[0];
- const color = _editor.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
- return {
- annotationType: _util.AnnotationEditorType.INK,
- color,
- thickness: this.thickness,
- opacity: this.opacity,
- paths: this.#serializePaths(this.scaleFactor / this.parentScale, this.translationX, this.translationY, height),
- pageIndex: this.pageIndex,
- rect,
- rotation: this.rotation
- };
+ const padding = FreeTextEditor._internalPadding * this.parentScale;
+ this.#initialData.rect = this.getRect(padding, padding);
}
}
-exports.InkEditor = InkEditor;
+
+ exports.FreeTextEditor = FreeTextEditor;
/***/ }),
-/* 30 */
+ /* 29 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -11658,320 +14158,13 @@ exports.InkEditor = InkEditor;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.fitCurve = void 0;
-const fitCurve = __w_pdfjs_require__(31);
-exports.fitCurve = fitCurve;
-
-/***/ }),
-/* 31 */
-/***/ ((module) => {
-
-
-
-function fitCurve(points, maxError, progressCallback) {
- if (!Array.isArray(points)) {
- throw new TypeError("First argument should be an array");
- }
- points.forEach(point => {
- if (!Array.isArray(point) || point.some(item => typeof item !== 'number') || point.length !== points[0].length) {
- throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.");
- }
- });
- points = points.filter((point, i) => i === 0 || !point.every((val, j) => val === points[i - 1][j]));
- if (points.length < 2) {
- return [];
- }
- const len = points.length;
- const leftTangent = createTangent(points[1], points[0]);
- const rightTangent = createTangent(points[len - 2], points[len - 1]);
- return fitCubic(points, leftTangent, rightTangent, maxError, progressCallback);
-}
-function fitCubic(points, leftTangent, rightTangent, error, progressCallback) {
- const MaxIterations = 20;
- var bezCurve, u, uPrime, maxError, prevErr, splitPoint, prevSplit, centerVector, toCenterTangent, fromCenterTangent, beziers, dist, i;
- if (points.length === 2) {
- dist = maths.vectorLen(maths.subtract(points[0], points[1])) / 3.0;
- bezCurve = [points[0], maths.addArrays(points[0], maths.mulItems(leftTangent, dist)), maths.addArrays(points[1], maths.mulItems(rightTangent, dist)), points[1]];
- return [bezCurve];
- }
- u = chordLengthParameterize(points);
- [bezCurve, maxError, splitPoint] = generateAndReport(points, u, u, leftTangent, rightTangent, progressCallback);
- if (maxError === 0 || maxError < error) {
- return [bezCurve];
- }
- if (maxError < error * error) {
- uPrime = u;
- prevErr = maxError;
- prevSplit = splitPoint;
- for (i = 0; i < MaxIterations; i++) {
- uPrime = reparameterize(bezCurve, points, uPrime);
- [bezCurve, maxError, splitPoint] = generateAndReport(points, u, uPrime, leftTangent, rightTangent, progressCallback);
- if (maxError < error) {
- return [bezCurve];
- } else if (splitPoint === prevSplit) {
- let errChange = maxError / prevErr;
- if (errChange > .9999 && errChange < 1.0001) {
- break;
- }
- }
- prevErr = maxError;
- prevSplit = splitPoint;
- }
- }
- beziers = [];
- centerVector = maths.subtract(points[splitPoint - 1], points[splitPoint + 1]);
- if (centerVector.every(val => val === 0)) {
- centerVector = maths.subtract(points[splitPoint - 1], points[splitPoint]);
- [centerVector[0], centerVector[1]] = [-centerVector[1], centerVector[0]];
- }
- toCenterTangent = maths.normalize(centerVector);
- fromCenterTangent = maths.mulItems(toCenterTangent, -1);
- beziers = beziers.concat(fitCubic(points.slice(0, splitPoint + 1), leftTangent, toCenterTangent, error, progressCallback));
- beziers = beziers.concat(fitCubic(points.slice(splitPoint), fromCenterTangent, rightTangent, error, progressCallback));
- return beziers;
-}
-;
-function generateAndReport(points, paramsOrig, paramsPrime, leftTangent, rightTangent, progressCallback) {
- var bezCurve, maxError, splitPoint;
- bezCurve = generateBezier(points, paramsPrime, leftTangent, rightTangent, progressCallback);
- [maxError, splitPoint] = computeMaxError(points, bezCurve, paramsOrig);
- if (progressCallback) {
- progressCallback({
- bez: bezCurve,
- points: points,
- params: paramsOrig,
- maxErr: maxError,
- maxPoint: splitPoint
- });
- }
- return [bezCurve, maxError, splitPoint];
-}
-function generateBezier(points, parameters, leftTangent, rightTangent) {
- var bezCurve,
- A,
- a,
- C,
- X,
- det_C0_C1,
- det_C0_X,
- det_X_C1,
- alpha_l,
- alpha_r,
- epsilon,
- segLength,
- i,
- len,
- tmp,
- u,
- ux,
- firstPoint = points[0],
- lastPoint = points[points.length - 1];
- bezCurve = [firstPoint, null, null, lastPoint];
- A = maths.zeros_Xx2x2(parameters.length);
- for (i = 0, len = parameters.length; i < len; i++) {
- u = parameters[i];
- ux = 1 - u;
- a = A[i];
- a[0] = maths.mulItems(leftTangent, 3 * u * (ux * ux));
- a[1] = maths.mulItems(rightTangent, 3 * ux * (u * u));
- }
- C = [[0, 0], [0, 0]];
- X = [0, 0];
- for (i = 0, len = points.length; i < len; i++) {
- u = parameters[i];
- a = A[i];
- C[0][0] += maths.dot(a[0], a[0]);
- C[0][1] += maths.dot(a[0], a[1]);
- C[1][0] += maths.dot(a[0], a[1]);
- C[1][1] += maths.dot(a[1], a[1]);
- tmp = maths.subtract(points[i], bezier.q([firstPoint, firstPoint, lastPoint, lastPoint], u));
- X[0] += maths.dot(a[0], tmp);
- X[1] += maths.dot(a[1], tmp);
- }
- det_C0_C1 = C[0][0] * C[1][1] - C[1][0] * C[0][1];
- det_C0_X = C[0][0] * X[1] - C[1][0] * X[0];
- det_X_C1 = X[0] * C[1][1] - X[1] * C[0][1];
- alpha_l = det_C0_C1 === 0 ? 0 : det_X_C1 / det_C0_C1;
- alpha_r = det_C0_C1 === 0 ? 0 : det_C0_X / det_C0_C1;
- segLength = maths.vectorLen(maths.subtract(firstPoint, lastPoint));
- epsilon = 1.0e-6 * segLength;
- if (alpha_l < epsilon || alpha_r < epsilon) {
- bezCurve[1] = maths.addArrays(firstPoint, maths.mulItems(leftTangent, segLength / 3.0));
- bezCurve[2] = maths.addArrays(lastPoint, maths.mulItems(rightTangent, segLength / 3.0));
- } else {
- bezCurve[1] = maths.addArrays(firstPoint, maths.mulItems(leftTangent, alpha_l));
- bezCurve[2] = maths.addArrays(lastPoint, maths.mulItems(rightTangent, alpha_r));
- }
- return bezCurve;
-}
-;
-function reparameterize(bezier, points, parameters) {
- return parameters.map((p, i) => newtonRaphsonRootFind(bezier, points[i], p));
-}
-;
-function newtonRaphsonRootFind(bez, point, u) {
- var d = maths.subtract(bezier.q(bez, u), point),
- qprime = bezier.qprime(bez, u),
- numerator = maths.mulMatrix(d, qprime),
- denominator = maths.sum(maths.squareItems(qprime)) + 2 * maths.mulMatrix(d, bezier.qprimeprime(bez, u));
- if (denominator === 0) {
- return u;
- } else {
- return u - numerator / denominator;
- }
-}
-;
-function chordLengthParameterize(points) {
- var u = [],
- currU,
- prevU,
- prevP;
- points.forEach((p, i) => {
- currU = i ? prevU + maths.vectorLen(maths.subtract(p, prevP)) : 0;
- u.push(currU);
- prevU = currU;
- prevP = p;
- });
- u = u.map(x => x / prevU);
- return u;
-}
-;
-function computeMaxError(points, bez, parameters) {
- var dist, maxDist, splitPoint, v, i, count, point, t;
- maxDist = 0;
- splitPoint = Math.floor(points.length / 2);
- const t_distMap = mapTtoRelativeDistances(bez, 10);
- for (i = 0, count = points.length; i < count; i++) {
- point = points[i];
- t = find_t(bez, parameters[i], t_distMap, 10);
- v = maths.subtract(bezier.q(bez, t), point);
- dist = v[0] * v[0] + v[1] * v[1];
- if (dist > maxDist) {
- maxDist = dist;
- splitPoint = i;
- }
- }
- return [maxDist, splitPoint];
-}
-;
-var mapTtoRelativeDistances = function (bez, B_parts) {
- var B_t_curr;
- var B_t_dist = [0];
- var B_t_prev = bez[0];
- var sumLen = 0;
- for (var i = 1; i <= B_parts; i++) {
- B_t_curr = bezier.q(bez, i / B_parts);
- sumLen += maths.vectorLen(maths.subtract(B_t_curr, B_t_prev));
- B_t_dist.push(sumLen);
- B_t_prev = B_t_curr;
- }
- B_t_dist = B_t_dist.map(x => x / sumLen);
- return B_t_dist;
-};
-function find_t(bez, param, t_distMap, B_parts) {
- if (param < 0) {
- return 0;
- }
- if (param > 1) {
- return 1;
- }
- var lenMax, lenMin, tMax, tMin, t;
- for (var i = 1; i <= B_parts; i++) {
- if (param <= t_distMap[i]) {
- tMin = (i - 1) / B_parts;
- tMax = i / B_parts;
- lenMin = t_distMap[i - 1];
- lenMax = t_distMap[i];
- t = (param - lenMin) / (lenMax - lenMin) * (tMax - tMin) + tMin;
- break;
- }
- }
- return t;
-}
-function createTangent(pointA, pointB) {
- return maths.normalize(maths.subtract(pointA, pointB));
-}
-class maths {
- static zeros_Xx2x2(x) {
- var zs = [];
- while (x--) {
- zs.push([0, 0]);
- }
- return zs;
- }
- static mulItems(items, multiplier) {
- return items.map(x => x * multiplier);
- }
- static mulMatrix(m1, m2) {
- return m1.reduce((sum, x1, i) => sum + x1 * m2[i], 0);
- }
- static subtract(arr1, arr2) {
- return arr1.map((x1, i) => x1 - arr2[i]);
- }
- static addArrays(arr1, arr2) {
- return arr1.map((x1, i) => x1 + arr2[i]);
- }
- static addItems(items, addition) {
- return items.map(x => x + addition);
- }
- static sum(items) {
- return items.reduce((sum, x) => sum + x);
- }
- static dot(m1, m2) {
- return maths.mulMatrix(m1, m2);
- }
- static vectorLen(v) {
- return Math.hypot(...v);
- }
- static divItems(items, divisor) {
- return items.map(x => x / divisor);
- }
- static squareItems(items) {
- return items.map(x => x * x);
- }
- static normalize(v) {
- return this.divItems(v, this.vectorLen(v));
- }
-}
-class bezier {
- static q(ctrlPoly, t) {
- var tx = 1.0 - t;
- var pA = maths.mulItems(ctrlPoly[0], tx * tx * tx),
- pB = maths.mulItems(ctrlPoly[1], 3 * tx * tx * t),
- pC = maths.mulItems(ctrlPoly[2], 3 * tx * t * t),
- pD = maths.mulItems(ctrlPoly[3], t * t * t);
- return maths.addArrays(maths.addArrays(pA, pB), maths.addArrays(pC, pD));
- }
- static qprime(ctrlPoly, t) {
- var tx = 1.0 - t;
- var pA = maths.mulItems(maths.subtract(ctrlPoly[1], ctrlPoly[0]), 3 * tx * tx),
- pB = maths.mulItems(maths.subtract(ctrlPoly[2], ctrlPoly[1]), 6 * tx * t),
- pC = maths.mulItems(maths.subtract(ctrlPoly[3], ctrlPoly[2]), 3 * t * t);
- return maths.addArrays(maths.addArrays(pA, pB), pC);
- }
- static qprimeprime(ctrlPoly, t) {
- return maths.addArrays(maths.mulItems(maths.addArrays(maths.subtract(ctrlPoly[2], maths.mulItems(ctrlPoly[1], 2)), ctrlPoly[0]), 6 * (1.0 - t)), maths.mulItems(maths.addArrays(maths.subtract(ctrlPoly[3], maths.mulItems(ctrlPoly[2], 2)), ctrlPoly[1]), 6 * t));
- }
-}
-module.exports = fitCurve;
-module.exports.fitCubic = fitCubic;
-module.exports.createTangent = createTangent;
-
-/***/ }),
-/* 32 */
-/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
- value: true
-}));
-exports.AnnotationLayer = void 0;
+ exports.StampAnnotationElement = exports.InkAnnotationElement = exports.FreeTextAnnotationElement = exports.AnnotationLayer = void 0;
var _util = __w_pdfjs_require__(1);
var _display_utils = __w_pdfjs_require__(6);
var _annotation_storage = __w_pdfjs_require__(3);
-var _scripting_utils = __w_pdfjs_require__(33);
-var _xfa_layer = __w_pdfjs_require__(34);
+ var _scripting_utils = __w_pdfjs_require__(30);
+ var _displayL10n_utils = __w_pdfjs_require__(31);
+ var _xfa_layer = __w_pdfjs_require__(32);
const DEFAULT_TAB_INDEX = 1000;
const DEFAULT_FONT_SIZE = 9;
const GetElementsByNameSet = new WeakSet();
@@ -12003,6 +14196,8 @@ class AnnotationElementFactory {
return new PushButtonWidgetAnnotationElement(parameters);
case "Ch":
return new ChoiceWidgetAnnotationElement(parameters);
+ case "Sig":
+ return new SignatureWidgetAnnotationElement(parameters);
}
return new WidgetAnnotationElement(parameters);
case _util.AnnotationType.POPUP:
@@ -12041,6 +14236,7 @@ class AnnotationElementFactory {
}
}
class AnnotationElement {
+ #hasBorder = false;
constructor(parameters, {
isRenderable = false,
ignoreBorder = false,
@@ -12049,8 +14245,6 @@ class AnnotationElement {
this.isRenderable = isRenderable;
this.data = parameters.data;
this.layer = parameters.layer;
- this.page = parameters.page;
- this.viewport = parameters.viewport;
this.linkService = parameters.linkService;
this.downloadManager = parameters.downloadManager;
this.imageResourcesPath = parameters.imageResourcesPath;
@@ -12060,27 +14254,62 @@ class AnnotationElement {
this.enableScripting = parameters.enableScripting;
this.hasJSActions = parameters.hasJSActions;
this._fieldObjects = parameters.fieldObjects;
+ this.parent = parameters.parent;
if (isRenderable) {
this.container = this._createContainer(ignoreBorder);
}
if (createQuadrilaterals) {
- this.quadrilaterals = this._createQuadrilaterals(ignoreBorder);
+ this._createQuadrilaterals();
}
}
- _createContainer(ignoreBorder = false) {
+
+ static _hasPopupData({
+ titleObj,
+ contentsObj,
+ richText
+ }) {
+ return !!(titleObj?.str || contentsObj?.str || richText?.str);
+ }
+
+ get hasPopupData() {
+ return AnnotationElement._hasPopupData(this.data);
+ }
+
+ _createContainer(ignoreBorder) {
const {
data,
- page,
- viewport
+ parent: {
+ page,
+ viewport
+ }
} = this;
const container = document.createElement("section");
container.setAttribute("data-annotation-id", data.id);
+ if (!(this instanceof WidgetAnnotationElement)) {
+ container.tabIndex = DEFAULT_TAB_INDEX;
+ }
+ container.style.zIndex = this.parent.zIndex++;
+ if (this.data.popupRef) {
+ container.setAttribute("aria-haspopup", "dialog");
+ }
+ if (data.noRotate) {
+ container.classList.add("norotate");
+ }
const {
pageWidth,
pageHeight,
pageX,
pageY
} = viewport.rawDims;
+ if (!data.rect || this instanceof PopupAnnotationElement) {
+ const {
+ rotation
+ } = data;
+ if (!data.hasOwnCanvas && rotation !== 0) {
+ this.setRotation(rotation, container);
+ }
+ return container;
+ }
const {
width,
height
@@ -12118,6 +14347,7 @@ class AnnotationElement {
}
const borderColor = data.borderColor || null;
if (borderColor) {
+ this.#hasBorder = true;
container.style.borderColor = _util.Util.makeHexColor(borderColor[0] | 0, borderColor[1] | 0, borderColor[2] | 0);
} else {
container.style.borderWidth = 0;
@@ -12137,10 +14367,13 @@ class AnnotationElement {
return container;
}
setRotation(angle, container = this.container) {
+ if (!this.data.rect) {
+ return;
+ }
const {
pageWidth,
pageHeight
- } = this.viewport.rawDims;
+ } = this.parent.viewport.rawDims;
const {
width,
height
@@ -12160,26 +14393,38 @@ class AnnotationElement {
get _commonActions() {
const setColor = (jsName, styleName, event) => {
const color = event.detail[jsName];
- event.target.style[styleName] = _scripting_utils.ColorConverters[`${color[0]}_HTML`](color.slice(1));
+ const colorType = color[0];
+ const colorArray = color.slice(1);
+ event.target.style[styleName] = _scripting_utils.ColorConverters[`${colorType}_HTML`](colorArray);
+ this.annotationStorage.setValue(this.data.id, {
+ [styleName]: _scripting_utils.ColorConverters[`${colorType}_rgb`](colorArray)
+ });
};
return (0, _util.shadow)(this, "_commonActions", {
display: event => {
- const hidden = event.detail.display % 2 === 1;
+ const {
+ display
+ } = event.detail;
+ const hidden = display % 2 === 1;
this.container.style.visibility = hidden ? "hidden" : "visible";
this.annotationStorage.setValue(this.data.id, {
- hidden,
- print: event.detail.display === 0 || event.detail.display === 3
+ noView: hidden,
+ noPrint: display === 1 || display === 2
});
},
print: event => {
this.annotationStorage.setValue(this.data.id, {
- print: event.detail.print
+ noPrint: !event.detail.print
});
},
hidden: event => {
- this.container.style.visibility = event.detail.hidden ? "hidden" : "visible";
+ const {
+ hidden
+ } = event.detail;
+ this.container.style.visibility = hidden ? "hidden" : "visible";
this.annotationStorage.setValue(this.data.id, {
- hidden: event.detail.hidden
+ noPrint: hidden,
+ noView: hidden
});
},
focus: event => {
@@ -12191,11 +14436,7 @@ class AnnotationElement {
event.target.title = event.detail.userName;
},
readonly: event => {
- if (event.detail.readonly) {
- event.target.setAttribute("readonly", "");
- } else {
- event.target.removeAttribute("readonly");
- }
+ event.target.disabled = event.detail.readonly;
},
required: event => {
this._setRequired(event.target, event.detail.required);
@@ -12257,49 +14498,108 @@ class AnnotationElement {
}
}
}
- _createQuadrilaterals(ignoreBorder = false) {
- if (!this.data.quadPoints) {
- return null;
+
+ _createQuadrilaterals() {
+ if (!this.container) {
+ return;
+ }
+ const {
+ quadPoints
+ } = this.data;
+ if (!quadPoints) {
+ return;
}
- const quadrilaterals = [];
- const savedRect = this.data.rect;
- for (const quadPoint of this.data.quadPoints) {
- this.data.rect = [quadPoint[2].x, quadPoint[2].y, quadPoint[1].x, quadPoint[1].y];
- quadrilaterals.push(this._createContainer(ignoreBorder));
+ const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect;
+ if (quadPoints.length === 1) {
+ const [, {
+ x: trX,
+ y: trY
+ }, {
+ x: blX,
+ y: blY
+ }] = quadPoints[0];
+ if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
+ return;
+ }
+ }
+ const {
+ style
+ } = this.container;
+ let svgBuffer;
+ if (this.#hasBorder) {
+ const {
+ borderColor,
+ borderWidth
+ } = style;
+ style.borderWidth = 0;
+ svgBuffer = ["url('data:image/svg+xml;utf8,", `')`);
+ style.backgroundImage = svgBuffer.join("");
+ }
+ this.container.append(svg);
+ this.container.style.clipPath = `url(#${id})`;
}
- const popupElement = new PopupElement({
+
+ _createPopup() {
+ const {
container,
- trigger,
- color: data.color,
- titleObj: data.titleObj,
- modificationDate: data.modificationDate,
- contentsObj: data.contentsObj,
- richText: data.richText,
- hideWrapper: true
+ data
+ } = this;
+ container.setAttribute("aria-haspopup", "dialog");
+ const popup = new PopupAnnotationElement({
+ data: {
+ color: data.color,
+ titleObj: data.titleObj,
+ modificationDate: data.modificationDate,
+ contentsObj: data.contentsObj,
+ richText: data.richText,
+ parentRect: data.rect,
+ borderStyle: 0,
+ id: `popup_${data.id}`,
+ rotation: data.rotation
+ },
+ parent: this.parent,
+ elements: [this]
});
- const popup = popupElement.render();
- popup.style.left = "100%";
- container.append(popup);
- }
- _renderQuadrilaterals(className) {
- for (const quadrilateral of this.quadrilaterals) {
- quadrilateral.className = className;
- }
- return this.quadrilaterals;
+ this.parent.div.append(popup.render());
}
render() {
(0, _util.unreachable)("Abstract method `AnnotationElement.render` called");
@@ -12354,6 +14654,51 @@ class AnnotationElement {
}
return fields;
}
+
+ show() {
+ if (this.container) {
+ this.container.hidden = false;
+ }
+ this.popup?.maybeShow();
+ }
+
+ hide() {
+ if (this.container) {
+ this.container.hidden = true;
+ }
+ this.popup?.forceHide();
+ }
+
+ getElementsToTriggerPopup() {
+ return this.container;
+ }
+
+ addHighlightArea() {
+ const triggers = this.getElementsToTriggerPopup();
+ if (Array.isArray(triggers)) {
+ for (const element of triggers) {
+ element.classList.add("highlightArea");
+ }
+ } else {
+ triggers.classList.add("highlightArea");
+ }
+ }
+
+ _editOnDoubleClick() {
+ const {
+ annotationEditorType: mode,
+ data: {
+ id: editId
+ }
+ } = this;
+ this.container.addEventListener("dblclick", () => {
+ this.linkService.eventBus?.dispatch("switchannotationeditormode", {
+ source: this,
+ mode,
+ editId
+ });
+ });
+ }
}
class LinkAnnotationElement extends AnnotationElement {
constructor(parameters, options = null) {
@@ -12400,14 +14745,7 @@ class LinkAnnotationElement extends AnnotationElement {
isBound = true;
}
}
- if (this.quadrilaterals) {
- return this._renderQuadrilaterals("linkAnnotation").map((quadrilateral, index) => {
- const linkElement = index === 0 ? link : link.cloneNode();
- quadrilateral.append(linkElement);
- return quadrilateral;
- });
- }
- this.container.className = "linkAnnotation";
+ this.container.classList.add("linkAnnotation");
if (isBound) {
this.container.append(link);
}
@@ -12581,13 +14919,12 @@ class LinkAnnotationElement extends AnnotationElement {
}
class TextAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable
+ isRenderable: true
});
}
render() {
- this.container.className = "textAnnotation";
+ this.container.classList.add("textAnnotation");
const image = document.createElement("img");
image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
image.alt = "[{{type}} Annotation]";
@@ -12595,8 +14932,8 @@ class TextAnnotationElement extends AnnotationElement {
image.dataset.l10nArgs = JSON.stringify({
type: this.data.name
});
- if (!this.data.hasPopup) {
- this._createPopup(image, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
this.container.append(image);
return this.container;
@@ -12609,6 +14946,15 @@ class WidgetAnnotationElement extends AnnotationElement {
}
return this.container;
}
+
+ showElementAndHideCanvas(element) {
+ if (this.data.hasOwnCanvas) {
+ if (element.previousSibling?.nodeName === "CANVAS") {
+ element.previousSibling.hidden = true;
+ }
+ element.hidden = false;
+ }
+ }
_getKeyModifier(event) {
const {
isWin,
@@ -12616,7 +14962,8 @@ class WidgetAnnotationElement extends AnnotationElement {
} = _util.FeatureTest.platform;
return isWin && event.ctrlKey || isMac && event.metaKey;
}
- _setEventListener(element, baseName, eventName, valueGetter) {
+
+ _setEventListener(element, elementData, baseName, eventName, valueGetter) {
if (baseName.includes("mouse")) {
element.addEventListener(baseName, event => {
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
@@ -12632,6 +14979,20 @@ class WidgetAnnotationElement extends AnnotationElement {
});
} else {
element.addEventListener(baseName, event => {
+ if (baseName === "blur") {
+ if (!elementData.focused || !event.relatedTarget) {
+ return;
+ }
+ elementData.focused = false;
+ } else if (baseName === "focus") {
+ if (elementData.focused) {
+ return;
+ }
+ elementData.focused = true;
+ }
+ if (!valueGetter) {
+ return;
+ }
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
source: this,
detail: {
@@ -12643,10 +15004,21 @@ class WidgetAnnotationElement extends AnnotationElement {
});
}
}
- _setEventListeners(element, names, getter) {
+
+ _setEventListeners(element, elementData, names, getter) {
for (const [baseName, eventName] of names) {
if (eventName === "Action" || this.data.actions?.[eventName]) {
- this._setEventListener(element, baseName, eventName, getter);
+ if (eventName === "Focus" || eventName === "Blur") {
+ elementData ||= {
+ focused: false
+ };
+ }
+ this._setEventListener(element, elementData, baseName, eventName, getter);
+ if (eventName === "Focus" && !this.data.actions?.Blur) {
+ this._setEventListener(element, elementData, "blur", "Blur", null);
+ } else if (eventName === "Blur" && !this.data.actions?.Focus) {
+ this._setEventListener(element, elementData, "focus", "Focus", null);
+ }
}
}
}
@@ -12709,39 +15081,47 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
render() {
const storage = this.annotationStorage;
const id = this.data.id;
- this.container.className = "textWidgetAnnotation";
+ this.container.classList.add("textWidgetAnnotation");
let element = null;
if (this.renderForms) {
const storedData = storage.getValue(id, {
value: this.data.fieldValue
});
- let textContent = storedData.formattedValue || storedData.value || "";
+ let textContent = storedData.value || "";
const maxLen = storage.getValue(id, {
charLimit: this.data.maxLen
}).charLimit;
if (maxLen && textContent.length > maxLen) {
textContent = textContent.slice(0, maxLen);
}
+ let fieldFormattedValues = storedData.formattedValue || this.data.textContent?.join("\n") || null;
+ if (fieldFormattedValues && this.data.comb) {
+ fieldFormattedValues = fieldFormattedValues.replaceAll(/\s+/g, "");
+ }
const elementData = {
userValue: textContent,
- formattedValue: null,
+ formattedValue: fieldFormattedValues,
lastCommittedValue: null,
- commitKey: 1
+ commitKey: 1,
+ focused: false
};
if (this.data.multiLine) {
element = document.createElement("textarea");
- element.textContent = textContent;
+ element.textContent = fieldFormattedValues ?? textContent;
if (this.data.doNotScroll) {
element.style.overflowY = "hidden";
}
} else {
element = document.createElement("input");
element.type = "text";
- element.setAttribute("value", textContent);
+ element.setAttribute("value", fieldFormattedValues ?? textContent);
if (this.data.doNotScroll) {
element.style.overflowX = "hidden";
}
}
+ if (this.data.hasOwnCanvas) {
+ element.hidden = true;
+ }
GetElementsByNameSet.add(element);
element.setAttribute("data-element-id", id);
element.disabled = this.data.readOnly;
@@ -12756,6 +15136,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
value: event.target.value
});
this.setPropertyOnSiblings(element, "value", event.target.value, "value");
+ elementData.formattedValue = null;
});
element.addEventListener("resetform", event => {
const defaultValue = this.data.defaultFieldValue ?? "";
@@ -12773,6 +15154,9 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
};
if (this.enableScripting && this.hasJSActions) {
element.addEventListener("focus", event => {
+ if (elementData.focused) {
+ return;
+ }
const {
target
} = event;
@@ -12781,8 +15165,10 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
}
elementData.lastCommittedValue = target.value;
elementData.commitKey = 1;
+ elementData.focused = true;
});
element.addEventListener("updatefromsandbox", jsEvent => {
+ this.showElementAndHideCanvas(jsEvent.target);
const actions = {
value(event) {
elementData.userValue = event.detail.value ?? "";
@@ -12880,9 +15266,10 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
const _blurListener = blurListener;
blurListener = null;
element.addEventListener("blur", event => {
- if (!event.relatedTarget) {
+ if (!elementData.focused || !event.relatedTarget) {
return;
}
+ elementData.focused = false;
const {
value
} = event.target;
@@ -12960,7 +15347,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
});
});
}
- this._setEventListeners(element, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.value);
+ this._setEventListeners(element, elementData, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.value);
}
if (blurListener) {
element.addEventListener("blur", blurListener);
@@ -12984,6 +15371,14 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
return this.container;
}
}
+
+ class SignatureWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: !!parameters.data.hasOwnCanvas
+ });
+ }
+ }
class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
constructor(parameters) {
super(parameters, {
@@ -13003,7 +15398,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
value
});
}
- this.container.className = "buttonWidgetAnnotation checkBox";
+ this.container.classList.add("buttonWidgetAnnotation", "checkBox");
const element = document.createElement("input");
GetElementsByNameSet.add(element);
element.setAttribute("data-element-id", id);
@@ -13050,7 +15445,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
};
this._dispatchEventFromSandbox(actions, jsEvent);
});
- this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
+ this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
}
this._setBackgroundColor(element);
this._setDefaultPropertiesFromJS(element);
@@ -13065,7 +15460,7 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
});
}
render() {
- this.container.className = "buttonWidgetAnnotation radioButton";
+ this.container.classList.add("buttonWidgetAnnotation", "radioButton");
const storage = this.annotationStorage;
const data = this.data;
const id = data.id;
@@ -13126,7 +15521,7 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
};
this._dispatchEventFromSandbox(actions, jsEvent);
});
- this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
+ this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
}
this._setBackgroundColor(element);
this._setDefaultPropertiesFromJS(element);
@@ -13142,7 +15537,7 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
}
render() {
const container = super.render();
- container.className = "buttonWidgetAnnotation pushButton";
+ container.classList.add("buttonWidgetAnnotation", "pushButton");
if (this.data.alternativeText) {
container.title = this.data.alternativeText;
}
@@ -13163,7 +15558,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
});
}
render() {
- this.container.className = "choiceWidgetAnnotation";
+ this.container.classList.add("choiceWidgetAnnotation");
const storage = this.annotationStorage;
const id = this.data.id;
const storedData = storage.getValue(id, {
@@ -13361,7 +15756,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
}
});
});
- this._setEventListeners(selectElement, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"]], event => event.target.checked);
+ this._setEventListeners(selectElement, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], event => event.target.value);
} else {
selectElement.addEventListener("input", function (event) {
storage.setValue(id, {
@@ -13379,119 +15774,191 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
}
}
class PopupAnnotationElement extends AnnotationElement {
- static IGNORE_TYPES = new Set(["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"]);
constructor(parameters) {
const {
- data
+ data,
+ elements
} = parameters;
- const isRenderable = !PopupAnnotationElement.IGNORE_TYPES.has(data.parentType) && !!(data.titleObj?.str || data.contentsObj?.str || data.richText?.str);
super(parameters, {
- isRenderable
+ isRenderable: AnnotationElement._hasPopupData(data)
});
+ this.elements = elements;
}
render() {
- this.container.className = "popupAnnotation";
- const parentElements = this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);
- if (parentElements.length === 0) {
- return this.container;
- }
+ this.container.classList.add("popupAnnotation");
const popup = new PopupElement({
container: this.container,
- trigger: Array.from(parentElements),
color: this.data.color,
titleObj: this.data.titleObj,
modificationDate: this.data.modificationDate,
contentsObj: this.data.contentsObj,
- richText: this.data.richText
+ richText: this.data.richText,
+ rect: this.data.rect,
+ parentRect: this.data.parentRect || null,
+ parent: this.parent,
+ elements: this.elements,
+ open: this.data.open
});
- const page = this.page;
- const rect = _util.Util.normalizeRect([this.data.parentRect[0], page.view[3] - this.data.parentRect[1] + page.view[1], this.data.parentRect[2], page.view[3] - this.data.parentRect[3] + page.view[1]]);
- const popupLeft = rect[0] + this.data.parentRect[2] - this.data.parentRect[0];
- const popupTop = rect[1];
- const {
- pageWidth,
- pageHeight,
- pageX,
- pageY
- } = this.viewport.rawDims;
- this.container.style.left = `${100 * (popupLeft - pageX) / pageWidth}%`;
- this.container.style.top = `${100 * (popupTop - pageY) / pageHeight}%`;
- this.container.append(popup.render());
- return this.container;
+ const elementIds = [];
+ for (const element of this.elements) {
+ element.popup = popup;
+ elementIds.push(element.data.id);
+ element.addHighlightArea();
+ }
+ this.container.setAttribute("aria-controls", elementIds.map(id => `${_util.AnnotationPrefix}${id}`).join(","));
+ return this.container;
}
}
-class PopupElement {
- constructor(parameters) {
- this.container = parameters.container;
- this.trigger = parameters.trigger;
- this.color = parameters.color;
- this.titleObj = parameters.titleObj;
- this.modificationDate = parameters.modificationDate;
- this.contentsObj = parameters.contentsObj;
- this.richText = parameters.richText;
- this.hideWrapper = parameters.hideWrapper || false;
- this.pinned = false;
- }
- render() {
- const BACKGROUND_ENLIGHT = 0.7;
- const wrapper = document.createElement("div");
- wrapper.className = "popupWrapper";
- this.hideElement = this.hideWrapper ? wrapper : this.container;
- this.hideElement.hidden = true;
- const popup = document.createElement("div");
- popup.className = "popup";
- const color = this.color;
- if (color) {
- const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
- const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
- const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
- popup.style.backgroundColor = _util.Util.makeHexColor(r | 0, g | 0, b | 0);
- }
+
+ class PopupElement {
+ #dateTimePromise = null;
+ #boundKeyDown = this.#keyDown.bind(this);
+ #boundHide = this.#hide.bind(this);
+ #boundShow = this.#show.bind(this);
+ #boundToggle = this.#toggle.bind(this);
+ #color = null;
+ #container = null;
+ #contentsObj = null;
+ #elements = null;
+ #parent = null;
+ #parentRect = null;
+ #pinned = false;
+ #popup = null;
+ #rect = null;
+ #richText = null;
+ #titleObj = null;
+ #wasVisible = false;
+
+ constructor({
+ container,
+ color,
+ elements,
+ titleObj,
+ modificationDate,
+ contentsObj,
+ richText,
+ parent,
+ rect,
+ parentRect,
+ open
+ }) {
+ this.#container = container;
+ this.#titleObj = titleObj;
+ this.#contentsObj = contentsObj;
+ this.#richText = richText;
+ this.#parent = parent;
+ this.#color = color;
+ this.#rect = rect;
+ this.#parentRect = parentRect;
+ this.#elements = elements;
+ const dateObject = _display_utils.PDFDateString.toDateObject(modificationDate);
+ if (dateObject) {
+ this.#dateTimePromise = parent.l10n.get("annotation_date_string", {
+ date: dateObject.toLocaleDateString(),
+ time: dateObject.toLocaleTimeString()
+ });
+ }
+ this.trigger = elements.flatMap(e => e.getElementsToTriggerPopup());
+ for (const element of this.trigger) {
+ element.addEventListener("click", this.#boundToggle);
+ element.addEventListener("mouseenter", this.#boundShow);
+ element.addEventListener("mouseleave", this.#boundHide);
+ element.classList.add("popupTriggerArea");
+ }
+ for (const element of elements) {
+ element.container?.addEventListener("keydown", this.#boundKeyDown);
+ }
+ this.#container.hidden = true;
+ if (open) {
+ this.#toggle();
+ }
+ }
+
+ render() {
+ if (this.#popup) {
+ return;
+ }
+ const {
+ page: {
+ view
+ },
+ viewport: {
+ rawDims: {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ }
+ }
+ } = this.#parent;
+ const popup = this.#popup = document.createElement("div");
+ popup.className = "popup";
+ if (this.#color) {
+ const baseColor = popup.style.outlineColor = _util.Util.makeHexColor(...this.#color);
+ if (CSS.supports("background-color", "color-mix(in srgb, red 30%, white)")) {
+ popup.style.backgroundColor = `color-mix(in srgb, ${baseColor} 30%, white)`;
+ } else {
+ const BACKGROUND_ENLIGHT = 0.7;
+ popup.style.backgroundColor = _util.Util.makeHexColor(...this.#color.map(c => Math.floor(BACKGROUND_ENLIGHT * (255 - c) + c)));
+ }
+ }
+ const header = document.createElement("span");
+ header.className = "header";
const title = document.createElement("h1");
- title.dir = this.titleObj.dir;
- title.textContent = this.titleObj.str;
- popup.append(title);
- const dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);
- if (dateObject) {
+ header.append(title);
+ ({
+ dir: title.dir,
+ str: title.textContent
+ } = this.#titleObj);
+ popup.append(header);
+ if (this.#dateTimePromise) {
const modificationDate = document.createElement("span");
- modificationDate.className = "popupDate";
- modificationDate.textContent = "{{date}}, {{time}}";
- modificationDate.dataset.l10nId = "annotation_date_string";
- modificationDate.dataset.l10nArgs = JSON.stringify({
- date: dateObject.toLocaleDateString(),
- time: dateObject.toLocaleTimeString()
+ modificationDate.classList.add("popupDate");
+ this.#dateTimePromise.then(localized => {
+ modificationDate.textContent = localized;
});
- popup.append(modificationDate);
+ header.append(modificationDate);
}
- if (this.richText?.str && (!this.contentsObj?.str || this.contentsObj.str === this.richText.str)) {
+ const contentsObj = this.#contentsObj;
+ const richText = this.#richText;
+ if (richText?.str && (!contentsObj?.str || contentsObj.str === richText.str)) {
_xfa_layer.XfaLayer.render({
- xfaHtml: this.richText.html,
+ xfaHtml: richText.html,
intent: "richText",
div: popup
});
- popup.lastChild.className = "richText popupContent";
+ popup.lastChild.classList.add("richText", "popupContent");
} else {
- const contents = this._formatContents(this.contentsObj);
+ const contents = this._formatContents(contentsObj);
popup.append(contents);
}
- if (!Array.isArray(this.trigger)) {
- this.trigger = [this.trigger];
+ let useParentRect = !!this.#parentRect;
+ let rect = useParentRect ? this.#parentRect : this.#rect;
+ for (const element of this.#elements) {
+ if (!rect || _util.Util.intersect(element.data.rect, rect) !== null) {
+ rect = element.data.rect;
+ useParentRect = true;
+ break;
+ }
}
- for (const element of this.trigger) {
- element.addEventListener("click", this._toggle.bind(this));
- element.addEventListener("mouseover", this._show.bind(this, false));
- element.addEventListener("mouseout", this._hide.bind(this, false));
- }
- popup.addEventListener("click", this._hide.bind(this, true));
- wrapper.append(popup);
- return wrapper;
+ const normalizedRect = _util.Util.normalizeRect([rect[0], view[3] - rect[1] + view[1], rect[2], view[3] - rect[3] + view[1]]);
+ const HORIZONTAL_SPACE_AFTER_ANNOTATION = 5;
+ const parentWidth = useParentRect ? rect[2] - rect[0] + HORIZONTAL_SPACE_AFTER_ANNOTATION : 0;
+ const popupLeft = normalizedRect[0] + parentWidth;
+ const popupTop = normalizedRect[1];
+ const {
+ style
+ } = this.#container;
+ style.left = `${100 * (popupLeft - pageX) / pageWidth}%`;
+ style.top = `${100 * (popupTop - pageY) / pageHeight}%`;
+ this.#container.append(popup);
}
_formatContents({
str,
dir
}) {
const p = document.createElement("p");
- p.className = "popupContent";
+ p.classList.add("popupContent");
p.dir = dir;
const lines = str.split(/(?:\r\n?|\n)/);
for (let i = 0, ii = lines.length; i < ii; ++i) {
@@ -13503,46 +15970,85 @@ class PopupElement {
}
return p;
}
- _toggle() {
- if (this.pinned) {
- this._hide(true);
+
+ #keyDown(event) {
+ if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
+ return;
+ }
+ if (event.key === "Enter" || event.key === "Escape" && this.#pinned) {
+ this.#toggle();
+ }
+ }
+
+ #toggle() {
+ this.#pinned = !this.#pinned;
+ if (this.#pinned) {
+ this.#show();
+ this.#container.addEventListener("click", this.#boundToggle);
+ this.#container.addEventListener("keydown", this.#boundKeyDown);
} else {
- this._show(true);
+ this.#hide();
+ this.#container.removeEventListener("click", this.#boundToggle);
+ this.#container.removeEventListener("keydown", this.#boundKeyDown);
+ }
+ }
+
+ #show() {
+ if (!this.#popup) {
+ this.render();
+ }
+ if (!this.isVisible) {
+ this.#container.hidden = false;
+ this.#container.style.zIndex = parseInt(this.#container.style.zIndex) + 1000;
+ } else if (this.#pinned) {
+ this.#container.classList.add("focused");
}
}
- _show(pin = false) {
- if (pin) {
- this.pinned = true;
+
+ #hide() {
+ this.#container.classList.remove("focused");
+ if (this.#pinned || !this.isVisible) {
+ return;
}
- if (this.hideElement.hidden) {
- this.hideElement.hidden = false;
- this.container.style.zIndex = parseInt(this.container.style.zIndex) + 1000;
- }
- }
- _hide(unpin = true) {
- if (unpin) {
- this.pinned = false;
- }
- if (!this.hideElement.hidden && !this.pinned) {
- this.hideElement.hidden = true;
- this.container.style.zIndex = parseInt(this.container.style.zIndex) - 1000;
+ this.#container.hidden = true;
+ this.#container.style.zIndex = parseInt(this.#container.style.zIndex) - 1000;
+ }
+
+ forceHide() {
+ this.#wasVisible = this.isVisible;
+ if (!this.#wasVisible) {
+ return;
+ }
+ this.#container.hidden = true;
+ }
+
+ maybeShow() {
+ if (!this.#wasVisible) {
+ return;
}
+ this.#wasVisible = false;
+ this.#container.hidden = false;
+ }
+
+ get isVisible() {
+ return this.#container.hidden === false;
}
}
class FreeTextAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
this.textContent = parameters.data.textContent;
+ this.textPosition = parameters.data.textPosition;
+ this.annotationEditorType = _util.AnnotationEditorType.FREETEXT;
}
render() {
- this.container.className = "freeTextAnnotation";
+ this.container.classList.add("freeTextAnnotation");
if (this.textContent) {
const content = document.createElement("div");
- content.className = "annotationTextContent";
+ content.classList.add("annotationTextContent");
content.setAttribute("role", "comment");
for (const line of this.textContent) {
const lineSpan = document.createElement("span");
@@ -13551,29 +16057,32 @@ class FreeTextAnnotationElement extends AnnotationElement {
}
this.container.append(content);
}
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
+ this._editOnDoubleClick();
return this.container;
}
}
+
+ exports.FreeTextAnnotationElement = FreeTextAnnotationElement;
class LineAnnotationElement extends AnnotationElement {
+ #line = null;
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
}
render() {
- this.container.className = "lineAnnotation";
+ this.container.classList.add("lineAnnotation");
const data = this.data;
const {
width,
height
} = getRectDims(data.rect);
const svg = this.svgFactory.create(width, height, true);
- const line = this.svgFactory.createElement("svg:line");
+ const line = this.#line = this.svgFactory.createElement("svg:line");
line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
@@ -13583,20 +16092,30 @@ class LineAnnotationElement extends AnnotationElement {
line.setAttribute("fill", "transparent");
svg.append(line);
this.container.append(svg);
- this._createPopup(line, data);
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
return this.container;
}
+
+ getElementsToTriggerPopup() {
+ return this.#line;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
}
class SquareAnnotationElement extends AnnotationElement {
+ #square = null;
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
}
render() {
- this.container.className = "squareAnnotation";
+ this.container.classList.add("squareAnnotation");
const data = this.data;
const {
width,
@@ -13604,7 +16123,7 @@ class SquareAnnotationElement extends AnnotationElement {
} = getRectDims(data.rect);
const svg = this.svgFactory.create(width, height, true);
const borderWidth = data.borderStyle.width;
- const square = this.svgFactory.createElement("svg:rect");
+ const square = this.#square = this.svgFactory.createElement("svg:rect");
square.setAttribute("x", borderWidth / 2);
square.setAttribute("y", borderWidth / 2);
square.setAttribute("width", width - borderWidth);
@@ -13614,20 +16133,30 @@ class SquareAnnotationElement extends AnnotationElement {
square.setAttribute("fill", "transparent");
svg.append(square);
this.container.append(svg);
- this._createPopup(square, data);
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
return this.container;
}
+
+ getElementsToTriggerPopup() {
+ return this.#square;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
}
class CircleAnnotationElement extends AnnotationElement {
+ #circle = null;
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
}
render() {
- this.container.className = "circleAnnotation";
+ this.container.classList.add("circleAnnotation");
const data = this.data;
const {
width,
@@ -13635,7 +16164,7 @@ class CircleAnnotationElement extends AnnotationElement {
} = getRectDims(data.rect);
const svg = this.svgFactory.create(width, height, true);
const borderWidth = data.borderStyle.width;
- const circle = this.svgFactory.createElement("svg:ellipse");
+ const circle = this.#circle = this.svgFactory.createElement("svg:ellipse");
circle.setAttribute("cx", width / 2);
circle.setAttribute("cy", height / 2);
circle.setAttribute("rx", width / 2 - borderWidth / 2);
@@ -13645,22 +16174,32 @@ class CircleAnnotationElement extends AnnotationElement {
circle.setAttribute("fill", "transparent");
svg.append(circle);
this.container.append(svg);
- this._createPopup(circle, data);
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
return this.container;
}
+
+ getElementsToTriggerPopup() {
+ return this.#circle;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
}
class PolylineAnnotationElement extends AnnotationElement {
+ #polyline = null;
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
this.containerClassName = "polylineAnnotation";
this.svgElementName = "svg:polyline";
}
render() {
- this.container.className = this.containerClassName;
+ this.container.classList.add(this.containerClassName);
const data = this.data;
const {
width,
@@ -13674,16 +16213,26 @@ class PolylineAnnotationElement extends AnnotationElement {
points.push(x + "," + y);
}
points = points.join(" ");
- const polyline = this.svgFactory.createElement(this.svgElementName);
+ const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
polyline.setAttribute("points", points);
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
polyline.setAttribute("stroke", "transparent");
polyline.setAttribute("fill", "transparent");
svg.append(polyline);
this.container.append(svg);
- this._createPopup(polyline, data);
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
return this.container;
}
+
+ getElementsToTriggerPopup() {
+ return this.#polyline;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
}
class PolygonAnnotationElement extends PolylineAnnotationElement {
constructor(parameters) {
@@ -13694,32 +16243,32 @@ class PolygonAnnotationElement extends PolylineAnnotationElement {
}
class CaretAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
}
render() {
- this.container.className = "caretAnnotation";
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ this.container.classList.add("caretAnnotation");
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
return this.container;
}
}
class InkAnnotationElement extends AnnotationElement {
+ #polylines = [];
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
this.containerClassName = "inkAnnotation";
this.svgElementName = "svg:polyline";
+ this.annotationEditorType = _util.AnnotationEditorType.INK;
}
render() {
- this.container.className = this.containerClassName;
+ this.container.classList.add(this.containerClassName);
const data = this.data;
const {
width,
@@ -13735,114 +16284,113 @@ class InkAnnotationElement extends AnnotationElement {
}
points = points.join(" ");
const polyline = this.svgFactory.createElement(this.svgElementName);
+ this.#polylines.push(polyline);
polyline.setAttribute("points", points);
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
polyline.setAttribute("stroke", "transparent");
polyline.setAttribute("fill", "transparent");
- this._createPopup(polyline, data);
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
svg.append(polyline);
}
this.container.append(svg);
return this.container;
}
+
+ getElementsToTriggerPopup() {
+ return this.#polylines;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
}
+
+ exports.InkAnnotationElement = InkAnnotationElement;
class HighlightAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true,
createQuadrilaterals: true
});
}
render() {
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
- if (this.quadrilaterals) {
- return this._renderQuadrilaterals("highlightAnnotation");
- }
- this.container.className = "highlightAnnotation";
+ this.container.classList.add("highlightAnnotation");
return this.container;
}
}
class UnderlineAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true,
createQuadrilaterals: true
});
}
render() {
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
- if (this.quadrilaterals) {
- return this._renderQuadrilaterals("underlineAnnotation");
- }
- this.container.className = "underlineAnnotation";
+ this.container.classList.add("underlineAnnotation");
return this.container;
}
}
class SquigglyAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true,
createQuadrilaterals: true
});
}
render() {
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
- if (this.quadrilaterals) {
- return this._renderQuadrilaterals("squigglyAnnotation");
- }
- this.container.className = "squigglyAnnotation";
+ this.container.classList.add("squigglyAnnotation");
return this.container;
}
}
class StrikeOutAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true,
createQuadrilaterals: true
});
}
render() {
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
- if (this.quadrilaterals) {
- return this._renderQuadrilaterals("strikeoutAnnotation");
- }
- this.container.className = "strikeoutAnnotation";
+ this.container.classList.add("strikeoutAnnotation");
return this.container;
}
}
class StampAnnotationElement extends AnnotationElement {
constructor(parameters) {
- const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);
super(parameters, {
- isRenderable,
+ isRenderable: true,
ignoreBorder: true
});
}
render() {
- this.container.className = "stampAnnotation";
- if (!this.data.hasPopup) {
- this._createPopup(null, this.data);
+ this.container.classList.add("stampAnnotation");
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
}
return this.container;
}
}
+
+ exports.StampAnnotationElement = StampAnnotationElement;
class FileAttachmentAnnotationElement extends AnnotationElement {
+ #trigger = null;
constructor(parameters) {
super(parameters, {
isRenderable: true
@@ -13860,46 +16408,92 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
});
}
render() {
- this.container.className = "fileAttachmentAnnotation";
+ this.container.classList.add("fileAttachmentAnnotation");
+ const {
+ container,
+ data
+ } = this;
let trigger;
- if (this.data.hasAppearance) {
+ if (data.hasAppearance || data.fillAlpha === 0) {
trigger = document.createElement("div");
} else {
trigger = document.createElement("img");
- trigger.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name) ? "paperclip" : "pushpin"}.svg`;
+ trigger.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(data.name) ? "paperclip" : "pushpin"}.svg`;
+ if (data.fillAlpha && data.fillAlpha < 1) {
+ trigger.style = `filter: opacity(${Math.round(data.fillAlpha * 100)}%);`;
+ }
+ }
+ trigger.addEventListener("dblclick", this.#download.bind(this));
+ this.#trigger = trigger;
+ const {
+ isMac
+ } = _util.FeatureTest.platform;
+ container.addEventListener("keydown", evt => {
+ if (evt.key === "Enter" && (isMac ? evt.metaKey : evt.ctrlKey)) {
+ this.#download();
+ }
+ });
+ if (!data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ } else {
+ trigger.classList.add("popupTriggerArea");
}
- trigger.className = "popupTriggerArea";
- trigger.addEventListener("dblclick", this._download.bind(this));
- if (!this.data.hasPopup && (this.data.titleObj?.str || this.data.contentsObj?.str || this.data.richText)) {
- this._createPopup(trigger, this.data);
- }
- this.container.append(trigger);
- return this.container;
+ container.append(trigger);
+ return container;
}
- _download() {
+
+ getElementsToTriggerPopup() {
+ return this.#trigger;
+ }
+
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
+
+ #download() {
this.downloadManager?.openOrDownloadData(this.container, this.content, this.filename);
}
}
class AnnotationLayer {
- static #appendElement(element, id, div, accessibilityManager) {
+ #accessibilityManager = null;
+ #annotationCanvasMap = null;
+ #editableAnnotations = new Map();
+
+ constructor({
+ div,
+ accessibilityManager,
+ annotationCanvasMap,
+ l10n,
+ page,
+ viewport
+ }) {
+ this.div = div;
+ this.#accessibilityManager = accessibilityManager;
+ this.#annotationCanvasMap = annotationCanvasMap;
+ this.l10n = l10n;
+ this.page = page;
+ this.viewport = viewport;
+ this.zIndex = 0;
+ this.l10n ||= _displayL10n_utils.NullL10n;
+ }
+
+ #appendElement(element, id) {
const contentElement = element.firstChild || element;
- contentElement.id = `${_display_utils.AnnotationPrefix}${id}`;
- div.append(element);
- accessibilityManager?.moveElementInDOM(div, element, contentElement, false);
+ contentElement.id = `${_util.AnnotationPrefix}${id}`;
+ this.div.append(element);
+ this.#accessibilityManager?.moveElementInDOM(this.div, element, contentElement, false);
}
- static render(params) {
+
+ async render(params) {
const {
- annotations,
- div,
- viewport,
- accessibilityManager
+ annotations
} = params;
- (0, _display_utils.setLayerDimensions)(div, viewport);
+ const layer = this.div;
+ (0, _display_utils.setLayerDimensions)(layer, this.viewport);
+ const popupToElements = new Map();
const elementParams = {
data: null,
- layer: div,
- page: params.page,
- viewport,
+ layer,
linkService: params.linkService,
downloadManager: params.downloadManager,
imageResourcesPath: params.imageResourcesPath || "",
@@ -13908,11 +16502,16 @@ class AnnotationLayer {
annotationStorage: params.annotationStorage || new _annotation_storage.AnnotationStorage(),
enableScripting: params.enableScripting === true,
hasJSActions: params.hasJSActions,
- fieldObjects: params.fieldObjects
+ fieldObjects: params.fieldObjects,
+ parent: this,
+ elements: null
};
- let zIndex = 0;
for (const data of annotations) {
- if (data.annotationType !== _util.AnnotationType.POPUP) {
+ if (data.noHTML) {
+ continue;
+ }
+ const isPopupAnnotation = data.annotationType === _util.AnnotationType.POPUP;
+ if (!isPopupAnnotation) {
const {
width,
height
@@ -13920,50 +16519,58 @@ class AnnotationLayer {
if (width <= 0 || height <= 0) {
continue;
}
+ } else {
+ const elements = popupToElements.get(data.id);
+ if (!elements) {
+ continue;
+ }
+ elementParams.elements = elements;
}
elementParams.data = data;
const element = AnnotationElementFactory.create(elementParams);
if (!element.isRenderable) {
continue;
}
+ if (!isPopupAnnotation && data.popupRef) {
+ const elements = popupToElements.get(data.popupRef);
+ if (!elements) {
+ popupToElements.set(data.popupRef, [element]);
+ } else {
+ elements.push(element);
+ }
+ }
+ if (element.annotationEditorType > 0) {
+ this.#editableAnnotations.set(element.data.id, element);
+ }
const rendered = element.render();
if (data.hidden) {
rendered.style.visibility = "hidden";
}
- if (Array.isArray(rendered)) {
- for (const renderedElement of rendered) {
- renderedElement.style.zIndex = zIndex++;
- AnnotationLayer.#appendElement(renderedElement, data.id, div, accessibilityManager);
- }
- } else {
- rendered.style.zIndex = zIndex++;
- if (element instanceof PopupAnnotationElement) {
- div.prepend(rendered);
- } else {
- AnnotationLayer.#appendElement(rendered, data.id, div, accessibilityManager);
- }
- }
+ this.#appendElement(rendered, data.id);
}
- this.#setAnnotationCanvasMap(div, params.annotationCanvasMap);
- }
- static update(params) {
- const {
- annotationCanvasMap,
- div,
- viewport
- } = params;
- (0, _display_utils.setLayerDimensions)(div, {
+ this.#setAnnotationCanvasMap();
+ await this.l10n.translate(layer);
+ }
+
+ update({
+ viewport
+ }) {
+ const layer = this.div;
+ this.viewport = viewport;
+ (0, _display_utils.setLayerDimensions)(layer, {
rotation: viewport.rotation
});
- this.#setAnnotationCanvasMap(div, annotationCanvasMap);
- div.hidden = false;
+ this.#setAnnotationCanvasMap();
+ layer.hidden = false;
}
- static #setAnnotationCanvasMap(div, annotationCanvasMap) {
- if (!annotationCanvasMap) {
+
+ #setAnnotationCanvasMap() {
+ if (!this.#annotationCanvasMap) {
return;
}
- for (const [id, canvas] of annotationCanvasMap) {
- const element = div.querySelector(`[data-annotation-id="${id}"]`);
+ const layer = this.div;
+ for (const [id, canvas] of this.#annotationCanvasMap) {
+ const element = layer.querySelector(`[data-annotation-id="${id}"]`);
if (!element) {
continue;
}
@@ -13978,13 +16585,21 @@ class AnnotationLayer {
firstChild.before(canvas);
}
}
- annotationCanvasMap.clear();
+ this.#annotationCanvasMap.clear();
+ }
+
+ getEditableAnnotations() {
+ return Array.from(this.#editableAnnotations.values());
+ }
+
+ getEditableAnnotation(id) {
+ return this.#editableAnnotations.get(id);
}
}
exports.AnnotationLayer = AnnotationLayer;
/***/ }),
-/* 33 */
+ /* 30 */
/***/ ((__unused_webpack_module, exports) => {
@@ -13996,6 +16611,10 @@ exports.ColorConverters = void 0;
function makeColorComp(n) {
return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
}
+
+ function scaleAndClamp(x) {
+ return Math.max(0, Math.min(255, 255 * x));
+ }
class ColorConverters {
static CMYK_G([c, y, m, k]) {
return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
@@ -14006,6 +16625,11 @@ class ColorConverters {
static G_RGB([g]) {
return ["RGB", g, g, g];
}
+
+ static G_rgb([g]) {
+ g = scaleAndClamp(g);
+ return [g, g, g];
+ }
static G_HTML([g]) {
const G = makeColorComp(g);
return `#${G}${G}${G}`;
@@ -14013,18 +16637,28 @@ class ColorConverters {
static RGB_G([r, g, b]) {
return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
}
- static RGB_HTML([r, g, b]) {
- const R = makeColorComp(r);
- const G = makeColorComp(g);
- const B = makeColorComp(b);
- return `#${R}${G}${B}`;
+
+ static RGB_rgb(color) {
+ return color.map(scaleAndClamp);
+ }
+
+ static RGB_HTML(color) {
+ return `#${color.map(makeColorComp).join("")}`;
}
static T_HTML() {
return "#00000000";
}
+
+ static T_rgb() {
+ return [null];
+ }
static CMYK_RGB([c, y, m, k]) {
return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
}
+
+ static CMYK_rgb([c, y, m, k]) {
+ return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))];
+ }
static CMYK_HTML(components) {
const rgb = this.CMYK_RGB(components).slice(1);
return this.RGB_HTML(rgb);
@@ -14040,7 +16674,109 @@ class ColorConverters {
exports.ColorConverters = ColorConverters;
/***/ }),
-/* 34 */
+ /* 31 */
+ /***/ ((__unused_webpack_module, exports) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.NullL10n = void 0;
+ exports.getL10nFallback = getL10nFallback;
+ const DEFAULT_L10N_STRINGS = {
+ of_pages: "of {{pagesCount}}",
+ page_of_pages: "({{pageNumber}} of {{pagesCount}})",
+ document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
+ document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
+ document_properties_date_string: "{{date}}, {{time}}",
+ document_properties_page_size_unit_inches: "in",
+ document_properties_page_size_unit_millimeters: "mm",
+ document_properties_page_size_orientation_portrait: "portrait",
+ document_properties_page_size_orientation_landscape: "landscape",
+ document_properties_page_size_name_a3: "A3",
+ document_properties_page_size_name_a4: "A4",
+ document_properties_page_size_name_letter: "Letter",
+ document_properties_page_size_name_legal: "Legal",
+ document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
+ document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
+ document_properties_linearized_yes: "Yes",
+ document_properties_linearized_no: "No",
+ additional_layers: "Additional Layers",
+ page_landmark: "Page {{page}}",
+ thumb_page_title: "Page {{page}}",
+ thumb_page_canvas: "Thumbnail of Page {{page}}",
+ find_reached_top: "Reached top of document, continued from bottom",
+ find_reached_bottom: "Reached end of document, continued from top",
+ "find_match_count[one]": "{{current}} of {{total}} match",
+ "find_match_count[other]": "{{current}} of {{total}} matches",
+ "find_match_count_limit[one]": "More than {{limit}} match",
+ "find_match_count_limit[other]": "More than {{limit}} matches",
+ find_not_found: "Phrase not found",
+ page_scale_width: "Page Width",
+ page_scale_fit: "Page Fit",
+ page_scale_auto: "Automatic Zoom",
+ page_scale_actual: "Actual Size",
+ page_scale_percent: "{{scale}}%",
+ loading_error: "An error occurred while loading the PDF.",
+ invalid_file_error: "Invalid or corrupted PDF file.",
+ missing_file_error: "Missing PDF file.",
+ unexpected_response_error: "Unexpected server response.",
+ rendering_error: "An error occurred while rendering the page.",
+ annotation_date_string: "{{date}}, {{time}}",
+ printing_not_supported: "Warning: Printing is not fully supported by this browser.",
+ printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
+ web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.",
+ free_text2_default_content: "Start typing…",
+ editor_free_text2_aria_label: "Text Editor",
+ editor_ink2_aria_label: "Draw Editor",
+ editor_ink_canvas_aria_label: "User-created image",
+ editor_alt_text_button_label: "Alt text",
+ editor_alt_text_edit_button_label: "Edit alt text",
+ editor_alt_text_decorative_tooltip: "Marked as decorative"
+ };
+ {
+ DEFAULT_L10N_STRINGS.print_progress_percent = "{{progress}}%";
+ }
+
+ function getL10nFallback(key, args) {
+ switch (key) {
+ case "find_match_count":
+ key = `find_match_count[${args.total === 1 ? "one" : "other"}]`;
+ break;
+ case "find_match_count_limit":
+ key = `find_match_count_limit[${args.limit === 1 ? "one" : "other"}]`;
+ break;
+ }
+ return DEFAULT_L10N_STRINGS[key] || "";
+ }
+
+ function formatL10nValue(text, args) {
+ if (!args) {
+ return text;
+ }
+ return text.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => {
+ return name in args ? args[name] : "{{" + name + "}}";
+ });
+ }
+
+ const NullL10n = {
+ async getLanguage() {
+ return "en-us";
+ },
+ async getDirection() {
+ return "ltr";
+ },
+ async get(key, args = null, fallback = getL10nFallback(key, args)) {
+ return formatL10nValue(fallback, args);
+ },
+ async translate(element) {
+ }
+ };
+ exports.NullL10n = NullL10n;
+
+ /***/
+ }),
+ /* 32 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -14049,7 +16785,7 @@ Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.XfaLayer = void 0;
-var _xfa_text = __w_pdfjs_require__(19);
+ var _xfa_text = __w_pdfjs_require__(25);
class XfaLayer {
static setupStorage(html, id, element, storage, intent) {
const storedData = storage.getValue(id, {
@@ -14100,9 +16836,12 @@ class XfaLayer {
break;
case "select":
if (storedData.value !== null) {
+ html.setAttribute("value", storedData.value);
for (const option of element.children) {
if (option.attributes.value === storedData.value) {
option.attributes.selected = true;
+ } else if (option.attributes.hasOwnProperty("selected")) {
+ delete option.attributes.selected;
}
}
}
@@ -14208,12 +16947,7 @@ class XfaLayer {
html.append(node);
continue;
}
- let childHtml;
- if (child?.attributes?.xmlns) {
- childHtml = document.createElementNS(child.attributes.xmlns, name);
- } else {
- childHtml = document.createElement(name);
- }
+ const childHtml = child?.attributes?.xmlns ? document.createElementNS(child.attributes.xmlns, name) : document.createElement(name);
html.append(childHtml);
if (child.attributes) {
this.setAttributes({
@@ -14250,7 +16984,7 @@ class XfaLayer {
exports.XfaLayer = XfaLayer;
/***/ }),
-/* 35 */
+ /* 33 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@@ -14258,1277 +16992,1261 @@ exports.XfaLayer = XfaLayer;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
-exports.SVGGraphics = void 0;
-var _display_utils = __w_pdfjs_require__(6);
+ exports.InkEditor = void 0;
var _util = __w_pdfjs_require__(1);
-var _is_node = __w_pdfjs_require__(10);
-let SVGGraphics = class {
- constructor() {
- (0, _util.unreachable)("Not implemented: SVGGraphics");
- }
-};
-exports.SVGGraphics = SVGGraphics;
-{
- const SVG_DEFAULTS = {
- fontStyle: "normal",
- fontWeight: "normal",
- fillColor: "#000000"
- };
- const XML_NS = "http://www.w3.org/XML/1998/namespace";
- const XLINK_NS = "http://www.w3.org/1999/xlink";
- const LINE_CAP_STYLES = ["butt", "round", "square"];
- const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
- const createObjectURL = function (data, contentType = "", forceDataSchema = false) {
- if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
- return URL.createObjectURL(new Blob([data], {
- type: contentType
- }));
+ var _editor = __w_pdfjs_require__(4);
+ var _annotation_layer = __w_pdfjs_require__(29);
+ var _display_utils = __w_pdfjs_require__(6);
+ var _tools = __w_pdfjs_require__(5);
+
+ class InkEditor extends _editor.AnnotationEditor {
+ #baseHeight = 0;
+ #baseWidth = 0;
+ #boundCanvasPointermove = this.canvasPointermove.bind(this);
+ #boundCanvasPointerleave = this.canvasPointerleave.bind(this);
+ #boundCanvasPointerup = this.canvasPointerup.bind(this);
+ #boundCanvasPointerdown = this.canvasPointerdown.bind(this);
+ #currentPath2D = new Path2D();
+ #disableEditing = false;
+ #hasSomethingToDraw = false;
+ #isCanvasInitialized = false;
+ #observer = null;
+ #realWidth = 0;
+ #realHeight = 0;
+ #requestFrameCallback = null;
+ static _defaultColor = null;
+ static _defaultOpacity = 1;
+ static _defaultThickness = 1;
+ static _type = "ink";
+
+ constructor(params) {
+ super({
+ ...params,
+ name: "inkEditor"
+ });
+ this.color = params.color || null;
+ this.thickness = params.thickness || null;
+ this.opacity = params.opacity || null;
+ this.paths = [];
+ this.bezierPath2D = [];
+ this.allRawPaths = [];
+ this.currentPath = [];
+ this.scaleFactor = 1;
+ this.translationX = this.translationY = 0;
+ this.x = 0;
+ this.y = 0;
+ this._willKeepAspectRatio = true;
+ }
+
+ static initialize(l10n) {
+ _editor.AnnotationEditor.initialize(l10n, {
+ strings: ["editor_ink_canvas_aria_label", "editor_ink2_aria_label"]
+ });
+ }
+
+ static updateDefaultParams(type, value) {
+ switch (type) {
+ case _util.AnnotationEditorParamsType.INK_THICKNESS:
+ InkEditor._defaultThickness = value;
+ break;
+ case _util.AnnotationEditorParamsType.INK_COLOR:
+ InkEditor._defaultColor = value;
+ break;
+ case _util.AnnotationEditorParamsType.INK_OPACITY:
+ InkEditor._defaultOpacity = value / 100;
+ break;
+ }
+ }
+
+ updateParams(type, value) {
+ switch (type) {
+ case _util.AnnotationEditorParamsType.INK_THICKNESS:
+ this.#updateThickness(value);
+ break;
+ case _util.AnnotationEditorParamsType.INK_COLOR:
+ this.#updateColor(value);
+ break;
+ case _util.AnnotationEditorParamsType.INK_OPACITY:
+ this.#updateOpacity(value);
+ break;
+ }
+ }
+
+ static get defaultPropertiesToUpdate() {
+ return [[_util.AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(InkEditor._defaultOpacity * 100)]];
+ }
+
+ get propertiesToUpdate() {
+ return [[_util.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? InkEditor._defaultOpacity))]];
+ }
+
+ #updateThickness(thickness) {
+ const savedThickness = this.thickness;
+ this.addCommands({
+ cmd: () => {
+ this.thickness = thickness;
+ this.#fitToContent();
+ },
+ undo: () => {
+ this.thickness = savedThickness;
+ this.#fitToContent();
+ },
+ mustExec: true,
+ type: _util.AnnotationEditorParamsType.INK_THICKNESS,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ }
+
+ #updateColor(color) {
+ const savedColor = this.color;
+ this.addCommands({
+ cmd: () => {
+ this.color = color;
+ this.#redraw();
+ },
+ undo: () => {
+ this.color = savedColor;
+ this.#redraw();
+ },
+ mustExec: true,
+ type: _util.AnnotationEditorParamsType.INK_COLOR,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ }
+
+ #updateOpacity(opacity) {
+ opacity /= 100;
+ const savedOpacity = this.opacity;
+ this.addCommands({
+ cmd: () => {
+ this.opacity = opacity;
+ this.#redraw();
+ },
+ undo: () => {
+ this.opacity = savedOpacity;
+ this.#redraw();
+ },
+ mustExec: true,
+ type: _util.AnnotationEditorParamsType.INK_OPACITY,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ }
+
+ rebuild() {
+ if (!this.parent) {
+ return;
+ }
+ super.rebuild();
+ if (this.div === null) {
+ return;
+ }
+ if (!this.canvas) {
+ this.#createCanvas();
+ this.#createObserver();
+ }
+ if (!this.isAttachedToDOM) {
+ this.parent.add(this);
+ this.#setCanvasDims();
+ }
+ this.#fitToContent();
+ }
+
+ remove() {
+ if (this.canvas === null) {
+ return;
+ }
+ if (!this.isEmpty()) {
+ this.commit();
+ }
+ this.canvas.width = this.canvas.height = 0;
+ this.canvas.remove();
+ this.canvas = null;
+ this.#observer.disconnect();
+ this.#observer = null;
+ super.remove();
+ }
+
+ setParent(parent) {
+ if (!this.parent && parent) {
+ this._uiManager.removeShouldRescale(this);
+ } else if (this.parent && parent === null) {
+ this._uiManager.addShouldRescale(this);
+ }
+ super.setParent(parent);
+ }
+
+ onScaleChanging() {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ const width = this.width * parentWidth;
+ const height = this.height * parentHeight;
+ this.setDimensions(width, height);
+ }
+
+ enableEditMode() {
+ if (this.#disableEditing || this.canvas === null) {
+ return;
+ }
+ super.enableEditMode();
+ this._isDraggable = false;
+ this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
+ }
+
+ disableEditMode() {
+ if (!this.isInEditMode() || this.canvas === null) {
+ return;
+ }
+ super.disableEditMode();
+ this._isDraggable = !this.isEmpty();
+ this.div.classList.remove("editing");
+ this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
+ }
+
+ onceAdded() {
+ this._isDraggable = !this.isEmpty();
+ }
+
+ isEmpty() {
+ return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
+ }
+
+ #getInitialBBox() {
+ const {
+ parentRotation,
+ parentDimensions: [width, height]
+ } = this;
+ switch (parentRotation) {
+ case 90:
+ return [0, height, height, width];
+ case 180:
+ return [width, height, width, height];
+ case 270:
+ return [width, 0, height, width];
+ default:
+ return [0, 0, width, height];
+ }
+ }
+
+ #setStroke() {
+ const {
+ ctx,
+ color,
+ opacity,
+ thickness,
+ parentScale,
+ scaleFactor
+ } = this;
+ ctx.lineWidth = thickness * parentScale / scaleFactor;
+ ctx.lineCap = "round";
+ ctx.lineJoin = "round";
+ ctx.miterLimit = 10;
+ ctx.strokeStyle = `${color}${(0, _tools.opacityToHex)(opacity)}`;
+ }
+
+ #startDrawing(x, y) {
+ this.canvas.addEventListener("contextmenu", _display_utils.noContextMenu);
+ this.canvas.addEventListener("pointerleave", this.#boundCanvasPointerleave);
+ this.canvas.addEventListener("pointermove", this.#boundCanvasPointermove);
+ this.canvas.addEventListener("pointerup", this.#boundCanvasPointerup);
+ this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
+ this.isEditing = true;
+ if (!this.#isCanvasInitialized) {
+ this.#isCanvasInitialized = true;
+ this.#setCanvasDims();
+ this.thickness ||= InkEditor._defaultThickness;
+ this.color ||= InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor;
+ this.opacity ??= InkEditor._defaultOpacity;
}
- const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- let buffer = `data:${contentType};base64,`;
- for (let i = 0, ii = data.length; i < ii; i += 3) {
- const b1 = data[i] & 0xff;
- const b2 = data[i + 1] & 0xff;
- const b3 = data[i + 2] & 0xff;
- const d1 = b1 >> 2,
- d2 = (b1 & 3) << 4 | b2 >> 4;
- const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
- const d4 = i + 2 < ii ? b3 & 0x3f : 64;
- buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
- }
- return buffer;
- };
- const convertImgDataToPng = function () {
- const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
- const CHUNK_WRAPPER_SIZE = 12;
- const crcTable = new Int32Array(256);
- for (let i = 0; i < 256; i++) {
- let c = i;
- for (let h = 0; h < 8; h++) {
- if (c & 1) {
- c = 0xedb88320 ^ c >> 1 & 0x7fffffff;
- } else {
- c = c >> 1 & 0x7fffffff;
- }
- }
- crcTable[i] = c;
- }
- function crc32(data, start, end) {
- let crc = -1;
- for (let i = start; i < end; i++) {
- const a = (crc ^ data[i]) & 0xff;
- const b = crcTable[a];
- crc = crc >>> 8 ^ b;
- }
- return crc ^ -1;
- }
- function writePngChunk(type, body, data, offset) {
- let p = offset;
- const len = body.length;
- data[p] = len >> 24 & 0xff;
- data[p + 1] = len >> 16 & 0xff;
- data[p + 2] = len >> 8 & 0xff;
- data[p + 3] = len & 0xff;
- p += 4;
- data[p] = type.charCodeAt(0) & 0xff;
- data[p + 1] = type.charCodeAt(1) & 0xff;
- data[p + 2] = type.charCodeAt(2) & 0xff;
- data[p + 3] = type.charCodeAt(3) & 0xff;
- p += 4;
- data.set(body, p);
- p += body.length;
- const crc = crc32(data, offset + 4, p);
- data[p] = crc >> 24 & 0xff;
- data[p + 1] = crc >> 16 & 0xff;
- data[p + 2] = crc >> 8 & 0xff;
- data[p + 3] = crc & 0xff;
- }
- function adler32(data, start, end) {
- let a = 1;
- let b = 0;
- for (let i = start; i < end; ++i) {
- a = (a + (data[i] & 0xff)) % 65521;
- b = (b + a) % 65521;
- }
- return b << 16 | a;
- }
- function deflateSync(literals) {
- if (!_is_node.isNodeJS) {
- return deflateSyncUncompressed(literals);
- }
- try {
- let input;
- if (parseInt(process.versions.node) >= 8) {
- input = literals;
- } else {
- input = Buffer.from(literals);
- }
- const output = require("zlib").deflateSync(input, {
- level: 9
- });
- return output instanceof Uint8Array ? output : new Uint8Array(output);
- } catch (e) {
- (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e);
- }
- return deflateSyncUncompressed(literals);
- }
- function deflateSyncUncompressed(literals) {
- let len = literals.length;
- const maxBlockLength = 0xffff;
- const deflateBlocks = Math.ceil(len / maxBlockLength);
- const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
- let pi = 0;
- idat[pi++] = 0x78;
- idat[pi++] = 0x9c;
- let pos = 0;
- while (len > maxBlockLength) {
- idat[pi++] = 0x00;
- idat[pi++] = 0xff;
- idat[pi++] = 0xff;
- idat[pi++] = 0x00;
- idat[pi++] = 0x00;
- idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
- pi += maxBlockLength;
- pos += maxBlockLength;
- len -= maxBlockLength;
- }
- idat[pi++] = 0x01;
- idat[pi++] = len & 0xff;
- idat[pi++] = len >> 8 & 0xff;
- idat[pi++] = ~len & 0xffff & 0xff;
- idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
- idat.set(literals.subarray(pos), pi);
- pi += literals.length - pos;
- const adler = adler32(literals, 0, literals.length);
- idat[pi++] = adler >> 24 & 0xff;
- idat[pi++] = adler >> 16 & 0xff;
- idat[pi++] = adler >> 8 & 0xff;
- idat[pi++] = adler & 0xff;
- return idat;
- }
- function encode(imgData, kind, forceDataSchema, isMask) {
- const width = imgData.width;
- const height = imgData.height;
- let bitDepth, colorType, lineSize;
- const bytes = imgData.data;
- switch (kind) {
- case _util.ImageKind.GRAYSCALE_1BPP:
- colorType = 0;
- bitDepth = 1;
- lineSize = width + 7 >> 3;
- break;
- case _util.ImageKind.RGB_24BPP:
- colorType = 2;
- bitDepth = 8;
- lineSize = width * 3;
- break;
- case _util.ImageKind.RGBA_32BPP:
- colorType = 6;
- bitDepth = 8;
- lineSize = width * 4;
- break;
- default:
- throw new Error("invalid format");
- }
- const literals = new Uint8Array((1 + lineSize) * height);
- let offsetLiterals = 0,
- offsetBytes = 0;
- for (let y = 0; y < height; ++y) {
- literals[offsetLiterals++] = 0;
- literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
- offsetBytes += lineSize;
- offsetLiterals += lineSize;
- }
- if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
- offsetLiterals = 0;
- for (let y = 0; y < height; y++) {
- offsetLiterals++;
- for (let i = 0; i < lineSize; i++) {
- literals[offsetLiterals++] ^= 0xff;
- }
- }
- }
- const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);
- const idat = deflateSync(literals);
- const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
- const data = new Uint8Array(pngLength);
- let offset = 0;
- data.set(PNG_HEADER, offset);
- offset += PNG_HEADER.length;
- writePngChunk("IHDR", ihdr, data, offset);
- offset += CHUNK_WRAPPER_SIZE + ihdr.length;
- writePngChunk("IDATA", idat, data, offset);
- offset += CHUNK_WRAPPER_SIZE + idat.length;
- writePngChunk("IEND", new Uint8Array(0), data, offset);
- return createObjectURL(data, "image/png", forceDataSchema);
- }
- return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
- const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
- return encode(imgData, kind, forceDataSchema, isMask);
- };
- }();
- class SVGExtraState {
- constructor() {
- this.fontSizeScale = 1;
- this.fontWeight = SVG_DEFAULTS.fontWeight;
- this.fontSize = 0;
- this.textMatrix = _util.IDENTITY_MATRIX;
- this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
- this.leading = 0;
- this.textRenderingMode = _util.TextRenderingMode.FILL;
- this.textMatrixScale = 1;
- this.x = 0;
- this.y = 0;
- this.lineX = 0;
- this.lineY = 0;
- this.charSpacing = 0;
- this.wordSpacing = 0;
- this.textHScale = 1;
- this.textRise = 0;
- this.fillColor = SVG_DEFAULTS.fillColor;
- this.strokeColor = "#000000";
- this.fillAlpha = 1;
- this.strokeAlpha = 1;
- this.lineWidth = 1;
- this.lineJoin = "";
- this.lineCap = "";
- this.miterLimit = 0;
- this.dashArray = [];
- this.dashPhase = 0;
- this.dependencies = [];
- this.activeClipUrl = null;
- this.clipGroup = null;
- this.maskId = "";
- }
- clone() {
- return Object.create(this);
- }
- setCurrentPoint(x, y) {
- this.x = x;
- this.y = y;
- }
- }
- function opListToTree(opList) {
- let opTree = [];
- const tmp = [];
- for (const opListElement of opList) {
- if (opListElement.fn === "save") {
- opTree.push({
- fnId: 92,
- fn: "group",
- items: []
- });
- tmp.push(opTree);
- opTree = opTree.at(-1).items;
- continue;
- }
- if (opListElement.fn === "restore") {
- opTree = tmp.pop();
+ this.currentPath.push([x, y]);
+ this.#hasSomethingToDraw = false;
+ this.#setStroke();
+ this.#requestFrameCallback = () => {
+ this.#drawPoints();
+ if (this.#requestFrameCallback) {
+ window.requestAnimationFrame(this.#requestFrameCallback);
+ }
+ };
+ window.requestAnimationFrame(this.#requestFrameCallback);
+ }
+
+ #draw(x, y) {
+ const [lastX, lastY] = this.currentPath.at(-1);
+ if (this.currentPath.length > 1 && x === lastX && y === lastY) {
+ return;
+ }
+ const currentPath = this.currentPath;
+ let path2D = this.#currentPath2D;
+ currentPath.push([x, y]);
+ this.#hasSomethingToDraw = true;
+ if (currentPath.length <= 2) {
+ path2D.moveTo(...currentPath[0]);
+ path2D.lineTo(x, y);
+ return;
+ }
+ if (currentPath.length === 3) {
+ this.#currentPath2D = path2D = new Path2D();
+ path2D.moveTo(...currentPath[0]);
+ }
+ this.#makeBezierCurve(path2D, ...currentPath.at(-3), ...currentPath.at(-2), x, y);
+ }
+
+ #endPath() {
+ if (this.currentPath.length === 0) {
+ return;
+ }
+ const lastPoint = this.currentPath.at(-1);
+ this.#currentPath2D.lineTo(...lastPoint);
+ }
+
+ #stopDrawing(x, y) {
+ this.#requestFrameCallback = null;
+ x = Math.min(Math.max(x, 0), this.canvas.width);
+ y = Math.min(Math.max(y, 0), this.canvas.height);
+ this.#draw(x, y);
+ this.#endPath();
+ let bezier;
+ if (this.currentPath.length !== 1) {
+ bezier = this.#generateBezierPoints();
+ } else {
+ const xy = [x, y];
+ bezier = [[xy, xy.slice(), xy.slice(), xy]];
+ }
+ const path2D = this.#currentPath2D;
+ const currentPath = this.currentPath;
+ this.currentPath = [];
+ this.#currentPath2D = new Path2D();
+ const cmd = () => {
+ this.allRawPaths.push(currentPath);
+ this.paths.push(bezier);
+ this.bezierPath2D.push(path2D);
+ this.rebuild();
+ };
+ const undo = () => {
+ this.allRawPaths.pop();
+ this.paths.pop();
+ this.bezierPath2D.pop();
+ if (this.paths.length === 0) {
+ this.remove();
} else {
- opTree.push(opListElement);
+ if (!this.canvas) {
+ this.#createCanvas();
+ this.#createObserver();
+ }
+ this.#fitToContent();
+ }
+ };
+ this.addCommands({
+ cmd,
+ undo,
+ mustExec: true
+ });
+ }
+
+ #drawPoints() {
+ if (!this.#hasSomethingToDraw) {
+ return;
+ }
+ this.#hasSomethingToDraw = false;
+ const thickness = Math.ceil(this.thickness * this.parentScale);
+ const lastPoints = this.currentPath.slice(-3);
+ const x = lastPoints.map(xy => xy[0]);
+ const y = lastPoints.map(xy => xy[1]);
+ const xMin = Math.min(...x) - thickness;
+ const xMax = Math.max(...x) + thickness;
+ const yMin = Math.min(...y) - thickness;
+ const yMax = Math.max(...y) + thickness;
+ const {
+ ctx
+ } = this;
+ ctx.save();
+ ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
+ for (const path of this.bezierPath2D) {
+ ctx.stroke(path);
+ }
+ ctx.stroke(this.#currentPath2D);
+ ctx.restore();
+ }
+
+ #makeBezierCurve(path2D, x0, y0, x1, y1, x2, y2) {
+ const prevX = (x0 + x1) / 2;
+ const prevY = (y0 + y1) / 2;
+ const x3 = (x1 + x2) / 2;
+ const y3 = (y1 + y2) / 2;
+ path2D.bezierCurveTo(prevX + 2 * (x1 - prevX) / 3, prevY + 2 * (y1 - prevY) / 3, x3 + 2 * (x1 - x3) / 3, y3 + 2 * (y1 - y3) / 3, x3, y3);
+ }
+
+ #generateBezierPoints() {
+ const path = this.currentPath;
+ if (path.length <= 2) {
+ return [[path[0], path[0], path.at(-1), path.at(-1)]];
+ }
+ const bezierPoints = [];
+ let i;
+ let [x0, y0] = path[0];
+ for (i = 1; i < path.length - 2; i++) {
+ const [x1, y1] = path[i];
+ const [x2, y2] = path[i + 1];
+ const x3 = (x1 + x2) / 2;
+ const y3 = (y1 + y2) / 2;
+ const control1 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3];
+ const control2 = [x3 + 2 * (x1 - x3) / 3, y3 + 2 * (y1 - y3) / 3];
+ bezierPoints.push([[x0, y0], control1, control2, [x3, y3]]);
+ [x0, y0] = [x3, y3];
+ }
+ const [x1, y1] = path[i];
+ const [x2, y2] = path[i + 1];
+ const control1 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3];
+ const control2 = [x2 + 2 * (x1 - x2) / 3, y2 + 2 * (y1 - y2) / 3];
+ bezierPoints.push([[x0, y0], control1, control2, [x2, y2]]);
+ return bezierPoints;
+ }
+
+ #redraw() {
+ if (this.isEmpty()) {
+ this.#updateTransform();
+ return;
+ }
+ this.#setStroke();
+ const {
+ canvas,
+ ctx
+ } = this;
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ this.#updateTransform();
+ for (const path of this.bezierPath2D) {
+ ctx.stroke(path);
+ }
+ }
+
+ commit() {
+ if (this.#disableEditing) {
+ return;
+ }
+ super.commit();
+ this.isEditing = false;
+ this.disableEditMode();
+ this.setInForeground();
+ this.#disableEditing = true;
+ this.div.classList.add("disabled");
+ this.#fitToContent(true);
+ this.makeResizable();
+ this.parent.addInkEditorIfNeeded(true);
+ this.moveInDOM();
+ this.div.focus({
+ preventScroll: true
+ });
+ }
+
+ focusin(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
+ super.focusin(event);
+ this.enableEditMode();
+ }
+
+ canvasPointerdown(event) {
+ if (event.button !== 0 || !this.isInEditMode() || this.#disableEditing) {
+ return;
+ }
+ this.setInForeground();
+ event.preventDefault();
+ if (event.type !== "mouse") {
+ this.div.focus();
+ }
+ this.#startDrawing(event.offsetX, event.offsetY);
+ }
+
+ canvasPointermove(event) {
+ event.preventDefault();
+ this.#draw(event.offsetX, event.offsetY);
+ }
+
+ canvasPointerup(event) {
+ event.preventDefault();
+ this.#endDrawing(event);
+ }
+
+ canvasPointerleave(event) {
+ this.#endDrawing(event);
+ }
+
+ #endDrawing(event) {
+ this.canvas.removeEventListener("pointerleave", this.#boundCanvasPointerleave);
+ this.canvas.removeEventListener("pointermove", this.#boundCanvasPointermove);
+ this.canvas.removeEventListener("pointerup", this.#boundCanvasPointerup);
+ this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
+ setTimeout(() => {
+ this.canvas.removeEventListener("contextmenu", _display_utils.noContextMenu);
+ }, 10);
+ this.#stopDrawing(event.offsetX, event.offsetY);
+ this.addToAnnotationStorage();
+ this.setInBackground();
+ }
+
+ #createCanvas() {
+ this.canvas = document.createElement("canvas");
+ this.canvas.width = this.canvas.height = 0;
+ this.canvas.className = "inkEditorCanvas";
+ _editor.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(msg => this.canvas?.setAttribute("aria-label", msg));
+ this.div.append(this.canvas);
+ this.ctx = this.canvas.getContext("2d");
+ }
+
+ #createObserver() {
+ this.#observer = new ResizeObserver(entries => {
+ const rect = entries[0].contentRect;
+ if (rect.width && rect.height) {
+ this.setDimensions(rect.width, rect.height);
}
+ });
+ this.#observer.observe(this.div);
+ }
+
+ get isResizable() {
+ return !this.isEmpty() && this.#disableEditing;
+ }
+
+ render() {
+ if (this.div) {
+ return this.div;
+ }
+ let baseX, baseY;
+ if (this.width) {
+ baseX = this.x;
+ baseY = this.y;
+ }
+ super.render();
+ _editor.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then(msg => this.div?.setAttribute("aria-label", msg));
+ const [x, y, w, h] = this.#getInitialBBox();
+ this.setAt(x, y, 0, 0);
+ this.setDims(w, h);
+ this.#createCanvas();
+ if (this.width) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setAspectRatio(this.width * parentWidth, this.height * parentHeight);
+ this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
+ this.#isCanvasInitialized = true;
+ this.#setCanvasDims();
+ this.setDims(this.width * parentWidth, this.height * parentHeight);
+ this.#redraw();
+ this.div.classList.add("disabled");
+ } else {
+ this.div.classList.add("editing");
+ this.enableEditMode();
}
- return opTree;
- }
- function pf(value) {
- if (Number.isInteger(value)) {
- return value.toString();
+ this.#createObserver();
+ return this.div;
+ }
+
+ #setCanvasDims() {
+ if (!this.#isCanvasInitialized) {
+ return;
}
- const s = value.toFixed(10);
- let i = s.length - 1;
- if (s[i] !== "0") {
- return s;
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.canvas.width = Math.ceil(this.width * parentWidth);
+ this.canvas.height = Math.ceil(this.height * parentHeight);
+ this.#updateTransform();
+ }
+
+ setDimensions(width, height) {
+ const roundedWidth = Math.round(width);
+ const roundedHeight = Math.round(height);
+ if (this.#realWidth === roundedWidth && this.#realHeight === roundedHeight) {
+ return;
}
- do {
- i--;
- } while (s[i] === "0");
- return s.substring(0, s[i] === "." ? i : i + 1);
- }
- function pm(m) {
- if (m[4] === 0 && m[5] === 0) {
- if (m[1] === 0 && m[2] === 0) {
- if (m[0] === 1 && m[3] === 1) {
- return "";
- }
- return `scale(${pf(m[0])} ${pf(m[3])})`;
+ this.#realWidth = roundedWidth;
+ this.#realHeight = roundedHeight;
+ this.canvas.style.visibility = "hidden";
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.width = width / parentWidth;
+ this.height = height / parentHeight;
+ this.fixAndSetPosition();
+ if (this.#disableEditing) {
+ this.#setScaleFactor(width, height);
+ }
+ this.#setCanvasDims();
+ this.#redraw();
+ this.canvas.style.visibility = "visible";
+ this.fixDims();
+ }
+
+ #setScaleFactor(width, height) {
+ const padding = this.#getPadding();
+ const scaleFactorW = (width - padding) / this.#baseWidth;
+ const scaleFactorH = (height - padding) / this.#baseHeight;
+ this.scaleFactor = Math.min(scaleFactorW, scaleFactorH);
+ }
+
+ #updateTransform() {
+ const padding = this.#getPadding() / 2;
+ this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + padding, this.translationY * this.scaleFactor + padding);
+ }
+
+ static #buildPath2D(bezier) {
+ const path2D = new Path2D();
+ for (let i = 0, ii = bezier.length; i < ii; i++) {
+ const [first, control1, control2, second] = bezier[i];
+ if (i === 0) {
+ path2D.moveTo(...first);
+ }
+ path2D.bezierCurveTo(control1[0], control1[1], control2[0], control2[1], second[0], second[1]);
+ }
+ return path2D;
+ }
+
+ static #toPDFCoordinates(points, rect, rotation) {
+ const [blX, blY, trX, trY] = rect;
+ switch (rotation) {
+ case 0:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ points[i] += blX;
+ points[i + 1] = trY - points[i + 1];
+ }
+ break;
+ case 90:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ const x = points[i];
+ points[i] = points[i + 1] + blX;
+ points[i + 1] = x + blY;
+ }
+ break;
+ case 180:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ points[i] = trX - points[i];
+ points[i + 1] += blY;
+ }
+ break;
+ case 270:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ const x = points[i];
+ points[i] = trX - points[i + 1];
+ points[i + 1] = trY - x;
+ }
+ break;
+ default:
+ throw new Error("Invalid rotation");
+ }
+ return points;
+ }
+
+ static #fromPDFCoordinates(points, rect, rotation) {
+ const [blX, blY, trX, trY] = rect;
+ switch (rotation) {
+ case 0:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ points[i] -= blX;
+ points[i + 1] = trY - points[i + 1];
+ }
+ break;
+ case 90:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ const x = points[i];
+ points[i] = points[i + 1] - blY;
+ points[i + 1] = x - blX;
+ }
+ break;
+ case 180:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ points[i] = trX - points[i];
+ points[i + 1] -= blY;
+ }
+ break;
+ case 270:
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ const x = points[i];
+ points[i] = trY - points[i + 1];
+ points[i + 1] = trX - x;
+ }
+ break;
+ default:
+ throw new Error("Invalid rotation");
+ }
+ return points;
+ }
+
+ #serializePaths(s, tx, ty, rect) {
+ const paths = [];
+ const padding = this.thickness / 2;
+ const shiftX = s * tx + padding;
+ const shiftY = s * ty + padding;
+ for (const bezier of this.paths) {
+ const buffer = [];
+ const points = [];
+ for (let j = 0, jj = bezier.length; j < jj; j++) {
+ const [first, control1, control2, second] = bezier[j];
+ const p10 = s * first[0] + shiftX;
+ const p11 = s * first[1] + shiftY;
+ const p20 = s * control1[0] + shiftX;
+ const p21 = s * control1[1] + shiftY;
+ const p30 = s * control2[0] + shiftX;
+ const p31 = s * control2[1] + shiftY;
+ const p40 = s * second[0] + shiftX;
+ const p41 = s * second[1] + shiftY;
+ if (j === 0) {
+ buffer.push(p10, p11);
+ points.push(p10, p11);
+ }
+ buffer.push(p20, p21, p30, p31, p40, p41);
+ points.push(p20, p21);
+ if (j === jj - 1) {
+ points.push(p40, p41);
+ }
+ }
+ paths.push({
+ bezier: InkEditor.#toPDFCoordinates(buffer, rect, this.rotation),
+ points: InkEditor.#toPDFCoordinates(points, rect, this.rotation)
+ });
+ }
+ return paths;
+ }
+
+ #getBbox() {
+ let xMin = Infinity;
+ let xMax = -Infinity;
+ let yMin = Infinity;
+ let yMax = -Infinity;
+ for (const path of this.paths) {
+ for (const [first, control1, control2, second] of path) {
+ const bbox = _util.Util.bezierBoundingBox(...first, ...control1, ...control2, ...second);
+ xMin = Math.min(xMin, bbox[0]);
+ yMin = Math.min(yMin, bbox[1]);
+ xMax = Math.max(xMax, bbox[2]);
+ yMax = Math.max(yMax, bbox[3]);
+ }
+ }
+ return [xMin, yMin, xMax, yMax];
+ }
+
+ #getPadding() {
+ return this.#disableEditing ? Math.ceil(this.thickness * this.parentScale) : 0;
+ }
+
+ #fitToContent(firstTime = false) {
+ if (this.isEmpty()) {
+ return;
+ }
+ if (!this.#disableEditing) {
+ this.#redraw();
+ return;
+ }
+ const bbox = this.#getBbox();
+ const padding = this.#getPadding();
+ this.#baseWidth = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]);
+ this.#baseHeight = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]);
+ const width = Math.ceil(padding + this.#baseWidth * this.scaleFactor);
+ const height = Math.ceil(padding + this.#baseHeight * this.scaleFactor);
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.width = width / parentWidth;
+ this.height = height / parentHeight;
+ this.setAspectRatio(width, height);
+ const prevTranslationX = this.translationX;
+ const prevTranslationY = this.translationY;
+ this.translationX = -bbox[0];
+ this.translationY = -bbox[1];
+ this.#setCanvasDims();
+ this.#redraw();
+ this.#realWidth = width;
+ this.#realHeight = height;
+ this.setDims(width, height);
+ const unscaledPadding = firstTime ? padding / this.scaleFactor / 2 : 0;
+ this.translate(prevTranslationX - this.translationX - unscaledPadding, prevTranslationY - this.translationY - unscaledPadding);
+ }
+
+ static deserialize(data, parent, uiManager) {
+ if (data instanceof _annotation_layer.InkAnnotationElement) {
+ return null;
+ }
+ const editor = super.deserialize(data, parent, uiManager);
+ editor.thickness = data.thickness;
+ editor.color = _util.Util.makeHexColor(...data.color);
+ editor.opacity = data.opacity;
+ const [pageWidth, pageHeight] = editor.pageDimensions;
+ const width = editor.width * pageWidth;
+ const height = editor.height * pageHeight;
+ const scaleFactor = editor.parentScale;
+ const padding = data.thickness / 2;
+ editor.#disableEditing = true;
+ editor.#realWidth = Math.round(width);
+ editor.#realHeight = Math.round(height);
+ const {
+ paths,
+ rect,
+ rotation
+ } = data;
+ for (let {
+ bezier
+ } of paths) {
+ bezier = InkEditor.#fromPDFCoordinates(bezier, rect, rotation);
+ const path = [];
+ editor.paths.push(path);
+ let p0 = scaleFactor * (bezier[0] - padding);
+ let p1 = scaleFactor * (bezier[1] - padding);
+ for (let i = 2, ii = bezier.length; i < ii; i += 6) {
+ const p10 = scaleFactor * (bezier[i] - padding);
+ const p11 = scaleFactor * (bezier[i + 1] - padding);
+ const p20 = scaleFactor * (bezier[i + 2] - padding);
+ const p21 = scaleFactor * (bezier[i + 3] - padding);
+ const p30 = scaleFactor * (bezier[i + 4] - padding);
+ const p31 = scaleFactor * (bezier[i + 5] - padding);
+ path.push([[p0, p1], [p10, p11], [p20, p21], [p30, p31]]);
+ p0 = p30;
+ p1 = p31;
+ }
+ const path2D = this.#buildPath2D(path);
+ editor.bezierPath2D.push(path2D);
+ }
+ const bbox = editor.#getBbox();
+ editor.#baseWidth = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]);
+ editor.#baseHeight = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]);
+ editor.#setScaleFactor(width, height);
+ return editor;
+ }
+
+ serialize() {
+ if (this.isEmpty()) {
+ return null;
+ }
+ const rect = this.getRect(0, 0);
+ const color = _editor.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
+ return {
+ annotationType: _util.AnnotationEditorType.INK,
+ color,
+ thickness: this.thickness,
+ opacity: this.opacity,
+ paths: this.#serializePaths(this.scaleFactor / this.parentScale, this.translationX, this.translationY, rect),
+ pageIndex: this.pageIndex,
+ rect,
+ rotation: this.rotation,
+ structTreeParentId: this._structTreeParentId
+ };
+ }
+ }
+
+ exports.InkEditor = InkEditor;
+
+ /***/
+ }),
+ /* 34 */
+ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
+
+
+ Object.defineProperty(exports, "__esModule", ({
+ value: true
+ }));
+ exports.StampEditor = void 0;
+ var _util = __w_pdfjs_require__(1);
+ var _editor = __w_pdfjs_require__(4);
+ var _display_utils = __w_pdfjs_require__(6);
+ var _annotation_layer = __w_pdfjs_require__(29);
+
+ class StampEditor extends _editor.AnnotationEditor {
+ #bitmap = null;
+ #bitmapId = null;
+ #bitmapPromise = null;
+ #bitmapUrl = null;
+ #bitmapFile = null;
+ #canvas = null;
+ #observer = null;
+ #resizeTimeoutId = null;
+ #isSvg = false;
+ #hasBeenAddedInUndoStack = false;
+ static _type = "stamp";
+
+ constructor(params) {
+ super({
+ ...params,
+ name: "stampEditor"
+ });
+ this.#bitmapUrl = params.bitmapUrl;
+ this.#bitmapFile = params.bitmapFile;
+ }
+
+ static initialize(l10n) {
+ _editor.AnnotationEditor.initialize(l10n);
+ }
+
+ static get supportedTypes() {
+ const types = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
+ return (0, _util.shadow)(this, "supportedTypes", types.map(type => `image/${type}`));
+ }
+
+ static get supportedTypesStr() {
+ return (0, _util.shadow)(this, "supportedTypesStr", this.supportedTypes.join(","));
+ }
+
+ static isHandlingMimeForPasting(mime) {
+ return this.supportedTypes.includes(mime);
+ }
+
+ static paste(item, parent) {
+ parent.pasteEditor(_util.AnnotationEditorType.STAMP, {
+ bitmapFile: item.getAsFile()
+ });
+ }
+
+ #getBitmapFetched(data, fromId = false) {
+ if (!data) {
+ this.remove();
+ return;
+ }
+ this.#bitmap = data.bitmap;
+ if (!fromId) {
+ this.#bitmapId = data.id;
+ this.#isSvg = data.isSvg;
+ }
+ this.#createCanvas();
+ }
+
+ #getBitmapDone() {
+ this.#bitmapPromise = null;
+ this._uiManager.enableWaiting(false);
+ if (this.#canvas) {
+ this.div.focus();
+ }
+ }
+
+ #getBitmap() {
+ if (this.#bitmapId) {
+ this._uiManager.enableWaiting(true);
+ this._uiManager.imageManager.getFromId(this.#bitmapId).then(data => this.#getBitmapFetched(data, true)).finally(() => this.#getBitmapDone());
+ return;
+ }
+ if (this.#bitmapUrl) {
+ const url = this.#bitmapUrl;
+ this.#bitmapUrl = null;
+ this._uiManager.enableWaiting(true);
+ this.#bitmapPromise = this._uiManager.imageManager.getFromUrl(url).then(data => this.#getBitmapFetched(data)).finally(() => this.#getBitmapDone());
+ return;
+ }
+ if (this.#bitmapFile) {
+ const file = this.#bitmapFile;
+ this.#bitmapFile = null;
+ this._uiManager.enableWaiting(true);
+ this.#bitmapPromise = this._uiManager.imageManager.getFromFile(file).then(data => this.#getBitmapFetched(data)).finally(() => this.#getBitmapDone());
+ return;
+ }
+ const input = document.createElement("input");
+ input.type = "file";
+ input.accept = StampEditor.supportedTypesStr;
+ this.#bitmapPromise = new Promise(resolve => {
+ input.addEventListener("change", async () => {
+ if (!input.files || input.files.length === 0) {
+ this.remove();
+ } else {
+ this._uiManager.enableWaiting(true);
+ const data = await this._uiManager.imageManager.getFromFile(input.files[0]);
+ this.#getBitmapFetched(data);
+ }
+ resolve();
+ });
+ input.addEventListener("cancel", () => {
+ this.remove();
+ resolve();
+ });
+ }).finally(() => this.#getBitmapDone());
+ input.click();
+ }
+
+ remove() {
+ if (this.#bitmapId) {
+ this.#bitmap = null;
+ this._uiManager.imageManager.deleteId(this.#bitmapId);
+ this.#canvas?.remove();
+ this.#canvas = null;
+ this.#observer?.disconnect();
+ this.#observer = null;
+ }
+ super.remove();
+ }
+
+ rebuild() {
+ if (!this.parent) {
+ if (this.#bitmapId) {
+ this.#getBitmap();
+ }
+ return;
+ }
+ super.rebuild();
+ if (this.div === null) {
+ return;
+ }
+ if (this.#bitmapId) {
+ this.#getBitmap();
+ }
+ if (!this.isAttachedToDOM) {
+ this.parent.add(this);
+ }
+ }
+
+ onceAdded() {
+ this._isDraggable = true;
+ this.div.focus();
+ }
+
+ isEmpty() {
+ return !(this.#bitmapPromise || this.#bitmap || this.#bitmapUrl || this.#bitmapFile);
+ }
+
+ get isResizable() {
+ return true;
+ }
+
+ render() {
+ if (this.div) {
+ return this.div;
+ }
+ let baseX, baseY;
+ if (this.width) {
+ baseX = this.x;
+ baseY = this.y;
+ }
+ super.render();
+ this.div.hidden = true;
+ if (this.#bitmap) {
+ this.#createCanvas();
+ } else {
+ this.#getBitmap();
+ }
+ if (this.width) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
+ }
+ return this.div;
+ }
+
+ #createCanvas() {
+ const {
+ div
+ } = this;
+ let {
+ width,
+ height
+ } = this.#bitmap;
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ const MAX_RATIO = 0.75;
+ if (this.width) {
+ width = this.width * pageWidth;
+ height = this.height * pageHeight;
+ } else if (width > MAX_RATIO * pageWidth || height > MAX_RATIO * pageHeight) {
+ const factor = Math.min(MAX_RATIO * pageWidth / width, MAX_RATIO * pageHeight / height);
+ width *= factor;
+ height *= factor;
+ }
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(width * parentWidth / pageWidth, height * parentHeight / pageHeight);
+ this._uiManager.enableWaiting(false);
+ const canvas = this.#canvas = document.createElement("canvas");
+ div.append(canvas);
+ div.hidden = false;
+ this.#drawBitmap(width, height);
+ this.#createObserver();
+ if (!this.#hasBeenAddedInUndoStack) {
+ this.parent.addUndoableEditor(this);
+ this.#hasBeenAddedInUndoStack = true;
+ }
+ this._uiManager._eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "editing",
+ subtype: this.editorType,
+ data: {
+ action: "inserted_image"
+ }
+ }
+ });
+ this.addAltTextButton();
+ }
+
+ #setDimensions(width, height) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.width = width / parentWidth;
+ this.height = height / parentHeight;
+ this.setDims(width, height);
+ if (this._initialOptions?.isCentered) {
+ this.center();
+ } else {
+ this.fixAndSetPosition();
+ }
+ this._initialOptions = null;
+ if (this.#resizeTimeoutId !== null) {
+ clearTimeout(this.#resizeTimeoutId);
+ }
+ const TIME_TO_WAIT = 200;
+ this.#resizeTimeoutId = setTimeout(() => {
+ this.#resizeTimeoutId = null;
+ this.#drawBitmap(width, height);
+ }, TIME_TO_WAIT);
+ }
+
+ #scaleBitmap(width, height) {
+ const {
+ width: bitmapWidth,
+ height: bitmapHeight
+ } = this.#bitmap;
+ let newWidth = bitmapWidth;
+ let newHeight = bitmapHeight;
+ let bitmap = this.#bitmap;
+ while (newWidth > 2 * width || newHeight > 2 * height) {
+ const prevWidth = newWidth;
+ const prevHeight = newHeight;
+ if (newWidth > 2 * width) {
+ newWidth = newWidth >= 16384 ? Math.floor(newWidth / 2) - 1 : Math.ceil(newWidth / 2);
+ }
+ if (newHeight > 2 * height) {
+ newHeight = newHeight >= 16384 ? Math.floor(newHeight / 2) - 1 : Math.ceil(newHeight / 2);
+ }
+ const offscreen = new OffscreenCanvas(newWidth, newHeight);
+ const ctx = offscreen.getContext("2d");
+ ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
+ bitmap = offscreen.transferToImageBitmap();
+ }
+ return bitmap;
+ }
+
+ #drawBitmap(width, height) {
+ width = Math.ceil(width);
+ height = Math.ceil(height);
+ const canvas = this.#canvas;
+ if (!canvas || canvas.width === width && canvas.height === height) {
+ return;
+ }
+ canvas.width = width;
+ canvas.height = height;
+ const bitmap = this.#isSvg ? this.#bitmap : this.#scaleBitmap(width, height);
+ const ctx = canvas.getContext("2d");
+ ctx.filter = this._uiManager.hcmFilter;
+ ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
+ }
+
+ #serializeBitmap(toUrl) {
+ if (toUrl) {
+ if (this.#isSvg) {
+ const url = this._uiManager.imageManager.getSvgUrl(this.#bitmapId);
+ if (url) {
+ return url;
+ }
}
- if (m[0] === m[3] && m[1] === -m[2]) {
- const a = Math.acos(m[0]) * 180 / Math.PI;
- return `rotate(${pf(a)})`;
- }
- } else {
- if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {
- return `translate(${pf(m[4])} ${pf(m[5])})`;
+ const canvas = document.createElement("canvas");
+ ({
+ width: canvas.width,
+ height: canvas.height
+ } = this.#bitmap);
+ const ctx = canvas.getContext("2d");
+ ctx.drawImage(this.#bitmap, 0, 0);
+ return canvas.toDataURL();
+ }
+ if (this.#isSvg) {
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ const width = Math.round(this.width * pageWidth * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
+ const height = Math.round(this.height * pageHeight * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
+ const offscreen = new OffscreenCanvas(width, height);
+ const ctx = offscreen.getContext("2d");
+ ctx.drawImage(this.#bitmap, 0, 0, this.#bitmap.width, this.#bitmap.height, 0, 0, width, height);
+ return offscreen.transferToImageBitmap();
+ }
+ return structuredClone(this.#bitmap);
+ }
+
+ #createObserver() {
+ this.#observer = new ResizeObserver(entries => {
+ const rect = entries[0].contentRect;
+ if (rect.width && rect.height) {
+ this.#setDimensions(rect.width, rect.height);
}
+ });
+ this.#observer.observe(this.div);
+ }
+
+ static deserialize(data, parent, uiManager) {
+ if (data instanceof _annotation_layer.StampAnnotationElement) {
+ return null;
+ }
+ const editor = super.deserialize(data, parent, uiManager);
+ const {
+ rect,
+ bitmapUrl,
+ bitmapId,
+ isSvg,
+ accessibilityData
+ } = data;
+ if (bitmapId && uiManager.imageManager.isValidId(bitmapId)) {
+ editor.#bitmapId = bitmapId;
+ } else {
+ editor.#bitmapUrl = bitmapUrl;
+ }
+ editor.#isSvg = isSvg;
+ const [parentWidth, parentHeight] = editor.pageDimensions;
+ editor.width = (rect[2] - rect[0]) / parentWidth;
+ editor.height = (rect[3] - rect[1]) / parentHeight;
+ if (accessibilityData) {
+ editor.altTextData = accessibilityData;
+ }
+ return editor;
+ }
+
+ serialize(isForCopying = false, context = null) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ const serialized = {
+ annotationType: _util.AnnotationEditorType.STAMP,
+ bitmapId: this.#bitmapId,
+ pageIndex: this.pageIndex,
+ rect: this.getRect(0, 0),
+ rotation: this.rotation,
+ isSvg: this.#isSvg,
+ structTreeParentId: this._structTreeParentId
+ };
+ if (isForCopying) {
+ serialized.bitmapUrl = this.#serializeBitmap(true);
+ serialized.accessibilityData = this.altTextData;
+ return serialized;
}
- return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`;
- }
- let clipCount = 0;
- let maskCount = 0;
- let shadingCount = 0;
- exports.SVGGraphics = SVGGraphics = class {
- constructor(commonObjs, objs, forceDataSchema = false) {
- (0, _display_utils.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");
- this.svgFactory = new _display_utils.DOMSVGFactory();
- this.current = new SVGExtraState();
- this.transformMatrix = _util.IDENTITY_MATRIX;
- this.transformStack = [];
- this.extraStack = [];
- this.commonObjs = commonObjs;
- this.objs = objs;
- this.pendingClip = null;
- this.pendingEOFill = false;
- this.embedFonts = false;
- this.embeddedFonts = Object.create(null);
- this.cssStyle = null;
- this.forceDataSchema = !!forceDataSchema;
- this._operatorIdMapping = [];
- for (const op in _util.OPS) {
- this._operatorIdMapping[_util.OPS[op]] = op;
- }
- }
- getObject(data, fallback = null) {
- if (typeof data === "string") {
- return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
- }
- return fallback;
- }
- save() {
- this.transformStack.push(this.transformMatrix);
- const old = this.current;
- this.extraStack.push(old);
- this.current = old.clone();
- }
- restore() {
- this.transformMatrix = this.transformStack.pop();
- this.current = this.extraStack.pop();
- this.pendingClip = null;
- this.tgrp = null;
- }
- group(items) {
- this.save();
- this.executeOpTree(items);
- this.restore();
- }
- loadDependencies(operatorList) {
- const fnArray = operatorList.fnArray;
- const argsArray = operatorList.argsArray;
- for (let i = 0, ii = fnArray.length; i < ii; i++) {
- if (fnArray[i] !== _util.OPS.dependency) {
- continue;
- }
- for (const obj of argsArray[i]) {
- const objsPool = obj.startsWith("g_") ? this.commonObjs : this.objs;
- const promise = new Promise(resolve => {
- objsPool.get(obj, resolve);
- });
- this.current.dependencies.push(promise);
- }
- }
- return Promise.all(this.current.dependencies);
- }
- transform(a, b, c, d, e, f) {
- const transformMatrix = [a, b, c, d, e, f];
- this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
- this.tgrp = null;
- }
- getSVG(operatorList, viewport) {
- this.viewport = viewport;
- const svgElement = this._initialize(viewport);
- return this.loadDependencies(operatorList).then(() => {
- this.transformMatrix = _util.IDENTITY_MATRIX;
- this.executeOpTree(this.convertOpList(operatorList));
- return svgElement;
- });
- }
- convertOpList(operatorList) {
- const operatorIdMapping = this._operatorIdMapping;
- const argsArray = operatorList.argsArray;
- const fnArray = operatorList.fnArray;
- const opList = [];
- for (let i = 0, ii = fnArray.length; i < ii; i++) {
- const fnId = fnArray[i];
- opList.push({
- fnId,
- fn: operatorIdMapping[fnId],
- args: argsArray[i]
- });
- }
- return opListToTree(opList);
- }
- executeOpTree(opTree) {
- for (const opTreeElement of opTree) {
- const fn = opTreeElement.fn;
- const fnId = opTreeElement.fnId;
- const args = opTreeElement.args;
- switch (fnId | 0) {
- case _util.OPS.beginText:
- this.beginText();
- break;
- case _util.OPS.dependency:
- break;
- case _util.OPS.setLeading:
- this.setLeading(args);
- break;
- case _util.OPS.setLeadingMoveText:
- this.setLeadingMoveText(args[0], args[1]);
- break;
- case _util.OPS.setFont:
- this.setFont(args);
- break;
- case _util.OPS.showText:
- this.showText(args[0]);
- break;
- case _util.OPS.showSpacedText:
- this.showText(args[0]);
- break;
- case _util.OPS.endText:
- this.endText();
- break;
- case _util.OPS.moveText:
- this.moveText(args[0], args[1]);
- break;
- case _util.OPS.setCharSpacing:
- this.setCharSpacing(args[0]);
- break;
- case _util.OPS.setWordSpacing:
- this.setWordSpacing(args[0]);
- break;
- case _util.OPS.setHScale:
- this.setHScale(args[0]);
- break;
- case _util.OPS.setTextMatrix:
- this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
- break;
- case _util.OPS.setTextRise:
- this.setTextRise(args[0]);
- break;
- case _util.OPS.setTextRenderingMode:
- this.setTextRenderingMode(args[0]);
- break;
- case _util.OPS.setLineWidth:
- this.setLineWidth(args[0]);
- break;
- case _util.OPS.setLineJoin:
- this.setLineJoin(args[0]);
- break;
- case _util.OPS.setLineCap:
- this.setLineCap(args[0]);
- break;
- case _util.OPS.setMiterLimit:
- this.setMiterLimit(args[0]);
- break;
- case _util.OPS.setFillRGBColor:
- this.setFillRGBColor(args[0], args[1], args[2]);
- break;
- case _util.OPS.setStrokeRGBColor:
- this.setStrokeRGBColor(args[0], args[1], args[2]);
- break;
- case _util.OPS.setStrokeColorN:
- this.setStrokeColorN(args);
- break;
- case _util.OPS.setFillColorN:
- this.setFillColorN(args);
- break;
- case _util.OPS.shadingFill:
- this.shadingFill(args[0]);
- break;
- case _util.OPS.setDash:
- this.setDash(args[0], args[1]);
- break;
- case _util.OPS.setRenderingIntent:
- this.setRenderingIntent(args[0]);
- break;
- case _util.OPS.setFlatness:
- this.setFlatness(args[0]);
- break;
- case _util.OPS.setGState:
- this.setGState(args[0]);
- break;
- case _util.OPS.fill:
- this.fill();
- break;
- case _util.OPS.eoFill:
- this.eoFill();
- break;
- case _util.OPS.stroke:
- this.stroke();
- break;
- case _util.OPS.fillStroke:
- this.fillStroke();
- break;
- case _util.OPS.eoFillStroke:
- this.eoFillStroke();
- break;
- case _util.OPS.clip:
- this.clip("nonzero");
- break;
- case _util.OPS.eoClip:
- this.clip("evenodd");
- break;
- case _util.OPS.paintSolidColorImageMask:
- this.paintSolidColorImageMask();
- break;
- case _util.OPS.paintImageXObject:
- this.paintImageXObject(args[0]);
- break;
- case _util.OPS.paintInlineImageXObject:
- this.paintInlineImageXObject(args[0]);
- break;
- case _util.OPS.paintImageMaskXObject:
- this.paintImageMaskXObject(args[0]);
- break;
- case _util.OPS.paintFormXObjectBegin:
- this.paintFormXObjectBegin(args[0], args[1]);
- break;
- case _util.OPS.paintFormXObjectEnd:
- this.paintFormXObjectEnd();
- break;
- case _util.OPS.closePath:
- this.closePath();
- break;
- case _util.OPS.closeStroke:
- this.closeStroke();
- break;
- case _util.OPS.closeFillStroke:
- this.closeFillStroke();
- break;
- case _util.OPS.closeEOFillStroke:
- this.closeEOFillStroke();
- break;
- case _util.OPS.nextLine:
- this.nextLine();
- break;
- case _util.OPS.transform:
- this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
- break;
- case _util.OPS.constructPath:
- this.constructPath(args[0], args[1]);
- break;
- case _util.OPS.endPath:
- this.endPath();
- break;
- case 92:
- this.group(opTreeElement.items);
- break;
- default:
- (0, _util.warn)(`Unimplemented operator ${fn}`);
- break;
- }
- }
- }
- setWordSpacing(wordSpacing) {
- this.current.wordSpacing = wordSpacing;
- }
- setCharSpacing(charSpacing) {
- this.current.charSpacing = charSpacing;
- }
- nextLine() {
- this.moveText(0, this.current.leading);
- }
- setTextMatrix(a, b, c, d, e, f) {
- const current = this.current;
- current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];
- current.textMatrixScale = Math.hypot(a, b);
- current.x = current.lineX = 0;
- current.y = current.lineY = 0;
- current.xcoords = [];
- current.ycoords = [];
- current.tspan = this.svgFactory.createElement("svg:tspan");
- current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
- current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
- current.tspan.setAttributeNS(null, "y", pf(-current.y));
- current.txtElement = this.svgFactory.createElement("svg:text");
- current.txtElement.append(current.tspan);
- }
- beginText() {
- const current = this.current;
- current.x = current.lineX = 0;
- current.y = current.lineY = 0;
- current.textMatrix = _util.IDENTITY_MATRIX;
- current.lineMatrix = _util.IDENTITY_MATRIX;
- current.textMatrixScale = 1;
- current.tspan = this.svgFactory.createElement("svg:tspan");
- current.txtElement = this.svgFactory.createElement("svg:text");
- current.txtgrp = this.svgFactory.createElement("svg:g");
- current.xcoords = [];
- current.ycoords = [];
- }
- moveText(x, y) {
- const current = this.current;
- current.x = current.lineX += x;
- current.y = current.lineY += y;
- current.xcoords = [];
- current.ycoords = [];
- current.tspan = this.svgFactory.createElement("svg:tspan");
- current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
- current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
- current.tspan.setAttributeNS(null, "y", pf(-current.y));
- }
- showText(glyphs) {
- const current = this.current;
- const font = current.font;
- const fontSize = current.fontSize;
- if (fontSize === 0) {
- return;
- }
- const fontSizeScale = current.fontSizeScale;
- const charSpacing = current.charSpacing;
- const wordSpacing = current.wordSpacing;
- const fontDirection = current.fontDirection;
- const textHScale = current.textHScale * fontDirection;
- const vertical = font.vertical;
- const spacingDir = vertical ? 1 : -1;
- const defaultVMetrics = font.defaultVMetrics;
- const widthAdvanceScale = fontSize * current.fontMatrix[0];
- let x = 0;
- for (const glyph of glyphs) {
- if (glyph === null) {
- x += fontDirection * wordSpacing;
- continue;
- } else if (typeof glyph === "number") {
- x += spacingDir * glyph * fontSize / 1000;
- continue;
- }
- const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
- const character = glyph.fontChar;
- let scaledX, scaledY;
- let width = glyph.width;
- if (vertical) {
- let vx;
- const vmetric = glyph.vmetric || defaultVMetrics;
- vx = glyph.vmetric ? vmetric[1] : width * 0.5;
- vx = -vx * widthAdvanceScale;
- const vy = vmetric[2] * widthAdvanceScale;
- width = vmetric ? -vmetric[0] : width;
- scaledX = vx / fontSizeScale;
- scaledY = (x + vy) / fontSizeScale;
- } else {
- scaledX = x / fontSizeScale;
- scaledY = 0;
- }
- if (glyph.isInFont || font.missingFile) {
- current.xcoords.push(current.x + scaledX);
- if (vertical) {
- current.ycoords.push(-current.y + scaledY);
- }
- current.tspan.textContent += character;
- } else {}
- let charWidth;
- if (vertical) {
- charWidth = width * widthAdvanceScale - spacing * fontDirection;
- } else {
- charWidth = width * widthAdvanceScale + spacing * fontDirection;
- }
- x += charWidth;
- }
- current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
- if (vertical) {
- current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
- } else {
- current.tspan.setAttributeNS(null, "y", pf(-current.y));
- }
- if (vertical) {
- current.y -= x;
- } else {
- current.x += x * textHScale;
- }
- current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
- current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
- if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
- current.tspan.setAttributeNS(null, "font-style", current.fontStyle);
- }
- if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
- current.tspan.setAttributeNS(null, "font-weight", current.fontWeight);
- }
- const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
- if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- if (current.fillColor !== SVG_DEFAULTS.fillColor) {
- current.tspan.setAttributeNS(null, "fill", current.fillColor);
- }
- if (current.fillAlpha < 1) {
- current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha);
- }
- } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
- current.tspan.setAttributeNS(null, "fill", "transparent");
- } else {
- current.tspan.setAttributeNS(null, "fill", "none");
- }
- if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
- const lineWidthScale = 1 / (current.textMatrixScale || 1);
- this._setStrokeAttributes(current.tspan, lineWidthScale);
- }
- let textMatrix = current.textMatrix;
- if (current.textRise !== 0) {
- textMatrix = textMatrix.slice();
- textMatrix[5] += current.textRise;
- }
- current.txtElement.setAttributeNS(null, "transform", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`);
- current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
- current.txtElement.append(current.tspan);
- current.txtgrp.append(current.txtElement);
- this._ensureTransformGroup().append(current.txtElement);
- }
- setLeadingMoveText(x, y) {
- this.setLeading(-y);
- this.moveText(x, y);
- }
- addFontStyle(fontObj) {
- if (!fontObj.data) {
- throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
- }
- if (!this.cssStyle) {
- this.cssStyle = this.svgFactory.createElement("svg:style");
- this.cssStyle.setAttributeNS(null, "type", "text/css");
- this.defs.append(this.cssStyle);
- }
- const url = createObjectURL(fontObj.data, fontObj.mimetype, this.forceDataSchema);
- this.cssStyle.textContent += `@font-face { font-family: "${fontObj.loadedName}";` + ` src: url(${url}); }\n`;
- }
- setFont(details) {
- const current = this.current;
- const fontObj = this.commonObjs.get(details[0]);
- let size = details[1];
- current.font = fontObj;
- if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
- this.addFontStyle(fontObj);
- this.embeddedFonts[fontObj.loadedName] = fontObj;
- }
- current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
- let bold = "normal";
- if (fontObj.black) {
- bold = "900";
- } else if (fontObj.bold) {
- bold = "bold";
- }
- const italic = fontObj.italic ? "italic" : "normal";
- if (size < 0) {
- size = -size;
- current.fontDirection = -1;
- } else {
- current.fontDirection = 1;
- }
- current.fontSize = size;
- current.fontFamily = fontObj.loadedName;
- current.fontWeight = bold;
- current.fontStyle = italic;
- current.tspan = this.svgFactory.createElement("svg:tspan");
- current.tspan.setAttributeNS(null, "y", pf(-current.y));
- current.xcoords = [];
- current.ycoords = [];
- }
- endText() {
- const current = this.current;
- if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement?.hasChildNodes()) {
- current.element = current.txtElement;
- this.clip("nonzero");
- this.endPath();
- }
- }
- setLineWidth(width) {
- if (width > 0) {
- this.current.lineWidth = width;
- }
- }
- setLineCap(style) {
- this.current.lineCap = LINE_CAP_STYLES[style];
- }
- setLineJoin(style) {
- this.current.lineJoin = LINE_JOIN_STYLES[style];
- }
- setMiterLimit(limit) {
- this.current.miterLimit = limit;
- }
- setStrokeAlpha(strokeAlpha) {
- this.current.strokeAlpha = strokeAlpha;
- }
- setStrokeRGBColor(r, g, b) {
- this.current.strokeColor = _util.Util.makeHexColor(r, g, b);
- }
- setFillAlpha(fillAlpha) {
- this.current.fillAlpha = fillAlpha;
- }
- setFillRGBColor(r, g, b) {
- this.current.fillColor = _util.Util.makeHexColor(r, g, b);
- this.current.tspan = this.svgFactory.createElement("svg:tspan");
- this.current.xcoords = [];
- this.current.ycoords = [];
- }
- setStrokeColorN(args) {
- this.current.strokeColor = this._makeColorN_Pattern(args);
- }
- setFillColorN(args) {
- this.current.fillColor = this._makeColorN_Pattern(args);
- }
- shadingFill(args) {
- const width = this.viewport.width;
- const height = this.viewport.height;
- const inv = _util.Util.inverseTransform(this.transformMatrix);
- const bl = _util.Util.applyTransform([0, 0], inv);
- const br = _util.Util.applyTransform([0, height], inv);
- const ul = _util.Util.applyTransform([width, 0], inv);
- const ur = _util.Util.applyTransform([width, height], inv);
- const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
- const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
- const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
- const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
- const rect = this.svgFactory.createElement("svg:rect");
- rect.setAttributeNS(null, "x", x0);
- rect.setAttributeNS(null, "y", y0);
- rect.setAttributeNS(null, "width", x1 - x0);
- rect.setAttributeNS(null, "height", y1 - y0);
- rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
- if (this.current.fillAlpha < 1) {
- rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
- }
- this._ensureTransformGroup().append(rect);
- }
- _makeColorN_Pattern(args) {
- if (args[0] === "TilingPattern") {
- return this._makeTilingPattern(args);
- }
- return this._makeShadingPattern(args);
- }
- _makeTilingPattern(args) {
- const color = args[1];
- const operatorList = args[2];
- const matrix = args[3] || _util.IDENTITY_MATRIX;
- const [x0, y0, x1, y1] = args[4];
- const xstep = args[5];
- const ystep = args[6];
- const paintType = args[7];
- const tilingId = `shading${shadingCount++}`;
- const [tx0, ty0, tx1, ty1] = _util.Util.normalizeRect([..._util.Util.applyTransform([x0, y0], matrix), ..._util.Util.applyTransform([x1, y1], matrix)]);
- const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix);
- const txstep = xstep * xscale;
- const tystep = ystep * yscale;
- const tiling = this.svgFactory.createElement("svg:pattern");
- tiling.setAttributeNS(null, "id", tilingId);
- tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
- tiling.setAttributeNS(null, "width", txstep);
- tiling.setAttributeNS(null, "height", tystep);
- tiling.setAttributeNS(null, "x", `${tx0}`);
- tiling.setAttributeNS(null, "y", `${ty0}`);
- const svg = this.svg;
- const transformMatrix = this.transformMatrix;
- const fillColor = this.current.fillColor;
- const strokeColor = this.current.strokeColor;
- const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);
- this.svg = bbox;
- this.transformMatrix = matrix;
- if (paintType === 2) {
- const cssColor = _util.Util.makeHexColor(...color);
- this.current.fillColor = cssColor;
- this.current.strokeColor = cssColor;
- }
- this.executeOpTree(this.convertOpList(operatorList));
- this.svg = svg;
- this.transformMatrix = transformMatrix;
- this.current.fillColor = fillColor;
- this.current.strokeColor = strokeColor;
- tiling.append(bbox.childNodes[0]);
- this.defs.append(tiling);
- return `url(#${tilingId})`;
- }
- _makeShadingPattern(args) {
- if (typeof args === "string") {
- args = this.objs.get(args);
- }
- switch (args[0]) {
- case "RadialAxial":
- const shadingId = `shading${shadingCount++}`;
- const colorStops = args[3];
- let gradient;
- switch (args[1]) {
- case "axial":
- const point0 = args[4];
- const point1 = args[5];
- gradient = this.svgFactory.createElement("svg:linearGradient");
- gradient.setAttributeNS(null, "id", shadingId);
- gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
- gradient.setAttributeNS(null, "x1", point0[0]);
- gradient.setAttributeNS(null, "y1", point0[1]);
- gradient.setAttributeNS(null, "x2", point1[0]);
- gradient.setAttributeNS(null, "y2", point1[1]);
- break;
- case "radial":
- const focalPoint = args[4];
- const circlePoint = args[5];
- const focalRadius = args[6];
- const circleRadius = args[7];
- gradient = this.svgFactory.createElement("svg:radialGradient");
- gradient.setAttributeNS(null, "id", shadingId);
- gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
- gradient.setAttributeNS(null, "cx", circlePoint[0]);
- gradient.setAttributeNS(null, "cy", circlePoint[1]);
- gradient.setAttributeNS(null, "r", circleRadius);
- gradient.setAttributeNS(null, "fx", focalPoint[0]);
- gradient.setAttributeNS(null, "fy", focalPoint[1]);
- gradient.setAttributeNS(null, "fr", focalRadius);
- break;
- default:
- throw new Error(`Unknown RadialAxial type: ${args[1]}`);
- }
- for (const colorStop of colorStops) {
- const stop = this.svgFactory.createElement("svg:stop");
- stop.setAttributeNS(null, "offset", colorStop[0]);
- stop.setAttributeNS(null, "stop-color", colorStop[1]);
- gradient.append(stop);
- }
- this.defs.append(gradient);
- return `url(#${shadingId})`;
- case "Mesh":
- (0, _util.warn)("Unimplemented pattern Mesh");
- return null;
- case "Dummy":
- return "hotpink";
- default:
- throw new Error(`Unknown IR type: ${args[0]}`);
- }
- }
- setDash(dashArray, dashPhase) {
- this.current.dashArray = dashArray;
- this.current.dashPhase = dashPhase;
- }
- constructPath(ops, args) {
- const current = this.current;
- let x = current.x,
- y = current.y;
- let d = [];
- let j = 0;
- for (const op of ops) {
- switch (op | 0) {
- case _util.OPS.rectangle:
- x = args[j++];
- y = args[j++];
- const width = args[j++];
- const height = args[j++];
- const xw = x + width;
- const yh = y + height;
- d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z");
- break;
- case _util.OPS.moveTo:
- x = args[j++];
- y = args[j++];
- d.push("M", pf(x), pf(y));
- break;
- case _util.OPS.lineTo:
- x = args[j++];
- y = args[j++];
- d.push("L", pf(x), pf(y));
- break;
- case _util.OPS.curveTo:
- x = args[j + 4];
- y = args[j + 5];
- d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));
- j += 6;
- break;
- case _util.OPS.curveTo2:
- d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));
- x = args[j + 2];
- y = args[j + 3];
- j += 4;
- break;
- case _util.OPS.curveTo3:
- x = args[j + 2];
- y = args[j + 3];
- d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));
- j += 4;
- break;
- case _util.OPS.closePath:
- d.push("Z");
- break;
- }
- }
- d = d.join(" ");
- if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {
- d = current.path.getAttributeNS(null, "d") + d;
- } else {
- current.path = this.svgFactory.createElement("svg:path");
- this._ensureTransformGroup().append(current.path);
- }
- current.path.setAttributeNS(null, "d", d);
- current.path.setAttributeNS(null, "fill", "none");
- current.element = current.path;
- current.setCurrentPoint(x, y);
- }
- endPath() {
- const current = this.current;
- current.path = null;
- if (!this.pendingClip) {
- return;
- }
- if (!current.element) {
- this.pendingClip = null;
- return;
- }
- const clipId = `clippath${clipCount++}`;
- const clipPath = this.svgFactory.createElement("svg:clipPath");
- clipPath.setAttributeNS(null, "id", clipId);
- clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix));
- const clipElement = current.element.cloneNode(true);
- if (this.pendingClip === "evenodd") {
- clipElement.setAttributeNS(null, "clip-rule", "evenodd");
- } else {
- clipElement.setAttributeNS(null, "clip-rule", "nonzero");
- }
- this.pendingClip = null;
- clipPath.append(clipElement);
- this.defs.append(clipPath);
- if (current.activeClipUrl) {
- current.clipGroup = null;
- for (const prev of this.extraStack) {
- prev.clipGroup = null;
- }
- clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl);
- }
- current.activeClipUrl = `url(#${clipId})`;
- this.tgrp = null;
- }
- clip(type) {
- this.pendingClip = type;
- }
- closePath() {
- const current = this.current;
- if (current.path) {
- const d = `${current.path.getAttributeNS(null, "d")}Z`;
- current.path.setAttributeNS(null, "d", d);
- }
- }
- setLeading(leading) {
- this.current.leading = -leading;
- }
- setTextRise(textRise) {
- this.current.textRise = textRise;
- }
- setTextRenderingMode(textRenderingMode) {
- this.current.textRenderingMode = textRenderingMode;
- }
- setHScale(scale) {
- this.current.textHScale = scale / 100;
- }
- setRenderingIntent(intent) {}
- setFlatness(flatness) {}
- setGState(states) {
- for (const [key, value] of states) {
- switch (key) {
- case "LW":
- this.setLineWidth(value);
- break;
- case "LC":
- this.setLineCap(value);
- break;
- case "LJ":
- this.setLineJoin(value);
- break;
- case "ML":
- this.setMiterLimit(value);
- break;
- case "D":
- this.setDash(value[0], value[1]);
- break;
- case "RI":
- this.setRenderingIntent(value);
- break;
- case "FL":
- this.setFlatness(value);
- break;
- case "Font":
- this.setFont(value);
- break;
- case "CA":
- this.setStrokeAlpha(value);
- break;
- case "ca":
- this.setFillAlpha(value);
- break;
- default:
- (0, _util.warn)(`Unimplemented graphic state operator ${key}`);
- break;
- }
- }
- }
- fill() {
- const current = this.current;
- if (current.element) {
- current.element.setAttributeNS(null, "fill", current.fillColor);
- current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha);
- this.endPath();
- }
- }
- stroke() {
- const current = this.current;
- if (current.element) {
- this._setStrokeAttributes(current.element);
- current.element.setAttributeNS(null, "fill", "none");
- this.endPath();
- }
- }
- _setStrokeAttributes(element, lineWidthScale = 1) {
- const current = this.current;
- let dashArray = current.dashArray;
- if (lineWidthScale !== 1 && dashArray.length > 0) {
- dashArray = dashArray.map(function (value) {
- return lineWidthScale * value;
- });
- }
- element.setAttributeNS(null, "stroke", current.strokeColor);
- element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha);
- element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit));
- element.setAttributeNS(null, "stroke-linecap", current.lineCap);
- element.setAttributeNS(null, "stroke-linejoin", current.lineJoin);
- element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px");
- element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" "));
- element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px");
- }
- eoFill() {
- this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
- this.fill();
- }
- fillStroke() {
- this.stroke();
- this.fill();
- }
- eoFillStroke() {
- this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
- this.fillStroke();
- }
- closeStroke() {
- this.closePath();
- this.stroke();
- }
- closeFillStroke() {
- this.closePath();
- this.fillStroke();
- }
- closeEOFillStroke() {
- this.closePath();
- this.eoFillStroke();
- }
- paintSolidColorImageMask() {
- const rect = this.svgFactory.createElement("svg:rect");
- rect.setAttributeNS(null, "x", "0");
- rect.setAttributeNS(null, "y", "0");
- rect.setAttributeNS(null, "width", "1px");
- rect.setAttributeNS(null, "height", "1px");
- rect.setAttributeNS(null, "fill", this.current.fillColor);
- this._ensureTransformGroup().append(rect);
- }
- paintImageXObject(objId) {
- const imgData = this.getObject(objId);
- if (!imgData) {
- (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`);
- return;
- }
- this.paintInlineImageXObject(imgData);
- }
- paintInlineImageXObject(imgData, mask) {
- const width = imgData.width;
- const height = imgData.height;
- const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
- const cliprect = this.svgFactory.createElement("svg:rect");
- cliprect.setAttributeNS(null, "x", "0");
- cliprect.setAttributeNS(null, "y", "0");
- cliprect.setAttributeNS(null, "width", pf(width));
- cliprect.setAttributeNS(null, "height", pf(height));
- this.current.element = cliprect;
- this.clip("nonzero");
- const imgEl = this.svgFactory.createElement("svg:image");
- imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc);
- imgEl.setAttributeNS(null, "x", "0");
- imgEl.setAttributeNS(null, "y", pf(-height));
- imgEl.setAttributeNS(null, "width", pf(width) + "px");
- imgEl.setAttributeNS(null, "height", pf(height) + "px");
- imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / width)} ${pf(-1 / height)})`);
- if (mask) {
- mask.append(imgEl);
- } else {
- this._ensureTransformGroup().append(imgEl);
- }
- }
- paintImageMaskXObject(img) {
- const imgData = this.getObject(img.data, img);
- if (imgData.bitmap) {
- (0, _util.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, " + "ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");
- return;
- }
- const current = this.current;
- const width = imgData.width;
- const height = imgData.height;
- const fillColor = current.fillColor;
- current.maskId = `mask${maskCount++}`;
- const mask = this.svgFactory.createElement("svg:mask");
- mask.setAttributeNS(null, "id", current.maskId);
- const rect = this.svgFactory.createElement("svg:rect");
- rect.setAttributeNS(null, "x", "0");
- rect.setAttributeNS(null, "y", "0");
- rect.setAttributeNS(null, "width", pf(width));
- rect.setAttributeNS(null, "height", pf(height));
- rect.setAttributeNS(null, "fill", fillColor);
- rect.setAttributeNS(null, "mask", `url(#${current.maskId})`);
- this.defs.append(mask);
- this._ensureTransformGroup().append(rect);
- this.paintInlineImageXObject(imgData, mask);
- }
- paintFormXObjectBegin(matrix, bbox) {
- if (Array.isArray(matrix) && matrix.length === 6) {
- this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
- }
- if (bbox) {
- const width = bbox[2] - bbox[0];
- const height = bbox[3] - bbox[1];
- const cliprect = this.svgFactory.createElement("svg:rect");
- cliprect.setAttributeNS(null, "x", bbox[0]);
- cliprect.setAttributeNS(null, "y", bbox[1]);
- cliprect.setAttributeNS(null, "width", pf(width));
- cliprect.setAttributeNS(null, "height", pf(height));
- this.current.element = cliprect;
- this.clip("nonzero");
- this.endPath();
- }
- }
- paintFormXObjectEnd() {}
- _initialize(viewport) {
- const svg = this.svgFactory.create(viewport.width, viewport.height);
- const definitions = this.svgFactory.createElement("svg:defs");
- svg.append(definitions);
- this.defs = definitions;
- const rootGroup = this.svgFactory.createElement("svg:g");
- rootGroup.setAttributeNS(null, "transform", pm(viewport.transform));
- svg.append(rootGroup);
- this.svg = rootGroup;
- return svg;
- }
- _ensureClipGroup() {
- if (!this.current.clipGroup) {
- const clipGroup = this.svgFactory.createElement("svg:g");
- clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl);
- this.svg.append(clipGroup);
- this.current.clipGroup = clipGroup;
- }
- return this.current.clipGroup;
- }
- _ensureTransformGroup() {
- if (!this.tgrp) {
- this.tgrp = this.svgFactory.createElement("svg:g");
- this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix));
- if (this.current.activeClipUrl) {
- this._ensureClipGroup().append(this.tgrp);
- } else {
- this.svg.append(this.tgrp);
- }
- }
- return this.tgrp;
- }
- };
-}
+ const {
+ decorative,
+ altText
+ } = this.altTextData;
+ if (!decorative && altText) {
+ serialized.accessibilityData = {
+ type: "Figure",
+ alt: altText
+ };
+ }
+ if (context === null) {
+ return serialized;
+ }
+ context.stamps ||= new Map();
+ const area = this.#isSvg ? (serialized.rect[2] - serialized.rect[0]) * (serialized.rect[3] - serialized.rect[1]) : null;
+ if (!context.stamps.has(this.#bitmapId)) {
+ context.stamps.set(this.#bitmapId, {
+ area,
+ serialized
+ });
+ serialized.bitmap = this.#serializeBitmap(false);
+ } else if (this.#isSvg) {
+ const prevData = context.stamps.get(this.#bitmapId);
+ if (area > prevData.area) {
+ prevData.area = area;
+ prevData.serialized.bitmap.close();
+ prevData.serialized.bitmap = this.#serializeBitmap(false);
+ }
+ }
+ return serialized;
+ }
+ }
+
+ exports.StampEditor = StampEditor;
/***/ })
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
-/******/
+/******/
/******/ // The require function
/******/ function __w_pdfjs_require__(moduleId) {
/******/ // Check if module is in cache
@@ -15542,14 +18260,14 @@ exports.SVGGraphics = SVGGraphics;
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
-/******/
+/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
-/******/
+/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
-/******/
+/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
@@ -15607,12 +18325,30 @@ Object.defineProperty(exports, "CMapCompressionType", ({
get: function () {
return _util.CMapCompressionType;
}
+}));
+ Object.defineProperty(exports, "DOMSVGFactory", ({
+ enumerable: true,
+ get: function () {
+ return _display_utils.DOMSVGFactory;
+ }
+ }));
+ Object.defineProperty(exports, "FeatureTest", ({
+ enumerable: true,
+ get: function () {
+ return _util.FeatureTest;
+ }
}));
Object.defineProperty(exports, "GlobalWorkerOptions", ({
enumerable: true,
get: function () {
return _worker_options.GlobalWorkerOptions;
}
+}));
+ Object.defineProperty(exports, "ImageKind", ({
+ enumerable: true,
+ get: function () {
+ return _util.ImageKind;
+ }
}));
Object.defineProperty(exports, "InvalidPDFException", ({
enumerable: true,
@@ -15667,6 +18403,12 @@ Object.defineProperty(exports, "PixelsPerInch", ({
get: function () {
return _display_utils.PixelsPerInch;
}
+}));
+ Object.defineProperty(exports, "PromiseCapability", ({
+ enumerable: true,
+ get: function () {
+ return _util.PromiseCapability;
+ }
}));
Object.defineProperty(exports, "RenderingCancelledException", ({
enumerable: true,
@@ -15677,13 +18419,7 @@ Object.defineProperty(exports, "RenderingCancelledException", ({
Object.defineProperty(exports, "SVGGraphics", ({
enumerable: true,
get: function () {
- return _svg.SVGGraphics;
- }
-}));
-Object.defineProperty(exports, "UNSUPPORTED_FEATURES", ({
- enumerable: true,
- get: function () {
- return _util.UNSUPPORTED_FEATURES;
+ return _api.SVGGraphics;
}
}));
Object.defineProperty(exports, "UnexpectedResponseException", ({
@@ -15716,12 +18452,6 @@ Object.defineProperty(exports, "build", ({
return _api.build;
}
}));
-Object.defineProperty(exports, "createPromiseCapability", ({
- enumerable: true,
- get: function () {
- return _util.createPromiseCapability;
- }
-}));
Object.defineProperty(exports, "createValidAbsoluteUrl", ({
enumerable: true,
get: function () {
@@ -15769,6 +18499,18 @@ Object.defineProperty(exports, "loadScript", ({
get: function () {
return _display_utils.loadScript;
}
+}));
+ Object.defineProperty(exports, "noContextMenu", ({
+ enumerable: true,
+ get: function () {
+ return _display_utils.noContextMenu;
+ }
+ }));
+ Object.defineProperty(exports, "normalizeUnicode", ({
+ enumerable: true,
+ get: function () {
+ return _util.normalizeUnicode;
+ }
}));
Object.defineProperty(exports, "renderTextLayer", ({
enumerable: true,
@@ -15806,12 +18548,11 @@ var _display_utils = __w_pdfjs_require__(6);
var _text_layer = __w_pdfjs_require__(26);
var _annotation_editor_layer = __w_pdfjs_require__(27);
var _tools = __w_pdfjs_require__(5);
-var _annotation_layer = __w_pdfjs_require__(32);
+ var _annotation_layer = __w_pdfjs_require__(29);
var _worker_options = __w_pdfjs_require__(14);
-var _svg = __w_pdfjs_require__(35);
-var _xfa_layer = __w_pdfjs_require__(34);
-const pdfjsVersion = '3.3.122';
-const pdfjsBuild = '562045607';
+ var _xfa_layer = __w_pdfjs_require__(32);
+ const pdfjsVersion = '3.11.174';
+ const pdfjsBuild = 'ce8716743';
})();
/******/ return __webpack_exports__;
diff --git a/src/main/resources/static/pdfjs/pdf.js.map b/src/main/resources/static/pdfjs/pdf.js.map
index 5713d322..39c3bd65 100644
--- a/src/main/resources/static/pdfjs/pdf.js.map
+++ b/src/main/resources/static/pdfjs/pdf.js.map
@@ -1 +1 @@
-{"version":3,"file":"pdf.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA;AASA,MAAMA,kBAAkB,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,CAAxB;AAzBA;AA0BA,MAAMC,uBAAuB,CAAC,KAAD,EAAQ,CAAR,EAAW,CAAX,EAAc,KAAd,EAAqB,CAArB,EAAwB,CAAxB,CAA7B;AA1BA;AA8BA,MAAMC,cAAc,IAApB;AA9BA;AA+BA,MAAMC,sBAAsB,IAA5B;AA/BA;AAgCA,MAAMC,kBAAkBD,sBAAsBD,WAA9C;AAhCA;AA8CA,MAAMG,sBAAsB;EAC1BC,KAAK,IADqB;EAE1BC,SAAS,IAFiB;EAG1BC,OAAO,IAHmB;EAI1BC,MAAM,IAJoB;EAK1BC,mBAAmB,IALO;EAM1BC,qBAAqB,IANK;EAO1BC,qBAAqB,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dfjs-dist/build/pdf/src/shared/util.js","webpack://pdfjs-dist/build/pdf/src/display/api.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_storage.js","webpack://pdfjs-dist/build/pdf/src/display/editor/editor.js","webpack://pdfjs-dist/build/pdf/src/display/editor/tools.js","webpack://pdfjs-dist/build/pdf/src/display/display_utils.js","webpack://pdfjs-dist/build/pdf/src/display/base_factory.js","webpack://pdfjs-dist/build/pdf/src/shared/murmurhash3.js","webpack://pdfjs-dist/build/pdf/src/display/font_loader.js","webpack://pdfjs-dist/build/pdf/src/shared/is_node.js","webpack://pdfjs-dist/build/pdf/src/display/canvas.js","webpack://pdfjs-dist/build/pdf/src/display/pattern_helper.js","webpack://pdfjs-dist/build/pdf/src/shared/image_utils.js","webpack://pdfjs-dist/build/pdf/src/display/worker_options.js","webpack://pdfjs-dist/build/pdf/src/shared/message_handler.js","webpack://pdfjs-dist/build/pdf/src/display/metadata.js","webpack://pdfjs-dist/build/pdf/src/display/optional_content_config.js","webpack://pdfjs-dist/build/pdf/src/display/transport_stream.js","webpack://pdfjs-dist/build/pdf/src/display/xfa_text.js","webpack://pdfjs-dist/build/pdf/src/display/node_utils.js","webpack://pdfjs-dist/build/pdf/src/display/node_stream.js","webpack://pdfjs-dist/build/pdf/src/display/network_utils.js","webpack://pdfjs-dist/build/pdf/src/display/content_disposition.js","webpack://pdfjs-dist/build/pdf/src/display/network.js","webpack://pdfjs-dist/build/pdf/src/display/fetch_stream.js","webpack://pdfjs-dist/build/pdf/src/display/text_layer.js","webpack://pdfjs-dist/build/pdf/src/display/editor/annotation_editor_layer.js","webpack://pdfjs-dist/build/pdf/src/display/editor/freetext.js","webpack://pdfjs-dist/build/pdf/src/display/editor/ink.js","webpack://pdfjs-dist/build/pdf/src/display/editor/fit_curve.js","webpack://pdfjs-dist/build/pdf/node_modules/fit-curve/src/fit-curve.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_layer.js","webpack://pdfjs-dist/build/pdf/src/shared/scripting_utils.js","webpack://pdfjs-dist/build/pdf/src/display/xfa_layer.js","webpack://pdfjs-dist/build/pdf/src/display/svg.js","webpack://pdfjs-dist/build/pdf/webpack/bootstrap","webpack://pdfjs-dist/build/pdf/src/pdf.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdfjs-dist/build/pdf\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdfjs-dist/build/pdf\"] = factory();\n\telse\n\t\troot[\"pdfjs-dist/build/pdf\"] = factory();\n})(globalThis, () => {\nreturn ","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Skip compatibility checks for modern builds and if we already ran the module.\nif (\n typeof PDFJSDev !== \"undefined\" &&\n !PDFJSDev.test(\"SKIP_BABEL\") &&\n !globalThis._pdfjsCompatibilityChecked\n) {\n globalThis._pdfjsCompatibilityChecked = true;\n require(\"./compatibility.js\");\n}\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\n// Represent the percentage of the height of a single-line field over\n// the font size. Acrobat seems to use this value.\nconst LINE_FACTOR = 1.35;\nconst LINE_DESCENT_FACTOR = 0.35;\nconst BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;\n\n/**\n * Refer to the `WorkerTransport.getRenderingIntent`-method in the API, to see\n * how these flags are being used:\n * - ANY, DISPLAY, and PRINT are the normal rendering intents, note the\n * `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods.\n * - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which\n * annotations are rendered onto the canvas (i.e. by being included in the\n * operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods\n * and their `annotationMode`-option.\n * - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the\n * `OperatorList`-constructor (on the worker-thread).\n */\nconst RenderingIntentFlag = {\n ANY: 0x01,\n DISPLAY: 0x02,\n PRINT: 0x04,\n SAVE: 0x08,\n ANNOTATIONS_FORMS: 0x10,\n ANNOTATIONS_STORAGE: 0x20,\n ANNOTATIONS_DISABLE: 0x40,\n OPLIST: 0x100,\n};\n\nconst AnnotationMode = {\n DISABLE: 0,\n ENABLE: 1,\n ENABLE_FORMS: 2,\n ENABLE_STORAGE: 3,\n};\n\nconst AnnotationEditorPrefix = \"pdfjs_internal_editor_\";\n\nconst AnnotationEditorType = {\n DISABLE: -1,\n NONE: 0,\n FREETEXT: 3,\n INK: 15,\n};\n\nconst AnnotationEditorParamsType = {\n FREETEXT_SIZE: 1,\n FREETEXT_COLOR: 2,\n FREETEXT_OPACITY: 3,\n INK_COLOR: 11,\n INK_THICKNESS: 12,\n INK_OPACITY: 13,\n};\n\n// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800,\n};\n\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4,\n};\n\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3,\n};\n\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26,\n};\n\nconst AnnotationStateModelType = {\n MARKED: \"Marked\",\n REVIEW: \"Review\",\n};\n\nconst AnnotationMarkedState = {\n MARKED: \"Marked\",\n UNMARKED: \"Unmarked\",\n};\n\nconst AnnotationReviewState = {\n ACCEPTED: \"Accepted\",\n REJECTED: \"Rejected\",\n CANCELLED: \"Cancelled\",\n COMPLETED: \"Completed\",\n NONE: \"None\",\n};\n\nconst AnnotationReplyType = {\n GROUP: \"Group\",\n REPLY: \"R\",\n};\n\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200,\n};\n\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000,\n};\n\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5,\n};\n\nconst AnnotationActionEventType = {\n E: \"Mouse Enter\",\n X: \"Mouse Exit\",\n D: \"Mouse Down\",\n U: \"Mouse Up\",\n Fo: \"Focus\",\n Bl: \"Blur\",\n PO: \"PageOpen\",\n PC: \"PageClose\",\n PV: \"PageVisible\",\n PI: \"PageInvisible\",\n K: \"Keystroke\",\n F: \"Format\",\n V: \"Validate\",\n C: \"Calculate\",\n};\n\nconst DocumentActionEventType = {\n WC: \"WillClose\",\n WS: \"WillSave\",\n DS: \"DidSave\",\n WP: \"WillPrint\",\n DP: \"DidPrint\",\n};\n\nconst PageActionEventType = {\n O: \"PageOpen\",\n C: \"PageClose\",\n};\n\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5,\n};\n\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n};\n\n// All the possible operations for an operator list.\nconst OPS = {\n // Intentionally start from 1 so it is easy to spot bad operators that will be\n // 0's.\n // PLEASE NOTE: We purposely keep any removed operators commented out, since\n // re-numbering the list would risk breaking third-party users.\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n // beginAnnotations: 78,\n // endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n // paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91,\n};\n\nconst UNSUPPORTED_FEATURES =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? {\n forms: \"forms\",\n javaScript: \"javaScript\",\n signatures: \"signatures\",\n smask: \"smask\",\n shadingPattern: \"shadingPattern\",\n errorTilingPattern: \"errorTilingPattern\",\n errorExtGState: \"errorExtGState\",\n errorXObject: \"errorXObject\",\n errorFontLoadType3: \"errorFontLoadType3\",\n errorFontState: \"errorFontState\",\n errorFontMissing: \"errorFontMissing\",\n errorFontTranslate: \"errorFontTranslate\",\n errorColorSpace: \"errorColorSpace\",\n errorOperatorList: \"errorOperatorList\",\n errorFontToUnicode: \"errorFontToUnicode\",\n errorFontLoadNative: \"errorFontLoadNative\",\n errorFontBuildPath: \"errorFontBuildPath\",\n errorFontGetPath: \"errorFontGetPath\",\n errorMarkedContent: \"errorMarkedContent\",\n errorContentSubStream: \"errorContentSubStream\",\n }\n : null;\n\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2,\n};\n\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\n// A notice for devs. These are good for things that are helpful to devs, such\n// as warning that Workers were disabled, which is important to devs but not\n// end users.\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log(`Info: ${msg}`);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log(`Warning: ${msg}`);\n }\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\n// Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.\nfunction _isValidProtocol(url) {\n if (!url) {\n return false;\n }\n switch (url.protocol) {\n case \"http:\":\n case \"https:\":\n case \"ftp:\":\n case \"mailto:\":\n case \"tel:\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Attempts to create a valid absolute URL.\n *\n * @param {URL|string} url - An absolute, or relative, URL.\n * @param {URL|string} [baseUrl] - An absolute URL.\n * @param {Object} [options]\n * @returns Either a valid {URL}, or `null` otherwise.\n */\nfunction createValidAbsoluteUrl(url, baseUrl = null, options = null) {\n if (!url) {\n return null;\n }\n try {\n if (options && typeof url === \"string\") {\n // Let URLs beginning with \"www.\" default to using the \"http://\" protocol.\n if (options.addDefaultProtocol && url.startsWith(\"www.\")) {\n const dots = url.match(/\\./g);\n // Avoid accidentally matching a *relative* URL pointing to a file named\n // e.g. \"www.pdf\" or similar.\n if (dots && dots.length >= 2) {\n url = `http://${url}`;\n }\n }\n\n // According to ISO 32000-1:2008, section 12.6.4.7, URIs should be encoded\n // in 7-bit ASCII. Some bad PDFs use UTF-8 encoding; see bug 1122280.\n if (options.tryConvertEncoding) {\n try {\n url = stringToUTF8String(url);\n } catch (ex) {}\n }\n }\n\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) {\n /* `new URL()` will throw on incorrect data. */\n }\n return null;\n}\n\nfunction shadow(obj, prop, value, nonSerializable = false) {\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(\n prop in obj,\n `shadow: Property \"${prop && prop.toString()}\" not found in object.`\n );\n }\n Object.defineProperty(obj, prop, {\n value,\n enumerable: !nonSerializable,\n configurable: true,\n writable: false,\n });\n return value;\n}\n\n/**\n * @type {any}\n */\nconst BaseException = (function BaseExceptionClosure() {\n // eslint-disable-next-line no-shadow\n function BaseException(message, name) {\n if (this.constructor === BaseException) {\n unreachable(\"Cannot initialize BaseException.\");\n }\n this.message = message;\n this.name = name;\n }\n BaseException.prototype = new Error();\n BaseException.constructor = BaseException;\n\n return BaseException;\n})();\n\nclass PasswordException extends BaseException {\n constructor(msg, code) {\n super(msg, \"PasswordException\");\n this.code = code;\n }\n}\n\nclass UnknownErrorException extends BaseException {\n constructor(msg, details) {\n super(msg, \"UnknownErrorException\");\n this.details = details;\n }\n}\n\nclass InvalidPDFException extends BaseException {\n constructor(msg) {\n super(msg, \"InvalidPDFException\");\n }\n}\n\nclass MissingPDFException extends BaseException {\n constructor(msg) {\n super(msg, \"MissingPDFException\");\n }\n}\n\nclass UnexpectedResponseException extends BaseException {\n constructor(msg, status) {\n super(msg, \"UnexpectedResponseException\");\n this.status = status;\n }\n}\n\n/**\n * Error caused during parsing PDF data.\n */\nclass FormatError extends BaseException {\n constructor(msg) {\n super(msg, \"FormatError\");\n }\n}\n\n/**\n * Error used to indicate task cancellation.\n */\nclass AbortException extends BaseException {\n constructor(msg) {\n super(msg, \"AbortException\");\n }\n}\n\nfunction bytesToString(bytes) {\n if (\n typeof bytes !== \"object\" ||\n bytes === null ||\n bytes.length === undefined\n ) {\n unreachable(\"Invalid argument for bytesToString\");\n }\n const length = bytes.length;\n const MAX_ARGUMENT_COUNT = 8192;\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n const strBuf = [];\n for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n const chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n if (typeof str !== \"string\") {\n unreachable(\"Invalid argument for stringToBytes\");\n }\n const length = str.length;\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n return bytes;\n}\n\n/**\n * Gets length of the array (Array, Uint8Array, or string) in bytes.\n * @param {Array|Uint8Array|string} arr\n * @returns {number}\n */\n// eslint-disable-next-line consistent-return\nfunction arrayByteLength(arr) {\n if (arr.length !== undefined) {\n return arr.length;\n }\n if (arr.byteLength !== undefined) {\n return arr.byteLength;\n }\n unreachable(\"Invalid argument for arrayByteLength\");\n}\n\n/**\n * Combines array items (arrays) into single Uint8Array object.\n * @param {Array|Uint8Array|string>} arr - the array of the arrays\n * (Array, Uint8Array, or string).\n * @returns {Uint8Array}\n */\nfunction arraysToBytes(arr) {\n const length = arr.length;\n // Shortcut: if first and only item is Uint8Array, return it.\n if (length === 1 && arr[0] instanceof Uint8Array) {\n return arr[0];\n }\n let resultLength = 0;\n for (let i = 0; i < length; i++) {\n resultLength += arrayByteLength(arr[i]);\n }\n let pos = 0;\n const data = new Uint8Array(resultLength);\n for (let i = 0; i < length; i++) {\n let item = arr[i];\n if (!(item instanceof Uint8Array)) {\n if (typeof item === \"string\") {\n item = stringToBytes(item);\n } else {\n item = new Uint8Array(item);\n }\n }\n const itemLength = item.byteLength;\n data.set(item, pos);\n pos += itemLength;\n }\n return data;\n}\n\nfunction string32(value) {\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(\n typeof value === \"number\" && Math.abs(value) < 2 ** 32,\n `string32: Unexpected input \"${value}\".`\n );\n }\n return String.fromCharCode(\n (value >> 24) & 0xff,\n (value >> 16) & 0xff,\n (value >> 8) & 0xff,\n value & 0xff\n );\n}\n\nfunction objectSize(obj) {\n return Object.keys(obj).length;\n}\n\n// Ensure that the returned Object has a `null` prototype; hence why\n// `Object.fromEntries(...)` is not used.\nfunction objectFromMap(map) {\n const obj = Object.create(null);\n for (const [key, value] of map) {\n obj[key] = value;\n }\n return obj;\n}\n\n// Checks the endianness of the platform.\nfunction isLittleEndian() {\n const buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return view32[0] === 1;\n}\n\n// Checks if it's possible to eval JS expressions.\nfunction isEvalSupported() {\n try {\n new Function(\"\"); // eslint-disable-line no-new, no-new-func\n return true;\n } catch (e) {\n return false;\n }\n}\n\nclass FeatureTest {\n static get isLittleEndian() {\n return shadow(this, \"isLittleEndian\", isLittleEndian());\n }\n\n static get isEvalSupported() {\n return shadow(this, \"isEvalSupported\", isEvalSupported());\n }\n\n static get isOffscreenCanvasSupported() {\n return shadow(\n this,\n \"isOffscreenCanvasSupported\",\n typeof OffscreenCanvas !== \"undefined\"\n );\n }\n\n static get platform() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n typeof navigator === \"undefined\"\n ) {\n return shadow(this, \"platform\", { isWin: false, isMac: false });\n }\n return shadow(this, \"platform\", {\n isWin: navigator.platform.includes(\"Win\"),\n isMac: navigator.platform.includes(\"Mac\"),\n });\n }\n}\n\nconst hexNumbers = [...Array(256).keys()].map(n =>\n n.toString(16).padStart(2, \"0\")\n);\n\nclass Util {\n static makeHexColor(r, g, b) {\n return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;\n }\n\n // Apply a scaling matrix to some min/max values.\n // If a scaling factor is negative then min and max must be\n // swaped.\n static scaleMinMax(transform, minMax) {\n let temp;\n if (transform[0]) {\n if (transform[0] < 0) {\n temp = minMax[0];\n minMax[0] = minMax[1];\n minMax[1] = temp;\n }\n minMax[0] *= transform[0];\n minMax[1] *= transform[0];\n\n if (transform[3] < 0) {\n temp = minMax[2];\n minMax[2] = minMax[3];\n minMax[3] = temp;\n }\n minMax[2] *= transform[3];\n minMax[3] *= transform[3];\n } else {\n temp = minMax[0];\n minMax[0] = minMax[2];\n minMax[2] = temp;\n temp = minMax[1];\n minMax[1] = minMax[3];\n minMax[3] = temp;\n\n if (transform[1] < 0) {\n temp = minMax[2];\n minMax[2] = minMax[3];\n minMax[3] = temp;\n }\n minMax[2] *= transform[1];\n minMax[3] *= transform[1];\n\n if (transform[2] < 0) {\n temp = minMax[0];\n minMax[0] = minMax[1];\n minMax[1] = temp;\n }\n minMax[0] *= transform[2];\n minMax[1] *= transform[2];\n }\n minMax[0] += transform[4];\n minMax[1] += transform[4];\n minMax[2] += transform[5];\n minMax[3] += transform[5];\n }\n\n // Concatenates two transformation matrices together and returns the result.\n static transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n }\n\n // For 2d affine transforms\n static applyTransform(p, m) {\n const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n }\n\n static applyInverseTransform(p, m) {\n const d = m[0] * m[3] - m[1] * m[2];\n const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n }\n\n // Applies the transform to the rectangle and finds the minimum axially\n // aligned bounding box.\n static getAxialAlignedBoundingBox(r, m) {\n const p1 = Util.applyTransform(r, m);\n const p2 = Util.applyTransform(r.slice(2, 4), m);\n const p3 = Util.applyTransform([r[0], r[3]], m);\n const p4 = Util.applyTransform([r[2], r[1]], m);\n return [\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n ];\n }\n\n static inverseTransform(m) {\n const d = m[0] * m[3] - m[1] * m[2];\n return [\n m[3] / d,\n -m[1] / d,\n -m[2] / d,\n m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d,\n (m[4] * m[1] - m[5] * m[0]) / d,\n ];\n }\n\n // This calculation uses Singular Value Decomposition.\n // The SVD can be represented with formula A = USV. We are interested in the\n // matrix S here because it represents the scale values.\n static singularValueDecompose2dScale(m) {\n const transpose = [m[0], m[2], m[1], m[3]];\n\n // Multiply matrix m with its transpose.\n const a = m[0] * transpose[0] + m[1] * transpose[2];\n const b = m[0] * transpose[1] + m[1] * transpose[3];\n const c = m[2] * transpose[0] + m[3] * transpose[2];\n const d = m[2] * transpose[1] + m[3] * transpose[3];\n\n // Solve the second degree polynomial to get roots.\n const first = (a + d) / 2;\n const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;\n const sx = first + second || 1;\n const sy = first - second || 1;\n\n // Scale values are the square roots of the eigenvalues.\n return [Math.sqrt(sx), Math.sqrt(sy)];\n }\n\n // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)\n // For coordinate systems whose origin lies in the bottom-left, this\n // means normalization to (BL,TR) ordering. For systems with origin in the\n // top-left, this means (TL,BR) ordering.\n static normalizeRect(rect) {\n const r = rect.slice(0); // clone rect\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n return r;\n }\n\n // Returns a rectangle [x1, y1, x2, y2] corresponding to the\n // intersection of rect1 and rect2. If no intersection, returns 'null'\n // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]\n static intersect(rect1, rect2) {\n const xLow = Math.max(\n Math.min(rect1[0], rect1[2]),\n Math.min(rect2[0], rect2[2])\n );\n const xHigh = Math.min(\n Math.max(rect1[0], rect1[2]),\n Math.max(rect2[0], rect2[2])\n );\n if (xLow > xHigh) {\n return null;\n }\n const yLow = Math.max(\n Math.min(rect1[1], rect1[3]),\n Math.min(rect2[1], rect2[3])\n );\n const yHigh = Math.min(\n Math.max(rect1[1], rect1[3]),\n Math.max(rect2[1], rect2[3])\n );\n if (yLow > yHigh) {\n return null;\n }\n\n return [xLow, yLow, xHigh, yHigh];\n }\n\n // From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852\n static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {\n const tvalues = [],\n bounds = [[], []];\n let a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (let i = 0; i < 2; ++i) {\n if (i === 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (Math.abs(a) < 1e-12) {\n if (Math.abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = Math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n let j = tvalues.length,\n mt;\n const jlen = j;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] =\n mt * mt * mt * x0 +\n 3 * mt * mt * t * x1 +\n 3 * mt * t * t * x2 +\n t * t * t * x3;\n bounds[1][j] =\n mt * mt * mt * y0 +\n 3 * mt * mt * t * y1 +\n 3 * mt * t * t * y2 +\n t * t * t * y3;\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n return [\n Math.min(...bounds[0]),\n Math.min(...bounds[1]),\n Math.max(...bounds[0]),\n Math.max(...bounds[1]),\n ];\n }\n}\n\nconst PDFStringTranslateTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8,\n 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192,\n 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,\n 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,\n 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,\n];\n\nfunction stringToPDFString(str) {\n if (str[0] >= \"\\xEF\") {\n let encoding;\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n encoding = \"utf-16be\";\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n encoding = \"utf-16le\";\n } else if (str[0] === \"\\xEF\" && str[1] === \"\\xBB\" && str[2] === \"\\xBF\") {\n encoding = \"utf-8\";\n }\n\n if (encoding) {\n try {\n const decoder = new TextDecoder(encoding, { fatal: true });\n const buffer = stringToBytes(str);\n return decoder.decode(buffer);\n } catch (ex) {\n warn(`stringToPDFString: \"${ex}\".`);\n }\n }\n }\n // ISO Latin 1\n const strBuf = [];\n for (let i = 0, ii = str.length; i < ii; i++) {\n const code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === \"object\" && v !== null && v.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0, ii = arr1.length; i < ii; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction getModificationDate(date = new Date()) {\n const buffer = [\n date.getUTCFullYear().toString(),\n (date.getUTCMonth() + 1).toString().padStart(2, \"0\"),\n date.getUTCDate().toString().padStart(2, \"0\"),\n date.getUTCHours().toString().padStart(2, \"0\"),\n date.getUTCMinutes().toString().padStart(2, \"0\"),\n date.getUTCSeconds().toString().padStart(2, \"0\"),\n ];\n\n return buffer.join(\"\");\n}\n\n/**\n * Promise Capability object.\n *\n * @typedef {Object} PromiseCapability\n * @property {Promise} promise - A Promise object.\n * @property {boolean} settled - If the Promise has been fulfilled/rejected.\n * @property {function} resolve - Fulfills the Promise.\n * @property {function} reject - Rejects the Promise.\n */\n\n/**\n * Creates a promise capability object.\n * @alias createPromiseCapability\n *\n * @returns {PromiseCapability}\n */\nfunction createPromiseCapability() {\n const capability = Object.create(null);\n let isSettled = false;\n\n Object.defineProperty(capability, \"settled\", {\n get() {\n return isSettled;\n },\n });\n capability.promise = new Promise(function (resolve, reject) {\n capability.resolve = function (data) {\n isSettled = true;\n resolve(data);\n };\n capability.reject = function (reason) {\n isSettled = true;\n reject(reason);\n };\n });\n return capability;\n}\n\nexport {\n AbortException,\n AnnotationActionEventType,\n AnnotationBorderStyleType,\n AnnotationEditorParamsType,\n AnnotationEditorPrefix,\n AnnotationEditorType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMarkedState,\n AnnotationMode,\n AnnotationReplyType,\n AnnotationReviewState,\n AnnotationStateModelType,\n AnnotationType,\n arrayByteLength,\n arraysToBytes,\n assert,\n BaseException,\n BASELINE_FACTOR,\n bytesToString,\n CMapCompressionType,\n createPromiseCapability,\n createValidAbsoluteUrl,\n DocumentActionEventType,\n FeatureTest,\n FONT_IDENTITY_MATRIX,\n FormatError,\n getModificationDate,\n getVerbosityLevel,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n InvalidPDFException,\n isArrayBuffer,\n isArrayEqual,\n LINE_DESCENT_FACTOR,\n LINE_FACTOR,\n MissingPDFException,\n objectFromMap,\n objectSize,\n OPS,\n PageActionEventType,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n RenderingIntentFlag,\n setVerbosityLevel,\n shadow,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF8String,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n UNSUPPORTED_FEATURES,\n utf8StringToString,\n Util,\n VerbosityLevel,\n warn,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @module pdfjsLib\n */\n\nimport {\n AbortException,\n AnnotationMode,\n assert,\n createPromiseCapability,\n getVerbosityLevel,\n info,\n InvalidPDFException,\n isArrayBuffer,\n MissingPDFException,\n PasswordException,\n RenderingIntentFlag,\n setVerbosityLevel,\n shadow,\n stringToBytes,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n warn,\n} from \"../shared/util.js\";\nimport {\n AnnotationStorage,\n PrintAnnotationStorage,\n} from \"./annotation_storage.js\";\nimport {\n deprecated,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n DOMStandardFontDataFactory,\n isDataScheme,\n isValidFetchUrl,\n loadScript,\n PageViewport,\n RenderingCancelledException,\n StatTimer,\n} from \"./display_utils.js\";\nimport { FontFaceObject, FontLoader } from \"./font_loader.js\";\nimport { CanvasGraphics } from \"./canvas.js\";\nimport { GlobalWorkerOptions } from \"./worker_options.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\nimport { MessageHandler } from \"../shared/message_handler.js\";\nimport { Metadata } from \"./metadata.js\";\nimport { OptionalContentConfig } from \"./optional_content_config.js\";\nimport { PDFDataTransportStream } from \"./transport_stream.js\";\nimport { XfaText } from \"./xfa_text.js\";\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\nconst RENDERING_CANCELLED_TIMEOUT = 100; // ms\n\nlet DefaultCanvasFactory = DOMCanvasFactory;\nlet DefaultCMapReaderFactory = DOMCMapReaderFactory;\nlet DefaultStandardFontDataFactory = DOMStandardFontDataFactory;\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\") && isNodeJS) {\n const {\n NodeCanvasFactory,\n NodeCMapReaderFactory,\n NodeStandardFontDataFactory,\n } = require(\"./node_utils.js\");\n\n DefaultCanvasFactory = NodeCanvasFactory;\n DefaultCMapReaderFactory = NodeCMapReaderFactory;\n DefaultStandardFontDataFactory = NodeStandardFontDataFactory;\n}\n\nlet createPDFNetworkStream;\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n const streamsPromise = Promise.all([\n import(\"./network.js\"),\n import(\"./fetch_stream.js\"),\n ]);\n\n createPDFNetworkStream = async params => {\n const [{ PDFNetworkStream }, { PDFFetchStream }] = await streamsPromise;\n\n return isValidFetchUrl(params.url)\n ? new PDFFetchStream(params)\n : new PDFNetworkStream(params);\n };\n} else if (PDFJSDev.test(\"GENERIC || CHROME\")) {\n if (PDFJSDev.test(\"GENERIC\") && isNodeJS) {\n const { PDFNodeStream } = require(\"./node_stream.js\");\n\n createPDFNetworkStream = params => {\n return new PDFNodeStream(params);\n };\n } else {\n const { PDFNetworkStream } = require(\"./network.js\");\n const { PDFFetchStream } = require(\"./fetch_stream.js\");\n\n createPDFNetworkStream = params => {\n return isValidFetchUrl(params.url)\n ? new PDFFetchStream(params)\n : new PDFNetworkStream(params);\n };\n }\n}\n\n/**\n * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |\n * Int16Array | Uint16Array |\n * Int32Array | Uint32Array | Float32Array |\n * Float64Array\n * } TypedArray\n */\n\n/**\n * @typedef { TypedArray | ArrayBuffer | Array | string } BinaryData\n */\n\n/**\n * @typedef {Object} RefProxy\n * @property {number} num\n * @property {number} gen\n */\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string | URL} [url] - The URL of the PDF.\n * @property {BinaryData} [data] - Binary PDF data.\n * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is\n * BASE64-encoded, use `atob()` to convert it to a binary string first.\n *\n * NOTE: If TypedArrays are used they will generally be transferred to the\n * worker-thread. This will help reduce main-thread memory usage, however\n * it will take ownership of the TypedArrays.\n * @property {Object} [httpHeaders] - Basic authentication headers.\n * @property {boolean} [withCredentials] - Indicates whether or not\n * cross-site Access-Control requests should be made using credentials such\n * as cookies or authorization headers. The default is `false`.\n * @property {string} [password] - For decrypting password-protected PDFs.\n * @property {number} [length] - The PDF file length. It's used for progress\n * reports and range requests operations.\n * @property {PDFDataRangeTransport} [range] - Allows for using a custom range\n * transport implementation.\n * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched\n * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.\n * @property {PDFWorker} [worker] - The worker that will be used for loading and\n * parsing the PDF data.\n * @property {number} [verbosity] - Controls the logging level; the constants\n * from {@link VerbosityLevel} should be used.\n * @property {string} [docBaseUrl] - The base URL of the document, used when\n * attempting to recover valid absolute URLs for annotations, and outline\n * items, that (incorrectly) only specify relative URLs.\n * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are\n * located. Include the trailing slash.\n * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary\n * packed or not.\n * @property {Object} [CMapReaderFactory] - The factory that will be used when\n * reading built-in CMap files. Providing a custom factory is useful for\n * environments without Fetch API or `XMLHttpRequest` support, such as\n * Node.js. The default value is {DOMCMapReaderFactory}.\n * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't\n * embedded in the PDF document will fallback to a system font.\n * The default value is `true` in web environments and `false` in Node.js;\n * unless `disableFontFace === true` in which case this defaults to `false`\n * regardless of the environment (to prevent completely broken fonts).\n * @property {string} [standardFontDataUrl] - The URL where the standard font\n * files are located. Include the trailing slash.\n * @property {Object} [StandardFontDataFactory] - The factory that will be used\n * when reading the standard font files. Providing a custom factory is useful\n * for environments without Fetch API or `XMLHttpRequest` support, such as\n * Node.js. The default value is {DOMStandardFontDataFactory}.\n * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the\n * worker-thread when reading CMap and standard font files. When `true`,\n * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.\n * The default value is `true` in web environments and `false` in Node.js.\n * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.\n * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated\n * PDF data cannot be successfully parsed, instead of attempting to recover\n * whatever possible of the data. The default value is `false`.\n * @property {number} [maxImageSize] - The maximum allowed image size in total\n * pixels, i.e. width * height. Images above this value will not be rendered.\n * Use -1 for no limit, which is also the default value.\n * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings\n * as JavaScript. Primarily used to improve performance of font rendering, and\n * when parsing PDF functions. The default value is `true`.\n * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use\n * `OffscreenCanvas` in the worker. Primarily used to improve performance of\n * image conversion/rendering.\n * The default value is `true` in web environments and `false` in Node.js.\n * @property {boolean} [disableFontFace] - By default fonts are converted to\n * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.\n * If disabled, fonts will be rendered using a built-in font renderer that\n * constructs the glyphs with primitive path commands.\n * The default value is `false` in web environments and `true` in Node.js.\n * @property {boolean} [fontExtraProperties] - Include additional properties,\n * which are unused during rendering of PDF documents, when exporting the\n * parsed font data from the worker-thread. This may be useful for debugging\n * purposes (and backwards compatibility), but note that it will lead to\n * increased memory usage. The default value is `false`.\n * @property {boolean} [enableXfa] - Render Xfa forms if any.\n * The default value is `false`.\n * @property {HTMLDocument} [ownerDocument] - Specify an explicit document\n * context to create elements with and to load resources, such as fonts,\n * into. Defaults to the current document.\n * @property {boolean} [disableRange] - Disable range request loading of PDF\n * files. When enabled, and if the server supports partial content requests,\n * then the PDF will be fetched in chunks. The default value is `false`.\n * @property {boolean} [disableStream] - Disable streaming of PDF file data.\n * By default PDF.js attempts to load PDF files in chunks. The default value\n * is `false`.\n * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file\n * data. When range requests are enabled PDF.js will automatically keep\n * fetching more data even if it isn't needed to display the current page.\n * The default value is `false`.\n *\n * NOTE: It is also necessary to disable streaming, see above, in order for\n * disabling of pre-fetching to work correctly.\n * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js\n * (see `web/debugger.js`). The default value is `false`.\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n *\n * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or\n * XHR as fallback) is used, which means it must follow same origin rules,\n * e.g. no cross-domain requests without CORS.\n *\n * @param {string | URL | TypedArray | ArrayBuffer | DocumentInitParameters}\n * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)\n * already populated with data, or a parameter object.\n * @returns {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (typeof src === \"string\" || src instanceof URL) {\n src = { url: src };\n } else if (isArrayBuffer(src)) {\n src = { data: src };\n } else if (src instanceof PDFDataRangeTransport) {\n deprecated(\n \"`PDFDataRangeTransport`-instance, \" +\n \"please use a parameter object with `range`-property instead.\"\n );\n src = { range: src };\n } else {\n if (typeof src !== \"object\") {\n throw new Error(\n \"Invalid parameter in getDocument, \" +\n \"need either string, URL, TypedArray, or parameter object.\"\n );\n }\n }\n } else if (typeof src !== \"object\") {\n throw new Error(\"Invalid parameter in getDocument, need parameter object.\");\n }\n if (!src.url && !src.data && !src.range) {\n throw new Error(\n \"Invalid parameter object: need either .data, .range or .url\"\n );\n }\n const task = new PDFDocumentLoadingTask();\n\n const params = Object.create(null);\n let rangeTransport = null,\n worker = null;\n\n for (const key in src) {\n const val = src[key];\n\n switch (key) {\n case \"url\":\n if (val instanceof URL) {\n params[key] = val.href;\n continue;\n }\n try {\n // The full path is required in the 'url' field.\n params[key] = new URL(val, window.location).href;\n continue;\n } catch (ex) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n typeof val === \"string\"\n ) {\n break; // Use the url as-is in Node.js environments.\n }\n }\n throw new Error(\n \"Invalid PDF url data: \" +\n \"either string or URL-object is expected in the url property.\"\n );\n case \"range\":\n rangeTransport = val;\n continue;\n case \"worker\":\n worker = val;\n continue;\n case \"data\":\n // Converting string or array-like data to Uint8Array.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n typeof Buffer !== \"undefined\" && // eslint-disable-line no-undef\n val instanceof Buffer // eslint-disable-line no-undef\n ) {\n params[key] = new Uint8Array(val);\n } else if (\n val instanceof Uint8Array &&\n val.byteLength === val.buffer.byteLength\n ) {\n // Use the data as-is when it's already a Uint8Array that completely\n // \"utilizes\" its underlying ArrayBuffer, to prevent any possible\n // issues when transferring it to the worker-thread.\n break;\n } else if (typeof val === \"string\") {\n params[key] = stringToBytes(val);\n } else if (\n (typeof val === \"object\" && val !== null && !isNaN(val.length)) ||\n isArrayBuffer(val)\n ) {\n params[key] = new Uint8Array(val);\n } else {\n throw new Error(\n \"Invalid PDF binary data: either TypedArray, \" +\n \"string, or array-like object is expected in the data property.\"\n );\n }\n continue;\n }\n params[key] = val;\n }\n\n params.CMapReaderFactory =\n params.CMapReaderFactory || DefaultCMapReaderFactory;\n params.StandardFontDataFactory =\n params.StandardFontDataFactory || DefaultStandardFontDataFactory;\n params.ignoreErrors = params.stopAtErrors !== true;\n params.fontExtraProperties = params.fontExtraProperties === true;\n params.pdfBug = params.pdfBug === true;\n params.enableXfa = params.enableXfa === true;\n\n if (!Number.isInteger(params.rangeChunkSize) || params.rangeChunkSize < 1) {\n params.rangeChunkSize = DEFAULT_RANGE_CHUNK_SIZE;\n }\n if (\n typeof params.docBaseUrl !== \"string\" ||\n isDataScheme(params.docBaseUrl)\n ) {\n // Ignore \"data:\"-URLs, since they can't be used to recover valid absolute\n // URLs anyway. We want to avoid sending them to the worker-thread, since\n // they contain the *entire* PDF document and can thus be arbitrarily long.\n params.docBaseUrl = null;\n }\n if (!Number.isInteger(params.maxImageSize) || params.maxImageSize < -1) {\n params.maxImageSize = -1;\n }\n if (typeof params.cMapUrl !== \"string\") {\n params.cMapUrl = null;\n }\n if (typeof params.standardFontDataUrl !== \"string\") {\n params.standardFontDataUrl = null;\n }\n if (typeof params.useWorkerFetch !== \"boolean\") {\n params.useWorkerFetch =\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (params.CMapReaderFactory === DOMCMapReaderFactory &&\n params.StandardFontDataFactory === DOMStandardFontDataFactory &&\n isValidFetchUrl(params.cMapUrl, document.baseURI) &&\n isValidFetchUrl(params.standardFontDataUrl, document.baseURI));\n }\n if (typeof params.isEvalSupported !== \"boolean\") {\n params.isEvalSupported = true;\n }\n if (typeof params.isOffscreenCanvasSupported !== \"boolean\") {\n params.isOffscreenCanvasSupported = !isNodeJS;\n }\n if (typeof params.disableFontFace !== \"boolean\") {\n params.disableFontFace = isNodeJS;\n }\n if (typeof params.useSystemFonts !== \"boolean\") {\n params.useSystemFonts = !isNodeJS && !params.disableFontFace;\n }\n if (\n typeof params.ownerDocument !== \"object\" ||\n params.ownerDocument === null\n ) {\n params.ownerDocument = globalThis.document;\n }\n\n if (typeof params.disableRange !== \"boolean\") {\n params.disableRange = false;\n }\n if (typeof params.disableStream !== \"boolean\") {\n params.disableStream = false;\n }\n if (typeof params.disableAutoFetch !== \"boolean\") {\n params.disableAutoFetch = false;\n }\n\n // Set the main-thread verbosity level.\n setVerbosityLevel(params.verbosity);\n\n if (!worker) {\n const workerParams = {\n verbosity: params.verbosity,\n port: GlobalWorkerOptions.workerPort,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n worker = workerParams.port\n ? PDFWorker.fromPort(workerParams)\n : new PDFWorker(workerParams);\n task._worker = worker;\n }\n const docId = task.docId;\n worker.promise\n .then(function () {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const workerIdPromise = _fetchDocument(\n worker,\n params,\n rangeTransport,\n docId\n );\n const networkStreamPromise = new Promise(function (resolve) {\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream(\n {\n length: params.length,\n initialData: params.initialData,\n progressiveDone: params.progressiveDone,\n contentDispositionFilename: params.contentDispositionFilename,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n },\n rangeTransport\n );\n } else if (!params.data) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: createPDFNetworkStream\");\n }\n networkStream = createPDFNetworkStream({\n url: params.url,\n length: params.length,\n httpHeaders: params.httpHeaders,\n withCredentials: params.withCredentials,\n rangeChunkSize: params.rangeChunkSize,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n });\n }\n resolve(networkStream);\n });\n\n return Promise.all([workerIdPromise, networkStreamPromise]).then(\n function ([workerId, networkStream]) {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const messageHandler = new MessageHandler(\n docId,\n workerId,\n worker.port\n );\n const transport = new WorkerTransport(\n messageHandler,\n task,\n networkStream,\n params\n );\n task._transport = transport;\n messageHandler.send(\"Ready\", null);\n }\n );\n })\n .catch(task._capability.reject);\n\n return task;\n}\n\n/**\n * Starts fetching of specified PDF document/data.\n *\n * @param {PDFWorker} worker\n * @param {Object} source\n * @param {PDFDataRangeTransport} pdfDataRangeTransport\n * @param {string} docId - Unique document ID, used in `MessageHandler`.\n * @returns {Promise} A promise that is resolved when the worker ID of\n * the `MessageHandler` is known.\n * @private\n */\nasync function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n\n if (pdfDataRangeTransport) {\n source.length = pdfDataRangeTransport.length;\n source.initialData = pdfDataRangeTransport.initialData;\n source.progressiveDone = pdfDataRangeTransport.progressiveDone;\n source.contentDispositionFilename =\n pdfDataRangeTransport.contentDispositionFilename;\n }\n const transfers = source.data ? [source.data.buffer] : null;\n\n const workerId = await worker.messageHandler.sendWithPromise(\n \"GetDocRequest\",\n // Only send the required properties, and *not* the entire `source` object.\n {\n docId,\n apiVersion:\n typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"TESTING\")\n ? PDFJSDev.eval(\"BUNDLE_VERSION\")\n : null,\n data: source.data,\n password: source.password,\n disableAutoFetch: source.disableAutoFetch,\n rangeChunkSize: source.rangeChunkSize,\n length: source.length,\n docBaseUrl: source.docBaseUrl,\n enableXfa: source.enableXfa,\n evaluatorOptions: {\n maxImageSize: source.maxImageSize,\n disableFontFace: source.disableFontFace,\n ignoreErrors: source.ignoreErrors,\n isEvalSupported: source.isEvalSupported,\n isOffscreenCanvasSupported: source.isOffscreenCanvasSupported,\n fontExtraProperties: source.fontExtraProperties,\n useSystemFonts: source.useSystemFonts,\n cMapUrl: source.useWorkerFetch ? source.cMapUrl : null,\n standardFontDataUrl: source.useWorkerFetch\n ? source.standardFontDataUrl\n : null,\n },\n },\n transfers\n );\n\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n return workerId;\n}\n\n/**\n * @typedef {Object} OnProgressParameters\n * @property {number} loaded - Currently loaded number of bytes.\n * @property {number} total - Total number of bytes in the PDF file.\n */\n\n/**\n * The loading task controls the operations required to load a PDF document\n * (such as network requests) and provides a way to listen for completion,\n * after which individual pages can be rendered.\n */\nclass PDFDocumentLoadingTask {\n static #docId = 0;\n\n #onUnsupportedFeature = null;\n\n constructor() {\n this._capability = createPromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique identifier for the document loading task.\n * @type {string}\n */\n this.docId = `d${PDFDocumentLoadingTask.#docId++}`;\n\n /**\n * Whether the loading task is destroyed or not.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if a wrong or no password was provided.\n * The callback receives two parameters: a function that should be called\n * with the new password, and a reason (see {@link PasswordResponses}).\n * @type {function}\n */\n this.onPassword = null;\n\n /**\n * Callback to be able to monitor the loading progress of the PDF file\n * (necessary to implement e.g. a loading bar).\n * The callback receives an {@link OnProgressParameters} argument.\n * @type {function}\n */\n this.onProgress = null;\n }\n\n /**\n * @type {function | null} The current callback used with unsupported\n * features.\n */\n get onUnsupportedFeature() {\n return this.#onUnsupportedFeature;\n }\n\n /**\n * Callback for when an unsupported feature is used in the PDF document.\n * The callback receives an {@link UNSUPPORTED_FEATURES} argument.\n * @type {function}\n */\n set onUnsupportedFeature(callback) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n deprecated(\n \"The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future.\"\n );\n this.#onUnsupportedFeature = callback;\n }\n }\n\n /**\n * Promise for document loading task completion.\n * @type {Promise}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * Abort all network requests and destroy the worker.\n * @returns {Promise} A promise that is resolved when destruction is\n * completed.\n */\n async destroy() {\n this.destroyed = true;\n await this._transport?.destroy();\n\n this._transport = null;\n if (this._worker) {\n this._worker.destroy();\n this._worker = null;\n }\n }\n}\n\n/**\n * Abstract class to support range requests file loading.\n *\n * NOTE: The TypedArrays passed to the constructor and relevant methods below\n * will generally be transferred to the worker-thread. This will help reduce\n * main-thread memory usage, however it will take ownership of the TypedArrays.\n */\nclass PDFDataRangeTransport {\n /**\n * @param {number} length\n * @param {Uint8Array|null} initialData\n * @param {boolean} [progressiveDone]\n * @param {string} [contentDispositionFilename]\n */\n constructor(\n length,\n initialData,\n progressiveDone = false,\n contentDispositionFilename = null\n ) {\n this.length = length;\n this.initialData = initialData;\n this.progressiveDone = progressiveDone;\n this.contentDispositionFilename = contentDispositionFilename;\n\n this._rangeListeners = [];\n this._progressListeners = [];\n this._progressiveReadListeners = [];\n this._progressiveDoneListeners = [];\n this._readyCapability = createPromiseCapability();\n }\n\n /**\n * @param {function} listener\n */\n addRangeListener(listener) {\n this._rangeListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressListener(listener) {\n this._progressListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressiveReadListener(listener) {\n this._progressiveReadListeners.push(listener);\n }\n\n /**\n * @param {function} listener\n */\n addProgressiveDoneListener(listener) {\n this._progressiveDoneListeners.push(listener);\n }\n\n /**\n * @param {number} begin\n * @param {Uint8Array|null} chunk\n */\n onDataRange(begin, chunk) {\n for (const listener of this._rangeListeners) {\n listener(begin, chunk);\n }\n }\n\n /**\n * @param {number} loaded\n * @param {number|undefined} total\n */\n onDataProgress(loaded, total) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressListeners) {\n listener(loaded, total);\n }\n });\n }\n\n /**\n * @param {Uint8Array|null} chunk\n */\n onDataProgressiveRead(chunk) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveReadListeners) {\n listener(chunk);\n }\n });\n }\n\n onDataProgressiveDone() {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveDoneListeners) {\n listener();\n }\n });\n }\n\n transportReady() {\n this._readyCapability.resolve();\n }\n\n /**\n * @param {number} begin\n * @param {number} end\n */\n requestDataRange(begin, end) {\n unreachable(\"Abstract method PDFDataRangeTransport.requestDataRange\");\n }\n\n abort() {}\n}\n\n/**\n * Proxy to a `PDFDocument` in the worker thread.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport) {\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n }\n\n /**\n * @type {AnnotationStorage} Storage for annotation data in forms.\n */\n get annotationStorage() {\n return this._transport.annotationStorage;\n }\n\n /**\n * @type {number} Total number of pages in the PDF file.\n */\n get numPages() {\n return this._pdfInfo.numPages;\n }\n\n /**\n * @type {Array} A (not guaranteed to be) unique ID to\n * identify the PDF document.\n * NOTE: The first element will always be defined for all PDF documents,\n * whereas the second element is only defined for *modified* PDF documents.\n */\n get fingerprints() {\n return this._pdfInfo.fingerprints;\n }\n\n /**\n * @type {boolean} True if only XFA form.\n */\n get isPureXfa() {\n return shadow(this, \"isPureXfa\", !!this._transport._htmlForXfa);\n }\n\n /**\n * NOTE: This is (mostly) intended to support printing of XFA forms.\n *\n * @type {Object | null} An object representing a HTML tree structure\n * to render the XFA, or `null` when no XFA form exists.\n */\n get allXfaHtml() {\n return this._transport._htmlForXfa;\n }\n\n /**\n * @param {number} pageNumber - The page number to get. The first page is 1.\n * @returns {Promise} A promise that is resolved with\n * a {@link PDFPageProxy} object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @param {RefProxy} ref - The page reference.\n * @returns {Promise} A promise that is resolved with the page index,\n * starting from zero, that is associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @returns {Promise