diff --git a/pdfjs/LICENSE b/pdfjs/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/pdfjs/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/pdfjs/build/pdf.mjs b/pdfjs/build/pdf.mjs
new file mode 100644
index 0000000..c9f1e70
--- /dev/null
+++ b/pdfjs/build/pdf.mjs
@@ -0,0 +1,21337 @@
+/**
+ * @licstart The following is the entire license notice for the
+ * JavaScript code in this page
+ *
+ * Copyright 2024 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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
+ */
+
+/******/ // The require scope
+/******/ var __webpack_require__ = {};
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/************************************************************************/
+var __webpack_exports__ = globalThis.pdfjsLib = {};
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+ AbortException: () => (/* reexport */ AbortException),
+ AnnotationEditorLayer: () => (/* reexport */ AnnotationEditorLayer),
+ AnnotationEditorParamsType: () => (/* reexport */ AnnotationEditorParamsType),
+ AnnotationEditorType: () => (/* reexport */ AnnotationEditorType),
+ AnnotationEditorUIManager: () => (/* reexport */ AnnotationEditorUIManager),
+ AnnotationLayer: () => (/* reexport */ AnnotationLayer),
+ AnnotationMode: () => (/* reexport */ AnnotationMode),
+ ColorPicker: () => (/* reexport */ ColorPicker),
+ DOMSVGFactory: () => (/* reexport */ DOMSVGFactory),
+ DrawLayer: () => (/* reexport */ DrawLayer),
+ FeatureTest: () => (/* reexport */ util_FeatureTest),
+ GlobalWorkerOptions: () => (/* reexport */ GlobalWorkerOptions),
+ ImageKind: () => (/* reexport */ util_ImageKind),
+ InvalidPDFException: () => (/* reexport */ InvalidPDFException),
+ MissingPDFException: () => (/* reexport */ MissingPDFException),
+ OPS: () => (/* reexport */ OPS),
+ OutputScale: () => (/* reexport */ OutputScale),
+ PDFDataRangeTransport: () => (/* reexport */ PDFDataRangeTransport),
+ PDFDateString: () => (/* reexport */ PDFDateString),
+ PDFWorker: () => (/* reexport */ PDFWorker),
+ PasswordResponses: () => (/* reexport */ PasswordResponses),
+ PermissionFlag: () => (/* reexport */ PermissionFlag),
+ PixelsPerInch: () => (/* reexport */ PixelsPerInch),
+ RenderingCancelledException: () => (/* reexport */ RenderingCancelledException),
+ TextLayer: () => (/* reexport */ TextLayer),
+ UnexpectedResponseException: () => (/* reexport */ UnexpectedResponseException),
+ Util: () => (/* reexport */ Util),
+ VerbosityLevel: () => (/* reexport */ VerbosityLevel),
+ XfaLayer: () => (/* reexport */ XfaLayer),
+ build: () => (/* reexport */ build),
+ createValidAbsoluteUrl: () => (/* reexport */ createValidAbsoluteUrl),
+ fetchData: () => (/* reexport */ fetchData),
+ getDocument: () => (/* reexport */ getDocument),
+ getFilenameFromUrl: () => (/* reexport */ getFilenameFromUrl),
+ getPdfFilenameFromUrl: () => (/* reexport */ getPdfFilenameFromUrl),
+ getXfaPageViewport: () => (/* reexport */ getXfaPageViewport),
+ isDataScheme: () => (/* reexport */ isDataScheme),
+ isPdfFile: () => (/* reexport */ isPdfFile),
+ noContextMenu: () => (/* reexport */ noContextMenu),
+ normalizeUnicode: () => (/* reexport */ normalizeUnicode),
+ setLayerDimensions: () => (/* reexport */ setLayerDimensions),
+ shadow: () => (/* reexport */ shadow),
+ stopEvent: () => (/* reexport */ stopEvent),
+ version: () => (/* reexport */ version)
+});
+
+;// ./src/shared/util.js
+const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
+const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
+const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
+const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
+const LINE_FACTOR = 1.35;
+const LINE_DESCENT_FACTOR = 0.35;
+const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
+const RenderingIntentFlag = {
+ ANY: 0x01,
+ DISPLAY: 0x02,
+ PRINT: 0x04,
+ SAVE: 0x08,
+ ANNOTATIONS_FORMS: 0x10,
+ ANNOTATIONS_STORAGE: 0x20,
+ ANNOTATIONS_DISABLE: 0x40,
+ IS_EDITING: 0x80,
+ OPLIST: 0x100
+};
+const AnnotationMode = {
+ DISABLE: 0,
+ ENABLE: 1,
+ ENABLE_FORMS: 2,
+ ENABLE_STORAGE: 3
+};
+const AnnotationEditorPrefix = "pdfjs_internal_editor_";
+const AnnotationEditorType = {
+ DISABLE: -1,
+ NONE: 0,
+ FREETEXT: 3,
+ HIGHLIGHT: 9,
+ STAMP: 13,
+ INK: 15
+};
+const AnnotationEditorParamsType = {
+ RESIZE: 1,
+ CREATE: 2,
+ FREETEXT_SIZE: 11,
+ FREETEXT_COLOR: 12,
+ FREETEXT_OPACITY: 13,
+ INK_COLOR: 21,
+ INK_THICKNESS: 22,
+ INK_OPACITY: 23,
+ HIGHLIGHT_COLOR: 31,
+ HIGHLIGHT_DEFAULT_COLOR: 32,
+ HIGHLIGHT_THICKNESS: 33,
+ HIGHLIGHT_FREE: 34,
+ HIGHLIGHT_SHOW_ALL: 35,
+ DRAW_STEP: 41
+};
+const PermissionFlag = {
+ PRINT: 0x04,
+ MODIFY_CONTENTS: 0x08,
+ COPY: 0x10,
+ MODIFY_ANNOTATIONS: 0x20,
+ FILL_INTERACTIVE_FORMS: 0x100,
+ COPY_FOR_ACCESSIBILITY: 0x200,
+ ASSEMBLE: 0x400,
+ PRINT_HIGH_QUALITY: 0x800
+};
+const TextRenderingMode = {
+ FILL: 0,
+ STROKE: 1,
+ FILL_STROKE: 2,
+ INVISIBLE: 3,
+ FILL_ADD_TO_PATH: 4,
+ STROKE_ADD_TO_PATH: 5,
+ FILL_STROKE_ADD_TO_PATH: 6,
+ ADD_TO_PATH: 7,
+ FILL_STROKE_MASK: 3,
+ ADD_TO_PATH_FLAG: 4
+};
+const util_ImageKind = {
+ GRAYSCALE_1BPP: 1,
+ RGB_24BPP: 2,
+ RGBA_32BPP: 3
+};
+const AnnotationType = {
+ TEXT: 1,
+ LINK: 2,
+ FREETEXT: 3,
+ LINE: 4,
+ SQUARE: 5,
+ CIRCLE: 6,
+ POLYGON: 7,
+ POLYLINE: 8,
+ HIGHLIGHT: 9,
+ UNDERLINE: 10,
+ SQUIGGLY: 11,
+ STRIKEOUT: 12,
+ STAMP: 13,
+ CARET: 14,
+ INK: 15,
+ POPUP: 16,
+ FILEATTACHMENT: 17,
+ SOUND: 18,
+ MOVIE: 19,
+ WIDGET: 20,
+ SCREEN: 21,
+ PRINTERMARK: 22,
+ TRAPNET: 23,
+ WATERMARK: 24,
+ THREED: 25,
+ REDACT: 26
+};
+const AnnotationReplyType = {
+ GROUP: "Group",
+ REPLY: "R"
+};
+const AnnotationFlag = {
+ INVISIBLE: 0x01,
+ HIDDEN: 0x02,
+ PRINT: 0x04,
+ NOZOOM: 0x08,
+ NOROTATE: 0x10,
+ NOVIEW: 0x20,
+ READONLY: 0x40,
+ LOCKED: 0x80,
+ TOGGLENOVIEW: 0x100,
+ LOCKEDCONTENTS: 0x200
+};
+const AnnotationFieldFlag = {
+ READONLY: 0x0000001,
+ REQUIRED: 0x0000002,
+ NOEXPORT: 0x0000004,
+ MULTILINE: 0x0001000,
+ PASSWORD: 0x0002000,
+ NOTOGGLETOOFF: 0x0004000,
+ RADIO: 0x0008000,
+ PUSHBUTTON: 0x0010000,
+ COMBO: 0x0020000,
+ EDIT: 0x0040000,
+ SORT: 0x0080000,
+ FILESELECT: 0x0100000,
+ MULTISELECT: 0x0200000,
+ DONOTSPELLCHECK: 0x0400000,
+ DONOTSCROLL: 0x0800000,
+ COMB: 0x1000000,
+ RICHTEXT: 0x2000000,
+ RADIOSINUNISON: 0x2000000,
+ COMMITONSELCHANGE: 0x4000000
+};
+const AnnotationBorderStyleType = {
+ SOLID: 1,
+ DASHED: 2,
+ BEVELED: 3,
+ INSET: 4,
+ UNDERLINE: 5
+};
+const AnnotationActionEventType = {
+ E: "Mouse Enter",
+ X: "Mouse Exit",
+ D: "Mouse Down",
+ U: "Mouse Up",
+ Fo: "Focus",
+ Bl: "Blur",
+ PO: "PageOpen",
+ PC: "PageClose",
+ PV: "PageVisible",
+ PI: "PageInvisible",
+ K: "Keystroke",
+ F: "Format",
+ V: "Validate",
+ C: "Calculate"
+};
+const DocumentActionEventType = {
+ WC: "WillClose",
+ WS: "WillSave",
+ DS: "DidSave",
+ WP: "WillPrint",
+ DP: "DidPrint"
+};
+const PageActionEventType = {
+ O: "PageOpen",
+ C: "PageClose"
+};
+const VerbosityLevel = {
+ ERRORS: 0,
+ WARNINGS: 1,
+ INFOS: 5
+};
+const OPS = {
+ dependency: 1,
+ setLineWidth: 2,
+ setLineCap: 3,
+ setLineJoin: 4,
+ setMiterLimit: 5,
+ setDash: 6,
+ setRenderingIntent: 7,
+ setFlatness: 8,
+ setGState: 9,
+ save: 10,
+ restore: 11,
+ transform: 12,
+ moveTo: 13,
+ lineTo: 14,
+ curveTo: 15,
+ curveTo2: 16,
+ curveTo3: 17,
+ closePath: 18,
+ rectangle: 19,
+ stroke: 20,
+ closeStroke: 21,
+ fill: 22,
+ eoFill: 23,
+ fillStroke: 24,
+ eoFillStroke: 25,
+ closeFillStroke: 26,
+ closeEOFillStroke: 27,
+ endPath: 28,
+ clip: 29,
+ eoClip: 30,
+ beginText: 31,
+ endText: 32,
+ setCharSpacing: 33,
+ setWordSpacing: 34,
+ setHScale: 35,
+ setLeading: 36,
+ setFont: 37,
+ setTextRenderingMode: 38,
+ setTextRise: 39,
+ moveText: 40,
+ setLeadingMoveText: 41,
+ setTextMatrix: 42,
+ nextLine: 43,
+ showText: 44,
+ showSpacedText: 45,
+ nextLineShowText: 46,
+ nextLineSetSpacingShowText: 47,
+ setCharWidth: 48,
+ setCharWidthAndBounds: 49,
+ setStrokeColorSpace: 50,
+ setFillColorSpace: 51,
+ setStrokeColor: 52,
+ setStrokeColorN: 53,
+ setFillColor: 54,
+ setFillColorN: 55,
+ setStrokeGray: 56,
+ setFillGray: 57,
+ setStrokeRGBColor: 58,
+ setFillRGBColor: 59,
+ setStrokeCMYKColor: 60,
+ setFillCMYKColor: 61,
+ shadingFill: 62,
+ beginInlineImage: 63,
+ beginImageData: 64,
+ endInlineImage: 65,
+ paintXObject: 66,
+ markPoint: 67,
+ markPointProps: 68,
+ beginMarkedContent: 69,
+ beginMarkedContentProps: 70,
+ endMarkedContent: 71,
+ beginCompat: 72,
+ endCompat: 73,
+ paintFormXObjectBegin: 74,
+ paintFormXObjectEnd: 75,
+ beginGroup: 76,
+ endGroup: 77,
+ beginAnnotation: 80,
+ endAnnotation: 81,
+ paintImageMaskXObject: 83,
+ paintImageMaskXObjectGroup: 84,
+ paintImageXObject: 85,
+ paintInlineImageXObject: 86,
+ paintInlineImageXObjectGroup: 87,
+ paintImageXObjectRepeat: 88,
+ paintImageMaskXObjectRepeat: 89,
+ paintSolidColorImageMask: 90,
+ constructPath: 91,
+ setStrokeTransparent: 92,
+ setFillTransparent: 93
+};
+const PasswordResponses = {
+ NEED_PASSWORD: 1,
+ INCORRECT_PASSWORD: 2
+};
+let verbosity = VerbosityLevel.WARNINGS;
+function setVerbosityLevel(level) {
+ if (Number.isInteger(level)) {
+ verbosity = level;
+ }
+}
+function getVerbosityLevel() {
+ return verbosity;
+}
+function info(msg) {
+ if (verbosity >= VerbosityLevel.INFOS) {
+ console.log(`Info: ${msg}`);
+ }
+}
+function warn(msg) {
+ if (verbosity >= VerbosityLevel.WARNINGS) {
+ console.log(`Warning: ${msg}`);
+ }
+}
+function unreachable(msg) {
+ throw new Error(msg);
+}
+function assert(cond, msg) {
+ if (!cond) {
+ unreachable(msg);
+ }
+}
+function _isValidProtocol(url) {
+ switch (url?.protocol) {
+ case "http:":
+ case "https:":
+ case "ftp:":
+ case "mailto:":
+ case "tel:":
+ return true;
+ default:
+ return false;
+ }
+}
+function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
+ if (!url) {
+ return null;
+ }
+ try {
+ if (options && typeof url === "string") {
+ if (options.addDefaultProtocol && url.startsWith("www.")) {
+ const dots = url.match(/\./g);
+ if (dots?.length >= 2) {
+ url = `http://${url}`;
+ }
+ }
+ if (options.tryConvertEncoding) {
+ try {
+ url = stringToUTF8String(url);
+ } catch {}
+ }
+ }
+ const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
+ if (_isValidProtocol(absoluteUrl)) {
+ return absoluteUrl;
+ }
+ } catch {}
+ return null;
+}
+function shadow(obj, prop, value, nonSerializable = false) {
+ Object.defineProperty(obj, prop, {
+ value,
+ enumerable: !nonSerializable,
+ configurable: true,
+ writable: false
+ });
+ return value;
+}
+const BaseException = function BaseExceptionClosure() {
+ function BaseException(message, name) {
+ this.message = message;
+ this.name = name;
+ }
+ BaseException.prototype = new Error();
+ BaseException.constructor = BaseException;
+ return BaseException;
+}();
+class PasswordException extends BaseException {
+ constructor(msg, code) {
+ super(msg, "PasswordException");
+ this.code = code;
+ }
+}
+class UnknownErrorException extends BaseException {
+ constructor(msg, details) {
+ super(msg, "UnknownErrorException");
+ this.details = details;
+ }
+}
+class InvalidPDFException extends BaseException {
+ constructor(msg) {
+ super(msg, "InvalidPDFException");
+ }
+}
+class MissingPDFException extends BaseException {
+ constructor(msg) {
+ super(msg, "MissingPDFException");
+ }
+}
+class UnexpectedResponseException extends BaseException {
+ constructor(msg, status) {
+ super(msg, "UnexpectedResponseException");
+ this.status = status;
+ }
+}
+class FormatError extends BaseException {
+ constructor(msg) {
+ super(msg, "FormatError");
+ }
+}
+class AbortException extends BaseException {
+ constructor(msg) {
+ super(msg, "AbortException");
+ }
+}
+function bytesToString(bytes) {
+ if (typeof bytes !== "object" || bytes?.length === undefined) {
+ unreachable("Invalid argument for bytesToString");
+ }
+ const length = bytes.length;
+ const MAX_ARGUMENT_COUNT = 8192;
+ if (length < MAX_ARGUMENT_COUNT) {
+ return String.fromCharCode.apply(null, bytes);
+ }
+ const strBuf = [];
+ for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
+ const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
+ const chunk = bytes.subarray(i, chunkEnd);
+ strBuf.push(String.fromCharCode.apply(null, chunk));
+ }
+ return strBuf.join("");
+}
+function stringToBytes(str) {
+ if (typeof str !== "string") {
+ unreachable("Invalid argument for stringToBytes");
+ }
+ const length = str.length;
+ const bytes = new Uint8Array(length);
+ for (let i = 0; i < length; ++i) {
+ bytes[i] = str.charCodeAt(i) & 0xff;
+ }
+ return bytes;
+}
+function string32(value) {
+ return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
+}
+function objectSize(obj) {
+ return Object.keys(obj).length;
+}
+function objectFromMap(map) {
+ const obj = Object.create(null);
+ for (const [key, value] of map) {
+ obj[key] = value;
+ }
+ return obj;
+}
+function isLittleEndian() {
+ const buffer8 = new Uint8Array(4);
+ buffer8[0] = 1;
+ const view32 = new Uint32Array(buffer8.buffer, 0, 1);
+ return view32[0] === 1;
+}
+function isEvalSupported() {
+ try {
+ new Function("");
+ return true;
+ } catch {
+ return false;
+ }
+}
+class util_FeatureTest {
+ static get isLittleEndian() {
+ return shadow(this, "isLittleEndian", isLittleEndian());
+ }
+ static get isEvalSupported() {
+ return shadow(this, "isEvalSupported", isEvalSupported());
+ }
+ static get isOffscreenCanvasSupported() {
+ return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
+ }
+ static get isImageDecoderSupported() {
+ return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
+ }
+ static get platform() {
+ if (typeof navigator !== "undefined" && typeof navigator?.platform === "string") {
+ return shadow(this, "platform", {
+ isMac: navigator.platform.includes("Mac"),
+ isWindows: navigator.platform.includes("Win"),
+ isFirefox: typeof navigator?.userAgent === "string" && navigator.userAgent.includes("Firefox")
+ });
+ }
+ return shadow(this, "platform", {
+ isMac: false,
+ isWindows: false,
+ isFirefox: false
+ });
+ }
+ static get isCSSRoundSupported() {
+ return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
+ }
+}
+const hexNumbers = Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0"));
+class Util {
+ static makeHexColor(r, g, b) {
+ return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
+ }
+ static scaleMinMax(transform, minMax) {
+ let temp;
+ if (transform[0]) {
+ if (transform[0] < 0) {
+ temp = minMax[0];
+ minMax[0] = minMax[2];
+ minMax[2] = temp;
+ }
+ minMax[0] *= transform[0];
+ minMax[2] *= transform[0];
+ if (transform[3] < 0) {
+ temp = minMax[1];
+ minMax[1] = minMax[3];
+ minMax[3] = temp;
+ }
+ minMax[1] *= transform[3];
+ minMax[3] *= transform[3];
+ } else {
+ temp = minMax[0];
+ minMax[0] = minMax[1];
+ minMax[1] = temp;
+ temp = minMax[2];
+ minMax[2] = minMax[3];
+ minMax[3] = temp;
+ if (transform[1] < 0) {
+ temp = minMax[1];
+ minMax[1] = minMax[3];
+ minMax[3] = temp;
+ }
+ minMax[1] *= transform[1];
+ minMax[3] *= transform[1];
+ if (transform[2] < 0) {
+ temp = minMax[0];
+ minMax[0] = minMax[2];
+ minMax[2] = temp;
+ }
+ minMax[0] *= transform[2];
+ minMax[2] *= transform[2];
+ }
+ minMax[0] += transform[4];
+ minMax[1] += transform[5];
+ minMax[2] += transform[4];
+ minMax[3] += transform[5];
+ }
+ static transform(m1, m2) {
+ return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
+ }
+ static applyTransform(p, m) {
+ const xt = p[0] * m[0] + p[1] * m[2] + m[4];
+ const yt = p[0] * m[1] + p[1] * m[3] + m[5];
+ return [xt, yt];
+ }
+ static applyInverseTransform(p, m) {
+ const d = m[0] * m[3] - m[1] * m[2];
+ const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
+ const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
+ return [xt, yt];
+ }
+ static getAxialAlignedBoundingBox(r, 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) {
+ const d = m[0] * m[3] - m[1] * m[2];
+ return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
+ }
+ static singularValueDecompose2dScale(m) {
+ const transpose = [m[0], m[2], m[1], m[3]];
+ const a = m[0] * transpose[0] + m[1] * transpose[2];
+ const b = m[0] * transpose[1] + m[1] * transpose[3];
+ const c = m[2] * transpose[0] + m[3] * transpose[2];
+ const d = m[2] * transpose[1] + m[3] * transpose[3];
+ const first = (a + d) / 2;
+ const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
+ const sx = first + second || 1;
+ const sy = first - second || 1;
+ return [Math.sqrt(sx), Math.sqrt(sy)];
+ }
+ static normalizeRect(rect) {
+ const r = rect.slice(0);
+ if (rect[0] > rect[2]) {
+ r[0] = rect[2];
+ r[2] = rect[0];
+ }
+ if (rect[1] > rect[3]) {
+ r[1] = rect[3];
+ r[3] = rect[1];
+ }
+ return r;
+ }
+ static intersect(rect1, rect2) {
+ const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
+ const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
+ if (xLow > xHigh) {
+ return null;
+ }
+ const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
+ const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
+ if (yLow > yHigh) {
+ return null;
+ }
+ return [xLow, yLow, xHigh, yHigh];
+ }
+ static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
+ if (t <= 0 || t >= 1) {
+ return;
+ }
+ const mt = 1 - t;
+ const tt = t * t;
+ const ttt = tt * t;
+ const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
+ const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
+ minMax[0] = Math.min(minMax[0], x);
+ minMax[1] = Math.min(minMax[1], y);
+ minMax[2] = Math.max(minMax[2], x);
+ minMax[3] = Math.max(minMax[3], y);
+ }
+ static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
+ if (Math.abs(a) < 1e-12) {
+ if (Math.abs(b) >= 1e-12) {
+ this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
+ }
+ return;
+ }
+ const delta = b ** 2 - 4 * c * a;
+ if (delta < 0) {
+ return;
+ }
+ const sqrtDelta = Math.sqrt(delta);
+ const a2 = 2 * a;
+ this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
+ this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
+ }
+ static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
+ if (minMax) {
+ minMax[0] = Math.min(minMax[0], x0, x3);
+ minMax[1] = Math.min(minMax[1], y0, y3);
+ minMax[2] = Math.max(minMax[2], x0, x3);
+ minMax[3] = Math.max(minMax[3], y0, y3);
+ } else {
+ minMax = [Math.min(x0, x3), Math.min(y0, y3), Math.max(x0, x3), Math.max(y0, y3)];
+ }
+ this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
+ this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
+ return minMax;
+ }
+}
+const PDFStringTranslateTable = (/* unused pure expression or super */ null && ([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, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac]));
+function stringToPDFString(str) {
+ if (str[0] >= "\xEF") {
+ let encoding;
+ if (str[0] === "\xFE" && str[1] === "\xFF") {
+ encoding = "utf-16be";
+ if (str.length % 2 === 1) {
+ str = str.slice(0, -1);
+ }
+ } else if (str[0] === "\xFF" && str[1] === "\xFE") {
+ encoding = "utf-16le";
+ if (str.length % 2 === 1) {
+ str = str.slice(0, -1);
+ }
+ } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
+ encoding = "utf-8";
+ }
+ if (encoding) {
+ try {
+ const decoder = new TextDecoder(encoding, {
+ fatal: true
+ });
+ const buffer = stringToBytes(str);
+ const decoded = decoder.decode(buffer);
+ if (!decoded.includes("\x1b")) {
+ return decoded;
+ }
+ return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
+ } catch (ex) {
+ warn(`stringToPDFString: "${ex}".`);
+ }
+ }
+ }
+ const strBuf = [];
+ for (let i = 0, ii = str.length; i < ii; i++) {
+ const charCode = str.charCodeAt(i);
+ if (charCode === 0x1b) {
+ while (++i < ii && str.charCodeAt(i) !== 0x1b) {}
+ continue;
+ }
+ const code = PDFStringTranslateTable[charCode];
+ strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
+ }
+ return strBuf.join("");
+}
+function stringToUTF8String(str) {
+ return decodeURIComponent(escape(str));
+}
+function utf8StringToString(str) {
+ return unescape(encodeURIComponent(str));
+}
+function isArrayEqual(arr1, arr2) {
+ if (arr1.length !== arr2.length) {
+ return false;
+ }
+ for (let i = 0, ii = arr1.length; i < ii; i++) {
+ if (arr1[i] !== arr2[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+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("");
+}
+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) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
+}
+function getUuid() {
+ if (typeof crypto.randomUUID === "function") {
+ return crypto.randomUUID();
+ }
+ const buf = new Uint8Array(32);
+ crypto.getRandomValues(buf);
+ return bytesToString(buf);
+}
+const AnnotationPrefix = "pdfjs_internal_id_";
+const FontRenderOps = {
+ BEZIER_CURVE_TO: 0,
+ MOVE_TO: 1,
+ LINE_TO: 2,
+ QUADRATIC_CURVE_TO: 3,
+ RESTORE: 4,
+ SAVE: 5,
+ SCALE: 6,
+ TRANSFORM: 7,
+ TRANSLATE: 8
+};
+function toHexUtil(arr) {
+ if (Uint8Array.prototype.toHex) {
+ return arr.toHex();
+ }
+ return Array.from(arr, num => hexNumbers[num]).join("");
+}
+function toBase64Util(arr) {
+ if (Uint8Array.prototype.toBase64) {
+ return arr.toBase64();
+ }
+ return btoa(bytesToString(arr));
+}
+function fromBase64Util(str) {
+ if (Uint8Array.fromBase64) {
+ return Uint8Array.fromBase64(str);
+ }
+ return stringToBytes(atob(str));
+}
+if (typeof Promise.try !== "function") {
+ Promise.try = function (fn, ...args) {
+ return new Promise(resolve => {
+ resolve(fn(...args));
+ });
+ };
+}
+
+;// ./src/display/display_utils.js
+
+const SVG_NS = "http://www.w3.org/2000/svg";
+class PixelsPerInch {
+ static CSS = 96.0;
+ static PDF = 72.0;
+ static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
+}
+async function fetchData(url, type = "text") {
+ if (isValidFetchUrl(url, document.baseURI)) {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(response.statusText);
+ }
+ switch (type) {
+ case "arraybuffer":
+ return response.arrayBuffer();
+ case "blob":
+ return response.blob();
+ case "json":
+ return response.json();
+ }
+ return response.text();
+ }
+ return new Promise((resolve, reject) => {
+ const request = new XMLHttpRequest();
+ request.open("GET", url, true);
+ request.responseType = type;
+ request.onreadystatechange = () => {
+ if (request.readyState !== XMLHttpRequest.DONE) {
+ return;
+ }
+ if (request.status === 200 || request.status === 0) {
+ switch (type) {
+ case "arraybuffer":
+ case "blob":
+ case "json":
+ resolve(request.response);
+ return;
+ }
+ resolve(request.responseText);
+ return;
+ }
+ reject(new Error(request.statusText));
+ };
+ request.send(null);
+ });
+}
+class PageViewport {
+ constructor({
+ viewBox,
+ scale,
+ rotation,
+ offsetX = 0,
+ offsetY = 0,
+ dontFlip = false
+ }) {
+ this.viewBox = viewBox;
+ this.scale = scale;
+ this.rotation = rotation;
+ this.offsetX = offsetX;
+ this.offsetY = offsetY;
+ const centerX = (viewBox[2] + viewBox[0]) / 2;
+ const centerY = (viewBox[3] + viewBox[1]) / 2;
+ let rotateA, rotateB, rotateC, rotateD;
+ rotation %= 360;
+ if (rotation < 0) {
+ rotation += 360;
+ }
+ switch (rotation) {
+ case 180:
+ rotateA = -1;
+ rotateB = 0;
+ rotateC = 0;
+ rotateD = 1;
+ break;
+ case 90:
+ rotateA = 0;
+ rotateB = 1;
+ rotateC = 1;
+ rotateD = 0;
+ break;
+ case 270:
+ rotateA = 0;
+ rotateB = -1;
+ rotateC = -1;
+ rotateD = 0;
+ break;
+ case 0:
+ rotateA = 1;
+ rotateB = 0;
+ rotateC = 0;
+ rotateD = -1;
+ break;
+ default:
+ throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
+ }
+ if (dontFlip) {
+ rotateC = -rotateC;
+ rotateD = -rotateD;
+ }
+ let offsetCanvasX, offsetCanvasY;
+ let width, height;
+ if (rotateA === 0) {
+ offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
+ offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
+ width = (viewBox[3] - viewBox[1]) * scale;
+ height = (viewBox[2] - viewBox[0]) * scale;
+ } else {
+ offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
+ offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
+ width = (viewBox[2] - viewBox[0]) * scale;
+ height = (viewBox[3] - viewBox[1]) * scale;
+ }
+ this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
+ this.width = width;
+ this.height = height;
+ }
+ get rawDims() {
+ const {
+ viewBox
+ } = this;
+ return shadow(this, "rawDims", {
+ pageWidth: viewBox[2] - viewBox[0],
+ pageHeight: viewBox[3] - viewBox[1],
+ pageX: viewBox[0],
+ pageY: viewBox[1]
+ });
+ }
+ clone({
+ scale = this.scale,
+ rotation = this.rotation,
+ offsetX = this.offsetX,
+ offsetY = this.offsetY,
+ dontFlip = false
+ } = {}) {
+ return new PageViewport({
+ viewBox: this.viewBox.slice(),
+ scale,
+ rotation,
+ offsetX,
+ offsetY,
+ dontFlip
+ });
+ }
+ convertToViewportPoint(x, y) {
+ return Util.applyTransform([x, y], this.transform);
+ }
+ convertToViewportRectangle(rect) {
+ const topLeft = Util.applyTransform([rect[0], rect[1]], this.transform);
+ const bottomRight = Util.applyTransform([rect[2], rect[3]], this.transform);
+ return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
+ }
+ convertToPdfPoint(x, y) {
+ return Util.applyInverseTransform([x, y], this.transform);
+ }
+}
+class RenderingCancelledException extends BaseException {
+ constructor(msg, extraDelay = 0) {
+ super(msg, "RenderingCancelledException");
+ this.extraDelay = extraDelay;
+ }
+}
+function isDataScheme(url) {
+ const ii = url.length;
+ let i = 0;
+ while (i < ii && url[i].trim() === "") {
+ i++;
+ }
+ return url.substring(i, i + 5).toLowerCase() === "data:";
+}
+function isPdfFile(filename) {
+ return typeof filename === "string" && /\.pdf$/i.test(filename);
+}
+function getFilenameFromUrl(url) {
+ [url] = url.split(/[#?]/, 1);
+ return url.substring(url.lastIndexOf("/") + 1);
+}
+function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
+ if (typeof url !== "string") {
+ return defaultFilename;
+ }
+ if (isDataScheme(url)) {
+ warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');
+ return defaultFilename;
+ }
+ const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
+ const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
+ const splitURI = reURI.exec(url);
+ let suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
+ if (suggestedFilename) {
+ suggestedFilename = suggestedFilename[0];
+ if (suggestedFilename.includes("%")) {
+ try {
+ suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
+ } catch {}
+ }
+ }
+ return suggestedFilename || defaultFilename;
+}
+class StatTimer {
+ started = Object.create(null);
+ times = [];
+ time(name) {
+ if (name in this.started) {
+ warn(`Timer is already running for ${name}`);
+ }
+ this.started[name] = Date.now();
+ }
+ timeEnd(name) {
+ if (!(name in this.started)) {
+ warn(`Timer has not been started for ${name}`);
+ }
+ this.times.push({
+ name,
+ start: this.started[name],
+ end: Date.now()
+ });
+ delete this.started[name];
+ }
+ toString() {
+ const outBuf = [];
+ let longest = 0;
+ for (const {
+ name
+ } of this.times) {
+ longest = Math.max(name.length, longest);
+ }
+ for (const {
+ name,
+ start,
+ end
+ } of this.times) {
+ outBuf.push(`${name.padEnd(longest)} ${end - start}ms\n`);
+ }
+ return outBuf.join("");
+ }
+}
+function isValidFetchUrl(url, baseUrl) {
+ try {
+ const {
+ protocol
+ } = baseUrl ? new URL(url, baseUrl) : new URL(url);
+ return protocol === "http:" || protocol === "https:";
+ } catch {
+ return false;
+ }
+}
+function noContextMenu(e) {
+ e.preventDefault();
+}
+function stopEvent(e) {
+ e.preventDefault();
+ e.stopPropagation();
+}
+function deprecated(details) {
+ console.log("Deprecated API usage: " + details);
+}
+class PDFDateString {
+ static #regex;
+ static toDateObject(input) {
+ if (!input || typeof input !== "string") {
+ return null;
+ }
+ this.#regex ||= new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
+ const matches = this.#regex.exec(input);
+ if (!matches) {
+ return null;
+ }
+ const year = parseInt(matches[1], 10);
+ let month = parseInt(matches[2], 10);
+ month = month >= 1 && month <= 12 ? month - 1 : 0;
+ let day = parseInt(matches[3], 10);
+ day = day >= 1 && day <= 31 ? day : 1;
+ let hour = parseInt(matches[4], 10);
+ hour = hour >= 0 && hour <= 23 ? hour : 0;
+ let minute = parseInt(matches[5], 10);
+ minute = minute >= 0 && minute <= 59 ? minute : 0;
+ let second = parseInt(matches[6], 10);
+ second = second >= 0 && second <= 59 ? second : 0;
+ const universalTimeRelation = matches[7] || "Z";
+ let offsetHour = parseInt(matches[8], 10);
+ offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
+ let offsetMinute = parseInt(matches[9], 10) || 0;
+ offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
+ if (universalTimeRelation === "-") {
+ hour += offsetHour;
+ minute += offsetMinute;
+ } else if (universalTimeRelation === "+") {
+ hour -= offsetHour;
+ minute -= offsetMinute;
+ }
+ return new Date(Date.UTC(year, month, day, hour, minute, second));
+ }
+}
+function getXfaPageViewport(xfaPage, {
+ scale = 1,
+ rotation = 0
+}) {
+ const {
+ width,
+ height
+ } = xfaPage.attributes.style;
+ const viewBox = [0, 0, parseInt(width), parseInt(height)];
+ return new PageViewport({
+ viewBox,
+ scale,
+ rotation
+ });
+}
+function getRGB(color) {
+ if (color.startsWith("#")) {
+ const colorRGB = parseInt(color.slice(1), 16);
+ return [(colorRGB & 0xff0000) >> 16, (colorRGB & 0x00ff00) >> 8, colorRGB & 0x0000ff];
+ }
+ if (color.startsWith("rgb(")) {
+ return color.slice(4, -1).split(",").map(x => parseInt(x));
+ }
+ if (color.startsWith("rgba(")) {
+ return color.slice(5, -1).split(",").map(x => parseInt(x)).slice(0, 3);
+ }
+ warn(`Not a valid color format: "${color}"`);
+ return [0, 0, 0];
+}
+function getColorValues(colors) {
+ const span = document.createElement("span");
+ span.style.visibility = "hidden";
+ document.body.append(span);
+ for (const name of colors.keys()) {
+ span.style.color = name;
+ const computedColor = window.getComputedStyle(span).color;
+ colors.set(name, getRGB(computedColor));
+ }
+ span.remove();
+}
+function getCurrentTransform(ctx) {
+ const {
+ a,
+ b,
+ c,
+ d,
+ e,
+ f
+ } = ctx.getTransform();
+ return [a, b, c, d, e, f];
+}
+function getCurrentTransformInverse(ctx) {
+ const {
+ a,
+ b,
+ c,
+ d,
+ e,
+ f
+ } = ctx.getTransform().invertSelf();
+ return [a, b, c, d, e, f];
+}
+function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true) {
+ if (viewport instanceof PageViewport) {
+ const {
+ pageWidth,
+ pageHeight
+ } = viewport.rawDims;
+ const {
+ style
+ } = div;
+ const useRound = util_FeatureTest.isCSSRoundSupported;
+ const w = `var(--scale-factor) * ${pageWidth}px`,
+ h = `var(--scale-factor) * ${pageHeight}px`;
+ const widthStr = useRound ? `round(down, ${w}, var(--scale-round-x, 1px))` : `calc(${w})`,
+ heightStr = useRound ? `round(down, ${h}, var(--scale-round-y, 1px))` : `calc(${h})`;
+ if (!mustFlip || viewport.rotation % 180 === 0) {
+ style.width = widthStr;
+ style.height = heightStr;
+ } else {
+ style.width = heightStr;
+ style.height = widthStr;
+ }
+ }
+ if (mustRotate) {
+ div.setAttribute("data-main-rotation", viewport.rotation);
+ }
+}
+class OutputScale {
+ constructor() {
+ const pixelRatio = window.devicePixelRatio || 1;
+ this.sx = pixelRatio;
+ this.sy = pixelRatio;
+ }
+ get scaled() {
+ return this.sx !== 1 || this.sy !== 1;
+ }
+ get symmetric() {
+ return this.sx === this.sy;
+ }
+}
+
+;// ./src/display/editor/toolbar.js
+
+class EditorToolbar {
+ #toolbar = null;
+ #colorPicker = null;
+ #editor;
+ #buttons = null;
+ #altText = null;
+ static #l10nRemove = null;
+ constructor(editor) {
+ this.#editor = editor;
+ EditorToolbar.#l10nRemove ||= Object.freeze({
+ freetext: "pdfjs-editor-remove-freetext-button",
+ highlight: "pdfjs-editor-remove-highlight-button",
+ ink: "pdfjs-editor-remove-ink-button",
+ stamp: "pdfjs-editor-remove-stamp-button"
+ });
+ }
+ render() {
+ const editToolbar = this.#toolbar = document.createElement("div");
+ editToolbar.classList.add("editToolbar", "hidden");
+ editToolbar.setAttribute("role", "toolbar");
+ const signal = this.#editor._uiManager._signal;
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ editToolbar.addEventListener("pointerdown", EditorToolbar.#pointerDown, {
+ signal
+ });
+ const buttons = this.#buttons = document.createElement("div");
+ buttons.className = "buttons";
+ editToolbar.append(buttons);
+ const position = this.#editor.toolbarPosition;
+ if (position) {
+ const {
+ style
+ } = editToolbar;
+ const x = this.#editor._uiManager.direction === "ltr" ? 1 - position[0] : position[0];
+ style.insetInlineEnd = `${100 * x}%`;
+ style.top = `calc(${100 * position[1]}% + var(--editor-toolbar-vert-offset))`;
+ }
+ this.#addDeleteButton();
+ return editToolbar;
+ }
+ get div() {
+ return this.#toolbar;
+ }
+ static #pointerDown(e) {
+ e.stopPropagation();
+ }
+ #focusIn(e) {
+ this.#editor._focusEventsAllowed = false;
+ stopEvent(e);
+ }
+ #focusOut(e) {
+ this.#editor._focusEventsAllowed = true;
+ stopEvent(e);
+ }
+ #addListenersToElement(element) {
+ const signal = this.#editor._uiManager._signal;
+ element.addEventListener("focusin", this.#focusIn.bind(this), {
+ capture: true,
+ signal
+ });
+ element.addEventListener("focusout", this.#focusOut.bind(this), {
+ capture: true,
+ signal
+ });
+ element.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ }
+ hide() {
+ this.#toolbar.classList.add("hidden");
+ this.#colorPicker?.hideDropdown();
+ }
+ show() {
+ this.#toolbar.classList.remove("hidden");
+ this.#altText?.shown();
+ }
+ #addDeleteButton() {
+ const {
+ editorType,
+ _uiManager
+ } = this.#editor;
+ const button = document.createElement("button");
+ button.className = "delete";
+ button.tabIndex = 0;
+ button.setAttribute("data-l10n-id", EditorToolbar.#l10nRemove[editorType]);
+ this.#addListenersToElement(button);
+ button.addEventListener("click", e => {
+ _uiManager.delete();
+ }, {
+ signal: _uiManager._signal
+ });
+ this.#buttons.append(button);
+ }
+ get #divider() {
+ const divider = document.createElement("div");
+ divider.className = "divider";
+ return divider;
+ }
+ async addAltText(altText) {
+ const button = await altText.render();
+ this.#addListenersToElement(button);
+ this.#buttons.prepend(button, this.#divider);
+ this.#altText = altText;
+ }
+ addColorPicker(colorPicker) {
+ this.#colorPicker = colorPicker;
+ const button = colorPicker.renderButton();
+ this.#addListenersToElement(button);
+ this.#buttons.prepend(button, this.#divider);
+ }
+ remove() {
+ this.#toolbar.remove();
+ this.#colorPicker?.destroy();
+ this.#colorPicker = null;
+ }
+}
+class HighlightToolbar {
+ #buttons = null;
+ #toolbar = null;
+ #uiManager;
+ constructor(uiManager) {
+ this.#uiManager = uiManager;
+ }
+ #render() {
+ const editToolbar = this.#toolbar = document.createElement("div");
+ editToolbar.className = "editToolbar";
+ editToolbar.setAttribute("role", "toolbar");
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
+ signal: this.#uiManager._signal
+ });
+ const buttons = this.#buttons = document.createElement("div");
+ buttons.className = "buttons";
+ editToolbar.append(buttons);
+ this.#addHighlightButton();
+ return editToolbar;
+ }
+ #getLastPoint(boxes, isLTR) {
+ let lastY = 0;
+ let lastX = 0;
+ for (const box of boxes) {
+ const y = box.y + box.height;
+ if (y < lastY) {
+ continue;
+ }
+ const x = box.x + (isLTR ? box.width : 0);
+ if (y > lastY) {
+ lastX = x;
+ lastY = y;
+ continue;
+ }
+ if (isLTR) {
+ if (x > lastX) {
+ lastX = x;
+ }
+ } else if (x < lastX) {
+ lastX = x;
+ }
+ }
+ return [isLTR ? 1 - lastX : lastX, lastY];
+ }
+ show(parent, boxes, isLTR) {
+ const [x, y] = this.#getLastPoint(boxes, isLTR);
+ const {
+ style
+ } = this.#toolbar ||= this.#render();
+ parent.append(this.#toolbar);
+ style.insetInlineEnd = `${100 * x}%`;
+ style.top = `calc(${100 * y}% + var(--editor-toolbar-vert-offset))`;
+ }
+ hide() {
+ this.#toolbar.remove();
+ }
+ #addHighlightButton() {
+ const button = document.createElement("button");
+ button.className = "highlightButton";
+ button.tabIndex = 0;
+ button.setAttribute("data-l10n-id", `pdfjs-highlight-floating-button1`);
+ const span = document.createElement("span");
+ button.append(span);
+ span.className = "visuallyHidden";
+ span.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button-label");
+ const signal = this.#uiManager._signal;
+ button.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ button.addEventListener("click", () => {
+ this.#uiManager.highlightSelection("floating_button");
+ }, {
+ signal
+ });
+ this.#buttons.append(button);
+ }
+}
+
+;// ./src/display/editor/tools.js
+
+
+
+function bindEvents(obj, element, names) {
+ for (const name of names) {
+ element.addEventListener(name, obj[name].bind(obj));
+ }
+}
+function opacityToHex(opacity) {
+ return Math.round(Math.min(255, Math.max(1, 255 * opacity))).toString(16).padStart(2, "0");
+}
+class IdManager {
+ #id = 0;
+ get id() {
+ return `${AnnotationEditorPrefix}${this.#id++}`;
+ }
+}
+class ImageManager {
+ #baseId = 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", {
+ willReadFrequently: true
+ });
+ 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 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;
+ image = await fetchData(rawData, "blob");
+ } else if (rawData instanceof File) {
+ image = data.file = rawData;
+ } else if (rawData instanceof Blob) {
+ image = 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) {
+ warn(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 getFromBlob(id, blobPromise) {
+ const blob = await blobPromise;
+ return this.#get(id, blob);
+ }
+ 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);
+ }
+ if (data.blobPromise) {
+ const {
+ blobPromise
+ } = data;
+ delete data.blobPromise;
+ return this.getFromBlob(data.id, blobPromise);
+ }
+ return this.getFromUrl(data.url);
+ }
+ getFromCanvas(id, canvas) {
+ this.#cache ||= new Map();
+ let data = this.#cache.get(id);
+ if (data?.bitmap) {
+ data.refCounter += 1;
+ return data;
+ }
+ const offscreen = new OffscreenCanvas(canvas.width, canvas.height);
+ const ctx = offscreen.getContext("2d");
+ ctx.drawImage(canvas, 0, 0);
+ data = {
+ bitmap: offscreen.transferToImageBitmap(),
+ id: `image_${this.#baseId}_${this.#id++}`,
+ refCounter: 1,
+ isSvg: false
+ };
+ this.#cache.set(id, data);
+ this.#cache.set(data.id, data);
+ return data;
+ }
+ 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;
+ }
+ const {
+ bitmap
+ } = data;
+ if (!data.url && !data.file) {
+ const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
+ const ctx = canvas.getContext("bitmaprenderer");
+ ctx.transferFromImageBitmap(bitmap);
+ data.blobPromise = canvas.convertToBlob();
+ }
+ bitmap.close?.();
+ data.bitmap = null;
+ }
+ isValidId(id) {
+ return id.startsWith(`image_${this.#baseId}_`);
+ }
+}
+class CommandManager {
+ #commands = [];
+ #locked = false;
+ #maxSize;
+ #position = -1;
+ constructor(maxSize = 128) {
+ this.#maxSize = maxSize;
+ }
+ add({
+ cmd,
+ undo,
+ post,
+ mustExec,
+ type = NaN,
+ overwriteIfSameType = false,
+ keepUndo = false
+ }) {
+ if (mustExec) {
+ cmd();
+ }
+ if (this.#locked) {
+ return;
+ }
+ const save = {
+ cmd,
+ undo,
+ post,
+ type
+ };
+ if (this.#position === -1) {
+ if (this.#commands.length > 0) {
+ this.#commands.length = 0;
+ }
+ this.#position = 0;
+ this.#commands.push(save);
+ return;
+ }
+ if (overwriteIfSameType && this.#commands[this.#position].type === type) {
+ if (keepUndo) {
+ save.undo = this.#commands[this.#position].undo;
+ }
+ this.#commands[this.#position] = save;
+ return;
+ }
+ const next = this.#position + 1;
+ if (next === this.#maxSize) {
+ this.#commands.splice(0, 1);
+ } else {
+ this.#position = next;
+ if (next < this.#commands.length) {
+ this.#commands.splice(next);
+ }
+ }
+ this.#commands.push(save);
+ }
+ undo() {
+ if (this.#position === -1) {
+ return;
+ }
+ this.#locked = true;
+ const {
+ undo,
+ post
+ } = this.#commands[this.#position];
+ undo();
+ post?.();
+ this.#locked = false;
+ this.#position -= 1;
+ }
+ redo() {
+ if (this.#position < this.#commands.length - 1) {
+ this.#position += 1;
+ this.#locked = true;
+ const {
+ cmd,
+ post
+ } = this.#commands[this.#position];
+ cmd();
+ post?.();
+ this.#locked = false;
+ }
+ }
+ hasSomethingToUndo() {
+ return this.#position !== -1;
+ }
+ hasSomethingToRedo() {
+ return this.#position < this.#commands.length - 1;
+ }
+ cleanType(type) {
+ if (this.#position === -1) {
+ return;
+ }
+ for (let i = this.#position; i >= 0; i--) {
+ if (this.#commands[i].type !== type) {
+ this.#commands.splice(i + 1, this.#position - i);
+ this.#position = i;
+ return;
+ }
+ }
+ this.#commands.length = 0;
+ this.#position = -1;
+ }
+ destroy() {
+ this.#commands = null;
+ }
+}
+class KeyboardManager {
+ constructor(callbacks) {
+ this.buffer = [];
+ this.callbacks = new Map();
+ this.allKeys = new Set();
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ 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,
+ options
+ });
+ this.allKeys.add(key.split("+").at(-1));
+ } else if (!isMac && !isMacKey) {
+ this.callbacks.set(key, {
+ callback,
+ options
+ });
+ this.allKeys.add(key.split("+").at(-1));
+ }
+ }
+ }
+ }
+ #serialize(event) {
+ if (event.altKey) {
+ this.buffer.push("alt");
+ }
+ if (event.ctrlKey) {
+ this.buffer.push("ctrl");
+ }
+ if (event.metaKey) {
+ this.buffer.push("meta");
+ }
+ if (event.shiftKey) {
+ this.buffer.push("shift");
+ }
+ this.buffer.push(event.key);
+ const str = this.buffer.join("+");
+ this.buffer.length = 0;
+ return str;
+ }
+ exec(self, event) {
+ if (!this.allKeys.has(event.key)) {
+ return;
+ }
+ const info = this.callbacks.get(this.#serialize(event));
+ if (!info) {
+ return;
+ }
+ const {
+ callback,
+ options: {
+ bubbles = false,
+ args = [],
+ checker = null
+ }
+ } = info;
+ if (checker && !checker(self, event)) {
+ return;
+ }
+ callback.bind(self, ...args, event)();
+ if (!bubbles) {
+ stopEvent(event);
+ }
+ }
+}
+class ColorManager {
+ static _colorsMapping = new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]);
+ get _colors() {
+ const colors = new Map([["CanvasText", null], ["Canvas", null]]);
+ getColorValues(colors);
+ return shadow(this, "_colors", colors);
+ }
+ convert(color) {
+ const rgb = getRGB(color);
+ if (!window.matchMedia("(forced-colors: active)").matches) {
+ return rgb;
+ }
+ for (const [name, RGB] of this._colors) {
+ if (RGB.every((x, i) => x === rgb[i])) {
+ return ColorManager._colorsMapping.get(name);
+ }
+ }
+ return rgb;
+ }
+ getHexCode(name) {
+ const rgb = this._colors.get(name);
+ if (!rgb) {
+ return name;
+ }
+ return Util.makeHexColor(...rgb);
+ }
+}
+class AnnotationEditorUIManager {
+ #abortController = new AbortController();
+ #activeEditor = null;
+ #allEditors = new Map();
+ #allLayers = new Map();
+ #altTextManager = null;
+ #annotationStorage = null;
+ #changedExistingAnnotations = null;
+ #commandManager = new CommandManager();
+ #copyPasteAC = null;
+ #currentDrawingSession = null;
+ #currentPageIndex = 0;
+ #deletedAnnotationsElementIds = new Set();
+ #draggingEditors = null;
+ #editorTypes = null;
+ #editorsToRescale = new Set();
+ _editorUndoBar = null;
+ #enableHighlightFloatingButton = false;
+ #enableUpdatedAddImage = false;
+ #enableNewAltTextWhenAddingImage = false;
+ #filterFactory = null;
+ #focusMainContainerTimeoutId = null;
+ #focusManagerAC = null;
+ #highlightColors = null;
+ #highlightWhenShiftUp = false;
+ #highlightToolbar = null;
+ #idManager = new IdManager();
+ #isEnabled = false;
+ #isWaiting = false;
+ #keyboardManagerAC = null;
+ #lastActiveElement = null;
+ #mainHighlightColorPicker = null;
+ #mlManager = null;
+ #mode = AnnotationEditorType.NONE;
+ #selectedEditors = new Set();
+ #selectedTextNode = null;
+ #pageColors = null;
+ #showAllStates = null;
+ #previousStates = {
+ isEditing: false,
+ isEmpty: true,
+ hasSomethingToUndo: false,
+ hasSomethingToRedo: false,
+ hasSelectedEditor: false,
+ hasSelectedText: false
+ };
+ #translation = [0, 0];
+ #translationTimeoutId = null;
+ #container = null;
+ #viewer = null;
+ #updateModeCapability = null;
+ static TRANSLATE_SMALL = 1;
+ static TRANSLATE_BIG = 10;
+ static get _keyboardManager() {
+ const proto = AnnotationEditorUIManager.prototype;
+ const arrowChecker = self => self.#container.contains(document.activeElement) && document.activeElement.tagName !== "BUTTON" && self.hasSomethingToControl();
+ const textInputChecker = (_self, {
+ target: el
+ }) => {
+ if (el instanceof HTMLInputElement) {
+ const {
+ type
+ } = el;
+ return type !== "text" && type !== "number";
+ }
+ return true;
+ };
+ const small = this.TRANSLATE_SMALL;
+ const big = this.TRANSLATE_BIG;
+ return shadow(this, "_keyboardManager", new KeyboardManager([[["ctrl+a", "mac+meta+a"], proto.selectAll, {
+ checker: textInputChecker
+ }], [["ctrl+z", "mac+meta+z"], proto.undo, {
+ checker: textInputChecker
+ }], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], proto.redo, {
+ checker: textInputChecker
+ }], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], proto.delete, {
+ checker: textInputChecker
+ }], [["Enter", "mac+Enter"], proto.addNewEditorFromKeyboard, {
+ checker: (self, {
+ target: el
+ }) => !(el instanceof HTMLButtonElement) && self.#container.contains(el) && !self.isEnterHandled
+ }], [[" ", "mac+ "], proto.addNewEditorFromKeyboard, {
+ checker: (self, {
+ target: el
+ }) => !(el instanceof HTMLButtonElement) && self.#container.contains(document.activeElement)
+ }], [["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, highlightColors, enableHighlightFloatingButton, enableUpdatedAddImage, enableNewAltTextWhenAddingImage, mlManager, editorUndoBar) {
+ const signal = this._signal = this.#abortController.signal;
+ this.#container = container;
+ this.#viewer = viewer;
+ this.#altTextManager = altTextManager;
+ this._eventBus = eventBus;
+ eventBus._on("editingaction", this.onEditingAction.bind(this), {
+ signal
+ });
+ eventBus._on("pagechanging", this.onPageChanging.bind(this), {
+ signal
+ });
+ eventBus._on("scalechanging", this.onScaleChanging.bind(this), {
+ signal
+ });
+ eventBus._on("rotationchanging", this.onRotationChanging.bind(this), {
+ signal
+ });
+ eventBus._on("setpreference", this.onSetPreference.bind(this), {
+ signal
+ });
+ eventBus._on("switchannotationeditorparams", evt => this.updateParams(evt.type, evt.value), {
+ signal
+ });
+ this.#addSelectionListener();
+ this.#addDragAndDropListeners();
+ this.#addKeyboardManager();
+ this.#annotationStorage = pdfDocument.annotationStorage;
+ this.#filterFactory = pdfDocument.filterFactory;
+ this.#pageColors = pageColors;
+ this.#highlightColors = highlightColors || null;
+ this.#enableHighlightFloatingButton = enableHighlightFloatingButton;
+ this.#enableUpdatedAddImage = enableUpdatedAddImage;
+ this.#enableNewAltTextWhenAddingImage = enableNewAltTextWhenAddingImage;
+ this.#mlManager = mlManager || null;
+ this.viewParameters = {
+ realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
+ rotation: 0
+ };
+ this.isShiftKeyDown = false;
+ this._editorUndoBar = editorUndoBar || null;
+ }
+ destroy() {
+ this.#updateModeCapability?.resolve();
+ this.#updateModeCapability = null;
+ this.#abortController?.abort();
+ this.#abortController = null;
+ this._signal = null;
+ for (const layer of this.#allLayers.values()) {
+ layer.destroy();
+ }
+ this.#allLayers.clear();
+ this.#allEditors.clear();
+ this.#editorsToRescale.clear();
+ this.#activeEditor = null;
+ this.#selectedEditors.clear();
+ this.#commandManager.destroy();
+ this.#altTextManager?.destroy();
+ this.#highlightToolbar?.hide();
+ this.#highlightToolbar = null;
+ if (this.#focusMainContainerTimeoutId) {
+ clearTimeout(this.#focusMainContainerTimeoutId);
+ this.#focusMainContainerTimeoutId = null;
+ }
+ if (this.#translationTimeoutId) {
+ clearTimeout(this.#translationTimeoutId);
+ this.#translationTimeoutId = null;
+ }
+ this._editorUndoBar?.destroy();
+ }
+ combinedSignal(ac) {
+ return AbortSignal.any([this._signal, ac.signal]);
+ }
+ get mlManager() {
+ return this.#mlManager;
+ }
+ get useNewAltTextFlow() {
+ return this.#enableUpdatedAddImage;
+ }
+ get useNewAltTextWhenAddingImage() {
+ return this.#enableNewAltTextWhenAddingImage;
+ }
+ get hcmFilter() {
+ return shadow(this, "hcmFilter", this.#pageColors ? this.#filterFactory.addHCMFilter(this.#pageColors.foreground, this.#pageColors.background) : "none");
+ }
+ get direction() {
+ return shadow(this, "direction", getComputedStyle(this.#container).direction);
+ }
+ get highlightColors() {
+ return shadow(this, "highlightColors", this.#highlightColors ? new Map(this.#highlightColors.split(",").map(pair => pair.split("=").map(x => x.trim()))) : null);
+ }
+ get highlightColorNames() {
+ return shadow(this, "highlightColorNames", this.highlightColors ? new Map(Array.from(this.highlightColors, e => e.reverse())) : null);
+ }
+ setCurrentDrawingSession(layer) {
+ if (layer) {
+ this.unselectAll();
+ this.disableUserSelect(true);
+ } else {
+ this.disableUserSelect(false);
+ }
+ this.#currentDrawingSession = layer;
+ }
+ setMainHighlightColorPicker(colorPicker) {
+ this.#mainHighlightColorPicker = colorPicker;
+ }
+ editAltText(editor, firstTime = false) {
+ this.#altTextManager?.editAltText(this, editor, firstTime);
+ }
+ switchToMode(mode, callback) {
+ this._eventBus.on("annotationeditormodechanged", callback, {
+ once: true,
+ signal: this._signal
+ });
+ this._eventBus.dispatch("showannotationeditorui", {
+ source: this,
+ mode
+ });
+ }
+ setPreference(name, value) {
+ this._eventBus.dispatch("setpreference", {
+ source: this,
+ name,
+ value
+ });
+ }
+ onSetPreference({
+ name,
+ value
+ }) {
+ switch (name) {
+ case "enableNewAltTextWhenAddingImage":
+ this.#enableNewAltTextWhenAddingImage = value;
+ break;
+ }
+ }
+ onPageChanging({
+ pageNumber
+ }) {
+ this.#currentPageIndex = pageNumber - 1;
+ }
+ 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);
+ }
+ removeShouldRescale(editor) {
+ this.#editorsToRescale.delete(editor);
+ }
+ onScaleChanging({
+ scale
+ }) {
+ this.commitOrRemove();
+ this.viewParameters.realScale = scale * PixelsPerInch.PDF_TO_CSS_UNITS;
+ for (const editor of this.#editorsToRescale) {
+ editor.onScaleChanging();
+ }
+ this.#currentDrawingSession?.onScaleChanging();
+ }
+ onRotationChanging({
+ pagesRotation
+ }) {
+ this.commitOrRemove();
+ this.viewParameters.rotation = pagesRotation;
+ }
+ #getAnchorElementForSelection({
+ anchorNode
+ }) {
+ return anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentElement : anchorNode;
+ }
+ #getLayerForTextLayer(textLayer) {
+ const {
+ currentLayer
+ } = this;
+ if (currentLayer.hasTextLayer(textLayer)) {
+ return currentLayer;
+ }
+ for (const layer of this.#allLayers.values()) {
+ if (layer.hasTextLayer(textLayer)) {
+ return layer;
+ }
+ }
+ return null;
+ }
+ highlightSelection(methodOfCreation = "") {
+ const selection = document.getSelection();
+ if (!selection || selection.isCollapsed) {
+ return;
+ }
+ const {
+ anchorNode,
+ anchorOffset,
+ focusNode,
+ focusOffset
+ } = selection;
+ const text = selection.toString();
+ const anchorElement = this.#getAnchorElementForSelection(selection);
+ const textLayer = anchorElement.closest(".textLayer");
+ const boxes = this.getSelectionBoxes(textLayer);
+ if (!boxes) {
+ return;
+ }
+ selection.empty();
+ const layer = this.#getLayerForTextLayer(textLayer);
+ const isNoneMode = this.#mode === AnnotationEditorType.NONE;
+ const callback = () => {
+ layer?.createAndAddNewEditor({
+ x: 0,
+ y: 0
+ }, false, {
+ methodOfCreation,
+ boxes,
+ anchorNode,
+ anchorOffset,
+ focusNode,
+ focusOffset,
+ text
+ });
+ if (isNoneMode) {
+ this.showAllEditors("highlight", true, true);
+ }
+ };
+ if (isNoneMode) {
+ this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);
+ return;
+ }
+ callback();
+ }
+ #displayHighlightToolbar() {
+ const selection = document.getSelection();
+ if (!selection || selection.isCollapsed) {
+ return;
+ }
+ const anchorElement = this.#getAnchorElementForSelection(selection);
+ const textLayer = anchorElement.closest(".textLayer");
+ const boxes = this.getSelectionBoxes(textLayer);
+ if (!boxes) {
+ return;
+ }
+ this.#highlightToolbar ||= new HighlightToolbar(this);
+ this.#highlightToolbar.show(textLayer, boxes, this.direction === "ltr");
+ }
+ addToAnnotationStorage(editor) {
+ if (!editor.isEmpty() && this.#annotationStorage && !this.#annotationStorage.has(editor.id)) {
+ this.#annotationStorage.setValue(editor.id, editor);
+ }
+ }
+ #selectionChange() {
+ const selection = document.getSelection();
+ if (!selection || selection.isCollapsed) {
+ if (this.#selectedTextNode) {
+ this.#highlightToolbar?.hide();
+ this.#selectedTextNode = null;
+ this.#dispatchUpdateStates({
+ hasSelectedText: false
+ });
+ }
+ return;
+ }
+ const {
+ anchorNode
+ } = selection;
+ if (anchorNode === this.#selectedTextNode) {
+ return;
+ }
+ const anchorElement = this.#getAnchorElementForSelection(selection);
+ const textLayer = anchorElement.closest(".textLayer");
+ if (!textLayer) {
+ if (this.#selectedTextNode) {
+ this.#highlightToolbar?.hide();
+ this.#selectedTextNode = null;
+ this.#dispatchUpdateStates({
+ hasSelectedText: false
+ });
+ }
+ return;
+ }
+ this.#highlightToolbar?.hide();
+ this.#selectedTextNode = anchorNode;
+ this.#dispatchUpdateStates({
+ hasSelectedText: true
+ });
+ if (this.#mode !== AnnotationEditorType.HIGHLIGHT && this.#mode !== AnnotationEditorType.NONE) {
+ return;
+ }
+ if (this.#mode === AnnotationEditorType.HIGHLIGHT) {
+ this.showAllEditors("highlight", true, true);
+ }
+ this.#highlightWhenShiftUp = this.isShiftKeyDown;
+ if (!this.isShiftKeyDown) {
+ const activeLayer = this.#mode === AnnotationEditorType.HIGHLIGHT ? this.#getLayerForTextLayer(textLayer) : null;
+ activeLayer?.toggleDrawing();
+ const ac = new AbortController();
+ const signal = this.combinedSignal(ac);
+ const pointerup = e => {
+ if (e.type === "pointerup" && e.button !== 0) {
+ return;
+ }
+ ac.abort();
+ activeLayer?.toggleDrawing(true);
+ if (e.type === "pointerup") {
+ this.#onSelectEnd("main_toolbar");
+ }
+ };
+ window.addEventListener("pointerup", pointerup, {
+ signal
+ });
+ window.addEventListener("blur", pointerup, {
+ signal
+ });
+ }
+ }
+ #onSelectEnd(methodOfCreation = "") {
+ if (this.#mode === AnnotationEditorType.HIGHLIGHT) {
+ this.highlightSelection(methodOfCreation);
+ } else if (this.#enableHighlightFloatingButton) {
+ this.#displayHighlightToolbar();
+ }
+ }
+ #addSelectionListener() {
+ document.addEventListener("selectionchange", this.#selectionChange.bind(this), {
+ signal: this._signal
+ });
+ }
+ #addFocusManager() {
+ if (this.#focusManagerAC) {
+ return;
+ }
+ this.#focusManagerAC = new AbortController();
+ const signal = this.combinedSignal(this.#focusManagerAC);
+ window.addEventListener("focus", this.focus.bind(this), {
+ signal
+ });
+ window.addEventListener("blur", this.blur.bind(this), {
+ signal
+ });
+ }
+ #removeFocusManager() {
+ this.#focusManagerAC?.abort();
+ this.#focusManagerAC = null;
+ }
+ blur() {
+ this.isShiftKeyDown = false;
+ if (this.#highlightWhenShiftUp) {
+ this.#highlightWhenShiftUp = false;
+ this.#onSelectEnd("main_toolbar");
+ }
+ 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,
+ signal: this._signal
+ });
+ lastActiveElement.focus();
+ }
+ #addKeyboardManager() {
+ if (this.#keyboardManagerAC) {
+ return;
+ }
+ this.#keyboardManagerAC = new AbortController();
+ const signal = this.combinedSignal(this.#keyboardManagerAC);
+ window.addEventListener("keydown", this.keydown.bind(this), {
+ signal
+ });
+ window.addEventListener("keyup", this.keyup.bind(this), {
+ signal
+ });
+ }
+ #removeKeyboardManager() {
+ this.#keyboardManagerAC?.abort();
+ this.#keyboardManagerAC = null;
+ }
+ #addCopyPasteListeners() {
+ if (this.#copyPasteAC) {
+ return;
+ }
+ this.#copyPasteAC = new AbortController();
+ const signal = this.combinedSignal(this.#copyPasteAC);
+ document.addEventListener("copy", this.copy.bind(this), {
+ signal
+ });
+ document.addEventListener("cut", this.cut.bind(this), {
+ signal
+ });
+ document.addEventListener("paste", this.paste.bind(this), {
+ signal
+ });
+ }
+ #removeCopyPasteListeners() {
+ this.#copyPasteAC?.abort();
+ this.#copyPasteAC = null;
+ }
+ #addDragAndDropListeners() {
+ const signal = this._signal;
+ document.addEventListener("dragover", this.dragOver.bind(this), {
+ signal
+ });
+ document.addEventListener("drop", this.drop.bind(this), {
+ signal
+ });
+ }
+ addEditListeners() {
+ this.#addKeyboardManager();
+ this.#addCopyPasteListeners();
+ }
+ removeEditListeners() {
+ this.#removeKeyboardManager();
+ this.#removeCopyPasteListeners();
+ }
+ dragOver(event) {
+ for (const {
+ type
+ } of event.dataTransfer.items) {
+ for (const editorType of this.#editorTypes) {
+ if (editorType.isHandlingMimeForPasting(type)) {
+ event.dataTransfer.dropEffect = "copy";
+ event.preventDefault();
+ return;
+ }
+ }
+ }
+ }
+ drop(event) {
+ for (const item of event.dataTransfer.items) {
+ for (const editorType of this.#editorTypes) {
+ if (editorType.isHandlingMimeForPasting(item.type)) {
+ editorType.paste(item, this.currentLayer);
+ event.preventDefault();
+ return;
+ }
+ }
+ }
+ }
+ copy(event) {
+ event.preventDefault();
+ this.#activeEditor?.commitOrRemove();
+ if (!this.hasSelection) {
+ return;
+ }
+ const editors = [];
+ for (const editor of this.#selectedEditors) {
+ const serialized = editor.serialize(true);
+ if (serialized) {
+ editors.push(serialized);
+ }
+ }
+ if (editors.length === 0) {
+ return;
+ }
+ event.clipboardData.setData("application/pdfjs", JSON.stringify(editors));
+ }
+ cut(event) {
+ this.copy(event);
+ this.delete();
+ }
+ async paste(event) {
+ event.preventDefault();
+ 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;
+ }
+ try {
+ data = JSON.parse(data);
+ } catch (ex) {
+ warn(`paste: "${ex.message}".`);
+ return;
+ }
+ if (!Array.isArray(data)) {
+ return;
+ }
+ this.unselectAll();
+ const layer = this.currentLayer;
+ try {
+ const newEditors = [];
+ for (const editor of data) {
+ const deserializedEditor = await layer.deserialize(editor);
+ if (!deserializedEditor) {
+ return;
+ }
+ newEditors.push(deserializedEditor);
+ }
+ const cmd = () => {
+ for (const editor of newEditors) {
+ this.#addEditorToLayer(editor);
+ }
+ this.#selectEditors(newEditors);
+ };
+ const undo = () => {
+ for (const editor of newEditors) {
+ editor.remove();
+ }
+ };
+ this.addCommands({
+ cmd,
+ undo,
+ mustExec: true
+ });
+ } catch (ex) {
+ warn(`paste: "${ex.message}".`);
+ }
+ }
+ keydown(event) {
+ if (!this.isShiftKeyDown && event.key === "Shift") {
+ this.isShiftKeyDown = true;
+ }
+ if (this.#mode !== AnnotationEditorType.NONE && !this.isEditorHandlingKeyboard) {
+ AnnotationEditorUIManager._keyboardManager.exec(this, event);
+ }
+ }
+ keyup(event) {
+ if (this.isShiftKeyDown && event.key === "Shift") {
+ this.isShiftKeyDown = false;
+ if (this.#highlightWhenShiftUp) {
+ this.#highlightWhenShiftUp = false;
+ this.#onSelectEnd("main_toolbar");
+ }
+ }
+ }
+ onEditingAction({
+ name
+ }) {
+ switch (name) {
+ case "undo":
+ case "redo":
+ case "delete":
+ case "selectAll":
+ this[name]();
+ break;
+ case "highlightSelection":
+ this.highlightSelection("context_menu");
+ break;
+ }
+ }
+ #dispatchUpdateStates(details) {
+ const hasChanged = Object.entries(details).some(([key, value]) => this.#previousStates[key] !== value);
+ if (hasChanged) {
+ this._eventBus.dispatch("annotationeditorstateschanged", {
+ source: this,
+ details: Object.assign(this.#previousStates, details)
+ });
+ if (this.#mode === AnnotationEditorType.HIGHLIGHT && details.hasSelectedEditor === false) {
+ this.#dispatchUpdateUI([[AnnotationEditorParamsType.HIGHLIGHT_FREE, true]]);
+ }
+ }
+ }
+ #dispatchUpdateUI(details) {
+ this._eventBus.dispatch("annotationeditorparamschanged", {
+ source: this,
+ details
+ });
+ }
+ setEditingState(isEditing) {
+ if (isEditing) {
+ this.#addFocusManager();
+ this.#addCopyPasteListeners();
+ this.#dispatchUpdateStates({
+ isEditing: this.#mode !== AnnotationEditorType.NONE,
+ isEmpty: this.#isEmpty(),
+ hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),
+ hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),
+ hasSelectedEditor: false
+ });
+ } else {
+ this.#removeFocusManager();
+ this.#removeCopyPasteListeners();
+ this.#dispatchUpdateStates({
+ isEditing: false
+ });
+ this.disableUserSelect(false);
+ }
+ }
+ registerEditorTypes(types) {
+ if (this.#editorTypes) {
+ return;
+ }
+ this.#editorTypes = types;
+ for (const editorType of this.#editorTypes) {
+ this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);
+ }
+ }
+ getId() {
+ return this.#idManager.id;
+ }
+ get currentLayer() {
+ return this.#allLayers.get(this.#currentPageIndex);
+ }
+ getLayer(pageIndex) {
+ return this.#allLayers.get(pageIndex);
+ }
+ get currentPageIndex() {
+ return this.#currentPageIndex;
+ }
+ addLayer(layer) {
+ this.#allLayers.set(layer.pageIndex, layer);
+ if (this.#isEnabled) {
+ layer.enable();
+ } else {
+ layer.disable();
+ }
+ }
+ removeLayer(layer) {
+ this.#allLayers.delete(layer.pageIndex);
+ }
+ async updateMode(mode, editId = null, isFromKeyboard = false) {
+ if (this.#mode === mode) {
+ return;
+ }
+ if (this.#updateModeCapability) {
+ await this.#updateModeCapability.promise;
+ if (!this.#updateModeCapability) {
+ return;
+ }
+ }
+ this.#updateModeCapability = Promise.withResolvers();
+ this.#mode = mode;
+ if (mode === AnnotationEditorType.NONE) {
+ this.setEditingState(false);
+ this.#disableAll();
+ this._editorUndoBar?.hide();
+ this.#updateModeCapability.resolve();
+ return;
+ }
+ this.setEditingState(true);
+ await this.#enableAll();
+ this.unselectAll();
+ for (const layer of this.#allLayers.values()) {
+ layer.updateMode(mode);
+ }
+ if (!editId) {
+ if (isFromKeyboard) {
+ this.addNewEditorFromKeyboard();
+ }
+ this.#updateModeCapability.resolve();
+ return;
+ }
+ for (const editor of this.#allEditors.values()) {
+ if (editor.annotationElementId === editId) {
+ this.setSelected(editor);
+ editor.enterInEditMode();
+ } else {
+ editor.unselect();
+ }
+ }
+ this.#updateModeCapability.resolve();
+ }
+ addNewEditorFromKeyboard() {
+ if (this.currentLayer.canCreateNewEmptyEditor()) {
+ this.currentLayer.addNewEditor();
+ }
+ }
+ updateToolbar(mode) {
+ if (mode === this.#mode) {
+ return;
+ }
+ this._eventBus.dispatch("switchannotationeditormode", {
+ source: this,
+ mode
+ });
+ }
+ updateParams(type, value) {
+ if (!this.#editorTypes) {
+ return;
+ }
+ switch (type) {
+ case AnnotationEditorParamsType.CREATE:
+ this.currentLayer.addNewEditor();
+ return;
+ case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
+ this.#mainHighlightColorPicker?.updateColor(value);
+ break;
+ case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
+ this._eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "editing",
+ data: {
+ type: "highlight",
+ action: "toggle_visibility"
+ }
+ }
+ });
+ (this.#showAllStates ||= new Map()).set(type, value);
+ this.showAllEditors("highlight", value);
+ break;
+ }
+ for (const editor of this.#selectedEditors) {
+ editor.updateParams(type, value);
+ }
+ for (const editorType of this.#editorTypes) {
+ editorType.updateDefaultParams(type, value);
+ }
+ }
+ showAllEditors(type, visible, updateButton = false) {
+ for (const editor of this.#allEditors.values()) {
+ if (editor.editorType === type) {
+ editor.show(visible);
+ }
+ }
+ const state = this.#showAllStates?.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL) ?? true;
+ if (state !== visible) {
+ this.#dispatchUpdateUI([[AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL, visible]]);
+ }
+ }
+ 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);
+ }
+ }
+ async #enableAll() {
+ if (!this.#isEnabled) {
+ this.#isEnabled = true;
+ const promises = [];
+ for (const layer of this.#allLayers.values()) {
+ promises.push(layer.enable());
+ }
+ await Promise.all(promises);
+ for (const editor of this.#allEditors.values()) {
+ editor.enable();
+ }
+ }
+ }
+ #disableAll() {
+ this.unselectAll();
+ if (this.#isEnabled) {
+ this.#isEnabled = false;
+ for (const layer of this.#allLayers.values()) {
+ layer.disable();
+ }
+ for (const editor of this.#allEditors.values()) {
+ editor.disable();
+ }
+ }
+ }
+ getEditors(pageIndex) {
+ const editors = [];
+ for (const editor of this.#allEditors.values()) {
+ if (editor.pageIndex === pageIndex) {
+ editors.push(editor);
+ }
+ }
+ return editors;
+ }
+ getEditor(id) {
+ return this.#allEditors.get(id);
+ }
+ addEditor(editor) {
+ this.#allEditors.set(editor.id, editor);
+ }
+ removeEditor(editor) {
+ if (editor.div.contains(document.activeElement)) {
+ if (this.#focusMainContainerTimeoutId) {
+ clearTimeout(this.#focusMainContainerTimeoutId);
+ }
+ this.#focusMainContainerTimeoutId = setTimeout(() => {
+ this.focusMainContainer();
+ this.#focusMainContainerTimeoutId = null;
+ }, 0);
+ }
+ this.#allEditors.delete(editor.id);
+ this.unselect(editor);
+ if (!editor.annotationElementId || !this.#deletedAnnotationsElementIds.has(editor.annotationElementId)) {
+ this.#annotationStorage?.remove(editor.id);
+ }
+ }
+ addDeletedAnnotationElement(editor) {
+ this.#deletedAnnotationsElementIds.add(editor.annotationElementId);
+ this.addChangedExistingAnnotation(editor);
+ editor.deleted = true;
+ }
+ isDeletedAnnotationElement(annotationElementId) {
+ return this.#deletedAnnotationsElementIds.has(annotationElementId);
+ }
+ removeDeletedAnnotationElement(editor) {
+ this.#deletedAnnotationsElementIds.delete(editor.annotationElementId);
+ this.removeChangedExistingAnnotation(editor);
+ editor.deleted = false;
+ }
+ #addEditorToLayer(editor) {
+ const layer = this.#allLayers.get(editor.pageIndex);
+ if (layer) {
+ layer.addOrRebuild(editor);
+ } else {
+ this.addEditor(editor);
+ this.addToAnnotationStorage(editor);
+ }
+ }
+ setActiveEditor(editor) {
+ if (this.#activeEditor === editor) {
+ return;
+ }
+ this.#activeEditor = editor;
+ if (editor) {
+ this.#dispatchUpdateUI(editor.propertiesToUpdate);
+ }
+ }
+ get #lastSelectedEditor() {
+ let ed = null;
+ for (ed of this.#selectedEditors) {}
+ return ed;
+ }
+ updateUI(editor) {
+ if (this.#lastSelectedEditor === editor) {
+ this.#dispatchUpdateUI(editor.propertiesToUpdate);
+ }
+ }
+ updateUIForDefaultProperties(editorType) {
+ this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);
+ }
+ toggleSelected(editor) {
+ if (this.#selectedEditors.has(editor)) {
+ this.#selectedEditors.delete(editor);
+ editor.unselect();
+ this.#dispatchUpdateStates({
+ hasSelectedEditor: this.hasSelection
+ });
+ return;
+ }
+ this.#selectedEditors.add(editor);
+ editor.select();
+ this.#dispatchUpdateUI(editor.propertiesToUpdate);
+ this.#dispatchUpdateStates({
+ hasSelectedEditor: true
+ });
+ }
+ setSelected(editor) {
+ this.#currentDrawingSession?.commitOrRemove();
+ for (const ed of this.#selectedEditors) {
+ if (ed !== editor) {
+ ed.unselect();
+ }
+ }
+ this.#selectedEditors.clear();
+ this.#selectedEditors.add(editor);
+ editor.select();
+ this.#dispatchUpdateUI(editor.propertiesToUpdate);
+ this.#dispatchUpdateStates({
+ hasSelectedEditor: true
+ });
+ }
+ isSelected(editor) {
+ return this.#selectedEditors.has(editor);
+ }
+ get firstSelectedEditor() {
+ return this.#selectedEditors.values().next().value;
+ }
+ unselect(editor) {
+ editor.unselect();
+ this.#selectedEditors.delete(editor);
+ this.#dispatchUpdateStates({
+ hasSelectedEditor: this.hasSelection
+ });
+ }
+ get hasSelection() {
+ return this.#selectedEditors.size !== 0;
+ }
+ get isEnterHandled() {
+ return this.#selectedEditors.size === 1 && this.firstSelectedEditor.isEnterHandled;
+ }
+ undo() {
+ this.#commandManager.undo();
+ this.#dispatchUpdateStates({
+ hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),
+ hasSomethingToRedo: true,
+ isEmpty: this.#isEmpty()
+ });
+ this._editorUndoBar?.hide();
+ }
+ redo() {
+ this.#commandManager.redo();
+ this.#dispatchUpdateStates({
+ hasSomethingToUndo: true,
+ hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),
+ isEmpty: this.#isEmpty()
+ });
+ }
+ addCommands(params) {
+ this.#commandManager.add(params);
+ this.#dispatchUpdateStates({
+ hasSomethingToUndo: true,
+ hasSomethingToRedo: false,
+ isEmpty: this.#isEmpty()
+ });
+ }
+ cleanUndoStack(type) {
+ this.#commandManager.cleanType(type);
+ }
+ #isEmpty() {
+ if (this.#allEditors.size === 0) {
+ return true;
+ }
+ if (this.#allEditors.size === 1) {
+ for (const editor of this.#allEditors.values()) {
+ return editor.isEmpty();
+ }
+ }
+ return false;
+ }
+ delete() {
+ this.commitOrRemove();
+ const drawingEditor = this.currentLayer?.endDrawingSession(true);
+ if (!this.hasSelection && !drawingEditor) {
+ return;
+ }
+ const editors = drawingEditor ? [drawingEditor] : [...this.#selectedEditors];
+ const cmd = () => {
+ this._editorUndoBar?.show(undo, editors.length === 1 ? editors[0].editorType : editors.length);
+ for (const editor of editors) {
+ editor.remove();
+ }
+ };
+ const undo = () => {
+ for (const editor of editors) {
+ this.#addEditorToLayer(editor);
+ }
+ };
+ this.addCommands({
+ cmd,
+ undo,
+ mustExec: true
+ });
+ }
+ commitOrRemove() {
+ this.#activeEditor?.commitOrRemove();
+ }
+ hasSomethingToControl() {
+ return this.#activeEditor || this.hasSelection;
+ }
+ #selectEditors(editors) {
+ for (const editor of this.#selectedEditors) {
+ editor.unselect();
+ }
+ this.#selectedEditors.clear();
+ for (const editor of editors) {
+ if (editor.isEmpty()) {
+ continue;
+ }
+ this.#selectedEditors.add(editor);
+ editor.select();
+ }
+ this.#dispatchUpdateStates({
+ hasSelectedEditor: this.hasSelection
+ });
+ }
+ selectAll() {
+ for (const editor of this.#selectedEditors) {
+ editor.commit();
+ }
+ this.#selectEditors(this.#allEditors.values());
+ }
+ unselectAll() {
+ if (this.#activeEditor) {
+ this.#activeEditor.commitOrRemove();
+ if (this.#mode !== AnnotationEditorType.NONE) {
+ return;
+ }
+ }
+ if (this.#currentDrawingSession?.commitOrRemove()) {
+ return;
+ }
+ if (!this.hasSelection) {
+ return;
+ }
+ for (const editor of this.#selectedEditors) {
+ editor.unselect();
+ }
+ this.#selectedEditors.clear();
+ this.#dispatchUpdateStates({
+ 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);
+ }
+ }
+ get isEditorHandlingKeyboard() {
+ return this.getActive()?.shouldGetKeyboardEvents() || this.#selectedEditors.size === 1 && this.firstSelectedEditor.shouldGetKeyboardEvents();
+ }
+ isActive(editor) {
+ return this.#activeEditor === editor;
+ }
+ getActive() {
+ return this.#activeEditor;
+ }
+ getMode() {
+ return this.#mode;
+ }
+ get imageManager() {
+ return shadow(this, "imageManager", new ImageManager());
+ }
+ getSelectionBoxes(textLayer) {
+ if (!textLayer) {
+ return null;
+ }
+ const selection = document.getSelection();
+ for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
+ if (!textLayer.contains(selection.getRangeAt(i).commonAncestorContainer)) {
+ return null;
+ }
+ }
+ const {
+ x: layerX,
+ y: layerY,
+ width: parentWidth,
+ height: parentHeight
+ } = textLayer.getBoundingClientRect();
+ let rotator;
+ switch (textLayer.getAttribute("data-main-rotation")) {
+ case "90":
+ rotator = (x, y, w, h) => ({
+ x: (y - layerY) / parentHeight,
+ y: 1 - (x + w - layerX) / parentWidth,
+ width: h / parentHeight,
+ height: w / parentWidth
+ });
+ break;
+ case "180":
+ rotator = (x, y, w, h) => ({
+ x: 1 - (x + w - layerX) / parentWidth,
+ y: 1 - (y + h - layerY) / parentHeight,
+ width: w / parentWidth,
+ height: h / parentHeight
+ });
+ break;
+ case "270":
+ rotator = (x, y, w, h) => ({
+ x: 1 - (y + h - layerY) / parentHeight,
+ y: (x - layerX) / parentWidth,
+ width: h / parentHeight,
+ height: w / parentWidth
+ });
+ break;
+ default:
+ rotator = (x, y, w, h) => ({
+ x: (x - layerX) / parentWidth,
+ y: (y - layerY) / parentHeight,
+ width: w / parentWidth,
+ height: h / parentHeight
+ });
+ break;
+ }
+ const boxes = [];
+ for (let i = 0, ii = selection.rangeCount; i < ii; i++) {
+ const range = selection.getRangeAt(i);
+ if (range.collapsed) {
+ continue;
+ }
+ for (const {
+ x,
+ y,
+ width,
+ height
+ } of range.getClientRects()) {
+ if (width === 0 || height === 0) {
+ continue;
+ }
+ boxes.push(rotator(x, y, width, height));
+ }
+ }
+ return boxes.length === 0 ? null : boxes;
+ }
+ addChangedExistingAnnotation({
+ annotationElementId,
+ id
+ }) {
+ (this.#changedExistingAnnotations ||= new Map()).set(annotationElementId, id);
+ }
+ removeChangedExistingAnnotation({
+ annotationElementId
+ }) {
+ this.#changedExistingAnnotations?.delete(annotationElementId);
+ }
+ renderAnnotationElement(annotation) {
+ const editorId = this.#changedExistingAnnotations?.get(annotation.data.id);
+ if (!editorId) {
+ return;
+ }
+ const editor = this.#annotationStorage.getRawValue(editorId);
+ if (!editor) {
+ return;
+ }
+ if (this.#mode === AnnotationEditorType.NONE && !editor.hasBeenModified) {
+ return;
+ }
+ editor.renderAnnotationElement(annotation);
+ }
+}
+
+;// ./src/display/editor/alt_text.js
+
+class AltText {
+ #altText = null;
+ #altTextDecorative = false;
+ #altTextButton = null;
+ #altTextButtonLabel = null;
+ #altTextTooltip = null;
+ #altTextTooltipTimeout = null;
+ #altTextWasFromKeyBoard = false;
+ #badge = null;
+ #editor = null;
+ #guessedText = null;
+ #textWithDisclaimer = null;
+ #useNewAltTextFlow = false;
+ static #l10nNewButton = null;
+ static _l10n = null;
+ constructor(editor) {
+ this.#editor = editor;
+ this.#useNewAltTextFlow = editor._uiManager.useNewAltTextFlow;
+ AltText.#l10nNewButton ||= Object.freeze({
+ added: "pdfjs-editor-new-alt-text-added-button",
+ "added-label": "pdfjs-editor-new-alt-text-added-button-label",
+ missing: "pdfjs-editor-new-alt-text-missing-button",
+ "missing-label": "pdfjs-editor-new-alt-text-missing-button-label",
+ review: "pdfjs-editor-new-alt-text-to-review-button",
+ "review-label": "pdfjs-editor-new-alt-text-to-review-button-label"
+ });
+ }
+ static initialize(l10n) {
+ AltText._l10n ??= l10n;
+ }
+ async render() {
+ const altText = this.#altTextButton = document.createElement("button");
+ altText.className = "altText";
+ altText.tabIndex = "0";
+ const label = this.#altTextButtonLabel = document.createElement("span");
+ altText.append(label);
+ if (this.#useNewAltTextFlow) {
+ altText.classList.add("new");
+ altText.setAttribute("data-l10n-id", AltText.#l10nNewButton.missing);
+ label.setAttribute("data-l10n-id", AltText.#l10nNewButton["missing-label"]);
+ } else {
+ altText.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button");
+ label.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button-label");
+ }
+ const signal = this.#editor._uiManager._signal;
+ altText.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ altText.addEventListener("pointerdown", event => event.stopPropagation(), {
+ signal
+ });
+ const onClick = event => {
+ event.preventDefault();
+ this.#editor._uiManager.editAltText(this.#editor);
+ if (this.#useNewAltTextFlow) {
+ this.#editor._reportTelemetry({
+ action: "pdfjs.image.alt_text.image_status_label_clicked",
+ data: {
+ label: this.#label
+ }
+ });
+ }
+ };
+ altText.addEventListener("click", onClick, {
+ capture: true,
+ signal
+ });
+ altText.addEventListener("keydown", event => {
+ if (event.target === altText && event.key === "Enter") {
+ this.#altTextWasFromKeyBoard = true;
+ onClick(event);
+ }
+ }, {
+ signal
+ });
+ await this.#setState();
+ return altText;
+ }
+ get #label() {
+ return this.#altText && "added" || this.#altText === null && this.guessedText && "review" || "missing";
+ }
+ finish() {
+ if (!this.#altTextButton) {
+ return;
+ }
+ this.#altTextButton.focus({
+ focusVisible: this.#altTextWasFromKeyBoard
+ });
+ this.#altTextWasFromKeyBoard = false;
+ }
+ isEmpty() {
+ if (this.#useNewAltTextFlow) {
+ return this.#altText === null;
+ }
+ return !this.#altText && !this.#altTextDecorative;
+ }
+ hasData() {
+ if (this.#useNewAltTextFlow) {
+ return this.#altText !== null || !!this.#guessedText;
+ }
+ return this.isEmpty();
+ }
+ get guessedText() {
+ return this.#guessedText;
+ }
+ async setGuessedText(guessedText) {
+ if (this.#altText !== null) {
+ return;
+ }
+ this.#guessedText = guessedText;
+ this.#textWithDisclaimer = await AltText._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer", {
+ generatedAltText: guessedText
+ });
+ this.#setState();
+ }
+ toggleAltTextBadge(visibility = false) {
+ if (!this.#useNewAltTextFlow || this.#altText) {
+ this.#badge?.remove();
+ this.#badge = null;
+ return;
+ }
+ if (!this.#badge) {
+ const badge = this.#badge = document.createElement("div");
+ badge.className = "noAltTextBadge";
+ this.#editor.div.append(badge);
+ }
+ this.#badge.classList.toggle("hidden", !visibility);
+ }
+ serialize(isForCopying) {
+ let altText = this.#altText;
+ if (!isForCopying && this.#guessedText === altText) {
+ altText = this.#textWithDisclaimer;
+ }
+ return {
+ altText,
+ decorative: this.#altTextDecorative,
+ guessedText: this.#guessedText,
+ textWithDisclaimer: this.#textWithDisclaimer
+ };
+ }
+ get data() {
+ return {
+ altText: this.#altText,
+ decorative: this.#altTextDecorative
+ };
+ }
+ set data({
+ altText,
+ decorative,
+ guessedText,
+ textWithDisclaimer,
+ cancel = false
+ }) {
+ if (guessedText) {
+ this.#guessedText = guessedText;
+ this.#textWithDisclaimer = textWithDisclaimer;
+ }
+ if (this.#altText === altText && this.#altTextDecorative === decorative) {
+ return;
+ }
+ if (!cancel) {
+ this.#altText = altText;
+ this.#altTextDecorative = decorative;
+ }
+ this.#setState();
+ }
+ toggle(enabled = false) {
+ if (!this.#altTextButton) {
+ return;
+ }
+ if (!enabled && this.#altTextTooltipTimeout) {
+ clearTimeout(this.#altTextTooltipTimeout);
+ this.#altTextTooltipTimeout = null;
+ }
+ this.#altTextButton.disabled = !enabled;
+ }
+ shown() {
+ this.#editor._reportTelemetry({
+ action: "pdfjs.image.alt_text.image_status_label_displayed",
+ data: {
+ label: this.#label
+ }
+ });
+ }
+ destroy() {
+ this.#altTextButton?.remove();
+ this.#altTextButton = null;
+ this.#altTextButtonLabel = null;
+ this.#altTextTooltip = null;
+ this.#badge?.remove();
+ this.#badge = null;
+ }
+ async #setState() {
+ const button = this.#altTextButton;
+ if (!button) {
+ return;
+ }
+ if (this.#useNewAltTextFlow) {
+ button.classList.toggle("done", !!this.#altText);
+ button.setAttribute("data-l10n-id", AltText.#l10nNewButton[this.#label]);
+ this.#altTextButtonLabel?.setAttribute("data-l10n-id", AltText.#l10nNewButton[`${this.#label}-label`]);
+ if (!this.#altText) {
+ this.#altTextTooltip?.remove();
+ return;
+ }
+ } else {
+ if (!this.#altText && !this.#altTextDecorative) {
+ button.classList.remove("done");
+ this.#altTextTooltip?.remove();
+ return;
+ }
+ button.classList.add("done");
+ button.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-edit-button");
+ }
+ let tooltip = this.#altTextTooltip;
+ if (!tooltip) {
+ this.#altTextTooltip = tooltip = document.createElement("span");
+ tooltip.className = "tooltip";
+ tooltip.setAttribute("role", "tooltip");
+ tooltip.id = `alt-text-tooltip-${this.#editor.id}`;
+ const DELAY_TO_SHOW_TOOLTIP = 100;
+ const signal = this.#editor._uiManager._signal;
+ signal.addEventListener("abort", () => {
+ clearTimeout(this.#altTextTooltipTimeout);
+ this.#altTextTooltipTimeout = null;
+ }, {
+ once: true
+ });
+ button.addEventListener("mouseenter", () => {
+ this.#altTextTooltipTimeout = setTimeout(() => {
+ this.#altTextTooltipTimeout = null;
+ this.#altTextTooltip.classList.add("show");
+ this.#editor._reportTelemetry({
+ action: "alt_text_tooltip"
+ });
+ }, DELAY_TO_SHOW_TOOLTIP);
+ }, {
+ signal
+ });
+ button.addEventListener("mouseleave", () => {
+ if (this.#altTextTooltipTimeout) {
+ clearTimeout(this.#altTextTooltipTimeout);
+ this.#altTextTooltipTimeout = null;
+ }
+ this.#altTextTooltip?.classList.remove("show");
+ }, {
+ signal
+ });
+ }
+ if (this.#altTextDecorative) {
+ tooltip.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-decorative-tooltip");
+ } else {
+ tooltip.removeAttribute("data-l10n-id");
+ tooltip.textContent = this.#altText;
+ }
+ if (!tooltip.parentNode) {
+ button.append(tooltip);
+ }
+ const element = this.#editor.getImageForAltText();
+ element?.setAttribute("aria-describedby", tooltip.id);
+ }
+}
+
+;// ./src/display/editor/editor.js
+
+
+
+
+
+class AnnotationEditor {
+ #accessibilityData = null;
+ #allResizerDivs = null;
+ #altText = null;
+ #disabled = false;
+ #dragPointerId = null;
+ #dragPointerType = "";
+ #keepAspectRatio = false;
+ #resizersDiv = null;
+ #lastPointerCoords = null;
+ #savedDimensions = null;
+ #focusAC = null;
+ #focusedResizerName = "";
+ #hasBeenClicked = false;
+ #initialRect = null;
+ #isEditing = false;
+ #isInEditMode = false;
+ #isResizerEnabledForKeyboard = false;
+ #moveInDOMTimeout = null;
+ #prevDragX = 0;
+ #prevDragY = 0;
+ #telemetryTimeouts = null;
+ _editToolbar = null;
+ _initialOptions = Object.create(null);
+ _initialData = null;
+ _isVisible = true;
+ _uiManager = null;
+ _focusEventsAllowed = true;
+ static _l10n = null;
+ static _l10nResizer = null;
+ #isDraggable = false;
+ #zIndex = AnnotationEditor._zIndex++;
+ static _borderLineWidth = -1;
+ static _colorManager = new ColorManager();
+ static _zIndex = 1;
+ static _telemetryTimeout = 1000;
+ static get _resizerKeyboardManager() {
+ const resize = AnnotationEditor.prototype._resizeWithKeyboard;
+ const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
+ const big = AnnotationEditorUIManager.TRANSLATE_BIG;
+ return shadow(this, "_resizerKeyboardManager", new KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], resize, {
+ args: [-small, 0]
+ }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], resize, {
+ args: [-big, 0]
+ }], [["ArrowRight", "mac+ArrowRight"], resize, {
+ args: [small, 0]
+ }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], resize, {
+ args: [big, 0]
+ }], [["ArrowUp", "mac+ArrowUp"], resize, {
+ args: [0, -small]
+ }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], resize, {
+ args: [0, -big]
+ }], [["ArrowDown", "mac+ArrowDown"], resize, {
+ args: [0, small]
+ }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], resize, {
+ args: [0, big]
+ }], [["Escape", "mac+Escape"], AnnotationEditor.prototype._stopResizingWithKeyboard]]));
+ }
+ constructor(parameters) {
+ this.parent = parameters.parent;
+ this.id = parameters.id;
+ this.width = this.height = null;
+ this.pageIndex = parameters.parent.pageIndex;
+ 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: {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ }
+ } = 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 isDrawer() {
+ return false;
+ }
+ static get _defaultLineColor() {
+ return 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, _uiManager) {
+ AnnotationEditor._l10n ??= l10n;
+ AnnotationEditor._l10nResizer ||= Object.freeze({
+ topLeft: "pdfjs-editor-resizer-top-left",
+ topMiddle: "pdfjs-editor-resizer-top-middle",
+ topRight: "pdfjs-editor-resizer-top-right",
+ middleRight: "pdfjs-editor-resizer-middle-right",
+ bottomRight: "pdfjs-editor-resizer-bottom-right",
+ bottomMiddle: "pdfjs-editor-resizer-bottom-middle",
+ bottomLeft: "pdfjs-editor-resizer-bottom-left",
+ middleLeft: "pdfjs-editor-resizer-middle-left"
+ });
+ 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) {
+ unreachable("Not implemented");
+ }
+ get propertiesToUpdate() {
+ return [];
+ }
+ get _isDraggable() {
+ return this.#isDraggable;
+ }
+ set _isDraggable(value) {
+ this.#isDraggable = value;
+ this.div?.classList.toggle("draggable", value);
+ }
+ get isEnterHandled() {
+ return true;
+ }
+ 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);
+ }
+ get currentLayer() {
+ return this._uiManager.currentLayer;
+ }
+ setInBackground() {
+ this.div.style.zIndex = 0;
+ }
+ setInForeground() {
+ this.div.style.zIndex = this.#zIndex;
+ }
+ setParent(parent) {
+ if (parent !== null) {
+ this.pageIndex = parent.pageIndex;
+ this.pageDimensions = parent.pageDimensions;
+ } else {
+ this.#stopResizing();
+ }
+ this.parent = parent;
+ }
+ focusin(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
+ if (!this.#hasBeenClicked) {
+ this.parent.setSelected(this);
+ } else {
+ this.#hasBeenClicked = false;
+ }
+ }
+ focusout(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
+ if (!this.isAttachedToDOM) {
+ return;
+ }
+ const target = event.relatedTarget;
+ if (target?.closest(`#${this.id}`)) {
+ return;
+ }
+ event.preventDefault();
+ if (!this.parent?.isMultipleSelection) {
+ this.commitOrRemove();
+ }
+ }
+ commitOrRemove() {
+ if (this.isEmpty()) {
+ this.remove();
+ } else {
+ this.commit();
+ }
+ }
+ commit() {
+ this.addToAnnotationStorage();
+ }
+ addToAnnotationStorage() {
+ this._uiManager.addToAnnotationStorage(this);
+ }
+ 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.fixAndSetPosition();
+ }
+ #translate([width, height], x, y) {
+ [x, y] = this.screenToPageTranslation(x, y);
+ this.x += x / width;
+ this.y += y / height;
+ this._onTranslating(this.x, this.y);
+ this.fixAndSetPosition();
+ }
+ translate(x, y) {
+ this.#translate(this.parentDimensions, x, y);
+ }
+ translateInPage(x, y) {
+ this.#initialRect ||= [this.x, this.y, this.width, this.height];
+ this.#translate(this.pageDimensions, x, y);
+ this.div.scrollIntoView({
+ block: "nearest"
+ });
+ }
+ drag(tx, ty) {
+ this.#initialRect ||= [this.x, this.y, this.width, this.height];
+ const {
+ div,
+ parentDimensions: [parentWidth, parentHeight]
+ } = this;
+ 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;
+ const {
+ style
+ } = div;
+ style.left = `${(100 * x).toFixed(2)}%`;
+ style.top = `${(100 * y).toFixed(2)}%`;
+ this._onTranslating(x, y);
+ div.scrollIntoView({
+ block: "nearest"
+ });
+ }
+ _onTranslating(x, y) {}
+ _onTranslated(x, y) {}
+ get _hasBeenMoved() {
+ return !!this.#initialRect && (this.#initialRect[0] !== this.x || this.#initialRect[1] !== this.y);
+ }
+ get _hasBeenResized() {
+ return !!this.#initialRect && (this.#initialRect[2] !== this.width || this.#initialRect[3] !== this.height);
+ }
+ 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];
+ }
+ }
+ get _mustFixPosition() {
+ return true;
+ }
+ fixAndSetPosition(rotation = this.rotation) {
+ const {
+ div: {
+ style
+ },
+ pageDimensions: [pageWidth, pageHeight]
+ } = this;
+ let {
+ x,
+ y,
+ width,
+ height
+ } = this;
+ width *= pageWidth;
+ height *= pageHeight;
+ x *= pageWidth;
+ y *= pageHeight;
+ if (this._mustFixPosition) {
+ switch (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;
+ 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:
+ return [-x, -y];
+ case 270:
+ return [-y, x];
+ default:
+ 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 + this.pageRotation) % 360;
+ }
+ get parentDimensions() {
+ const {
+ parentScale,
+ pageDimensions: [pageWidth, pageHeight]
+ } = this;
+ return [pageWidth * parentScale, pageHeight * parentScale];
+ }
+ setDims(width, height) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ const {
+ style
+ } = this.div;
+ style.width = `${(100 * width / parentWidth).toFixed(2)}%`;
+ if (!this.#keepAspectRatio) {
+ style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
+ }
+ }
+ fixDims() {
+ const {
+ style
+ } = this.div;
+ const {
+ height,
+ width
+ } = style;
+ const widthPercent = width.endsWith("%");
+ const heightPercent = !this.#keepAspectRatio && height.endsWith("%");
+ if (widthPercent && heightPercent) {
+ return;
+ }
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ if (!widthPercent) {
+ style.width = `${(100 * parseFloat(width) / parentWidth).toFixed(2)}%`;
+ }
+ 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 = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"];
+ const signal = this._uiManager._signal;
+ for (const name of classes) {
+ const div = document.createElement("div");
+ this.#resizersDiv.append(div);
+ div.classList.add("resizer", name);
+ div.setAttribute("data-resizer-name", name);
+ div.addEventListener("pointerdown", this.#resizerPointerdown.bind(this, name), {
+ signal
+ });
+ div.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ div.tabIndex = -1;
+ }
+ this.div.prepend(this.#resizersDiv);
+ }
+ #resizerPointerdown(name, event) {
+ event.preventDefault();
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ return;
+ }
+ this.#altText?.toggle(false);
+ const savedDraggable = this._isDraggable;
+ this._isDraggable = false;
+ this.#lastPointerCoords = [event.screenX, event.screenY];
+ const ac = new AbortController();
+ const signal = this._uiManager.combinedSignal(ac);
+ this.parent.togglePointerEvents(false);
+ window.addEventListener("pointermove", this.#resizerPointermove.bind(this, name), {
+ passive: true,
+ capture: true,
+ signal
+ });
+ window.addEventListener("touchmove", stopEvent, {
+ passive: false,
+ signal
+ });
+ window.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ this.#savedDimensions = {
+ savedX: this.x,
+ savedY: this.y,
+ savedWidth: this.width,
+ 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 = () => {
+ ac.abort();
+ this.parent.togglePointerEvents(true);
+ this.#altText?.toggle(true);
+ this._isDraggable = savedDraggable;
+ this.parent.div.style.cursor = savedParentCursor;
+ this.div.style.cursor = savedCursor;
+ this.#addResizeToUndoStack();
+ };
+ window.addEventListener("pointerup", pointerUpCallback, {
+ signal
+ });
+ window.addEventListener("blur", pointerUpCallback, {
+ signal
+ });
+ }
+ #resize(x, y, width, height) {
+ this.width = width;
+ this.height = height;
+ this.x = x;
+ this.y = y;
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(parentWidth * width, parentHeight * height);
+ this.fixAndSetPosition();
+ this._onResized();
+ }
+ _onResized() {}
+ #addResizeToUndoStack() {
+ if (!this.#savedDimensions) {
+ return;
+ }
+ const {
+ savedX,
+ savedY,
+ savedWidth,
+ savedHeight
+ } = this.#savedDimensions;
+ this.#savedDimensions = null;
+ 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.#resize.bind(this, newX, newY, newWidth, newHeight),
+ undo: this.#resize.bind(this, savedX, savedY, savedWidth, savedHeight),
+ mustExec: true
+ });
+ }
+ #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;
+ if (!event.fromKeyboard) {
+ const {
+ screenX,
+ screenY
+ } = event;
+ const [lastScreenX, lastScreenY] = this.#lastPointerCoords;
+ [deltaX, deltaY] = this.screenToPageTranslation(screenX - lastScreenX, screenY - lastScreenY);
+ this.#lastPointerCoords[0] = screenX;
+ this.#lastPointerCoords[1] = screenY;
+ } else {
+ ({
+ deltaX,
+ deltaY
+ } = event);
+ }
+ [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.#initialRect ||= [this.x, this.y, this.width, this.height];
+ this.width = newWidth;
+ this.height = newHeight;
+ this.x = newX;
+ this.y = newY;
+ this.setDims(parentWidth * newWidth, parentHeight * newHeight);
+ this.fixAndSetPosition();
+ this._onResizing();
+ }
+ _onResizing() {}
+ altTextFinish() {
+ this.#altText?.finish();
+ }
+ async addEditToolbar() {
+ if (this._editToolbar || this.#isInEditMode) {
+ return this._editToolbar;
+ }
+ this._editToolbar = new EditorToolbar(this);
+ this.div.append(this._editToolbar.render());
+ if (this.#altText) {
+ await this._editToolbar.addAltText(this.#altText);
+ }
+ return this._editToolbar;
+ }
+ removeEditToolbar() {
+ if (!this._editToolbar) {
+ return;
+ }
+ this._editToolbar.remove();
+ this._editToolbar = null;
+ this.#altText?.destroy();
+ }
+ addContainer(container) {
+ const editToolbarDiv = this._editToolbar?.div;
+ if (editToolbarDiv) {
+ editToolbarDiv.before(container);
+ } else {
+ this.div.append(container);
+ }
+ }
+ getClientDimensions() {
+ return this.div.getBoundingClientRect();
+ }
+ async addAltTextButton() {
+ if (this.#altText) {
+ return;
+ }
+ AltText.initialize(AnnotationEditor._l10n);
+ this.#altText = new AltText(this);
+ if (this.#accessibilityData) {
+ this.#altText.data = this.#accessibilityData;
+ this.#accessibilityData = null;
+ }
+ await this.addEditToolbar();
+ }
+ get altTextData() {
+ return this.#altText?.data;
+ }
+ set altTextData(data) {
+ if (!this.#altText) {
+ return;
+ }
+ this.#altText.data = data;
+ }
+ get guessedAltText() {
+ return this.#altText?.guessedText;
+ }
+ async setGuessedAltText(text) {
+ await this.#altText?.setGuessedText(text);
+ }
+ serializeAltText(isForCopying) {
+ return this.#altText?.serialize(isForCopying);
+ }
+ hasAltText() {
+ return !!this.#altText && !this.#altText.isEmpty();
+ }
+ hasAltTextData() {
+ return this.#altText?.hasData() ?? false;
+ }
+ render() {
+ this.div = document.createElement("div");
+ this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
+ this.div.className = this.name;
+ this.div.setAttribute("id", this.id);
+ this.div.tabIndex = this.#disabled ? -1 : 0;
+ if (!this._isVisible) {
+ this.div.classList.add("hidden");
+ }
+ this.setInForeground();
+ this.#addFocusListeners();
+ 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);
+ bindEvents(this, this.div, ["pointerdown"]);
+ this._uiManager._editorUndoBar?.hide();
+ return this.div;
+ }
+ pointerdown(event) {
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ event.preventDefault();
+ return;
+ }
+ this.#hasBeenClicked = true;
+ if (this._isDraggable) {
+ this.#setUpDragSession(event);
+ return;
+ }
+ this.#selectOnPointerEvent(event);
+ }
+ get isSelected() {
+ return this._uiManager.isSelected(this);
+ }
+ #selectOnPointerEvent(event) {
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
+ this.parent.toggleSelected(this);
+ } else {
+ this.parent.setSelected(this);
+ }
+ }
+ #setUpDragSession(event) {
+ const {
+ isSelected
+ } = this;
+ this._uiManager.setUpDragSession();
+ const ac = new AbortController();
+ const signal = this._uiManager.combinedSignal(ac);
+ const opts = {
+ capture: true,
+ passive: false,
+ signal
+ };
+ const cancelDrag = e => {
+ ac.abort();
+ this.#dragPointerId = null;
+ this.#hasBeenClicked = false;
+ if (!this._uiManager.endDragSession()) {
+ this.#selectOnPointerEvent(e);
+ }
+ };
+ if (isSelected) {
+ this.#prevDragX = event.clientX;
+ this.#prevDragY = event.clientY;
+ this.#dragPointerId = event.pointerId;
+ this.#dragPointerType = event.pointerType;
+ window.addEventListener("pointermove", e => {
+ const {
+ clientX: x,
+ clientY: y,
+ pointerId
+ } = e;
+ if (pointerId !== this.#dragPointerId) {
+ stopEvent(e);
+ return;
+ }
+ const [tx, ty] = this.screenToPageTranslation(x - this.#prevDragX, y - this.#prevDragY);
+ this.#prevDragX = x;
+ this.#prevDragY = y;
+ this._uiManager.dragSelectedEditors(tx, ty);
+ }, opts);
+ window.addEventListener("touchmove", stopEvent, opts);
+ window.addEventListener("pointerdown", e => {
+ if (e.isPrimary && e.pointerType === this.#dragPointerType) {
+ cancelDrag(e);
+ }
+ stopEvent(e);
+ }, opts);
+ }
+ this._onStartDragging();
+ const pointerUpCallback = e => {
+ if (!this.#dragPointerId || this.#dragPointerId === e.pointerId) {
+ cancelDrag(e);
+ this._onStopDragging();
+ return;
+ }
+ stopEvent(e);
+ };
+ window.addEventListener("pointerup", pointerUpCallback, {
+ signal
+ });
+ window.addEventListener("blur", pointerUpCallback, {
+ signal
+ });
+ }
+ _onStartDragging() {}
+ _onStopDragging() {}
+ moveInDOM() {
+ if (this.#moveInDOMTimeout) {
+ clearTimeout(this.#moveInDOMTimeout);
+ }
+ this.#moveInDOMTimeout = setTimeout(() => {
+ this.#moveInDOMTimeout = null;
+ this.parent?.moveEditorInDOM(this);
+ }, 0);
+ }
+ _setParentAndPosition(parent, x, y) {
+ parent.changeParent(this);
+ this.x = x;
+ this.y = y;
+ this.fixAndSetPosition();
+ this._onTranslated();
+ }
+ getRect(tx, ty, rotation = this.rotation) {
+ const scale = this.parentScale;
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ const [pageX, pageY] = this.pageTranslation;
+ const shiftX = tx / scale;
+ const shiftY = ty / scale;
+ const x = this.x * pageWidth;
+ const y = this.y * pageHeight;
+ const width = this.width * pageWidth;
+ const height = this.height * pageHeight;
+ switch (rotation) {
+ case 0:
+ return [x + shiftX + pageX, pageHeight - y - shiftY - height + pageY, x + shiftX + width + pageX, pageHeight - y - shiftY + pageY];
+ case 90:
+ return [x + shiftY + pageX, pageHeight - y + shiftX + pageY, x + shiftY + height + pageX, pageHeight - y + shiftX + width + pageY];
+ case 180:
+ return [x - shiftX - width + pageX, pageHeight - y + shiftY + pageY, x - shiftX + pageX, pageHeight - y + shiftY + height + pageY];
+ case 270:
+ return [x - shiftY - height + pageX, pageHeight - y - shiftX - width + pageY, x - shiftY + pageX, pageHeight - y - shiftX + pageY];
+ default:
+ throw new Error("Invalid rotation");
+ }
+ }
+ getRectInCurrentCoords(rect, pageHeight) {
+ const [x1, y1, x2, y2] = rect;
+ const width = x2 - x1;
+ const height = y2 - y1;
+ switch (this.rotation) {
+ case 0:
+ return [x1, pageHeight - y2, width, height];
+ case 90:
+ return [x1, pageHeight - y1, height, width];
+ case 180:
+ return [x2, pageHeight - y1, width, height];
+ case 270:
+ return [x2, pageHeight - y2, height, width];
+ default:
+ throw new Error("Invalid rotation");
+ }
+ }
+ onceAdded() {}
+ isEmpty() {
+ return false;
+ }
+ enableEditMode() {
+ this.#isInEditMode = true;
+ }
+ disableEditMode() {
+ this.#isInEditMode = false;
+ }
+ isInEditMode() {
+ return this.#isInEditMode;
+ }
+ shouldGetKeyboardEvents() {
+ return this.#isResizerEnabledForKeyboard;
+ }
+ needsToBeRebuilt() {
+ return this.div && !this.isAttachedToDOM;
+ }
+ get isOnScreen() {
+ const {
+ top,
+ left,
+ bottom,
+ right
+ } = this.getClientDimensions();
+ const {
+ innerHeight,
+ innerWidth
+ } = window;
+ return left < innerWidth && right > 0 && top < innerHeight && bottom > 0;
+ }
+ #addFocusListeners() {
+ if (this.#focusAC || !this.div) {
+ return;
+ }
+ this.#focusAC = new AbortController();
+ const signal = this._uiManager.combinedSignal(this.#focusAC);
+ this.div.addEventListener("focusin", this.focusin.bind(this), {
+ signal
+ });
+ this.div.addEventListener("focusout", this.focusout.bind(this), {
+ signal
+ });
+ }
+ rebuild() {
+ this.#addFocusListeners();
+ }
+ rotate(_angle) {}
+ resize() {}
+ serializeDeleted() {
+ return {
+ id: this.annotationElementId,
+ deleted: true,
+ pageIndex: this.pageIndex,
+ popupRef: this._initialData?.popupRef || ""
+ };
+ }
+ serialize(isForCopying = false, context = null) {
+ unreachable("An editor must be serializable");
+ }
+ static async deserialize(data, parent, uiManager) {
+ const editor = new this.prototype.constructor({
+ parent,
+ id: parent.getNextId(),
+ uiManager
+ });
+ editor.rotation = data.rotation;
+ editor.#accessibilityData = data.accessibilityData;
+ const [pageWidth, pageHeight] = editor.pageDimensions;
+ const [x, y, width, height] = editor.getRectInCurrentCoords(data.rect, pageHeight);
+ editor.x = x / pageWidth;
+ editor.y = y / pageHeight;
+ editor.width = width / pageWidth;
+ editor.height = height / pageHeight;
+ return editor;
+ }
+ get hasBeenModified() {
+ return !!this.annotationElementId && (this.deleted || this.serialize() !== null);
+ }
+ remove() {
+ this.#focusAC?.abort();
+ this.#focusAC = null;
+ if (!this.isEmpty()) {
+ this.commit();
+ }
+ if (this.parent) {
+ this.parent.remove(this);
+ } else {
+ this._uiManager.removeEditor(this);
+ }
+ if (this.#moveInDOMTimeout) {
+ clearTimeout(this.#moveInDOMTimeout);
+ this.#moveInDOMTimeout = null;
+ }
+ this.#stopResizing();
+ this.removeEditToolbar();
+ if (this.#telemetryTimeouts) {
+ for (const timeout of this.#telemetryTimeouts.values()) {
+ clearTimeout(timeout);
+ }
+ this.#telemetryTimeouts = null;
+ }
+ this.parent = null;
+ }
+ get isResizable() {
+ return false;
+ }
+ makeResizable() {
+ if (this.isResizable) {
+ this.#createResizers();
+ this.#resizersDiv.classList.remove("hidden");
+ bindEvents(this, this.div, ["keydown"]);
+ }
+ }
+ get toolbarPosition() {
+ return null;
+ }
+ keydown(event) {
+ if (!this.isResizable || event.target !== this.div || event.key !== "Enter") {
+ return;
+ }
+ this._uiManager.setSelected(this);
+ this.#savedDimensions = {
+ savedX: this.x,
+ savedY: this.y,
+ savedWidth: this.width,
+ savedHeight: this.height
+ };
+ const children = this.#resizersDiv.children;
+ if (!this.#allResizerDivs) {
+ this.#allResizerDivs = Array.from(children);
+ const boundResizerKeydown = this.#resizerKeydown.bind(this);
+ const boundResizerBlur = this.#resizerBlur.bind(this);
+ const signal = this._uiManager._signal;
+ for (const div of this.#allResizerDivs) {
+ const name = div.getAttribute("data-resizer-name");
+ div.setAttribute("role", "spinbutton");
+ div.addEventListener("keydown", boundResizerKeydown, {
+ signal
+ });
+ div.addEventListener("blur", boundResizerBlur, {
+ signal
+ });
+ div.addEventListener("focus", this.#resizerFocus.bind(this, name), {
+ signal
+ });
+ div.setAttribute("data-l10n-id", AnnotationEditor._l10nResizer[name]);
+ }
+ }
+ const first = this.#allResizerDivs[0];
+ let firstPosition = 0;
+ for (const div of children) {
+ if (div === first) {
+ break;
+ }
+ firstPosition++;
+ }
+ const nextFirstPosition = (360 - this.rotation + this.parentRotation) % 360 / 90 * (this.#allResizerDivs.length / 4);
+ if (nextFirstPosition !== firstPosition) {
+ if (nextFirstPosition < firstPosition) {
+ for (let i = 0; i < firstPosition - nextFirstPosition; i++) {
+ this.#resizersDiv.append(this.#resizersDiv.firstChild);
+ }
+ } else if (nextFirstPosition > firstPosition) {
+ for (let i = 0; i < nextFirstPosition - firstPosition; i++) {
+ this.#resizersDiv.firstChild.before(this.#resizersDiv.lastChild);
+ }
+ }
+ let i = 0;
+ for (const child of children) {
+ const div = this.#allResizerDivs[i++];
+ const name = div.getAttribute("data-resizer-name");
+ child.setAttribute("data-l10n-id", AnnotationEditor._l10nResizer[name]);
+ }
+ }
+ this.#setResizerTabIndex(0);
+ this.#isResizerEnabledForKeyboard = true;
+ this.#resizersDiv.firstChild.focus({
+ focusVisible: true
+ });
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ #resizerKeydown(event) {
+ AnnotationEditor._resizerKeyboardManager.exec(this, event);
+ }
+ #resizerBlur(event) {
+ if (this.#isResizerEnabledForKeyboard && event.relatedTarget?.parentNode !== this.#resizersDiv) {
+ this.#stopResizing();
+ }
+ }
+ #resizerFocus(name) {
+ this.#focusedResizerName = this.#isResizerEnabledForKeyboard ? name : "";
+ }
+ #setResizerTabIndex(value) {
+ if (!this.#allResizerDivs) {
+ return;
+ }
+ for (const div of this.#allResizerDivs) {
+ div.tabIndex = value;
+ }
+ }
+ _resizeWithKeyboard(x, y) {
+ if (!this.#isResizerEnabledForKeyboard) {
+ return;
+ }
+ this.#resizerPointermove(this.#focusedResizerName, {
+ deltaX: x,
+ deltaY: y,
+ fromKeyboard: true
+ });
+ }
+ #stopResizing() {
+ this.#isResizerEnabledForKeyboard = false;
+ this.#setResizerTabIndex(-1);
+ this.#addResizeToUndoStack();
+ }
+ _stopResizingWithKeyboard() {
+ this.#stopResizing();
+ this.div.focus();
+ }
+ select() {
+ this.makeResizable();
+ this.div?.classList.add("selectedEditor");
+ if (!this._editToolbar) {
+ this.addEditToolbar().then(() => {
+ if (this.div?.classList.contains("selectedEditor")) {
+ this._editToolbar?.show();
+ }
+ });
+ return;
+ }
+ this._editToolbar?.show();
+ this.#altText?.toggleAltTextBadge(false);
+ }
+ unselect() {
+ this.#resizersDiv?.classList.add("hidden");
+ this.div?.classList.remove("selectedEditor");
+ if (this.div?.contains(document.activeElement)) {
+ this._uiManager.currentLayer.div.focus({
+ preventScroll: true
+ });
+ }
+ this._editToolbar?.hide();
+ this.#altText?.toggleAltTextBadge(true);
+ }
+ updateParams(type, value) {}
+ disableEditing() {}
+ enableEditing() {}
+ enterInEditMode() {}
+ getImageForAltText() {
+ return null;
+ }
+ get contentDiv() {
+ return this.div;
+ }
+ get isEditing() {
+ return this.#isEditing;
+ }
+ set isEditing(value) {
+ this.#isEditing = value;
+ if (!this.parent) {
+ return;
+ }
+ if (value) {
+ this.parent.setSelected(this);
+ this.parent.setActiveEditor(this);
+ } else {
+ 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;
+ }
+ static canCreateNewEmptyEditor() {
+ return true;
+ }
+ get telemetryInitialData() {
+ return {
+ action: "added"
+ };
+ }
+ get telemetryFinalData() {
+ return null;
+ }
+ _reportTelemetry(data, mustWait = false) {
+ if (mustWait) {
+ this.#telemetryTimeouts ||= new Map();
+ const {
+ action
+ } = data;
+ let timeout = this.#telemetryTimeouts.get(action);
+ if (timeout) {
+ clearTimeout(timeout);
+ }
+ timeout = setTimeout(() => {
+ this._reportTelemetry(data);
+ this.#telemetryTimeouts.delete(action);
+ if (this.#telemetryTimeouts.size === 0) {
+ this.#telemetryTimeouts = null;
+ }
+ }, AnnotationEditor._telemetryTimeout);
+ this.#telemetryTimeouts.set(action, timeout);
+ return;
+ }
+ data.type ||= this.editorType;
+ this._uiManager._eventBus.dispatch("reporttelemetry", {
+ source: this,
+ details: {
+ type: "editing",
+ data
+ }
+ });
+ }
+ show(visible = this._isVisible) {
+ this.div.classList.toggle("hidden", !visible);
+ this._isVisible = visible;
+ }
+ enable() {
+ if (this.div) {
+ this.div.tabIndex = 0;
+ }
+ this.#disabled = false;
+ }
+ disable() {
+ if (this.div) {
+ this.div.tabIndex = -1;
+ }
+ this.#disabled = true;
+ }
+ renderAnnotationElement(annotation) {
+ let content = annotation.container.querySelector(".annotationContent");
+ if (!content) {
+ content = document.createElement("div");
+ content.classList.add("annotationContent", this.editorType);
+ annotation.container.prepend(content);
+ } else if (content.nodeName === "CANVAS") {
+ const canvas = content;
+ content = document.createElement("div");
+ content.classList.add("annotationContent", this.editorType);
+ canvas.before(content);
+ }
+ return content;
+ }
+ resetAnnotationElement(annotation) {
+ const {
+ firstChild
+ } = annotation.container;
+ if (firstChild?.nodeName === "DIV" && firstChild.classList.contains("annotationContent")) {
+ firstChild.remove();
+ }
+ }
+}
+class FakeEditor extends AnnotationEditor {
+ constructor(params) {
+ super(params);
+ this.annotationElementId = params.annotationElementId;
+ this.deleted = true;
+ }
+ serialize() {
+ return this.serializeDeleted();
+ }
+}
+
+;// ./src/shared/murmurhash3.js
+const SEED = 0xc3d2e1f0;
+const MASK_HIGH = 0xffff0000;
+const MASK_LOW = 0xffff;
+class MurmurHash3_64 {
+ constructor(seed) {
+ this.h1 = seed ? seed & 0xffffffff : SEED;
+ this.h2 = seed ? seed & 0xffffffff : SEED;
+ }
+ update(input) {
+ let data, length;
+ if (typeof input === "string") {
+ data = new Uint8Array(input.length * 2);
+ length = 0;
+ for (let i = 0, ii = input.length; i < ii; i++) {
+ const code = input.charCodeAt(i);
+ if (code <= 0xff) {
+ data[length++] = code;
+ } else {
+ data[length++] = code >>> 8;
+ data[length++] = code & 0xff;
+ }
+ }
+ } else if (ArrayBuffer.isView(input)) {
+ data = input.slice();
+ length = data.byteLength;
+ } else {
+ throw new Error("Invalid data format, must be a string or TypedArray.");
+ }
+ const blockCounts = length >> 2;
+ const tailLength = length - blockCounts * 4;
+ const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
+ let k1 = 0,
+ k2 = 0;
+ let h1 = this.h1,
+ h2 = this.h2;
+ const C1 = 0xcc9e2d51,
+ C2 = 0x1b873593;
+ const C1_LOW = C1 & MASK_LOW,
+ C2_LOW = C2 & MASK_LOW;
+ for (let i = 0; i < blockCounts; i++) {
+ if (i & 1) {
+ k1 = dataUint32[i];
+ k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+ k1 = k1 << 15 | k1 >>> 17;
+ k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+ h1 ^= k1;
+ h1 = h1 << 13 | h1 >>> 19;
+ h1 = h1 * 5 + 0xe6546b64;
+ } else {
+ k2 = dataUint32[i];
+ k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
+ k2 = k2 << 15 | k2 >>> 17;
+ k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
+ h2 ^= k2;
+ h2 = h2 << 13 | h2 >>> 19;
+ h2 = h2 * 5 + 0xe6546b64;
+ }
+ }
+ k1 = 0;
+ switch (tailLength) {
+ case 3:
+ k1 ^= data[blockCounts * 4 + 2] << 16;
+ case 2:
+ k1 ^= data[blockCounts * 4 + 1] << 8;
+ case 1:
+ k1 ^= data[blockCounts * 4];
+ k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+ k1 = k1 << 15 | k1 >>> 17;
+ k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+ if (blockCounts & 1) {
+ h1 ^= k1;
+ } else {
+ h2 ^= k1;
+ }
+ }
+ this.h1 = h1;
+ this.h2 = h2;
+ }
+ hexdigest() {
+ let h1 = this.h1,
+ h2 = this.h2;
+ h1 ^= h2 >>> 1;
+ h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
+ h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
+ h1 ^= h2 >>> 1;
+ h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
+ h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
+ h1 ^= h2 >>> 1;
+ return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
+ }
+}
+
+;// ./src/display/annotation_storage.js
+
+
+
+const SerializableEmpty = Object.freeze({
+ map: null,
+ hash: "",
+ transfer: undefined
+});
+class AnnotationStorage {
+ #modified = false;
+ #modifiedIds = null;
+ #storage = new Map();
+ constructor() {
+ this.onSetModified = null;
+ this.onResetModified = null;
+ this.onAnnotationEditor = null;
+ }
+ getValue(key, defaultValue) {
+ const value = this.#storage.get(key);
+ if (value === undefined) {
+ return defaultValue;
+ }
+ return Object.assign(defaultValue, value);
+ }
+ getRawValue(key) {
+ return this.#storage.get(key);
+ }
+ remove(key) {
+ this.#storage.delete(key);
+ if (this.#storage.size === 0) {
+ this.resetModified();
+ }
+ if (typeof this.onAnnotationEditor === "function") {
+ for (const value of this.#storage.values()) {
+ if (value instanceof AnnotationEditor) {
+ return;
+ }
+ }
+ this.onAnnotationEditor(null);
+ }
+ }
+ setValue(key, value) {
+ const obj = this.#storage.get(key);
+ let modified = false;
+ if (obj !== undefined) {
+ for (const [entry, val] of Object.entries(value)) {
+ if (obj[entry] !== val) {
+ modified = true;
+ obj[entry] = val;
+ }
+ }
+ } else {
+ modified = true;
+ this.#storage.set(key, value);
+ }
+ if (modified) {
+ this.#setModified();
+ }
+ if (value instanceof AnnotationEditor && typeof this.onAnnotationEditor === "function") {
+ this.onAnnotationEditor(value.constructor._type);
+ }
+ }
+ has(key) {
+ return this.#storage.has(key);
+ }
+ getAll() {
+ return this.#storage.size > 0 ? objectFromMap(this.#storage) : null;
+ }
+ setAll(obj) {
+ for (const [key, val] of Object.entries(obj)) {
+ this.setValue(key, val);
+ }
+ }
+ get size() {
+ return this.#storage.size;
+ }
+ #setModified() {
+ if (!this.#modified) {
+ this.#modified = true;
+ if (typeof this.onSetModified === "function") {
+ this.onSetModified();
+ }
+ }
+ }
+ resetModified() {
+ if (this.#modified) {
+ this.#modified = false;
+ if (typeof this.onResetModified === "function") {
+ this.onResetModified();
+ }
+ }
+ }
+ get print() {
+ return new PrintAnnotationStorage(this);
+ }
+ get serializable() {
+ if (this.#storage.size === 0) {
+ return SerializableEmpty;
+ }
+ const map = new Map(),
+ hash = new MurmurHash3_64(),
+ transfer = [];
+ const context = Object.create(null);
+ let hasBitmap = false;
+ for (const [key, val] of this.#storage) {
+ const serialized = val instanceof AnnotationEditor ? val.serialize(false, context) : val;
+ if (serialized) {
+ map.set(key, serialized);
+ hash.update(`${key}:${JSON.stringify(serialized)}`);
+ hasBitmap ||= !!serialized.bitmap;
+ }
+ }
+ if (hasBitmap) {
+ for (const value of map.values()) {
+ if (value.bitmap) {
+ transfer.push(value.bitmap);
+ }
+ }
+ }
+ return map.size > 0 ? {
+ map,
+ hash: hash.hexdigest(),
+ transfer
+ } : SerializableEmpty;
+ }
+ get editorStats() {
+ let stats = null;
+ const typeToEditor = new Map();
+ for (const value of this.#storage.values()) {
+ if (!(value instanceof AnnotationEditor)) {
+ continue;
+ }
+ const editorStats = value.telemetryFinalData;
+ if (!editorStats) {
+ continue;
+ }
+ const {
+ type
+ } = editorStats;
+ if (!typeToEditor.has(type)) {
+ typeToEditor.set(type, Object.getPrototypeOf(value).constructor);
+ }
+ stats ||= Object.create(null);
+ const map = stats[type] ||= new Map();
+ for (const [key, val] of Object.entries(editorStats)) {
+ if (key === "type") {
+ continue;
+ }
+ let counters = map.get(key);
+ if (!counters) {
+ counters = new Map();
+ map.set(key, counters);
+ }
+ const count = counters.get(val) ?? 0;
+ counters.set(val, count + 1);
+ }
+ }
+ for (const [type, editor] of typeToEditor) {
+ stats[type] = editor.computeTelemetryFinalData(stats[type]);
+ }
+ return stats;
+ }
+ resetModifiedIds() {
+ this.#modifiedIds = null;
+ }
+ get modifiedIds() {
+ if (this.#modifiedIds) {
+ return this.#modifiedIds;
+ }
+ const ids = [];
+ for (const value of this.#storage.values()) {
+ if (!(value instanceof AnnotationEditor) || !value.annotationElementId || !value.serialize()) {
+ continue;
+ }
+ ids.push(value.annotationElementId);
+ }
+ return this.#modifiedIds = {
+ ids: new Set(ids),
+ hash: ids.join(",")
+ };
+ }
+}
+class PrintAnnotationStorage extends AnnotationStorage {
+ #serializable;
+ constructor(parent) {
+ super();
+ const {
+ map,
+ hash,
+ transfer
+ } = parent.serializable;
+ const clone = structuredClone(map, transfer ? {
+ transfer
+ } : null);
+ this.#serializable = {
+ map: clone,
+ hash,
+ transfer
+ };
+ }
+ get print() {
+ unreachable("Should not call PrintAnnotationStorage.print");
+ }
+ get serializable() {
+ return this.#serializable;
+ }
+ get modifiedIds() {
+ return shadow(this, "modifiedIds", {
+ ids: new Set(),
+ hash: ""
+ });
+ }
+}
+
+;// ./src/display/font_loader.js
+
+class FontLoader {
+ #systemFonts = new Set();
+ constructor({
+ ownerDocument = globalThis.document,
+ styleElement = null
+ }) {
+ this._document = ownerDocument;
+ this.nativeFontFaces = new Set();
+ this.styleElement = null;
+ this.loadingRequests = [];
+ this.loadTestFontId = 0;
+ }
+ addNativeFontFace(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");
+ this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);
+ }
+ const styleSheet = this.styleElement.sheet;
+ styleSheet.insertRule(rule, styleSheet.cssRules.length);
+ }
+ clear() {
+ for (const nativeFontFace of this.nativeFontFaces) {
+ this._document.fonts.delete(nativeFontFace);
+ }
+ this.nativeFontFaces.clear();
+ this.#systemFonts.clear();
+ if (this.styleElement) {
+ this.styleElement.remove();
+ this.styleElement = null;
+ }
+ }
+ async loadSystemFont({
+ systemFontInfo: info,
+ _inspectFont
+ }) {
+ if (!info || this.#systemFonts.has(info.loadedName)) {
+ return;
+ }
+ 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);
+ _inspectFont?.(info);
+ } catch {
+ warn(`Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`);
+ this.removeNativeFontFace(fontFace);
+ }
+ return;
+ }
+ unreachable("Not implemented: loadSystemFont without the Font Loading API.");
+ }
+ async bind(font) {
+ if (font.attached || font.missingFile && !font.systemFontInfo) {
+ return;
+ }
+ font.attached = true;
+ if (font.systemFontInfo) {
+ await this.loadSystemFont(font);
+ return;
+ }
+ if (this.isFontLoadingAPISupported) {
+ const nativeFontFace = font.createNativeFontFace();
+ if (nativeFontFace) {
+ this.addNativeFontFace(nativeFontFace);
+ try {
+ await nativeFontFace.loaded;
+ } catch (ex) {
+ warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
+ font.disableFontFace = true;
+ throw ex;
+ }
+ }
+ return;
+ }
+ const rule = font.createFontFaceRule();
+ if (rule) {
+ this.insertRule(rule);
+ if (this.isSyncFontLoadingSupported) {
+ return;
+ }
+ await new Promise(resolve => {
+ const request = this._queueLoadingCallback(resolve);
+ this._prepareFontLoadEvent(font, request);
+ });
+ }
+ }
+ get isFontLoadingAPISupported() {
+ const hasFonts = !!this._document?.fonts;
+ return shadow(this, "isFontLoadingAPISupported", hasFonts);
+ }
+ get isSyncFontLoadingSupported() {
+ let supported = false;
+ if (isNodeJS) {
+ supported = true;
+ } else if (typeof navigator !== "undefined" && typeof navigator?.userAgent === "string" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) {
+ supported = true;
+ }
+ return shadow(this, "isSyncFontLoadingSupported", supported);
+ }
+ _queueLoadingCallback(callback) {
+ function completeRequest() {
+ assert(!request.done, "completeRequest() cannot be called twice.");
+ request.done = true;
+ while (loadingRequests.length > 0 && loadingRequests[0].done) {
+ const otherRequest = loadingRequests.shift();
+ setTimeout(otherRequest.callback, 0);
+ }
+ }
+ const {
+ loadingRequests
+ } = this;
+ const request = {
+ done: false,
+ complete: completeRequest,
+ callback
+ };
+ loadingRequests.push(request);
+ return request;
+ }
+ get _loadTestFont() {
+ const testFont = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + "ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA" + "AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1" + "AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD" + "6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM" + "AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D" + "IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA" + "AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA" + "AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB" + "AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY" + "AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA" + "AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA" + "AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC" + "AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
+ return shadow(this, "_loadTestFont", testFont);
+ }
+ _prepareFontLoadEvent(font, request) {
+ function int32(data, offset) {
+ return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
+ }
+ function spliceString(s, offset, remove, insert) {
+ const chunk1 = s.substring(0, offset);
+ const chunk2 = s.substring(offset + remove);
+ return chunk1 + insert + chunk2;
+ }
+ let i, ii;
+ const canvas = this._document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = 1;
+ const ctx = canvas.getContext("2d");
+ let called = 0;
+ function isFontReady(name, callback) {
+ if (++called > 30) {
+ warn("Load test font never loaded.");
+ callback();
+ return;
+ }
+ ctx.font = "30px " + name;
+ ctx.fillText(".", 0, 20);
+ const imageData = ctx.getImageData(0, 0, 1, 1);
+ if (imageData.data[3] > 0) {
+ callback();
+ return;
+ }
+ setTimeout(isFontReady.bind(null, name, callback));
+ }
+ const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;
+ let data = this._loadTestFont;
+ const COMMENT_OFFSET = 976;
+ data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
+ const CFF_CHECKSUM_OFFSET = 16;
+ const XXXX_VALUE = 0x58585858;
+ let checksum = int32(data, CFF_CHECKSUM_OFFSET);
+ for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
+ checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
+ }
+ if (i < loadTestFontId.length) {
+ checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
+ }
+ data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));
+ const url = `url(data:font/opentype;base64,${btoa(data)});`;
+ const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`;
+ this.insertRule(rule);
+ const div = this._document.createElement("div");
+ div.style.visibility = "hidden";
+ div.style.width = div.style.height = "10px";
+ div.style.position = "absolute";
+ div.style.top = div.style.left = "0px";
+ for (const name of [font.loadedName, loadTestFontId]) {
+ const span = this._document.createElement("span");
+ span.textContent = "Hi";
+ span.style.fontFamily = name;
+ div.append(span);
+ }
+ this._document.body.append(div);
+ isFontReady(loadTestFontId, () => {
+ div.remove();
+ request.complete();
+ });
+ }
+}
+class FontFaceObject {
+ constructor(translatedData, {
+ disableFontFace = false,
+ inspectFont = null
+ }) {
+ this.compiledGlyphs = Object.create(null);
+ for (const i in translatedData) {
+ this[i] = translatedData[i];
+ }
+ this.disableFontFace = disableFontFace === true;
+ this._inspectFont = inspectFont;
+ }
+ createNativeFontFace() {
+ if (!this.data || this.disableFontFace) {
+ return null;
+ }
+ let nativeFontFace;
+ if (!this.cssFontInfo) {
+ nativeFontFace = new FontFace(this.loadedName, this.data, {});
+ } else {
+ const css = {
+ weight: this.cssFontInfo.fontWeight
+ };
+ if (this.cssFontInfo.italicAngle) {
+ css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;
+ }
+ nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);
+ }
+ this._inspectFont?.(this);
+ return nativeFontFace;
+ }
+ createFontFaceRule() {
+ if (!this.data || this.disableFontFace) {
+ return null;
+ }
+ const url = `url(data:${this.mimetype};base64,${toBase64Util(this.data)});`;
+ let rule;
+ if (!this.cssFontInfo) {
+ rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`;
+ } else {
+ let css = `font-weight: ${this.cssFontInfo.fontWeight};`;
+ if (this.cssFontInfo.italicAngle) {
+ css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;
+ }
+ rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css}src:${url}}`;
+ }
+ this._inspectFont?.(this, url);
+ return rule;
+ }
+ getPathGenerator(objs, character) {
+ if (this.compiledGlyphs[character] !== undefined) {
+ return this.compiledGlyphs[character];
+ }
+ let cmds;
+ try {
+ cmds = objs.get(this.loadedName + "_path_" + character);
+ } catch (ex) {
+ warn(`getPathGenerator - ignoring character: "${ex}".`);
+ }
+ if (!Array.isArray(cmds) || cmds.length === 0) {
+ return this.compiledGlyphs[character] = function (c, size) {};
+ }
+ const commands = [];
+ for (let i = 0, ii = cmds.length; i < ii;) {
+ switch (cmds[i++]) {
+ case FontRenderOps.BEZIER_CURVE_TO:
+ {
+ const [a, b, c, d, e, f] = cmds.slice(i, i + 6);
+ commands.push(ctx => ctx.bezierCurveTo(a, b, c, d, e, f));
+ i += 6;
+ }
+ break;
+ case FontRenderOps.MOVE_TO:
+ {
+ const [a, b] = cmds.slice(i, i + 2);
+ commands.push(ctx => ctx.moveTo(a, b));
+ i += 2;
+ }
+ break;
+ case FontRenderOps.LINE_TO:
+ {
+ const [a, b] = cmds.slice(i, i + 2);
+ commands.push(ctx => ctx.lineTo(a, b));
+ i += 2;
+ }
+ break;
+ case FontRenderOps.QUADRATIC_CURVE_TO:
+ {
+ const [a, b, c, d] = cmds.slice(i, i + 4);
+ commands.push(ctx => ctx.quadraticCurveTo(a, b, c, d));
+ i += 4;
+ }
+ break;
+ case FontRenderOps.RESTORE:
+ commands.push(ctx => ctx.restore());
+ break;
+ case FontRenderOps.SAVE:
+ commands.push(ctx => ctx.save());
+ break;
+ case FontRenderOps.SCALE:
+ assert(commands.length === 2, "Scale command is only valid at the third position.");
+ break;
+ case FontRenderOps.TRANSFORM:
+ {
+ const [a, b, c, d, e, f] = cmds.slice(i, i + 6);
+ commands.push(ctx => ctx.transform(a, b, c, d, e, f));
+ i += 6;
+ }
+ break;
+ case FontRenderOps.TRANSLATE:
+ {
+ const [a, b] = cmds.slice(i, i + 2);
+ commands.push(ctx => ctx.translate(a, b));
+ i += 2;
+ }
+ break;
+ }
+ }
+ commands.push(ctx => ctx.closePath());
+ return this.compiledGlyphs[character] = function glyphDrawer(ctx, size) {
+ commands[0](ctx);
+ commands[1](ctx);
+ ctx.scale(size, -size);
+ for (let i = 2, ii = commands.length; i < ii; i++) {
+ commands[i](ctx);
+ }
+ };
+ }
+}
+
+;// ./src/display/canvas_factory.js
+
+class BaseCanvasFactory {
+ #enableHWA = false;
+ constructor({
+ enableHWA = false
+ }) {
+ this.#enableHWA = enableHWA;
+ }
+ create(width, height) {
+ if (width <= 0 || height <= 0) {
+ throw new Error("Invalid canvas size");
+ }
+ const canvas = this._createCanvas(width, height);
+ return {
+ canvas,
+ context: canvas.getContext("2d", {
+ willReadFrequently: !this.#enableHWA
+ })
+ };
+ }
+ reset(canvasAndContext, width, height) {
+ if (!canvasAndContext.canvas) {
+ throw new Error("Canvas is not specified");
+ }
+ if (width <= 0 || height <= 0) {
+ throw new Error("Invalid canvas size");
+ }
+ canvasAndContext.canvas.width = width;
+ canvasAndContext.canvas.height = height;
+ }
+ destroy(canvasAndContext) {
+ if (!canvasAndContext.canvas) {
+ throw new Error("Canvas is not specified");
+ }
+ canvasAndContext.canvas.width = 0;
+ canvasAndContext.canvas.height = 0;
+ canvasAndContext.canvas = null;
+ canvasAndContext.context = null;
+ }
+ _createCanvas(width, height) {
+ unreachable("Abstract method `_createCanvas` called.");
+ }
+}
+class DOMCanvasFactory extends BaseCanvasFactory {
+ constructor({
+ ownerDocument = globalThis.document,
+ enableHWA = false
+ }) {
+ super({
+ enableHWA
+ });
+ this._document = ownerDocument;
+ }
+ _createCanvas(width, height) {
+ const canvas = this._document.createElement("canvas");
+ canvas.width = width;
+ canvas.height = height;
+ return canvas;
+ }
+}
+
+;// ./src/display/cmap_reader_factory.js
+
+
+class BaseCMapReaderFactory {
+ constructor({
+ baseUrl = null,
+ isCompressed = true
+ }) {
+ this.baseUrl = baseUrl;
+ this.isCompressed = isCompressed;
+ }
+ async fetch({
+ name
+ }) {
+ if (!this.baseUrl) {
+ throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");
+ }
+ if (!name) {
+ throw new Error("CMap name must be specified.");
+ }
+ const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
+ return this._fetch(url).then(cMapData => ({
+ cMapData,
+ isCompressed: this.isCompressed
+ })).catch(reason => {
+ throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`);
+ });
+ }
+ async _fetch(url) {
+ unreachable("Abstract method `_fetch` called.");
+ }
+}
+class DOMCMapReaderFactory extends BaseCMapReaderFactory {
+ async _fetch(url) {
+ const data = await fetchData(url, this.isCompressed ? "arraybuffer" : "text");
+ return data instanceof ArrayBuffer ? new Uint8Array(data) : stringToBytes(data);
+ }
+}
+
+;// ./src/display/filter_factory.js
+
+
+class BaseFilterFactory {
+ addFilter(maps) {
+ return "none";
+ }
+ addHCMFilter(fgColor, bgColor) {
+ return "none";
+ }
+ addAlphaFilter(map) {
+ return "none";
+ }
+ addLuminosityFilter(map) {
+ return "none";
+ }
+ addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
+ return "none";
+ }
+ destroy(keepHCM = false) {}
+}
+class DOMFilterFactory extends BaseFilterFactory {
+ #baseUrl;
+ #_cache;
+ #_defs;
+ #docId;
+ #document;
+ #_hcmCache;
+ #id = 0;
+ constructor({
+ docId,
+ ownerDocument = globalThis.document
+ }) {
+ super();
+ this.#docId = docId;
+ this.#document = ownerDocument;
+ }
+ get #cache() {
+ return this.#_cache ||= new Map();
+ }
+ get #hcmCache() {
+ return this.#_hcmCache ||= 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;
+ }
+ #createTables(maps) {
+ 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;
+ }
+ const table = buffer.join(",");
+ return [table, table, table];
+ }
+ 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;
+ }
+ return [bufferR.join(","), bufferG.join(","), bufferB.join(",")];
+ }
+ #createUrl(id) {
+ if (this.#baseUrl === undefined) {
+ this.#baseUrl = "";
+ const url = this.#document.URL;
+ if (url !== this.#document.baseURI) {
+ if (isDataScheme(url)) {
+ warn('#createUrl: ignore "data:"-URL for performance reasons.');
+ } else {
+ this.#baseUrl = url.split("#", 1)[0];
+ }
+ }
+ }
+ return `url(${this.#baseUrl}#${id})`;
+ }
+ addFilter(maps) {
+ if (!maps) {
+ return "none";
+ }
+ let value = this.#cache.get(maps);
+ if (value) {
+ return value;
+ }
+ const [tableR, tableG, tableB] = this.#createTables(maps);
+ const key = maps.length === 1 ? tableR : `${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 = this.#createUrl(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}`;
+ const filterName = "base";
+ let info = this.#hcmCache.get(filterName);
+ if (info?.key === key) {
+ return info.url;
+ }
+ if (info) {
+ info.filter?.remove();
+ info.key = key;
+ info.url = "none";
+ info.filter = null;
+ } else {
+ info = {
+ key,
+ url: "none",
+ filter: null
+ };
+ this.#hcmCache.set(filterName, info);
+ }
+ if (!fgColor || !bgColor) {
+ return info.url;
+ }
+ const fgRGB = this.#getRGB(fgColor);
+ fgColor = Util.makeHexColor(...fgRGB);
+ const bgRGB = this.#getRGB(bgColor);
+ bgColor = Util.makeHexColor(...bgRGB);
+ this.#defs.style.color = "";
+ if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
+ return info.url;
+ }
+ 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 = info.filter = 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);
+ info.url = this.#createUrl(id);
+ return info.url;
+ }
+ addAlphaFilter(map) {
+ let value = this.#cache.get(map);
+ if (value) {
+ return value;
+ }
+ const [tableA] = this.#createTables([map]);
+ const key = `alpha_${tableA}`;
+ value = this.#cache.get(key);
+ if (value) {
+ this.#cache.set(map, value);
+ return value;
+ }
+ const id = `g_${this.#docId}_alpha_map_${this.#id++}`;
+ const url = this.#createUrl(id);
+ this.#cache.set(map, url);
+ this.#cache.set(key, url);
+ const filter = this.#createFilter(id);
+ this.#addTransferMapAlphaConversion(tableA, filter);
+ return url;
+ }
+ addLuminosityFilter(map) {
+ let value = this.#cache.get(map || "luminosity");
+ if (value) {
+ return value;
+ }
+ let tableA, key;
+ if (map) {
+ [tableA] = this.#createTables([map]);
+ key = `luminosity_${tableA}`;
+ } else {
+ key = "luminosity";
+ }
+ value = this.#cache.get(key);
+ if (value) {
+ this.#cache.set(map, value);
+ return value;
+ }
+ const id = `g_${this.#docId}_luminosity_map_${this.#id++}`;
+ const url = this.#createUrl(id);
+ this.#cache.set(map, url);
+ this.#cache.set(key, url);
+ const filter = this.#createFilter(id);
+ this.#addLuminosityConversion(filter);
+ if (map) {
+ this.#addTransferMapAlphaConversion(tableA, filter);
+ }
+ return url;
+ }
+ addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
+ const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;
+ let info = this.#hcmCache.get(filterName);
+ if (info?.key === key) {
+ return info.url;
+ }
+ if (info) {
+ info.filter?.remove();
+ info.key = key;
+ info.url = "none";
+ info.filter = null;
+ } else {
+ info = {
+ key,
+ url: "none",
+ filter: null
+ };
+ this.#hcmCache.set(filterName, info);
+ }
+ if (!fgColor || !bgColor) {
+ return info.url;
+ }
+ 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_${filterName}_filter`;
+ const filter = info.filter = 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);
+ info.url = this.#createUrl(id);
+ return info.url;
+ }
+ destroy(keepHCM = false) {
+ if (keepHCM && this.#_hcmCache?.size) {
+ return;
+ }
+ this.#_defs?.parentNode.parentNode.remove();
+ this.#_defs = null;
+ this.#_cache?.clear();
+ this.#_cache = null;
+ this.#_hcmCache?.clear();
+ this.#_hcmCache = null;
+ this.#id = 0;
+ }
+ #addLuminosityConversion(filter) {
+ const feColorMatrix = this.#document.createElementNS(SVG_NS, "feColorMatrix");
+ feColorMatrix.setAttribute("type", "matrix");
+ feColorMatrix.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0");
+ filter.append(feColorMatrix);
+ }
+ #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);
+ }
+ #addTransferMapAlphaConversion(aTable, filter) {
+ const feComponentTransfer = this.#document.createElementNS(SVG_NS, "feComponentTransfer");
+ filter.append(feComponentTransfer);
+ this.#appendFeFunc(feComponentTransfer, "feFuncA", aTable);
+ }
+ #getRGB(color) {
+ this.#defs.style.color = color;
+ return getRGB(getComputedStyle(this.#defs).getPropertyValue("color"));
+ }
+}
+
+;// ./src/display/standard_fontdata_factory.js
+
+
+class BaseStandardFontDataFactory {
+ constructor({
+ baseUrl = null
+ }) {
+ this.baseUrl = baseUrl;
+ }
+ async fetch({
+ filename
+ }) {
+ if (!this.baseUrl) {
+ throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");
+ }
+ if (!filename) {
+ throw new Error("Font filename must be specified.");
+ }
+ const url = `${this.baseUrl}${filename}`;
+ return this._fetch(url).catch(reason => {
+ throw new Error(`Unable to load font data at: ${url}`);
+ });
+ }
+ async _fetch(url) {
+ unreachable("Abstract method `_fetch` called.");
+ }
+}
+class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
+ async _fetch(url) {
+ const data = await fetchData(url, "arraybuffer");
+ return new Uint8Array(data);
+ }
+}
+
+;// ./src/display/node_utils.js
+
+
+
+
+
+async function node_utils_fetchData(url) {
+ const fs = process.getBuiltinModule("fs");
+ const data = await fs.promises.readFile(url);
+ return new Uint8Array(data);
+}
+class NodeFilterFactory extends BaseFilterFactory {}
+class NodeCanvasFactory extends BaseCanvasFactory {
+ _createCanvas(width, height) {
+ const require = process.getBuiltinModule("module").createRequire(import.meta.url);
+ const canvas = require("@napi-rs/canvas");
+ return canvas.createCanvas(width, height);
+ }
+}
+class NodeCMapReaderFactory extends BaseCMapReaderFactory {
+ async _fetch(url) {
+ return node_utils_fetchData(url);
+ }
+}
+class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
+ async _fetch(url) {
+ return node_utils_fetchData(url);
+ }
+}
+
+;// ./src/display/pattern_helper.js
+
+
+const PathType = {
+ FILL: "Fill",
+ STROKE: "Stroke",
+ SHADING: "Shading"
+};
+function applyBoundingBox(ctx, bbox) {
+ if (!bbox) {
+ return;
+ }
+ const width = bbox[2] - bbox[0];
+ const height = bbox[3] - bbox[1];
+ const region = new Path2D();
+ region.rect(bbox[0], bbox[1], width, height);
+ ctx.clip(region);
+}
+class BaseShadingPattern {
+ getPattern() {
+ unreachable("Abstract method `getPattern` called.");
+ }
+}
+class RadialAxialShadingPattern extends BaseShadingPattern {
+ constructor(IR) {
+ super();
+ this._type = IR[1];
+ this._bbox = IR[2];
+ this._colorStops = IR[3];
+ this._p0 = IR[4];
+ this._p1 = IR[5];
+ this._r0 = IR[6];
+ this._r1 = IR[7];
+ this.matrix = null;
+ }
+ _createGradient(ctx) {
+ let grad;
+ if (this._type === "axial") {
+ grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);
+ } else if (this._type === "radial") {
+ grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);
+ }
+ for (const colorStop of this._colorStops) {
+ grad.addColorStop(colorStop[0], colorStop[1]);
+ }
+ return grad;
+ }
+ getPattern(ctx, owner, inverse, pathType) {
+ let pattern;
+ if (pathType === PathType.STROKE || pathType === PathType.FILL) {
+ const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, getCurrentTransform(ctx)) || [0, 0, 0, 0];
+ const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
+ const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
+ const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height);
+ const tmpCtx = tmpCanvas.context;
+ tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
+ tmpCtx.beginPath();
+ tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
+ tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
+ inverse = Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
+ tmpCtx.transform(...owner.baseTransform);
+ if (this.matrix) {
+ tmpCtx.transform(...this.matrix);
+ }
+ applyBoundingBox(tmpCtx, this._bbox);
+ tmpCtx.fillStyle = this._createGradient(tmpCtx);
+ tmpCtx.fill();
+ pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
+ const domMatrix = new DOMMatrix(inverse);
+ pattern.setTransform(domMatrix);
+ } else {
+ applyBoundingBox(ctx, this._bbox);
+ pattern = this._createGradient(ctx);
+ }
+ return pattern;
+ }
+}
+function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
+ const coords = context.coords,
+ colors = context.colors;
+ const bytes = data.data,
+ rowSize = data.width * 4;
+ let tmp;
+ if (coords[p1 + 1] > coords[p2 + 1]) {
+ tmp = p1;
+ p1 = p2;
+ p2 = tmp;
+ tmp = c1;
+ c1 = c2;
+ c2 = tmp;
+ }
+ if (coords[p2 + 1] > coords[p3 + 1]) {
+ tmp = p2;
+ p2 = p3;
+ p3 = tmp;
+ tmp = c2;
+ c2 = c3;
+ c3 = tmp;
+ }
+ if (coords[p1 + 1] > coords[p2 + 1]) {
+ tmp = p1;
+ p1 = p2;
+ p2 = tmp;
+ tmp = c1;
+ c1 = c2;
+ c2 = tmp;
+ }
+ const x1 = (coords[p1] + context.offsetX) * context.scaleX;
+ const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
+ const x2 = (coords[p2] + context.offsetX) * context.scaleX;
+ const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
+ const x3 = (coords[p3] + context.offsetX) * context.scaleX;
+ const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
+ if (y1 >= y3) {
+ return;
+ }
+ const c1r = colors[c1],
+ c1g = colors[c1 + 1],
+ c1b = colors[c1 + 2];
+ const c2r = colors[c2],
+ c2g = colors[c2 + 1],
+ c2b = colors[c2 + 2];
+ const c3r = colors[c3],
+ c3g = colors[c3 + 1],
+ c3b = colors[c3 + 2];
+ const minY = Math.round(y1),
+ maxY = Math.round(y3);
+ let xa, car, cag, cab;
+ let xb, cbr, cbg, cbb;
+ for (let y = minY; y <= maxY; y++) {
+ if (y < 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;
+ cab = c1b - (c1b - c2b) * k;
+ } else {
+ let k;
+ if (y > y3) {
+ k = 1;
+ } else if (y2 === y3) {
+ k = 0;
+ } else {
+ k = (y2 - y) / (y2 - y3);
+ }
+ xa = x2 - (x2 - x3) * k;
+ car = c2r - (c2r - c3r) * k;
+ cag = c2g - (c2g - c3g) * k;
+ cab = c2b - (c2b - c3b) * k;
+ }
+ let k;
+ if (y < y1) {
+ k = 0;
+ } else if (y > y3) {
+ k = 1;
+ } else {
+ k = (y1 - y) / (y1 - y3);
+ }
+ xb = x1 - (x1 - x3) * k;
+ cbr = c1r - (c1r - c3r) * k;
+ cbg = c1g - (c1g - c3g) * k;
+ cbb = c1b - (c1b - c3b) * k;
+ const x1_ = Math.round(Math.min(xa, xb));
+ const x2_ = Math.round(Math.max(xa, xb));
+ let j = rowSize * y + x1_ * 4;
+ for (let x = x1_; x <= x2_; x++) {
+ k = (xa - x) / (xa - xb);
+ if (k < 0) {
+ k = 0;
+ } else if (k > 1) {
+ k = 1;
+ }
+ bytes[j++] = car - (car - cbr) * k | 0;
+ bytes[j++] = cag - (cag - cbg) * k | 0;
+ bytes[j++] = cab - (cab - cbb) * k | 0;
+ bytes[j++] = 255;
+ }
+ }
+}
+function drawFigure(data, figure, context) {
+ const ps = figure.coords;
+ const cs = figure.colors;
+ let i, ii;
+ switch (figure.type) {
+ case "lattice":
+ const verticesPerRow = figure.verticesPerRow;
+ const rows = Math.floor(ps.length / verticesPerRow) - 1;
+ const cols = verticesPerRow - 1;
+ for (i = 0; i < rows; i++) {
+ let q = i * verticesPerRow;
+ for (let j = 0; j < cols; j++, q++) {
+ drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
+ drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
+ }
+ }
+ break;
+ case "triangles":
+ for (i = 0, ii = ps.length; i < ii; i += 3) {
+ drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
+ }
+ break;
+ default:
+ throw new Error("illegal figure");
+ }
+}
+class MeshShadingPattern extends BaseShadingPattern {
+ constructor(IR) {
+ super();
+ this._coords = IR[2];
+ this._colors = IR[3];
+ this._figures = IR[4];
+ this._bounds = IR[5];
+ this._bbox = IR[7];
+ this._background = IR[8];
+ this.matrix = null;
+ }
+ _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {
+ const EXPECTED_SCALE = 1.1;
+ const MAX_PATTERN_SIZE = 3000;
+ const BORDER_SIZE = 2;
+ const offsetX = Math.floor(this._bounds[0]);
+ const offsetY = Math.floor(this._bounds[1]);
+ const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
+ const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
+ const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
+ const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
+ const scaleX = boundsWidth / width;
+ const scaleY = boundsHeight / height;
+ const context = {
+ coords: this._coords,
+ colors: this._colors,
+ offsetX: -offsetX,
+ offsetY: -offsetY,
+ scaleX: 1 / scaleX,
+ scaleY: 1 / scaleY
+ };
+ const paddedWidth = width + BORDER_SIZE * 2;
+ const paddedHeight = height + BORDER_SIZE * 2;
+ const tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight);
+ const tmpCtx = tmpCanvas.context;
+ const data = tmpCtx.createImageData(width, height);
+ if (backgroundColor) {
+ const bytes = data.data;
+ for (let i = 0, ii = bytes.length; i < ii; i += 4) {
+ bytes[i] = backgroundColor[0];
+ bytes[i + 1] = backgroundColor[1];
+ bytes[i + 2] = backgroundColor[2];
+ bytes[i + 3] = 255;
+ }
+ }
+ for (const figure of this._figures) {
+ drawFigure(data, figure, context);
+ }
+ tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
+ const canvas = tmpCanvas.canvas;
+ return {
+ canvas,
+ offsetX: offsetX - BORDER_SIZE * scaleX,
+ offsetY: offsetY - BORDER_SIZE * scaleY,
+ scaleX,
+ scaleY
+ };
+ }
+ getPattern(ctx, owner, inverse, pathType) {
+ applyBoundingBox(ctx, this._bbox);
+ let scale;
+ if (pathType === PathType.SHADING) {
+ scale = Util.singularValueDecompose2dScale(getCurrentTransform(ctx));
+ } else {
+ scale = Util.singularValueDecompose2dScale(owner.baseTransform);
+ if (this.matrix) {
+ const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
+ scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
+ }
+ }
+ const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);
+ if (pathType !== PathType.SHADING) {
+ ctx.setTransform(...owner.baseTransform);
+ if (this.matrix) {
+ ctx.transform(...this.matrix);
+ }
+ }
+ ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
+ ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
+ return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
+ }
+}
+class DummyShadingPattern extends BaseShadingPattern {
+ getPattern() {
+ return "hotpink";
+ }
+}
+function getShadingPattern(IR) {
+ switch (IR[0]) {
+ case "RadialAxial":
+ return new RadialAxialShadingPattern(IR);
+ case "Mesh":
+ return new MeshShadingPattern(IR);
+ case "Dummy":
+ return new DummyShadingPattern();
+ }
+ throw new Error(`Unknown IR type: ${IR[0]}`);
+}
+const PaintType = {
+ COLORED: 1,
+ UNCOLORED: 2
+};
+class TilingPattern {
+ static MAX_PATTERN_SIZE = 3000;
+ constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
+ this.operatorList = IR[2];
+ this.matrix = IR[3];
+ this.bbox = IR[4];
+ this.xstep = IR[5];
+ this.ystep = IR[6];
+ this.paintType = IR[7];
+ this.tilingType = IR[8];
+ this.color = color;
+ this.ctx = ctx;
+ this.canvasGraphicsFactory = canvasGraphicsFactory;
+ this.baseTransform = baseTransform;
+ }
+ createPatternCanvas(owner) {
+ const {
+ bbox,
+ operatorList,
+ paintType,
+ tilingType,
+ color,
+ canvasGraphicsFactory
+ } = this;
+ let {
+ xstep,
+ ystep
+ } = this;
+ xstep = Math.abs(xstep);
+ ystep = Math.abs(ystep);
+ info("TilingType: " + tilingType);
+ const x0 = bbox[0],
+ y0 = bbox[1],
+ x1 = bbox[2],
+ y1 = bbox[3];
+ const width = x1 - x0;
+ const height = y1 - y0;
+ const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
+ const curMatrixScale = Util.singularValueDecompose2dScale(this.baseTransform);
+ const combinedScaleX = matrixScale[0] * curMatrixScale[0];
+ const combinedScaleY = matrixScale[1] * curMatrixScale[1];
+ let canvasWidth = width,
+ canvasHeight = height,
+ redrawHorizontally = false,
+ redrawVertically = false;
+ const xScaledStep = Math.ceil(xstep * combinedScaleX);
+ const yScaledStep = Math.ceil(ystep * combinedScaleY);
+ const xScaledWidth = Math.ceil(width * combinedScaleX);
+ const yScaledHeight = Math.ceil(height * combinedScaleY);
+ if (xScaledStep >= xScaledWidth) {
+ canvasWidth = xstep;
+ } else {
+ redrawHorizontally = true;
+ }
+ if (yScaledStep >= yScaledHeight) {
+ canvasHeight = ystep;
+ } else {
+ redrawVertically = true;
+ }
+ const dimx = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
+ const dimy = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
+ const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size);
+ const tmpCtx = tmpCanvas.context;
+ const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
+ graphics.groupLevel = owner.groupLevel;
+ this.setFillAndStrokeStyleToContext(graphics, paintType, color);
+ tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);
+ graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
+ tmpCtx.save();
+ this.clipBbox(graphics, x0, y0, x1, y1);
+ graphics.baseTransform = getCurrentTransform(graphics.ctx);
+ graphics.executeOperatorList(operatorList);
+ graphics.endDrawing();
+ tmpCtx.restore();
+ if (redrawHorizontally || redrawVertically) {
+ const image = tmpCanvas.canvas;
+ if (redrawHorizontally) {
+ canvasWidth = xstep;
+ }
+ if (redrawVertically) {
+ canvasHeight = ystep;
+ }
+ const dimx2 = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
+ const dimy2 = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
+ const xSize = dimx2.size;
+ const ySize = dimy2.size;
+ const tmpCanvas2 = owner.cachedCanvases.getCanvas("pattern-workaround", xSize, ySize);
+ const tmpCtx2 = tmpCanvas2.context;
+ const ii = redrawHorizontally ? Math.floor(width / xstep) : 0;
+ const jj = redrawVertically ? Math.floor(height / ystep) : 0;
+ for (let i = 0; i <= ii; i++) {
+ for (let j = 0; j <= jj; j++) {
+ tmpCtx2.drawImage(image, xSize * i, ySize * j, xSize, ySize, 0, 0, xSize, ySize);
+ }
+ }
+ return {
+ canvas: tmpCanvas2.canvas,
+ scaleX: dimx2.scale,
+ scaleY: dimy2.scale,
+ offsetX: x0,
+ offsetY: y0
+ };
+ }
+ return {
+ canvas: tmpCanvas.canvas,
+ scaleX: dimx.scale,
+ scaleY: dimy.scale,
+ offsetX: x0,
+ offsetY: y0
+ };
+ }
+ getSizeAndScale(step, realOutputSize, scale) {
+ const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
+ let size = Math.ceil(step * scale);
+ if (size >= maxSize) {
+ size = maxSize;
+ } else {
+ scale = size / step;
+ }
+ return {
+ scale,
+ size
+ };
+ }
+ clipBbox(graphics, x0, y0, x1, y1) {
+ const bboxWidth = x1 - x0;
+ const bboxHeight = y1 - y0;
+ graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
+ graphics.current.updateRectMinMax(getCurrentTransform(graphics.ctx), [x0, y0, x1, y1]);
+ graphics.clip();
+ graphics.endPath();
+ }
+ setFillAndStrokeStyleToContext(graphics, paintType, color) {
+ const context = graphics.ctx,
+ current = graphics.current;
+ switch (paintType) {
+ case PaintType.COLORED:
+ const ctx = this.ctx;
+ context.fillStyle = ctx.fillStyle;
+ context.strokeStyle = ctx.strokeStyle;
+ current.fillColor = ctx.fillStyle;
+ current.strokeColor = ctx.strokeStyle;
+ break;
+ case PaintType.UNCOLORED:
+ const cssColor = Util.makeHexColor(color[0], color[1], color[2]);
+ context.fillStyle = cssColor;
+ context.strokeStyle = cssColor;
+ current.fillColor = cssColor;
+ current.strokeColor = cssColor;
+ break;
+ default:
+ throw new FormatError(`Unsupported paint type: ${paintType}`);
+ }
+ }
+ getPattern(ctx, owner, inverse, pathType) {
+ let matrix = inverse;
+ if (pathType !== PathType.SHADING) {
+ matrix = Util.transform(matrix, owner.baseTransform);
+ if (this.matrix) {
+ matrix = Util.transform(matrix, this.matrix);
+ }
+ }
+ const temporaryPatternCanvas = this.createPatternCanvas(owner);
+ let domMatrix = new DOMMatrix(matrix);
+ domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
+ domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
+ const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
+ pattern.setTransform(domMatrix);
+ return pattern;
+ }
+}
+
+;// ./src/shared/image_utils.js
+
+function convertToRGBA(params) {
+ switch (params.kind) {
+ case ImageKind.GRAYSCALE_1BPP:
+ return convertBlackAndWhiteToRGBA(params);
+ case ImageKind.RGB_24BPP:
+ return convertRGBToRGBA(params);
+ }
+ return null;
+}
+function convertBlackAndWhiteToRGBA({
+ src,
+ srcPos = 0,
+ dest,
+ width,
+ height,
+ nonBlackColor = 0xffffffff,
+ inverseDecode = false
+}) {
+ 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;
+ dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
+ dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
+ }
+ if (widthRemainder === 0) {
+ continue;
+ }
+ const elem = srcPos < srcLength ? src[srcPos++] : 255;
+ for (let j = 0; j < widthRemainder; j++) {
+ dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
+ }
+ }
+ return {
+ srcPos,
+ destPos
+ };
+}
+function convertRGBToRGBA({
+ src,
+ srcPos = 0,
+ dest,
+ destPos = 0,
+ width,
+ height
+}) {
+ let i = 0;
+ const len = width * height * 3;
+ const len32 = len >> 2;
+ const src32 = new Uint32Array(src.buffer, srcPos, len32);
+ if (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 = srcPos + len; 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 = srcPos + len; j < jj; j += 3) {
+ dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
+ }
+ }
+ return {
+ srcPos: srcPos + len,
+ destPos
+ };
+}
+function grayToRGBA(src, dest) {
+ if (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;
+ }
+ }
+}
+
+;// ./src/display/canvas.js
+
+
+
+
+const MIN_FONT_SIZE = 16;
+const MAX_FONT_SIZE = 100;
+const EXECUTION_TIME = 15;
+const EXECUTION_STEPS = 10;
+const MAX_SIZE_TO_COMPILE = 1000;
+const FULL_CHUNK_HEIGHT = 16;
+function mirrorContextOperations(ctx, destCtx) {
+ if (ctx._removeMirroring) {
+ throw new Error("Context is already forwarding operations.");
+ }
+ ctx.__originalSave = ctx.save;
+ ctx.__originalRestore = ctx.restore;
+ ctx.__originalRotate = ctx.rotate;
+ ctx.__originalScale = ctx.scale;
+ ctx.__originalTranslate = ctx.translate;
+ ctx.__originalTransform = ctx.transform;
+ ctx.__originalSetTransform = ctx.setTransform;
+ ctx.__originalResetTransform = ctx.resetTransform;
+ ctx.__originalClip = ctx.clip;
+ ctx.__originalMoveTo = ctx.moveTo;
+ ctx.__originalLineTo = ctx.lineTo;
+ ctx.__originalBezierCurveTo = ctx.bezierCurveTo;
+ ctx.__originalRect = ctx.rect;
+ ctx.__originalClosePath = ctx.closePath;
+ ctx.__originalBeginPath = ctx.beginPath;
+ ctx._removeMirroring = () => {
+ ctx.save = ctx.__originalSave;
+ ctx.restore = ctx.__originalRestore;
+ ctx.rotate = ctx.__originalRotate;
+ ctx.scale = ctx.__originalScale;
+ ctx.translate = ctx.__originalTranslate;
+ ctx.transform = ctx.__originalTransform;
+ ctx.setTransform = ctx.__originalSetTransform;
+ ctx.resetTransform = ctx.__originalResetTransform;
+ ctx.clip = ctx.__originalClip;
+ ctx.moveTo = ctx.__originalMoveTo;
+ ctx.lineTo = ctx.__originalLineTo;
+ ctx.bezierCurveTo = ctx.__originalBezierCurveTo;
+ ctx.rect = ctx.__originalRect;
+ ctx.closePath = ctx.__originalClosePath;
+ ctx.beginPath = ctx.__originalBeginPath;
+ delete ctx._removeMirroring;
+ };
+ ctx.save = function ctxSave() {
+ destCtx.save();
+ this.__originalSave();
+ };
+ ctx.restore = function ctxRestore() {
+ destCtx.restore();
+ this.__originalRestore();
+ };
+ ctx.translate = function ctxTranslate(x, y) {
+ destCtx.translate(x, y);
+ this.__originalTranslate(x, y);
+ };
+ ctx.scale = function ctxScale(x, y) {
+ destCtx.scale(x, y);
+ this.__originalScale(x, y);
+ };
+ ctx.transform = function ctxTransform(a, b, c, d, e, f) {
+ destCtx.transform(a, b, c, d, e, f);
+ this.__originalTransform(a, b, c, d, e, f);
+ };
+ ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
+ destCtx.setTransform(a, b, c, d, e, f);
+ this.__originalSetTransform(a, b, c, d, e, f);
+ };
+ ctx.resetTransform = function ctxResetTransform() {
+ destCtx.resetTransform();
+ this.__originalResetTransform();
+ };
+ ctx.rotate = function ctxRotate(angle) {
+ destCtx.rotate(angle);
+ this.__originalRotate(angle);
+ };
+ ctx.clip = function ctxRotate(rule) {
+ destCtx.clip(rule);
+ this.__originalClip(rule);
+ };
+ ctx.moveTo = function (x, y) {
+ destCtx.moveTo(x, y);
+ this.__originalMoveTo(x, y);
+ };
+ ctx.lineTo = function (x, y) {
+ destCtx.lineTo(x, y);
+ this.__originalLineTo(x, y);
+ };
+ ctx.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
+ destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+ this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+ };
+ ctx.rect = function (x, y, width, height) {
+ destCtx.rect(x, y, width, height);
+ this.__originalRect(x, y, width, height);
+ };
+ ctx.closePath = function () {
+ destCtx.closePath();
+ this.__originalClosePath();
+ };
+ ctx.beginPath = function () {
+ destCtx.beginPath();
+ this.__originalBeginPath();
+ };
+}
+class CachedCanvases {
+ constructor(canvasFactory) {
+ this.canvasFactory = canvasFactory;
+ this.cache = Object.create(null);
+ }
+ getCanvas(id, width, height) {
+ let canvasEntry;
+ if (this.cache[id] !== undefined) {
+ canvasEntry = this.cache[id];
+ this.canvasFactory.reset(canvasEntry, width, height);
+ } else {
+ canvasEntry = this.canvasFactory.create(width, height);
+ this.cache[id] = canvasEntry;
+ }
+ return canvasEntry;
+ }
+ delete(id) {
+ delete this.cache[id];
+ }
+ clear() {
+ for (const id in this.cache) {
+ const canvasEntry = this.cache[id];
+ this.canvasFactory.destroy(canvasEntry);
+ delete this.cache[id];
+ }
+ }
+}
+function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
+ const [a, b, c, d, tx, ty] = getCurrentTransform(ctx);
+ if (b === 0 && c === 0) {
+ const tlX = destX * a + tx;
+ const rTlX = Math.round(tlX);
+ const tlY = destY * d + ty;
+ const rTlY = Math.round(tlY);
+ const brX = (destX + destW) * a + tx;
+ const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
+ const brY = (destY + destH) * d + ty;
+ const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
+ ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
+ ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
+ ctx.setTransform(a, b, c, d, tx, ty);
+ return [rWidth, rHeight];
+ }
+ if (a === 0 && d === 0) {
+ const tlX = destY * c + tx;
+ const rTlX = Math.round(tlX);
+ const tlY = destX * b + ty;
+ const rTlY = Math.round(tlY);
+ const brX = (destY + destH) * c + tx;
+ const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
+ const brY = (destX + destW) * b + ty;
+ const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
+ ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, rTlX, rTlY);
+ ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rHeight, rWidth);
+ ctx.setTransform(a, b, c, d, tx, ty);
+ return [rHeight, rWidth];
+ }
+ ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
+ const scaleX = Math.hypot(a, b);
+ const scaleY = Math.hypot(c, d);
+ return [scaleX * destW, scaleY * destH];
+}
+function compileType3Glyph(imgData) {
+ const {
+ width,
+ height
+ } = imgData;
+ if (width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) {
+ return null;
+ }
+ const POINT_TO_PROCESS_LIMIT = 1000;
+ const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
+ const width1 = width + 1;
+ let points = new Uint8Array(width1 * (height + 1));
+ let i, j, j0;
+ const lineSize = width + 7 & ~7;
+ let data = new Uint8Array(lineSize * height),
+ pos = 0;
+ for (const elem of imgData.data) {
+ let mask = 128;
+ while (mask > 0) {
+ data[pos++] = elem & mask ? 0 : 255;
+ mask >>= 1;
+ }
+ }
+ let count = 0;
+ pos = 0;
+ if (data[pos] !== 0) {
+ points[0] = 1;
+ ++count;
+ }
+ for (j = 1; j < width; j++) {
+ if (data[pos] !== data[pos + 1]) {
+ points[j] = data[pos] ? 2 : 1;
+ ++count;
+ }
+ pos++;
+ }
+ if (data[pos] !== 0) {
+ points[j] = 2;
+ ++count;
+ }
+ for (i = 1; i < height; i++) {
+ pos = i * lineSize;
+ j0 = i * width1;
+ if (data[pos - lineSize] !== data[pos]) {
+ points[j0] = data[pos] ? 1 : 8;
+ ++count;
+ }
+ let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
+ for (j = 1; j < width; j++) {
+ sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
+ if (POINT_TYPES[sum]) {
+ points[j0 + j] = POINT_TYPES[sum];
+ ++count;
+ }
+ pos++;
+ }
+ if (data[pos - lineSize] !== data[pos]) {
+ points[j0 + j] = data[pos] ? 2 : 4;
+ ++count;
+ }
+ if (count > POINT_TO_PROCESS_LIMIT) {
+ return null;
+ }
+ }
+ pos = lineSize * (height - 1);
+ j0 = i * width1;
+ if (data[pos] !== 0) {
+ points[j0] = 8;
+ ++count;
+ }
+ for (j = 1; j < width; j++) {
+ if (data[pos] !== data[pos + 1]) {
+ points[j0 + j] = data[pos] ? 4 : 8;
+ ++count;
+ }
+ pos++;
+ }
+ if (data[pos] !== 0) {
+ points[j0 + j] = 4;
+ ++count;
+ }
+ if (count > POINT_TO_PROCESS_LIMIT) {
+ return null;
+ }
+ const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
+ const path = new Path2D();
+ for (i = 0; count && i <= height; i++) {
+ let p = i * width1;
+ const end = p + width;
+ while (p < end && !points[p]) {
+ p++;
+ }
+ if (p === end) {
+ continue;
+ }
+ path.moveTo(p % width1, i);
+ const p0 = p;
+ let type = points[p];
+ do {
+ const step = steps[type];
+ do {
+ p += step;
+ } while (!points[p]);
+ const pp = points[p];
+ if (pp !== 5 && pp !== 10) {
+ type = pp;
+ points[p] = 0;
+ } else {
+ type = pp & 0x33 * type >> 4;
+ points[p] &= type >> 2 | type << 2;
+ }
+ path.lineTo(p % width1, p / width1 | 0);
+ if (!points[p]) {
+ --count;
+ }
+ } while (p0 !== p);
+ --i;
+ }
+ data = null;
+ points = null;
+ const drawOutline = function (c) {
+ c.save();
+ c.scale(1 / width, -1 / height);
+ c.translate(0, -height);
+ c.fill(path);
+ c.beginPath();
+ c.restore();
+ };
+ return drawOutline;
+}
+class CanvasExtraState {
+ constructor(width, height) {
+ this.alphaIsShape = false;
+ this.fontSize = 0;
+ this.fontSizeScale = 1;
+ this.textMatrix = IDENTITY_MATRIX;
+ this.textMatrixScale = 1;
+ this.fontMatrix = FONT_IDENTITY_MATRIX;
+ this.leading = 0;
+ this.x = 0;
+ this.y = 0;
+ this.lineX = 0;
+ this.lineY = 0;
+ this.charSpacing = 0;
+ this.wordSpacing = 0;
+ this.textHScale = 1;
+ this.textRenderingMode = TextRenderingMode.FILL;
+ this.textRise = 0;
+ this.fillColor = "#000000";
+ this.strokeColor = "#000000";
+ this.patternFill = false;
+ this.patternStroke = false;
+ this.fillAlpha = 1;
+ this.strokeAlpha = 1;
+ this.lineWidth = 1;
+ this.activeSMask = null;
+ this.transferMaps = "none";
+ this.startNewPathAndClipBox([0, 0, width, height]);
+ }
+ clone() {
+ const clone = Object.create(this);
+ clone.clipBox = this.clipBox.slice();
+ return clone;
+ }
+ setCurrentPoint(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+ updatePathMinMax(transform, x, y) {
+ [x, y] = Util.applyTransform([x, y], transform);
+ this.minX = Math.min(this.minX, x);
+ this.minY = Math.min(this.minY, y);
+ this.maxX = Math.max(this.maxX, x);
+ this.maxY = Math.max(this.maxY, y);
+ }
+ updateRectMinMax(transform, rect) {
+ const p1 = Util.applyTransform(rect, transform);
+ const p2 = Util.applyTransform(rect.slice(2), transform);
+ const p3 = Util.applyTransform([rect[0], rect[3]], transform);
+ const p4 = Util.applyTransform([rect[2], rect[1]], transform);
+ this.minX = Math.min(this.minX, p1[0], p2[0], p3[0], p4[0]);
+ this.minY = Math.min(this.minY, p1[1], p2[1], p3[1], p4[1]);
+ this.maxX = Math.max(this.maxX, p1[0], p2[0], p3[0], p4[0]);
+ this.maxY = Math.max(this.maxY, p1[1], p2[1], p3[1], p4[1]);
+ }
+ updateScalingPathMinMax(transform, minMax) {
+ Util.scaleMinMax(transform, minMax);
+ this.minX = Math.min(this.minX, minMax[0]);
+ this.minY = Math.min(this.minY, minMax[1]);
+ this.maxX = Math.max(this.maxX, minMax[2]);
+ this.maxY = Math.max(this.maxY, minMax[3]);
+ }
+ updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
+ const box = Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax);
+ if (minMax) {
+ return;
+ }
+ this.updateRectMinMax(transform, box);
+ }
+ getPathBoundingBox(pathType = PathType.FILL, transform = null) {
+ const box = [this.minX, this.minY, this.maxX, this.maxY];
+ if (pathType === PathType.STROKE) {
+ if (!transform) {
+ unreachable("Stroke bounding box must include transform.");
+ }
+ const scale = Util.singularValueDecompose2dScale(transform);
+ const xStrokePad = scale[0] * this.lineWidth / 2;
+ const yStrokePad = scale[1] * this.lineWidth / 2;
+ box[0] -= xStrokePad;
+ box[1] -= yStrokePad;
+ box[2] += xStrokePad;
+ box[3] += yStrokePad;
+ }
+ return box;
+ }
+ updateClipFromPath() {
+ const intersect = Util.intersect(this.clipBox, this.getPathBoundingBox());
+ this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
+ }
+ isEmptyClip() {
+ return this.minX === Infinity;
+ }
+ startNewPathAndClipBox(box) {
+ this.clipBox = box;
+ this.minX = Infinity;
+ this.minY = Infinity;
+ this.maxX = 0;
+ this.maxY = 0;
+ }
+ getClippedPathBoundingBox(pathType = PathType.FILL, transform = null) {
+ return Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
+ }
+}
+function putBinaryImageData(ctx, imgData) {
+ if (imgData instanceof ImageData) {
+ ctx.putImageData(imgData, 0, 0);
+ return;
+ }
+ const height = imgData.height,
+ width = imgData.width;
+ const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
+ const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
+ const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
+ const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
+ let srcPos = 0,
+ destPos;
+ const src = imgData.data;
+ const dest = chunkImgData.data;
+ let i, j, thisChunkHeight, elemsInThisChunk;
+ 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;
+ 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;
+ for (j = 0; j < thisChunkHeight; j++) {
+ const srcDiff = srcLength - srcPos;
+ let k = 0;
+ const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
+ const kEndUnrolled = kEnd & ~7;
+ let mask = 0;
+ let srcByte = 0;
+ for (; k < kEndUnrolled; k += 8) {
+ srcByte = src[srcPos++];
+ dest32[destPos++] = srcByte & 128 ? white : black;
+ dest32[destPos++] = srcByte & 64 ? white : black;
+ dest32[destPos++] = srcByte & 32 ? white : black;
+ dest32[destPos++] = srcByte & 16 ? white : black;
+ dest32[destPos++] = srcByte & 8 ? white : black;
+ dest32[destPos++] = srcByte & 4 ? white : black;
+ dest32[destPos++] = srcByte & 2 ? white : black;
+ dest32[destPos++] = srcByte & 1 ? white : black;
+ }
+ for (; k < kEnd; k++) {
+ if (mask === 0) {
+ srcByte = src[srcPos++];
+ mask = 128;
+ }
+ dest32[destPos++] = srcByte & mask ? white : black;
+ mask >>= 1;
+ }
+ }
+ while (destPos < dest32DataLength) {
+ dest32[destPos++] = 0;
+ }
+ ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
+ }
+ } else if (imgData.kind === util_ImageKind.RGBA_32BPP) {
+ j = 0;
+ elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
+ for (i = 0; i < fullChunks; i++) {
+ dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
+ srcPos += elemsInThisChunk;
+ ctx.putImageData(chunkImgData, 0, j);
+ j += FULL_CHUNK_HEIGHT;
+ }
+ if (i < totalChunks) {
+ elemsInThisChunk = width * partialChunkHeight * 4;
+ dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
+ ctx.putImageData(chunkImgData, 0, j);
+ }
+ } else if (imgData.kind === util_ImageKind.RGB_24BPP) {
+ thisChunkHeight = FULL_CHUNK_HEIGHT;
+ elemsInThisChunk = width * thisChunkHeight;
+ for (i = 0; i < totalChunks; i++) {
+ if (i >= fullChunks) {
+ thisChunkHeight = partialChunkHeight;
+ elemsInThisChunk = width * thisChunkHeight;
+ }
+ destPos = 0;
+ for (j = elemsInThisChunk; j--;) {
+ dest[destPos++] = src[srcPos++];
+ dest[destPos++] = src[srcPos++];
+ dest[destPos++] = src[srcPos++];
+ dest[destPos++] = 255;
+ }
+ ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
+ }
+ } else {
+ throw new Error(`bad image kind: ${imgData.kind}`);
+ }
+}
+function putBinaryImageMask(ctx, imgData) {
+ if (imgData.bitmap) {
+ ctx.drawImage(imgData.bitmap, 0, 0);
+ return;
+ }
+ const height = imgData.height,
+ width = imgData.width;
+ const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
+ const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
+ const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
+ const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
+ let srcPos = 0;
+ const src = imgData.data;
+ const dest = chunkImgData.data;
+ for (let i = 0; i < totalChunks; i++) {
+ const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
+ ({
+ srcPos
+ } = convertBlackAndWhiteToRGBA({
+ src,
+ srcPos,
+ dest,
+ width,
+ 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", "filter"];
+ for (const property of properties) {
+ if (sourceCtx[property] !== undefined) {
+ destCtx[property] = sourceCtx[property];
+ }
+ }
+ if (sourceCtx.setLineDash !== undefined) {
+ destCtx.setLineDash(sourceCtx.getLineDash());
+ destCtx.lineDashOffset = sourceCtx.lineDashOffset;
+ }
+}
+function resetCtxToDefault(ctx) {
+ ctx.strokeStyle = ctx.fillStyle = "#000000";
+ ctx.fillRule = "nonzero";
+ ctx.globalAlpha = 1;
+ ctx.lineWidth = 1;
+ ctx.lineCap = "butt";
+ ctx.lineJoin = "miter";
+ ctx.miterLimit = 10;
+ ctx.globalCompositeOperation = "source-over";
+ ctx.font = "10px sans-serif";
+ if (ctx.setLineDash !== undefined) {
+ ctx.setLineDash([]);
+ ctx.lineDashOffset = 0;
+ }
+ if (!isNodeJS) {
+ const {
+ filter
+ } = ctx;
+ if (filter !== "none" && filter !== "") {
+ ctx.filter = "none";
+ }
+ }
+}
+function getImageSmoothingEnabled(transform, interpolate) {
+ if (interpolate) {
+ return true;
+ }
+ const scale = Util.singularValueDecompose2dScale(transform);
+ scale[0] = Math.fround(scale[0]);
+ scale[1] = Math.fround(scale[1]);
+ const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * PixelsPerInch.PDF_TO_CSS_UNITS);
+ return scale[0] <= actualScale && scale[1] <= actualScale;
+}
+const LINE_CAP_STYLES = ["butt", "round", "square"];
+const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
+const NORMAL_CLIP = {};
+const EO_CLIP = {};
+class CanvasGraphics {
+ constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
+ optionalContentConfig,
+ markedContentStack = null
+ }, annotationCanvasMap, pageColors) {
+ this.ctx = canvasCtx;
+ this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
+ this.stateStack = [];
+ this.pendingClip = null;
+ this.pendingEOFill = false;
+ this.res = null;
+ this.xobjs = null;
+ this.commonObjs = commonObjs;
+ this.objs = objs;
+ this.canvasFactory = canvasFactory;
+ this.filterFactory = filterFactory;
+ this.groupStack = [];
+ this.processingType3 = null;
+ this.baseTransform = null;
+ this.baseTransformStack = [];
+ this.groupLevel = 0;
+ this.smaskStack = [];
+ this.smaskCounter = 0;
+ this.tempSMask = null;
+ this.suspendedCtx = null;
+ this.contentVisible = true;
+ this.markedContentStack = markedContentStack || [];
+ this.optionalContentConfig = optionalContentConfig;
+ this.cachedCanvases = new CachedCanvases(this.canvasFactory);
+ this.cachedPatterns = new Map();
+ this.annotationCanvasMap = annotationCanvasMap;
+ this.viewportScale = 1;
+ this.outputScaleX = 1;
+ this.outputScaleY = 1;
+ this.pageColors = pageColors;
+ this._cachedScaleForStroking = [-1, 0];
+ this._cachedGetSinglePixelWidth = null;
+ this._cachedBitmapsMap = new Map();
+ }
+ getObject(data, fallback = null) {
+ if (typeof data === "string") {
+ return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
+ }
+ return fallback;
+ }
+ beginDrawing({
+ transform,
+ viewport,
+ transparency = false,
+ background = null
+ }) {
+ const width = this.ctx.canvas.width;
+ const height = this.ctx.canvas.height;
+ const savedFillStyle = this.ctx.fillStyle;
+ this.ctx.fillStyle = background || "#ffffff";
+ this.ctx.fillRect(0, 0, width, height);
+ this.ctx.fillStyle = savedFillStyle;
+ if (transparency) {
+ const transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height);
+ this.compositeCtx = this.ctx;
+ this.transparentCanvas = transparentCanvas.canvas;
+ this.ctx = transparentCanvas.context;
+ this.ctx.save();
+ this.ctx.transform(...getCurrentTransform(this.compositeCtx));
+ }
+ this.ctx.save();
+ resetCtxToDefault(this.ctx);
+ if (transform) {
+ this.ctx.transform(...transform);
+ this.outputScaleX = transform[0];
+ this.outputScaleY = transform[0];
+ }
+ this.ctx.transform(...viewport.transform);
+ this.viewportScale = viewport.scale;
+ this.baseTransform = getCurrentTransform(this.ctx);
+ }
+ executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
+ const argsArray = operatorList.argsArray;
+ const fnArray = operatorList.fnArray;
+ let i = executionStartIdx || 0;
+ const argsArrayLen = argsArray.length;
+ if (argsArrayLen === i) {
+ return i;
+ }
+ const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
+ const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
+ let steps = 0;
+ const commonObjs = this.commonObjs;
+ const objs = this.objs;
+ let fnId;
+ while (true) {
+ if (stepper !== undefined && i === stepper.nextBreakPoint) {
+ stepper.breakIt(i, continueCallback);
+ return i;
+ }
+ fnId = fnArray[i];
+ if (fnId !== OPS.dependency) {
+ this[fnId].apply(this, argsArray[i]);
+ } else {
+ for (const depObjId of argsArray[i]) {
+ const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
+ if (!objsPool.has(depObjId)) {
+ objsPool.get(depObjId, continueCallback);
+ return i;
+ }
+ }
+ }
+ i++;
+ if (i === argsArrayLen) {
+ return i;
+ }
+ if (chunkOperations && ++steps > EXECUTION_STEPS) {
+ if (Date.now() > endTime) {
+ continueCallback();
+ return i;
+ }
+ steps = 0;
+ }
+ }
+ }
+ #restoreInitialState() {
+ while (this.stateStack.length || this.inSMaskMode) {
+ this.restore();
+ }
+ this.current.activeSMask = null;
+ this.ctx.restore();
+ if (this.transparentCanvas) {
+ this.ctx = this.compositeCtx;
+ this.ctx.save();
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
+ this.ctx.drawImage(this.transparentCanvas, 0, 0);
+ this.ctx.restore();
+ this.transparentCanvas = null;
+ }
+ }
+ endDrawing() {
+ this.#restoreInitialState();
+ this.cachedCanvases.clear();
+ this.cachedPatterns.clear();
+ for (const cache of this._cachedBitmapsMap.values()) {
+ for (const canvas of cache.values()) {
+ if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
+ canvas.width = canvas.height = 0;
+ }
+ }
+ 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 ?? img.displayWidth;
+ const height = img.height ?? img.displayHeight;
+ let widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
+ let heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
+ let paintWidth = width,
+ paintHeight = height;
+ let tmpCanvasId = "prescale1";
+ let tmpCanvas, tmpCtx;
+ while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
+ let newWidth = paintWidth,
+ newHeight = paintHeight;
+ if (widthScale > 2 && paintWidth > 1) {
+ newWidth = paintWidth >= 16384 ? Math.floor(paintWidth / 2) - 1 || 1 : Math.ceil(paintWidth / 2);
+ widthScale /= paintWidth / newWidth;
+ }
+ if (heightScale > 2 && paintHeight > 1) {
+ newHeight = paintHeight >= 16384 ? Math.floor(paintHeight / 2) - 1 || 1 : Math.ceil(paintHeight) / 2;
+ heightScale /= paintHeight / newHeight;
+ }
+ tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
+ tmpCtx = tmpCanvas.context;
+ tmpCtx.clearRect(0, 0, newWidth, newHeight);
+ tmpCtx.drawImage(img, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
+ img = tmpCanvas.canvas;
+ paintWidth = newWidth;
+ paintHeight = newHeight;
+ tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
+ }
+ return {
+ img,
+ paintWidth,
+ paintHeight
+ };
+ }
+ _createMaskCanvas(img) {
+ const ctx = this.ctx;
+ const {
+ width,
+ height
+ } = img;
+ const fillColor = this.current.fillColor;
+ const isPatternFill = this.current.patternFill;
+ const currentTransform = getCurrentTransform(ctx);
+ let cache, cacheKey, scaled, maskCanvas;
+ if ((img.bitmap || img.data) && img.count > 1) {
+ const mainKey = img.bitmap || img.data.buffer;
+ cacheKey = JSON.stringify(isPatternFill ? currentTransform : [currentTransform.slice(0, 4), fillColor]);
+ cache = this._cachedBitmapsMap.get(mainKey);
+ if (!cache) {
+ cache = new Map();
+ this._cachedBitmapsMap.set(mainKey, cache);
+ }
+ const cachedImage = cache.get(cacheKey);
+ if (cachedImage && !isPatternFill) {
+ const offsetX = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
+ const offsetY = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
+ return {
+ canvas: cachedImage,
+ offsetX,
+ offsetY
+ };
+ }
+ scaled = cachedImage;
+ }
+ if (!scaled) {
+ maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
+ putBinaryImageMask(maskCanvas.context, img);
+ }
+ let maskToCanvas = Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
+ maskToCanvas = Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
+ const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox([0, 0, width, height], maskToCanvas);
+ const drawnWidth = Math.round(maxX - minX) || 1;
+ const drawnHeight = Math.round(maxY - minY) || 1;
+ const fillCanvas = this.cachedCanvases.getCanvas("fillCanvas", drawnWidth, drawnHeight);
+ const fillCtx = fillCanvas.context;
+ const offsetX = minX;
+ const offsetY = minY;
+ fillCtx.translate(-offsetX, -offsetY);
+ fillCtx.transform(...maskToCanvas);
+ if (!scaled) {
+ scaled = this._scaleImage(maskCanvas.canvas, getCurrentTransformInverse(fillCtx));
+ scaled = scaled.img;
+ if (cache && isPatternFill) {
+ cache.set(cacheKey, scaled);
+ }
+ }
+ fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(fillCtx), img.interpolate);
+ drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
+ fillCtx.globalCompositeOperation = "source-in";
+ const inverse = Util.transform(getCurrentTransformInverse(fillCtx), [1, 0, 0, 1, -offsetX, -offsetY]);
+ fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, PathType.FILL) : fillColor;
+ fillCtx.fillRect(0, 0, width, height);
+ if (cache && !isPatternFill) {
+ this.cachedCanvases.delete("fillCanvas");
+ cache.set(cacheKey, fillCanvas.canvas);
+ }
+ return {
+ canvas: fillCanvas.canvas,
+ offsetX: Math.round(offsetX),
+ offsetY: Math.round(offsetY)
+ };
+ }
+ setLineWidth(width) {
+ if (width !== this.current.lineWidth) {
+ this._cachedScaleForStroking[0] = -1;
+ }
+ this.current.lineWidth = width;
+ this.ctx.lineWidth = width;
+ }
+ setLineCap(style) {
+ this.ctx.lineCap = LINE_CAP_STYLES[style];
+ }
+ setLineJoin(style) {
+ this.ctx.lineJoin = LINE_JOIN_STYLES[style];
+ }
+ setMiterLimit(limit) {
+ this.ctx.miterLimit = limit;
+ }
+ setDash(dashArray, dashPhase) {
+ const ctx = this.ctx;
+ if (ctx.setLineDash !== undefined) {
+ ctx.setLineDash(dashArray);
+ ctx.lineDashOffset = dashPhase;
+ }
+ }
+ 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[0], value[1]);
+ break;
+ case "CA":
+ this.current.strokeAlpha = value;
+ break;
+ case "ca":
+ this.current.fillAlpha = value;
+ this.ctx.globalAlpha = value;
+ break;
+ case "BM":
+ this.ctx.globalCompositeOperation = value;
+ break;
+ case "SMask":
+ this.current.activeSMask = value ? this.tempSMask : null;
+ this.tempSMask = null;
+ this.checkSMaskState();
+ break;
+ case "TR":
+ this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
+ break;
+ }
+ }
+ }
+ get inSMaskMode() {
+ return !!this.suspendedCtx;
+ }
+ checkSMaskState() {
+ const inSMaskMode = this.inSMaskMode;
+ if (this.current.activeSMask && !inSMaskMode) {
+ this.beginSMaskMode();
+ } else if (!this.current.activeSMask && inSMaskMode) {
+ this.endSMaskMode();
+ }
+ }
+ beginSMaskMode() {
+ if (this.inSMaskMode) {
+ throw new Error("beginSMaskMode called while already in smask mode");
+ }
+ const drawnWidth = this.ctx.canvas.width;
+ const drawnHeight = this.ctx.canvas.height;
+ const cacheId = "smaskGroupAt" + this.groupLevel;
+ const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
+ this.suspendedCtx = this.ctx;
+ this.ctx = scratchCanvas.context;
+ const ctx = this.ctx;
+ ctx.setTransform(...getCurrentTransform(this.suspendedCtx));
+ copyCtxState(this.suspendedCtx, ctx);
+ mirrorContextOperations(ctx, this.suspendedCtx);
+ this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
+ }
+ endSMaskMode() {
+ if (!this.inSMaskMode) {
+ throw new Error("endSMaskMode called while not in smask mode");
+ }
+ this.ctx._removeMirroring();
+ copyCtxState(this.ctx, this.suspendedCtx);
+ this.ctx = this.suspendedCtx;
+ this.suspendedCtx = null;
+ }
+ compose(dirtyBox) {
+ if (!this.current.activeSMask) {
+ return;
+ }
+ if (!dirtyBox) {
+ dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
+ } else {
+ dirtyBox[0] = Math.floor(dirtyBox[0]);
+ dirtyBox[1] = Math.floor(dirtyBox[1]);
+ dirtyBox[2] = Math.ceil(dirtyBox[2]);
+ dirtyBox[3] = Math.ceil(dirtyBox[3]);
+ }
+ const smask = this.current.activeSMask;
+ const suspendedCtx = this.suspendedCtx;
+ this.composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);
+ this.ctx.save();
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
+ this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
+ this.ctx.restore();
+ }
+ composeSMask(ctx, smask, layerCtx, layerBox) {
+ const layerOffsetX = layerBox[0];
+ const layerOffsetY = layerBox[1];
+ const layerWidth = layerBox[2] - layerOffsetX;
+ const layerHeight = layerBox[3] - layerOffsetY;
+ if (layerWidth === 0 || layerHeight === 0) {
+ return;
+ }
+ this.genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);
+ ctx.save();
+ ctx.globalAlpha = 1;
+ ctx.globalCompositeOperation = "source-over";
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.drawImage(layerCtx.canvas, 0, 0);
+ ctx.restore();
+ }
+ genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, layerOffsetY, maskOffsetX, maskOffsetY) {
+ let maskCanvas = maskCtx.canvas;
+ let maskX = layerOffsetX - maskOffsetX;
+ let maskY = layerOffsetY - maskOffsetY;
+ if (backdrop) {
+ const backdropRGB = Util.makeHexColor(...backdrop);
+ if (maskX < 0 || maskY < 0 || maskX + width > maskCanvas.width || maskY + height > maskCanvas.height) {
+ const canvas = this.cachedCanvases.getCanvas("maskExtension", width, height);
+ const ctx = canvas.context;
+ ctx.drawImage(maskCanvas, -maskX, -maskY);
+ ctx.globalCompositeOperation = "destination-atop";
+ ctx.fillStyle = backdropRGB;
+ ctx.fillRect(0, 0, width, height);
+ ctx.globalCompositeOperation = "source-over";
+ maskCanvas = canvas.canvas;
+ maskX = maskY = 0;
+ } else {
+ maskCtx.save();
+ maskCtx.globalAlpha = 1;
+ maskCtx.setTransform(1, 0, 0, 1, 0, 0);
+ const clip = new Path2D();
+ clip.rect(maskX, maskY, width, height);
+ maskCtx.clip(clip);
+ maskCtx.globalCompositeOperation = "destination-atop";
+ maskCtx.fillStyle = backdropRGB;
+ maskCtx.fillRect(maskX, maskY, width, height);
+ maskCtx.restore();
+ }
+ }
+ layerCtx.save();
+ layerCtx.globalAlpha = 1;
+ layerCtx.setTransform(1, 0, 0, 1, 0, 0);
+ if (subtype === "Alpha" && transferMap) {
+ layerCtx.filter = this.filterFactory.addAlphaFilter(transferMap);
+ } else if (subtype === "Luminosity") {
+ layerCtx.filter = this.filterFactory.addLuminosityFilter(transferMap);
+ }
+ const clip = new Path2D();
+ clip.rect(layerOffsetX, layerOffsetY, width, height);
+ layerCtx.clip(clip);
+ layerCtx.globalCompositeOperation = "destination-in";
+ layerCtx.drawImage(maskCanvas, maskX, maskY, width, height, layerOffsetX, layerOffsetY, width, height);
+ layerCtx.restore();
+ }
+ save() {
+ if (this.inSMaskMode) {
+ copyCtxState(this.ctx, this.suspendedCtx);
+ this.suspendedCtx.save();
+ } else {
+ this.ctx.save();
+ }
+ const old = this.current;
+ this.stateStack.push(old);
+ this.current = old.clone();
+ }
+ restore() {
+ if (this.stateStack.length === 0 && this.inSMaskMode) {
+ this.endSMaskMode();
+ }
+ if (this.stateStack.length !== 0) {
+ this.current = this.stateStack.pop();
+ if (this.inSMaskMode) {
+ this.suspendedCtx.restore();
+ copyCtxState(this.suspendedCtx, this.ctx);
+ } else {
+ this.ctx.restore();
+ }
+ this.checkSMaskState();
+ this.pendingClip = 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[0] = -1;
+ this._cachedGetSinglePixelWidth = null;
+ }
+ constructPath(ops, args, minMax) {
+ const ctx = this.ctx;
+ const current = this.current;
+ let x = current.x,
+ y = current.y;
+ let startX, startY;
+ const currentTransform = getCurrentTransform(ctx);
+ const isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
+ const minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
+ for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
+ switch (ops[i] | 0) {
+ case OPS.rectangle:
+ x = args[j++];
+ y = args[j++];
+ const width = args[j++];
+ const height = args[j++];
+ const xw = x + width;
+ const yh = y + height;
+ ctx.moveTo(x, y);
+ if (width === 0 || height === 0) {
+ ctx.lineTo(xw, yh);
+ } else {
+ ctx.lineTo(xw, y);
+ ctx.lineTo(xw, yh);
+ ctx.lineTo(x, yh);
+ }
+ if (!isScalingMatrix) {
+ current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
+ }
+ ctx.closePath();
+ break;
+ case OPS.moveTo:
+ x = args[j++];
+ y = args[j++];
+ ctx.moveTo(x, y);
+ if (!isScalingMatrix) {
+ current.updatePathMinMax(currentTransform, x, y);
+ }
+ break;
+ case OPS.lineTo:
+ x = args[j++];
+ y = args[j++];
+ ctx.lineTo(x, y);
+ if (!isScalingMatrix) {
+ current.updatePathMinMax(currentTransform, x, y);
+ }
+ break;
+ case OPS.curveTo:
+ startX = x;
+ startY = y;
+ x = args[j + 4];
+ y = args[j + 5];
+ ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
+ current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], args[j + 2], args[j + 3], x, y, minMaxForBezier);
+ j += 6;
+ break;
+ case OPS.curveTo2:
+ startX = x;
+ startY = y;
+ ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
+ current.updateCurvePathMinMax(currentTransform, startX, startY, x, y, args[j], args[j + 1], args[j + 2], args[j + 3], minMaxForBezier);
+ x = args[j + 2];
+ y = args[j + 3];
+ j += 4;
+ break;
+ case OPS.curveTo3:
+ startX = x;
+ startY = y;
+ x = args[j + 2];
+ y = args[j + 3];
+ ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
+ current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], x, y, x, y, minMaxForBezier);
+ j += 4;
+ break;
+ case OPS.closePath:
+ ctx.closePath();
+ break;
+ }
+ }
+ if (isScalingMatrix) {
+ current.updateScalingPathMinMax(currentTransform, minMaxForBezier);
+ }
+ current.setCurrentPoint(x, y);
+ }
+ closePath() {
+ this.ctx.closePath();
+ }
+ stroke(consumePath = true) {
+ const ctx = this.ctx;
+ const strokeColor = this.current.strokeColor;
+ ctx.globalAlpha = this.current.strokeAlpha;
+ if (this.contentVisible) {
+ if (typeof strokeColor === "object" && strokeColor?.getPattern) {
+ ctx.save();
+ ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE);
+ this.rescaleAndStroke(false);
+ ctx.restore();
+ } else {
+ this.rescaleAndStroke(true);
+ }
+ }
+ if (consumePath) {
+ this.consumePath(this.current.getClippedPathBoundingBox());
+ }
+ ctx.globalAlpha = this.current.fillAlpha;
+ }
+ closeStroke() {
+ this.closePath();
+ this.stroke();
+ }
+ fill(consumePath = true) {
+ const ctx = this.ctx;
+ const fillColor = this.current.fillColor;
+ const isPatternFill = this.current.patternFill;
+ let needRestore = false;
+ if (isPatternFill) {
+ ctx.save();
+ ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
+ needRestore = true;
+ }
+ const intersect = this.current.getClippedPathBoundingBox();
+ if (this.contentVisible && intersect !== null) {
+ if (this.pendingEOFill) {
+ ctx.fill("evenodd");
+ this.pendingEOFill = false;
+ } else {
+ ctx.fill();
+ }
+ }
+ if (needRestore) {
+ ctx.restore();
+ }
+ if (consumePath) {
+ this.consumePath(intersect);
+ }
+ }
+ eoFill() {
+ this.pendingEOFill = true;
+ this.fill();
+ }
+ fillStroke() {
+ this.fill(false);
+ this.stroke(false);
+ this.consumePath();
+ }
+ eoFillStroke() {
+ this.pendingEOFill = true;
+ this.fillStroke();
+ }
+ closeFillStroke() {
+ this.closePath();
+ this.fillStroke();
+ }
+ closeEOFillStroke() {
+ this.pendingEOFill = true;
+ this.closePath();
+ this.fillStroke();
+ }
+ endPath() {
+ this.consumePath();
+ }
+ clip() {
+ this.pendingClip = NORMAL_CLIP;
+ }
+ eoClip() {
+ this.pendingClip = EO_CLIP;
+ }
+ beginText() {
+ this.current.textMatrix = IDENTITY_MATRIX;
+ this.current.textMatrixScale = 1;
+ this.current.x = this.current.lineX = 0;
+ this.current.y = this.current.lineY = 0;
+ }
+ endText() {
+ const paths = this.pendingTextPaths;
+ const ctx = this.ctx;
+ if (paths === undefined) {
+ ctx.beginPath();
+ return;
+ }
+ ctx.save();
+ ctx.beginPath();
+ for (const path of paths) {
+ ctx.setTransform(...path.transform);
+ ctx.translate(path.x, path.y);
+ path.addToPath(ctx, path.fontSize);
+ }
+ ctx.restore();
+ ctx.clip();
+ ctx.beginPath();
+ delete this.pendingTextPaths;
+ }
+ setCharSpacing(spacing) {
+ this.current.charSpacing = spacing;
+ }
+ setWordSpacing(spacing) {
+ this.current.wordSpacing = spacing;
+ }
+ setHScale(scale) {
+ this.current.textHScale = scale / 100;
+ }
+ setLeading(leading) {
+ this.current.leading = -leading;
+ }
+ setFont(fontRefName, size) {
+ const fontObj = this.commonObjs.get(fontRefName);
+ const current = this.current;
+ if (!fontObj) {
+ throw new Error(`Can't find font for ${fontRefName}`);
+ }
+ current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
+ if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
+ warn("Invalid font matrix for font " + fontRefName);
+ }
+ if (size < 0) {
+ size = -size;
+ current.fontDirection = -1;
+ } else {
+ current.fontDirection = 1;
+ }
+ this.current.font = fontObj;
+ this.current.fontSize = size;
+ if (fontObj.isType3Font) {
+ return;
+ }
+ const name = fontObj.loadedName || "sans-serif";
+ const typeface = fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
+ let bold = "normal";
+ if (fontObj.black) {
+ bold = "900";
+ } else if (fontObj.bold) {
+ bold = "bold";
+ }
+ const italic = fontObj.italic ? "italic" : "normal";
+ let browserFontSize = size;
+ if (size < MIN_FONT_SIZE) {
+ browserFontSize = MIN_FONT_SIZE;
+ } else if (size > MAX_FONT_SIZE) {
+ browserFontSize = MAX_FONT_SIZE;
+ }
+ this.current.fontSizeScale = size / browserFontSize;
+ this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
+ }
+ setTextRenderingMode(mode) {
+ this.current.textRenderingMode = mode;
+ }
+ setTextRise(rise) {
+ this.current.textRise = rise;
+ }
+ moveText(x, y) {
+ this.current.x = this.current.lineX += x;
+ this.current.y = this.current.lineY += y;
+ }
+ setLeadingMoveText(x, y) {
+ this.setLeading(-y);
+ this.moveText(x, y);
+ }
+ setTextMatrix(a, b, c, d, e, f) {
+ this.current.textMatrix = [a, b, c, d, e, f];
+ this.current.textMatrixScale = Math.hypot(a, b);
+ this.current.x = this.current.lineX = 0;
+ this.current.y = this.current.lineY = 0;
+ }
+ nextLine() {
+ this.moveText(0, this.current.leading);
+ }
+ paintChar(character, x, y, patternFillTransform, patternStrokeTransform) {
+ const ctx = this.ctx;
+ const current = this.current;
+ const font = current.font;
+ const textRenderingMode = current.textRenderingMode;
+ const fontSize = current.fontSize / current.fontSizeScale;
+ const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
+ const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
+ const patternFill = current.patternFill && !font.missingFile;
+ const patternStroke = current.patternStroke && !font.missingFile;
+ let addToPath;
+ if (font.disableFontFace || isAddToPathSet || patternFill || patternStroke) {
+ addToPath = font.getPathGenerator(this.commonObjs, character);
+ }
+ if (font.disableFontFace || patternFill || patternStroke) {
+ ctx.save();
+ ctx.translate(x, y);
+ ctx.beginPath();
+ addToPath(ctx, fontSize);
+ if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
+ if (patternFillTransform) {
+ ctx.setTransform(...patternFillTransform);
+ }
+ ctx.fill();
+ }
+ if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
+ if (patternStrokeTransform) {
+ ctx.setTransform(...patternStrokeTransform);
+ }
+ ctx.stroke();
+ }
+ ctx.restore();
+ } else {
+ if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
+ ctx.fillText(character, x, y);
+ }
+ if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
+ ctx.strokeText(character, x, y);
+ }
+ }
+ if (isAddToPathSet) {
+ const paths = this.pendingTextPaths ||= [];
+ paths.push({
+ transform: getCurrentTransform(ctx),
+ x,
+ y,
+ fontSize,
+ addToPath
+ });
+ }
+ }
+ get isFontSubpixelAAEnabled() {
+ const {
+ context: ctx
+ } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
+ ctx.scale(1.5, 1);
+ ctx.fillText("I", 0, 10);
+ const data = ctx.getImageData(0, 0, 10, 10).data;
+ let enabled = false;
+ for (let i = 3; i < data.length; i += 4) {
+ if (data[i] > 0 && data[i] < 255) {
+ enabled = true;
+ break;
+ }
+ }
+ return shadow(this, "isFontSubpixelAAEnabled", enabled);
+ }
+ showText(glyphs) {
+ const current = this.current;
+ const font = current.font;
+ if (font.isType3Font) {
+ return this.showType3Text(glyphs);
+ }
+ const fontSize = current.fontSize;
+ if (fontSize === 0) {
+ return undefined;
+ }
+ const ctx = this.ctx;
+ const fontSizeScale = current.fontSizeScale;
+ const charSpacing = current.charSpacing;
+ const wordSpacing = current.wordSpacing;
+ const fontDirection = current.fontDirection;
+ const textHScale = current.textHScale * fontDirection;
+ const glyphsLength = glyphs.length;
+ const vertical = font.vertical;
+ const spacingDir = vertical ? 1 : -1;
+ const defaultVMetrics = font.defaultVMetrics;
+ const widthAdvanceScale = fontSize * current.fontMatrix[0];
+ const simpleFillText = current.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
+ ctx.save();
+ ctx.transform(...current.textMatrix);
+ ctx.translate(current.x, current.y + current.textRise);
+ if (fontDirection > 0) {
+ ctx.scale(textHScale, -1);
+ } else {
+ ctx.scale(textHScale, 1);
+ }
+ let patternFillTransform, patternStrokeTransform;
+ if (current.patternFill) {
+ ctx.save();
+ const pattern = current.fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
+ patternFillTransform = getCurrentTransform(ctx);
+ ctx.restore();
+ ctx.fillStyle = pattern;
+ }
+ if (current.patternStroke) {
+ ctx.save();
+ const pattern = current.strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE);
+ patternStrokeTransform = getCurrentTransform(ctx);
+ ctx.restore();
+ ctx.strokeStyle = pattern;
+ }
+ let lineWidth = current.lineWidth;
+ const scale = current.textMatrixScale;
+ if (scale === 0 || lineWidth === 0) {
+ const fillStrokeMode = current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
+ if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
+ lineWidth = this.getSinglePixelWidth();
+ }
+ } else {
+ lineWidth /= scale;
+ }
+ if (fontSizeScale !== 1.0) {
+ ctx.scale(fontSizeScale, fontSizeScale);
+ lineWidth /= fontSizeScale;
+ }
+ ctx.lineWidth = lineWidth;
+ if (font.isInvalidPDFjsFont) {
+ const chars = [];
+ let width = 0;
+ for (const glyph of glyphs) {
+ chars.push(glyph.unicode);
+ width += glyph.width;
+ }
+ ctx.fillText(chars.join(""), 0, 0);
+ current.x += width * widthAdvanceScale * textHScale;
+ ctx.restore();
+ this.compose();
+ return undefined;
+ }
+ let x = 0,
+ i;
+ for (i = 0; i < glyphsLength; ++i) {
+ const glyph = glyphs[i];
+ if (typeof glyph === "number") {
+ x += spacingDir * glyph * fontSize / 1000;
+ continue;
+ }
+ let restoreNeeded = false;
+ const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
+ const character = glyph.fontChar;
+ const accent = glyph.accent;
+ let scaledX, scaledY;
+ let width = glyph.width;
+ if (vertical) {
+ const vmetric = glyph.vmetric || defaultVMetrics;
+ const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * 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 (font.remeasure && width > 0) {
+ const measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
+ if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
+ const characterScaleX = width / measuredWidth;
+ restoreNeeded = true;
+ ctx.save();
+ ctx.scale(characterScaleX, 1);
+ scaledX /= characterScaleX;
+ } else if (width !== measuredWidth) {
+ scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
+ }
+ }
+ if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
+ if (simpleFillText && !accent) {
+ ctx.fillText(character, scaledX, scaledY);
+ } else {
+ this.paintChar(character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
+ if (accent) {
+ const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
+ const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
+ this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
+ }
+ }
+ }
+ const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
+ x += charWidth;
+ if (restoreNeeded) {
+ ctx.restore();
+ }
+ }
+ if (vertical) {
+ current.y -= x;
+ } else {
+ current.x += x * textHScale;
+ }
+ ctx.restore();
+ this.compose();
+ return undefined;
+ }
+ showType3Text(glyphs) {
+ const ctx = this.ctx;
+ const current = this.current;
+ const font = current.font;
+ const fontSize = current.fontSize;
+ const fontDirection = current.fontDirection;
+ const spacingDir = font.vertical ? 1 : -1;
+ const charSpacing = current.charSpacing;
+ const wordSpacing = current.wordSpacing;
+ const textHScale = current.textHScale * fontDirection;
+ const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
+ const glyphsLength = glyphs.length;
+ const isTextInvisible = current.textRenderingMode === TextRenderingMode.INVISIBLE;
+ let i, glyph, width, spacingLength;
+ if (isTextInvisible || fontSize === 0) {
+ return;
+ }
+ this._cachedScaleForStroking[0] = -1;
+ this._cachedGetSinglePixelWidth = null;
+ ctx.save();
+ ctx.transform(...current.textMatrix);
+ ctx.translate(current.x, current.y);
+ ctx.scale(textHScale, fontDirection);
+ for (i = 0; i < glyphsLength; ++i) {
+ glyph = glyphs[i];
+ if (typeof glyph === "number") {
+ spacingLength = spacingDir * glyph * fontSize / 1000;
+ this.ctx.translate(spacingLength, 0);
+ current.x += spacingLength * textHScale;
+ continue;
+ }
+ const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
+ const operatorList = font.charProcOperatorList[glyph.operatorListId];
+ if (!operatorList) {
+ warn(`Type3 character "${glyph.operatorListId}" is not available.`);
+ continue;
+ }
+ if (this.contentVisible) {
+ this.processingType3 = glyph;
+ this.save();
+ ctx.scale(fontSize, fontSize);
+ ctx.transform(...fontMatrix);
+ this.executeOperatorList(operatorList);
+ this.restore();
+ }
+ const transformed = Util.applyTransform([glyph.width, 0], fontMatrix);
+ width = transformed[0] * fontSize + spacing;
+ ctx.translate(width, 0);
+ current.x += width * textHScale;
+ }
+ ctx.restore();
+ this.processingType3 = null;
+ }
+ setCharWidth(xWidth, yWidth) {}
+ setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
+ this.ctx.rect(llx, lly, urx - llx, ury - lly);
+ this.ctx.clip();
+ this.endPath();
+ }
+ getColorN_Pattern(IR) {
+ let pattern;
+ if (IR[0] === "TilingPattern") {
+ const color = IR[1];
+ const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
+ const canvasGraphicsFactory = {
+ createCanvasGraphics: ctx => new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
+ optionalContentConfig: this.optionalContentConfig,
+ markedContentStack: this.markedContentStack
+ })
+ };
+ pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
+ } else {
+ pattern = this._getPattern(IR[1], IR[2]);
+ }
+ return pattern;
+ }
+ setStrokeColorN() {
+ this.current.strokeColor = this.getColorN_Pattern(arguments);
+ this.current.patternStroke = true;
+ }
+ setFillColorN() {
+ this.current.fillColor = this.getColorN_Pattern(arguments);
+ this.current.patternFill = true;
+ }
+ setStrokeRGBColor(r, g, b) {
+ this.ctx.strokeStyle = this.current.strokeColor = Util.makeHexColor(r, g, b);
+ this.current.patternStroke = false;
+ }
+ setStrokeTransparent() {
+ this.ctx.strokeStyle = this.current.strokeColor = "transparent";
+ this.current.patternStroke = false;
+ }
+ setFillRGBColor(r, g, b) {
+ this.ctx.fillStyle = this.current.fillColor = Util.makeHexColor(r, g, b);
+ this.current.patternFill = false;
+ }
+ setFillTransparent() {
+ this.ctx.fillStyle = this.current.fillColor = "transparent";
+ this.current.patternFill = false;
+ }
+ _getPattern(objId, matrix = null) {
+ let pattern;
+ if (this.cachedPatterns.has(objId)) {
+ pattern = this.cachedPatterns.get(objId);
+ } else {
+ pattern = getShadingPattern(this.getObject(objId));
+ this.cachedPatterns.set(objId, pattern);
+ }
+ if (matrix) {
+ pattern.matrix = matrix;
+ }
+ return pattern;
+ }
+ shadingFill(objId) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const ctx = this.ctx;
+ this.save();
+ const pattern = this._getPattern(objId);
+ ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING);
+ const inv = getCurrentTransformInverse(ctx);
+ if (inv) {
+ const {
+ width,
+ height
+ } = ctx.canvas;
+ const [x0, y0, x1, y1] = Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
+ this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
+ } else {
+ this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
+ }
+ this.compose(this.current.getClippedPathBoundingBox());
+ this.restore();
+ }
+ beginInlineImage() {
+ unreachable("Should not call beginInlineImage");
+ }
+ beginImageData() {
+ unreachable("Should not call beginImageData");
+ }
+ paintFormXObjectBegin(matrix, bbox) {
+ if (!this.contentVisible) {
+ return;
+ }
+ this.save();
+ this.baseTransformStack.push(this.baseTransform);
+ if (matrix) {
+ this.transform(...matrix);
+ }
+ this.baseTransform = getCurrentTransform(this.ctx);
+ if (bbox) {
+ const width = bbox[2] - bbox[0];
+ const height = bbox[3] - bbox[1];
+ this.ctx.rect(bbox[0], bbox[1], width, height);
+ this.current.updateRectMinMax(getCurrentTransform(this.ctx), bbox);
+ this.clip();
+ this.endPath();
+ }
+ }
+ paintFormXObjectEnd() {
+ if (!this.contentVisible) {
+ return;
+ }
+ this.restore();
+ this.baseTransform = this.baseTransformStack.pop();
+ }
+ beginGroup(group) {
+ if (!this.contentVisible) {
+ return;
+ }
+ this.save();
+ if (this.inSMaskMode) {
+ this.endSMaskMode();
+ this.current.activeSMask = null;
+ }
+ const currentCtx = this.ctx;
+ if (!group.isolated) {
+ info("TODO: Support non-isolated groups.");
+ }
+ if (group.knockout) {
+ warn("Knockout groups not supported.");
+ }
+ const currentTransform = getCurrentTransform(currentCtx);
+ if (group.matrix) {
+ currentCtx.transform(...group.matrix);
+ }
+ if (!group.bbox) {
+ throw new Error("Bounding box is required.");
+ }
+ let bounds = Util.getAxialAlignedBoundingBox(group.bbox, getCurrentTransform(currentCtx));
+ const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
+ bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
+ const offsetX = Math.floor(bounds[0]);
+ const offsetY = Math.floor(bounds[1]);
+ const drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
+ const drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
+ this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
+ let cacheId = "groupAt" + this.groupLevel;
+ if (group.smask) {
+ cacheId += "_smask_" + this.smaskCounter++ % 2;
+ }
+ const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
+ const groupCtx = scratchCanvas.context;
+ groupCtx.translate(-offsetX, -offsetY);
+ groupCtx.transform(...currentTransform);
+ if (group.smask) {
+ this.smaskStack.push({
+ canvas: scratchCanvas.canvas,
+ context: groupCtx,
+ offsetX,
+ offsetY,
+ subtype: group.smask.subtype,
+ backdrop: group.smask.backdrop,
+ transferMap: group.smask.transferMap || null,
+ startTransformInverse: null
+ });
+ } else {
+ currentCtx.setTransform(1, 0, 0, 1, 0, 0);
+ currentCtx.translate(offsetX, offsetY);
+ currentCtx.save();
+ }
+ copyCtxState(currentCtx, groupCtx);
+ this.ctx = groupCtx;
+ this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
+ this.groupStack.push(currentCtx);
+ this.groupLevel++;
+ }
+ endGroup(group) {
+ if (!this.contentVisible) {
+ return;
+ }
+ this.groupLevel--;
+ const groupCtx = this.ctx;
+ const ctx = this.groupStack.pop();
+ this.ctx = ctx;
+ this.ctx.imageSmoothingEnabled = false;
+ if (group.smask) {
+ this.tempSMask = this.smaskStack.pop();
+ this.restore();
+ } else {
+ this.ctx.restore();
+ const currentMtx = getCurrentTransform(this.ctx);
+ this.restore();
+ this.ctx.save();
+ this.ctx.setTransform(...currentMtx);
+ const dirtyBox = Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);
+ this.ctx.drawImage(groupCtx.canvas, 0, 0);
+ this.ctx.restore();
+ this.compose(dirtyBox);
+ }
+ }
+ beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
+ this.#restoreInitialState();
+ resetCtxToDefault(this.ctx);
+ this.ctx.save();
+ this.save();
+ if (this.baseTransform) {
+ this.ctx.setTransform(...this.baseTransform);
+ }
+ if (rect) {
+ const width = rect[2] - rect[0];
+ const height = rect[3] - rect[1];
+ if (hasOwnCanvas && this.annotationCanvasMap) {
+ transform = transform.slice();
+ transform[4] -= rect[0];
+ transform[5] -= rect[1];
+ rect = rect.slice();
+ rect[0] = rect[1] = 0;
+ rect[2] = width;
+ rect[3] = height;
+ const [scaleX, scaleY] = Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx));
+ const {
+ viewportScale
+ } = this;
+ const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
+ const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
+ this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
+ const {
+ canvas,
+ context
+ } = this.annotationCanvas;
+ 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);
+ } else {
+ resetCtxToDefault(this.ctx);
+ this.endPath();
+ this.ctx.rect(rect[0], rect[1], width, height);
+ this.ctx.clip();
+ this.ctx.beginPath();
+ }
+ }
+ this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
+ this.transform(...transform);
+ this.transform(...matrix);
+ }
+ endAnnotation() {
+ if (this.annotationCanvas) {
+ this.ctx.restore();
+ this.#drawFilter();
+ this.ctx = this.annotationCanvas.savedCtx;
+ delete this.annotationCanvas.savedCtx;
+ delete this.annotationCanvas;
+ }
+ }
+ paintImageMaskXObject(img) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const count = img.count;
+ img = this.getObject(img.data, img);
+ img.count = count;
+ const ctx = this.ctx;
+ const glyph = this.processingType3;
+ if (glyph) {
+ if (glyph.compiled === undefined) {
+ glyph.compiled = compileType3Glyph(img);
+ }
+ if (glyph.compiled) {
+ glyph.compiled(ctx);
+ return;
+ }
+ }
+ const mask = this._createMaskCanvas(img);
+ const maskCanvas = mask.canvas;
+ ctx.save();
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
+ ctx.restore();
+ this.compose();
+ }
+ paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
+ if (!this.contentVisible) {
+ return;
+ }
+ img = this.getObject(img.data, img);
+ const ctx = this.ctx;
+ ctx.save();
+ const currentTransform = getCurrentTransform(ctx);
+ ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
+ const mask = this._createMaskCanvas(img);
+ ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
+ for (let i = 0, ii = positions.length; i < ii; i += 2) {
+ const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
+ const [x, y] = Util.applyTransform([0, 0], trans);
+ ctx.drawImage(mask.canvas, x, y);
+ }
+ ctx.restore();
+ this.compose();
+ }
+ paintImageMaskXObjectGroup(images) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const ctx = this.ctx;
+ const fillColor = this.current.fillColor;
+ const isPatternFill = this.current.patternFill;
+ for (const image of images) {
+ const {
+ data,
+ width,
+ height,
+ transform
+ } = image;
+ const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
+ const maskCtx = maskCanvas.context;
+ maskCtx.save();
+ const img = this.getObject(data, image);
+ putBinaryImageMask(maskCtx, img);
+ maskCtx.globalCompositeOperation = "source-in";
+ maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL) : fillColor;
+ maskCtx.fillRect(0, 0, width, height);
+ maskCtx.restore();
+ ctx.save();
+ ctx.transform(...transform);
+ ctx.scale(1, -1);
+ drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
+ ctx.restore();
+ }
+ this.compose();
+ }
+ paintImageXObject(objId) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const imgData = this.getObject(objId);
+ if (!imgData) {
+ warn("Dependent image isn't ready yet");
+ return;
+ }
+ this.paintInlineImageXObject(imgData);
+ }
+ paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const imgData = this.getObject(objId);
+ if (!imgData) {
+ warn("Dependent image isn't ready yet");
+ return;
+ }
+ const width = imgData.width;
+ const height = imgData.height;
+ const map = [];
+ for (let i = 0, ii = positions.length; i < ii; i += 2) {
+ map.push({
+ transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
+ x: 0,
+ y: 0,
+ w: width,
+ h: height
+ });
+ }
+ 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;
+ }
+ const width = imgData.width;
+ const height = imgData.height;
+ const ctx = this.ctx;
+ this.save();
+ if (!isNodeJS) {
+ const {
+ filter
+ } = ctx;
+ if (filter !== "none" && filter !== "") {
+ ctx.filter = "none";
+ }
+ }
+ ctx.scale(1 / width, -1 / height);
+ let imgToPaint;
+ 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);
+ imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
+ }
+ const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
+ ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
+ drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
+ this.compose();
+ this.restore();
+ }
+ paintInlineImageXObjectGroup(imgData, map) {
+ if (!this.contentVisible) {
+ return;
+ }
+ const ctx = this.ctx;
+ 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, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
+ ctx.restore();
+ }
+ this.compose();
+ }
+ paintSolidColorImageMask() {
+ if (!this.contentVisible) {
+ return;
+ }
+ this.ctx.fillRect(0, 0, 1, 1);
+ this.compose();
+ }
+ markPoint(tag) {}
+ markPointProps(tag, properties) {}
+ beginMarkedContent(tag) {
+ this.markedContentStack.push({
+ visible: true
+ });
+ }
+ beginMarkedContentProps(tag, properties) {
+ if (tag === "OC") {
+ this.markedContentStack.push({
+ visible: this.optionalContentConfig.isVisible(properties)
+ });
+ } else {
+ this.markedContentStack.push({
+ visible: true
+ });
+ }
+ this.contentVisible = this.isContentVisible();
+ }
+ endMarkedContent() {
+ this.markedContentStack.pop();
+ this.contentVisible = this.isContentVisible();
+ }
+ beginCompat() {}
+ endCompat() {}
+ consumePath(clipBox) {
+ const isEmpty = this.current.isEmptyClip();
+ if (this.pendingClip) {
+ this.current.updateClipFromPath();
+ }
+ if (!this.pendingClip) {
+ this.compose(clipBox);
+ }
+ const ctx = this.ctx;
+ if (this.pendingClip) {
+ if (!isEmpty) {
+ if (this.pendingClip === EO_CLIP) {
+ ctx.clip("evenodd");
+ } else {
+ ctx.clip();
+ }
+ }
+ this.pendingClip = null;
+ }
+ this.current.startNewPathAndClipBox(this.current.clipBox);
+ ctx.beginPath();
+ }
+ getSinglePixelWidth() {
+ if (!this._cachedGetSinglePixelWidth) {
+ const m = getCurrentTransform(this.ctx);
+ if (m[1] === 0 && m[2] === 0) {
+ this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
+ } else {
+ const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
+ const normX = Math.hypot(m[0], m[2]);
+ const normY = Math.hypot(m[1], m[3]);
+ this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
+ }
+ }
+ return this._cachedGetSinglePixelWidth;
+ }
+ getScaleForStroking() {
+ if (this._cachedScaleForStroking[0] === -1) {
+ const {
+ lineWidth
+ } = this.current;
+ const {
+ a,
+ b,
+ c,
+ d
+ } = this.ctx.getTransform();
+ let scaleX, scaleY;
+ 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 {
+ const scaledXLineWidth = normX * lineWidth;
+ const scaledYLineWidth = normY * lineWidth;
+ scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
+ scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
+ }
+ } else {
+ 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;
+ } else {
+ const baseArea = lineWidth * absDet;
+ scaleX = normY > baseArea ? normY / baseArea : 1;
+ scaleY = normX > baseArea ? normX / baseArea : 1;
+ }
+ }
+ this._cachedScaleForStroking[0] = scaleX;
+ this._cachedScaleForStroking[1] = scaleY;
+ }
+ return this._cachedScaleForStroking;
+ }
+ rescaleAndStroke(saveRestore) {
+ const {
+ ctx
+ } = this;
+ const {
+ lineWidth
+ } = this.current;
+ const [scaleX, scaleY] = this.getScaleForStroking();
+ ctx.lineWidth = lineWidth || 1;
+ if (scaleX === 1 && scaleY === 1) {
+ ctx.stroke();
+ return;
+ }
+ const dashes = ctx.getLineDash();
+ if (saveRestore) {
+ ctx.save();
+ }
+ ctx.scale(scaleX, scaleY);
+ 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.restore();
+ }
+ }
+ isContentVisible() {
+ for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
+ if (!this.markedContentStack[i].visible) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+for (const op in OPS) {
+ if (CanvasGraphics.prototype[op] !== undefined) {
+ CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
+ }
+}
+
+;// ./src/display/worker_options.js
+class GlobalWorkerOptions {
+ static #port = null;
+ static #src = "";
+ static get workerPort() {
+ return this.#port;
+ }
+ static set workerPort(val) {
+ if (!(typeof Worker !== "undefined" && val instanceof Worker) && val !== null) {
+ throw new Error("Invalid `workerPort` type.");
+ }
+ this.#port = val;
+ }
+ static get workerSrc() {
+ return this.#src;
+ }
+ static set workerSrc(val) {
+ if (typeof val !== "string") {
+ throw new Error("Invalid `workerSrc` type.");
+ }
+ this.#src = val;
+ }
+}
+
+;// ./src/shared/message_handler.js
+
+const CallbackKind = {
+ UNKNOWN: 0,
+ DATA: 1,
+ ERROR: 2
+};
+const StreamKind = {
+ UNKNOWN: 0,
+ CANCEL: 1,
+ CANCEL_COMPLETE: 2,
+ CLOSE: 3,
+ ENQUEUE: 4,
+ ERROR: 5,
+ PULL: 6,
+ PULL_COMPLETE: 7,
+ START_COMPLETE: 8
+};
+function onFn() {}
+function wrapReason(reason) {
+ if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
+ unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
+ }
+ switch (reason.name) {
+ case "AbortException":
+ return new AbortException(reason.message);
+ case "MissingPDFException":
+ return new MissingPDFException(reason.message);
+ case "PasswordException":
+ return new PasswordException(reason.message, reason.code);
+ case "UnexpectedResponseException":
+ return new UnexpectedResponseException(reason.message, reason.status);
+ case "UnknownErrorException":
+ return new UnknownErrorException(reason.message, reason.details);
+ default:
+ return new UnknownErrorException(reason.message, reason.toString());
+ }
+}
+class MessageHandler {
+ #messageAC = new AbortController();
+ constructor(sourceName, targetName, comObj) {
+ this.sourceName = sourceName;
+ this.targetName = targetName;
+ this.comObj = comObj;
+ this.callbackId = 1;
+ this.streamId = 1;
+ this.streamSinks = Object.create(null);
+ this.streamControllers = Object.create(null);
+ this.callbackCapabilities = Object.create(null);
+ this.actionHandler = Object.create(null);
+ comObj.addEventListener("message", this.#onMessage.bind(this), {
+ signal: this.#messageAC.signal
+ });
+ }
+ #onMessage({
+ data
+ }) {
+ if (data.targetName !== this.sourceName) {
+ return;
+ }
+ if (data.stream) {
+ this.#processStreamMessage(data);
+ return;
+ }
+ if (data.callback) {
+ const callbackId = data.callbackId;
+ const capability = this.callbackCapabilities[callbackId];
+ if (!capability) {
+ throw new Error(`Cannot resolve callback ${callbackId}`);
+ }
+ delete this.callbackCapabilities[callbackId];
+ if (data.callback === CallbackKind.DATA) {
+ capability.resolve(data.data);
+ } else if (data.callback === CallbackKind.ERROR) {
+ capability.reject(wrapReason(data.reason));
+ } else {
+ throw new Error("Unexpected callback case");
+ }
+ return;
+ }
+ const action = this.actionHandler[data.action];
+ if (!action) {
+ throw new Error(`Unknown action from worker: ${data.action}`);
+ }
+ if (data.callbackId) {
+ const sourceName = this.sourceName,
+ targetName = data.sourceName,
+ comObj = this.comObj;
+ Promise.try(action, data.data).then(function (result) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ callback: CallbackKind.DATA,
+ callbackId: data.callbackId,
+ data: result
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ callback: CallbackKind.ERROR,
+ callbackId: data.callbackId,
+ reason: wrapReason(reason)
+ });
+ });
+ return;
+ }
+ if (data.streamId) {
+ this.#createStreamSink(data);
+ return;
+ }
+ action(data.data);
+ }
+ on(actionName, handler) {
+ const ah = this.actionHandler;
+ if (ah[actionName]) {
+ throw new Error(`There is already an actionName called "${actionName}"`);
+ }
+ ah[actionName] = handler;
+ }
+ send(actionName, data, transfers) {
+ this.comObj.postMessage({
+ sourceName: this.sourceName,
+ targetName: this.targetName,
+ action: actionName,
+ data
+ }, transfers);
+ }
+ sendWithPromise(actionName, data, transfers) {
+ const callbackId = this.callbackId++;
+ const capability = Promise.withResolvers();
+ this.callbackCapabilities[callbackId] = capability;
+ try {
+ this.comObj.postMessage({
+ sourceName: this.sourceName,
+ targetName: this.targetName,
+ action: actionName,
+ callbackId,
+ data
+ }, transfers);
+ } catch (ex) {
+ capability.reject(ex);
+ }
+ return capability.promise;
+ }
+ sendWithStream(actionName, data, queueingStrategy, transfers) {
+ const streamId = this.streamId++,
+ sourceName = this.sourceName,
+ targetName = this.targetName,
+ comObj = this.comObj;
+ return new ReadableStream({
+ start: controller => {
+ const startCapability = Promise.withResolvers();
+ this.streamControllers[streamId] = {
+ controller,
+ startCall: startCapability,
+ pullCall: null,
+ cancelCall: null,
+ isClosed: false
+ };
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ action: actionName,
+ streamId,
+ data,
+ desiredSize: controller.desiredSize
+ }, transfers);
+ return startCapability.promise;
+ },
+ pull: controller => {
+ const pullCapability = Promise.withResolvers();
+ this.streamControllers[streamId].pullCall = pullCapability;
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.PULL,
+ streamId,
+ desiredSize: controller.desiredSize
+ });
+ return pullCapability.promise;
+ },
+ cancel: reason => {
+ assert(reason instanceof Error, "cancel must have a valid reason");
+ const cancelCapability = Promise.withResolvers();
+ this.streamControllers[streamId].cancelCall = cancelCapability;
+ this.streamControllers[streamId].isClosed = true;
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.CANCEL,
+ streamId,
+ reason: wrapReason(reason)
+ });
+ return cancelCapability.promise;
+ }
+ }, queueingStrategy);
+ }
+ #createStreamSink(data) {
+ const streamId = data.streamId,
+ sourceName = this.sourceName,
+ targetName = data.sourceName,
+ comObj = this.comObj;
+ const self = this,
+ action = this.actionHandler[data.action];
+ const streamSink = {
+ enqueue(chunk, size = 1, transfers) {
+ if (this.isCancelled) {
+ return;
+ }
+ const lastDesiredSize = this.desiredSize;
+ this.desiredSize -= size;
+ if (lastDesiredSize > 0 && this.desiredSize <= 0) {
+ this.sinkCapability = Promise.withResolvers();
+ this.ready = this.sinkCapability.promise;
+ }
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.ENQUEUE,
+ streamId,
+ chunk
+ }, transfers);
+ },
+ close() {
+ if (this.isCancelled) {
+ return;
+ }
+ this.isCancelled = true;
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.CLOSE,
+ streamId
+ });
+ delete self.streamSinks[streamId];
+ },
+ error(reason) {
+ assert(reason instanceof Error, "error must have a valid reason");
+ if (this.isCancelled) {
+ return;
+ }
+ this.isCancelled = true;
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.ERROR,
+ streamId,
+ reason: wrapReason(reason)
+ });
+ },
+ sinkCapability: Promise.withResolvers(),
+ onPull: null,
+ onCancel: null,
+ isCancelled: false,
+ desiredSize: data.desiredSize,
+ ready: null
+ };
+ streamSink.sinkCapability.resolve();
+ streamSink.ready = streamSink.sinkCapability.promise;
+ this.streamSinks[streamId] = streamSink;
+ Promise.try(action, data.data, streamSink).then(function () {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.START_COMPLETE,
+ streamId,
+ success: true
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.START_COMPLETE,
+ streamId,
+ reason: wrapReason(reason)
+ });
+ });
+ }
+ #processStreamMessage(data) {
+ const streamId = data.streamId,
+ sourceName = this.sourceName,
+ targetName = data.sourceName,
+ comObj = this.comObj;
+ const streamController = this.streamControllers[streamId],
+ streamSink = this.streamSinks[streamId];
+ switch (data.stream) {
+ case StreamKind.START_COMPLETE:
+ if (data.success) {
+ streamController.startCall.resolve();
+ } else {
+ streamController.startCall.reject(wrapReason(data.reason));
+ }
+ break;
+ case StreamKind.PULL_COMPLETE:
+ if (data.success) {
+ streamController.pullCall.resolve();
+ } else {
+ streamController.pullCall.reject(wrapReason(data.reason));
+ }
+ break;
+ case StreamKind.PULL:
+ if (!streamSink) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId,
+ success: true
+ });
+ break;
+ }
+ if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
+ streamSink.sinkCapability.resolve();
+ }
+ streamSink.desiredSize = data.desiredSize;
+ Promise.try(streamSink.onPull || onFn).then(function () {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId,
+ success: true
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId,
+ reason: wrapReason(reason)
+ });
+ });
+ break;
+ case StreamKind.ENQUEUE:
+ assert(streamController, "enqueue should have stream controller");
+ if (streamController.isClosed) {
+ break;
+ }
+ streamController.controller.enqueue(data.chunk);
+ break;
+ case StreamKind.CLOSE:
+ assert(streamController, "close should have stream controller");
+ if (streamController.isClosed) {
+ break;
+ }
+ streamController.isClosed = true;
+ streamController.controller.close();
+ this.#deleteStreamController(streamController, streamId);
+ break;
+ case StreamKind.ERROR:
+ assert(streamController, "error should have stream controller");
+ streamController.controller.error(wrapReason(data.reason));
+ this.#deleteStreamController(streamController, streamId);
+ break;
+ case StreamKind.CANCEL_COMPLETE:
+ if (data.success) {
+ streamController.cancelCall.resolve();
+ } else {
+ streamController.cancelCall.reject(wrapReason(data.reason));
+ }
+ this.#deleteStreamController(streamController, streamId);
+ break;
+ case StreamKind.CANCEL:
+ if (!streamSink) {
+ break;
+ }
+ const dataReason = wrapReason(data.reason);
+ Promise.try(streamSink.onCancel || onFn, dataReason).then(function () {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.CANCEL_COMPLETE,
+ streamId,
+ success: true
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName,
+ targetName,
+ stream: StreamKind.CANCEL_COMPLETE,
+ streamId,
+ reason: wrapReason(reason)
+ });
+ });
+ streamSink.sinkCapability.reject(dataReason);
+ streamSink.isCancelled = true;
+ delete this.streamSinks[streamId];
+ break;
+ default:
+ throw new Error("Unexpected stream case");
+ }
+ }
+ async #deleteStreamController(streamController, streamId) {
+ await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
+ delete this.streamControllers[streamId];
+ }
+ destroy() {
+ this.#messageAC?.abort();
+ this.#messageAC = null;
+ }
+}
+
+;// ./src/display/metadata.js
+
+class Metadata {
+ #metadataMap;
+ #data;
+ constructor({
+ parsedData,
+ rawData
+ }) {
+ this.#metadataMap = parsedData;
+ this.#data = rawData;
+ }
+ getRaw() {
+ return this.#data;
+ }
+ get(name) {
+ return this.#metadataMap.get(name) ?? null;
+ }
+ getAll() {
+ return objectFromMap(this.#metadataMap);
+ }
+ has(name) {
+ return this.#metadataMap.has(name);
+ }
+}
+
+;// ./src/display/optional_content_config.js
+
+
+const INTERNAL = Symbol("INTERNAL");
+class OptionalContentGroup {
+ #isDisplay = false;
+ #isPrint = false;
+ #userSet = false;
+ #visible = true;
+ constructor(renderingIntent, {
+ name,
+ intent,
+ usage,
+ rbGroups
+ }) {
+ this.#isDisplay = !!(renderingIntent & RenderingIntentFlag.DISPLAY);
+ this.#isPrint = !!(renderingIntent & RenderingIntentFlag.PRINT);
+ this.name = name;
+ this.intent = intent;
+ this.usage = usage;
+ this.rbGroups = rbGroups;
+ }
+ get visible() {
+ if (this.#userSet) {
+ return this.#visible;
+ }
+ if (!this.#visible) {
+ return false;
+ }
+ const {
+ print,
+ view
+ } = this.usage;
+ if (this.#isDisplay) {
+ return view?.viewState !== "OFF";
+ } else if (this.#isPrint) {
+ return print?.printState !== "OFF";
+ }
+ return true;
+ }
+ _setVisible(internal, visible, userSet = false) {
+ if (internal !== INTERNAL) {
+ unreachable("Internal method `_setVisible` called.");
+ }
+ this.#userSet = userSet;
+ this.#visible = visible;
+ }
+}
+class OptionalContentConfig {
+ #cachedGetHash = null;
+ #groups = new Map();
+ #initialHash = null;
+ #order = null;
+ constructor(data, renderingIntent = RenderingIntentFlag.DISPLAY) {
+ this.renderingIntent = renderingIntent;
+ this.name = null;
+ this.creator = null;
+ if (data === null) {
+ return;
+ }
+ this.name = data.name;
+ this.creator = data.creator;
+ this.#order = data.order;
+ for (const group of data.groups) {
+ this.#groups.set(group.id, new OptionalContentGroup(renderingIntent, group));
+ }
+ if (data.baseState === "OFF") {
+ for (const group of this.#groups.values()) {
+ group._setVisible(INTERNAL, false);
+ }
+ }
+ for (const on of data.on) {
+ this.#groups.get(on)._setVisible(INTERNAL, true);
+ }
+ for (const off of data.off) {
+ this.#groups.get(off)._setVisible(INTERNAL, false);
+ }
+ this.#initialHash = this.getHash();
+ }
+ #evaluateVisibilityExpression(array) {
+ const length = array.length;
+ if (length < 2) {
+ return true;
+ }
+ const operator = array[0];
+ for (let i = 1; i < length; i++) {
+ const element = array[i];
+ let state;
+ if (Array.isArray(element)) {
+ state = this.#evaluateVisibilityExpression(element);
+ } else if (this.#groups.has(element)) {
+ state = this.#groups.get(element).visible;
+ } else {
+ warn(`Optional content group not found: ${element}`);
+ return true;
+ }
+ switch (operator) {
+ case "And":
+ if (!state) {
+ return false;
+ }
+ break;
+ case "Or":
+ if (state) {
+ return true;
+ }
+ break;
+ case "Not":
+ return !state;
+ default:
+ return true;
+ }
+ }
+ return operator === "And";
+ }
+ isVisible(group) {
+ if (this.#groups.size === 0) {
+ return true;
+ }
+ if (!group) {
+ info("Optional content group not defined.");
+ return true;
+ }
+ if (group.type === "OCG") {
+ if (!this.#groups.has(group.id)) {
+ warn(`Optional content group not found: ${group.id}`);
+ return true;
+ }
+ return this.#groups.get(group.id).visible;
+ } else if (group.type === "OCMD") {
+ if (group.expression) {
+ return this.#evaluateVisibilityExpression(group.expression);
+ }
+ if (!group.policy || group.policy === "AnyOn") {
+ for (const id of group.ids) {
+ if (!this.#groups.has(id)) {
+ warn(`Optional content group not found: ${id}`);
+ return true;
+ }
+ if (this.#groups.get(id).visible) {
+ return true;
+ }
+ }
+ return false;
+ } else if (group.policy === "AllOn") {
+ for (const id of group.ids) {
+ if (!this.#groups.has(id)) {
+ warn(`Optional content group not found: ${id}`);
+ return true;
+ }
+ if (!this.#groups.get(id).visible) {
+ return false;
+ }
+ }
+ return true;
+ } else if (group.policy === "AnyOff") {
+ for (const id of group.ids) {
+ if (!this.#groups.has(id)) {
+ warn(`Optional content group not found: ${id}`);
+ return true;
+ }
+ if (!this.#groups.get(id).visible) {
+ return true;
+ }
+ }
+ return false;
+ } else if (group.policy === "AllOff") {
+ for (const id of group.ids) {
+ if (!this.#groups.has(id)) {
+ warn(`Optional content group not found: ${id}`);
+ return true;
+ }
+ if (this.#groups.get(id).visible) {
+ return false;
+ }
+ }
+ return true;
+ }
+ warn(`Unknown optional content policy ${group.policy}.`);
+ return true;
+ }
+ warn(`Unknown group type ${group.type}.`);
+ return true;
+ }
+ setVisibility(id, visible = true, preserveRB = true) {
+ const group = this.#groups.get(id);
+ if (!group) {
+ warn(`Optional content group not found: ${id}`);
+ return;
+ }
+ if (preserveRB && visible && group.rbGroups.length) {
+ for (const rbGroup of group.rbGroups) {
+ for (const otherId of rbGroup) {
+ if (otherId !== id) {
+ this.#groups.get(otherId)?._setVisible(INTERNAL, false, true);
+ }
+ }
+ }
+ }
+ group._setVisible(INTERNAL, !!visible, true);
+ this.#cachedGetHash = null;
+ }
+ setOCGState({
+ state,
+ preserveRB
+ }) {
+ let operator;
+ for (const elem of state) {
+ switch (elem) {
+ case "ON":
+ case "OFF":
+ case "Toggle":
+ operator = elem;
+ continue;
+ }
+ const group = this.#groups.get(elem);
+ if (!group) {
+ continue;
+ }
+ switch (operator) {
+ case "ON":
+ this.setVisibility(elem, true, preserveRB);
+ break;
+ case "OFF":
+ this.setVisibility(elem, false, preserveRB);
+ break;
+ case "Toggle":
+ this.setVisibility(elem, !group.visible, preserveRB);
+ break;
+ }
+ }
+ this.#cachedGetHash = null;
+ }
+ get hasInitialVisibility() {
+ return this.#initialHash === null || this.getHash() === this.#initialHash;
+ }
+ getOrder() {
+ if (!this.#groups.size) {
+ return null;
+ }
+ if (this.#order) {
+ return this.#order.slice();
+ }
+ return [...this.#groups.keys()];
+ }
+ getGroups() {
+ return this.#groups.size > 0 ? objectFromMap(this.#groups) : null;
+ }
+ getGroup(id) {
+ return this.#groups.get(id) || null;
+ }
+ getHash() {
+ if (this.#cachedGetHash !== null) {
+ return this.#cachedGetHash;
+ }
+ const hash = new MurmurHash3_64();
+ for (const [id, group] of this.#groups) {
+ hash.update(`${id}:${group.visible}`);
+ }
+ return this.#cachedGetHash = hash.hexdigest();
+ }
+}
+
+;// ./src/display/transport_stream.js
+
+
+class PDFDataTransportStream {
+ constructor(pdfDataRangeTransport, {
+ disableRange = false,
+ disableStream = false
+ }) {
+ assert(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
+ const {
+ length,
+ initialData,
+ progressiveDone,
+ contentDispositionFilename
+ } = pdfDataRangeTransport;
+ this._queuedChunks = [];
+ this._progressiveDone = progressiveDone;
+ this._contentDispositionFilename = contentDispositionFilename;
+ if (initialData?.length > 0) {
+ const buffer = initialData instanceof Uint8Array && initialData.byteLength === initialData.buffer.byteLength ? initialData.buffer : new Uint8Array(initialData).buffer;
+ this._queuedChunks.push(buffer);
+ }
+ this._pdfDataRangeTransport = pdfDataRangeTransport;
+ this._isStreamingSupported = !disableStream;
+ this._isRangeSupported = !disableRange;
+ this._contentLength = length;
+ this._fullRequestReader = null;
+ this._rangeReaders = [];
+ pdfDataRangeTransport.addRangeListener((begin, chunk) => {
+ this._onReceiveData({
+ begin,
+ chunk
+ });
+ });
+ pdfDataRangeTransport.addProgressListener((loaded, total) => {
+ this._onProgress({
+ loaded,
+ total
+ });
+ });
+ pdfDataRangeTransport.addProgressiveReadListener(chunk => {
+ this._onReceiveData({
+ chunk
+ });
+ });
+ pdfDataRangeTransport.addProgressiveDoneListener(() => {
+ this._onProgressiveDone();
+ });
+ pdfDataRangeTransport.transportReady();
+ }
+ _onReceiveData({
+ begin,
+ chunk
+ }) {
+ const buffer = chunk instanceof Uint8Array && chunk.byteLength === chunk.buffer.byteLength ? chunk.buffer : new Uint8Array(chunk).buffer;
+ if (begin === undefined) {
+ if (this._fullRequestReader) {
+ this._fullRequestReader._enqueue(buffer);
+ } else {
+ this._queuedChunks.push(buffer);
+ }
+ } else {
+ const found = this._rangeReaders.some(function (rangeReader) {
+ if (rangeReader._begin !== begin) {
+ return false;
+ }
+ rangeReader._enqueue(buffer);
+ return true;
+ });
+ assert(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
+ }
+ }
+ get _progressiveDataLength() {
+ return this._fullRequestReader?._loaded ?? 0;
+ }
+ _onProgress(evt) {
+ if (evt.total === undefined) {
+ this._rangeReaders[0]?.onProgress?.({
+ loaded: evt.loaded
+ });
+ } else {
+ this._fullRequestReader?.onProgress?.({
+ loaded: evt.loaded,
+ total: evt.total
+ });
+ }
+ }
+ _onProgressiveDone() {
+ this._fullRequestReader?.progressiveDone();
+ this._progressiveDone = true;
+ }
+ _removeRangeReader(reader) {
+ const i = this._rangeReaders.indexOf(reader);
+ if (i >= 0) {
+ this._rangeReaders.splice(i, 1);
+ }
+ }
+ getFullReader() {
+ assert(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
+ const queuedChunks = this._queuedChunks;
+ this._queuedChunks = null;
+ return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename);
+ }
+ getRangeReader(begin, end) {
+ if (end <= this._progressiveDataLength) {
+ return null;
+ }
+ const reader = new PDFDataTransportStreamRangeReader(this, begin, end);
+ this._pdfDataRangeTransport.requestDataRange(begin, end);
+ this._rangeReaders.push(reader);
+ return reader;
+ }
+ cancelAllRequests(reason) {
+ this._fullRequestReader?.cancel(reason);
+ for (const reader of this._rangeReaders.slice(0)) {
+ reader.cancel(reason);
+ }
+ this._pdfDataRangeTransport.abort();
+ }
+}
+class PDFDataTransportStreamReader {
+ constructor(stream, queuedChunks, progressiveDone = false, contentDispositionFilename = null) {
+ this._stream = stream;
+ this._done = progressiveDone || false;
+ this._filename = isPdfFile(contentDispositionFilename) ? contentDispositionFilename : null;
+ this._queuedChunks = queuedChunks || [];
+ this._loaded = 0;
+ for (const chunk of this._queuedChunks) {
+ this._loaded += chunk.byteLength;
+ }
+ this._requests = [];
+ this._headersReady = Promise.resolve();
+ stream._fullRequestReader = this;
+ this.onProgress = null;
+ }
+ _enqueue(chunk) {
+ if (this._done) {
+ return;
+ }
+ if (this._requests.length > 0) {
+ const requestCapability = this._requests.shift();
+ requestCapability.resolve({
+ value: chunk,
+ done: false
+ });
+ } else {
+ this._queuedChunks.push(chunk);
+ }
+ this._loaded += chunk.byteLength;
+ }
+ get headersReady() {
+ return this._headersReady;
+ }
+ get filename() {
+ return this._filename;
+ }
+ get isRangeSupported() {
+ return this._stream._isRangeSupported;
+ }
+ get isStreamingSupported() {
+ return this._stream._isStreamingSupported;
+ }
+ get contentLength() {
+ return this._stream._contentLength;
+ }
+ async read() {
+ if (this._queuedChunks.length > 0) {
+ const chunk = this._queuedChunks.shift();
+ return {
+ value: chunk,
+ done: false
+ };
+ }
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ const requestCapability = Promise.withResolvers();
+ this._requests.push(requestCapability);
+ return requestCapability.promise;
+ }
+ cancel(reason) {
+ this._done = true;
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ }
+ progressiveDone() {
+ if (this._done) {
+ return;
+ }
+ this._done = true;
+ }
+}
+class PDFDataTransportStreamRangeReader {
+ constructor(stream, begin, end) {
+ this._stream = stream;
+ this._begin = begin;
+ this._end = end;
+ this._queuedChunk = null;
+ this._requests = [];
+ this._done = false;
+ this.onProgress = null;
+ }
+ _enqueue(chunk) {
+ if (this._done) {
+ return;
+ }
+ if (this._requests.length === 0) {
+ this._queuedChunk = chunk;
+ } else {
+ const requestsCapability = this._requests.shift();
+ requestsCapability.resolve({
+ value: chunk,
+ done: false
+ });
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ }
+ this._done = true;
+ this._stream._removeRangeReader(this);
+ }
+ get isStreamingSupported() {
+ return false;
+ }
+ async read() {
+ if (this._queuedChunk) {
+ const chunk = this._queuedChunk;
+ this._queuedChunk = null;
+ return {
+ value: chunk,
+ done: false
+ };
+ }
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ const requestCapability = Promise.withResolvers();
+ this._requests.push(requestCapability);
+ return requestCapability.promise;
+ }
+ cancel(reason) {
+ this._done = true;
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ this._stream._removeRangeReader(this);
+ }
+}
+
+;// ./src/display/content_disposition.js
+
+function getFilenameFromContentDispositionHeader(contentDisposition) {
+ let needsEncodingFixup = true;
+ let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
+ if (tmp) {
+ tmp = tmp[1];
+ let filename = rfc2616unquote(tmp);
+ filename = unescape(filename);
+ filename = rfc5987decode(filename);
+ filename = rfc2047decode(filename);
+ return fixupEncoding(filename);
+ }
+ tmp = rfc2231getparam(contentDisposition);
+ if (tmp) {
+ const filename = rfc2047decode(tmp);
+ return fixupEncoding(filename);
+ }
+ tmp = toParamRegExp("filename", "i").exec(contentDisposition);
+ if (tmp) {
+ tmp = tmp[1];
+ let filename = rfc2616unquote(tmp);
+ filename = rfc2047decode(filename);
+ return fixupEncoding(filename);
+ }
+ function toParamRegExp(attributePattern, flags) {
+ return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags);
+ }
+ function textdecode(encoding, value) {
+ if (encoding) {
+ if (!/^[\x00-\xFF]+$/.test(value)) {
+ return value;
+ }
+ try {
+ const decoder = new TextDecoder(encoding, {
+ fatal: true
+ });
+ const buffer = stringToBytes(value);
+ value = decoder.decode(buffer);
+ needsEncodingFixup = false;
+ } catch {}
+ }
+ return value;
+ }
+ function fixupEncoding(value) {
+ if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
+ value = textdecode("utf-8", value);
+ if (needsEncodingFixup) {
+ value = textdecode("iso-8859-1", value);
+ }
+ }
+ return value;
+ }
+ function rfc2231getparam(contentDispositionStr) {
+ const matches = [];
+ let match;
+ const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
+ while ((match = iter.exec(contentDispositionStr)) !== null) {
+ let [, n, quot, part] = match;
+ n = parseInt(n, 10);
+ if (n in matches) {
+ if (n === 0) {
+ break;
+ }
+ continue;
+ }
+ matches[n] = [quot, part];
+ }
+ const parts = [];
+ for (let n = 0; n < matches.length; ++n) {
+ if (!(n in matches)) {
+ break;
+ }
+ let [quot, part] = matches[n];
+ part = rfc2616unquote(part);
+ if (quot) {
+ part = unescape(part);
+ if (n === 0) {
+ part = rfc5987decode(part);
+ }
+ }
+ parts.push(part);
+ }
+ return parts.join("");
+ }
+ function rfc2616unquote(value) {
+ if (value.startsWith('"')) {
+ const parts = value.slice(1).split('\\"');
+ for (let i = 0; i < parts.length; ++i) {
+ const quotindex = parts[i].indexOf('"');
+ if (quotindex !== -1) {
+ parts[i] = parts[i].slice(0, quotindex);
+ parts.length = i + 1;
+ }
+ parts[i] = parts[i].replaceAll(/\\(.)/g, "$1");
+ }
+ value = parts.join('"');
+ }
+ return value;
+ }
+ function rfc5987decode(extvalue) {
+ const encodingend = extvalue.indexOf("'");
+ if (encodingend === -1) {
+ return extvalue;
+ }
+ const encoding = extvalue.slice(0, encodingend);
+ const langvalue = extvalue.slice(encodingend + 1);
+ const value = langvalue.replace(/^[^']*'/, "");
+ return textdecode(encoding, value);
+ }
+ function rfc2047decode(value) {
+ if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
+ return value;
+ }
+ return value.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
+ if (encoding === "q" || encoding === "Q") {
+ 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 {}
+ return textdecode(charset, text);
+ });
+ }
+ return "";
+}
+
+;// ./src/display/network_utils.js
+
+
+
+function createHeaders(isHttp, httpHeaders) {
+ const headers = new Headers();
+ if (!isHttp || !httpHeaders || typeof httpHeaders !== "object") {
+ return headers;
+ }
+ for (const key in httpHeaders) {
+ const val = httpHeaders[key];
+ if (val !== undefined) {
+ headers.append(key, val);
+ }
+ }
+ return headers;
+}
+function getResponseOrigin(url) {
+ try {
+ return new URL(url).origin;
+ } catch {}
+ return null;
+}
+function validateRangeRequestCapabilities({
+ responseHeaders,
+ isHttp,
+ rangeChunkSize,
+ disableRange
+}) {
+ const returnValues = {
+ allowRangeRequests: false,
+ suggestedLength: undefined
+ };
+ const length = parseInt(responseHeaders.get("Content-Length"), 10);
+ if (!Number.isInteger(length)) {
+ return returnValues;
+ }
+ returnValues.suggestedLength = length;
+ if (length <= 2 * rangeChunkSize) {
+ return returnValues;
+ }
+ if (disableRange || !isHttp) {
+ return returnValues;
+ }
+ if (responseHeaders.get("Accept-Ranges") !== "bytes") {
+ return returnValues;
+ }
+ const contentEncoding = responseHeaders.get("Content-Encoding") || "identity";
+ if (contentEncoding !== "identity") {
+ return returnValues;
+ }
+ returnValues.allowRangeRequests = true;
+ return returnValues;
+}
+function extractFilenameFromHeader(responseHeaders) {
+ const contentDisposition = responseHeaders.get("Content-Disposition");
+ if (contentDisposition) {
+ let filename = getFilenameFromContentDispositionHeader(contentDisposition);
+ if (filename.includes("%")) {
+ try {
+ filename = decodeURIComponent(filename);
+ } catch {}
+ }
+ if (isPdfFile(filename)) {
+ return filename;
+ }
+ }
+ return null;
+}
+function createResponseStatusError(status, url) {
+ if (status === 404 || status === 0 && url.startsWith("file:")) {
+ return new MissingPDFException('Missing PDF "' + url + '".');
+ }
+ return new UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF "${url}".`, status);
+}
+function validateResponseStatus(status) {
+ return status === 200 || status === 206;
+}
+
+;// ./src/display/fetch_stream.js
+
+
+function createFetchOptions(headers, withCredentials, abortController) {
+ return {
+ method: "GET",
+ headers,
+ signal: abortController.signal,
+ mode: "cors",
+ credentials: withCredentials ? "include" : "same-origin",
+ redirect: "follow"
+ };
+}
+function getArrayBuffer(val) {
+ if (val instanceof Uint8Array) {
+ return val.buffer;
+ }
+ if (val instanceof ArrayBuffer) {
+ return val;
+ }
+ warn(`getArrayBuffer - unexpected data format: ${val}`);
+ return new Uint8Array(val).buffer;
+}
+class PDFFetchStream {
+ _responseOrigin = null;
+ constructor(source) {
+ this.source = source;
+ this.isHttp = /^https?:/i.test(source.url);
+ this.headers = createHeaders(this.isHttp, source.httpHeaders);
+ this._fullRequestReader = null;
+ this._rangeRequestReaders = [];
+ }
+ get _progressiveDataLength() {
+ return this._fullRequestReader?._loaded ?? 0;
+ }
+ getFullReader() {
+ assert(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
+ this._fullRequestReader = new PDFFetchStreamReader(this);
+ return this._fullRequestReader;
+ }
+ getRangeReader(begin, end) {
+ if (end <= this._progressiveDataLength) {
+ return null;
+ }
+ const reader = new PDFFetchStreamRangeReader(this, begin, end);
+ this._rangeRequestReaders.push(reader);
+ return reader;
+ }
+ cancelAllRequests(reason) {
+ this._fullRequestReader?.cancel(reason);
+ for (const reader of this._rangeRequestReaders.slice(0)) {
+ reader.cancel(reason);
+ }
+ }
+}
+class PDFFetchStreamReader {
+ constructor(stream) {
+ 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._headersCapability = Promise.withResolvers();
+ 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;
+ const headers = new Headers(stream.headers);
+ const url = source.url;
+ fetch(url, createFetchOptions(headers, this._withCredentials, this._abortController)).then(response => {
+ stream._responseOrigin = getResponseOrigin(response.url);
+ if (!validateResponseStatus(response.status)) {
+ throw createResponseStatusError(response.status, url);
+ }
+ this._reader = response.body.getReader();
+ this._headersCapability.resolve();
+ const responseHeaders = response.headers;
+ const {
+ allowRangeRequests,
+ suggestedLength
+ } = validateRangeRequestCapabilities({
+ responseHeaders,
+ isHttp: stream.isHttp,
+ rangeChunkSize: this._rangeChunkSize,
+ disableRange: this._disableRange
+ });
+ this._isRangeSupported = allowRangeRequests;
+ this._contentLength = suggestedLength || this._contentLength;
+ this._filename = extractFilenameFromHeader(responseHeaders);
+ if (!this._isStreamingSupported && this._isRangeSupported) {
+ this.cancel(new AbortException("Streaming is disabled."));
+ }
+ }).catch(this._headersCapability.reject);
+ this.onProgress = null;
+ }
+ get headersReady() {
+ return this._headersCapability.promise;
+ }
+ get filename() {
+ return this._filename;
+ }
+ get contentLength() {
+ return this._contentLength;
+ }
+ get isRangeSupported() {
+ return this._isRangeSupported;
+ }
+ get isStreamingSupported() {
+ return this._isStreamingSupported;
+ }
+ async read() {
+ await this._headersCapability.promise;
+ const {
+ value,
+ done
+ } = await this._reader.read();
+ if (done) {
+ return {
+ value,
+ done
+ };
+ }
+ this._loaded += value.byteLength;
+ this.onProgress?.({
+ loaded: this._loaded,
+ total: this._contentLength
+ });
+ return {
+ value: getArrayBuffer(value),
+ 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 = Promise.withResolvers();
+ this._isStreamingSupported = !source.disableStream;
+ this._abortController = new AbortController();
+ const headers = new Headers(stream.headers);
+ headers.append("Range", `bytes=${begin}-${end - 1}`);
+ const url = source.url;
+ fetch(url, createFetchOptions(headers, this._withCredentials, this._abortController)).then(response => {
+ const responseOrigin = getResponseOrigin(response.url);
+ if (responseOrigin !== stream._responseOrigin) {
+ throw new Error(`Expected range response-origin "${responseOrigin}" to match "${stream._responseOrigin}".`);
+ }
+ if (!validateResponseStatus(response.status)) {
+ throw 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;
+ const {
+ value,
+ done
+ } = await this._reader.read();
+ if (done) {
+ return {
+ value,
+ done
+ };
+ }
+ this._loaded += value.byteLength;
+ this.onProgress?.({
+ loaded: this._loaded
+ });
+ return {
+ value: getArrayBuffer(value),
+ done: false
+ };
+ }
+ cancel(reason) {
+ this._reader?.cancel(reason);
+ this._abortController.abort();
+ }
+}
+
+;// ./src/display/network.js
+
+
+const OK_RESPONSE = 200;
+const PARTIAL_CONTENT_RESPONSE = 206;
+function network_getArrayBuffer(xhr) {
+ const data = xhr.response;
+ if (typeof data !== "string") {
+ return data;
+ }
+ return stringToBytes(data).buffer;
+}
+class NetworkManager {
+ _responseOrigin = null;
+ constructor({
+ url,
+ httpHeaders,
+ withCredentials
+ }) {
+ this.url = url;
+ this.isHttp = /^https?:/i.test(url);
+ this.headers = createHeaders(this.isHttp, httpHeaders);
+ this.withCredentials = withCredentials || false;
+ this.currXhrId = 0;
+ this.pendingRequests = Object.create(null);
+ }
+ requestRange(begin, end, listeners) {
+ const args = {
+ begin,
+ end
+ };
+ for (const prop in listeners) {
+ args[prop] = listeners[prop];
+ }
+ return this.request(args);
+ }
+ requestFull(listeners) {
+ return this.request(listeners);
+ }
+ request(args) {
+ const xhr = new XMLHttpRequest();
+ const xhrId = this.currXhrId++;
+ const pendingRequest = this.pendingRequests[xhrId] = {
+ xhr
+ };
+ xhr.open("GET", this.url);
+ xhr.withCredentials = this.withCredentials;
+ for (const [key, val] of this.headers) {
+ xhr.setRequestHeader(key, val);
+ }
+ if (this.isHttp && "begin" in args && "end" in args) {
+ xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`);
+ pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
+ } else {
+ pendingRequest.expectedStatus = OK_RESPONSE;
+ }
+ xhr.responseType = "arraybuffer";
+ if (args.onError) {
+ xhr.onerror = function (evt) {
+ args.onError(xhr.status);
+ };
+ }
+ xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
+ xhr.onprogress = this.onProgress.bind(this, xhrId);
+ pendingRequest.onHeadersReceived = args.onHeadersReceived;
+ pendingRequest.onDone = args.onDone;
+ pendingRequest.onError = args.onError;
+ pendingRequest.onProgress = args.onProgress;
+ xhr.send(null);
+ return xhrId;
+ }
+ onProgress(xhrId, evt) {
+ const pendingRequest = this.pendingRequests[xhrId];
+ if (!pendingRequest) {
+ return;
+ }
+ pendingRequest.onProgress?.(evt);
+ }
+ onStateChange(xhrId, evt) {
+ const pendingRequest = this.pendingRequests[xhrId];
+ if (!pendingRequest) {
+ return;
+ }
+ const xhr = pendingRequest.xhr;
+ if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
+ pendingRequest.onHeadersReceived();
+ delete pendingRequest.onHeadersReceived;
+ }
+ if (xhr.readyState !== 4) {
+ return;
+ }
+ if (!(xhrId in this.pendingRequests)) {
+ return;
+ }
+ delete this.pendingRequests[xhrId];
+ if (xhr.status === 0 && this.isHttp) {
+ pendingRequest.onError?.(xhr.status);
+ return;
+ }
+ const xhrStatus = xhr.status || OK_RESPONSE;
+ const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
+ if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
+ pendingRequest.onError?.(xhr.status);
+ return;
+ }
+ const chunk = network_getArrayBuffer(xhr);
+ if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
+ const rangeHeader = xhr.getResponseHeader("Content-Range");
+ const matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
+ pendingRequest.onDone({
+ begin: parseInt(matches[1], 10),
+ chunk
+ });
+ } else if (chunk) {
+ pendingRequest.onDone({
+ begin: 0,
+ chunk
+ });
+ } else {
+ pendingRequest.onError?.(xhr.status);
+ }
+ }
+ getRequestXhr(xhrId) {
+ return this.pendingRequests[xhrId].xhr;
+ }
+ isPendingRequest(xhrId) {
+ return xhrId in this.pendingRequests;
+ }
+ abortRequest(xhrId) {
+ const xhr = this.pendingRequests[xhrId].xhr;
+ delete this.pendingRequests[xhrId];
+ xhr.abort();
+ }
+}
+class PDFNetworkStream {
+ constructor(source) {
+ this._source = source;
+ this._manager = new NetworkManager(source);
+ this._rangeChunkSize = source.rangeChunkSize;
+ this._fullRequestReader = null;
+ this._rangeRequestReaders = [];
+ }
+ _onRangeRequestReaderClosed(reader) {
+ const i = this._rangeRequestReaders.indexOf(reader);
+ if (i >= 0) {
+ this._rangeRequestReaders.splice(i, 1);
+ }
+ }
+ getFullReader() {
+ assert(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
+ this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
+ return this._fullRequestReader;
+ }
+ getRangeReader(begin, end) {
+ const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
+ reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
+ this._rangeRequestReaders.push(reader);
+ return reader;
+ }
+ cancelAllRequests(reason) {
+ this._fullRequestReader?.cancel(reason);
+ for (const reader of this._rangeRequestReaders.slice(0)) {
+ reader.cancel(reason);
+ }
+ }
+}
+class PDFNetworkStreamFullRequestReader {
+ constructor(manager, source) {
+ this._manager = manager;
+ const args = {
+ onHeadersReceived: this._onHeadersReceived.bind(this),
+ onDone: this._onDone.bind(this),
+ onError: this._onError.bind(this),
+ onProgress: this._onProgress.bind(this)
+ };
+ this._url = source.url;
+ this._fullRequestId = manager.requestFull(args);
+ this._headersCapability = Promise.withResolvers();
+ this._disableRange = source.disableRange || false;
+ this._contentLength = source.length;
+ this._rangeChunkSize = source.rangeChunkSize;
+ if (!this._rangeChunkSize && !this._disableRange) {
+ this._disableRange = true;
+ }
+ this._isStreamingSupported = false;
+ this._isRangeSupported = false;
+ this._cachedChunks = [];
+ this._requests = [];
+ this._done = false;
+ this._storedError = undefined;
+ this._filename = null;
+ this.onProgress = null;
+ }
+ _onHeadersReceived() {
+ const fullRequestXhrId = this._fullRequestId;
+ const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
+ this._manager._responseOrigin = getResponseOrigin(fullRequestXhr.responseURL);
+ const rawResponseHeaders = fullRequestXhr.getAllResponseHeaders();
+ const responseHeaders = new Headers(rawResponseHeaders ? rawResponseHeaders.trim().split(/[\r\n]+/).map(x => {
+ const [key, ...val] = x.split(": ");
+ return [key, val.join(": ")];
+ }) : []);
+ const {
+ allowRangeRequests,
+ suggestedLength
+ } = validateRangeRequestCapabilities({
+ responseHeaders,
+ isHttp: this._manager.isHttp,
+ rangeChunkSize: this._rangeChunkSize,
+ disableRange: this._disableRange
+ });
+ if (allowRangeRequests) {
+ this._isRangeSupported = true;
+ }
+ this._contentLength = suggestedLength || this._contentLength;
+ this._filename = extractFilenameFromHeader(responseHeaders);
+ if (this._isRangeSupported) {
+ this._manager.abortRequest(fullRequestXhrId);
+ }
+ this._headersCapability.resolve();
+ }
+ _onDone(data) {
+ if (data) {
+ if (this._requests.length > 0) {
+ const requestCapability = this._requests.shift();
+ requestCapability.resolve({
+ value: data.chunk,
+ done: false
+ });
+ } else {
+ this._cachedChunks.push(data.chunk);
+ }
+ }
+ this._done = true;
+ if (this._cachedChunks.length > 0) {
+ return;
+ }
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ }
+ _onError(status) {
+ this._storedError = createResponseStatusError(status, this._url);
+ this._headersCapability.reject(this._storedError);
+ for (const requestCapability of this._requests) {
+ requestCapability.reject(this._storedError);
+ }
+ this._requests.length = 0;
+ this._cachedChunks.length = 0;
+ }
+ _onProgress(evt) {
+ this.onProgress?.({
+ loaded: evt.loaded,
+ total: evt.lengthComputable ? evt.total : this._contentLength
+ });
+ }
+ get filename() {
+ return this._filename;
+ }
+ get isRangeSupported() {
+ return this._isRangeSupported;
+ }
+ get isStreamingSupported() {
+ return this._isStreamingSupported;
+ }
+ get contentLength() {
+ return this._contentLength;
+ }
+ get headersReady() {
+ return this._headersCapability.promise;
+ }
+ async read() {
+ await this._headersCapability.promise;
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ if (this._cachedChunks.length > 0) {
+ const chunk = this._cachedChunks.shift();
+ return {
+ value: chunk,
+ done: false
+ };
+ }
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ const requestCapability = Promise.withResolvers();
+ this._requests.push(requestCapability);
+ return requestCapability.promise;
+ }
+ cancel(reason) {
+ this._done = true;
+ this._headersCapability.reject(reason);
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ if (this._manager.isPendingRequest(this._fullRequestId)) {
+ this._manager.abortRequest(this._fullRequestId);
+ }
+ this._fullRequestReader = null;
+ }
+}
+class PDFNetworkStreamRangeRequestReader {
+ constructor(manager, begin, end) {
+ this._manager = manager;
+ const args = {
+ onHeadersReceived: this._onHeadersReceived.bind(this),
+ onDone: this._onDone.bind(this),
+ onError: this._onError.bind(this),
+ onProgress: this._onProgress.bind(this)
+ };
+ this._url = manager.url;
+ this._requestId = manager.requestRange(begin, end, args);
+ this._requests = [];
+ this._queuedChunk = null;
+ this._done = false;
+ this._storedError = undefined;
+ this.onProgress = null;
+ this.onClosed = null;
+ }
+ _onHeadersReceived() {
+ const responseOrigin = getResponseOrigin(this._manager.getRequestXhr(this._requestId)?.responseURL);
+ if (responseOrigin !== this._manager._responseOrigin) {
+ this._storedError = new Error(`Expected range response-origin "${responseOrigin}" to match "${this._manager._responseOrigin}".`);
+ this._onError(0);
+ }
+ }
+ _close() {
+ this.onClosed?.(this);
+ }
+ _onDone(data) {
+ const chunk = data.chunk;
+ if (this._requests.length > 0) {
+ const requestCapability = this._requests.shift();
+ requestCapability.resolve({
+ value: chunk,
+ done: false
+ });
+ } else {
+ this._queuedChunk = chunk;
+ }
+ this._done = true;
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ this._close();
+ }
+ _onError(status) {
+ this._storedError ??= createResponseStatusError(status, this._url);
+ for (const requestCapability of this._requests) {
+ requestCapability.reject(this._storedError);
+ }
+ this._requests.length = 0;
+ this._queuedChunk = null;
+ }
+ _onProgress(evt) {
+ if (!this.isStreamingSupported) {
+ this.onProgress?.({
+ loaded: evt.loaded
+ });
+ }
+ }
+ get isStreamingSupported() {
+ return false;
+ }
+ async read() {
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ if (this._queuedChunk !== null) {
+ const chunk = this._queuedChunk;
+ this._queuedChunk = null;
+ return {
+ value: chunk,
+ done: false
+ };
+ }
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ const requestCapability = Promise.withResolvers();
+ this._requests.push(requestCapability);
+ return requestCapability.promise;
+ }
+ cancel(reason) {
+ this._done = true;
+ for (const requestCapability of this._requests) {
+ requestCapability.resolve({
+ value: undefined,
+ done: true
+ });
+ }
+ this._requests.length = 0;
+ if (this._manager.isPendingRequest(this._requestId)) {
+ this._manager.abortRequest(this._requestId);
+ }
+ this._close();
+ }
+}
+
+;// ./src/display/node_stream.js
+
+const urlRegex = /^[a-z][a-z0-9\-+.]+:/i;
+function parseUrlOrPath(sourceUrl) {
+ if (urlRegex.test(sourceUrl)) {
+ return new URL(sourceUrl);
+ }
+ const url = process.getBuiltinModule("url");
+ return new URL(url.pathToFileURL(sourceUrl));
+}
+class PDFNodeStream {
+ constructor(source) {
+ this.source = source;
+ this.url = parseUrlOrPath(source.url);
+ assert(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs.");
+ this._fullRequestReader = null;
+ this._rangeRequestReaders = [];
+ }
+ get _progressiveDataLength() {
+ return this._fullRequestReader?._loaded ?? 0;
+ }
+ getFullReader() {
+ assert(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
+ this._fullRequestReader = new PDFNodeStreamFsFullReader(this);
+ return this._fullRequestReader;
+ }
+ getRangeReader(start, end) {
+ if (end <= this._progressiveDataLength) {
+ return null;
+ }
+ const rangeReader = new PDFNodeStreamFsRangeReader(this, start, end);
+ this._rangeRequestReaders.push(rangeReader);
+ return rangeReader;
+ }
+ cancelAllRequests(reason) {
+ this._fullRequestReader?.cancel(reason);
+ for (const reader of this._rangeRequestReaders.slice(0)) {
+ reader.cancel(reason);
+ }
+ }
+}
+class PDFNodeStreamFsFullReader {
+ constructor(stream) {
+ this._url = stream.url;
+ this._done = false;
+ this._storedError = null;
+ this.onProgress = null;
+ const source = stream.source;
+ this._contentLength = source.length;
+ this._loaded = 0;
+ this._filename = null;
+ this._disableRange = source.disableRange || false;
+ this._rangeChunkSize = source.rangeChunkSize;
+ if (!this._rangeChunkSize && !this._disableRange) {
+ this._disableRange = true;
+ }
+ this._isStreamingSupported = !source.disableStream;
+ this._isRangeSupported = !source.disableRange;
+ this._readableStream = null;
+ this._readCapability = Promise.withResolvers();
+ this._headersCapability = Promise.withResolvers();
+ const fs = process.getBuiltinModule("fs");
+ fs.promises.lstat(this._url).then(stat => {
+ this._contentLength = stat.size;
+ this._setReadableStream(fs.createReadStream(this._url));
+ this._headersCapability.resolve();
+ }, error => {
+ if (error.code === "ENOENT") {
+ error = new MissingPDFException(`Missing PDF "${this._url}".`);
+ }
+ this._storedError = error;
+ this._headersCapability.reject(error);
+ });
+ }
+ get headersReady() {
+ return this._headersCapability.promise;
+ }
+ get filename() {
+ return this._filename;
+ }
+ get contentLength() {
+ return this._contentLength;
+ }
+ get isRangeSupported() {
+ return this._isRangeSupported;
+ }
+ get isStreamingSupported() {
+ return this._isStreamingSupported;
+ }
+ async read() {
+ await this._readCapability.promise;
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ const chunk = this._readableStream.read();
+ if (chunk === null) {
+ this._readCapability = Promise.withResolvers();
+ return this.read();
+ }
+ this._loaded += chunk.length;
+ this.onProgress?.({
+ loaded: this._loaded,
+ total: this._contentLength
+ });
+ const buffer = new Uint8Array(chunk).buffer;
+ return {
+ value: buffer,
+ 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._isStreamingSupported && this._isRangeSupported) {
+ this._error(new AbortException("streaming is disabled"));
+ }
+ if (this._storedError) {
+ this._readableStream.destroy(this._storedError);
+ }
+ }
+}
+class PDFNodeStreamFsRangeReader {
+ constructor(stream, start, end) {
+ this._url = stream.url;
+ this._done = false;
+ this._storedError = null;
+ this.onProgress = null;
+ this._loaded = 0;
+ this._readableStream = null;
+ this._readCapability = Promise.withResolvers();
+ const source = stream.source;
+ this._isStreamingSupported = !source.disableStream;
+ const fs = process.getBuiltinModule("fs");
+ this._setReadableStream(fs.createReadStream(this._url, {
+ start,
+ end: end - 1
+ }));
+ }
+ get isStreamingSupported() {
+ return this._isStreamingSupported;
+ }
+ async read() {
+ await this._readCapability.promise;
+ if (this._done) {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ if (this._storedError) {
+ throw this._storedError;
+ }
+ const chunk = this._readableStream.read();
+ if (chunk === null) {
+ this._readCapability = Promise.withResolvers();
+ return this.read();
+ }
+ this._loaded += chunk.length;
+ this.onProgress?.({
+ loaded: this._loaded
+ });
+ const buffer = new Uint8Array(chunk).buffer;
+ return {
+ value: buffer,
+ 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);
+ }
+ }
+}
+
+;// ./src/display/text_layer.js
+
+
+const MAX_TEXT_DIVS_TO_RENDER = 100000;
+const DEFAULT_FONT_SIZE = 30;
+const DEFAULT_FONT_ASCENT = 0.8;
+class TextLayer {
+ #capability = Promise.withResolvers();
+ #container = null;
+ #disableProcessItems = false;
+ #fontInspectorEnabled = !!globalThis.FontInspector?.enabled;
+ #lang = null;
+ #layoutTextParams = null;
+ #pageHeight = 0;
+ #pageWidth = 0;
+ #reader = null;
+ #rootContainer = null;
+ #rotation = 0;
+ #scale = 0;
+ #styleCache = Object.create(null);
+ #textContentItemsStr = [];
+ #textContentSource = null;
+ #textDivs = [];
+ #textDivProperties = new WeakMap();
+ #transform = null;
+ static #ascentCache = new Map();
+ static #canvasContexts = new Map();
+ static #canvasCtxFonts = new WeakMap();
+ static #minFontSize = null;
+ static #pendingTextLayers = new Set();
+ constructor({
+ textContentSource,
+ container,
+ viewport
+ }) {
+ if (textContentSource instanceof ReadableStream) {
+ this.#textContentSource = textContentSource;
+ } else if (typeof textContentSource === "object") {
+ this.#textContentSource = new ReadableStream({
+ start(controller) {
+ controller.enqueue(textContentSource);
+ controller.close();
+ }
+ });
+ } else {
+ throw new Error('No "textContentSource" parameter specified.');
+ }
+ this.#container = this.#rootContainer = container;
+ this.#scale = viewport.scale * (globalThis.devicePixelRatio || 1);
+ this.#rotation = viewport.rotation;
+ this.#layoutTextParams = {
+ div: null,
+ properties: null,
+ ctx: null
+ };
+ const {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ } = viewport.rawDims;
+ this.#transform = [1, 0, 0, -1, -pageX, pageY + pageHeight];
+ this.#pageWidth = pageWidth;
+ this.#pageHeight = pageHeight;
+ TextLayer.#ensureMinFontSizeComputed();
+ setLayerDimensions(container, viewport);
+ this.#capability.promise.finally(() => {
+ TextLayer.#pendingTextLayers.delete(this);
+ this.#layoutTextParams = null;
+ this.#styleCache = null;
+ }).catch(() => {});
+ }
+ static get fontFamilyMap() {
+ const {
+ isWindows,
+ isFirefox
+ } = util_FeatureTest.platform;
+ return shadow(this, "fontFamilyMap", new Map([["sans-serif", `${isWindows && isFirefox ? "Calibri, " : ""}sans-serif`], ["monospace", `${isWindows && isFirefox ? "Lucida Console, " : ""}monospace`]]));
+ }
+ render() {
+ const pump = () => {
+ this.#reader.read().then(({
+ value,
+ done
+ }) => {
+ if (done) {
+ this.#capability.resolve();
+ return;
+ }
+ this.#lang ??= value.lang;
+ Object.assign(this.#styleCache, value.styles);
+ this.#processItems(value.items);
+ pump();
+ }, this.#capability.reject);
+ };
+ this.#reader = this.#textContentSource.getReader();
+ TextLayer.#pendingTextLayers.add(this);
+ pump();
+ return this.#capability.promise;
+ }
+ update({
+ viewport,
+ onBefore = null
+ }) {
+ const scale = viewport.scale * (globalThis.devicePixelRatio || 1);
+ const rotation = viewport.rotation;
+ if (rotation !== this.#rotation) {
+ onBefore?.();
+ this.#rotation = rotation;
+ setLayerDimensions(this.#rootContainer, {
+ rotation
+ });
+ }
+ if (scale !== this.#scale) {
+ onBefore?.();
+ this.#scale = scale;
+ const params = {
+ div: null,
+ properties: null,
+ ctx: TextLayer.#getCtx(this.#lang)
+ };
+ for (const div of this.#textDivs) {
+ params.properties = this.#textDivProperties.get(div);
+ params.div = div;
+ this.#layout(params);
+ }
+ }
+ }
+ cancel() {
+ const abortEx = new AbortException("TextLayer task cancelled.");
+ this.#reader?.cancel(abortEx).catch(() => {});
+ this.#reader = null;
+ this.#capability.reject(abortEx);
+ }
+ get textDivs() {
+ return this.#textDivs;
+ }
+ get textContentItemsStr() {
+ return this.#textContentItemsStr;
+ }
+ #processItems(items) {
+ if (this.#disableProcessItems) {
+ return;
+ }
+ this.#layoutTextParams.ctx ??= TextLayer.#getCtx(this.#lang);
+ const textDivs = this.#textDivs,
+ textContentItemsStr = this.#textContentItemsStr;
+ for (const item of items) {
+ if (textDivs.length > MAX_TEXT_DIVS_TO_RENDER) {
+ warn("Ignoring additional textDivs for performance reasons.");
+ this.#disableProcessItems = true;
+ return;
+ }
+ if (item.str === undefined) {
+ if (item.type === "beginMarkedContentProps" || item.type === "beginMarkedContent") {
+ const parent = this.#container;
+ this.#container = document.createElement("span");
+ this.#container.classList.add("markedContent");
+ if (item.id !== null) {
+ this.#container.setAttribute("id", `${item.id}`);
+ }
+ parent.append(this.#container);
+ } else if (item.type === "endMarkedContent") {
+ this.#container = this.#container.parentNode;
+ }
+ continue;
+ }
+ textContentItemsStr.push(item.str);
+ this.#appendText(item);
+ }
+ }
+ #appendText(geom) {
+ const textDiv = document.createElement("span");
+ const textDivProperties = {
+ angle: 0,
+ canvasWidth: 0,
+ hasText: geom.str !== "",
+ hasEOL: geom.hasEOL,
+ fontSize: 0
+ };
+ this.#textDivs.push(textDiv);
+ const tx = Util.transform(this.#transform, geom.transform);
+ let angle = Math.atan2(tx[1], tx[0]);
+ const style = this.#styleCache[geom.fontName];
+ if (style.vertical) {
+ angle += Math.PI / 2;
+ }
+ let fontFamily = this.#fontInspectorEnabled && style.fontSubstitution || style.fontFamily;
+ fontFamily = TextLayer.fontFamilyMap.get(fontFamily) || fontFamily;
+ const fontHeight = Math.hypot(tx[2], tx[3]);
+ const fontAscent = fontHeight * TextLayer.#getAscent(fontFamily, this.#lang);
+ let left, top;
+ if (angle === 0) {
+ left = tx[4];
+ top = tx[5] - fontAscent;
+ } else {
+ left = tx[4] + fontAscent * Math.sin(angle);
+ top = tx[5] - fontAscent * Math.cos(angle);
+ }
+ const scaleFactorStr = "calc(var(--scale-factor)*";
+ const divStyle = textDiv.style;
+ if (this.#container === this.#rootContainer) {
+ divStyle.left = `${(100 * left / this.#pageWidth).toFixed(2)}%`;
+ divStyle.top = `${(100 * top / this.#pageHeight).toFixed(2)}%`;
+ } else {
+ divStyle.left = `${scaleFactorStr}${left.toFixed(2)}px)`;
+ divStyle.top = `${scaleFactorStr}${top.toFixed(2)}px)`;
+ }
+ divStyle.fontSize = `${scaleFactorStr}${(TextLayer.#minFontSize * fontHeight).toFixed(2)}px)`;
+ divStyle.fontFamily = fontFamily;
+ textDivProperties.fontSize = fontHeight;
+ textDiv.setAttribute("role", "presentation");
+ textDiv.textContent = geom.str;
+ textDiv.dir = geom.dir;
+ if (this.#fontInspectorEnabled) {
+ textDiv.dataset.fontName = style.fontSubstitutionLoadedName || geom.fontName;
+ }
+ if (angle !== 0) {
+ textDivProperties.angle = angle * (180 / Math.PI);
+ }
+ let shouldScaleText = false;
+ if (geom.str.length > 1) {
+ shouldScaleText = true;
+ } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
+ const absScaleX = Math.abs(geom.transform[0]),
+ absScaleY = Math.abs(geom.transform[3]);
+ if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
+ shouldScaleText = true;
+ }
+ }
+ if (shouldScaleText) {
+ textDivProperties.canvasWidth = style.vertical ? geom.height : geom.width;
+ }
+ this.#textDivProperties.set(textDiv, textDivProperties);
+ this.#layoutTextParams.div = textDiv;
+ this.#layoutTextParams.properties = textDivProperties;
+ this.#layout(this.#layoutTextParams);
+ if (textDivProperties.hasText) {
+ this.#container.append(textDiv);
+ }
+ if (textDivProperties.hasEOL) {
+ const br = document.createElement("br");
+ br.setAttribute("role", "presentation");
+ this.#container.append(br);
+ }
+ }
+ #layout(params) {
+ const {
+ div,
+ properties,
+ ctx
+ } = params;
+ const {
+ style
+ } = div;
+ let transform = "";
+ if (TextLayer.#minFontSize > 1) {
+ transform = `scale(${1 / TextLayer.#minFontSize})`;
+ }
+ if (properties.canvasWidth !== 0 && properties.hasText) {
+ const {
+ fontFamily
+ } = style;
+ const {
+ canvasWidth,
+ fontSize
+ } = properties;
+ TextLayer.#ensureCtxFont(ctx, fontSize * this.#scale, fontFamily);
+ const {
+ width
+ } = ctx.measureText(div.textContent);
+ if (width > 0) {
+ transform = `scaleX(${canvasWidth * this.#scale / width}) ${transform}`;
+ }
+ }
+ if (properties.angle !== 0) {
+ transform = `rotate(${properties.angle}deg) ${transform}`;
+ }
+ if (transform.length > 0) {
+ style.transform = transform;
+ }
+ }
+ static cleanup() {
+ if (this.#pendingTextLayers.size > 0) {
+ return;
+ }
+ this.#ascentCache.clear();
+ for (const {
+ canvas
+ } of this.#canvasContexts.values()) {
+ canvas.remove();
+ }
+ this.#canvasContexts.clear();
+ }
+ static #getCtx(lang = null) {
+ let ctx = this.#canvasContexts.get(lang ||= "");
+ if (!ctx) {
+ const canvas = document.createElement("canvas");
+ canvas.className = "hiddenCanvasElement";
+ canvas.lang = lang;
+ document.body.append(canvas);
+ ctx = canvas.getContext("2d", {
+ alpha: false,
+ willReadFrequently: true
+ });
+ this.#canvasContexts.set(lang, ctx);
+ this.#canvasCtxFonts.set(ctx, {
+ size: 0,
+ family: ""
+ });
+ }
+ return ctx;
+ }
+ static #ensureCtxFont(ctx, size, family) {
+ const cached = this.#canvasCtxFonts.get(ctx);
+ if (size === cached.size && family === cached.family) {
+ return;
+ }
+ ctx.font = `${size}px ${family}`;
+ cached.size = size;
+ cached.family = family;
+ }
+ static #ensureMinFontSizeComputed() {
+ if (this.#minFontSize !== null) {
+ return;
+ }
+ const div = document.createElement("div");
+ div.style.opacity = 0;
+ div.style.lineHeight = 1;
+ div.style.fontSize = "1px";
+ div.style.position = "absolute";
+ div.textContent = "X";
+ document.body.append(div);
+ this.#minFontSize = div.getBoundingClientRect().height;
+ div.remove();
+ }
+ static #getAscent(fontFamily, lang) {
+ const cachedAscent = this.#ascentCache.get(fontFamily);
+ if (cachedAscent) {
+ return cachedAscent;
+ }
+ const ctx = this.#getCtx(lang);
+ ctx.canvas.width = ctx.canvas.height = DEFAULT_FONT_SIZE;
+ this.#ensureCtxFont(ctx, DEFAULT_FONT_SIZE, fontFamily);
+ const metrics = ctx.measureText("");
+ let ascent = metrics.fontBoundingBoxAscent;
+ let descent = Math.abs(metrics.fontBoundingBoxDescent);
+ if (ascent) {
+ const ratio = ascent / (ascent + descent);
+ this.#ascentCache.set(fontFamily, ratio);
+ ctx.canvas.width = ctx.canvas.height = 0;
+ return ratio;
+ }
+ ctx.strokeStyle = "red";
+ ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
+ ctx.strokeText("g", 0, 0);
+ let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
+ descent = 0;
+ for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
+ if (pixels[i] > 0) {
+ descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
+ break;
+ }
+ }
+ ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
+ ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
+ pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
+ ascent = 0;
+ for (let i = 0, ii = pixels.length; i < ii; i += 4) {
+ if (pixels[i] > 0) {
+ ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);
+ break;
+ }
+ }
+ ctx.canvas.width = ctx.canvas.height = 0;
+ const ratio = ascent ? ascent / (ascent + descent) : DEFAULT_FONT_ASCENT;
+ this.#ascentCache.set(fontFamily, ratio);
+ return ratio;
+ }
+}
+
+;// ./src/display/xfa_text.js
+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");
+ }
+}
+
+;// ./src/display/api.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const DEFAULT_RANGE_CHUNK_SIZE = 65536;
+const RENDERING_CANCELLED_TIMEOUT = 100;
+const DELAYED_CLEANUP_TIMEOUT = 5000;
+const DefaultCanvasFactory = isNodeJS ? NodeCanvasFactory : DOMCanvasFactory;
+const DefaultCMapReaderFactory = isNodeJS ? NodeCMapReaderFactory : DOMCMapReaderFactory;
+const DefaultFilterFactory = isNodeJS ? NodeFilterFactory : DOMFilterFactory;
+const DefaultStandardFontDataFactory = isNodeJS ? NodeStandardFontDataFactory : DOMStandardFontDataFactory;
+function getDocument(src = {}) {
+ if (typeof src === "string" || src instanceof URL) {
+ src = {
+ url: src
+ };
+ } else if (src instanceof ArrayBuffer || ArrayBuffer.isView(src)) {
+ src = {
+ data: src
+ };
+ }
+ const task = new PDFDocumentLoadingTask();
+ 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" && !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 : !isNodeJS;
+ const isImageDecoderSupported = typeof src.isImageDecoderSupported === "boolean" ? src.isImageDecoderSupported : !isNodeJS && (util_FeatureTest.platform.isFirefox || !globalThis.chrome);
+ const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes) ? src.canvasMaxAreaInBytes : -1;
+ const disableFontFace = typeof src.disableFontFace === "boolean" ? src.disableFontFace : 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 CanvasFactory = src.CanvasFactory || DefaultCanvasFactory;
+ const FilterFactory = src.FilterFactory || DefaultFilterFactory;
+ const enableHWA = src.enableHWA === true;
+ const length = rangeTransport ? rangeTransport.length : src.length ?? NaN;
+ const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !isNodeJS && !disableFontFace;
+ const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : CMapReaderFactory === DOMCMapReaderFactory && StandardFontDataFactory === DOMStandardFontDataFactory && cMapUrl && standardFontDataUrl && isValidFetchUrl(cMapUrl, document.baseURI) && isValidFetchUrl(standardFontDataUrl, document.baseURI);
+ if (src.canvasFactory) {
+ deprecated("`canvasFactory`-instance option, please use `CanvasFactory` instead.");
+ }
+ if (src.filterFactory) {
+ deprecated("`filterFactory`-instance option, please use `FilterFactory` instead.");
+ }
+ const styleElement = null;
+ setVerbosityLevel(verbosity);
+ const transportFactory = {
+ canvasFactory: new CanvasFactory({
+ ownerDocument,
+ enableHWA
+ }),
+ filterFactory: new FilterFactory({
+ docId,
+ ownerDocument
+ }),
+ cMapReaderFactory: useWorkerFetch ? null : new CMapReaderFactory({
+ baseUrl: cMapUrl,
+ isCompressed: cMapPacked
+ }),
+ standardFontDataFactory: useWorkerFetch ? null : new StandardFontDataFactory({
+ baseUrl: standardFontDataUrl
+ })
+ };
+ if (!worker) {
+ const workerParams = {
+ verbosity,
+ port: GlobalWorkerOptions.workerPort
+ };
+ worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
+ task._worker = worker;
+ }
+ const docParams = {
+ docId,
+ apiVersion: "4.9.155",
+ data,
+ password,
+ disableAutoFetch,
+ rangeChunkSize,
+ length,
+ docBaseUrl,
+ enableXfa,
+ evaluatorOptions: {
+ maxImageSize,
+ disableFontFace,
+ ignoreErrors,
+ isEvalSupported,
+ isOffscreenCanvasSupported,
+ isImageDecoderSupported,
+ canvasMaxAreaInBytes,
+ fontExtraProperties,
+ useSystemFonts,
+ cMapUrl: useWorkerFetch ? cMapUrl : null,
+ standardFontDataUrl: useWorkerFetch ? standardFontDataUrl : null
+ }
+ };
+ const transportParams = {
+ disableFontFace,
+ fontExtraProperties,
+ ownerDocument,
+ pdfBug,
+ styleElement,
+ loadingParams: {
+ disableAutoFetch,
+ enableXfa
+ }
+ };
+ worker.promise.then(function () {
+ if (task.destroyed) {
+ throw new Error("Loading aborted");
+ }
+ if (worker.destroyed) {
+ throw new Error("Worker was destroyed");
+ }
+ const workerIdPromise = worker.messageHandler.sendWithPromise("GetDocRequest", docParams, data ? [data.buffer] : null);
+ let networkStream;
+ if (rangeTransport) {
+ networkStream = new PDFDataTransportStream(rangeTransport, {
+ disableRange,
+ disableStream
+ });
+ } else if (!data) {
+ if (!url) {
+ throw new Error("getDocument - no `url` parameter provided.");
+ }
+ let NetworkStream;
+ if (isNodeJS) {
+ if (isValidFetchUrl(url)) {
+ if (typeof fetch === "undefined" || typeof Response === "undefined" || !("body" in Response.prototype)) {
+ throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");
+ }
+ NetworkStream = PDFFetchStream;
+ } else {
+ NetworkStream = PDFNodeStream;
+ }
+ } else {
+ NetworkStream = isValidFetchUrl(url) ? PDFFetchStream : PDFNetworkStream;
+ }
+ networkStream = new NetworkStream({
+ url,
+ length,
+ httpHeaders,
+ withCredentials,
+ rangeChunkSize,
+ disableRange,
+ disableStream
+ });
+ }
+ return workerIdPromise.then(workerId => {
+ if (task.destroyed) {
+ throw new Error("Loading aborted");
+ }
+ if (worker.destroyed) {
+ throw new Error("Worker was destroyed");
+ }
+ const messageHandler = new MessageHandler(docId, workerId, worker.port);
+ const transport = new WorkerTransport(messageHandler, task, networkStream, transportParams, transportFactory);
+ task._transport = transport;
+ messageHandler.send("Ready", null);
+ });
+ }).catch(task._capability.reject);
+ return task;
+}
+function getUrlProp(val) {
+ if (val instanceof URL) {
+ return val.href;
+ }
+ try {
+ return new URL(val, window.location).href;
+ } catch {
+ if (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 (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 stringToBytes(val);
+ }
+ if (val instanceof ArrayBuffer || ArrayBuffer.isView(val) || typeof val === "object" && !isNaN(val?.length)) {
+ return new Uint8Array(val);
+ }
+ throw new Error("Invalid PDF binary data: either TypedArray, " + "string, or array-like object is expected in the data property.");
+}
+function isRefProxy(ref) {
+ return typeof ref === "object" && Number.isInteger(ref?.num) && ref.num >= 0 && Number.isInteger(ref?.gen) && ref.gen >= 0;
+}
+class PDFDocumentLoadingTask {
+ static #docId = 0;
+ constructor() {
+ this._capability = Promise.withResolvers();
+ this._transport = null;
+ this._worker = null;
+ this.docId = `d${PDFDocumentLoadingTask.#docId++}`;
+ this.destroyed = false;
+ this.onPassword = null;
+ this.onProgress = null;
+ }
+ get promise() {
+ return this._capability.promise;
+ }
+ async destroy() {
+ this.destroyed = true;
+ 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;
+ this._worker?.destroy();
+ this._worker = null;
+ }
+}
+class PDFDataRangeTransport {
+ constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) {
+ this.length = length;
+ this.initialData = initialData;
+ this.progressiveDone = progressiveDone;
+ this.contentDispositionFilename = contentDispositionFilename;
+ this._rangeListeners = [];
+ this._progressListeners = [];
+ this._progressiveReadListeners = [];
+ this._progressiveDoneListeners = [];
+ this._readyCapability = Promise.withResolvers();
+ }
+ addRangeListener(listener) {
+ this._rangeListeners.push(listener);
+ }
+ addProgressListener(listener) {
+ this._progressListeners.push(listener);
+ }
+ addProgressiveReadListener(listener) {
+ this._progressiveReadListeners.push(listener);
+ }
+ addProgressiveDoneListener(listener) {
+ this._progressiveDoneListeners.push(listener);
+ }
+ onDataRange(begin, chunk) {
+ for (const listener of this._rangeListeners) {
+ listener(begin, chunk);
+ }
+ }
+ onDataProgress(loaded, total) {
+ this._readyCapability.promise.then(() => {
+ for (const listener of this._progressListeners) {
+ listener(loaded, total);
+ }
+ });
+ }
+ onDataProgressiveRead(chunk) {
+ this._readyCapability.promise.then(() => {
+ for (const listener of this._progressiveReadListeners) {
+ listener(chunk);
+ }
+ });
+ }
+ onDataProgressiveDone() {
+ this._readyCapability.promise.then(() => {
+ for (const listener of this._progressiveDoneListeners) {
+ listener();
+ }
+ });
+ }
+ transportReady() {
+ this._readyCapability.resolve();
+ }
+ requestDataRange(begin, end) {
+ unreachable("Abstract method PDFDataRangeTransport.requestDataRange");
+ }
+ abort() {}
+}
+class PDFDocumentProxy {
+ constructor(pdfInfo, transport) {
+ this._pdfInfo = pdfInfo;
+ this._transport = transport;
+ }
+ get annotationStorage() {
+ return this._transport.annotationStorage;
+ }
+ get canvasFactory() {
+ return this._transport.canvasFactory;
+ }
+ get filterFactory() {
+ return this._transport.filterFactory;
+ }
+ get numPages() {
+ return this._pdfInfo.numPages;
+ }
+ get fingerprints() {
+ return this._pdfInfo.fingerprints;
+ }
+ get isPureXfa() {
+ return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
+ }
+ get allXfaHtml() {
+ return this._transport._htmlForXfa;
+ }
+ getPage(pageNumber) {
+ return this._transport.getPage(pageNumber);
+ }
+ getPageIndex(ref) {
+ return this._transport.getPageIndex(ref);
+ }
+ getDestinations() {
+ return this._transport.getDestinations();
+ }
+ getDestination(id) {
+ return this._transport.getDestination(id);
+ }
+ getPageLabels() {
+ return this._transport.getPageLabels();
+ }
+ getPageLayout() {
+ return this._transport.getPageLayout();
+ }
+ getPageMode() {
+ return this._transport.getPageMode();
+ }
+ getViewerPreferences() {
+ return this._transport.getViewerPreferences();
+ }
+ getOpenAction() {
+ return this._transport.getOpenAction();
+ }
+ getAttachments() {
+ return this._transport.getAttachments();
+ }
+ getJSActions() {
+ return this._transport.getDocJSActions();
+ }
+ getOutline() {
+ return this._transport.getOutline();
+ }
+ getOptionalContentConfig({
+ intent = "display"
+ } = {}) {
+ const {
+ renderingIntent
+ } = this._transport.getRenderingIntent(intent);
+ return this._transport.getOptionalContentConfig(renderingIntent);
+ }
+ getPermissions() {
+ return this._transport.getPermissions();
+ }
+ getMetadata() {
+ return this._transport.getMetadata();
+ }
+ getMarkInfo() {
+ return this._transport.getMarkInfo();
+ }
+ getData() {
+ return this._transport.getData();
+ }
+ saveDocument() {
+ return this._transport.saveDocument();
+ }
+ getDownloadInfo() {
+ return this._transport.downloadInfoCapability.promise;
+ }
+ cleanup(keepLoadedFonts = false) {
+ return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
+ }
+ destroy() {
+ return this.loadingTask.destroy();
+ }
+ cachedPageNumber(ref) {
+ return this._transport.cachedPageNumber(ref);
+ }
+ get loadingParams() {
+ return this._transport.loadingParams;
+ }
+ get loadingTask() {
+ return this._transport.loadingTask;
+ }
+ getFieldObjects() {
+ return this._transport.getFieldObjects();
+ }
+ hasJSActions() {
+ return this._transport.hasJSActions();
+ }
+ getCalculationOrderIds() {
+ return this._transport.getCalculationOrderIds();
+ }
+}
+class PDFPageProxy {
+ #delayedCleanupTimeout = null;
+ #pendingCleanup = false;
+ constructor(pageIndex, pageInfo, transport, pdfBug = false) {
+ this._pageIndex = pageIndex;
+ this._pageInfo = pageInfo;
+ this._transport = transport;
+ this._stats = pdfBug ? new StatTimer() : null;
+ this._pdfBug = pdfBug;
+ this.commonObjs = transport.commonObjs;
+ this.objs = new PDFObjects();
+ this._maybeCleanupAfterRender = false;
+ this._intentStates = new Map();
+ this.destroyed = false;
+ }
+ get pageNumber() {
+ return this._pageIndex + 1;
+ }
+ get rotate() {
+ return this._pageInfo.rotate;
+ }
+ get ref() {
+ return this._pageInfo.ref;
+ }
+ get userUnit() {
+ return this._pageInfo.userUnit;
+ }
+ get view() {
+ return this._pageInfo.view;
+ }
+ getViewport({
+ scale,
+ rotation = this.rotate,
+ offsetX = 0,
+ offsetY = 0,
+ dontFlip = false
+ } = {}) {
+ return new PageViewport({
+ viewBox: this.view,
+ scale,
+ rotation,
+ offsetX,
+ offsetY,
+ dontFlip
+ });
+ }
+ getAnnotations({
+ intent = "display"
+ } = {}) {
+ const {
+ renderingIntent
+ } = this._transport.getRenderingIntent(intent);
+ return this._transport.getAnnotations(this._pageIndex, renderingIntent);
+ }
+ getJSActions() {
+ return this._transport.getPageJSActions(this._pageIndex);
+ }
+ get filterFactory() {
+ return this._transport.filterFactory;
+ }
+ get isPureXfa() {
+ return shadow(this, "isPureXfa", !!this._transport._htmlForXfa);
+ }
+ async getXfa() {
+ return this._transport._htmlForXfa?.children[this._pageIndex] || null;
+ }
+ render({
+ canvasContext,
+ viewport,
+ intent = "display",
+ annotationMode = AnnotationMode.ENABLE,
+ transform = null,
+ background = null,
+ optionalContentConfigPromise = null,
+ annotationCanvasMap = null,
+ pageColors = null,
+ printAnnotationStorage = null,
+ isEditing = false
+ }) {
+ this._stats?.time("Overall");
+ const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing);
+ const {
+ renderingIntent,
+ cacheKey
+ } = intentArgs;
+ this.#pendingCleanup = false;
+ this.#abortDelayedCleanup();
+ optionalContentConfigPromise ||= this._transport.getOptionalContentConfig(renderingIntent);
+ let intentState = this._intentStates.get(cacheKey);
+ if (!intentState) {
+ intentState = Object.create(null);
+ this._intentStates.set(cacheKey, intentState);
+ }
+ if (intentState.streamReaderCancelTimeout) {
+ clearTimeout(intentState.streamReaderCancelTimeout);
+ intentState.streamReaderCancelTimeout = null;
+ }
+ const intentPrint = !!(renderingIntent & RenderingIntentFlag.PRINT);
+ if (!intentState.displayReadyCapability) {
+ intentState.displayReadyCapability = Promise.withResolvers();
+ intentState.operatorList = {
+ fnArray: [],
+ argsArray: [],
+ lastChunk: false,
+ separateAnnots: null
+ };
+ this._stats?.time("Page Request");
+ this._pumpOperatorList(intentArgs);
+ }
+ const complete = error => {
+ intentState.renderTasks.delete(internalRenderTask);
+ if (this._maybeCleanupAfterRender || intentPrint) {
+ this.#pendingCleanup = true;
+ }
+ this.#tryCleanup(!intentPrint);
+ if (error) {
+ internalRenderTask.capability.reject(error);
+ this._abortOperatorList({
+ intentState,
+ reason: error instanceof Error ? error : new Error(error)
+ });
+ } else {
+ internalRenderTask.capability.resolve();
+ }
+ if (this._stats) {
+ this._stats.timeEnd("Rendering");
+ this._stats.timeEnd("Overall");
+ if (globalThis.Stats?.enabled) {
+ globalThis.Stats.add(this.pageNumber, this._stats);
+ }
+ }
+ };
+ const internalRenderTask = new InternalRenderTask({
+ callback: complete,
+ params: {
+ canvasContext,
+ viewport,
+ transform,
+ background
+ },
+ objs: this.objs,
+ commonObjs: this.commonObjs,
+ annotationCanvasMap,
+ operatorList: intentState.operatorList,
+ pageIndex: this._pageIndex,
+ canvasFactory: this._transport.canvasFactory,
+ filterFactory: this._transport.filterFactory,
+ useRequestAnimationFrame: !intentPrint,
+ pdfBug: this._pdfBug,
+ pageColors
+ });
+ (intentState.renderTasks ||= new Set()).add(internalRenderTask);
+ const renderTask = internalRenderTask.task;
+ Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
+ if (this.destroyed) {
+ complete();
+ return;
+ }
+ this._stats?.time("Rendering");
+ if (!(optionalContentConfig.renderingIntent & renderingIntent)) {
+ throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` " + "and `PDFDocumentProxy.getOptionalContentConfig` methods.");
+ }
+ internalRenderTask.initializeGraphics({
+ transparency,
+ optionalContentConfig
+ });
+ internalRenderTask.operatorListChanged();
+ }).catch(complete);
+ return renderTask;
+ }
+ getOperatorList({
+ intent = "display",
+ annotationMode = AnnotationMode.ENABLE,
+ printAnnotationStorage = null,
+ isEditing = false
+ } = {}) {
+ function operatorListChanged() {
+ if (intentState.operatorList.lastChunk) {
+ intentState.opListReadCapability.resolve(intentState.operatorList);
+ intentState.renderTasks.delete(opListTask);
+ }
+ }
+ const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing, true);
+ let intentState = this._intentStates.get(intentArgs.cacheKey);
+ if (!intentState) {
+ intentState = Object.create(null);
+ this._intentStates.set(intentArgs.cacheKey, intentState);
+ }
+ let opListTask;
+ if (!intentState.opListReadCapability) {
+ opListTask = Object.create(null);
+ opListTask.operatorListChanged = operatorListChanged;
+ intentState.opListReadCapability = Promise.withResolvers();
+ (intentState.renderTasks ||= new Set()).add(opListTask);
+ intentState.operatorList = {
+ fnArray: [],
+ argsArray: [],
+ lastChunk: false,
+ separateAnnots: null
+ };
+ this._stats?.time("Page Request");
+ this._pumpOperatorList(intentArgs);
+ }
+ return intentState.opListReadCapability.promise;
+ }
+ streamTextContent({
+ includeMarkedContent = false,
+ disableNormalization = false
+ } = {}) {
+ const TEXT_CONTENT_CHUNK_SIZE = 100;
+ return this._transport.messageHandler.sendWithStream("GetTextContent", {
+ pageIndex: this._pageIndex,
+ includeMarkedContent: includeMarkedContent === true,
+ disableNormalization: disableNormalization === true
+ }, {
+ highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
+ size(textContent) {
+ return textContent.items.length;
+ }
+ });
+ }
+ getTextContent(params = {}) {
+ if (this._transport._htmlForXfa) {
+ return this.getXfa().then(xfa => XfaText.textContent(xfa));
+ }
+ const readableStream = this.streamTextContent(params);
+ return new Promise(function (resolve, reject) {
+ function pump() {
+ reader.read().then(function ({
+ value,
+ done
+ }) {
+ if (done) {
+ resolve(textContent);
+ return;
+ }
+ textContent.lang ??= value.lang;
+ Object.assign(textContent.styles, value.styles);
+ textContent.items.push(...value.items);
+ pump();
+ }, reject);
+ }
+ const reader = readableStream.getReader();
+ const textContent = {
+ items: [],
+ styles: Object.create(null),
+ lang: null
+ };
+ pump();
+ });
+ }
+ getStructTree() {
+ return this._transport.getStructTree(this._pageIndex);
+ }
+ _destroy() {
+ this.destroyed = true;
+ const waitOn = [];
+ for (const intentState of this._intentStates.values()) {
+ this._abortOperatorList({
+ intentState,
+ reason: new Error("Page was destroyed."),
+ force: true
+ });
+ if (intentState.opListReadCapability) {
+ continue;
+ }
+ for (const internalRenderTask of intentState.renderTasks) {
+ waitOn.push(internalRenderTask.completed);
+ internalRenderTask.cancel();
+ }
+ }
+ this.objs.clear();
+ this.#pendingCleanup = false;
+ this.#abortDelayedCleanup();
+ return Promise.all(waitOn);
+ }
+ cleanup(resetStats = false) {
+ this.#pendingCleanup = true;
+ const success = this.#tryCleanup(false);
+ if (resetStats && success) {
+ this._stats &&= new StatTimer();
+ }
+ return success;
+ }
+ #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 {
+ renderTasks,
+ operatorList
+ } of this._intentStates.values()) {
+ if (renderTasks.size > 0 || !operatorList.lastChunk) {
+ return false;
+ }
+ }
+ this._intentStates.clear();
+ this.objs.clear();
+ 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) {
+ return;
+ }
+ this._stats?.timeEnd("Page Request");
+ intentState.displayReadyCapability?.resolve(transparency);
+ }
+ _renderPageChunk(operatorListChunk, intentState) {
+ for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {
+ intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
+ intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
+ }
+ intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
+ intentState.operatorList.separateAnnots = operatorListChunk.separateAnnots;
+ for (const internalRenderTask of intentState.renderTasks) {
+ internalRenderTask.operatorListChanged();
+ }
+ if (operatorListChunk.lastChunk) {
+ this.#tryCleanup(true);
+ }
+ }
+ _pumpOperatorList({
+ renderingIntent,
+ cacheKey,
+ annotationStorageSerializable,
+ modifiedIds
+ }) {
+ const {
+ map,
+ transfer
+ } = annotationStorageSerializable;
+ const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
+ pageIndex: this._pageIndex,
+ intent: renderingIntent,
+ cacheKey,
+ annotationStorage: map,
+ modifiedIds
+ }, transfer);
+ const reader = readableStream.getReader();
+ const intentState = this._intentStates.get(cacheKey);
+ intentState.streamReader = reader;
+ const pump = () => {
+ reader.read().then(({
+ value,
+ done
+ }) => {
+ if (done) {
+ intentState.streamReader = null;
+ return;
+ }
+ if (this._transport.destroyed) {
+ return;
+ }
+ this._renderPageChunk(value, intentState);
+ pump();
+ }, reason => {
+ intentState.streamReader = null;
+ if (this._transport.destroyed) {
+ return;
+ }
+ if (intentState.operatorList) {
+ intentState.operatorList.lastChunk = true;
+ for (const internalRenderTask of intentState.renderTasks) {
+ internalRenderTask.operatorListChanged();
+ }
+ this.#tryCleanup(true);
+ }
+ if (intentState.displayReadyCapability) {
+ intentState.displayReadyCapability.reject(reason);
+ } else if (intentState.opListReadCapability) {
+ intentState.opListReadCapability.reject(reason);
+ } else {
+ throw reason;
+ }
+ });
+ };
+ pump();
+ }
+ _abortOperatorList({
+ intentState,
+ reason,
+ force = false
+ }) {
+ if (!intentState.streamReader) {
+ return;
+ }
+ if (intentState.streamReaderCancelTimeout) {
+ clearTimeout(intentState.streamReaderCancelTimeout);
+ intentState.streamReaderCancelTimeout = null;
+ }
+ if (!force) {
+ if (intentState.renderTasks.size > 0) {
+ return;
+ }
+ if (reason instanceof RenderingCancelledException) {
+ let delay = RENDERING_CANCELLED_TIMEOUT;
+ if (reason.extraDelay > 0 && reason.extraDelay < 1000) {
+ delay += reason.extraDelay;
+ }
+ intentState.streamReaderCancelTimeout = setTimeout(() => {
+ intentState.streamReaderCancelTimeout = null;
+ this._abortOperatorList({
+ intentState,
+ reason,
+ force: true
+ });
+ }, delay);
+ return;
+ }
+ }
+ intentState.streamReader.cancel(new AbortException(reason.message)).catch(() => {});
+ intentState.streamReader = null;
+ if (this._transport.destroyed) {
+ return;
+ }
+ for (const [curCacheKey, curIntentState] of this._intentStates) {
+ if (curIntentState === intentState) {
+ this._intentStates.delete(curCacheKey);
+ break;
+ }
+ }
+ this.cleanup();
+ }
+ get stats() {
+ return this._stats;
+ }
+}
+class LoopbackPort {
+ #listeners = new Map();
+ #deferred = Promise.resolve();
+ postMessage(obj, transfer) {
+ const event = {
+ data: structuredClone(obj, transfer ? {
+ transfer
+ } : null)
+ };
+ this.#deferred.then(() => {
+ for (const [listener] of this.#listeners) {
+ listener.call(this, event);
+ }
+ });
+ }
+ addEventListener(name, listener, options = null) {
+ let rmAbort = null;
+ if (options?.signal instanceof AbortSignal) {
+ const {
+ signal
+ } = options;
+ if (signal.aborted) {
+ warn("LoopbackPort - cannot use an `aborted` signal.");
+ return;
+ }
+ const onAbort = () => this.removeEventListener(name, listener);
+ rmAbort = () => signal.removeEventListener("abort", onAbort);
+ signal.addEventListener("abort", onAbort);
+ }
+ this.#listeners.set(listener, rmAbort);
+ }
+ removeEventListener(name, listener) {
+ const rmAbort = this.#listeners.get(listener);
+ rmAbort?.();
+ this.#listeners.delete(listener);
+ }
+ terminate() {
+ for (const [, rmAbort] of this.#listeners) {
+ rmAbort?.();
+ }
+ this.#listeners.clear();
+ }
+}
+class PDFWorker {
+ static #fakeWorkerId = 0;
+ static #isWorkerDisabled = false;
+ static #workerPorts;
+ static {
+ if (isNodeJS) {
+ this.#isWorkerDisabled = true;
+ GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
+ }
+ this._isSameOrigin = (baseUrl, otherUrl) => {
+ let base;
+ try {
+ base = new URL(baseUrl);
+ if (!base.origin || base.origin === "null") {
+ return false;
+ }
+ } catch {
+ return false;
+ }
+ const other = new URL(otherUrl, base);
+ return base.origin === other.origin;
+ };
+ this._createCDNWrapper = url => {
+ const wrapper = `await import("${url}");`;
+ return URL.createObjectURL(new Blob([wrapper], {
+ type: "text/javascript"
+ }));
+ };
+ }
+ constructor({
+ name = null,
+ port = null,
+ verbosity = getVerbosityLevel()
+ } = {}) {
+ this.name = name;
+ this.destroyed = false;
+ this.verbosity = verbosity;
+ this._readyCapability = Promise.withResolvers();
+ this._port = null;
+ this._webWorker = null;
+ this._messageHandler = null;
+ if (port) {
+ 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;
+ }
+ this._initialize();
+ }
+ get promise() {
+ return this._readyCapability.promise;
+ }
+ #resolve() {
+ this._readyCapability.resolve();
+ this._messageHandler.send("configure", {
+ verbosity: this.verbosity
+ });
+ }
+ get port() {
+ return this._port;
+ }
+ get messageHandler() {
+ return this._messageHandler;
+ }
+ _initializeFromPort(port) {
+ this._port = port;
+ this._messageHandler = new MessageHandler("main", "worker", port);
+ this._messageHandler.on("ready", function () {});
+ this.#resolve();
+ }
+ _initialize() {
+ if (PDFWorker.#isWorkerDisabled || PDFWorker.#mainThreadWorkerMessageHandler) {
+ this._setupFakeWorker();
+ return;
+ }
+ let {
+ workerSrc
+ } = PDFWorker;
+ try {
+ if (!PDFWorker._isSameOrigin(window.location.href, workerSrc)) {
+ workerSrc = PDFWorker._createCDNWrapper(new URL(workerSrc, window.location).href);
+ }
+ const worker = new Worker(workerSrc, {
+ type: "module"
+ });
+ const messageHandler = new MessageHandler("main", "worker", worker);
+ const terminateEarly = () => {
+ ac.abort();
+ messageHandler.destroy();
+ worker.terminate();
+ if (this.destroyed) {
+ this._readyCapability.reject(new Error("Worker was destroyed"));
+ } else {
+ this._setupFakeWorker();
+ }
+ };
+ const ac = new AbortController();
+ worker.addEventListener("error", () => {
+ if (!this._webWorker) {
+ terminateEarly();
+ }
+ }, {
+ signal: ac.signal
+ });
+ messageHandler.on("test", data => {
+ ac.abort();
+ if (this.destroyed || !data) {
+ terminateEarly();
+ return;
+ }
+ this._messageHandler = messageHandler;
+ this._port = worker;
+ this._webWorker = worker;
+ this.#resolve();
+ });
+ messageHandler.on("ready", data => {
+ ac.abort();
+ if (this.destroyed) {
+ terminateEarly();
+ return;
+ }
+ try {
+ sendTest();
+ } catch {
+ this._setupFakeWorker();
+ }
+ });
+ const sendTest = () => {
+ const testObj = new Uint8Array();
+ messageHandler.send("test", testObj, [testObj.buffer]);
+ };
+ sendTest();
+ return;
+ } catch {
+ info("The worker has been disabled.");
+ }
+ this._setupFakeWorker();
+ }
+ _setupFakeWorker() {
+ if (!PDFWorker.#isWorkerDisabled) {
+ warn("Setting up fake worker.");
+ PDFWorker.#isWorkerDisabled = true;
+ }
+ PDFWorker._setupFakeWorkerGlobal.then(WorkerMessageHandler => {
+ if (this.destroyed) {
+ this._readyCapability.reject(new Error("Worker was destroyed"));
+ return;
+ }
+ const port = new LoopbackPort();
+ this._port = port;
+ const id = `fake${PDFWorker.#fakeWorkerId++}`;
+ const workerHandler = new MessageHandler(id + "_worker", id, port);
+ WorkerMessageHandler.setup(workerHandler, port);
+ this._messageHandler = new MessageHandler(id, id + "_worker", port);
+ this.#resolve();
+ }).catch(reason => {
+ this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`));
+ });
+ }
+ destroy() {
+ this.destroyed = true;
+ this._webWorker?.terminate();
+ this._webWorker = null;
+ PDFWorker.#workerPorts?.delete(this._port);
+ this._port = null;
+ this._messageHandler?.destroy();
+ this._messageHandler = null;
+ }
+ static fromPort(params) {
+ if (!params?.port) {
+ throw new Error("PDFWorker.fromPort - invalid method signature.");
+ }
+ 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);
+ }
+ static get workerSrc() {
+ if (GlobalWorkerOptions.workerSrc) {
+ return GlobalWorkerOptions.workerSrc;
+ }
+ throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
+ }
+ static get #mainThreadWorkerMessageHandler() {
+ try {
+ return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
+ } catch {
+ return null;
+ }
+ }
+ static get _setupFakeWorkerGlobal() {
+ const loader = async () => {
+ if (this.#mainThreadWorkerMessageHandler) {
+ return this.#mainThreadWorkerMessageHandler;
+ }
+ const worker = await import(/*webpackIgnore: true*/this.workerSrc);
+ return worker.WorkerMessageHandler;
+ };
+ return shadow(this, "_setupFakeWorkerGlobal", loader());
+ }
+}
+class WorkerTransport {
+ #methodPromises = new Map();
+ #pageCache = new Map();
+ #pagePromises = new Map();
+ #pageRefCache = new Map();
+ #passwordCapability = null;
+ constructor(messageHandler, loadingTask, networkStream, params, factory) {
+ this.messageHandler = messageHandler;
+ this.loadingTask = loadingTask;
+ this.commonObjs = new PDFObjects();
+ this.fontLoader = new FontLoader({
+ ownerDocument: params.ownerDocument,
+ styleElement: params.styleElement
+ });
+ this.loadingParams = params.loadingParams;
+ this._params = params;
+ this.canvasFactory = factory.canvasFactory;
+ this.filterFactory = factory.filterFactory;
+ this.cMapReaderFactory = factory.cMapReaderFactory;
+ this.standardFontDataFactory = factory.standardFontDataFactory;
+ this.destroyed = false;
+ this.destroyCapability = null;
+ this._networkStream = networkStream;
+ this._fullReader = null;
+ this._lastProgress = null;
+ this.downloadInfoCapability = Promise.withResolvers();
+ 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 shadow(this, "annotationStorage", new AnnotationStorage());
+ }
+ getRenderingIntent(intent, annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, isEditing = false, isOpList = false) {
+ let renderingIntent = RenderingIntentFlag.DISPLAY;
+ let annotationStorageSerializable = SerializableEmpty;
+ switch (intent) {
+ case "any":
+ renderingIntent = RenderingIntentFlag.ANY;
+ break;
+ case "display":
+ break;
+ case "print":
+ renderingIntent = RenderingIntentFlag.PRINT;
+ break;
+ default:
+ warn(`getRenderingIntent - invalid intent: ${intent}`);
+ }
+ const annotationStorage = renderingIntent & RenderingIntentFlag.PRINT && printAnnotationStorage instanceof PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
+ switch (annotationMode) {
+ case AnnotationMode.DISABLE:
+ renderingIntent += RenderingIntentFlag.ANNOTATIONS_DISABLE;
+ break;
+ case AnnotationMode.ENABLE:
+ break;
+ case AnnotationMode.ENABLE_FORMS:
+ renderingIntent += RenderingIntentFlag.ANNOTATIONS_FORMS;
+ break;
+ case AnnotationMode.ENABLE_STORAGE:
+ renderingIntent += RenderingIntentFlag.ANNOTATIONS_STORAGE;
+ annotationStorageSerializable = annotationStorage.serializable;
+ break;
+ default:
+ warn(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
+ }
+ if (isEditing) {
+ renderingIntent += RenderingIntentFlag.IS_EDITING;
+ }
+ if (isOpList) {
+ renderingIntent += RenderingIntentFlag.OPLIST;
+ }
+ const {
+ ids: modifiedIds,
+ hash: modifiedIdsHash
+ } = annotationStorage.modifiedIds;
+ const cacheKeyBuf = [renderingIntent, annotationStorageSerializable.hash, modifiedIdsHash];
+ return {
+ renderingIntent,
+ cacheKey: cacheKeyBuf.join("_"),
+ annotationStorageSerializable,
+ modifiedIds
+ };
+ }
+ destroy() {
+ if (this.destroyCapability) {
+ return this.destroyCapability.promise;
+ }
+ this.destroyed = true;
+ this.destroyCapability = Promise.withResolvers();
+ this.#passwordCapability?.reject(new Error("Worker was destroyed during onPassword callback"));
+ const waitOn = [];
+ for (const page of this.#pageCache.values()) {
+ waitOn.push(page._destroy());
+ }
+ this.#pageCache.clear();
+ this.#pagePromises.clear();
+ this.#pageRefCache.clear();
+ if (this.hasOwnProperty("annotationStorage")) {
+ this.annotationStorage.resetModified();
+ }
+ const terminated = this.messageHandler.sendWithPromise("Terminate", null);
+ waitOn.push(terminated);
+ Promise.all(waitOn).then(() => {
+ this.commonObjs.clear();
+ this.fontLoader.clear();
+ this.#methodPromises.clear();
+ this.filterFactory.destroy();
+ TextLayer.cleanup();
+ this._networkStream?.cancelAllRequests(new AbortException("Worker was terminated."));
+ this.messageHandler?.destroy();
+ this.messageHandler = null;
+ this.destroyCapability.resolve();
+ }, this.destroyCapability.reject);
+ return this.destroyCapability.promise;
+ }
+ setupMessageHandler() {
+ const {
+ messageHandler,
+ loadingTask
+ } = this;
+ messageHandler.on("GetReader", (data, sink) => {
+ assert(this._networkStream, "GetReader - no `IPDFStream` instance available.");
+ this._fullReader = this._networkStream.getFullReader();
+ this._fullReader.onProgress = evt => {
+ this._lastProgress = {
+ loaded: evt.loaded,
+ total: evt.total
+ };
+ };
+ sink.onPull = () => {
+ this._fullReader.read().then(function ({
+ value,
+ done
+ }) {
+ if (done) {
+ sink.close();
+ return;
+ }
+ assert(value instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer.");
+ sink.enqueue(new Uint8Array(value), 1, [value]);
+ }).catch(reason => {
+ sink.error(reason);
+ });
+ };
+ sink.onCancel = reason => {
+ this._fullReader.cancel(reason);
+ sink.ready.catch(readyReason => {
+ if (this.destroyed) {
+ return;
+ }
+ throw readyReason;
+ });
+ };
+ });
+ messageHandler.on("ReaderHeadersReady", async data => {
+ await this._fullReader.headersReady;
+ const {
+ isStreamingSupported,
+ isRangeSupported,
+ contentLength
+ } = this._fullReader;
+ if (!isStreamingSupported || !isRangeSupported) {
+ if (this._lastProgress) {
+ loadingTask.onProgress?.(this._lastProgress);
+ }
+ this._fullReader.onProgress = evt => {
+ loadingTask.onProgress?.({
+ loaded: evt.loaded,
+ total: evt.total
+ });
+ };
+ }
+ return {
+ isStreamingSupported,
+ isRangeSupported,
+ contentLength
+ };
+ });
+ messageHandler.on("GetRangeReader", (data, sink) => {
+ assert(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
+ const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
+ if (!rangeReader) {
+ sink.close();
+ return;
+ }
+ sink.onPull = () => {
+ rangeReader.read().then(function ({
+ value,
+ done
+ }) {
+ if (done) {
+ sink.close();
+ return;
+ }
+ assert(value instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer.");
+ sink.enqueue(new Uint8Array(value), 1, [value]);
+ }).catch(reason => {
+ sink.error(reason);
+ });
+ };
+ sink.onCancel = reason => {
+ rangeReader.cancel(reason);
+ sink.ready.catch(readyReason => {
+ if (this.destroyed) {
+ return;
+ }
+ throw readyReason;
+ });
+ };
+ });
+ messageHandler.on("GetDoc", ({
+ pdfInfo
+ }) => {
+ this._numPages = pdfInfo.numPages;
+ this._htmlForXfa = pdfInfo.htmlForXfa;
+ delete pdfInfo.htmlForXfa;
+ loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
+ });
+ messageHandler.on("DocException", function (ex) {
+ let reason;
+ switch (ex.name) {
+ case "PasswordException":
+ reason = new PasswordException(ex.message, ex.code);
+ break;
+ case "InvalidPDFException":
+ reason = new InvalidPDFException(ex.message);
+ break;
+ case "MissingPDFException":
+ reason = new MissingPDFException(ex.message);
+ break;
+ case "UnexpectedResponseException":
+ reason = new UnexpectedResponseException(ex.message, ex.status);
+ break;
+ case "UnknownErrorException":
+ reason = new UnknownErrorException(ex.message, ex.details);
+ break;
+ default:
+ unreachable("DocException - expected a valid Error.");
+ }
+ loadingTask._capability.reject(reason);
+ });
+ messageHandler.on("PasswordRequest", exception => {
+ this.#passwordCapability = Promise.withResolvers();
+ if (loadingTask.onPassword) {
+ const updatePassword = password => {
+ if (password instanceof Error) {
+ this.#passwordCapability.reject(password);
+ } else {
+ this.#passwordCapability.resolve({
+ password
+ });
+ }
+ };
+ try {
+ loadingTask.onPassword(updatePassword, exception.code);
+ } catch (ex) {
+ this.#passwordCapability.reject(ex);
+ }
+ } else {
+ this.#passwordCapability.reject(new PasswordException(exception.message, exception.code));
+ }
+ return this.#passwordCapability.promise;
+ });
+ messageHandler.on("DataLoaded", data => {
+ loadingTask.onProgress?.({
+ loaded: data.length,
+ total: data.length
+ });
+ this.downloadInfoCapability.resolve(data);
+ });
+ messageHandler.on("StartRenderPage", data => {
+ if (this.destroyed) {
+ return;
+ }
+ const page = this.#pageCache.get(data.pageIndex);
+ page._startRenderPage(data.transparency, data.cacheKey);
+ });
+ messageHandler.on("commonobj", ([id, type, exportedData]) => {
+ if (this.destroyed) {
+ return null;
+ }
+ if (this.commonObjs.has(id)) {
+ return null;
+ }
+ switch (type) {
+ case "Font":
+ const {
+ disableFontFace,
+ fontExtraProperties,
+ pdfBug
+ } = this._params;
+ if ("error" in exportedData) {
+ const exportedError = exportedData.error;
+ warn(`Error during font loading: ${exportedError}`);
+ this.commonObjs.resolve(id, exportedError);
+ break;
+ }
+ const inspectFont = pdfBug && globalThis.FontInspector?.enabled ? (font, url) => globalThis.FontInspector.fontAdded(font, url) : null;
+ const font = new FontFaceObject(exportedData, {
+ disableFontFace,
+ inspectFont
+ });
+ this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", {
+ id
+ })).finally(() => {
+ if (!fontExtraProperties && font.data) {
+ font.data = null;
+ }
+ this.commonObjs.resolve(id, font);
+ });
+ break;
+ case "CopyLocalImage":
+ const {
+ imageRef
+ } = exportedData;
+ assert(imageRef, "The imageRef must be defined.");
+ for (const pageProxy of this.#pageCache.values()) {
+ for (const [, data] of pageProxy.objs) {
+ if (data?.ref !== imageRef) {
+ continue;
+ }
+ if (!data.dataLen) {
+ return null;
+ }
+ this.commonObjs.resolve(id, structuredClone(data));
+ return data.dataLen;
+ }
+ }
+ break;
+ case "FontPath":
+ case "Image":
+ case "Pattern":
+ this.commonObjs.resolve(id, exportedData);
+ break;
+ default:
+ throw new Error(`Got unknown common object type ${type}`);
+ }
+ return null;
+ });
+ messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
+ if (this.destroyed) {
+ return;
+ }
+ const pageProxy = this.#pageCache.get(pageIndex);
+ if (pageProxy.objs.has(id)) {
+ return;
+ }
+ if (pageProxy._intentStates.size === 0) {
+ imageData?.bitmap?.close();
+ return;
+ }
+ switch (type) {
+ case "Image":
+ pageProxy.objs.resolve(id, imageData);
+ if (imageData?.dataLen > MAX_IMAGE_SIZE_TO_CACHE) {
+ pageProxy._maybeCleanupAfterRender = true;
+ }
+ break;
+ case "Pattern":
+ pageProxy.objs.resolve(id, imageData);
+ break;
+ default:
+ throw new Error(`Got unknown object type ${type}`);
+ }
+ });
+ messageHandler.on("DocProgress", data => {
+ if (this.destroyed) {
+ return;
+ }
+ loadingTask.onProgress?.({
+ loaded: data.loaded,
+ total: data.total
+ });
+ });
+ messageHandler.on("FetchBuiltInCMap", async data => {
+ if (this.destroyed) {
+ throw new Error("Worker was destroyed.");
+ }
+ if (!this.cMapReaderFactory) {
+ throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");
+ }
+ return this.cMapReaderFactory.fetch(data);
+ });
+ messageHandler.on("FetchStandardFontData", async data => {
+ if (this.destroyed) {
+ throw new Error("Worker was destroyed.");
+ }
+ if (!this.standardFontDataFactory) {
+ throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");
+ }
+ return this.standardFontDataFactory.fetch(data);
+ });
+ }
+ getData() {
+ return this.messageHandler.sendWithPromise("GetData", null);
+ }
+ saveDocument() {
+ if (this.annotationStorage.size <= 0) {
+ warn("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead.");
+ }
+ const {
+ map,
+ transfer
+ } = this.annotationStorage.serializable;
+ return this.messageHandler.sendWithPromise("SaveDocument", {
+ isPureXfa: !!this._htmlForXfa,
+ numPages: this._numPages,
+ annotationStorage: map,
+ filename: this._fullReader?.filename ?? null
+ }, transfer).finally(() => {
+ this.annotationStorage.resetModified();
+ });
+ }
+ getPage(pageNumber) {
+ if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
+ return Promise.reject(new Error("Invalid page request."));
+ }
+ const pageIndex = pageNumber - 1,
+ cachedPromise = this.#pagePromises.get(pageIndex);
+ if (cachedPromise) {
+ return cachedPromise;
+ }
+ const promise = this.messageHandler.sendWithPromise("GetPage", {
+ pageIndex
+ }).then(pageInfo => {
+ if (this.destroyed) {
+ throw new Error("Transport destroyed");
+ }
+ if (pageInfo.refStr) {
+ this.#pageRefCache.set(pageInfo.refStr, pageNumber);
+ }
+ const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug);
+ this.#pageCache.set(pageIndex, page);
+ return page;
+ });
+ this.#pagePromises.set(pageIndex, promise);
+ return promise;
+ }
+ getPageIndex(ref) {
+ if (!isRefProxy(ref)) {
+ return Promise.reject(new Error("Invalid pageIndex request."));
+ }
+ return this.messageHandler.sendWithPromise("GetPageIndex", {
+ num: ref.num,
+ gen: ref.gen
+ });
+ }
+ getAnnotations(pageIndex, intent) {
+ return this.messageHandler.sendWithPromise("GetAnnotations", {
+ pageIndex,
+ intent
+ });
+ }
+ getFieldObjects() {
+ return this.#cacheSimpleMethod("GetFieldObjects");
+ }
+ hasJSActions() {
+ return this.#cacheSimpleMethod("HasJSActions");
+ }
+ getCalculationOrderIds() {
+ return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
+ }
+ getDestinations() {
+ return this.messageHandler.sendWithPromise("GetDestinations", null);
+ }
+ getDestination(id) {
+ if (typeof id !== "string") {
+ return Promise.reject(new Error("Invalid destination request."));
+ }
+ return this.messageHandler.sendWithPromise("GetDestination", {
+ id
+ });
+ }
+ getPageLabels() {
+ return this.messageHandler.sendWithPromise("GetPageLabels", null);
+ }
+ getPageLayout() {
+ return this.messageHandler.sendWithPromise("GetPageLayout", null);
+ }
+ getPageMode() {
+ return this.messageHandler.sendWithPromise("GetPageMode", null);
+ }
+ getViewerPreferences() {
+ return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
+ }
+ getOpenAction() {
+ return this.messageHandler.sendWithPromise("GetOpenAction", null);
+ }
+ getAttachments() {
+ return this.messageHandler.sendWithPromise("GetAttachments", null);
+ }
+ getDocJSActions() {
+ return this.#cacheSimpleMethod("GetDocJSActions");
+ }
+ getPageJSActions(pageIndex) {
+ return this.messageHandler.sendWithPromise("GetPageJSActions", {
+ pageIndex
+ });
+ }
+ getStructTree(pageIndex) {
+ return this.messageHandler.sendWithPromise("GetStructTree", {
+ pageIndex
+ });
+ }
+ getOutline() {
+ return this.messageHandler.sendWithPromise("GetOutline", null);
+ }
+ getOptionalContentConfig(renderingIntent) {
+ return this.#cacheSimpleMethod("GetOptionalContentConfig").then(data => new OptionalContentConfig(data, renderingIntent));
+ }
+ getPermissions() {
+ return this.messageHandler.sendWithPromise("GetPermissions", null);
+ }
+ getMetadata() {
+ const name = "GetMetadata",
+ cachedPromise = this.#methodPromises.get(name);
+ if (cachedPromise) {
+ return cachedPromise;
+ }
+ const promise = this.messageHandler.sendWithPromise(name, null).then(results => ({
+ info: results[0],
+ metadata: results[1] ? new Metadata(results[1]) : null,
+ contentDispositionFilename: this._fullReader?.filename ?? null,
+ contentLength: this._fullReader?.contentLength ?? null
+ }));
+ this.#methodPromises.set(name, promise);
+ return promise;
+ }
+ getMarkInfo() {
+ return this.messageHandler.sendWithPromise("GetMarkInfo", null);
+ }
+ async startCleanup(keepLoadedFonts = false) {
+ if (this.destroyed) {
+ return;
+ }
+ await this.messageHandler.sendWithPromise("Cleanup", null);
+ for (const page of this.#pageCache.values()) {
+ const cleanupSuccessful = page.cleanup();
+ if (!cleanupSuccessful) {
+ throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);
+ }
+ }
+ this.commonObjs.clear();
+ if (!keepLoadedFonts) {
+ this.fontLoader.clear();
+ }
+ this.#methodPromises.clear();
+ this.filterFactory.destroy(true);
+ TextLayer.cleanup();
+ }
+ cachedPageNumber(ref) {
+ if (!isRefProxy(ref)) {
+ return null;
+ }
+ const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
+ return this.#pageRefCache.get(refStr) ?? null;
+ }
+}
+const INITIAL_DATA = Symbol("INITIAL_DATA");
+class PDFObjects {
+ #objs = Object.create(null);
+ #ensureObj(objId) {
+ return this.#objs[objId] ||= {
+ ...Promise.withResolvers(),
+ data: INITIAL_DATA
+ };
+ }
+ get(objId, callback = null) {
+ if (callback) {
+ const obj = this.#ensureObj(objId);
+ obj.promise.then(() => callback(obj.data));
+ return null;
+ }
+ const obj = this.#objs[objId];
+ if (!obj || obj.data === INITIAL_DATA) {
+ throw new Error(`Requesting object that isn't resolved yet ${objId}.`);
+ }
+ return obj.data;
+ }
+ has(objId) {
+ const obj = this.#objs[objId];
+ return !!obj && obj.data !== INITIAL_DATA;
+ }
+ resolve(objId, data = null) {
+ const obj = this.#ensureObj(objId);
+ obj.data = data;
+ obj.resolve();
+ }
+ clear() {
+ for (const objId in this.#objs) {
+ const {
+ data
+ } = this.#objs[objId];
+ data?.bitmap?.close();
+ }
+ this.#objs = Object.create(null);
+ }
+ *[Symbol.iterator]() {
+ for (const objId in this.#objs) {
+ const {
+ data
+ } = this.#objs[objId];
+ if (data === INITIAL_DATA) {
+ continue;
+ }
+ yield [objId, data];
+ }
+ }
+}
+class RenderTask {
+ #internalRenderTask = null;
+ constructor(internalRenderTask) {
+ this.#internalRenderTask = internalRenderTask;
+ this.onContinue = null;
+ }
+ get promise() {
+ return this.#internalRenderTask.capability.promise;
+ }
+ cancel(extraDelay = 0) {
+ this.#internalRenderTask.cancel(null, extraDelay);
+ }
+ get separateAnnots() {
+ const {
+ separateAnnots
+ } = this.#internalRenderTask.operatorList;
+ if (!separateAnnots) {
+ return false;
+ }
+ const {
+ annotationCanvasMap
+ } = this.#internalRenderTask;
+ return separateAnnots.form || separateAnnots.canvas && annotationCanvasMap?.size > 0;
+ }
+}
+class InternalRenderTask {
+ #rAF = null;
+ static #canvasInUse = new WeakSet();
+ constructor({
+ callback,
+ params,
+ objs,
+ commonObjs,
+ annotationCanvasMap,
+ operatorList,
+ pageIndex,
+ canvasFactory,
+ filterFactory,
+ useRequestAnimationFrame = false,
+ pdfBug = false,
+ pageColors = null
+ }) {
+ this.callback = callback;
+ this.params = params;
+ this.objs = objs;
+ this.commonObjs = commonObjs;
+ this.annotationCanvasMap = annotationCanvasMap;
+ this.operatorListIdx = null;
+ this.operatorList = operatorList;
+ this._pageIndex = pageIndex;
+ this.canvasFactory = canvasFactory;
+ this.filterFactory = filterFactory;
+ this._pdfBug = pdfBug;
+ this.pageColors = pageColors;
+ this.running = false;
+ this.graphicsReadyCallback = null;
+ this.graphicsReady = false;
+ this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
+ this.cancelled = false;
+ this.capability = Promise.withResolvers();
+ this.task = new RenderTask(this);
+ this._cancelBound = this.cancel.bind(this);
+ this._continueBound = this._continue.bind(this);
+ this._scheduleNextBound = this._scheduleNext.bind(this);
+ this._nextBound = this._next.bind(this);
+ this._canvas = params.canvasContext.canvas;
+ }
+ get completed() {
+ return this.capability.promise.catch(function () {});
+ }
+ initializeGraphics({
+ transparency = false,
+ optionalContentConfig
+ }) {
+ if (this.cancelled) {
+ return;
+ }
+ if (this._canvas) {
+ if (InternalRenderTask.#canvasInUse.has(this._canvas)) {
+ throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed.");
+ }
+ InternalRenderTask.#canvasInUse.add(this._canvas);
+ }
+ if (this._pdfBug && globalThis.StepperManager?.enabled) {
+ this.stepper = globalThis.StepperManager.create(this._pageIndex);
+ this.stepper.init(this.operatorList);
+ this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
+ }
+ const {
+ canvasContext,
+ viewport,
+ transform,
+ background
+ } = this.params;
+ this.gfx = new CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
+ optionalContentConfig
+ }, this.annotationCanvasMap, this.pageColors);
+ this.gfx.beginDrawing({
+ transform,
+ viewport,
+ transparency,
+ background
+ });
+ this.operatorListIdx = 0;
+ this.graphicsReady = true;
+ this.graphicsReadyCallback?.();
+ }
+ cancel(error = null, extraDelay = 0) {
+ this.running = false;
+ this.cancelled = true;
+ this.gfx?.endDrawing();
+ if (this.#rAF) {
+ window.cancelAnimationFrame(this.#rAF);
+ this.#rAF = null;
+ }
+ InternalRenderTask.#canvasInUse.delete(this._canvas);
+ this.callback(error || new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, extraDelay));
+ }
+ operatorListChanged() {
+ if (!this.graphicsReady) {
+ this.graphicsReadyCallback ||= this._continueBound;
+ return;
+ }
+ this.stepper?.updateOperatorList(this.operatorList);
+ if (this.running) {
+ return;
+ }
+ this._continue();
+ }
+ _continue() {
+ this.running = true;
+ if (this.cancelled) {
+ return;
+ }
+ if (this.task.onContinue) {
+ this.task.onContinue(this._scheduleNextBound);
+ } else {
+ this._scheduleNext();
+ }
+ }
+ _scheduleNext() {
+ if (this._useRequestAnimationFrame) {
+ this.#rAF = window.requestAnimationFrame(() => {
+ this.#rAF = null;
+ this._nextBound().catch(this._cancelBound);
+ });
+ } else {
+ Promise.resolve().then(this._nextBound).catch(this._cancelBound);
+ }
+ }
+ async _next() {
+ if (this.cancelled) {
+ return;
+ }
+ this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
+ if (this.operatorListIdx === this.operatorList.argsArray.length) {
+ this.running = false;
+ if (this.operatorList.lastChunk) {
+ this.gfx.endDrawing();
+ InternalRenderTask.#canvasInUse.delete(this._canvas);
+ this.callback();
+ }
+ }
+ }
+}
+const version = "4.9.155";
+const build = "a4eb8407c";
+
+;// ./src/shared/scripting_utils.js
+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)];
+ }
+ static G_CMYK([g]) {
+ return ["CMYK", 0, 0, 0, 1 - g];
+ }
+ 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}`;
+ }
+ static RGB_G([r, g, b]) {
+ return ["G", 0.3 * r + 0.59 * g + 0.11 * 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);
+ }
+ static RGB_CMYK([r, g, b]) {
+ const c = 1 - r;
+ const m = 1 - g;
+ const y = 1 - b;
+ const k = Math.min(c, m, y);
+ return ["CMYK", c, m, y, k];
+ }
+}
+
+;// ./src/display/svg_factory.js
+
+
+class BaseSVGFactory {
+ create(width, height, skipDimensions = false) {
+ if (width <= 0 || height <= 0) {
+ throw new Error("Invalid SVG dimensions");
+ }
+ const svg = this._createSVG("svg:svg");
+ svg.setAttribute("version", "1.1");
+ if (!skipDimensions) {
+ svg.setAttribute("width", `${width}px`);
+ svg.setAttribute("height", `${height}px`);
+ }
+ svg.setAttribute("preserveAspectRatio", "none");
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
+ return svg;
+ }
+ createElement(type) {
+ if (typeof type !== "string") {
+ throw new Error("Invalid SVG element type");
+ }
+ return this._createSVG(type);
+ }
+ _createSVG(type) {
+ unreachable("Abstract method `_createSVG` called.");
+ }
+}
+class DOMSVGFactory extends BaseSVGFactory {
+ _createSVG(type) {
+ return document.createElementNS(SVG_NS, type);
+ }
+}
+
+;// ./src/display/xfa_layer.js
+
+class XfaLayer {
+ static setupStorage(html, id, element, storage, intent) {
+ const storedData = storage.getValue(id, {
+ value: null
+ });
+ switch (element.name) {
+ case "textarea":
+ if (storedData.value !== null) {
+ html.textContent = storedData.value;
+ }
+ if (intent === "print") {
+ break;
+ }
+ html.addEventListener("input", event => {
+ storage.setValue(id, {
+ value: event.target.value
+ });
+ });
+ break;
+ case "input":
+ if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
+ if (storedData.value === element.attributes.xfaOn) {
+ html.setAttribute("checked", true);
+ } else if (storedData.value === element.attributes.xfaOff) {
+ html.removeAttribute("checked");
+ }
+ if (intent === "print") {
+ break;
+ }
+ html.addEventListener("change", event => {
+ storage.setValue(id, {
+ value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
+ });
+ });
+ } else {
+ if (storedData.value !== null) {
+ html.setAttribute("value", storedData.value);
+ }
+ if (intent === "print") {
+ break;
+ }
+ html.addEventListener("input", event => {
+ storage.setValue(id, {
+ value: event.target.value
+ });
+ });
+ }
+ 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;
+ }
+ }
+ }
+ html.addEventListener("input", event => {
+ const options = event.target.options;
+ const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
+ storage.setValue(id, {
+ value
+ });
+ });
+ break;
+ }
+ }
+ static setAttributes({
+ html,
+ element,
+ storage = null,
+ intent,
+ linkService
+ }) {
+ const {
+ attributes
+ } = element;
+ const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
+ if (attributes.type === "radio") {
+ attributes.name = `${attributes.name}-${intent}`;
+ }
+ for (const [key, value] of Object.entries(attributes)) {
+ if (value === null || value === undefined) {
+ continue;
+ }
+ switch (key) {
+ case "class":
+ if (value.length) {
+ html.setAttribute(key, value.join(" "));
+ }
+ break;
+ case "dataId":
+ break;
+ case "id":
+ html.setAttribute("data-element-id", value);
+ break;
+ case "style":
+ Object.assign(html.style, value);
+ break;
+ case "textContent":
+ html.textContent = value;
+ break;
+ default:
+ if (!isHTMLAnchorElement || key !== "href" && key !== "newWindow") {
+ html.setAttribute(key, value);
+ }
+ }
+ }
+ if (isHTMLAnchorElement) {
+ linkService.addLinkAttributes(html, attributes.href, attributes.newWindow);
+ }
+ if (storage && attributes.dataId) {
+ this.setupStorage(html, attributes.dataId, element, storage);
+ }
+ }
+ static render(parameters) {
+ const storage = parameters.annotationStorage;
+ const linkService = parameters.linkService;
+ const root = parameters.xfaHtml;
+ const intent = parameters.intent || "display";
+ const rootHtml = document.createElement(root.name);
+ if (root.attributes) {
+ this.setAttributes({
+ html: rootHtml,
+ element: root,
+ intent,
+ linkService
+ });
+ }
+ const isNotForRichText = intent !== "richText";
+ const rootDiv = parameters.div;
+ rootDiv.append(rootHtml);
+ if (parameters.viewport) {
+ const transform = `matrix(${parameters.viewport.transform.join(",")})`;
+ rootDiv.style.transform = transform;
+ }
+ if (isNotForRichText) {
+ rootDiv.setAttribute("class", "xfaLayer xfaFont");
+ }
+ const textDivs = [];
+ if (root.children.length === 0) {
+ if (root.value) {
+ const node = document.createTextNode(root.value);
+ rootHtml.append(node);
+ if (isNotForRichText && XfaText.shouldBuildText(root.name)) {
+ textDivs.push(node);
+ }
+ }
+ return {
+ textDivs
+ };
+ }
+ const stack = [[root, -1, rootHtml]];
+ while (stack.length > 0) {
+ const [parent, i, html] = stack.at(-1);
+ if (i + 1 === parent.children.length) {
+ stack.pop();
+ continue;
+ }
+ const child = parent.children[++stack.at(-1)[1]];
+ if (child === null) {
+ continue;
+ }
+ const {
+ name
+ } = child;
+ if (name === "#text") {
+ const node = document.createTextNode(child.value);
+ textDivs.push(node);
+ html.append(node);
+ continue;
+ }
+ const childHtml = child?.attributes?.xmlns ? document.createElementNS(child.attributes.xmlns, name) : document.createElement(name);
+ html.append(childHtml);
+ if (child.attributes) {
+ this.setAttributes({
+ html: childHtml,
+ element: child,
+ storage,
+ intent,
+ linkService
+ });
+ }
+ if (child.children?.length > 0) {
+ stack.push([child, -1, childHtml]);
+ } else if (child.value) {
+ const node = document.createTextNode(child.value);
+ if (isNotForRichText && XfaText.shouldBuildText(name)) {
+ textDivs.push(node);
+ }
+ childHtml.append(node);
+ }
+ }
+ for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
+ el.setAttribute("readOnly", true);
+ }
+ return {
+ textDivs
+ };
+ }
+ static update(parameters) {
+ const transform = `matrix(${parameters.viewport.transform.join(",")})`;
+ parameters.div.style.transform = transform;
+ parameters.div.hidden = false;
+ }
+}
+
+;// ./src/display/annotation_layer.js
+
+
+
+
+
+
+const DEFAULT_TAB_INDEX = 1000;
+const annotation_layer_DEFAULT_FONT_SIZE = 9;
+const GetElementsByNameSet = new WeakSet();
+function getRectDims(rect) {
+ return {
+ width: rect[2] - rect[0],
+ height: rect[3] - rect[1]
+ };
+}
+class AnnotationElementFactory {
+ static create(parameters) {
+ const subtype = parameters.data.annotationType;
+ switch (subtype) {
+ case AnnotationType.LINK:
+ return new LinkAnnotationElement(parameters);
+ case AnnotationType.TEXT:
+ return new TextAnnotationElement(parameters);
+ case AnnotationType.WIDGET:
+ const fieldType = parameters.data.fieldType;
+ switch (fieldType) {
+ case "Tx":
+ return new TextWidgetAnnotationElement(parameters);
+ case "Btn":
+ if (parameters.data.radioButton) {
+ return new RadioButtonWidgetAnnotationElement(parameters);
+ } else if (parameters.data.checkBox) {
+ return new CheckboxWidgetAnnotationElement(parameters);
+ }
+ return new PushButtonWidgetAnnotationElement(parameters);
+ case "Ch":
+ return new ChoiceWidgetAnnotationElement(parameters);
+ case "Sig":
+ return new SignatureWidgetAnnotationElement(parameters);
+ }
+ return new WidgetAnnotationElement(parameters);
+ case AnnotationType.POPUP:
+ return new PopupAnnotationElement(parameters);
+ case AnnotationType.FREETEXT:
+ return new FreeTextAnnotationElement(parameters);
+ case AnnotationType.LINE:
+ return new LineAnnotationElement(parameters);
+ case AnnotationType.SQUARE:
+ return new SquareAnnotationElement(parameters);
+ case AnnotationType.CIRCLE:
+ return new CircleAnnotationElement(parameters);
+ case AnnotationType.POLYLINE:
+ return new PolylineAnnotationElement(parameters);
+ case AnnotationType.CARET:
+ return new CaretAnnotationElement(parameters);
+ case AnnotationType.INK:
+ return new InkAnnotationElement(parameters);
+ case AnnotationType.POLYGON:
+ return new PolygonAnnotationElement(parameters);
+ case AnnotationType.HIGHLIGHT:
+ return new HighlightAnnotationElement(parameters);
+ case AnnotationType.UNDERLINE:
+ return new UnderlineAnnotationElement(parameters);
+ case AnnotationType.SQUIGGLY:
+ return new SquigglyAnnotationElement(parameters);
+ case AnnotationType.STRIKEOUT:
+ return new StrikeOutAnnotationElement(parameters);
+ case AnnotationType.STAMP:
+ return new StampAnnotationElement(parameters);
+ case AnnotationType.FILEATTACHMENT:
+ return new FileAttachmentAnnotationElement(parameters);
+ default:
+ return new AnnotationElement(parameters);
+ }
+ }
+}
+class AnnotationElement {
+ #updates = null;
+ #hasBorder = false;
+ #popupElement = null;
+ constructor(parameters, {
+ isRenderable = false,
+ ignoreBorder = false,
+ createQuadrilaterals = false
+ } = {}) {
+ this.isRenderable = isRenderable;
+ this.data = parameters.data;
+ this.layer = parameters.layer;
+ this.linkService = parameters.linkService;
+ this.downloadManager = parameters.downloadManager;
+ this.imageResourcesPath = parameters.imageResourcesPath;
+ this.renderForms = parameters.renderForms;
+ this.svgFactory = parameters.svgFactory;
+ this.annotationStorage = parameters.annotationStorage;
+ 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._createQuadrilaterals();
+ }
+ }
+ static _hasPopupData({
+ titleObj,
+ contentsObj,
+ richText
+ }) {
+ return !!(titleObj?.str || contentsObj?.str || richText?.str);
+ }
+ get _isEditable() {
+ return this.data.isEditable;
+ }
+ get hasPopupData() {
+ return AnnotationElement._hasPopupData(this.data);
+ }
+ updateEdited(params) {
+ if (!this.container) {
+ return;
+ }
+ this.#updates ||= {
+ rect: this.data.rect.slice(0)
+ };
+ const {
+ rect
+ } = params;
+ if (rect) {
+ this.#setRectEdited(rect);
+ }
+ this.#popupElement?.popup.updateEdited(params);
+ }
+ resetEdited() {
+ if (!this.#updates) {
+ return;
+ }
+ this.#setRectEdited(this.#updates.rect);
+ this.#popupElement?.popup.resetEdited();
+ this.#updates = null;
+ }
+ #setRectEdited(rect) {
+ const {
+ container: {
+ style
+ },
+ data: {
+ rect: currentRect,
+ rotation
+ },
+ parent: {
+ viewport: {
+ rawDims: {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ }
+ }
+ }
+ } = this;
+ currentRect?.splice(0, 4, ...rect);
+ const {
+ width,
+ height
+ } = getRectDims(rect);
+ style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
+ style.top = `${100 * (pageHeight - rect[3] + pageY) / pageHeight}%`;
+ if (rotation === 0) {
+ style.width = `${100 * width / pageWidth}%`;
+ style.height = `${100 * height / pageHeight}%`;
+ } else {
+ this.setRotation(rotation);
+ }
+ }
+ _createContainer(ignoreBorder) {
+ const {
+ data,
+ 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;
+ }
+ const {
+ style
+ } = container;
+ style.zIndex = this.parent.zIndex++;
+ if (data.alternativeText) {
+ container.title = data.alternativeText;
+ }
+ if (data.noRotate) {
+ container.classList.add("norotate");
+ }
+ if (!data.rect || this instanceof PopupAnnotationElement) {
+ const {
+ rotation
+ } = data;
+ if (!data.hasOwnCanvas && rotation !== 0) {
+ this.setRotation(rotation, container);
+ }
+ return container;
+ }
+ const {
+ width,
+ height
+ } = getRectDims(data.rect);
+ if (!ignoreBorder && data.borderStyle.width > 0) {
+ style.borderWidth = `${data.borderStyle.width}px`;
+ const horizontalRadius = data.borderStyle.horizontalCornerRadius;
+ const verticalRadius = data.borderStyle.verticalCornerRadius;
+ if (horizontalRadius > 0 || verticalRadius > 0) {
+ const radius = `calc(${horizontalRadius}px * var(--scale-factor)) / calc(${verticalRadius}px * var(--scale-factor))`;
+ style.borderRadius = radius;
+ } else if (this instanceof RadioButtonWidgetAnnotationElement) {
+ const radius = `calc(${width}px * var(--scale-factor)) / calc(${height}px * var(--scale-factor))`;
+ style.borderRadius = radius;
+ }
+ switch (data.borderStyle.style) {
+ case AnnotationBorderStyleType.SOLID:
+ style.borderStyle = "solid";
+ break;
+ case AnnotationBorderStyleType.DASHED:
+ style.borderStyle = "dashed";
+ break;
+ case AnnotationBorderStyleType.BEVELED:
+ warn("Unimplemented border style: beveled");
+ break;
+ case AnnotationBorderStyleType.INSET:
+ warn("Unimplemented border style: inset");
+ break;
+ case AnnotationBorderStyleType.UNDERLINE:
+ style.borderBottomStyle = "solid";
+ break;
+ default:
+ break;
+ }
+ const borderColor = data.borderColor || null;
+ if (borderColor) {
+ this.#hasBorder = true;
+ style.borderColor = Util.makeHexColor(borderColor[0] | 0, borderColor[1] | 0, borderColor[2] | 0);
+ } else {
+ style.borderWidth = 0;
+ }
+ }
+ const rect = Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
+ const {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ } = viewport.rawDims;
+ style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
+ style.top = `${100 * (rect[1] - pageY) / pageHeight}%`;
+ const {
+ rotation
+ } = data;
+ if (data.hasOwnCanvas || rotation === 0) {
+ style.width = `${100 * width / pageWidth}%`;
+ style.height = `${100 * height / pageHeight}%`;
+ } else {
+ this.setRotation(rotation, container);
+ }
+ return container;
+ }
+ setRotation(angle, container = this.container) {
+ if (!this.data.rect) {
+ return;
+ }
+ const {
+ pageWidth,
+ pageHeight
+ } = this.parent.viewport.rawDims;
+ const {
+ width,
+ height
+ } = getRectDims(this.data.rect);
+ let elementWidth, elementHeight;
+ if (angle % 180 === 0) {
+ elementWidth = 100 * width / pageWidth;
+ elementHeight = 100 * height / pageHeight;
+ } else {
+ elementWidth = 100 * height / pageWidth;
+ elementHeight = 100 * width / pageHeight;
+ }
+ container.style.width = `${elementWidth}%`;
+ container.style.height = `${elementHeight}%`;
+ container.setAttribute("data-main-rotation", (360 - angle) % 360);
+ }
+ get _commonActions() {
+ const setColor = (jsName, styleName, event) => {
+ const color = event.detail[jsName];
+ const colorType = color[0];
+ const colorArray = color.slice(1);
+ event.target.style[styleName] = ColorConverters[`${colorType}_HTML`](colorArray);
+ this.annotationStorage.setValue(this.data.id, {
+ [styleName]: ColorConverters[`${colorType}_rgb`](colorArray)
+ });
+ };
+ return shadow(this, "_commonActions", {
+ display: event => {
+ const {
+ display
+ } = event.detail;
+ const hidden = display % 2 === 1;
+ this.container.style.visibility = hidden ? "hidden" : "visible";
+ this.annotationStorage.setValue(this.data.id, {
+ noView: hidden,
+ noPrint: display === 1 || display === 2
+ });
+ },
+ print: event => {
+ this.annotationStorage.setValue(this.data.id, {
+ noPrint: !event.detail.print
+ });
+ },
+ hidden: event => {
+ const {
+ hidden
+ } = event.detail;
+ this.container.style.visibility = hidden ? "hidden" : "visible";
+ this.annotationStorage.setValue(this.data.id, {
+ noPrint: hidden,
+ noView: hidden
+ });
+ },
+ focus: event => {
+ setTimeout(() => event.target.focus({
+ preventScroll: false
+ }), 0);
+ },
+ userName: event => {
+ event.target.title = event.detail.userName;
+ },
+ readonly: event => {
+ event.target.disabled = event.detail.readonly;
+ },
+ required: event => {
+ this._setRequired(event.target, event.detail.required);
+ },
+ bgColor: event => {
+ setColor("bgColor", "backgroundColor", event);
+ },
+ fillColor: event => {
+ setColor("fillColor", "backgroundColor", event);
+ },
+ fgColor: event => {
+ setColor("fgColor", "color", event);
+ },
+ textColor: event => {
+ setColor("textColor", "color", event);
+ },
+ borderColor: event => {
+ setColor("borderColor", "borderColor", event);
+ },
+ strokeColor: event => {
+ setColor("strokeColor", "borderColor", event);
+ },
+ rotation: event => {
+ const angle = event.detail.rotation;
+ this.setRotation(angle);
+ this.annotationStorage.setValue(this.data.id, {
+ rotation: angle
+ });
+ }
+ });
+ }
+ _dispatchEventFromSandbox(actions, jsEvent) {
+ const commonActions = this._commonActions;
+ for (const name of Object.keys(jsEvent.detail)) {
+ const action = actions[name] || commonActions[name];
+ action?.(jsEvent);
+ }
+ }
+ _setDefaultPropertiesFromJS(element) {
+ if (!this.enableScripting) {
+ return;
+ }
+ const storedData = this.annotationStorage.getRawValue(this.data.id);
+ if (!storedData) {
+ return;
+ }
+ const commonActions = this._commonActions;
+ for (const [actionName, detail] of Object.entries(storedData)) {
+ const action = commonActions[actionName];
+ if (action) {
+ const eventProxy = {
+ detail: {
+ [actionName]: detail
+ },
+ target: element
+ };
+ action(eventProxy);
+ delete storedData[actionName];
+ }
+ }
+ }
+ _createQuadrilaterals() {
+ if (!this.container) {
+ return;
+ }
+ const {
+ quadPoints
+ } = this.data;
+ if (!quadPoints) {
+ return;
+ }
+ const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect.map(x => Math.fround(x));
+ if (quadPoints.length === 8) {
+ const [trX, trY, blX, blY] = quadPoints.subarray(2, 6);
+ 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})`;
+ }
+ _createPopup() {
+ const {
+ data
+ } = this;
+ const popup = this.#popupElement = 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]
+ });
+ this.parent.div.append(popup.render());
+ }
+ render() {
+ unreachable("Abstract method `AnnotationElement.render` called");
+ }
+ _getElementsByName(name, skipId = null) {
+ const fields = [];
+ if (this._fieldObjects) {
+ const fieldObj = this._fieldObjects[name];
+ if (fieldObj) {
+ for (const {
+ page,
+ id,
+ exportValues
+ } of fieldObj) {
+ if (page === -1) {
+ continue;
+ }
+ if (id === skipId) {
+ continue;
+ }
+ const exportValue = typeof exportValues === "string" ? exportValues : null;
+ const domElement = document.querySelector(`[data-element-id="${id}"]`);
+ if (domElement && !GetElementsByNameSet.has(domElement)) {
+ warn(`_getElementsByName - element not allowed: ${id}`);
+ continue;
+ }
+ fields.push({
+ id,
+ exportValue,
+ domElement
+ });
+ }
+ }
+ return fields;
+ }
+ for (const domElement of document.getElementsByName(name)) {
+ const {
+ exportValue
+ } = domElement;
+ const id = domElement.getAttribute("data-element-id");
+ if (id === skipId) {
+ continue;
+ }
+ if (!GetElementsByNameSet.has(domElement)) {
+ continue;
+ }
+ fields.push({
+ id,
+ exportValue,
+ domElement
+ });
+ }
+ 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() {
+ if (!this._isEditable) {
+ return;
+ }
+ 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) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: !!options?.ignoreBorder,
+ createQuadrilaterals: true
+ });
+ this.isTooltipOnly = parameters.data.isTooltipOnly;
+ }
+ render() {
+ const {
+ data,
+ linkService
+ } = this;
+ const link = document.createElement("a");
+ link.setAttribute("data-element-id", data.id);
+ let isBound = false;
+ if (data.url) {
+ linkService.addLinkAttributes(link, data.url, data.newWindow);
+ isBound = true;
+ } else if (data.action) {
+ this._bindNamedAction(link, data.action);
+ isBound = true;
+ } else if (data.attachment) {
+ this.#bindAttachment(link, data.attachment, data.attachmentDest);
+ isBound = true;
+ } else if (data.setOCGState) {
+ this.#bindSetOCGState(link, data.setOCGState);
+ isBound = true;
+ } else if (data.dest) {
+ this._bindLink(link, data.dest);
+ isBound = true;
+ } else {
+ if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) {
+ this._bindJSAction(link, data);
+ isBound = true;
+ }
+ if (data.resetForm) {
+ this._bindResetFormAction(link, data.resetForm);
+ isBound = true;
+ } else if (this.isTooltipOnly && !isBound) {
+ this._bindLink(link, "");
+ isBound = true;
+ }
+ }
+ this.container.classList.add("linkAnnotation");
+ if (isBound) {
+ this.container.append(link);
+ }
+ return this.container;
+ }
+ #setInternalLink() {
+ this.container.setAttribute("data-internal-link", "");
+ }
+ _bindLink(link, destination) {
+ link.href = this.linkService.getDestinationHash(destination);
+ link.onclick = () => {
+ if (destination) {
+ this.linkService.goToDestination(destination);
+ }
+ return false;
+ };
+ if (destination || destination === "") {
+ this.#setInternalLink();
+ }
+ }
+ _bindNamedAction(link, action) {
+ link.href = this.linkService.getAnchorUrl("");
+ link.onclick = () => {
+ this.linkService.executeNamedAction(action);
+ return false;
+ };
+ this.#setInternalLink();
+ }
+ #bindAttachment(link, attachment, dest = null) {
+ link.href = this.linkService.getAnchorUrl("");
+ if (attachment.description) {
+ link.title = attachment.description;
+ }
+ link.onclick = () => {
+ this.downloadManager?.openOrDownloadData(attachment.content, attachment.filename, dest);
+ return false;
+ };
+ this.#setInternalLink();
+ }
+ #bindSetOCGState(link, action) {
+ link.href = this.linkService.getAnchorUrl("");
+ link.onclick = () => {
+ this.linkService.executeSetOCGState(action);
+ return false;
+ };
+ this.#setInternalLink();
+ }
+ _bindJSAction(link, data) {
+ link.href = this.linkService.getAnchorUrl("");
+ const map = new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
+ for (const name of Object.keys(data.actions)) {
+ const jsName = map.get(name);
+ if (!jsName) {
+ continue;
+ }
+ link[jsName] = () => {
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id: data.id,
+ name
+ }
+ });
+ return false;
+ };
+ }
+ if (!link.onclick) {
+ link.onclick = () => false;
+ }
+ this.#setInternalLink();
+ }
+ _bindResetFormAction(link, resetForm) {
+ const otherClickAction = link.onclick;
+ if (!otherClickAction) {
+ link.href = this.linkService.getAnchorUrl("");
+ }
+ this.#setInternalLink();
+ if (!this._fieldObjects) {
+ warn(`_bindResetFormAction - "resetForm" action not supported, ` + "ensure that the `fieldObjects` parameter is provided.");
+ if (!otherClickAction) {
+ link.onclick = () => false;
+ }
+ return;
+ }
+ link.onclick = () => {
+ otherClickAction?.();
+ const {
+ fields: resetFormFields,
+ refs: resetFormRefs,
+ include
+ } = resetForm;
+ const allFields = [];
+ if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {
+ const fieldIds = new Set(resetFormRefs);
+ for (const fieldName of resetFormFields) {
+ const fields = this._fieldObjects[fieldName] || [];
+ for (const {
+ id
+ } of fields) {
+ fieldIds.add(id);
+ }
+ }
+ for (const fields of Object.values(this._fieldObjects)) {
+ for (const field of fields) {
+ if (fieldIds.has(field.id) === include) {
+ allFields.push(field);
+ }
+ }
+ }
+ } else {
+ for (const fields of Object.values(this._fieldObjects)) {
+ allFields.push(...fields);
+ }
+ }
+ const storage = this.annotationStorage;
+ const allIds = [];
+ for (const field of allFields) {
+ const {
+ id
+ } = field;
+ allIds.push(id);
+ switch (field.type) {
+ case "text":
+ {
+ const value = field.defaultValue || "";
+ storage.setValue(id, {
+ value
+ });
+ break;
+ }
+ case "checkbox":
+ case "radiobutton":
+ {
+ const value = field.defaultValue === field.exportValues;
+ storage.setValue(id, {
+ value
+ });
+ break;
+ }
+ case "combobox":
+ case "listbox":
+ {
+ const value = field.defaultValue || "";
+ storage.setValue(id, {
+ value
+ });
+ break;
+ }
+ default:
+ continue;
+ }
+ const domElement = document.querySelector(`[data-element-id="${id}"]`);
+ if (!domElement) {
+ continue;
+ } else if (!GetElementsByNameSet.has(domElement)) {
+ warn(`_bindResetFormAction - element not allowed: ${id}`);
+ continue;
+ }
+ domElement.dispatchEvent(new Event("resetform"));
+ }
+ if (this.enableScripting) {
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id: "app",
+ ids: allIds,
+ name: "ResetForm"
+ }
+ });
+ }
+ return false;
+ };
+ }
+}
+class TextAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true
+ });
+ }
+ render() {
+ this.container.classList.add("textAnnotation");
+ const image = document.createElement("img");
+ image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
+ image.setAttribute("data-l10n-id", "pdfjs-text-annotation-type");
+ image.setAttribute("data-l10n-args", JSON.stringify({
+ type: this.data.name
+ }));
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.append(image);
+ return this.container;
+ }
+}
+class WidgetAnnotationElement extends AnnotationElement {
+ render() {
+ return this.container;
+ }
+ showElementAndHideCanvas(element) {
+ if (this.data.hasOwnCanvas) {
+ if (element.previousSibling?.nodeName === "CANVAS") {
+ element.previousSibling.hidden = true;
+ }
+ element.hidden = false;
+ }
+ }
+ _getKeyModifier(event) {
+ return util_FeatureTest.platform.isMac ? event.metaKey : event.ctrlKey;
+ }
+ _setEventListener(element, elementData, baseName, eventName, valueGetter) {
+ if (baseName.includes("mouse")) {
+ element.addEventListener(baseName, event => {
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id: this.data.id,
+ name: eventName,
+ value: valueGetter(event),
+ shift: event.shiftKey,
+ modifier: this._getKeyModifier(event)
+ }
+ });
+ });
+ } 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: {
+ id: this.data.id,
+ name: eventName,
+ value: valueGetter(event)
+ }
+ });
+ });
+ }
+ }
+ _setEventListeners(element, elementData, names, getter) {
+ for (const [baseName, eventName] of names) {
+ if (eventName === "Action" || this.data.actions?.[eventName]) {
+ 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);
+ }
+ }
+ }
+ }
+ _setBackgroundColor(element) {
+ const color = this.data.backgroundColor || null;
+ element.style.backgroundColor = color === null ? "transparent" : Util.makeHexColor(color[0], color[1], color[2]);
+ }
+ _setTextStyle(element) {
+ const TEXT_ALIGNMENT = ["left", "center", "right"];
+ const {
+ fontColor
+ } = this.data.defaultAppearanceData;
+ const fontSize = this.data.defaultAppearanceData.fontSize || annotation_layer_DEFAULT_FONT_SIZE;
+ const style = element.style;
+ let computedFontSize;
+ const BORDER_SIZE = 2;
+ const roundToOneDecimal = x => Math.round(10 * x) / 10;
+ if (this.data.multiLine) {
+ const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
+ const numberOfLines = Math.round(height / (LINE_FACTOR * fontSize)) || 1;
+ const lineHeight = height / numberOfLines;
+ computedFontSize = Math.min(fontSize, roundToOneDecimal(lineHeight / LINE_FACTOR));
+ } else {
+ const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
+ computedFontSize = Math.min(fontSize, roundToOneDecimal(height / LINE_FACTOR));
+ }
+ style.fontSize = `calc(${computedFontSize}px * var(--scale-factor))`;
+ style.color = Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);
+ if (this.data.textAlignment !== null) {
+ style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
+ }
+ }
+ _setRequired(element, isRequired) {
+ if (isRequired) {
+ element.setAttribute("required", true);
+ } else {
+ element.removeAttribute("required");
+ }
+ element.setAttribute("aria-required", isRequired);
+ }
+}
+class TextWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ const isRenderable = parameters.renderForms || parameters.data.hasOwnCanvas || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
+ super(parameters, {
+ isRenderable
+ });
+ }
+ setPropertyOnSiblings(base, key, value, keyInStorage) {
+ const storage = this.annotationStorage;
+ for (const element of this._getElementsByName(base.name, base.id)) {
+ if (element.domElement) {
+ element.domElement[key] = value;
+ }
+ storage.setValue(element.id, {
+ [keyInStorage]: value
+ });
+ }
+ }
+ render() {
+ const storage = this.annotationStorage;
+ const id = this.data.id;
+ this.container.classList.add("textWidgetAnnotation");
+ let element = null;
+ if (this.renderForms) {
+ const storedData = storage.getValue(id, {
+ value: this.data.fieldValue
+ });
+ 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: fieldFormattedValues,
+ lastCommittedValue: null,
+ commitKey: 1,
+ focused: false
+ };
+ if (this.data.multiLine) {
+ element = document.createElement("textarea");
+ element.textContent = fieldFormattedValues ?? textContent;
+ if (this.data.doNotScroll) {
+ element.style.overflowY = "hidden";
+ }
+ } else {
+ element = document.createElement("input");
+ element.type = "text";
+ 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;
+ element.name = this.data.fieldName;
+ element.tabIndex = DEFAULT_TAB_INDEX;
+ this._setRequired(element, this.data.required);
+ if (maxLen) {
+ element.maxLength = maxLen;
+ }
+ element.addEventListener("input", event => {
+ storage.setValue(id, {
+ value: event.target.value
+ });
+ this.setPropertyOnSiblings(element, "value", event.target.value, "value");
+ elementData.formattedValue = null;
+ });
+ element.addEventListener("resetform", event => {
+ const defaultValue = this.data.defaultFieldValue ?? "";
+ element.value = elementData.userValue = defaultValue;
+ elementData.formattedValue = null;
+ });
+ let blurListener = event => {
+ const {
+ formattedValue
+ } = elementData;
+ if (formattedValue !== null && formattedValue !== undefined) {
+ event.target.value = formattedValue;
+ }
+ event.target.scrollLeft = 0;
+ };
+ if (this.enableScripting && this.hasJSActions) {
+ element.addEventListener("focus", event => {
+ if (elementData.focused) {
+ return;
+ }
+ const {
+ target
+ } = event;
+ if (elementData.userValue) {
+ target.value = elementData.userValue;
+ }
+ elementData.lastCommittedValue = target.value;
+ elementData.commitKey = 1;
+ if (!this.data.actions?.Focus) {
+ elementData.focused = true;
+ }
+ });
+ element.addEventListener("updatefromsandbox", jsEvent => {
+ this.showElementAndHideCanvas(jsEvent.target);
+ const actions = {
+ value(event) {
+ elementData.userValue = event.detail.value ?? "";
+ storage.setValue(id, {
+ value: elementData.userValue.toString()
+ });
+ event.target.value = elementData.userValue;
+ },
+ formattedValue(event) {
+ const {
+ formattedValue
+ } = event.detail;
+ elementData.formattedValue = formattedValue;
+ if (formattedValue !== null && formattedValue !== undefined && event.target !== document.activeElement) {
+ event.target.value = formattedValue;
+ }
+ storage.setValue(id, {
+ formattedValue
+ });
+ },
+ selRange(event) {
+ event.target.setSelectionRange(...event.detail.selRange);
+ },
+ charLimit: event => {
+ const {
+ charLimit
+ } = event.detail;
+ const {
+ target
+ } = event;
+ if (charLimit === 0) {
+ target.removeAttribute("maxLength");
+ return;
+ }
+ target.setAttribute("maxLength", charLimit);
+ let value = elementData.userValue;
+ if (!value || value.length <= charLimit) {
+ return;
+ }
+ value = value.slice(0, charLimit);
+ target.value = elementData.userValue = value;
+ storage.setValue(id, {
+ value
+ });
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id,
+ name: "Keystroke",
+ value,
+ willCommit: true,
+ commitKey: 1,
+ selStart: target.selectionStart,
+ selEnd: target.selectionEnd
+ }
+ });
+ }
+ };
+ this._dispatchEventFromSandbox(actions, jsEvent);
+ });
+ element.addEventListener("keydown", event => {
+ elementData.commitKey = 1;
+ let commitKey = -1;
+ if (event.key === "Escape") {
+ commitKey = 0;
+ } else if (event.key === "Enter" && !this.data.multiLine) {
+ commitKey = 2;
+ } else if (event.key === "Tab") {
+ elementData.commitKey = 3;
+ }
+ if (commitKey === -1) {
+ return;
+ }
+ const {
+ value
+ } = event.target;
+ if (elementData.lastCommittedValue === value) {
+ return;
+ }
+ elementData.lastCommittedValue = value;
+ elementData.userValue = value;
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id,
+ name: "Keystroke",
+ value,
+ willCommit: true,
+ commitKey,
+ selStart: event.target.selectionStart,
+ selEnd: event.target.selectionEnd
+ }
+ });
+ });
+ const _blurListener = blurListener;
+ blurListener = null;
+ element.addEventListener("blur", event => {
+ if (!elementData.focused || !event.relatedTarget) {
+ return;
+ }
+ if (!this.data.actions?.Blur) {
+ elementData.focused = false;
+ }
+ const {
+ value
+ } = event.target;
+ elementData.userValue = value;
+ if (elementData.lastCommittedValue !== value) {
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id,
+ name: "Keystroke",
+ value,
+ willCommit: true,
+ commitKey: elementData.commitKey,
+ selStart: event.target.selectionStart,
+ selEnd: event.target.selectionEnd
+ }
+ });
+ }
+ _blurListener(event);
+ });
+ if (this.data.actions?.Keystroke) {
+ element.addEventListener("beforeinput", event => {
+ elementData.lastCommittedValue = null;
+ const {
+ data,
+ target
+ } = event;
+ const {
+ value,
+ selectionStart,
+ selectionEnd
+ } = target;
+ let selStart = selectionStart,
+ selEnd = selectionEnd;
+ switch (event.inputType) {
+ case "deleteWordBackward":
+ {
+ const match = value.substring(0, selectionStart).match(/\w*[^\w]*$/);
+ if (match) {
+ selStart -= match[0].length;
+ }
+ break;
+ }
+ case "deleteWordForward":
+ {
+ const match = value.substring(selectionStart).match(/^[^\w]*\w*/);
+ if (match) {
+ selEnd += match[0].length;
+ }
+ break;
+ }
+ case "deleteContentBackward":
+ if (selectionStart === selectionEnd) {
+ selStart -= 1;
+ }
+ break;
+ case "deleteContentForward":
+ if (selectionStart === selectionEnd) {
+ selEnd += 1;
+ }
+ break;
+ }
+ event.preventDefault();
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id,
+ name: "Keystroke",
+ value,
+ change: data || "",
+ willCommit: false,
+ selStart,
+ selEnd
+ }
+ });
+ });
+ }
+ 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);
+ }
+ if (this.data.comb) {
+ const fieldWidth = this.data.rect[2] - this.data.rect[0];
+ const combWidth = fieldWidth / maxLen;
+ element.classList.add("comb");
+ element.style.letterSpacing = `calc(${combWidth}px * var(--scale-factor) - 1ch)`;
+ }
+ } else {
+ element = document.createElement("div");
+ element.textContent = this.data.fieldValue;
+ element.style.verticalAlign = "middle";
+ element.style.display = "table-cell";
+ if (this.data.hasOwnCanvas) {
+ element.hidden = true;
+ }
+ }
+ this._setTextStyle(element);
+ this._setBackgroundColor(element);
+ this._setDefaultPropertiesFromJS(element);
+ this.container.append(element);
+ return this.container;
+ }
+}
+class SignatureWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: !!parameters.data.hasOwnCanvas
+ });
+ }
+}
+class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: parameters.renderForms
+ });
+ }
+ render() {
+ const storage = this.annotationStorage;
+ const data = this.data;
+ const id = data.id;
+ let value = storage.getValue(id, {
+ value: data.exportValue === data.fieldValue
+ }).value;
+ if (typeof value === "string") {
+ value = value !== "Off";
+ storage.setValue(id, {
+ value
+ });
+ }
+ this.container.classList.add("buttonWidgetAnnotation", "checkBox");
+ const element = document.createElement("input");
+ GetElementsByNameSet.add(element);
+ element.setAttribute("data-element-id", id);
+ element.disabled = data.readOnly;
+ this._setRequired(element, this.data.required);
+ element.type = "checkbox";
+ element.name = data.fieldName;
+ if (value) {
+ element.setAttribute("checked", true);
+ }
+ element.setAttribute("exportValue", data.exportValue);
+ element.tabIndex = DEFAULT_TAB_INDEX;
+ element.addEventListener("change", event => {
+ const {
+ name,
+ checked
+ } = event.target;
+ for (const checkbox of this._getElementsByName(name, id)) {
+ const curChecked = checked && checkbox.exportValue === data.exportValue;
+ if (checkbox.domElement) {
+ checkbox.domElement.checked = curChecked;
+ }
+ storage.setValue(checkbox.id, {
+ value: curChecked
+ });
+ }
+ storage.setValue(id, {
+ value: checked
+ });
+ });
+ element.addEventListener("resetform", event => {
+ const defaultValue = data.defaultFieldValue || "Off";
+ event.target.checked = defaultValue === data.exportValue;
+ });
+ if (this.enableScripting && this.hasJSActions) {
+ element.addEventListener("updatefromsandbox", jsEvent => {
+ const actions = {
+ value(event) {
+ event.target.checked = event.detail.value !== "Off";
+ storage.setValue(id, {
+ value: event.target.checked
+ });
+ }
+ };
+ this._dispatchEventFromSandbox(actions, jsEvent);
+ });
+ 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);
+ this.container.append(element);
+ return this.container;
+ }
+}
+class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: parameters.renderForms
+ });
+ }
+ render() {
+ this.container.classList.add("buttonWidgetAnnotation", "radioButton");
+ const storage = this.annotationStorage;
+ const data = this.data;
+ const id = data.id;
+ let value = storage.getValue(id, {
+ value: data.fieldValue === data.buttonValue
+ }).value;
+ if (typeof value === "string") {
+ value = value !== data.buttonValue;
+ storage.setValue(id, {
+ value
+ });
+ }
+ if (value) {
+ for (const radio of this._getElementsByName(data.fieldName, id)) {
+ storage.setValue(radio.id, {
+ value: false
+ });
+ }
+ }
+ const element = document.createElement("input");
+ GetElementsByNameSet.add(element);
+ element.setAttribute("data-element-id", id);
+ element.disabled = data.readOnly;
+ this._setRequired(element, this.data.required);
+ element.type = "radio";
+ element.name = data.fieldName;
+ if (value) {
+ element.setAttribute("checked", true);
+ }
+ element.tabIndex = DEFAULT_TAB_INDEX;
+ element.addEventListener("change", event => {
+ const {
+ name,
+ checked
+ } = event.target;
+ for (const radio of this._getElementsByName(name, id)) {
+ storage.setValue(radio.id, {
+ value: false
+ });
+ }
+ storage.setValue(id, {
+ value: checked
+ });
+ });
+ element.addEventListener("resetform", event => {
+ const defaultValue = data.defaultFieldValue;
+ event.target.checked = defaultValue !== null && defaultValue !== undefined && defaultValue === data.buttonValue;
+ });
+ if (this.enableScripting && this.hasJSActions) {
+ const pdfButtonValue = data.buttonValue;
+ element.addEventListener("updatefromsandbox", jsEvent => {
+ const actions = {
+ value: event => {
+ const checked = pdfButtonValue === event.detail.value;
+ for (const radio of this._getElementsByName(event.target.name)) {
+ const curChecked = checked && radio.id === id;
+ if (radio.domElement) {
+ radio.domElement.checked = curChecked;
+ }
+ storage.setValue(radio.id, {
+ value: curChecked
+ });
+ }
+ }
+ };
+ this._dispatchEventFromSandbox(actions, jsEvent);
+ });
+ 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);
+ this.container.append(element);
+ return this.container;
+ }
+}
+class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ ignoreBorder: parameters.data.hasAppearance
+ });
+ }
+ render() {
+ const container = super.render();
+ container.classList.add("buttonWidgetAnnotation", "pushButton");
+ const linkElement = container.lastChild;
+ if (this.enableScripting && this.hasJSActions && linkElement) {
+ this._setDefaultPropertiesFromJS(linkElement);
+ linkElement.addEventListener("updatefromsandbox", jsEvent => {
+ this._dispatchEventFromSandbox({}, jsEvent);
+ });
+ }
+ return container;
+ }
+}
+class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: parameters.renderForms
+ });
+ }
+ render() {
+ this.container.classList.add("choiceWidgetAnnotation");
+ const storage = this.annotationStorage;
+ const id = this.data.id;
+ const storedData = storage.getValue(id, {
+ value: this.data.fieldValue
+ });
+ const selectElement = document.createElement("select");
+ GetElementsByNameSet.add(selectElement);
+ selectElement.setAttribute("data-element-id", id);
+ selectElement.disabled = this.data.readOnly;
+ this._setRequired(selectElement, this.data.required);
+ selectElement.name = this.data.fieldName;
+ selectElement.tabIndex = DEFAULT_TAB_INDEX;
+ let addAnEmptyEntry = this.data.combo && this.data.options.length > 0;
+ if (!this.data.combo) {
+ selectElement.size = this.data.options.length;
+ if (this.data.multiSelect) {
+ selectElement.multiple = true;
+ }
+ }
+ selectElement.addEventListener("resetform", event => {
+ const defaultValue = this.data.defaultFieldValue;
+ for (const option of selectElement.options) {
+ option.selected = option.value === defaultValue;
+ }
+ });
+ for (const option of this.data.options) {
+ const optionElement = document.createElement("option");
+ optionElement.textContent = option.displayValue;
+ optionElement.value = option.exportValue;
+ if (storedData.value.includes(option.exportValue)) {
+ optionElement.setAttribute("selected", true);
+ addAnEmptyEntry = false;
+ }
+ selectElement.append(optionElement);
+ }
+ let removeEmptyEntry = null;
+ if (addAnEmptyEntry) {
+ const noneOptionElement = document.createElement("option");
+ noneOptionElement.value = " ";
+ noneOptionElement.setAttribute("hidden", true);
+ noneOptionElement.setAttribute("selected", true);
+ selectElement.prepend(noneOptionElement);
+ removeEmptyEntry = () => {
+ noneOptionElement.remove();
+ selectElement.removeEventListener("input", removeEmptyEntry);
+ removeEmptyEntry = null;
+ };
+ selectElement.addEventListener("input", removeEmptyEntry);
+ }
+ const getValue = isExport => {
+ const name = isExport ? "value" : "textContent";
+ const {
+ options,
+ multiple
+ } = selectElement;
+ if (!multiple) {
+ return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];
+ }
+ return Array.prototype.filter.call(options, option => option.selected).map(option => option[name]);
+ };
+ let selectedValues = getValue(false);
+ const getItems = event => {
+ const options = event.target.options;
+ return Array.prototype.map.call(options, option => ({
+ displayValue: option.textContent,
+ exportValue: option.value
+ }));
+ };
+ if (this.enableScripting && this.hasJSActions) {
+ selectElement.addEventListener("updatefromsandbox", jsEvent => {
+ const actions = {
+ value(event) {
+ removeEmptyEntry?.();
+ const value = event.detail.value;
+ const values = new Set(Array.isArray(value) ? value : [value]);
+ for (const option of selectElement.options) {
+ option.selected = values.has(option.value);
+ }
+ storage.setValue(id, {
+ value: getValue(true)
+ });
+ selectedValues = getValue(false);
+ },
+ multipleSelection(event) {
+ selectElement.multiple = true;
+ },
+ remove(event) {
+ const options = selectElement.options;
+ const index = event.detail.remove;
+ options[index].selected = false;
+ selectElement.remove(index);
+ if (options.length > 0) {
+ const i = Array.prototype.findIndex.call(options, option => option.selected);
+ if (i === -1) {
+ options[0].selected = true;
+ }
+ }
+ storage.setValue(id, {
+ value: getValue(true),
+ items: getItems(event)
+ });
+ selectedValues = getValue(false);
+ },
+ clear(event) {
+ while (selectElement.length !== 0) {
+ selectElement.remove(0);
+ }
+ storage.setValue(id, {
+ value: null,
+ items: []
+ });
+ selectedValues = getValue(false);
+ },
+ insert(event) {
+ const {
+ index,
+ displayValue,
+ exportValue
+ } = event.detail.insert;
+ const selectChild = selectElement.children[index];
+ const optionElement = document.createElement("option");
+ optionElement.textContent = displayValue;
+ optionElement.value = exportValue;
+ if (selectChild) {
+ selectChild.before(optionElement);
+ } else {
+ selectElement.append(optionElement);
+ }
+ storage.setValue(id, {
+ value: getValue(true),
+ items: getItems(event)
+ });
+ selectedValues = getValue(false);
+ },
+ items(event) {
+ const {
+ items
+ } = event.detail;
+ while (selectElement.length !== 0) {
+ selectElement.remove(0);
+ }
+ for (const item of items) {
+ const {
+ displayValue,
+ exportValue
+ } = item;
+ const optionElement = document.createElement("option");
+ optionElement.textContent = displayValue;
+ optionElement.value = exportValue;
+ selectElement.append(optionElement);
+ }
+ if (selectElement.options.length > 0) {
+ selectElement.options[0].selected = true;
+ }
+ storage.setValue(id, {
+ value: getValue(true),
+ items: getItems(event)
+ });
+ selectedValues = getValue(false);
+ },
+ indices(event) {
+ const indices = new Set(event.detail.indices);
+ for (const option of event.target.options) {
+ option.selected = indices.has(option.index);
+ }
+ storage.setValue(id, {
+ value: getValue(true)
+ });
+ selectedValues = getValue(false);
+ },
+ editable(event) {
+ event.target.disabled = !event.detail.editable;
+ }
+ };
+ this._dispatchEventFromSandbox(actions, jsEvent);
+ });
+ selectElement.addEventListener("input", event => {
+ const exportValue = getValue(true);
+ const change = getValue(false);
+ storage.setValue(id, {
+ value: exportValue
+ });
+ event.preventDefault();
+ this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
+ source: this,
+ detail: {
+ id,
+ name: "Keystroke",
+ value: selectedValues,
+ change,
+ changeEx: exportValue,
+ willCommit: false,
+ commitKey: 1,
+ keyDown: false
+ }
+ });
+ });
+ 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, {
+ value: getValue(true)
+ });
+ });
+ }
+ if (this.data.combo) {
+ this._setTextStyle(selectElement);
+ } else {}
+ this._setBackgroundColor(selectElement);
+ this._setDefaultPropertiesFromJS(selectElement);
+ this.container.append(selectElement);
+ return this.container;
+ }
+}
+class PopupAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ const {
+ data,
+ elements
+ } = parameters;
+ super(parameters, {
+ isRenderable: AnnotationElement._hasPopupData(data)
+ });
+ this.elements = elements;
+ this.popup = null;
+ }
+ render() {
+ this.container.classList.add("popupAnnotation");
+ const popup = this.popup = new PopupElement({
+ container: this.container,
+ color: this.data.color,
+ titleObj: this.data.titleObj,
+ modificationDate: this.data.modificationDate,
+ contentsObj: this.data.contentsObj,
+ richText: this.data.richText,
+ rect: this.data.rect,
+ parentRect: this.data.parentRect || null,
+ parent: this.parent,
+ elements: this.elements,
+ open: this.data.open
+ });
+ const elementIds = [];
+ for (const element of this.elements) {
+ element.popup = popup;
+ element.container.ariaHasPopup = "dialog";
+ elementIds.push(element.data.id);
+ element.addHighlightArea();
+ }
+ this.container.setAttribute("aria-controls", elementIds.map(id => `${AnnotationPrefix}${id}`).join(","));
+ return this.container;
+ }
+}
+class PopupElement {
+ #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;
+ #dateObj = null;
+ #elements = null;
+ #parent = null;
+ #parentRect = null;
+ #pinned = false;
+ #popup = null;
+ #position = null;
+ #rect = null;
+ #richText = null;
+ #titleObj = null;
+ #updates = 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;
+ this.#dateObj = PDFDateString.toDateObject(modificationDate);
+ 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 popup = this.#popup = document.createElement("div");
+ popup.className = "popup";
+ if (this.#color) {
+ const baseColor = popup.style.outlineColor = 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.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");
+ header.append(title);
+ ({
+ dir: title.dir,
+ str: title.textContent
+ } = this.#titleObj);
+ popup.append(header);
+ if (this.#dateObj) {
+ const modificationDate = document.createElement("span");
+ modificationDate.classList.add("popupDate");
+ modificationDate.setAttribute("data-l10n-id", "pdfjs-annotation-date-time-string");
+ modificationDate.setAttribute("data-l10n-args", JSON.stringify({
+ dateObj: this.#dateObj.valueOf()
+ }));
+ header.append(modificationDate);
+ }
+ const html = this.#html;
+ if (html) {
+ XfaLayer.render({
+ xfaHtml: html,
+ intent: "richText",
+ div: popup
+ });
+ popup.lastChild.classList.add("richText", "popupContent");
+ } else {
+ const contents = this._formatContents(this.#contentsObj);
+ popup.append(contents);
+ }
+ this.#container.append(popup);
+ }
+ get #html() {
+ const richText = this.#richText;
+ const contentsObj = this.#contentsObj;
+ if (richText?.str && (!contentsObj?.str || contentsObj.str === richText.str)) {
+ return this.#richText.html || null;
+ }
+ return null;
+ }
+ get #fontSize() {
+ return this.#html?.attributes?.style?.fontSize || 0;
+ }
+ get #fontColor() {
+ return this.#html?.attributes?.style?.color || null;
+ }
+ #makePopupContent(text) {
+ const popupLines = [];
+ const popupContent = {
+ str: text,
+ html: {
+ name: "div",
+ attributes: {
+ dir: "auto"
+ },
+ children: [{
+ name: "p",
+ children: popupLines
+ }]
+ }
+ };
+ const lineAttributes = {
+ style: {
+ color: this.#fontColor,
+ fontSize: this.#fontSize ? `calc(${this.#fontSize}px * var(--scale-factor))` : ""
+ }
+ };
+ for (const line of text.split("\n")) {
+ popupLines.push({
+ name: "span",
+ value: line,
+ attributes: lineAttributes
+ });
+ }
+ return popupContent;
+ }
+ _formatContents({
+ str,
+ dir
+ }) {
+ const p = document.createElement("p");
+ p.classList.add("popupContent");
+ p.dir = dir;
+ const lines = str.split(/(?:\r\n?|\n)/);
+ for (let i = 0, ii = lines.length; i < ii; ++i) {
+ const line = lines[i];
+ p.append(document.createTextNode(line));
+ if (i < ii - 1) {
+ p.append(document.createElement("br"));
+ }
+ }
+ return p;
+ }
+ #keyDown(event) {
+ if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
+ return;
+ }
+ if (event.key === "Enter" || event.key === "Escape" && this.#pinned) {
+ this.#toggle();
+ }
+ }
+ updateEdited({
+ rect,
+ popupContent
+ }) {
+ this.#updates ||= {
+ contentsObj: this.#contentsObj,
+ richText: this.#richText
+ };
+ if (rect) {
+ this.#position = null;
+ }
+ if (popupContent) {
+ this.#richText = this.#makePopupContent(popupContent);
+ this.#contentsObj = null;
+ }
+ this.#popup?.remove();
+ this.#popup = null;
+ }
+ resetEdited() {
+ if (!this.#updates) {
+ return;
+ }
+ ({
+ contentsObj: this.#contentsObj,
+ richText: this.#richText
+ } = this.#updates);
+ this.#updates = null;
+ this.#popup?.remove();
+ this.#popup = null;
+ this.#position = null;
+ }
+ #setPosition() {
+ if (this.#position !== null) {
+ return;
+ }
+ const {
+ page: {
+ view
+ },
+ viewport: {
+ rawDims: {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ }
+ }
+ } = this.#parent;
+ let useParentRect = !!this.#parentRect;
+ let rect = useParentRect ? this.#parentRect : this.#rect;
+ for (const element of this.#elements) {
+ if (!rect || Util.intersect(element.data.rect, rect) !== null) {
+ rect = element.data.rect;
+ useParentRect = true;
+ break;
+ }
+ }
+ const normalizedRect = 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];
+ this.#position = [100 * (popupLeft - pageX) / pageWidth, 100 * (popupTop - pageY) / pageHeight];
+ const {
+ style
+ } = this.#container;
+ style.left = `${this.#position[0]}%`;
+ style.top = `${this.#position[1]}%`;
+ }
+ #toggle() {
+ this.#pinned = !this.#pinned;
+ if (this.#pinned) {
+ this.#show();
+ this.#container.addEventListener("click", this.#boundToggle);
+ this.#container.addEventListener("keydown", this.#boundKeyDown);
+ } else {
+ this.#hide();
+ this.#container.removeEventListener("click", this.#boundToggle);
+ this.#container.removeEventListener("keydown", this.#boundKeyDown);
+ }
+ }
+ #show() {
+ if (!this.#popup) {
+ this.render();
+ }
+ if (!this.isVisible) {
+ this.#setPosition();
+ this.#container.hidden = false;
+ this.#container.style.zIndex = parseInt(this.#container.style.zIndex) + 1000;
+ } else if (this.#pinned) {
+ this.#container.classList.add("focused");
+ }
+ }
+ #hide() {
+ this.#container.classList.remove("focused");
+ if (this.#pinned || !this.isVisible) {
+ return;
+ }
+ 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;
+ }
+ if (!this.#popup) {
+ this.#show();
+ }
+ this.#wasVisible = false;
+ this.#container.hidden = false;
+ }
+ get isVisible() {
+ return this.#container.hidden === false;
+ }
+}
+class FreeTextAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ this.textContent = parameters.data.textContent;
+ this.textPosition = parameters.data.textPosition;
+ this.annotationEditorType = AnnotationEditorType.FREETEXT;
+ }
+ render() {
+ this.container.classList.add("freeTextAnnotation");
+ if (this.textContent) {
+ const content = document.createElement("div");
+ content.classList.add("annotationTextContent");
+ content.setAttribute("role", "comment");
+ for (const line of this.textContent) {
+ const lineSpan = document.createElement("span");
+ lineSpan.textContent = line;
+ content.append(lineSpan);
+ }
+ this.container.append(content);
+ }
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this._editOnDoubleClick();
+ return this.container;
+ }
+}
+class LineAnnotationElement extends AnnotationElement {
+ #line = null;
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ }
+ render() {
+ 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.#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]);
+ line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
+ line.setAttribute("stroke-width", data.borderStyle.width || 1);
+ line.setAttribute("stroke", "transparent");
+ line.setAttribute("fill", "transparent");
+ svg.append(line);
+ this.container.append(svg);
+ 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) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ }
+ render() {
+ this.container.classList.add("squareAnnotation");
+ const data = this.data;
+ const {
+ width,
+ height
+ } = getRectDims(data.rect);
+ const svg = this.svgFactory.create(width, height, true);
+ const borderWidth = data.borderStyle.width;
+ const square = this.#square = this.svgFactory.createElement("svg:rect");
+ square.setAttribute("x", borderWidth / 2);
+ square.setAttribute("y", borderWidth / 2);
+ square.setAttribute("width", width - borderWidth);
+ square.setAttribute("height", height - borderWidth);
+ square.setAttribute("stroke-width", borderWidth || 1);
+ square.setAttribute("stroke", "transparent");
+ square.setAttribute("fill", "transparent");
+ svg.append(square);
+ this.container.append(svg);
+ 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) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ }
+ render() {
+ this.container.classList.add("circleAnnotation");
+ const data = this.data;
+ const {
+ width,
+ height
+ } = getRectDims(data.rect);
+ const svg = this.svgFactory.create(width, height, true);
+ const borderWidth = data.borderStyle.width;
+ 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);
+ circle.setAttribute("ry", height / 2 - borderWidth / 2);
+ circle.setAttribute("stroke-width", borderWidth || 1);
+ circle.setAttribute("stroke", "transparent");
+ circle.setAttribute("fill", "transparent");
+ svg.append(circle);
+ this.container.append(svg);
+ 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) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ this.containerClassName = "polylineAnnotation";
+ this.svgElementName = "svg:polyline";
+ }
+ render() {
+ this.container.classList.add(this.containerClassName);
+ const {
+ data: {
+ rect,
+ vertices,
+ borderStyle,
+ popupRef
+ }
+ } = this;
+ if (!vertices) {
+ return this.container;
+ }
+ const {
+ width,
+ height
+ } = getRectDims(rect);
+ const svg = this.svgFactory.create(width, height, true);
+ let points = [];
+ for (let i = 0, ii = vertices.length; i < ii; i += 2) {
+ const x = vertices[i] - rect[0];
+ const y = rect[3] - vertices[i + 1];
+ points.push(`${x},${y}`);
+ }
+ points = points.join(" ");
+ const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
+ polyline.setAttribute("points", points);
+ polyline.setAttribute("stroke-width", borderStyle.width || 1);
+ polyline.setAttribute("stroke", "transparent");
+ polyline.setAttribute("fill", "transparent");
+ svg.append(polyline);
+ this.container.append(svg);
+ if (!popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ return this.container;
+ }
+ getElementsToTriggerPopup() {
+ return this.#polyline;
+ }
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
+}
+class PolygonAnnotationElement extends PolylineAnnotationElement {
+ constructor(parameters) {
+ super(parameters);
+ this.containerClassName = "polygonAnnotation";
+ this.svgElementName = "svg:polygon";
+ }
+}
+class CaretAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ }
+ render() {
+ this.container.classList.add("caretAnnotation");
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ return this.container;
+ }
+}
+class InkAnnotationElement extends AnnotationElement {
+ #polylinesGroupElement = null;
+ #polylines = [];
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ this.containerClassName = "inkAnnotation";
+ this.svgElementName = "svg:polyline";
+ this.annotationEditorType = this.data.it === "InkHighlight" ? AnnotationEditorType.HIGHLIGHT : AnnotationEditorType.INK;
+ }
+ #getTransform(rotation, rect) {
+ switch (rotation) {
+ case 90:
+ return {
+ transform: `rotate(90) translate(${-rect[0]},${rect[1]}) scale(1,-1)`,
+ width: rect[3] - rect[1],
+ height: rect[2] - rect[0]
+ };
+ case 180:
+ return {
+ transform: `rotate(180) translate(${-rect[2]},${rect[1]}) scale(1,-1)`,
+ width: rect[2] - rect[0],
+ height: rect[3] - rect[1]
+ };
+ case 270:
+ return {
+ transform: `rotate(270) translate(${-rect[2]},${rect[3]}) scale(1,-1)`,
+ width: rect[3] - rect[1],
+ height: rect[2] - rect[0]
+ };
+ default:
+ return {
+ transform: `translate(${-rect[0]},${rect[3]}) scale(1,-1)`,
+ width: rect[2] - rect[0],
+ height: rect[3] - rect[1]
+ };
+ }
+ }
+ render() {
+ this.container.classList.add(this.containerClassName);
+ const {
+ data: {
+ rect,
+ rotation,
+ inkLists,
+ borderStyle,
+ popupRef
+ }
+ } = this;
+ const {
+ transform,
+ width,
+ height
+ } = this.#getTransform(rotation, rect);
+ const svg = this.svgFactory.create(width, height, true);
+ const g = this.#polylinesGroupElement = this.svgFactory.createElement("svg:g");
+ svg.append(g);
+ g.setAttribute("stroke-width", borderStyle.width || 1);
+ g.setAttribute("stroke-linecap", "round");
+ g.setAttribute("stroke-linejoin", "round");
+ g.setAttribute("stroke-miterlimit", 10);
+ g.setAttribute("stroke", "transparent");
+ g.setAttribute("fill", "transparent");
+ g.setAttribute("transform", transform);
+ for (let i = 0, ii = inkLists.length; i < ii; i++) {
+ const polyline = this.svgFactory.createElement(this.svgElementName);
+ this.#polylines.push(polyline);
+ polyline.setAttribute("points", inkLists[i].join(","));
+ g.append(polyline);
+ }
+ if (!popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.append(svg);
+ this._editOnDoubleClick();
+ return this.container;
+ }
+ updateEdited(params) {
+ super.updateEdited(params);
+ const {
+ thickness,
+ points,
+ rect
+ } = params;
+ const g = this.#polylinesGroupElement;
+ if (thickness >= 0) {
+ g.setAttribute("stroke-width", thickness || 1);
+ }
+ if (points) {
+ for (let i = 0, ii = this.#polylines.length; i < ii; i++) {
+ this.#polylines[i].setAttribute("points", points[i].join(","));
+ }
+ }
+ if (rect) {
+ const {
+ transform,
+ width,
+ height
+ } = this.#getTransform(this.data.rotation, rect);
+ const root = g.parentElement;
+ root.setAttribute("viewBox", `0 0 ${width} ${height}`);
+ g.setAttribute("transform", transform);
+ }
+ }
+ getElementsToTriggerPopup() {
+ return this.#polylines;
+ }
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
+}
+class HighlightAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true,
+ createQuadrilaterals: true
+ });
+ this.annotationEditorType = AnnotationEditorType.HIGHLIGHT;
+ }
+ render() {
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.classList.add("highlightAnnotation");
+ this._editOnDoubleClick();
+ return this.container;
+ }
+}
+class UnderlineAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true,
+ createQuadrilaterals: true
+ });
+ }
+ render() {
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.classList.add("underlineAnnotation");
+ return this.container;
+ }
+}
+class SquigglyAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true,
+ createQuadrilaterals: true
+ });
+ }
+ render() {
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.classList.add("squigglyAnnotation");
+ return this.container;
+ }
+}
+class StrikeOutAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true,
+ createQuadrilaterals: true
+ });
+ }
+ render() {
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this.container.classList.add("strikeoutAnnotation");
+ return this.container;
+ }
+}
+class StampAnnotationElement extends AnnotationElement {
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true,
+ ignoreBorder: true
+ });
+ this.annotationEditorType = AnnotationEditorType.STAMP;
+ }
+ render() {
+ this.container.classList.add("stampAnnotation");
+ this.container.setAttribute("role", "img");
+ if (!this.data.popupRef && this.hasPopupData) {
+ this._createPopup();
+ }
+ this._editOnDoubleClick();
+ return this.container;
+ }
+}
+class FileAttachmentAnnotationElement extends AnnotationElement {
+ #trigger = null;
+ constructor(parameters) {
+ super(parameters, {
+ isRenderable: true
+ });
+ const {
+ file
+ } = this.data;
+ this.filename = file.filename;
+ this.content = file.content;
+ this.linkService.eventBus?.dispatch("fileattachmentannotation", {
+ source: this,
+ ...file
+ });
+ }
+ render() {
+ this.container.classList.add("fileAttachmentAnnotation");
+ const {
+ container,
+ data
+ } = this;
+ let trigger;
+ if (data.hasAppearance || data.fillAlpha === 0) {
+ trigger = document.createElement("div");
+ } else {
+ trigger = document.createElement("img");
+ 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");
+ }
+ container.append(trigger);
+ return container;
+ }
+ getElementsToTriggerPopup() {
+ return this.#trigger;
+ }
+ addHighlightArea() {
+ this.container.classList.add("highlightArea");
+ }
+ #download() {
+ this.downloadManager?.openOrDownloadData(this.content, this.filename);
+ }
+}
+class AnnotationLayer {
+ #accessibilityManager = null;
+ #annotationCanvasMap = null;
+ #editableAnnotations = new Map();
+ #structTreeLayer = null;
+ constructor({
+ div,
+ accessibilityManager,
+ annotationCanvasMap,
+ annotationEditorUIManager,
+ page,
+ viewport,
+ structTreeLayer
+ }) {
+ this.div = div;
+ this.#accessibilityManager = accessibilityManager;
+ this.#annotationCanvasMap = annotationCanvasMap;
+ this.#structTreeLayer = structTreeLayer || null;
+ this.page = page;
+ this.viewport = viewport;
+ this.zIndex = 0;
+ this._annotationEditorUIManager = annotationEditorUIManager;
+ }
+ hasEditableAnnotations() {
+ return this.#editableAnnotations.size > 0;
+ }
+ async #appendElement(element, id) {
+ const contentElement = element.firstChild || element;
+ const annotationId = contentElement.id = `${AnnotationPrefix}${id}`;
+ const ariaAttributes = await this.#structTreeLayer?.getAriaAttributes(annotationId);
+ if (ariaAttributes) {
+ for (const [key, value] of ariaAttributes) {
+ contentElement.setAttribute(key, value);
+ }
+ }
+ this.div.append(element);
+ this.#accessibilityManager?.moveElementInDOM(this.div, element, contentElement, false);
+ }
+ async render(params) {
+ const {
+ annotations
+ } = params;
+ const layer = this.div;
+ setLayerDimensions(layer, this.viewport);
+ const popupToElements = new Map();
+ const elementParams = {
+ data: null,
+ layer,
+ linkService: params.linkService,
+ downloadManager: params.downloadManager,
+ imageResourcesPath: params.imageResourcesPath || "",
+ renderForms: params.renderForms !== false,
+ svgFactory: new DOMSVGFactory(),
+ annotationStorage: params.annotationStorage || new AnnotationStorage(),
+ enableScripting: params.enableScripting === true,
+ hasJSActions: params.hasJSActions,
+ fieldObjects: params.fieldObjects,
+ parent: this,
+ elements: null
+ };
+ for (const data of annotations) {
+ if (data.noHTML) {
+ continue;
+ }
+ const isPopupAnnotation = data.annotationType === AnnotationType.POPUP;
+ if (!isPopupAnnotation) {
+ const {
+ width,
+ height
+ } = getRectDims(data.rect);
+ 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);
+ }
+ }
+ const rendered = element.render();
+ if (data.hidden) {
+ rendered.style.visibility = "hidden";
+ }
+ await this.#appendElement(rendered, data.id);
+ if (element._isEditable) {
+ this.#editableAnnotations.set(element.data.id, element);
+ this._annotationEditorUIManager?.renderAnnotationElement(element);
+ }
+ }
+ this.#setAnnotationCanvasMap();
+ }
+ update({
+ viewport
+ }) {
+ const layer = this.div;
+ this.viewport = viewport;
+ setLayerDimensions(layer, {
+ rotation: viewport.rotation
+ });
+ this.#setAnnotationCanvasMap();
+ layer.hidden = false;
+ }
+ #setAnnotationCanvasMap() {
+ if (!this.#annotationCanvasMap) {
+ return;
+ }
+ const layer = this.div;
+ for (const [id, canvas] of this.#annotationCanvasMap) {
+ const element = layer.querySelector(`[data-annotation-id="${id}"]`);
+ if (!element) {
+ continue;
+ }
+ canvas.className = "annotationContent";
+ const {
+ firstChild
+ } = element;
+ if (!firstChild) {
+ element.append(canvas);
+ } else if (firstChild.nodeName === "CANVAS") {
+ firstChild.replaceWith(canvas);
+ } else if (!firstChild.classList.contains("annotationContent")) {
+ firstChild.before(canvas);
+ } else {
+ firstChild.after(canvas);
+ }
+ }
+ this.#annotationCanvasMap.clear();
+ }
+ getEditableAnnotations() {
+ return Array.from(this.#editableAnnotations.values());
+ }
+ getEditableAnnotation(id) {
+ return this.#editableAnnotations.get(id);
+ }
+}
+
+;// ./src/display/editor/freetext.js
+
+
+
+
+const EOL_PATTERN = /\r\n?|\n/g;
+class FreeTextEditor extends AnnotationEditor {
+ #color;
+ #content = "";
+ #editorDivId = `${this.id}-editor`;
+ #editModeAC = null;
+ #fontSize;
+ static _freeTextDefaultContent = "";
+ static _internalPadding = 0;
+ static _defaultColor = null;
+ static _defaultFontSize = 10;
+ static get _keyboardManager() {
+ const proto = FreeTextEditor.prototype;
+ const arrowChecker = self => self.isEmpty();
+ const small = AnnotationEditorUIManager.TRANSLATE_SMALL;
+ const big = AnnotationEditorUIManager.TRANSLATE_BIG;
+ return shadow(this, "_keyboardManager", new 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";
+ static _editorType = AnnotationEditorType.FREETEXT;
+ constructor(params) {
+ super({
+ ...params,
+ name: "freeTextEditor"
+ });
+ this.#color = params.color || FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor;
+ this.#fontSize = params.fontSize || FreeTextEditor._defaultFontSize;
+ }
+ static initialize(l10n, uiManager) {
+ AnnotationEditor.initialize(l10n, uiManager);
+ const style = getComputedStyle(document.documentElement);
+ this._internalPadding = parseFloat(style.getPropertyValue("--freetext-padding"));
+ }
+ static updateDefaultParams(type, value) {
+ switch (type) {
+ case AnnotationEditorParamsType.FREETEXT_SIZE:
+ FreeTextEditor._defaultFontSize = value;
+ break;
+ case AnnotationEditorParamsType.FREETEXT_COLOR:
+ FreeTextEditor._defaultColor = value;
+ break;
+ }
+ }
+ updateParams(type, value) {
+ switch (type) {
+ case AnnotationEditorParamsType.FREETEXT_SIZE:
+ this.#updateFontSize(value);
+ break;
+ case AnnotationEditorParamsType.FREETEXT_COLOR:
+ this.#updateColor(value);
+ break;
+ }
+ }
+ static get defaultPropertiesToUpdate() {
+ return [[AnnotationEditorParamsType.FREETEXT_SIZE, FreeTextEditor._defaultFontSize], [AnnotationEditorParamsType.FREETEXT_COLOR, FreeTextEditor._defaultColor || AnnotationEditor._defaultLineColor]];
+ }
+ get propertiesToUpdate() {
+ return [[AnnotationEditorParamsType.FREETEXT_SIZE, this.#fontSize], [AnnotationEditorParamsType.FREETEXT_COLOR, this.#color]];
+ }
+ #updateFontSize(fontSize) {
+ const setFontsize = size => {
+ this.editorDiv.style.fontSize = `calc(${size}px * var(--scale-factor))`;
+ this.translate(0, -(size - this.#fontSize) * this.parentScale);
+ this.#fontSize = size;
+ this.#setEditorDimensions();
+ };
+ const savedFontsize = this.#fontSize;
+ this.addCommands({
+ cmd: setFontsize.bind(this, fontSize),
+ undo: setFontsize.bind(this, savedFontsize),
+ post: this._uiManager.updateUI.bind(this._uiManager, this),
+ mustExec: true,
+ type: AnnotationEditorParamsType.FREETEXT_SIZE,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ }
+ #updateColor(color) {
+ const setColor = col => {
+ this.#color = this.editorDiv.style.color = col;
+ };
+ const savedColor = this.#color;
+ this.addCommands({
+ cmd: setColor.bind(this, color),
+ undo: setColor.bind(this, savedColor),
+ post: this._uiManager.updateUI.bind(this._uiManager, this),
+ mustExec: true,
+ type: AnnotationEditorParamsType.FREETEXT_COLOR,
+ overwriteIfSameType: true,
+ 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;
+ }
+ if (!this.isAttachedToDOM) {
+ this.parent.add(this);
+ }
+ }
+ enableEditMode() {
+ if (this.isInEditMode()) {
+ return;
+ }
+ this.parent.setEditingState(false);
+ this.parent.updateToolbar(AnnotationEditorType.FREETEXT);
+ super.enableEditMode();
+ this.overlayDiv.classList.remove("enabled");
+ this.editorDiv.contentEditable = true;
+ this._isDraggable = false;
+ this.div.removeAttribute("aria-activedescendant");
+ this.#editModeAC = new AbortController();
+ const signal = this._uiManager.combinedSignal(this.#editModeAC);
+ this.editorDiv.addEventListener("keydown", this.editorDivKeydown.bind(this), {
+ signal
+ });
+ this.editorDiv.addEventListener("focus", this.editorDivFocus.bind(this), {
+ signal
+ });
+ this.editorDiv.addEventListener("blur", this.editorDivBlur.bind(this), {
+ signal
+ });
+ this.editorDiv.addEventListener("input", this.editorDivInput.bind(this), {
+ signal
+ });
+ this.editorDiv.addEventListener("paste", this.editorDivPaste.bind(this), {
+ signal
+ });
+ }
+ disableEditMode() {
+ if (!this.isInEditMode()) {
+ return;
+ }
+ this.parent.setEditingState(true);
+ super.disableEditMode();
+ this.overlayDiv.classList.add("enabled");
+ this.editorDiv.contentEditable = false;
+ this.div.setAttribute("aria-activedescendant", this.#editorDivId);
+ this._isDraggable = true;
+ this.#editModeAC?.abort();
+ this.#editModeAC = null;
+ this.div.focus({
+ preventScroll: true
+ });
+ this.isEditing = false;
+ this.parent.div.classList.add("freetextEditing");
+ }
+ focusin(event) {
+ if (!this._focusEventsAllowed) {
+ return;
+ }
+ super.focusin(event);
+ if (event.target !== this.editorDiv) {
+ this.editorDiv.focus();
+ }
+ }
+ onceAdded() {
+ if (this.width) {
+ 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;
+ if (this.parent) {
+ this.parent.setEditingState(true);
+ this.parent.div.classList.add("freetextEditing");
+ }
+ super.remove();
+ }
+ #extractText() {
+ const buffer = [];
+ this.editorDiv.normalize();
+ let prevChild = null;
+ for (const child of this.editorDiv.childNodes) {
+ if (prevChild?.nodeType === Node.TEXT_NODE && child.nodeName === "BR") {
+ continue;
+ }
+ buffer.push(FreeTextEditor.#getNodeContent(child));
+ prevChild = child;
+ }
+ return buffer.join("\n");
+ }
+ #setEditorDimensions() {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ let rect;
+ if (this.isAttachedToDOM) {
+ rect = this.div.getBoundingClientRect();
+ } else {
+ const {
+ currentLayer,
+ div
+ } = this;
+ const savedDisplay = div.style.display;
+ const savedVisibility = div.classList.contains("hidden");
+ div.classList.remove("hidden");
+ div.style.display = "hidden";
+ currentLayer.div.append(this.div);
+ rect = div.getBoundingClientRect();
+ div.remove();
+ div.style.display = savedDisplay;
+ div.classList.toggle("hidden", savedVisibility);
+ }
+ 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();
+ this.disableEditMode();
+ 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();
+ }
+ enterInEditMode() {
+ this.enableEditMode();
+ this.editorDiv.focus();
+ }
+ dblclick(event) {
+ this.enterInEditMode();
+ }
+ keydown(event) {
+ if (event.target === this.div && event.key === "Enter") {
+ this.enterInEditMode();
+ event.preventDefault();
+ }
+ }
+ editorDivKeydown(event) {
+ FreeTextEditor._keyboardManager.exec(this, event);
+ }
+ editorDivFocus(event) {
+ this.isEditing = true;
+ }
+ editorDivBlur(event) {
+ this.isEditing = false;
+ }
+ editorDivInput(event) {
+ this.parent.div.classList.toggle("freetextEditing", this.isEmpty());
+ }
+ disableEditing() {
+ this.editorDiv.setAttribute("role", "comment");
+ this.editorDiv.removeAttribute("aria-multiline");
+ }
+ enableEditing() {
+ this.editorDiv.setAttribute("role", "textbox");
+ this.editorDiv.setAttribute("aria-multiline", true);
+ }
+ render() {
+ if (this.div) {
+ return this.div;
+ }
+ let baseX, baseY;
+ if (this.width) {
+ baseX = this.x;
+ baseY = this.y;
+ }
+ super.render();
+ this.editorDiv = document.createElement("div");
+ this.editorDiv.className = "internal";
+ this.editorDiv.setAttribute("id", this.#editorDivId);
+ this.editorDiv.setAttribute("data-l10n-id", "pdfjs-free-text2");
+ this.editorDiv.setAttribute("data-l10n-attrs", "default-content");
+ this.enableEditing();
+ this.editorDiv.contentEditable = true;
+ const {
+ style
+ } = this.editorDiv;
+ style.fontSize = `calc(${this.#fontSize}px * var(--scale-factor))`;
+ style.color = this.#color;
+ this.div.append(this.editorDiv);
+ this.overlayDiv = document.createElement("div");
+ this.overlayDiv.classList.add("overlay", "enabled");
+ this.div.append(this.overlayDiv);
+ bindEvents(this, this.div, ["dblclick", "keydown"]);
+ if (this.width) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ 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.#setContent();
+ this._isDraggable = true;
+ this.editorDiv.contentEditable = false;
+ } else {
+ this._isDraggable = false;
+ this.editorDiv.contentEditable = true;
+ }
+ return this.div;
+ }
+ static #getNodeContent(node) {
+ return (node.nodeType === Node.TEXT_NODE ? node.nodeValue : node.innerText).replaceAll(EOL_PATTERN, "");
+ }
+ editorDivPaste(event) {
+ const clipboardData = event.clipboardData || window.clipboardData;
+ const {
+ types
+ } = clipboardData;
+ if (types.length === 1 && types[0] === "text/plain") {
+ return;
+ }
+ event.preventDefault();
+ const paste = FreeTextEditor.#deserializeContent(clipboardData.getData("text") || "").replaceAll(EOL_PATTERN, "\n");
+ if (!paste) {
+ return;
+ }
+ const selection = window.getSelection();
+ if (!selection.rangeCount) {
+ return;
+ }
+ this.editorDiv.normalize();
+ selection.deleteFromDocument();
+ const range = selection.getRangeAt(0);
+ if (!paste.includes("\n")) {
+ range.insertNode(document.createTextNode(paste));
+ this.editorDiv.normalize();
+ selection.collapseToStart();
+ return;
+ }
+ const {
+ startContainer,
+ startOffset
+ } = range;
+ const bufferBefore = [];
+ const bufferAfter = [];
+ if (startContainer.nodeType === Node.TEXT_NODE) {
+ const parent = startContainer.parentElement;
+ bufferAfter.push(startContainer.nodeValue.slice(startOffset).replaceAll(EOL_PATTERN, ""));
+ if (parent !== this.editorDiv) {
+ let buffer = bufferBefore;
+ for (const child of this.editorDiv.childNodes) {
+ if (child === parent) {
+ buffer = bufferAfter;
+ continue;
+ }
+ buffer.push(FreeTextEditor.#getNodeContent(child));
+ }
+ }
+ bufferBefore.push(startContainer.nodeValue.slice(0, startOffset).replaceAll(EOL_PATTERN, ""));
+ } else if (startContainer === this.editorDiv) {
+ let buffer = bufferBefore;
+ let i = 0;
+ for (const child of this.editorDiv.childNodes) {
+ if (i++ === startOffset) {
+ buffer = bufferAfter;
+ }
+ buffer.push(FreeTextEditor.#getNodeContent(child));
+ }
+ }
+ this.#content = `${bufferBefore.join("\n")}${paste}${bufferAfter.join("\n")}`;
+ this.#setContent();
+ const newRange = new Range();
+ let beforeLength = bufferBefore.reduce((acc, line) => acc + line.length, 0);
+ for (const {
+ firstChild
+ } of this.editorDiv.childNodes) {
+ if (firstChild.nodeType === Node.TEXT_NODE) {
+ const length = firstChild.nodeValue.length;
+ if (beforeLength <= length) {
+ newRange.setStart(firstChild, beforeLength);
+ newRange.setEnd(firstChild, beforeLength);
+ break;
+ }
+ beforeLength -= length;
+ }
+ }
+ selection.removeAllRanges();
+ selection.addRange(newRange);
+ }
+ #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);
+ }
+ }
+ #serializeContent() {
+ return this.#content.replaceAll("\xa0", " ");
+ }
+ static #deserializeContent(content) {
+ return content.replaceAll(" ", "\xa0");
+ }
+ get contentDiv() {
+ return this.editorDiv;
+ }
+ static async deserialize(data, parent, uiManager) {
+ let initialData = null;
+ if (data instanceof FreeTextAnnotationElement) {
+ const {
+ data: {
+ defaultAppearanceData: {
+ fontSize,
+ fontColor
+ },
+ rect,
+ rotation,
+ id,
+ popupRef
+ },
+ textContent,
+ textPosition,
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ if (!textContent || textContent.length === 0) {
+ return null;
+ }
+ initialData = data = {
+ annotationType: AnnotationEditorType.FREETEXT,
+ color: Array.from(fontColor),
+ fontSize,
+ value: textContent.join("\n"),
+ position: textPosition,
+ pageIndex: pageNumber - 1,
+ rect: rect.slice(0),
+ rotation,
+ id,
+ deleted: false,
+ popupRef
+ };
+ }
+ const editor = await super.deserialize(data, parent, uiManager);
+ editor.#fontSize = data.fontSize;
+ editor.#color = Util.makeHexColor(...data.color);
+ editor.#content = FreeTextEditor.#deserializeContent(data.value);
+ editor.annotationElementId = data.id || null;
+ editor._initialData = initialData;
+ return editor;
+ }
+ serialize(isForCopying = false) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ if (this.deleted) {
+ return this.serializeDeleted();
+ }
+ const padding = FreeTextEditor._internalPadding * this.parentScale;
+ const rect = this.getRect(padding, padding);
+ const color = AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : this.#color);
+ const serialized = {
+ annotationType: AnnotationEditorType.FREETEXT,
+ color,
+ fontSize: this.#fontSize,
+ value: this.#serializeContent(),
+ pageIndex: this.pageIndex,
+ rect,
+ rotation: this.rotation,
+ structTreeParentId: this._structTreeParentId
+ };
+ if (isForCopying) {
+ return serialized;
+ }
+ if (this.annotationElementId && !this.#hasElementChanged(serialized)) {
+ return null;
+ }
+ serialized.id = this.annotationElementId;
+ return serialized;
+ }
+ #hasElementChanged(serialized) {
+ const {
+ value,
+ fontSize,
+ color,
+ pageIndex
+ } = this._initialData;
+ return this._hasBeenMoved || serialized.value !== value || serialized.fontSize !== fontSize || serialized.color.some((c, i) => c !== color[i]) || serialized.pageIndex !== pageIndex;
+ }
+ renderAnnotationElement(annotation) {
+ const content = super.renderAnnotationElement(annotation);
+ if (this.deleted) {
+ return content;
+ }
+ const {
+ style
+ } = content;
+ style.fontSize = `calc(${this.#fontSize}px * var(--scale-factor))`;
+ style.color = this.#color;
+ content.replaceChildren();
+ for (const line of this.#content.split("\n")) {
+ const div = document.createElement("div");
+ div.append(line ? document.createTextNode(line) : document.createElement("br"));
+ content.append(div);
+ }
+ const padding = FreeTextEditor._internalPadding * this.parentScale;
+ annotation.updateEdited({
+ rect: this.getRect(padding, padding),
+ popupContent: this.#content
+ });
+ return content;
+ }
+ resetAnnotationElement(annotation) {
+ super.resetAnnotationElement(annotation);
+ annotation.resetEdited();
+ }
+}
+
+;// ./src/display/editor/drawers/outline.js
+
+class Outline {
+ static PRECISION = 1e-4;
+ toSVGPath() {
+ unreachable("Abstract method `toSVGPath` must be implemented.");
+ }
+ get box() {
+ unreachable("Abstract getter `box` must be implemented.");
+ }
+ serialize(_bbox, _rotation) {
+ unreachable("Abstract method `serialize` must be implemented.");
+ }
+ static _rescale(src, tx, ty, sx, sy, dest) {
+ dest ||= new Float32Array(src.length);
+ for (let i = 0, ii = src.length; i < ii; i += 2) {
+ dest[i] = tx + src[i] * sx;
+ dest[i + 1] = ty + src[i + 1] * sy;
+ }
+ return dest;
+ }
+ static _rescaleAndSwap(src, tx, ty, sx, sy, dest) {
+ dest ||= new Float32Array(src.length);
+ for (let i = 0, ii = src.length; i < ii; i += 2) {
+ dest[i] = tx + src[i + 1] * sx;
+ dest[i + 1] = ty + src[i] * sy;
+ }
+ return dest;
+ }
+ static _translate(src, tx, ty, dest) {
+ dest ||= new Float32Array(src.length);
+ for (let i = 0, ii = src.length; i < ii; i += 2) {
+ dest[i] = tx + src[i];
+ dest[i + 1] = ty + src[i + 1];
+ }
+ return dest;
+ }
+ static svgRound(x) {
+ return Math.round(x * 10000);
+ }
+ static _normalizePoint(x, y, parentWidth, parentHeight, rotation) {
+ switch (rotation) {
+ case 90:
+ return [1 - y / parentWidth, x / parentHeight];
+ case 180:
+ return [1 - x / parentWidth, 1 - y / parentHeight];
+ case 270:
+ return [y / parentWidth, 1 - x / parentHeight];
+ default:
+ return [x / parentWidth, y / parentHeight];
+ }
+ }
+ static _normalizePagePoint(x, y, rotation) {
+ switch (rotation) {
+ case 90:
+ return [1 - y, x];
+ case 180:
+ return [1 - x, 1 - y];
+ case 270:
+ return [y, 1 - x];
+ default:
+ return [x, y];
+ }
+ }
+ static createBezierPoints(x1, y1, x2, y2, x3, y3) {
+ return [(x1 + 5 * x2) / 6, (y1 + 5 * y2) / 6, (5 * x2 + x3) / 6, (5 * y2 + y3) / 6, (x2 + x3) / 2, (y2 + y3) / 2];
+ }
+}
+
+;// ./src/display/editor/drawers/freedraw.js
+
+
+class FreeDrawOutliner {
+ #box;
+ #bottom = [];
+ #innerMargin;
+ #isLTR;
+ #top = [];
+ #last = new Float32Array(18);
+ #lastX;
+ #lastY;
+ #min;
+ #min_dist;
+ #scaleFactor;
+ #thickness;
+ #points = [];
+ static #MIN_DIST = 8;
+ static #MIN_DIFF = 2;
+ static #MIN = FreeDrawOutliner.#MIN_DIST + FreeDrawOutliner.#MIN_DIFF;
+ constructor({
+ x,
+ y
+ }, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
+ this.#box = box;
+ this.#thickness = thickness * scaleFactor;
+ this.#isLTR = isLTR;
+ this.#last.set([NaN, NaN, NaN, NaN, x, y], 6);
+ this.#innerMargin = innerMargin;
+ this.#min_dist = FreeDrawOutliner.#MIN_DIST * scaleFactor;
+ this.#min = FreeDrawOutliner.#MIN * scaleFactor;
+ this.#scaleFactor = scaleFactor;
+ this.#points.push(x, y);
+ }
+ isEmpty() {
+ return isNaN(this.#last[8]);
+ }
+ #getLastCoords() {
+ const lastTop = this.#last.subarray(4, 6);
+ const lastBottom = this.#last.subarray(16, 18);
+ const [x, y, width, height] = this.#box;
+ return [(this.#lastX + (lastTop[0] - lastBottom[0]) / 2 - x) / width, (this.#lastY + (lastTop[1] - lastBottom[1]) / 2 - y) / height, (this.#lastX + (lastBottom[0] - lastTop[0]) / 2 - x) / width, (this.#lastY + (lastBottom[1] - lastTop[1]) / 2 - y) / height];
+ }
+ add({
+ x,
+ y
+ }) {
+ this.#lastX = x;
+ this.#lastY = y;
+ const [layerX, layerY, layerWidth, layerHeight] = this.#box;
+ let [x1, y1, x2, y2] = this.#last.subarray(8, 12);
+ const diffX = x - x2;
+ const diffY = y - y2;
+ const d = Math.hypot(diffX, diffY);
+ if (d < this.#min) {
+ return false;
+ }
+ const diffD = d - this.#min_dist;
+ const K = diffD / d;
+ const shiftX = K * diffX;
+ const shiftY = K * diffY;
+ let x0 = x1;
+ let y0 = y1;
+ x1 = x2;
+ y1 = y2;
+ x2 += shiftX;
+ y2 += shiftY;
+ this.#points?.push(x, y);
+ const nX = -shiftY / diffD;
+ const nY = shiftX / diffD;
+ const thX = nX * this.#thickness;
+ const thY = nY * this.#thickness;
+ this.#last.set(this.#last.subarray(2, 8), 0);
+ this.#last.set([x2 + thX, y2 + thY], 4);
+ this.#last.set(this.#last.subarray(14, 18), 12);
+ this.#last.set([x2 - thX, y2 - thY], 16);
+ if (isNaN(this.#last[6])) {
+ if (this.#top.length === 0) {
+ this.#last.set([x1 + thX, y1 + thY], 2);
+ this.#top.push(NaN, NaN, NaN, NaN, (x1 + thX - layerX) / layerWidth, (y1 + thY - layerY) / layerHeight);
+ this.#last.set([x1 - thX, y1 - thY], 14);
+ this.#bottom.push(NaN, NaN, NaN, NaN, (x1 - thX - layerX) / layerWidth, (y1 - thY - layerY) / layerHeight);
+ }
+ this.#last.set([x0, y0, x1, y1, x2, y2], 6);
+ return !this.isEmpty();
+ }
+ this.#last.set([x0, y0, x1, y1, x2, y2], 6);
+ const angle = Math.abs(Math.atan2(y0 - y1, x0 - x1) - Math.atan2(shiftY, shiftX));
+ if (angle < Math.PI / 2) {
+ [x1, y1, x2, y2] = this.#last.subarray(2, 6);
+ this.#top.push(NaN, NaN, NaN, NaN, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
+ [x1, y1, x0, y0] = this.#last.subarray(14, 18);
+ this.#bottom.push(NaN, NaN, NaN, NaN, ((x0 + x1) / 2 - layerX) / layerWidth, ((y0 + y1) / 2 - layerY) / layerHeight);
+ return true;
+ }
+ [x0, y0, x1, y1, x2, y2] = this.#last.subarray(0, 6);
+ this.#top.push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
+ [x2, y2, x1, y1, x0, y0] = this.#last.subarray(12, 18);
+ this.#bottom.push(((x0 + 5 * x1) / 6 - layerX) / layerWidth, ((y0 + 5 * y1) / 6 - layerY) / layerHeight, ((5 * x1 + x2) / 6 - layerX) / layerWidth, ((5 * y1 + y2) / 6 - layerY) / layerHeight, ((x1 + x2) / 2 - layerX) / layerWidth, ((y1 + y2) / 2 - layerY) / layerHeight);
+ return true;
+ }
+ toSVGPath() {
+ if (this.isEmpty()) {
+ return "";
+ }
+ const top = this.#top;
+ const bottom = this.#bottom;
+ if (isNaN(this.#last[6]) && !this.isEmpty()) {
+ return this.#toSVGPathTwoPoints();
+ }
+ const buffer = [];
+ buffer.push(`M${top[4]} ${top[5]}`);
+ for (let i = 6; i < top.length; i += 6) {
+ if (isNaN(top[i])) {
+ buffer.push(`L${top[i + 4]} ${top[i + 5]}`);
+ } else {
+ buffer.push(`C${top[i]} ${top[i + 1]} ${top[i + 2]} ${top[i + 3]} ${top[i + 4]} ${top[i + 5]}`);
+ }
+ }
+ this.#toSVGPathEnd(buffer);
+ for (let i = bottom.length - 6; i >= 6; i -= 6) {
+ if (isNaN(bottom[i])) {
+ buffer.push(`L${bottom[i + 4]} ${bottom[i + 5]}`);
+ } else {
+ buffer.push(`C${bottom[i]} ${bottom[i + 1]} ${bottom[i + 2]} ${bottom[i + 3]} ${bottom[i + 4]} ${bottom[i + 5]}`);
+ }
+ }
+ this.#toSVGPathStart(buffer);
+ return buffer.join(" ");
+ }
+ #toSVGPathTwoPoints() {
+ const [x, y, width, height] = this.#box;
+ const [lastTopX, lastTopY, lastBottomX, lastBottomY] = this.#getLastCoords();
+ return `M${(this.#last[2] - x) / width} ${(this.#last[3] - y) / height} L${(this.#last[4] - x) / width} ${(this.#last[5] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(this.#last[16] - x) / width} ${(this.#last[17] - y) / height} L${(this.#last[14] - x) / width} ${(this.#last[15] - y) / height} Z`;
+ }
+ #toSVGPathStart(buffer) {
+ const bottom = this.#bottom;
+ buffer.push(`L${bottom[4]} ${bottom[5]} Z`);
+ }
+ #toSVGPathEnd(buffer) {
+ const [x, y, width, height] = this.#box;
+ const lastTop = this.#last.subarray(4, 6);
+ const lastBottom = this.#last.subarray(16, 18);
+ const [lastTopX, lastTopY, lastBottomX, lastBottomY] = this.#getLastCoords();
+ buffer.push(`L${(lastTop[0] - x) / width} ${(lastTop[1] - y) / height} L${lastTopX} ${lastTopY} L${lastBottomX} ${lastBottomY} L${(lastBottom[0] - x) / width} ${(lastBottom[1] - y) / height}`);
+ }
+ newFreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR) {
+ return new FreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR);
+ }
+ getOutlines() {
+ const top = this.#top;
+ const bottom = this.#bottom;
+ const last = this.#last;
+ const [layerX, layerY, layerWidth, layerHeight] = this.#box;
+ const points = new Float32Array((this.#points?.length ?? 0) + 2);
+ for (let i = 0, ii = points.length - 2; i < ii; i += 2) {
+ points[i] = (this.#points[i] - layerX) / layerWidth;
+ points[i + 1] = (this.#points[i + 1] - layerY) / layerHeight;
+ }
+ points[points.length - 2] = (this.#lastX - layerX) / layerWidth;
+ points[points.length - 1] = (this.#lastY - layerY) / layerHeight;
+ if (isNaN(last[6]) && !this.isEmpty()) {
+ return this.#getOutlineTwoPoints(points);
+ }
+ const outline = new Float32Array(this.#top.length + 24 + this.#bottom.length);
+ let N = top.length;
+ for (let i = 0; i < N; i += 2) {
+ if (isNaN(top[i])) {
+ outline[i] = outline[i + 1] = NaN;
+ continue;
+ }
+ outline[i] = top[i];
+ outline[i + 1] = top[i + 1];
+ }
+ N = this.#getOutlineEnd(outline, N);
+ for (let i = bottom.length - 6; i >= 6; i -= 6) {
+ for (let j = 0; j < 6; j += 2) {
+ if (isNaN(bottom[i + j])) {
+ outline[N] = outline[N + 1] = NaN;
+ N += 2;
+ continue;
+ }
+ outline[N] = bottom[i + j];
+ outline[N + 1] = bottom[i + j + 1];
+ N += 2;
+ }
+ }
+ this.#getOutlineStart(outline, N);
+ return this.newFreeDrawOutline(outline, points, this.#box, this.#scaleFactor, this.#innerMargin, this.#isLTR);
+ }
+ #getOutlineTwoPoints(points) {
+ const last = this.#last;
+ const [layerX, layerY, layerWidth, layerHeight] = this.#box;
+ const [lastTopX, lastTopY, lastBottomX, lastBottomY] = this.#getLastCoords();
+ const outline = new Float32Array(36);
+ outline.set([NaN, NaN, NaN, NaN, (last[2] - layerX) / layerWidth, (last[3] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last[4] - layerX) / layerWidth, (last[5] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (last[16] - layerX) / layerWidth, (last[17] - layerY) / layerHeight, NaN, NaN, NaN, NaN, (last[14] - layerX) / layerWidth, (last[15] - layerY) / layerHeight], 0);
+ return this.newFreeDrawOutline(outline, points, this.#box, this.#scaleFactor, this.#innerMargin, this.#isLTR);
+ }
+ #getOutlineStart(outline, pos) {
+ const bottom = this.#bottom;
+ outline.set([NaN, NaN, NaN, NaN, bottom[4], bottom[5]], pos);
+ return pos += 6;
+ }
+ #getOutlineEnd(outline, pos) {
+ const lastTop = this.#last.subarray(4, 6);
+ const lastBottom = this.#last.subarray(16, 18);
+ const [layerX, layerY, layerWidth, layerHeight] = this.#box;
+ const [lastTopX, lastTopY, lastBottomX, lastBottomY] = this.#getLastCoords();
+ outline.set([NaN, NaN, NaN, NaN, (lastTop[0] - layerX) / layerWidth, (lastTop[1] - layerY) / layerHeight, NaN, NaN, NaN, NaN, lastTopX, lastTopY, NaN, NaN, NaN, NaN, lastBottomX, lastBottomY, NaN, NaN, NaN, NaN, (lastBottom[0] - layerX) / layerWidth, (lastBottom[1] - layerY) / layerHeight], pos);
+ return pos += 24;
+ }
+}
+class FreeDrawOutline extends Outline {
+ #box;
+ #bbox = new Float32Array(4);
+ #innerMargin;
+ #isLTR;
+ #points;
+ #scaleFactor;
+ #outline;
+ constructor(outline, points, box, scaleFactor, innerMargin, isLTR) {
+ super();
+ this.#outline = outline;
+ this.#points = points;
+ this.#box = box;
+ this.#scaleFactor = scaleFactor;
+ this.#innerMargin = innerMargin;
+ this.#isLTR = isLTR;
+ this.lastPoint = [NaN, NaN];
+ this.#computeMinMax(isLTR);
+ const [x, y, width, height] = this.#bbox;
+ for (let i = 0, ii = outline.length; i < ii; i += 2) {
+ outline[i] = (outline[i] - x) / width;
+ outline[i + 1] = (outline[i + 1] - y) / height;
+ }
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ points[i] = (points[i] - x) / width;
+ points[i + 1] = (points[i + 1] - y) / height;
+ }
+ }
+ toSVGPath() {
+ const buffer = [`M${this.#outline[4]} ${this.#outline[5]}`];
+ for (let i = 6, ii = this.#outline.length; i < ii; i += 6) {
+ if (isNaN(this.#outline[i])) {
+ buffer.push(`L${this.#outline[i + 4]} ${this.#outline[i + 5]}`);
+ continue;
+ }
+ buffer.push(`C${this.#outline[i]} ${this.#outline[i + 1]} ${this.#outline[i + 2]} ${this.#outline[i + 3]} ${this.#outline[i + 4]} ${this.#outline[i + 5]}`);
+ }
+ buffer.push("Z");
+ return buffer.join(" ");
+ }
+ serialize([blX, blY, trX, trY], rotation) {
+ const width = trX - blX;
+ const height = trY - blY;
+ let outline;
+ let points;
+ switch (rotation) {
+ case 0:
+ outline = Outline._rescale(this.#outline, blX, trY, width, -height);
+ points = Outline._rescale(this.#points, blX, trY, width, -height);
+ break;
+ case 90:
+ outline = Outline._rescaleAndSwap(this.#outline, blX, blY, width, height);
+ points = Outline._rescaleAndSwap(this.#points, blX, blY, width, height);
+ break;
+ case 180:
+ outline = Outline._rescale(this.#outline, trX, blY, -width, height);
+ points = Outline._rescale(this.#points, trX, blY, -width, height);
+ break;
+ case 270:
+ outline = Outline._rescaleAndSwap(this.#outline, trX, trY, -width, -height);
+ points = Outline._rescaleAndSwap(this.#points, trX, trY, -width, -height);
+ break;
+ }
+ return {
+ outline: Array.from(outline),
+ points: [Array.from(points)]
+ };
+ }
+ #computeMinMax(isLTR) {
+ const outline = this.#outline;
+ let lastX = outline[4];
+ let lastY = outline[5];
+ let minX = lastX;
+ let minY = lastY;
+ let maxX = lastX;
+ let maxY = lastY;
+ let lastPointX = lastX;
+ let lastPointY = lastY;
+ const ltrCallback = isLTR ? Math.max : Math.min;
+ for (let i = 6, ii = outline.length; i < ii; i += 6) {
+ if (isNaN(outline[i])) {
+ minX = Math.min(minX, outline[i + 4]);
+ minY = Math.min(minY, outline[i + 5]);
+ maxX = Math.max(maxX, outline[i + 4]);
+ maxY = Math.max(maxY, outline[i + 5]);
+ if (lastPointY < outline[i + 5]) {
+ lastPointX = outline[i + 4];
+ lastPointY = outline[i + 5];
+ } else if (lastPointY === outline[i + 5]) {
+ lastPointX = ltrCallback(lastPointX, outline[i + 4]);
+ }
+ } else {
+ const bbox = Util.bezierBoundingBox(lastX, lastY, ...outline.slice(i, i + 6));
+ minX = Math.min(minX, bbox[0]);
+ minY = Math.min(minY, bbox[1]);
+ maxX = Math.max(maxX, bbox[2]);
+ maxY = Math.max(maxY, bbox[3]);
+ if (lastPointY < bbox[3]) {
+ lastPointX = bbox[2];
+ lastPointY = bbox[3];
+ } else if (lastPointY === bbox[3]) {
+ lastPointX = ltrCallback(lastPointX, bbox[2]);
+ }
+ }
+ lastX = outline[i + 4];
+ lastY = outline[i + 5];
+ }
+ const bbox = this.#bbox;
+ bbox[0] = minX - this.#innerMargin;
+ bbox[1] = minY - this.#innerMargin;
+ bbox[2] = maxX - minX + 2 * this.#innerMargin;
+ bbox[3] = maxY - minY + 2 * this.#innerMargin;
+ this.lastPoint = [lastPointX, lastPointY];
+ }
+ get box() {
+ return this.#bbox;
+ }
+ newOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
+ return new FreeDrawOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin);
+ }
+ getNewOutline(thickness, innerMargin) {
+ const [x, y, width, height] = this.#bbox;
+ const [layerX, layerY, layerWidth, layerHeight] = this.#box;
+ const sx = width * layerWidth;
+ const sy = height * layerHeight;
+ const tx = x * layerWidth + layerX;
+ const ty = y * layerHeight + layerY;
+ const outliner = this.newOutliner({
+ x: this.#points[0] * sx + tx,
+ y: this.#points[1] * sy + ty
+ }, this.#box, this.#scaleFactor, thickness, this.#isLTR, innerMargin ?? this.#innerMargin);
+ for (let i = 2; i < this.#points.length; i += 2) {
+ outliner.add({
+ x: this.#points[i] * sx + tx,
+ y: this.#points[i + 1] * sy + ty
+ });
+ }
+ return outliner.getOutlines();
+ }
+}
+
+;// ./src/display/editor/drawers/highlight.js
+
+
+class HighlightOutliner {
+ #box;
+ #lastPoint;
+ #verticalEdges = [];
+ #intervals = [];
+ constructor(boxes, borderWidth = 0, innerMargin = 0, isLTR = true) {
+ let minX = Infinity;
+ let maxX = -Infinity;
+ let minY = Infinity;
+ let maxY = -Infinity;
+ const NUMBER_OF_DIGITS = 4;
+ const EPSILON = 10 ** -NUMBER_OF_DIGITS;
+ for (const {
+ x,
+ y,
+ width,
+ height
+ } of boxes) {
+ const x1 = Math.floor((x - borderWidth) / EPSILON) * EPSILON;
+ const x2 = Math.ceil((x + width + borderWidth) / EPSILON) * EPSILON;
+ const y1 = Math.floor((y - borderWidth) / EPSILON) * EPSILON;
+ const y2 = Math.ceil((y + height + borderWidth) / EPSILON) * EPSILON;
+ const left = [x1, y1, y2, true];
+ const right = [x2, y1, y2, false];
+ this.#verticalEdges.push(left, right);
+ minX = Math.min(minX, x1);
+ maxX = Math.max(maxX, x2);
+ minY = Math.min(minY, y1);
+ maxY = Math.max(maxY, y2);
+ }
+ const bboxWidth = maxX - minX + 2 * innerMargin;
+ const bboxHeight = maxY - minY + 2 * innerMargin;
+ const shiftedMinX = minX - innerMargin;
+ const shiftedMinY = minY - innerMargin;
+ const lastEdge = this.#verticalEdges.at(isLTR ? -1 : -2);
+ const lastPoint = [lastEdge[0], lastEdge[2]];
+ for (const edge of this.#verticalEdges) {
+ const [x, y1, y2] = edge;
+ edge[0] = (x - shiftedMinX) / bboxWidth;
+ edge[1] = (y1 - shiftedMinY) / bboxHeight;
+ edge[2] = (y2 - shiftedMinY) / bboxHeight;
+ }
+ this.#box = new Float32Array([shiftedMinX, shiftedMinY, bboxWidth, bboxHeight]);
+ this.#lastPoint = lastPoint;
+ }
+ getOutlines() {
+ this.#verticalEdges.sort((a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2]);
+ const outlineVerticalEdges = [];
+ for (const edge of this.#verticalEdges) {
+ if (edge[3]) {
+ outlineVerticalEdges.push(...this.#breakEdge(edge));
+ this.#insert(edge);
+ } else {
+ this.#remove(edge);
+ outlineVerticalEdges.push(...this.#breakEdge(edge));
+ }
+ }
+ return this.#getOutlines(outlineVerticalEdges);
+ }
+ #getOutlines(outlineVerticalEdges) {
+ const edges = [];
+ const allEdges = new Set();
+ for (const edge of outlineVerticalEdges) {
+ const [x, y1, y2] = edge;
+ edges.push([x, y1, edge], [x, y2, edge]);
+ }
+ edges.sort((a, b) => a[1] - b[1] || a[0] - b[0]);
+ for (let i = 0, ii = edges.length; i < ii; i += 2) {
+ const edge1 = edges[i][2];
+ const edge2 = edges[i + 1][2];
+ edge1.push(edge2);
+ edge2.push(edge1);
+ allEdges.add(edge1);
+ allEdges.add(edge2);
+ }
+ const outlines = [];
+ let outline;
+ while (allEdges.size > 0) {
+ const edge = allEdges.values().next().value;
+ let [x, y1, y2, edge1, edge2] = edge;
+ allEdges.delete(edge);
+ let lastPointX = x;
+ let lastPointY = y1;
+ outline = [x, y2];
+ outlines.push(outline);
+ while (true) {
+ let e;
+ if (allEdges.has(edge1)) {
+ e = edge1;
+ } else if (allEdges.has(edge2)) {
+ e = edge2;
+ } else {
+ break;
+ }
+ allEdges.delete(e);
+ [x, y1, y2, edge1, edge2] = e;
+ if (lastPointX !== x) {
+ outline.push(lastPointX, lastPointY, x, lastPointY === y1 ? y1 : y2);
+ lastPointX = x;
+ }
+ lastPointY = lastPointY === y1 ? y2 : y1;
+ }
+ outline.push(lastPointX, lastPointY);
+ }
+ return new HighlightOutline(outlines, this.#box, this.#lastPoint);
+ }
+ #binarySearch(y) {
+ const array = this.#intervals;
+ let start = 0;
+ let end = array.length - 1;
+ while (start <= end) {
+ const middle = start + end >> 1;
+ const y1 = array[middle][0];
+ if (y1 === y) {
+ return middle;
+ }
+ if (y1 < y) {
+ start = middle + 1;
+ } else {
+ end = middle - 1;
+ }
+ }
+ return end + 1;
+ }
+ #insert([, y1, y2]) {
+ const index = this.#binarySearch(y1);
+ this.#intervals.splice(index, 0, [y1, y2]);
+ }
+ #remove([, y1, y2]) {
+ const index = this.#binarySearch(y1);
+ for (let i = index; i < this.#intervals.length; i++) {
+ const [start, end] = this.#intervals[i];
+ if (start !== y1) {
+ break;
+ }
+ if (start === y1 && end === y2) {
+ this.#intervals.splice(i, 1);
+ return;
+ }
+ }
+ for (let i = index - 1; i >= 0; i--) {
+ const [start, end] = this.#intervals[i];
+ if (start !== y1) {
+ break;
+ }
+ if (start === y1 && end === y2) {
+ this.#intervals.splice(i, 1);
+ return;
+ }
+ }
+ }
+ #breakEdge(edge) {
+ const [x, y1, y2] = edge;
+ const results = [[x, y1, y2]];
+ const index = this.#binarySearch(y2);
+ for (let i = 0; i < index; i++) {
+ const [start, end] = this.#intervals[i];
+ for (let j = 0, jj = results.length; j < jj; j++) {
+ const [, y3, y4] = results[j];
+ if (end <= y3 || y4 <= start) {
+ continue;
+ }
+ if (y3 >= start) {
+ if (y4 > end) {
+ results[j][1] = end;
+ } else {
+ if (jj === 1) {
+ return [];
+ }
+ results.splice(j, 1);
+ j--;
+ jj--;
+ }
+ continue;
+ }
+ results[j][2] = start;
+ if (y4 > end) {
+ results.push([x, end, y4]);
+ }
+ }
+ }
+ return results;
+ }
+}
+class HighlightOutline extends Outline {
+ #box;
+ #outlines;
+ constructor(outlines, box, lastPoint) {
+ super();
+ this.#outlines = outlines;
+ this.#box = box;
+ this.lastPoint = lastPoint;
+ }
+ toSVGPath() {
+ const buffer = [];
+ for (const polygon of this.#outlines) {
+ let [prevX, prevY] = polygon;
+ buffer.push(`M${prevX} ${prevY}`);
+ for (let i = 2; i < polygon.length; i += 2) {
+ const x = polygon[i];
+ const y = polygon[i + 1];
+ if (x === prevX) {
+ buffer.push(`V${y}`);
+ prevY = y;
+ } else if (y === prevY) {
+ buffer.push(`H${x}`);
+ prevX = x;
+ }
+ }
+ buffer.push("Z");
+ }
+ return buffer.join(" ");
+ }
+ serialize([blX, blY, trX, trY], _rotation) {
+ const outlines = [];
+ const width = trX - blX;
+ const height = trY - blY;
+ for (const outline of this.#outlines) {
+ const points = new Array(outline.length);
+ for (let i = 0; i < outline.length; i += 2) {
+ points[i] = blX + outline[i] * width;
+ points[i + 1] = trY - outline[i + 1] * height;
+ }
+ outlines.push(points);
+ }
+ return outlines;
+ }
+ get box() {
+ return this.#box;
+ }
+ get classNamesForOutlining() {
+ return ["highlightOutline"];
+ }
+}
+class FreeHighlightOutliner extends FreeDrawOutliner {
+ newFreeDrawOutline(outline, points, box, scaleFactor, innerMargin, isLTR) {
+ return new FreeHighlightOutline(outline, points, box, scaleFactor, innerMargin, isLTR);
+ }
+}
+class FreeHighlightOutline extends FreeDrawOutline {
+ newOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin = 0) {
+ return new FreeHighlightOutliner(point, box, scaleFactor, thickness, isLTR, innerMargin);
+ }
+}
+
+;// ./src/display/editor/color_picker.js
+
+
+
+class ColorPicker {
+ #button = null;
+ #buttonSwatch = null;
+ #defaultColor;
+ #dropdown = null;
+ #dropdownWasFromKeyboard = false;
+ #isMainColorPicker = false;
+ #editor = null;
+ #eventBus;
+ #openDropdownAC = null;
+ #uiManager = null;
+ #type;
+ static #l10nColor = null;
+ static get _keyboardManager() {
+ return shadow(this, "_keyboardManager", new KeyboardManager([[["Escape", "mac+Escape"], ColorPicker.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], ColorPicker.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], ColorPicker.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], ColorPicker.prototype._moveToPrevious], [["Home", "mac+Home"], ColorPicker.prototype._moveToBeginning], [["End", "mac+End"], ColorPicker.prototype._moveToEnd]]));
+ }
+ constructor({
+ editor = null,
+ uiManager = null
+ }) {
+ if (editor) {
+ this.#isMainColorPicker = false;
+ this.#type = AnnotationEditorParamsType.HIGHLIGHT_COLOR;
+ this.#editor = editor;
+ } else {
+ this.#isMainColorPicker = true;
+ this.#type = AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR;
+ }
+ this.#uiManager = editor?._uiManager || uiManager;
+ this.#eventBus = this.#uiManager._eventBus;
+ this.#defaultColor = editor?.color || this.#uiManager?.highlightColors.values().next().value || "#FFFF98";
+ ColorPicker.#l10nColor ||= Object.freeze({
+ blue: "pdfjs-editor-colorpicker-blue",
+ green: "pdfjs-editor-colorpicker-green",
+ pink: "pdfjs-editor-colorpicker-pink",
+ red: "pdfjs-editor-colorpicker-red",
+ yellow: "pdfjs-editor-colorpicker-yellow"
+ });
+ }
+ renderButton() {
+ const button = this.#button = document.createElement("button");
+ button.className = "colorPicker";
+ button.tabIndex = "0";
+ button.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-button");
+ button.setAttribute("aria-haspopup", true);
+ const signal = this.#uiManager._signal;
+ button.addEventListener("click", this.#openDropdown.bind(this), {
+ signal
+ });
+ button.addEventListener("keydown", this.#keyDown.bind(this), {
+ signal
+ });
+ const swatch = this.#buttonSwatch = document.createElement("span");
+ swatch.className = "swatch";
+ swatch.setAttribute("aria-hidden", true);
+ swatch.style.backgroundColor = this.#defaultColor;
+ button.append(swatch);
+ return button;
+ }
+ renderMainDropdown() {
+ const dropdown = this.#dropdown = this.#getDropdownRoot();
+ dropdown.setAttribute("aria-orientation", "horizontal");
+ dropdown.setAttribute("aria-labelledby", "highlightColorPickerLabel");
+ return dropdown;
+ }
+ #getDropdownRoot() {
+ const div = document.createElement("div");
+ const signal = this.#uiManager._signal;
+ div.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ div.className = "dropdown";
+ div.role = "listbox";
+ div.setAttribute("aria-multiselectable", false);
+ div.setAttribute("aria-orientation", "vertical");
+ div.setAttribute("data-l10n-id", "pdfjs-editor-colorpicker-dropdown");
+ for (const [name, color] of this.#uiManager.highlightColors) {
+ const button = document.createElement("button");
+ button.tabIndex = "0";
+ button.role = "option";
+ button.setAttribute("data-color", color);
+ button.title = name;
+ button.setAttribute("data-l10n-id", ColorPicker.#l10nColor[name]);
+ const swatch = document.createElement("span");
+ button.append(swatch);
+ swatch.className = "swatch";
+ swatch.style.backgroundColor = color;
+ button.setAttribute("aria-selected", color === this.#defaultColor);
+ button.addEventListener("click", this.#colorSelect.bind(this, color), {
+ signal
+ });
+ div.append(button);
+ }
+ div.addEventListener("keydown", this.#keyDown.bind(this), {
+ signal
+ });
+ return div;
+ }
+ #colorSelect(color, event) {
+ event.stopPropagation();
+ this.#eventBus.dispatch("switchannotationeditorparams", {
+ source: this,
+ type: this.#type,
+ value: color
+ });
+ }
+ _colorSelectFromKeyboard(event) {
+ if (event.target === this.#button) {
+ this.#openDropdown(event);
+ return;
+ }
+ const color = event.target.getAttribute("data-color");
+ if (!color) {
+ return;
+ }
+ this.#colorSelect(color, event);
+ }
+ _moveToNext(event) {
+ if (!this.#isDropdownVisible) {
+ this.#openDropdown(event);
+ return;
+ }
+ if (event.target === this.#button) {
+ this.#dropdown.firstChild?.focus();
+ return;
+ }
+ event.target.nextSibling?.focus();
+ }
+ _moveToPrevious(event) {
+ if (event.target === this.#dropdown?.firstChild || event.target === this.#button) {
+ if (this.#isDropdownVisible) {
+ this._hideDropdownFromKeyboard();
+ }
+ return;
+ }
+ if (!this.#isDropdownVisible) {
+ this.#openDropdown(event);
+ }
+ event.target.previousSibling?.focus();
+ }
+ _moveToBeginning(event) {
+ if (!this.#isDropdownVisible) {
+ this.#openDropdown(event);
+ return;
+ }
+ this.#dropdown.firstChild?.focus();
+ }
+ _moveToEnd(event) {
+ if (!this.#isDropdownVisible) {
+ this.#openDropdown(event);
+ return;
+ }
+ this.#dropdown.lastChild?.focus();
+ }
+ #keyDown(event) {
+ ColorPicker._keyboardManager.exec(this, event);
+ }
+ #openDropdown(event) {
+ if (this.#isDropdownVisible) {
+ this.hideDropdown();
+ return;
+ }
+ this.#dropdownWasFromKeyboard = event.detail === 0;
+ if (!this.#openDropdownAC) {
+ this.#openDropdownAC = new AbortController();
+ window.addEventListener("pointerdown", this.#pointerDown.bind(this), {
+ signal: this.#uiManager.combinedSignal(this.#openDropdownAC)
+ });
+ }
+ if (this.#dropdown) {
+ this.#dropdown.classList.remove("hidden");
+ return;
+ }
+ const root = this.#dropdown = this.#getDropdownRoot();
+ this.#button.append(root);
+ }
+ #pointerDown(event) {
+ if (this.#dropdown?.contains(event.target)) {
+ return;
+ }
+ this.hideDropdown();
+ }
+ hideDropdown() {
+ this.#dropdown?.classList.add("hidden");
+ this.#openDropdownAC?.abort();
+ this.#openDropdownAC = null;
+ }
+ get #isDropdownVisible() {
+ return this.#dropdown && !this.#dropdown.classList.contains("hidden");
+ }
+ _hideDropdownFromKeyboard() {
+ if (this.#isMainColorPicker) {
+ return;
+ }
+ if (!this.#isDropdownVisible) {
+ this.#editor?.unselect();
+ return;
+ }
+ this.hideDropdown();
+ this.#button.focus({
+ preventScroll: true,
+ focusVisible: this.#dropdownWasFromKeyboard
+ });
+ }
+ updateColor(color) {
+ if (this.#buttonSwatch) {
+ this.#buttonSwatch.style.backgroundColor = color;
+ }
+ if (!this.#dropdown) {
+ return;
+ }
+ const i = this.#uiManager.highlightColors.values();
+ for (const child of this.#dropdown.children) {
+ child.setAttribute("aria-selected", i.next().value === color);
+ }
+ }
+ destroy() {
+ this.#button?.remove();
+ this.#button = null;
+ this.#buttonSwatch = null;
+ this.#dropdown?.remove();
+ this.#dropdown = null;
+ }
+}
+
+;// ./src/display/editor/highlight.js
+
+
+
+
+
+
+
+class HighlightEditor extends AnnotationEditor {
+ #anchorNode = null;
+ #anchorOffset = 0;
+ #boxes;
+ #clipPathId = null;
+ #colorPicker = null;
+ #focusOutlines = null;
+ #focusNode = null;
+ #focusOffset = 0;
+ #highlightDiv = null;
+ #highlightOutlines = null;
+ #id = null;
+ #isFreeHighlight = false;
+ #lastPoint = null;
+ #opacity;
+ #outlineId = null;
+ #text = "";
+ #thickness;
+ #methodOfCreation = "";
+ static _defaultColor = null;
+ static _defaultOpacity = 1;
+ static _defaultThickness = 12;
+ static _type = "highlight";
+ static _editorType = AnnotationEditorType.HIGHLIGHT;
+ static _freeHighlightId = -1;
+ static _freeHighlight = null;
+ static _freeHighlightClipId = "";
+ static get _keyboardManager() {
+ const proto = HighlightEditor.prototype;
+ return shadow(this, "_keyboardManager", new KeyboardManager([[["ArrowLeft", "mac+ArrowLeft"], proto._moveCaret, {
+ args: [0]
+ }], [["ArrowRight", "mac+ArrowRight"], proto._moveCaret, {
+ args: [1]
+ }], [["ArrowUp", "mac+ArrowUp"], proto._moveCaret, {
+ args: [2]
+ }], [["ArrowDown", "mac+ArrowDown"], proto._moveCaret, {
+ args: [3]
+ }]]));
+ }
+ constructor(params) {
+ super({
+ ...params,
+ name: "highlightEditor"
+ });
+ this.color = params.color || HighlightEditor._defaultColor;
+ this.#thickness = params.thickness || HighlightEditor._defaultThickness;
+ this.#opacity = params.opacity || HighlightEditor._defaultOpacity;
+ this.#boxes = params.boxes || null;
+ this.#methodOfCreation = params.methodOfCreation || "";
+ this.#text = params.text || "";
+ this._isDraggable = false;
+ if (params.highlightId > -1) {
+ this.#isFreeHighlight = true;
+ this.#createFreeOutlines(params);
+ this.#addToDrawLayer();
+ } else if (this.#boxes) {
+ this.#anchorNode = params.anchorNode;
+ this.#anchorOffset = params.anchorOffset;
+ this.#focusNode = params.focusNode;
+ this.#focusOffset = params.focusOffset;
+ this.#createOutlines();
+ this.#addToDrawLayer();
+ this.rotate(this.rotation);
+ }
+ }
+ get telemetryInitialData() {
+ return {
+ action: "added",
+ type: this.#isFreeHighlight ? "free_highlight" : "highlight",
+ color: this._uiManager.highlightColorNames.get(this.color),
+ thickness: this.#thickness,
+ methodOfCreation: this.#methodOfCreation
+ };
+ }
+ get telemetryFinalData() {
+ return {
+ type: "highlight",
+ color: this._uiManager.highlightColorNames.get(this.color)
+ };
+ }
+ static computeTelemetryFinalData(data) {
+ return {
+ numberOfColors: data.get("color").size
+ };
+ }
+ #createOutlines() {
+ const outliner = new HighlightOutliner(this.#boxes, 0.001);
+ this.#highlightOutlines = outliner.getOutlines();
+ [this.x, this.y, this.width, this.height] = this.#highlightOutlines.box;
+ const outlinerForOutline = new HighlightOutliner(this.#boxes, 0.0025, 0.001, this._uiManager.direction === "ltr");
+ this.#focusOutlines = outlinerForOutline.getOutlines();
+ const {
+ lastPoint
+ } = this.#focusOutlines;
+ this.#lastPoint = [(lastPoint[0] - this.x) / this.width, (lastPoint[1] - this.y) / this.height];
+ }
+ #createFreeOutlines({
+ highlightOutlines,
+ highlightId,
+ clipPathId
+ }) {
+ this.#highlightOutlines = highlightOutlines;
+ const extraThickness = 1.5;
+ this.#focusOutlines = highlightOutlines.getNewOutline(this.#thickness / 2 + extraThickness, 0.0025);
+ if (highlightId >= 0) {
+ this.#id = highlightId;
+ this.#clipPathId = clipPathId;
+ this.parent.drawLayer.finalizeDraw(highlightId, {
+ bbox: highlightOutlines.box,
+ path: {
+ d: highlightOutlines.toSVGPath()
+ }
+ });
+ this.#outlineId = this.parent.drawLayer.drawOutline({
+ rootClass: {
+ highlightOutline: true,
+ free: true
+ },
+ bbox: this.#focusOutlines.box,
+ path: {
+ d: this.#focusOutlines.toSVGPath()
+ }
+ }, true);
+ } else if (this.parent) {
+ const angle = this.parent.viewport.rotation;
+ this.parent.drawLayer.updateProperties(this.#id, {
+ bbox: HighlightEditor.#rotateBbox(this.#highlightOutlines.box, (angle - this.rotation + 360) % 360),
+ path: {
+ d: highlightOutlines.toSVGPath()
+ }
+ });
+ this.parent.drawLayer.updateProperties(this.#outlineId, {
+ bbox: HighlightEditor.#rotateBbox(this.#focusOutlines.box, angle),
+ path: {
+ d: this.#focusOutlines.toSVGPath()
+ }
+ });
+ }
+ const [x, y, width, height] = highlightOutlines.box;
+ switch (this.rotation) {
+ case 0:
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ break;
+ case 90:
+ {
+ const [pageWidth, pageHeight] = this.parentDimensions;
+ this.x = y;
+ this.y = 1 - x;
+ this.width = width * pageHeight / pageWidth;
+ this.height = height * pageWidth / pageHeight;
+ break;
+ }
+ case 180:
+ this.x = 1 - x;
+ this.y = 1 - y;
+ this.width = width;
+ this.height = height;
+ break;
+ case 270:
+ {
+ const [pageWidth, pageHeight] = this.parentDimensions;
+ this.x = 1 - y;
+ this.y = x;
+ this.width = width * pageHeight / pageWidth;
+ this.height = height * pageWidth / pageHeight;
+ break;
+ }
+ }
+ const {
+ lastPoint
+ } = this.#focusOutlines;
+ this.#lastPoint = [(lastPoint[0] - x) / width, (lastPoint[1] - y) / height];
+ }
+ static initialize(l10n, uiManager) {
+ AnnotationEditor.initialize(l10n, uiManager);
+ HighlightEditor._defaultColor ||= uiManager.highlightColors?.values().next().value || "#fff066";
+ }
+ static updateDefaultParams(type, value) {
+ switch (type) {
+ case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:
+ HighlightEditor._defaultColor = value;
+ break;
+ case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
+ HighlightEditor._defaultThickness = value;
+ break;
+ }
+ }
+ translateInPage(x, y) {}
+ get toolbarPosition() {
+ return this.#lastPoint;
+ }
+ updateParams(type, value) {
+ switch (type) {
+ case AnnotationEditorParamsType.HIGHLIGHT_COLOR:
+ this.#updateColor(value);
+ break;
+ case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
+ this.#updateThickness(value);
+ break;
+ }
+ }
+ static get defaultPropertiesToUpdate() {
+ return [[AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR, HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, HighlightEditor._defaultThickness]];
+ }
+ get propertiesToUpdate() {
+ return [[AnnotationEditorParamsType.HIGHLIGHT_COLOR, this.color || HighlightEditor._defaultColor], [AnnotationEditorParamsType.HIGHLIGHT_THICKNESS, this.#thickness || HighlightEditor._defaultThickness], [AnnotationEditorParamsType.HIGHLIGHT_FREE, this.#isFreeHighlight]];
+ }
+ #updateColor(color) {
+ const setColorAndOpacity = (col, opa) => {
+ this.color = col;
+ this.#opacity = opa;
+ this.parent?.drawLayer.updateProperties(this.#id, {
+ root: {
+ fill: col,
+ "fill-opacity": opa
+ }
+ });
+ this.#colorPicker?.updateColor(col);
+ };
+ const savedColor = this.color;
+ const savedOpacity = this.#opacity;
+ this.addCommands({
+ cmd: setColorAndOpacity.bind(this, color, HighlightEditor._defaultOpacity),
+ undo: setColorAndOpacity.bind(this, savedColor, savedOpacity),
+ post: this._uiManager.updateUI.bind(this._uiManager, this),
+ mustExec: true,
+ type: AnnotationEditorParamsType.HIGHLIGHT_COLOR,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ this._reportTelemetry({
+ action: "color_changed",
+ color: this._uiManager.highlightColorNames.get(color)
+ }, true);
+ }
+ #updateThickness(thickness) {
+ const savedThickness = this.#thickness;
+ const setThickness = th => {
+ this.#thickness = th;
+ this.#changeThickness(th);
+ };
+ this.addCommands({
+ cmd: setThickness.bind(this, thickness),
+ undo: setThickness.bind(this, savedThickness),
+ post: this._uiManager.updateUI.bind(this._uiManager, this),
+ mustExec: true,
+ type: AnnotationEditorParamsType.INK_THICKNESS,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ this._reportTelemetry({
+ action: "thickness_changed",
+ thickness
+ }, true);
+ }
+ async addEditToolbar() {
+ const toolbar = await super.addEditToolbar();
+ if (!toolbar) {
+ return null;
+ }
+ if (this._uiManager.highlightColors) {
+ this.#colorPicker = new ColorPicker({
+ editor: this
+ });
+ toolbar.addColorPicker(this.#colorPicker);
+ }
+ return toolbar;
+ }
+ disableEditing() {
+ super.disableEditing();
+ this.div.classList.toggle("disabled", true);
+ }
+ enableEditing() {
+ super.enableEditing();
+ this.div.classList.toggle("disabled", false);
+ }
+ fixAndSetPosition() {
+ return super.fixAndSetPosition(this.#getRotation());
+ }
+ getBaseTranslation() {
+ return [0, 0];
+ }
+ getRect(tx, ty) {
+ return super.getRect(tx, ty, this.#getRotation());
+ }
+ onceAdded() {
+ if (!this.annotationElementId) {
+ this.parent.addUndoableEditor(this);
+ }
+ this.div.focus();
+ }
+ remove() {
+ this.#cleanDrawLayer();
+ this._reportTelemetry({
+ action: "deleted"
+ });
+ super.remove();
+ }
+ rebuild() {
+ if (!this.parent) {
+ return;
+ }
+ super.rebuild();
+ if (this.div === null) {
+ return;
+ }
+ this.#addToDrawLayer();
+ if (!this.isAttachedToDOM) {
+ this.parent.add(this);
+ }
+ }
+ setParent(parent) {
+ let mustBeSelected = false;
+ if (this.parent && !parent) {
+ this.#cleanDrawLayer();
+ } else if (parent) {
+ this.#addToDrawLayer(parent);
+ mustBeSelected = !this.parent && this.div?.classList.contains("selectedEditor");
+ }
+ super.setParent(parent);
+ this.show(this._isVisible);
+ if (mustBeSelected) {
+ this.select();
+ }
+ }
+ #changeThickness(thickness) {
+ if (!this.#isFreeHighlight) {
+ return;
+ }
+ this.#createFreeOutlines({
+ highlightOutlines: this.#highlightOutlines.getNewOutline(thickness / 2)
+ });
+ this.fixAndSetPosition();
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(this.width * parentWidth, this.height * parentHeight);
+ }
+ #cleanDrawLayer() {
+ if (this.#id === null || !this.parent) {
+ return;
+ }
+ this.parent.drawLayer.remove(this.#id);
+ this.#id = null;
+ this.parent.drawLayer.remove(this.#outlineId);
+ this.#outlineId = null;
+ }
+ #addToDrawLayer(parent = this.parent) {
+ if (this.#id !== null) {
+ return;
+ }
+ ({
+ id: this.#id,
+ clipPathId: this.#clipPathId
+ } = parent.drawLayer.draw({
+ bbox: this.#highlightOutlines.box,
+ root: {
+ viewBox: "0 0 1 1",
+ fill: this.color,
+ "fill-opacity": this.#opacity
+ },
+ rootClass: {
+ highlight: true,
+ free: this.#isFreeHighlight
+ },
+ path: {
+ d: this.#highlightOutlines.toSVGPath()
+ }
+ }, false, true));
+ this.#outlineId = parent.drawLayer.drawOutline({
+ rootClass: {
+ highlightOutline: true,
+ free: this.#isFreeHighlight
+ },
+ bbox: this.#focusOutlines.box,
+ path: {
+ d: this.#focusOutlines.toSVGPath()
+ }
+ }, this.#isFreeHighlight);
+ if (this.#highlightDiv) {
+ this.#highlightDiv.style.clipPath = this.#clipPathId;
+ }
+ }
+ static #rotateBbox([x, y, width, height], angle) {
+ switch (angle) {
+ case 90:
+ return [1 - y - height, x, height, width];
+ case 180:
+ return [1 - x - width, 1 - y - height, width, height];
+ case 270:
+ return [y, 1 - x - width, height, width];
+ }
+ return [x, y, width, height];
+ }
+ rotate(angle) {
+ const {
+ drawLayer
+ } = this.parent;
+ let box;
+ if (this.#isFreeHighlight) {
+ angle = (angle - this.rotation + 360) % 360;
+ box = HighlightEditor.#rotateBbox(this.#highlightOutlines.box, angle);
+ } else {
+ box = HighlightEditor.#rotateBbox([this.x, this.y, this.width, this.height], angle);
+ }
+ drawLayer.updateProperties(this.#id, {
+ bbox: box,
+ root: {
+ "data-main-rotation": angle
+ }
+ });
+ drawLayer.updateProperties(this.#outlineId, {
+ bbox: HighlightEditor.#rotateBbox(this.#focusOutlines.box, angle),
+ root: {
+ "data-main-rotation": angle
+ }
+ });
+ }
+ render() {
+ if (this.div) {
+ return this.div;
+ }
+ const div = super.render();
+ if (this.#text) {
+ div.setAttribute("aria-label", this.#text);
+ div.setAttribute("role", "mark");
+ }
+ if (this.#isFreeHighlight) {
+ div.classList.add("free");
+ } else {
+ this.div.addEventListener("keydown", this.#keydown.bind(this), {
+ signal: this._uiManager._signal
+ });
+ }
+ const highlightDiv = this.#highlightDiv = document.createElement("div");
+ div.append(highlightDiv);
+ highlightDiv.setAttribute("aria-hidden", "true");
+ highlightDiv.className = "internal";
+ highlightDiv.style.clipPath = this.#clipPathId;
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(this.width * parentWidth, this.height * parentHeight);
+ bindEvents(this, this.#highlightDiv, ["pointerover", "pointerleave"]);
+ this.enableEditing();
+ return div;
+ }
+ pointerover() {
+ if (!this.isSelected) {
+ this.parent?.drawLayer.updateProperties(this.#outlineId, {
+ rootClass: {
+ hovered: true
+ }
+ });
+ }
+ }
+ pointerleave() {
+ if (!this.isSelected) {
+ this.parent?.drawLayer.updateProperties(this.#outlineId, {
+ rootClass: {
+ hovered: false
+ }
+ });
+ }
+ }
+ #keydown(event) {
+ HighlightEditor._keyboardManager.exec(this, event);
+ }
+ _moveCaret(direction) {
+ this.parent.unselect(this);
+ switch (direction) {
+ case 0:
+ case 2:
+ this.#setCaret(true);
+ break;
+ case 1:
+ case 3:
+ this.#setCaret(false);
+ break;
+ }
+ }
+ #setCaret(start) {
+ if (!this.#anchorNode) {
+ return;
+ }
+ const selection = window.getSelection();
+ if (start) {
+ selection.setPosition(this.#anchorNode, this.#anchorOffset);
+ } else {
+ selection.setPosition(this.#focusNode, this.#focusOffset);
+ }
+ }
+ select() {
+ super.select();
+ if (!this.#outlineId) {
+ return;
+ }
+ this.parent?.drawLayer.updateProperties(this.#outlineId, {
+ rootClass: {
+ hovered: false,
+ selected: true
+ }
+ });
+ }
+ unselect() {
+ super.unselect();
+ if (!this.#outlineId) {
+ return;
+ }
+ this.parent?.drawLayer.updateProperties(this.#outlineId, {
+ rootClass: {
+ selected: false
+ }
+ });
+ if (!this.#isFreeHighlight) {
+ this.#setCaret(false);
+ }
+ }
+ get _mustFixPosition() {
+ return !this.#isFreeHighlight;
+ }
+ show(visible = this._isVisible) {
+ super.show(visible);
+ if (this.parent) {
+ this.parent.drawLayer.updateProperties(this.#id, {
+ rootClass: {
+ hidden: !visible
+ }
+ });
+ this.parent.drawLayer.updateProperties(this.#outlineId, {
+ rootClass: {
+ hidden: !visible
+ }
+ });
+ }
+ }
+ #getRotation() {
+ return this.#isFreeHighlight ? this.rotation : 0;
+ }
+ #serializeBoxes() {
+ if (this.#isFreeHighlight) {
+ return null;
+ }
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ const [pageX, pageY] = this.pageTranslation;
+ const boxes = this.#boxes;
+ const quadPoints = new Float32Array(boxes.length * 8);
+ let i = 0;
+ for (const {
+ x,
+ y,
+ width,
+ height
+ } of boxes) {
+ const sx = x * pageWidth + pageX;
+ const sy = (1 - y) * pageHeight + pageY;
+ quadPoints[i] = quadPoints[i + 4] = sx;
+ quadPoints[i + 1] = quadPoints[i + 3] = sy;
+ quadPoints[i + 2] = quadPoints[i + 6] = sx + width * pageWidth;
+ quadPoints[i + 5] = quadPoints[i + 7] = sy - height * pageHeight;
+ i += 8;
+ }
+ return quadPoints;
+ }
+ #serializeOutlines(rect) {
+ return this.#highlightOutlines.serialize(rect, this.#getRotation());
+ }
+ static startHighlighting(parent, isLTR, {
+ target: textLayer,
+ x,
+ y
+ }) {
+ const {
+ x: layerX,
+ y: layerY,
+ width: parentWidth,
+ height: parentHeight
+ } = textLayer.getBoundingClientRect();
+ const ac = new AbortController();
+ const signal = parent.combinedSignal(ac);
+ const pointerUpCallback = e => {
+ ac.abort();
+ this.#endHighlight(parent, e);
+ };
+ window.addEventListener("blur", pointerUpCallback, {
+ signal
+ });
+ window.addEventListener("pointerup", pointerUpCallback, {
+ signal
+ });
+ window.addEventListener("pointerdown", stopEvent, {
+ capture: true,
+ passive: false,
+ signal
+ });
+ window.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ textLayer.addEventListener("pointermove", this.#highlightMove.bind(this, parent), {
+ signal
+ });
+ this._freeHighlight = new FreeHighlightOutliner({
+ x,
+ y
+ }, [layerX, layerY, parentWidth, parentHeight], parent.scale, this._defaultThickness / 2, isLTR, 0.001);
+ ({
+ id: this._freeHighlightId,
+ clipPathId: this._freeHighlightClipId
+ } = parent.drawLayer.draw({
+ bbox: [0, 0, 1, 1],
+ root: {
+ viewBox: "0 0 1 1",
+ fill: this._defaultColor,
+ "fill-opacity": this._defaultOpacity
+ },
+ rootClass: {
+ highlight: true,
+ free: true
+ },
+ path: {
+ d: this._freeHighlight.toSVGPath()
+ }
+ }, true, true));
+ }
+ static #highlightMove(parent, event) {
+ if (this._freeHighlight.add(event)) {
+ parent.drawLayer.updateProperties(this._freeHighlightId, {
+ path: {
+ d: this._freeHighlight.toSVGPath()
+ }
+ });
+ }
+ }
+ static #endHighlight(parent, event) {
+ if (!this._freeHighlight.isEmpty()) {
+ parent.createAndAddNewEditor(event, false, {
+ highlightId: this._freeHighlightId,
+ highlightOutlines: this._freeHighlight.getOutlines(),
+ clipPathId: this._freeHighlightClipId,
+ methodOfCreation: "main_toolbar"
+ });
+ } else {
+ parent.drawLayer.remove(this._freeHighlightId);
+ }
+ this._freeHighlightId = -1;
+ this._freeHighlight = null;
+ this._freeHighlightClipId = "";
+ }
+ static async deserialize(data, parent, uiManager) {
+ let initialData = null;
+ if (data instanceof HighlightAnnotationElement) {
+ const {
+ data: {
+ quadPoints,
+ rect,
+ rotation,
+ id,
+ color,
+ opacity,
+ popupRef
+ },
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ initialData = data = {
+ annotationType: AnnotationEditorType.HIGHLIGHT,
+ color: Array.from(color),
+ opacity,
+ quadPoints,
+ boxes: null,
+ pageIndex: pageNumber - 1,
+ rect: rect.slice(0),
+ rotation,
+ id,
+ deleted: false,
+ popupRef
+ };
+ } else if (data instanceof InkAnnotationElement) {
+ const {
+ data: {
+ inkLists,
+ rect,
+ rotation,
+ id,
+ color,
+ borderStyle: {
+ rawWidth: thickness
+ },
+ popupRef
+ },
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ initialData = data = {
+ annotationType: AnnotationEditorType.HIGHLIGHT,
+ color: Array.from(color),
+ thickness,
+ inkLists,
+ boxes: null,
+ pageIndex: pageNumber - 1,
+ rect: rect.slice(0),
+ rotation,
+ id,
+ deleted: false,
+ popupRef
+ };
+ }
+ const {
+ color,
+ quadPoints,
+ inkLists,
+ opacity
+ } = data;
+ const editor = await super.deserialize(data, parent, uiManager);
+ editor.color = Util.makeHexColor(...color);
+ editor.#opacity = opacity || 1;
+ if (inkLists) {
+ editor.#thickness = data.thickness;
+ }
+ editor.annotationElementId = data.id || null;
+ editor._initialData = initialData;
+ const [pageWidth, pageHeight] = editor.pageDimensions;
+ const [pageX, pageY] = editor.pageTranslation;
+ if (quadPoints) {
+ const boxes = editor.#boxes = [];
+ for (let i = 0; i < quadPoints.length; i += 8) {
+ boxes.push({
+ x: (quadPoints[i] - pageX) / pageWidth,
+ y: 1 - (quadPoints[i + 1] - pageY) / pageHeight,
+ width: (quadPoints[i + 2] - quadPoints[i]) / pageWidth,
+ height: (quadPoints[i + 1] - quadPoints[i + 5]) / pageHeight
+ });
+ }
+ editor.#createOutlines();
+ editor.#addToDrawLayer();
+ editor.rotate(editor.rotation);
+ } else if (inkLists) {
+ editor.#isFreeHighlight = true;
+ const points = inkLists[0];
+ const point = {
+ x: points[0] - pageX,
+ y: pageHeight - (points[1] - pageY)
+ };
+ const outliner = new FreeHighlightOutliner(point, [0, 0, pageWidth, pageHeight], 1, editor.#thickness / 2, true, 0.001);
+ for (let i = 0, ii = points.length; i < ii; i += 2) {
+ point.x = points[i] - pageX;
+ point.y = pageHeight - (points[i + 1] - pageY);
+ outliner.add(point);
+ }
+ const {
+ id,
+ clipPathId
+ } = parent.drawLayer.draw({
+ bbox: [0, 0, 1, 1],
+ root: {
+ viewBox: "0 0 1 1",
+ fill: editor.color,
+ "fill-opacity": editor._defaultOpacity
+ },
+ rootClass: {
+ highlight: true,
+ free: true
+ },
+ path: {
+ d: outliner.toSVGPath()
+ }
+ }, true, true);
+ editor.#createFreeOutlines({
+ highlightOutlines: outliner.getOutlines(),
+ highlightId: id,
+ clipPathId
+ });
+ editor.#addToDrawLayer();
+ }
+ return editor;
+ }
+ serialize(isForCopying = false) {
+ if (this.isEmpty() || isForCopying) {
+ return null;
+ }
+ if (this.deleted) {
+ return this.serializeDeleted();
+ }
+ const rect = this.getRect(0, 0);
+ const color = AnnotationEditor._colorManager.convert(this.color);
+ const serialized = {
+ annotationType: AnnotationEditorType.HIGHLIGHT,
+ color,
+ opacity: this.#opacity,
+ thickness: this.#thickness,
+ quadPoints: this.#serializeBoxes(),
+ outlines: this.#serializeOutlines(rect),
+ pageIndex: this.pageIndex,
+ rect,
+ rotation: this.#getRotation(),
+ structTreeParentId: this._structTreeParentId
+ };
+ if (this.annotationElementId && !this.#hasElementChanged(serialized)) {
+ return null;
+ }
+ serialized.id = this.annotationElementId;
+ return serialized;
+ }
+ #hasElementChanged(serialized) {
+ const {
+ color
+ } = this._initialData;
+ return serialized.color.some((c, i) => c !== color[i]);
+ }
+ renderAnnotationElement(annotation) {
+ annotation.updateEdited({
+ rect: this.getRect(0, 0)
+ });
+ return null;
+ }
+ static canCreateNewEmptyEditor() {
+ return false;
+ }
+}
+
+;// ./src/display/editor/draw.js
+
+
+
+class DrawingOptions {
+ #svgProperties = Object.create(null);
+ updateProperty(name, value) {
+ this[name] = value;
+ this.updateSVGProperty(name, value);
+ }
+ updateProperties(properties) {
+ if (!properties) {
+ return;
+ }
+ for (const [name, value] of Object.entries(properties)) {
+ this.updateProperty(name, value);
+ }
+ }
+ updateSVGProperty(name, value) {
+ this.#svgProperties[name] = value;
+ }
+ toSVGProperties() {
+ const root = this.#svgProperties;
+ this.#svgProperties = Object.create(null);
+ return {
+ root
+ };
+ }
+ reset() {
+ this.#svgProperties = Object.create(null);
+ }
+ updateAll(options = this) {
+ this.updateProperties(options);
+ }
+ clone() {
+ unreachable("Not implemented");
+ }
+}
+class DrawingEditor extends AnnotationEditor {
+ #drawOutlines = null;
+ #mustBeCommitted;
+ _drawId = null;
+ static _currentDrawId = -1;
+ static _currentDraw = null;
+ static _currentDrawingOptions = null;
+ static _currentParent = null;
+ static _INNER_MARGIN = 3;
+ constructor(params) {
+ super(params);
+ this.#mustBeCommitted = params.mustBeCommitted || false;
+ if (params.drawOutlines) {
+ this.#createDrawOutlines(params);
+ this.#addToDrawLayer();
+ }
+ }
+ #createDrawOutlines({
+ drawOutlines,
+ drawId,
+ drawingOptions
+ }) {
+ this.#drawOutlines = drawOutlines;
+ this._drawingOptions ||= drawingOptions;
+ if (drawId >= 0) {
+ this._drawId = drawId;
+ this.parent.drawLayer.finalizeDraw(drawId, drawOutlines.defaultProperties);
+ } else {
+ this._drawId = this.#createDrawing(drawOutlines, this.parent);
+ }
+ this.#updateBbox(drawOutlines.box);
+ }
+ #createDrawing(drawOutlines, parent) {
+ const {
+ id
+ } = parent.drawLayer.draw(DrawingEditor._mergeSVGProperties(this._drawingOptions.toSVGProperties(), drawOutlines.defaultSVGProperties), false, false);
+ return id;
+ }
+ static _mergeSVGProperties(p1, p2) {
+ const p1Keys = new Set(Object.keys(p1));
+ for (const [key, value] of Object.entries(p2)) {
+ if (p1Keys.has(key)) {
+ Object.assign(p1[key], value);
+ } else {
+ p1[key] = value;
+ }
+ }
+ return p1;
+ }
+ static getDefaultDrawingOptions(_options) {
+ unreachable("Not implemented");
+ }
+ static get typesMap() {
+ unreachable("Not implemented");
+ }
+ static get isDrawer() {
+ return true;
+ }
+ static get supportMultipleDrawings() {
+ return false;
+ }
+ static updateDefaultParams(type, value) {
+ const propertyName = this.typesMap.get(type);
+ if (propertyName) {
+ this._defaultDrawingOptions.updateProperty(propertyName, value);
+ }
+ if (this._currentParent) {
+ this._currentDraw.updateProperty(propertyName, value);
+ this._currentParent.drawLayer.updateProperties(this._currentDrawId, this._defaultDrawingOptions.toSVGProperties());
+ }
+ }
+ updateParams(type, value) {
+ const propertyName = this.constructor.typesMap.get(type);
+ if (propertyName) {
+ this._updateProperty(type, propertyName, value);
+ }
+ }
+ static get defaultPropertiesToUpdate() {
+ const properties = [];
+ const options = this._defaultDrawingOptions;
+ for (const [type, name] of this.typesMap) {
+ properties.push([type, options[name]]);
+ }
+ return properties;
+ }
+ get propertiesToUpdate() {
+ const properties = [];
+ const {
+ _drawingOptions
+ } = this;
+ for (const [type, name] of this.constructor.typesMap) {
+ properties.push([type, _drawingOptions[name]]);
+ }
+ return properties;
+ }
+ _updateProperty(type, name, value) {
+ const options = this._drawingOptions;
+ const savedValue = options[name];
+ const setter = val => {
+ options.updateProperty(name, val);
+ const bbox = this.#drawOutlines.updateProperty(name, val);
+ if (bbox) {
+ this.#updateBbox(bbox);
+ }
+ this.parent?.drawLayer.updateProperties(this._drawId, options.toSVGProperties());
+ };
+ this.addCommands({
+ cmd: setter.bind(this, value),
+ undo: setter.bind(this, savedValue),
+ post: this._uiManager.updateUI.bind(this._uiManager, this),
+ mustExec: true,
+ type,
+ overwriteIfSameType: true,
+ keepUndo: true
+ });
+ }
+ _onResizing() {
+ this.parent?.drawLayer.updateProperties(this._drawId, DrawingEditor._mergeSVGProperties(this.#drawOutlines.getPathResizingSVGProperties(this.#convertToDrawSpace()), {
+ bbox: this.#rotateBox()
+ }));
+ }
+ _onResized() {
+ this.parent?.drawLayer.updateProperties(this._drawId, DrawingEditor._mergeSVGProperties(this.#drawOutlines.getPathResizedSVGProperties(this.#convertToDrawSpace()), {
+ bbox: this.#rotateBox()
+ }));
+ }
+ _onTranslating(x, y) {
+ this.parent?.drawLayer.updateProperties(this._drawId, {
+ bbox: this.#rotateBox(x, y)
+ });
+ }
+ _onTranslated() {
+ this.parent?.drawLayer.updateProperties(this._drawId, DrawingEditor._mergeSVGProperties(this.#drawOutlines.getPathTranslatedSVGProperties(this.#convertToDrawSpace(), this.parentDimensions), {
+ bbox: this.#rotateBox()
+ }));
+ }
+ _onStartDragging() {
+ this.parent?.drawLayer.updateProperties(this._drawId, {
+ rootClass: {
+ moving: true
+ }
+ });
+ }
+ _onStopDragging() {
+ this.parent?.drawLayer.updateProperties(this._drawId, {
+ rootClass: {
+ moving: false
+ }
+ });
+ }
+ commit() {
+ super.commit();
+ this.disableEditMode();
+ this.disableEditing();
+ }
+ disableEditing() {
+ super.disableEditing();
+ this.div.classList.toggle("disabled", true);
+ }
+ enableEditing() {
+ super.enableEditing();
+ this.div.classList.toggle("disabled", false);
+ }
+ getBaseTranslation() {
+ return [0, 0];
+ }
+ get isResizable() {
+ return true;
+ }
+ onceAdded() {
+ if (!this.annotationElementId) {
+ this.parent.addUndoableEditor(this);
+ }
+ this._isDraggable = true;
+ if (this.#mustBeCommitted) {
+ this.#mustBeCommitted = false;
+ this.commit();
+ this.parent.setSelected(this);
+ if (this.isOnScreen) {
+ this.div.focus();
+ }
+ }
+ }
+ remove() {
+ this.#cleanDrawLayer();
+ super.remove();
+ }
+ rebuild() {
+ if (!this.parent) {
+ return;
+ }
+ super.rebuild();
+ if (this.div === null) {
+ return;
+ }
+ this.#addToDrawLayer();
+ this.#updateBbox(this.#drawOutlines.box);
+ if (!this.isAttachedToDOM) {
+ this.parent.add(this);
+ }
+ }
+ setParent(parent) {
+ let mustBeSelected = false;
+ if (this.parent && !parent) {
+ this._uiManager.removeShouldRescale(this);
+ this.#cleanDrawLayer();
+ } else if (parent) {
+ this._uiManager.addShouldRescale(this);
+ this.#addToDrawLayer(parent);
+ mustBeSelected = !this.parent && this.div?.classList.contains("selectedEditor");
+ }
+ super.setParent(parent);
+ if (mustBeSelected) {
+ this.select();
+ }
+ }
+ #cleanDrawLayer() {
+ if (this._drawId === null || !this.parent) {
+ return;
+ }
+ this.parent.drawLayer.remove(this._drawId);
+ this._drawId = null;
+ this._drawingOptions.reset();
+ }
+ #addToDrawLayer(parent = this.parent) {
+ if (this._drawId !== null && this.parent === parent) {
+ return;
+ }
+ if (this._drawId !== null) {
+ this.parent.drawLayer.updateParent(this._drawId, parent.drawLayer);
+ return;
+ }
+ this._drawingOptions.updateAll();
+ this._drawId = this.#createDrawing(this.#drawOutlines, parent);
+ }
+ #convertToParentSpace([x, y, width, height]) {
+ const {
+ parentDimensions: [pW, pH],
+ rotation
+ } = this;
+ switch (rotation) {
+ case 90:
+ return [y, 1 - x, width * (pH / pW), height * (pW / pH)];
+ case 180:
+ return [1 - x, 1 - y, width, height];
+ case 270:
+ return [1 - y, x, width * (pH / pW), height * (pW / pH)];
+ default:
+ return [x, y, width, height];
+ }
+ }
+ #convertToDrawSpace() {
+ const {
+ x,
+ y,
+ width,
+ height,
+ parentDimensions: [pW, pH],
+ rotation
+ } = this;
+ switch (rotation) {
+ case 90:
+ return [1 - y, x, width * (pW / pH), height * (pH / pW)];
+ case 180:
+ return [1 - x, 1 - y, width, height];
+ case 270:
+ return [y, 1 - x, width * (pW / pH), height * (pH / pW)];
+ default:
+ return [x, y, width, height];
+ }
+ }
+ #updateBbox(bbox) {
+ [this.x, this.y, this.width, this.height] = this.#convertToParentSpace(bbox);
+ if (this.div) {
+ this.fixAndSetPosition();
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(this.width * parentWidth, this.height * parentHeight);
+ }
+ this._onResized();
+ }
+ #rotateBox() {
+ const {
+ x,
+ y,
+ width,
+ height,
+ rotation,
+ parentRotation,
+ parentDimensions: [pW, pH]
+ } = this;
+ switch ((rotation * 4 + parentRotation) / 90) {
+ case 1:
+ return [1 - y - height, x, height, width];
+ case 2:
+ return [1 - x - width, 1 - y - height, width, height];
+ case 3:
+ return [y, 1 - x - width, height, width];
+ case 4:
+ return [x, y - width * (pW / pH), height * (pH / pW), width * (pW / pH)];
+ case 5:
+ return [1 - y, x, width * (pW / pH), height * (pH / pW)];
+ case 6:
+ return [1 - x - height * (pH / pW), 1 - y, height * (pH / pW), width * (pW / pH)];
+ case 7:
+ return [y - width * (pW / pH), 1 - x - height * (pH / pW), width * (pW / pH), height * (pH / pW)];
+ case 8:
+ return [x - width, y - height, width, height];
+ case 9:
+ return [1 - y, x - width, height, width];
+ case 10:
+ return [1 - x, 1 - y, width, height];
+ case 11:
+ return [y - height, 1 - x, height, width];
+ case 12:
+ return [x - height * (pH / pW), y, height * (pH / pW), width * (pW / pH)];
+ case 13:
+ return [1 - y - width * (pW / pH), x - height * (pH / pW), width * (pW / pH), height * (pH / pW)];
+ case 14:
+ return [1 - x, 1 - y - width * (pW / pH), height * (pH / pW), width * (pW / pH)];
+ case 15:
+ return [y, 1 - x, width * (pW / pH), height * (pH / pW)];
+ default:
+ return [x, y, width, height];
+ }
+ }
+ rotate() {
+ if (!this.parent) {
+ return;
+ }
+ this.parent.drawLayer.updateProperties(this._drawId, DrawingEditor._mergeSVGProperties({
+ bbox: this.#rotateBox()
+ }, this.#drawOutlines.updateRotation((this.parentRotation - this.rotation + 360) % 360)));
+ }
+ onScaleChanging() {
+ if (!this.parent) {
+ return;
+ }
+ this.#updateBbox(this.#drawOutlines.updateParentDimensions(this.parentDimensions, this.parent.scale));
+ }
+ static onScaleChangingWhenDrawing() {}
+ render() {
+ if (this.div) {
+ return this.div;
+ }
+ const div = super.render();
+ div.classList.add("draw");
+ const drawDiv = document.createElement("div");
+ div.append(drawDiv);
+ drawDiv.setAttribute("aria-hidden", "true");
+ drawDiv.className = "internal";
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.setDims(this.width * parentWidth, this.height * parentHeight);
+ this._uiManager.addShouldRescale(this);
+ this.disableEditing();
+ return div;
+ }
+ static createDrawerInstance(_x, _y, _parentWidth, _parentHeight, _rotation) {
+ unreachable("Not implemented");
+ }
+ static startDrawing(parent, uiManager, _isLTR, {
+ target,
+ offsetX: x,
+ offsetY: y
+ }) {
+ const {
+ viewport: {
+ rotation
+ }
+ } = parent;
+ const {
+ width: parentWidth,
+ height: parentHeight
+ } = target.getBoundingClientRect();
+ const ac = new AbortController();
+ const signal = parent.combinedSignal(ac);
+ window.addEventListener("pointerup", e => {
+ ac.abort();
+ parent.toggleDrawing(true);
+ this._endDraw(e);
+ }, {
+ signal
+ });
+ window.addEventListener("pointerdown", stopEvent, {
+ capture: true,
+ passive: false,
+ signal
+ });
+ window.addEventListener("contextmenu", noContextMenu, {
+ signal
+ });
+ target.addEventListener("pointermove", this._drawMove.bind(this), {
+ signal
+ });
+ parent.toggleDrawing();
+ uiManager._editorUndoBar?.hide();
+ if (this._currentDraw) {
+ parent.drawLayer.updateProperties(this._currentDrawId, this._currentDraw.startNew(x, y, parentWidth, parentHeight, rotation));
+ return;
+ }
+ uiManager.updateUIForDefaultProperties(this);
+ this._currentDraw = this.createDrawerInstance(x, y, parentWidth, parentHeight, rotation);
+ this._currentDrawingOptions = this.getDefaultDrawingOptions();
+ this._currentParent = parent;
+ ({
+ id: this._currentDrawId
+ } = parent.drawLayer.draw(this._mergeSVGProperties(this._currentDrawingOptions.toSVGProperties(), this._currentDraw.defaultSVGProperties), true, false));
+ }
+ static _drawMove({
+ offsetX,
+ offsetY
+ }) {
+ this._currentParent.drawLayer.updateProperties(this._currentDrawId, this._currentDraw.add(offsetX, offsetY));
+ }
+ static _endDraw({
+ offsetX,
+ offsetY
+ }) {
+ const parent = this._currentParent;
+ parent.drawLayer.updateProperties(this._currentDrawId, this._currentDraw.end(offsetX, offsetY));
+ if (this.supportMultipleDrawings) {
+ const draw = this._currentDraw;
+ const drawId = this._currentDrawId;
+ const lastElement = draw.getLastElement();
+ parent.addCommands({
+ cmd: () => {
+ parent.drawLayer.updateProperties(drawId, draw.setLastElement(lastElement));
+ },
+ undo: () => {
+ parent.drawLayer.updateProperties(drawId, draw.removeLastElement());
+ },
+ mustExec: false,
+ type: AnnotationEditorParamsType.DRAW_STEP
+ });
+ return;
+ }
+ this.endDrawing(false);
+ }
+ static endDrawing(isAborted) {
+ const parent = this._currentParent;
+ if (!parent) {
+ return null;
+ }
+ parent.toggleDrawing(true);
+ parent.cleanUndoStack(AnnotationEditorParamsType.DRAW_STEP);
+ if (!this._currentDraw.isEmpty()) {
+ const {
+ pageDimensions: [pageWidth, pageHeight],
+ scale
+ } = parent;
+ const editor = parent.createAndAddNewEditor({
+ offsetX: 0,
+ offsetY: 0
+ }, false, {
+ drawId: this._currentDrawId,
+ drawOutlines: this._currentDraw.getOutlines(pageWidth * scale, pageHeight * scale, scale, this._INNER_MARGIN),
+ drawingOptions: this._currentDrawingOptions,
+ mustBeCommitted: !isAborted
+ });
+ this._cleanup();
+ return editor;
+ }
+ parent.drawLayer.remove(this._currentDrawId);
+ this._cleanup();
+ return null;
+ }
+ static _cleanup() {
+ this._currentDrawId = -1;
+ this._currentDraw = null;
+ this._currentDrawingOptions = null;
+ this._currentParent = null;
+ }
+ createDrawingOptions(_data) {}
+ static deserializeDraw(_pageX, _pageY, _pageWidth, _pageHeight, _innerWidth, _data) {
+ unreachable("Not implemented");
+ }
+ static async deserialize(data, parent, uiManager) {
+ const {
+ rawDims: {
+ pageWidth,
+ pageHeight,
+ pageX,
+ pageY
+ }
+ } = parent.viewport;
+ const drawOutlines = this.deserializeDraw(pageX, pageY, pageWidth, pageHeight, this._INNER_MARGIN, data);
+ const editor = await super.deserialize(data, parent, uiManager);
+ editor.createDrawingOptions(data);
+ editor.#createDrawOutlines({
+ drawOutlines
+ });
+ editor.#addToDrawLayer();
+ editor.onScaleChanging();
+ editor.rotate();
+ return editor;
+ }
+ serializeDraw(isForCopying) {
+ const [pageX, pageY] = this.pageTranslation;
+ const [pageWidth, pageHeight] = this.pageDimensions;
+ return this.#drawOutlines.serialize([pageX, pageY, pageWidth, pageHeight], isForCopying);
+ }
+ renderAnnotationElement(annotation) {
+ annotation.updateEdited({
+ rect: this.getRect(0, 0)
+ });
+ return null;
+ }
+ static canCreateNewEmptyEditor() {
+ return false;
+ }
+}
+
+;// ./src/display/editor/drawers/inkdraw.js
+
+
+class InkDrawOutliner {
+ #last = new Float64Array(6);
+ #line;
+ #lines;
+ #rotation;
+ #thickness;
+ #points;
+ #lastSVGPath = "";
+ #lastIndex = 0;
+ #outlines = new InkDrawOutline();
+ #parentWidth;
+ #parentHeight;
+ constructor(x, y, parentWidth, parentHeight, rotation, thickness) {
+ this.#parentWidth = parentWidth;
+ this.#parentHeight = parentHeight;
+ this.#rotation = rotation;
+ this.#thickness = thickness;
+ [x, y] = this.#normalizePoint(x, y);
+ const line = this.#line = [NaN, NaN, NaN, NaN, x, y];
+ this.#points = [x, y];
+ this.#lines = [{
+ line,
+ points: this.#points
+ }];
+ this.#last.set(line, 0);
+ }
+ updateProperty(name, value) {
+ if (name === "stroke-width") {
+ this.#thickness = value;
+ }
+ }
+ #normalizePoint(x, y) {
+ return Outline._normalizePoint(x, y, this.#parentWidth, this.#parentHeight, this.#rotation);
+ }
+ isEmpty() {
+ return !this.#lines || this.#lines.length === 0;
+ }
+ add(x, y) {
+ [x, y] = this.#normalizePoint(x, y);
+ const [x1, y1, x2, y2] = this.#last.subarray(2, 6);
+ const diffX = x - x2;
+ const diffY = y - y2;
+ const d = Math.hypot(this.#parentWidth * diffX, this.#parentHeight * diffY);
+ if (d <= 2) {
+ return null;
+ }
+ this.#points.push(x, y);
+ if (isNaN(x1)) {
+ this.#last.set([x2, y2, x, y], 2);
+ this.#line.push(NaN, NaN, NaN, NaN, x, y);
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ if (isNaN(this.#last[0])) {
+ this.#line.splice(6, 6);
+ }
+ this.#last.set([x1, y1, x2, y2, x, y], 0);
+ this.#line.push(...Outline.createBezierPoints(x1, y1, x2, y2, x, y));
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ end(x, y) {
+ const change = this.add(x, y);
+ if (change) {
+ return change;
+ }
+ if (this.#points.length === 2) {
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ return null;
+ }
+ startNew(x, y, parentWidth, parentHeight, rotation) {
+ this.#parentWidth = parentWidth;
+ this.#parentHeight = parentHeight;
+ this.#rotation = rotation;
+ [x, y] = this.#normalizePoint(x, y);
+ const line = this.#line = [NaN, NaN, NaN, NaN, x, y];
+ this.#points = [x, y];
+ const last = this.#lines.at(-1);
+ if (last) {
+ last.line = new Float32Array(last.line);
+ last.points = new Float32Array(last.points);
+ }
+ this.#lines.push({
+ line,
+ points: this.#points
+ });
+ this.#last.set(line, 0);
+ this.#lastIndex = 0;
+ this.toSVGPath();
+ return null;
+ }
+ getLastElement() {
+ return this.#lines.at(-1);
+ }
+ setLastElement(element) {
+ if (!this.#lines) {
+ return this.#outlines.setLastElement(element);
+ }
+ this.#lines.push(element);
+ this.#line = element.line;
+ this.#points = element.points;
+ this.#lastIndex = 0;
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ removeLastElement() {
+ if (!this.#lines) {
+ return this.#outlines.removeLastElement();
+ }
+ this.#lines.pop();
+ this.#lastSVGPath = "";
+ for (let i = 0, ii = this.#lines.length; i < ii; i++) {
+ const {
+ line,
+ points
+ } = this.#lines[i];
+ this.#line = line;
+ this.#points = points;
+ this.#lastIndex = 0;
+ this.toSVGPath();
+ }
+ return {
+ path: {
+ d: this.#lastSVGPath
+ }
+ };
+ }
+ toSVGPath() {
+ const firstX = Outline.svgRound(this.#line[4]);
+ const firstY = Outline.svgRound(this.#line[5]);
+ if (this.#points.length === 2) {
+ this.#lastSVGPath = `${this.#lastSVGPath} M ${firstX} ${firstY} Z`;
+ return this.#lastSVGPath;
+ }
+ if (this.#points.length <= 6) {
+ const i = this.#lastSVGPath.lastIndexOf("M");
+ this.#lastSVGPath = `${this.#lastSVGPath.slice(0, i)} M ${firstX} ${firstY}`;
+ this.#lastIndex = 6;
+ }
+ if (this.#points.length === 4) {
+ const secondX = Outline.svgRound(this.#line[10]);
+ const secondY = Outline.svgRound(this.#line[11]);
+ this.#lastSVGPath = `${this.#lastSVGPath} L ${secondX} ${secondY}`;
+ this.#lastIndex = 12;
+ return this.#lastSVGPath;
+ }
+ const buffer = [];
+ if (this.#lastIndex === 0) {
+ buffer.push(`M ${firstX} ${firstY}`);
+ this.#lastIndex = 6;
+ }
+ for (let i = this.#lastIndex, ii = this.#line.length; i < ii; i += 6) {
+ const [c1x, c1y, c2x, c2y, x, y] = this.#line.slice(i, i + 6).map(Outline.svgRound);
+ buffer.push(`C${c1x} ${c1y} ${c2x} ${c2y} ${x} ${y}`);
+ }
+ this.#lastSVGPath += buffer.join(" ");
+ this.#lastIndex = this.#line.length;
+ return this.#lastSVGPath;
+ }
+ getOutlines(parentWidth, parentHeight, scale, innerMargin) {
+ const last = this.#lines.at(-1);
+ last.line = new Float32Array(last.line);
+ last.points = new Float32Array(last.points);
+ this.#outlines.build(this.#lines, parentWidth, parentHeight, scale, this.#rotation, this.#thickness, innerMargin);
+ this.#last = null;
+ this.#line = null;
+ this.#lines = null;
+ this.#lastSVGPath = null;
+ return this.#outlines;
+ }
+ get defaultSVGProperties() {
+ return {
+ root: {
+ viewBox: "0 0 10000 10000"
+ },
+ rootClass: {
+ draw: true
+ },
+ bbox: [0, 0, 1, 1]
+ };
+ }
+}
+class InkDrawOutline extends Outline {
+ #bbox;
+ #currentRotation = 0;
+ #innerMargin;
+ #lines;
+ #parentWidth;
+ #parentHeight;
+ #parentScale;
+ #rotation;
+ #thickness;
+ build(lines, parentWidth, parentHeight, parentScale, rotation, thickness, innerMargin) {
+ this.#parentWidth = parentWidth;
+ this.#parentHeight = parentHeight;
+ this.#parentScale = parentScale;
+ this.#rotation = rotation;
+ this.#thickness = thickness;
+ this.#innerMargin = innerMargin ?? 0;
+ this.#lines = lines;
+ this.#computeBbox();
+ }
+ setLastElement(element) {
+ this.#lines.push(element);
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ removeLastElement() {
+ this.#lines.pop();
+ return {
+ path: {
+ d: this.toSVGPath()
+ }
+ };
+ }
+ toSVGPath() {
+ const buffer = [];
+ for (const {
+ line
+ } of this.#lines) {
+ buffer.push(`M${Outline.svgRound(line[4])} ${Outline.svgRound(line[5])}`);
+ if (line.length === 6) {
+ buffer.push("Z");
+ continue;
+ }
+ if (line.length === 12) {
+ buffer.push(`L${Outline.svgRound(line[10])} ${Outline.svgRound(line[11])}`);
+ continue;
+ }
+ for (let i = 6, ii = line.length; i < ii; i += 6) {
+ const [c1x, c1y, c2x, c2y, x, y] = line.subarray(i, i + 6).map(Outline.svgRound);
+ buffer.push(`C${c1x} ${c1y} ${c2x} ${c2y} ${x} ${y}`);
+ }
+ }
+ return buffer.join("");
+ }
+ serialize([pageX, pageY, pageWidth, pageHeight], isForCopying) {
+ const serializedLines = [];
+ const serializedPoints = [];
+ const [x, y, width, height] = this.#getBBoxWithNoMargin();
+ let tx, ty, sx, sy, x1, y1, x2, y2, rescaleFn;
+ switch (this.#rotation) {
+ case 0:
+ rescaleFn = Outline._rescale;
+ tx = pageX;
+ ty = pageY + pageHeight;
+ sx = pageWidth;
+ sy = -pageHeight;
+ x1 = pageX + x * pageWidth;
+ y1 = pageY + (1 - y - height) * pageHeight;
+ x2 = pageX + (x + width) * pageWidth;
+ y2 = pageY + (1 - y) * pageHeight;
+ break;
+ case 90:
+ rescaleFn = Outline._rescaleAndSwap;
+ tx = pageX;
+ ty = pageY;
+ sx = pageWidth;
+ sy = pageHeight;
+ x1 = pageX + y * pageWidth;
+ y1 = pageY + x * pageHeight;
+ x2 = pageX + (y + height) * pageWidth;
+ y2 = pageY + (x + width) * pageHeight;
+ break;
+ case 180:
+ rescaleFn = Outline._rescale;
+ tx = pageX + pageWidth;
+ ty = pageY;
+ sx = -pageWidth;
+ sy = pageHeight;
+ x1 = pageX + (1 - x - width) * pageWidth;
+ y1 = pageY + y * pageHeight;
+ x2 = pageX + (1 - x) * pageWidth;
+ y2 = pageY + (y + height) * pageHeight;
+ break;
+ case 270:
+ rescaleFn = Outline._rescaleAndSwap;
+ tx = pageX + pageWidth;
+ ty = pageY + pageHeight;
+ sx = -pageWidth;
+ sy = -pageHeight;
+ x1 = pageX + (1 - y - height) * pageWidth;
+ y1 = pageY + (1 - x - width) * pageHeight;
+ x2 = pageX + (1 - y) * pageWidth;
+ y2 = pageY + (1 - x) * pageHeight;
+ break;
+ }
+ for (const {
+ line,
+ points
+ } of this.#lines) {
+ serializedLines.push(rescaleFn(line, tx, ty, sx, sy, isForCopying ? new Array(line.length) : null));
+ serializedPoints.push(rescaleFn(points, tx, ty, sx, sy, isForCopying ? new Array(points.length) : null));
+ }
+ return {
+ lines: serializedLines,
+ points: serializedPoints,
+ rect: [x1, y1, x2, y2]
+ };
+ }
+ static deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, {
+ paths: {
+ lines,
+ points
+ },
+ rotation,
+ thickness
+ }) {
+ const newLines = [];
+ let tx, ty, sx, sy, rescaleFn;
+ switch (rotation) {
+ case 0:
+ rescaleFn = Outline._rescale;
+ tx = -pageX / pageWidth;
+ ty = pageY / pageHeight + 1;
+ sx = 1 / pageWidth;
+ sy = -1 / pageHeight;
+ break;
+ case 90:
+ rescaleFn = Outline._rescaleAndSwap;
+ tx = -pageY / pageHeight;
+ ty = -pageX / pageWidth;
+ sx = 1 / pageHeight;
+ sy = 1 / pageWidth;
+ break;
+ case 180:
+ rescaleFn = Outline._rescale;
+ tx = pageX / pageWidth + 1;
+ ty = -pageY / pageHeight;
+ sx = -1 / pageWidth;
+ sy = 1 / pageHeight;
+ break;
+ case 270:
+ rescaleFn = Outline._rescaleAndSwap;
+ tx = pageY / pageHeight + 1;
+ ty = pageX / pageWidth + 1;
+ sx = -1 / pageHeight;
+ sy = -1 / pageWidth;
+ break;
+ }
+ if (!lines) {
+ lines = [];
+ for (const point of points) {
+ const len = point.length;
+ if (len === 2) {
+ lines.push(new Float32Array([NaN, NaN, NaN, NaN, point[0], point[1]]));
+ continue;
+ }
+ if (len === 4) {
+ lines.push(new Float32Array([NaN, NaN, NaN, NaN, point[0], point[1], NaN, NaN, NaN, NaN, point[2], point[3]]));
+ continue;
+ }
+ const line = new Float32Array(3 * (len - 2));
+ lines.push(line);
+ let [x1, y1, x2, y2] = point.subarray(0, 4);
+ line.set([NaN, NaN, NaN, NaN, x1, y1], 0);
+ for (let i = 4; i < len; i += 2) {
+ const x = point[i];
+ const y = point[i + 1];
+ line.set(Outline.createBezierPoints(x1, y1, x2, y2, x, y), (i - 2) * 3);
+ [x1, y1, x2, y2] = [x2, y2, x, y];
+ }
+ }
+ }
+ for (let i = 0, ii = lines.length; i < ii; i++) {
+ newLines.push({
+ line: rescaleFn(lines[i].map(x => x ?? NaN), tx, ty, sx, sy),
+ points: rescaleFn(points[i].map(x => x ?? NaN), tx, ty, sx, sy)
+ });
+ }
+ const outlines = new InkDrawOutline();
+ outlines.build(newLines, pageWidth, pageHeight, 1, rotation, thickness, innerMargin);
+ return outlines;
+ }
+ #getMarginComponents(thickness = this.#thickness) {
+ const margin = this.#innerMargin + thickness / 2 * this.#parentScale;
+ return this.#rotation % 180 === 0 ? [margin / this.#parentWidth, margin / this.#parentHeight] : [margin / this.#parentHeight, margin / this.#parentWidth];
+ }
+ #getBBoxWithNoMargin() {
+ const [x, y, width, height] = this.#bbox;
+ const [marginX, marginY] = this.#getMarginComponents(0);
+ return [x + marginX, y + marginY, width - 2 * marginX, height - 2 * marginY];
+ }
+ #computeBbox() {
+ const bbox = this.#bbox = new Float32Array([Infinity, Infinity, -Infinity, -Infinity]);
+ for (const {
+ line
+ } of this.#lines) {
+ if (line.length <= 12) {
+ for (let i = 4, ii = line.length; i < ii; i += 6) {
+ const [x, y] = line.subarray(i, i + 2);
+ bbox[0] = Math.min(bbox[0], x);
+ bbox[1] = Math.min(bbox[1], y);
+ bbox[2] = Math.max(bbox[2], x);
+ bbox[3] = Math.max(bbox[3], y);
+ }
+ continue;
+ }
+ let lastX = line[4],
+ lastY = line[5];
+ for (let i = 6, ii = line.length; i < ii; i += 6) {
+ const [c1x, c1y, c2x, c2y, x, y] = line.subarray(i, i + 6);
+ Util.bezierBoundingBox(lastX, lastY, c1x, c1y, c2x, c2y, x, y, bbox);
+ lastX = x;
+ lastY = y;
+ }
+ }
+ const [marginX, marginY] = this.#getMarginComponents();
+ bbox[0] = Math.min(1, Math.max(0, bbox[0] - marginX));
+ bbox[1] = Math.min(1, Math.max(0, bbox[1] - marginY));
+ bbox[2] = Math.min(1, Math.max(0, bbox[2] + marginX));
+ bbox[3] = Math.min(1, Math.max(0, bbox[3] + marginY));
+ bbox[2] -= bbox[0];
+ bbox[3] -= bbox[1];
+ }
+ get box() {
+ return this.#bbox;
+ }
+ updateProperty(name, value) {
+ if (name === "stroke-width") {
+ return this.#updateThickness(value);
+ }
+ return null;
+ }
+ #updateThickness(thickness) {
+ const [oldMarginX, oldMarginY] = this.#getMarginComponents();
+ this.#thickness = thickness;
+ const [newMarginX, newMarginY] = this.#getMarginComponents();
+ const [diffMarginX, diffMarginY] = [newMarginX - oldMarginX, newMarginY - oldMarginY];
+ const bbox = this.#bbox;
+ bbox[0] -= diffMarginX;
+ bbox[1] -= diffMarginY;
+ bbox[2] += 2 * diffMarginX;
+ bbox[3] += 2 * diffMarginY;
+ return bbox;
+ }
+ updateParentDimensions([width, height], scale) {
+ const [oldMarginX, oldMarginY] = this.#getMarginComponents();
+ this.#parentWidth = width;
+ this.#parentHeight = height;
+ this.#parentScale = scale;
+ const [newMarginX, newMarginY] = this.#getMarginComponents();
+ const diffMarginX = newMarginX - oldMarginX;
+ const diffMarginY = newMarginY - oldMarginY;
+ const bbox = this.#bbox;
+ bbox[0] -= diffMarginX;
+ bbox[1] -= diffMarginY;
+ bbox[2] += 2 * diffMarginX;
+ bbox[3] += 2 * diffMarginY;
+ return bbox;
+ }
+ updateRotation(rotation) {
+ this.#currentRotation = rotation;
+ return {
+ path: {
+ transform: this.rotationTransform
+ }
+ };
+ }
+ get viewBox() {
+ return this.#bbox.map(Outline.svgRound).join(" ");
+ }
+ get defaultProperties() {
+ const [x, y] = this.#bbox;
+ return {
+ root: {
+ viewBox: this.viewBox
+ },
+ path: {
+ "transform-origin": `${Outline.svgRound(x)} ${Outline.svgRound(y)}`
+ }
+ };
+ }
+ get rotationTransform() {
+ const [,, width, height] = this.#bbox;
+ let a = 0,
+ b = 0,
+ c = 0,
+ d = 0,
+ e = 0,
+ f = 0;
+ switch (this.#currentRotation) {
+ case 90:
+ b = height / width;
+ c = -width / height;
+ e = width;
+ break;
+ case 180:
+ a = -1;
+ d = -1;
+ e = width;
+ f = height;
+ break;
+ case 270:
+ b = -height / width;
+ c = width / height;
+ f = height;
+ break;
+ default:
+ return "";
+ }
+ return `matrix(${a} ${b} ${c} ${d} ${Outline.svgRound(e)} ${Outline.svgRound(f)})`;
+ }
+ getPathResizingSVGProperties([newX, newY, newWidth, newHeight]) {
+ const [marginX, marginY] = this.#getMarginComponents();
+ const [x, y, width, height] = this.#bbox;
+ if (Math.abs(width - marginX) <= Outline.PRECISION || Math.abs(height - marginY) <= Outline.PRECISION) {
+ const tx = newX + newWidth / 2 - (x + width / 2);
+ const ty = newY + newHeight / 2 - (y + height / 2);
+ return {
+ path: {
+ "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
+ transform: `${this.rotationTransform} translate(${tx} ${ty})`
+ }
+ };
+ }
+ const s1x = (newWidth - 2 * marginX) / (width - 2 * marginX);
+ const s1y = (newHeight - 2 * marginY) / (height - 2 * marginY);
+ const s2x = width / newWidth;
+ const s2y = height / newHeight;
+ return {
+ path: {
+ "transform-origin": `${Outline.svgRound(x)} ${Outline.svgRound(y)}`,
+ transform: `${this.rotationTransform} scale(${s2x} ${s2y}) ` + `translate(${Outline.svgRound(marginX)} ${Outline.svgRound(marginY)}) scale(${s1x} ${s1y}) ` + `translate(${Outline.svgRound(-marginX)} ${Outline.svgRound(-marginY)})`
+ }
+ };
+ }
+ getPathResizedSVGProperties([newX, newY, newWidth, newHeight]) {
+ const [marginX, marginY] = this.#getMarginComponents();
+ const bbox = this.#bbox;
+ const [x, y, width, height] = bbox;
+ bbox[0] = newX;
+ bbox[1] = newY;
+ bbox[2] = newWidth;
+ bbox[3] = newHeight;
+ if (Math.abs(width - marginX) <= Outline.PRECISION || Math.abs(height - marginY) <= Outline.PRECISION) {
+ const tx = newX + newWidth / 2 - (x + width / 2);
+ const ty = newY + newHeight / 2 - (y + height / 2);
+ for (const {
+ line,
+ points
+ } of this.#lines) {
+ Outline._translate(line, tx, ty, line);
+ Outline._translate(points, tx, ty, points);
+ }
+ return {
+ root: {
+ viewBox: this.viewBox
+ },
+ path: {
+ "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
+ transform: this.rotationTransform || null,
+ d: this.toSVGPath()
+ }
+ };
+ }
+ const s1x = (newWidth - 2 * marginX) / (width - 2 * marginX);
+ const s1y = (newHeight - 2 * marginY) / (height - 2 * marginY);
+ const tx = -s1x * (x + marginX) + newX + marginX;
+ const ty = -s1y * (y + marginY) + newY + marginY;
+ if (s1x !== 1 || s1y !== 1 || tx !== 0 || ty !== 0) {
+ for (const {
+ line,
+ points
+ } of this.#lines) {
+ Outline._rescale(line, tx, ty, s1x, s1y, line);
+ Outline._rescale(points, tx, ty, s1x, s1y, points);
+ }
+ }
+ return {
+ root: {
+ viewBox: this.viewBox
+ },
+ path: {
+ "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`,
+ transform: this.rotationTransform || null,
+ d: this.toSVGPath()
+ }
+ };
+ }
+ getPathTranslatedSVGProperties([newX, newY], parentDimensions) {
+ const [newParentWidth, newParentHeight] = parentDimensions;
+ const bbox = this.#bbox;
+ const tx = newX - bbox[0];
+ const ty = newY - bbox[1];
+ if (this.#parentWidth === newParentWidth && this.#parentHeight === newParentHeight) {
+ for (const {
+ line,
+ points
+ } of this.#lines) {
+ Outline._translate(line, tx, ty, line);
+ Outline._translate(points, tx, ty, points);
+ }
+ } else {
+ const sx = this.#parentWidth / newParentWidth;
+ const sy = this.#parentHeight / newParentHeight;
+ this.#parentWidth = newParentWidth;
+ this.#parentHeight = newParentHeight;
+ for (const {
+ line,
+ points
+ } of this.#lines) {
+ Outline._rescale(line, tx, ty, sx, sy, line);
+ Outline._rescale(points, tx, ty, sx, sy, points);
+ }
+ bbox[2] *= sx;
+ bbox[3] *= sy;
+ }
+ bbox[0] = newX;
+ bbox[1] = newY;
+ return {
+ root: {
+ viewBox: this.viewBox
+ },
+ path: {
+ d: this.toSVGPath(),
+ "transform-origin": `${Outline.svgRound(newX)} ${Outline.svgRound(newY)}`
+ }
+ };
+ }
+ get defaultSVGProperties() {
+ const bbox = this.#bbox;
+ return {
+ root: {
+ viewBox: this.viewBox
+ },
+ rootClass: {
+ draw: true
+ },
+ path: {
+ d: this.toSVGPath(),
+ "transform-origin": `${Outline.svgRound(bbox[0])} ${Outline.svgRound(bbox[1])}`,
+ transform: this.rotationTransform || null
+ },
+ bbox
+ };
+ }
+}
+
+;// ./src/display/editor/ink.js
+
+
+
+
+
+class InkDrawingOptions extends DrawingOptions {
+ #viewParameters;
+ constructor(viewerParameters) {
+ super();
+ this.#viewParameters = viewerParameters;
+ super.updateProperties({
+ fill: "none",
+ stroke: AnnotationEditor._defaultLineColor,
+ "stroke-opacity": 1,
+ "stroke-width": 1,
+ "stroke-linecap": "round",
+ "stroke-linejoin": "round",
+ "stroke-miterlimit": 10
+ });
+ }
+ updateSVGProperty(name, value) {
+ if (name === "stroke-width") {
+ value ??= this["stroke-width"];
+ value *= this.#viewParameters.realScale;
+ }
+ super.updateSVGProperty(name, value);
+ }
+ clone() {
+ const clone = new InkDrawingOptions(this.#viewParameters);
+ clone.updateAll(this);
+ return clone;
+ }
+}
+class InkEditor extends DrawingEditor {
+ static _type = "ink";
+ static _editorType = AnnotationEditorType.INK;
+ static _defaultDrawingOptions = null;
+ constructor(params) {
+ super({
+ ...params,
+ name: "inkEditor"
+ });
+ this._willKeepAspectRatio = true;
+ }
+ static initialize(l10n, uiManager) {
+ AnnotationEditor.initialize(l10n, uiManager);
+ this._defaultDrawingOptions = new InkDrawingOptions(uiManager.viewParameters);
+ }
+ static getDefaultDrawingOptions(options) {
+ const clone = this._defaultDrawingOptions.clone();
+ clone.updateProperties(options);
+ return clone;
+ }
+ static get supportMultipleDrawings() {
+ return true;
+ }
+ static get typesMap() {
+ return shadow(this, "typesMap", new Map([[AnnotationEditorParamsType.INK_THICKNESS, "stroke-width"], [AnnotationEditorParamsType.INK_COLOR, "stroke"], [AnnotationEditorParamsType.INK_OPACITY, "stroke-opacity"]]));
+ }
+ static createDrawerInstance(x, y, parentWidth, parentHeight, rotation) {
+ return new InkDrawOutliner(x, y, parentWidth, parentHeight, rotation, this._defaultDrawingOptions["stroke-width"]);
+ }
+ static deserializeDraw(pageX, pageY, pageWidth, pageHeight, innerMargin, data) {
+ return InkDrawOutline.deserialize(pageX, pageY, pageWidth, pageHeight, innerMargin, data);
+ }
+ static async deserialize(data, parent, uiManager) {
+ let initialData = null;
+ if (data instanceof InkAnnotationElement) {
+ const {
+ data: {
+ inkLists,
+ rect,
+ rotation,
+ id,
+ color,
+ opacity,
+ borderStyle: {
+ rawWidth: thickness
+ },
+ popupRef
+ },
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ initialData = data = {
+ annotationType: AnnotationEditorType.INK,
+ color: Array.from(color),
+ thickness,
+ opacity,
+ paths: {
+ points: inkLists
+ },
+ boxes: null,
+ pageIndex: pageNumber - 1,
+ rect: rect.slice(0),
+ rotation,
+ id,
+ deleted: false,
+ popupRef
+ };
+ }
+ const editor = await super.deserialize(data, parent, uiManager);
+ editor.annotationElementId = data.id || null;
+ editor._initialData = initialData;
+ return editor;
+ }
+ onScaleChanging() {
+ if (!this.parent) {
+ return;
+ }
+ super.onScaleChanging();
+ const {
+ _drawId,
+ _drawingOptions,
+ parent
+ } = this;
+ _drawingOptions.updateSVGProperty("stroke-width");
+ parent.drawLayer.updateProperties(_drawId, _drawingOptions.toSVGProperties());
+ }
+ static onScaleChangingWhenDrawing() {
+ const parent = this._currentParent;
+ if (!parent) {
+ return;
+ }
+ super.onScaleChangingWhenDrawing();
+ this._defaultDrawingOptions.updateSVGProperty("stroke-width");
+ parent.drawLayer.updateProperties(this._currentDrawId, this._defaultDrawingOptions.toSVGProperties());
+ }
+ createDrawingOptions({
+ color,
+ thickness,
+ opacity
+ }) {
+ this._drawingOptions = InkEditor.getDefaultDrawingOptions({
+ stroke: Util.makeHexColor(...color),
+ "stroke-width": thickness,
+ "stroke-opacity": opacity
+ });
+ }
+ serialize(isForCopying = false) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ if (this.deleted) {
+ return this.serializeDeleted();
+ }
+ const {
+ lines,
+ points,
+ rect
+ } = this.serializeDraw(isForCopying);
+ const {
+ _drawingOptions: {
+ stroke,
+ "stroke-opacity": opacity,
+ "stroke-width": thickness
+ }
+ } = this;
+ const serialized = {
+ annotationType: AnnotationEditorType.INK,
+ color: AnnotationEditor._colorManager.convert(stroke),
+ opacity,
+ thickness,
+ paths: {
+ lines,
+ points
+ },
+ pageIndex: this.pageIndex,
+ rect,
+ rotation: this.rotation,
+ structTreeParentId: this._structTreeParentId
+ };
+ if (isForCopying) {
+ return serialized;
+ }
+ if (this.annotationElementId && !this.#hasElementChanged(serialized)) {
+ return null;
+ }
+ serialized.id = this.annotationElementId;
+ return serialized;
+ }
+ #hasElementChanged(serialized) {
+ const {
+ color,
+ thickness,
+ opacity,
+ pageIndex
+ } = this._initialData;
+ return this._hasBeenMoved || this._hasBeenResized || serialized.color.some((c, i) => c !== color[i]) || serialized.thickness !== thickness || serialized.opacity !== opacity || serialized.pageIndex !== pageIndex;
+ }
+ renderAnnotationElement(annotation) {
+ const {
+ points,
+ rect
+ } = this.serializeDraw(false);
+ annotation.updateEdited({
+ rect,
+ thickness: this._drawingOptions["stroke-width"],
+ points
+ });
+ return null;
+ }
+}
+
+;// ./src/display/editor/stamp.js
+
+
+
+
+class StampEditor extends AnnotationEditor {
+ #bitmap = null;
+ #bitmapId = null;
+ #bitmapPromise = null;
+ #bitmapUrl = null;
+ #bitmapFile = null;
+ #bitmapFileName = "";
+ #canvas = null;
+ #observer = null;
+ #resizeTimeoutId = null;
+ #isSvg = false;
+ #hasBeenAddedInUndoStack = false;
+ static _type = "stamp";
+ static _editorType = AnnotationEditorType.STAMP;
+ constructor(params) {
+ super({
+ ...params,
+ name: "stampEditor"
+ });
+ this.#bitmapUrl = params.bitmapUrl;
+ this.#bitmapFile = params.bitmapFile;
+ }
+ static initialize(l10n, uiManager) {
+ AnnotationEditor.initialize(l10n, uiManager);
+ }
+ static get supportedTypes() {
+ const types = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
+ return shadow(this, "supportedTypes", types.map(type => `image/${type}`));
+ }
+ static get supportedTypesStr() {
+ return shadow(this, "supportedTypesStr", this.supportedTypes.join(","));
+ }
+ static isHandlingMimeForPasting(mime) {
+ return this.supportedTypes.includes(mime);
+ }
+ static paste(item, parent) {
+ parent.pasteEditor(AnnotationEditorType.STAMP, {
+ bitmapFile: item.getAsFile()
+ });
+ }
+ altTextFinish() {
+ if (this._uiManager.useNewAltTextFlow) {
+ this.div.hidden = false;
+ }
+ super.altTextFinish();
+ }
+ get telemetryFinalData() {
+ return {
+ type: "stamp",
+ hasAltText: !!this.altTextData?.altText
+ };
+ }
+ static computeTelemetryFinalData(data) {
+ const hasAltTextStats = data.get("hasAltText");
+ return {
+ hasAltText: hasAltTextStats.get(true) ?? 0,
+ hasNoAltText: hasAltTextStats.get(false) ?? 0
+ };
+ }
+ #getBitmapFetched(data, fromId = false) {
+ if (!data) {
+ this.remove();
+ return;
+ }
+ this.#bitmap = data.bitmap;
+ if (!fromId) {
+ this.#bitmapId = data.id;
+ this.#isSvg = data.isSvg;
+ }
+ if (data.file) {
+ this.#bitmapFileName = data.file.name;
+ }
+ this.#createCanvas();
+ }
+ #getBitmapDone() {
+ this.#bitmapPromise = null;
+ this._uiManager.enableWaiting(false);
+ if (!this.#canvas) {
+ return;
+ }
+ if (this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && this.#bitmap) {
+ this._editToolbar.hide();
+ this._uiManager.editAltText(this, true);
+ return;
+ }
+ if (!this._uiManager.useNewAltTextWhenAddingImage && this._uiManager.useNewAltTextFlow && this.#bitmap) {
+ this._reportTelemetry({
+ action: "pdfjs.image.image_added",
+ data: {
+ alt_text_modal: false,
+ alt_text_type: "empty"
+ }
+ });
+ try {
+ this.mlGuessAltText();
+ } catch {}
+ }
+ this.div.focus();
+ }
+ async mlGuessAltText(imageData = null, updateAltTextData = true) {
+ if (this.hasAltTextData()) {
+ return null;
+ }
+ const {
+ mlManager
+ } = this._uiManager;
+ if (!mlManager) {
+ throw new Error("No ML.");
+ }
+ if (!(await mlManager.isEnabledFor("altText"))) {
+ throw new Error("ML isn't enabled for alt text.");
+ }
+ const {
+ data,
+ width,
+ height
+ } = imageData || this.copyCanvas(null, null, true).imageData;
+ const response = await mlManager.guess({
+ name: "altText",
+ request: {
+ data,
+ width,
+ height,
+ channels: data.length / (width * height)
+ }
+ });
+ if (!response) {
+ throw new Error("No response from the AI service.");
+ }
+ if (response.error) {
+ throw new Error("Error from the AI service.");
+ }
+ if (response.cancel) {
+ return null;
+ }
+ if (!response.output) {
+ throw new Error("No valid response from the AI service.");
+ }
+ const altText = response.output;
+ await this.setGuessedAltText(altText);
+ if (updateAltTextData && !this.hasAltTextData()) {
+ this.altTextData = {
+ alt: altText,
+ decorative: false
+ };
+ }
+ return altText;
+ }
+ #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;
+ const signal = this._uiManager._signal;
+ 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._reportTelemetry({
+ action: "pdfjs.image.image_selected",
+ data: {
+ alt_text_modal: this._uiManager.useNewAltTextFlow
+ }
+ });
+ this.#getBitmapFetched(data);
+ }
+ resolve();
+ }, {
+ signal
+ });
+ input.addEventListener("cancel", () => {
+ this.remove();
+ resolve();
+ }, {
+ signal
+ });
+ }).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;
+ if (this.#resizeTimeoutId) {
+ clearTimeout(this.#resizeTimeoutId);
+ this.#resizeTimeoutId = null;
+ }
+ }
+ super.remove();
+ }
+ rebuild() {
+ if (!this.parent) {
+ if (this.#bitmapId) {
+ this.#getBitmap();
+ }
+ return;
+ }
+ super.rebuild();
+ if (this.div === null) {
+ return;
+ }
+ if (this.#bitmapId && this.#canvas === null) {
+ 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 || this.#bitmapId);
+ }
+ 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;
+ this.div.setAttribute("role", "figure");
+ this.addAltTextButton();
+ if (this.#bitmap) {
+ this.#createCanvas();
+ } else {
+ this.#getBitmap();
+ }
+ if (this.width && !this.annotationElementId) {
+ 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");
+ canvas.setAttribute("role", "img");
+ this.addContainer(canvas);
+ if (!this._uiManager.useNewAltTextWhenAddingImage || !this._uiManager.useNewAltTextFlow || this.annotationElementId) {
+ div.hidden = false;
+ }
+ this.#drawBitmap(width, height);
+ this.#createObserver();
+ if (!this.#hasBeenAddedInUndoStack) {
+ this.parent.addUndoableEditor(this);
+ this.#hasBeenAddedInUndoStack = true;
+ }
+ this._reportTelemetry({
+ action: "inserted_image"
+ });
+ if (this.#bitmapFileName) {
+ canvas.setAttribute("aria-label", this.#bitmapFileName);
+ }
+ }
+ copyCanvas(maxDataDimension, maxPreviewDimension, createImageData = false) {
+ if (!maxDataDimension) {
+ maxDataDimension = 224;
+ }
+ const {
+ width: bitmapWidth,
+ height: bitmapHeight
+ } = this.#bitmap;
+ const outputScale = new OutputScale();
+ let bitmap = this.#bitmap;
+ let width = bitmapWidth,
+ height = bitmapHeight;
+ let canvas = null;
+ if (maxPreviewDimension) {
+ if (bitmapWidth > maxPreviewDimension || bitmapHeight > maxPreviewDimension) {
+ const ratio = Math.min(maxPreviewDimension / bitmapWidth, maxPreviewDimension / bitmapHeight);
+ width = Math.floor(bitmapWidth * ratio);
+ height = Math.floor(bitmapHeight * ratio);
+ }
+ canvas = document.createElement("canvas");
+ const scaledWidth = canvas.width = Math.ceil(width * outputScale.sx);
+ const scaledHeight = canvas.height = Math.ceil(height * outputScale.sy);
+ if (!this.#isSvg) {
+ bitmap = this.#scaleBitmap(scaledWidth, scaledHeight);
+ }
+ const ctx = canvas.getContext("2d");
+ ctx.filter = this._uiManager.hcmFilter;
+ let white = "white",
+ black = "#cfcfd8";
+ if (this._uiManager.hcmFilter !== "none") {
+ black = "black";
+ } else if (window.matchMedia?.("(prefers-color-scheme: dark)").matches) {
+ white = "#8f8f9d";
+ black = "#42414d";
+ }
+ const boxDim = 15;
+ const boxDimWidth = boxDim * outputScale.sx;
+ const boxDimHeight = boxDim * outputScale.sy;
+ const pattern = new OffscreenCanvas(boxDimWidth * 2, boxDimHeight * 2);
+ const patternCtx = pattern.getContext("2d");
+ patternCtx.fillStyle = white;
+ patternCtx.fillRect(0, 0, boxDimWidth * 2, boxDimHeight * 2);
+ patternCtx.fillStyle = black;
+ patternCtx.fillRect(0, 0, boxDimWidth, boxDimHeight);
+ patternCtx.fillRect(boxDimWidth, boxDimHeight, boxDimWidth, boxDimHeight);
+ ctx.fillStyle = ctx.createPattern(pattern, "repeat");
+ ctx.fillRect(0, 0, scaledWidth, scaledHeight);
+ ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, scaledWidth, scaledHeight);
+ }
+ let imageData = null;
+ if (createImageData) {
+ let dataWidth, dataHeight;
+ if (outputScale.symmetric && bitmap.width < maxDataDimension && bitmap.height < maxDataDimension) {
+ dataWidth = bitmap.width;
+ dataHeight = bitmap.height;
+ } else {
+ bitmap = this.#bitmap;
+ if (bitmapWidth > maxDataDimension || bitmapHeight > maxDataDimension) {
+ const ratio = Math.min(maxDataDimension / bitmapWidth, maxDataDimension / bitmapHeight);
+ dataWidth = Math.floor(bitmapWidth * ratio);
+ dataHeight = Math.floor(bitmapHeight * ratio);
+ if (!this.#isSvg) {
+ bitmap = this.#scaleBitmap(dataWidth, dataHeight);
+ }
+ }
+ }
+ const offscreen = new OffscreenCanvas(dataWidth, dataHeight);
+ const offscreenCtx = offscreen.getContext("2d", {
+ willReadFrequently: true
+ });
+ offscreenCtx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, dataWidth, dataHeight);
+ imageData = {
+ width: dataWidth,
+ height: dataHeight,
+ data: offscreenCtx.getImageData(0, 0, dataWidth, dataHeight).data
+ };
+ }
+ return {
+ canvas,
+ width,
+ height,
+ imageData
+ };
+ }
+ #setDimensions(width, height) {
+ const [parentWidth, parentHeight] = this.parentDimensions;
+ this.width = width / parentWidth;
+ this.height = height / parentHeight;
+ 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) {
+ const outputScale = new OutputScale();
+ const scaledWidth = Math.ceil(width * outputScale.sx);
+ const scaledHeight = Math.ceil(height * outputScale.sy);
+ const canvas = this.#canvas;
+ if (!canvas || canvas.width === scaledWidth && canvas.height === scaledHeight) {
+ return;
+ }
+ canvas.width = scaledWidth;
+ canvas.height = scaledHeight;
+ const bitmap = this.#isSvg ? this.#bitmap : this.#scaleBitmap(scaledWidth, scaledHeight);
+ const ctx = canvas.getContext("2d");
+ ctx.filter = this._uiManager.hcmFilter;
+ ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, scaledWidth, scaledHeight);
+ }
+ getImageForAltText() {
+ return this.#canvas;
+ }
+ #serializeBitmap(toUrl) {
+ if (toUrl) {
+ if (this.#isSvg) {
+ const url = this._uiManager.imageManager.getSvgUrl(this.#bitmapId);
+ if (url) {
+ return url;
+ }
+ }
+ 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 * PixelsPerInch.PDF_TO_CSS_UNITS);
+ const height = Math.round(this.height * pageHeight * 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() {
+ if (!this._uiManager._signal) {
+ return;
+ }
+ 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);
+ this._uiManager._signal.addEventListener("abort", () => {
+ this.#observer?.disconnect();
+ this.#observer = null;
+ }, {
+ once: true
+ });
+ }
+ static async deserialize(data, parent, uiManager) {
+ let initialData = null;
+ if (data instanceof StampAnnotationElement) {
+ const {
+ data: {
+ rect,
+ rotation,
+ id,
+ structParent,
+ popupRef
+ },
+ container,
+ parent: {
+ page: {
+ pageNumber
+ }
+ }
+ } = data;
+ const canvas = container.querySelector("canvas");
+ const imageData = uiManager.imageManager.getFromCanvas(container.id, canvas);
+ canvas.remove();
+ const altText = (await parent._structTree.getAriaAttributes(`${AnnotationPrefix}${id}`))?.get("aria-label") || "";
+ initialData = data = {
+ annotationType: AnnotationEditorType.STAMP,
+ bitmapId: imageData.id,
+ bitmap: imageData.bitmap,
+ pageIndex: pageNumber - 1,
+ rect: rect.slice(0),
+ rotation,
+ id,
+ deleted: false,
+ accessibilityData: {
+ decorative: false,
+ altText
+ },
+ isSvg: false,
+ structParent,
+ popupRef
+ };
+ }
+ const editor = await super.deserialize(data, parent, uiManager);
+ const {
+ rect,
+ bitmap,
+ bitmapUrl,
+ bitmapId,
+ isSvg,
+ accessibilityData
+ } = data;
+ if (bitmapId && uiManager.imageManager.isValidId(bitmapId)) {
+ editor.#bitmapId = bitmapId;
+ if (bitmap) {
+ editor.#bitmap = bitmap;
+ }
+ } 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;
+ editor.annotationElementId = data.id || null;
+ if (accessibilityData) {
+ editor.altTextData = accessibilityData;
+ }
+ editor._initialData = initialData;
+ editor.#hasBeenAddedInUndoStack = !!initialData;
+ return editor;
+ }
+ serialize(isForCopying = false, context = null) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ if (this.deleted) {
+ return this.serializeDeleted();
+ }
+ const serialized = {
+ annotationType: 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.serializeAltText(true);
+ return serialized;
+ }
+ const {
+ decorative,
+ altText
+ } = this.serializeAltText(false);
+ if (!decorative && altText) {
+ serialized.accessibilityData = {
+ type: "Figure",
+ alt: altText
+ };
+ }
+ if (this.annotationElementId) {
+ const changes = this.#hasElementChanged(serialized);
+ if (changes.isSame) {
+ return null;
+ }
+ if (changes.isSameAltText) {
+ delete serialized.accessibilityData;
+ } else {
+ serialized.accessibilityData.structParent = this._initialData.structParent ?? -1;
+ }
+ }
+ serialized.id = this.annotationElementId;
+ 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;
+ }
+ #hasElementChanged(serialized) {
+ const {
+ pageIndex,
+ accessibilityData: {
+ altText
+ }
+ } = this._initialData;
+ const isSamePageIndex = serialized.pageIndex === pageIndex;
+ const isSameAltText = (serialized.accessibilityData?.alt || "") === altText;
+ return {
+ isSame: !this._hasBeenMoved && !this._hasBeenResized && isSamePageIndex && isSameAltText,
+ isSameAltText
+ };
+ }
+ renderAnnotationElement(annotation) {
+ annotation.updateEdited({
+ rect: this.getRect(0, 0)
+ });
+ return null;
+ }
+}
+
+;// ./src/display/editor/annotation_editor_layer.js
+
+
+
+
+
+
+
+class AnnotationEditorLayer {
+ #accessibilityManager;
+ #allowClick = false;
+ #annotationLayer = null;
+ #clickAC = null;
+ #editorFocusTimeoutId = null;
+ #editors = new Map();
+ #hadPointerDown = false;
+ #isDisabling = false;
+ #drawingAC = null;
+ #textLayer = null;
+ #textSelectionAC = null;
+ #uiManager;
+ static _initialized = false;
+ static #editorTypes = new Map([FreeTextEditor, InkEditor, StampEditor, HighlightEditor].map(type => [type._editorType, type]));
+ constructor({
+ uiManager,
+ pageIndex,
+ div,
+ structTreeLayer,
+ accessibilityManager,
+ annotationLayer,
+ drawLayer,
+ textLayer,
+ viewport,
+ l10n
+ }) {
+ const editorTypes = [...AnnotationEditorLayer.#editorTypes.values()];
+ if (!AnnotationEditorLayer._initialized) {
+ AnnotationEditorLayer._initialized = true;
+ for (const editorType of editorTypes) {
+ editorType.initialize(l10n, uiManager);
+ }
+ }
+ uiManager.registerEditorTypes(editorTypes);
+ this.#uiManager = uiManager;
+ this.pageIndex = pageIndex;
+ this.div = div;
+ this.#accessibilityManager = accessibilityManager;
+ this.#annotationLayer = annotationLayer;
+ this.viewport = viewport;
+ this.#textLayer = textLayer;
+ this.drawLayer = drawLayer;
+ this._structTree = structTreeLayer;
+ this.#uiManager.addLayer(this);
+ }
+ get isEmpty() {
+ return this.#editors.size === 0;
+ }
+ get isInvisible() {
+ return this.isEmpty && this.#uiManager.getMode() === AnnotationEditorType.NONE;
+ }
+ updateToolbar(mode) {
+ this.#uiManager.updateToolbar(mode);
+ }
+ updateMode(mode = this.#uiManager.getMode()) {
+ this.#cleanup();
+ switch (mode) {
+ case AnnotationEditorType.NONE:
+ this.disableTextSelection();
+ this.togglePointerEvents(false);
+ this.toggleAnnotationLayerPointerEvents(true);
+ this.disableClick();
+ return;
+ case AnnotationEditorType.INK:
+ this.disableTextSelection();
+ this.togglePointerEvents(true);
+ this.enableClick();
+ break;
+ case AnnotationEditorType.HIGHLIGHT:
+ this.enableTextSelection();
+ this.togglePointerEvents(false);
+ this.disableClick();
+ break;
+ default:
+ this.disableTextSelection();
+ this.togglePointerEvents(true);
+ this.enableClick();
+ }
+ this.toggleAnnotationLayerPointerEvents(false);
+ const {
+ classList
+ } = this.div;
+ for (const editorType of AnnotationEditorLayer.#editorTypes.values()) {
+ classList.toggle(`${editorType._type}Editing`, mode === editorType._editorType);
+ }
+ this.div.hidden = false;
+ }
+ hasTextLayer(textLayer) {
+ return textLayer === this.#textLayer?.div;
+ }
+ setEditingState(isEditing) {
+ this.#uiManager.setEditingState(isEditing);
+ }
+ addCommands(params) {
+ this.#uiManager.addCommands(params);
+ }
+ cleanUndoStack(type) {
+ this.#uiManager.cleanUndoStack(type);
+ }
+ toggleDrawing(enabled = false) {
+ this.div.classList.toggle("drawing", !enabled);
+ }
+ togglePointerEvents(enabled = false) {
+ this.div.classList.toggle("disabled", !enabled);
+ }
+ toggleAnnotationLayerPointerEvents(enabled = false) {
+ this.#annotationLayer?.div.classList.toggle("disabled", !enabled);
+ }
+ async enable() {
+ this.div.tabIndex = 0;
+ this.togglePointerEvents(true);
+ const annotationElementIds = new Set();
+ for (const editor of this.#editors.values()) {
+ editor.enableEditing();
+ editor.show(true);
+ if (editor.annotationElementId) {
+ this.#uiManager.removeChangedExistingAnnotation(editor);
+ 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 = await this.deserialize(editable);
+ if (!editor) {
+ continue;
+ }
+ this.addOrRebuild(editor);
+ editor.enableEditing();
+ }
+ }
+ disable() {
+ this.#isDisabling = true;
+ this.div.tabIndex = -1;
+ this.togglePointerEvents(false);
+ const changedAnnotations = new Map();
+ const resetAnnotations = new Map();
+ for (const editor of this.#editors.values()) {
+ editor.disableEditing();
+ if (!editor.annotationElementId) {
+ continue;
+ }
+ if (editor.serialize() !== null) {
+ changedAnnotations.set(editor.annotationElementId, editor);
+ continue;
+ } else {
+ resetAnnotations.set(editor.annotationElementId, editor);
+ }
+ 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 (this.#uiManager.isDeletedAnnotationElement(id)) {
+ continue;
+ }
+ let editor = resetAnnotations.get(id);
+ if (editor) {
+ editor.resetAnnotationElement(editable);
+ editor.show(false);
+ editable.show();
+ continue;
+ }
+ editor = changedAnnotations.get(id);
+ if (editor) {
+ this.#uiManager.addChangedExistingAnnotation(editor);
+ if (editor.renderAnnotationElement(editable)) {
+ editor.show(false);
+ }
+ }
+ editable.show();
+ }
+ }
+ this.#cleanup();
+ if (this.isEmpty) {
+ this.div.hidden = true;
+ }
+ const {
+ classList
+ } = this.div;
+ for (const editorType of AnnotationEditorLayer.#editorTypes.values()) {
+ classList.remove(`${editorType._type}Editing`);
+ }
+ this.disableTextSelection();
+ this.toggleAnnotationLayerPointerEvents(true);
+ this.#isDisabling = false;
+ }
+ getEditableAnnotation(id) {
+ return this.#annotationLayer?.getEditableAnnotation(id) || null;
+ }
+ setActiveEditor(editor) {
+ const currentActive = this.#uiManager.getActive();
+ if (currentActive === editor) {
+ return;
+ }
+ this.#uiManager.setActiveEditor(editor);
+ }
+ enableTextSelection() {
+ this.div.tabIndex = -1;
+ if (this.#textLayer?.div && !this.#textSelectionAC) {
+ this.#textSelectionAC = new AbortController();
+ const signal = this.#uiManager.combinedSignal(this.#textSelectionAC);
+ this.#textLayer.div.addEventListener("pointerdown", this.#textLayerPointerDown.bind(this), {
+ signal
+ });
+ this.#textLayer.div.classList.add("highlighting");
+ }
+ }
+ disableTextSelection() {
+ this.div.tabIndex = 0;
+ if (this.#textLayer?.div && this.#textSelectionAC) {
+ this.#textSelectionAC.abort();
+ this.#textSelectionAC = null;
+ this.#textLayer.div.classList.remove("highlighting");
+ }
+ }
+ #textLayerPointerDown(event) {
+ this.#uiManager.unselectAll();
+ const {
+ target
+ } = event;
+ if (target === this.#textLayer.div || (target.getAttribute("role") === "img" || target.classList.contains("endOfContent")) && this.#textLayer.div.contains(target)) {
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ return;
+ }
+ this.#uiManager.showAllEditors("highlight", true, true);
+ this.#textLayer.div.classList.add("free");
+ this.toggleDrawing();
+ HighlightEditor.startHighlighting(this, this.#uiManager.direction === "ltr", {
+ target: this.#textLayer.div,
+ x: event.x,
+ y: event.y
+ });
+ this.#textLayer.div.addEventListener("pointerup", () => {
+ this.#textLayer.div.classList.remove("free");
+ this.toggleDrawing(true);
+ }, {
+ once: true,
+ signal: this.#uiManager._signal
+ });
+ event.preventDefault();
+ }
+ }
+ enableClick() {
+ if (this.#clickAC) {
+ return;
+ }
+ this.#clickAC = new AbortController();
+ const signal = this.#uiManager.combinedSignal(this.#clickAC);
+ this.div.addEventListener("pointerdown", this.pointerdown.bind(this), {
+ signal
+ });
+ this.div.addEventListener("pointerup", this.pointerup.bind(this), {
+ signal
+ });
+ }
+ disableClick() {
+ this.#clickAC?.abort();
+ this.#clickAC = null;
+ }
+ 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.detach(editor);
+ this.#uiManager.removeEditor(editor);
+ editor.div.remove();
+ editor.isAttachedToDOM = false;
+ }
+ changeParent(editor) {
+ if (editor.parent === this) {
+ return;
+ }
+ if (editor.parent && editor.annotationElementId) {
+ this.#uiManager.addDeletedAnnotationElement(editor.annotationElementId);
+ AnnotationEditor.deleteAnnotationElement(editor);
+ editor.annotationElementId = null;
+ }
+ this.attach(editor);
+ editor.parent?.detach(editor);
+ editor.setParent(this);
+ if (editor.div && editor.isAttachedToDOM) {
+ editor.div.remove();
+ this.div.append(editor.div);
+ }
+ }
+ add(editor) {
+ if (editor.parent === this && editor.isAttachedToDOM) {
+ return;
+ }
+ this.changeParent(editor);
+ this.#uiManager.addEditor(editor);
+ this.attach(editor);
+ if (!editor.isAttachedToDOM) {
+ const div = editor.render();
+ this.div.append(div);
+ editor.isAttachedToDOM = true;
+ }
+ editor.fixAndSetPosition();
+ editor.onceAdded();
+ this.#uiManager.addToAnnotationStorage(editor);
+ editor._reportTelemetry(editor.telemetryInitialData);
+ }
+ moveEditorInDOM(editor) {
+ if (!editor.isAttachedToDOM) {
+ return;
+ }
+ const {
+ activeElement
+ } = document;
+ if (editor.div.contains(activeElement) && !this.#editorFocusTimeoutId) {
+ editor._focusEventsAllowed = false;
+ this.#editorFocusTimeoutId = setTimeout(() => {
+ this.#editorFocusTimeoutId = null;
+ if (!editor.div.contains(document.activeElement)) {
+ editor.div.addEventListener("focusin", () => {
+ editor._focusEventsAllowed = true;
+ }, {
+ once: true,
+ signal: this.#uiManager._signal
+ });
+ activeElement.focus();
+ } else {
+ editor._focusEventsAllowed = true;
+ }
+ }, 0);
+ }
+ editor._structTreeParentId = this.#accessibilityManager?.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
+ }
+ addOrRebuild(editor) {
+ if (editor.needsToBeRebuilt()) {
+ editor.parent ||= this;
+ editor.rebuild();
+ editor.show();
+ } else {
+ this.add(editor);
+ }
+ }
+ addUndoableEditor(editor) {
+ const cmd = () => editor._uiManager.rebuild(editor);
+ const undo = () => {
+ editor.remove();
+ };
+ this.addCommands({
+ cmd,
+ undo,
+ mustExec: false
+ });
+ }
+ getNextId() {
+ return this.#uiManager.getId();
+ }
+ get #currentEditorType() {
+ return AnnotationEditorLayer.#editorTypes.get(this.#uiManager.getMode());
+ }
+ combinedSignal(ac) {
+ return this.#uiManager.combinedSignal(ac);
+ }
+ #createNewEditor(params) {
+ const editorType = this.#currentEditorType;
+ return editorType ? new editorType.prototype.constructor(params) : null;
+ }
+ canCreateNewEmptyEditor() {
+ return this.#currentEditorType?.canCreateNewEmptyEditor();
+ }
+ 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);
+ }
+ }
+ async deserialize(data) {
+ return (await AnnotationEditorLayer.#editorTypes.get(data.annotationType ?? data.annotationEditorType)?.deserialize(data, this, this.#uiManager)) || null;
+ }
+ createAndAddNewEditor(event, isCentered, data = {}) {
+ const id = this.getNextId();
+ const editor = this.#createNewEditor({
+ parent: this,
+ id,
+ x: event.offsetX,
+ y: event.offsetY,
+ uiManager: this.#uiManager,
+ isCentered,
+ ...data
+ });
+ 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);
+ }
+ toggleSelected(editor) {
+ this.#uiManager.toggleSelected(editor);
+ }
+ unselect(editor) {
+ this.#uiManager.unselect(editor);
+ }
+ pointerup(event) {
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ return;
+ }
+ if (event.target !== this.div) {
+ return;
+ }
+ if (!this.#hadPointerDown) {
+ return;
+ }
+ this.#hadPointerDown = false;
+ if (this.#currentEditorType?.isDrawer && this.#currentEditorType.supportMultipleDrawings) {
+ return;
+ }
+ if (!this.#allowClick) {
+ this.#allowClick = true;
+ return;
+ }
+ if (this.#uiManager.getMode() === AnnotationEditorType.STAMP) {
+ this.#uiManager.unselectAll();
+ return;
+ }
+ this.createAndAddNewEditor(event, false);
+ }
+ pointerdown(event) {
+ if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
+ this.enableTextSelection();
+ }
+ if (this.#hadPointerDown) {
+ this.#hadPointerDown = false;
+ return;
+ }
+ const {
+ isMac
+ } = util_FeatureTest.platform;
+ if (event.button !== 0 || event.ctrlKey && isMac) {
+ return;
+ }
+ if (event.target !== this.div) {
+ return;
+ }
+ this.#hadPointerDown = true;
+ if (this.#currentEditorType?.isDrawer) {
+ this.startDrawingSession(event);
+ return;
+ }
+ const editor = this.#uiManager.getActive();
+ this.#allowClick = !editor || editor.isEmpty();
+ }
+ startDrawingSession(event) {
+ this.div.focus();
+ if (this.#drawingAC) {
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
+ return;
+ }
+ this.#uiManager.setCurrentDrawingSession(this);
+ this.#drawingAC = new AbortController();
+ const signal = this.#uiManager.combinedSignal(this.#drawingAC);
+ this.div.addEventListener("blur", ({
+ relatedTarget
+ }) => {
+ if (relatedTarget && !this.div.contains(relatedTarget)) {
+ this.commitOrRemove();
+ }
+ }, {
+ signal
+ });
+ this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
+ }
+ endDrawingSession(isAborted = false) {
+ if (!this.#drawingAC) {
+ return null;
+ }
+ this.#uiManager.setCurrentDrawingSession(null);
+ this.#drawingAC.abort();
+ this.#drawingAC = null;
+ return this.#currentEditorType.endDrawing(isAborted);
+ }
+ findNewParent(editor, x, y) {
+ const layer = this.#uiManager.findParent(x, y);
+ if (layer === null || layer === this) {
+ return false;
+ }
+ layer.changeParent(editor);
+ return true;
+ }
+ commitOrRemove() {
+ if (this.#drawingAC) {
+ this.endDrawingSession();
+ return true;
+ }
+ return false;
+ }
+ onScaleChanging() {
+ if (!this.#drawingAC) {
+ return;
+ }
+ this.#currentEditorType.onScaleChangingWhenDrawing(this);
+ }
+ destroy() {
+ this.commitOrRemove();
+ if (this.#uiManager.getActive()?.parent === this) {
+ this.#uiManager.commitOrRemove();
+ this.#uiManager.setActiveEditor(null);
+ }
+ if (this.#editorFocusTimeoutId) {
+ clearTimeout(this.#editorFocusTimeoutId);
+ this.#editorFocusTimeoutId = null;
+ }
+ for (const editor of this.#editors.values()) {
+ this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
+ editor.setParent(null);
+ editor.isAttachedToDOM = false;
+ editor.div.remove();
+ }
+ this.div = null;
+ this.#editors.clear();
+ this.#uiManager.removeLayer(this);
+ }
+ #cleanup() {
+ for (const editor of this.#editors.values()) {
+ if (editor.isEmpty()) {
+ editor.remove();
+ }
+ }
+ }
+ render({
+ viewport
+ }) {
+ this.viewport = viewport;
+ setLayerDimensions(this.div, viewport);
+ for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
+ this.add(editor);
+ editor.rebuild();
+ }
+ this.updateMode();
+ }
+ update({
+ viewport
+ }) {
+ this.#uiManager.commitOrRemove();
+ this.#cleanup();
+ const oldRotation = this.viewport.rotation;
+ const rotation = viewport.rotation;
+ this.viewport = viewport;
+ setLayerDimensions(this.div, {
+ rotation
+ });
+ if (oldRotation !== rotation) {
+ for (const editor of this.#editors.values()) {
+ editor.rotate(rotation);
+ }
+ }
+ }
+ get pageDimensions() {
+ const {
+ pageWidth,
+ pageHeight
+ } = this.viewport.rawDims;
+ return [pageWidth, pageHeight];
+ }
+ get scale() {
+ return this.#uiManager.viewParameters.realScale;
+ }
+}
+
+;// ./src/display/draw_layer.js
+
+
+class DrawLayer {
+ #parent = null;
+ #id = 0;
+ #mapping = new Map();
+ #toUpdate = new Map();
+ constructor({
+ pageIndex
+ }) {
+ this.pageIndex = pageIndex;
+ }
+ setParent(parent) {
+ if (!this.#parent) {
+ this.#parent = parent;
+ return;
+ }
+ if (this.#parent !== parent) {
+ if (this.#mapping.size > 0) {
+ for (const root of this.#mapping.values()) {
+ root.remove();
+ parent.append(root);
+ }
+ }
+ this.#parent = parent;
+ }
+ }
+ static get _svgFactory() {
+ return shadow(this, "_svgFactory", new DOMSVGFactory());
+ }
+ static #setBox(element, [x, y, width, height]) {
+ const {
+ style
+ } = element;
+ style.top = `${100 * y}%`;
+ style.left = `${100 * x}%`;
+ style.width = `${100 * width}%`;
+ style.height = `${100 * height}%`;
+ }
+ #createSVG() {
+ const svg = DrawLayer._svgFactory.create(1, 1, true);
+ this.#parent.append(svg);
+ svg.setAttribute("aria-hidden", true);
+ return svg;
+ }
+ #createClipPath(defs, pathId) {
+ const clipPath = DrawLayer._svgFactory.createElement("clipPath");
+ defs.append(clipPath);
+ const clipPathId = `clip_${pathId}`;
+ clipPath.setAttribute("id", clipPathId);
+ clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
+ const clipPathUse = DrawLayer._svgFactory.createElement("use");
+ clipPath.append(clipPathUse);
+ clipPathUse.setAttribute("href", `#${pathId}`);
+ clipPathUse.classList.add("clip");
+ return clipPathId;
+ }
+ #updateProperties(element, properties) {
+ for (const [key, value] of Object.entries(properties)) {
+ if (value === null) {
+ element.removeAttribute(key);
+ } else {
+ element.setAttribute(key, value);
+ }
+ }
+ }
+ draw(properties, isPathUpdatable = false, hasClip = false) {
+ const id = this.#id++;
+ const root = this.#createSVG();
+ const defs = DrawLayer._svgFactory.createElement("defs");
+ root.append(defs);
+ const path = DrawLayer._svgFactory.createElement("path");
+ defs.append(path);
+ const pathId = `path_p${this.pageIndex}_${id}`;
+ path.setAttribute("id", pathId);
+ path.setAttribute("vector-effect", "non-scaling-stroke");
+ if (isPathUpdatable) {
+ this.#toUpdate.set(id, path);
+ }
+ const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
+ const use = DrawLayer._svgFactory.createElement("use");
+ root.append(use);
+ use.setAttribute("href", `#${pathId}`);
+ this.updateProperties(root, properties);
+ this.#mapping.set(id, root);
+ return {
+ id,
+ clipPathId: `url(#${clipPathId})`
+ };
+ }
+ drawOutline(properties, mustRemoveSelfIntersections) {
+ const id = this.#id++;
+ const root = this.#createSVG();
+ const defs = DrawLayer._svgFactory.createElement("defs");
+ root.append(defs);
+ const path = DrawLayer._svgFactory.createElement("path");
+ defs.append(path);
+ const pathId = `path_p${this.pageIndex}_${id}`;
+ path.setAttribute("id", pathId);
+ path.setAttribute("vector-effect", "non-scaling-stroke");
+ let maskId;
+ if (mustRemoveSelfIntersections) {
+ const mask = DrawLayer._svgFactory.createElement("mask");
+ defs.append(mask);
+ maskId = `mask_p${this.pageIndex}_${id}`;
+ mask.setAttribute("id", maskId);
+ mask.setAttribute("maskUnits", "objectBoundingBox");
+ const rect = DrawLayer._svgFactory.createElement("rect");
+ mask.append(rect);
+ rect.setAttribute("width", "1");
+ rect.setAttribute("height", "1");
+ rect.setAttribute("fill", "white");
+ const use = DrawLayer._svgFactory.createElement("use");
+ mask.append(use);
+ use.setAttribute("href", `#${pathId}`);
+ use.setAttribute("stroke", "none");
+ use.setAttribute("fill", "black");
+ use.setAttribute("fill-rule", "nonzero");
+ use.classList.add("mask");
+ }
+ const use1 = DrawLayer._svgFactory.createElement("use");
+ root.append(use1);
+ use1.setAttribute("href", `#${pathId}`);
+ if (maskId) {
+ use1.setAttribute("mask", `url(#${maskId})`);
+ }
+ const use2 = use1.cloneNode();
+ root.append(use2);
+ use1.classList.add("mainOutline");
+ use2.classList.add("secondaryOutline");
+ this.updateProperties(root, properties);
+ this.#mapping.set(id, root);
+ return id;
+ }
+ finalizeDraw(id, properties) {
+ this.#toUpdate.delete(id);
+ this.updateProperties(id, properties);
+ }
+ updateProperties(elementOrId, properties) {
+ if (!properties) {
+ return;
+ }
+ const {
+ root,
+ bbox,
+ rootClass,
+ path
+ } = properties;
+ const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
+ if (!element) {
+ return;
+ }
+ if (root) {
+ this.#updateProperties(element, root);
+ }
+ if (bbox) {
+ DrawLayer.#setBox(element, bbox);
+ }
+ if (rootClass) {
+ const {
+ classList
+ } = element;
+ for (const [className, value] of Object.entries(rootClass)) {
+ classList.toggle(className, value);
+ }
+ }
+ if (path) {
+ const defs = element.firstChild;
+ const pathElement = defs.firstChild;
+ this.#updateProperties(pathElement, path);
+ }
+ }
+ updateParent(id, layer) {
+ if (layer === this) {
+ return;
+ }
+ const root = this.#mapping.get(id);
+ if (!root) {
+ return;
+ }
+ layer.#parent.append(root);
+ this.#mapping.delete(id);
+ layer.#mapping.set(id, root);
+ }
+ remove(id) {
+ this.#toUpdate.delete(id);
+ if (this.#parent === null) {
+ return;
+ }
+ this.#mapping.get(id).remove();
+ this.#mapping.delete(id);
+ }
+ destroy() {
+ this.#parent = null;
+ for (const root of this.#mapping.values()) {
+ root.remove();
+ }
+ this.#mapping.clear();
+ this.#toUpdate.clear();
+ }
+}
+
+;// ./src/pdf.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+const pdfjsVersion = "4.9.155";
+const pdfjsBuild = "a4eb8407c";
+{
+ globalThis.pdfjsTestingUtils = {
+ HighlightOutliner: HighlightOutliner
+ };
+}
+
+var __webpack_exports__AbortException = __webpack_exports__.AbortException;
+var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;
+var __webpack_exports__AnnotationEditorParamsType = __webpack_exports__.AnnotationEditorParamsType;
+var __webpack_exports__AnnotationEditorType = __webpack_exports__.AnnotationEditorType;
+var __webpack_exports__AnnotationEditorUIManager = __webpack_exports__.AnnotationEditorUIManager;
+var __webpack_exports__AnnotationLayer = __webpack_exports__.AnnotationLayer;
+var __webpack_exports__AnnotationMode = __webpack_exports__.AnnotationMode;
+var __webpack_exports__ColorPicker = __webpack_exports__.ColorPicker;
+var __webpack_exports__DOMSVGFactory = __webpack_exports__.DOMSVGFactory;
+var __webpack_exports__DrawLayer = __webpack_exports__.DrawLayer;
+var __webpack_exports__FeatureTest = __webpack_exports__.FeatureTest;
+var __webpack_exports__GlobalWorkerOptions = __webpack_exports__.GlobalWorkerOptions;
+var __webpack_exports__ImageKind = __webpack_exports__.ImageKind;
+var __webpack_exports__InvalidPDFException = __webpack_exports__.InvalidPDFException;
+var __webpack_exports__MissingPDFException = __webpack_exports__.MissingPDFException;
+var __webpack_exports__OPS = __webpack_exports__.OPS;
+var __webpack_exports__OutputScale = __webpack_exports__.OutputScale;
+var __webpack_exports__PDFDataRangeTransport = __webpack_exports__.PDFDataRangeTransport;
+var __webpack_exports__PDFDateString = __webpack_exports__.PDFDateString;
+var __webpack_exports__PDFWorker = __webpack_exports__.PDFWorker;
+var __webpack_exports__PasswordResponses = __webpack_exports__.PasswordResponses;
+var __webpack_exports__PermissionFlag = __webpack_exports__.PermissionFlag;
+var __webpack_exports__PixelsPerInch = __webpack_exports__.PixelsPerInch;
+var __webpack_exports__RenderingCancelledException = __webpack_exports__.RenderingCancelledException;
+var __webpack_exports__TextLayer = __webpack_exports__.TextLayer;
+var __webpack_exports__UnexpectedResponseException = __webpack_exports__.UnexpectedResponseException;
+var __webpack_exports__Util = __webpack_exports__.Util;
+var __webpack_exports__VerbosityLevel = __webpack_exports__.VerbosityLevel;
+var __webpack_exports__XfaLayer = __webpack_exports__.XfaLayer;
+var __webpack_exports__build = __webpack_exports__.build;
+var __webpack_exports__createValidAbsoluteUrl = __webpack_exports__.createValidAbsoluteUrl;
+var __webpack_exports__fetchData = __webpack_exports__.fetchData;
+var __webpack_exports__getDocument = __webpack_exports__.getDocument;
+var __webpack_exports__getFilenameFromUrl = __webpack_exports__.getFilenameFromUrl;
+var __webpack_exports__getPdfFilenameFromUrl = __webpack_exports__.getPdfFilenameFromUrl;
+var __webpack_exports__getXfaPageViewport = __webpack_exports__.getXfaPageViewport;
+var __webpack_exports__isDataScheme = __webpack_exports__.isDataScheme;
+var __webpack_exports__isPdfFile = __webpack_exports__.isPdfFile;
+var __webpack_exports__noContextMenu = __webpack_exports__.noContextMenu;
+var __webpack_exports__normalizeUnicode = __webpack_exports__.normalizeUnicode;
+var __webpack_exports__setLayerDimensions = __webpack_exports__.setLayerDimensions;
+var __webpack_exports__shadow = __webpack_exports__.shadow;
+var __webpack_exports__stopEvent = __webpack_exports__.stopEvent;
+var __webpack_exports__version = __webpack_exports__.version;
+export { __webpack_exports__AbortException as AbortException, __webpack_exports__AnnotationEditorLayer as AnnotationEditorLayer, __webpack_exports__AnnotationEditorParamsType as AnnotationEditorParamsType, __webpack_exports__AnnotationEditorType as AnnotationEditorType, __webpack_exports__AnnotationEditorUIManager as AnnotationEditorUIManager, __webpack_exports__AnnotationLayer as AnnotationLayer, __webpack_exports__AnnotationMode as AnnotationMode, __webpack_exports__ColorPicker as ColorPicker, __webpack_exports__DOMSVGFactory as DOMSVGFactory, __webpack_exports__DrawLayer as DrawLayer, __webpack_exports__FeatureTest as FeatureTest, __webpack_exports__GlobalWorkerOptions as GlobalWorkerOptions, __webpack_exports__ImageKind as ImageKind, __webpack_exports__InvalidPDFException as InvalidPDFException, __webpack_exports__MissingPDFException as MissingPDFException, __webpack_exports__OPS as OPS, __webpack_exports__OutputScale as OutputScale, __webpack_exports__PDFDataRangeTransport as PDFDataRangeTransport, __webpack_exports__PDFDateString as PDFDateString, __webpack_exports__PDFWorker as PDFWorker, __webpack_exports__PasswordResponses as PasswordResponses, __webpack_exports__PermissionFlag as PermissionFlag, __webpack_exports__PixelsPerInch as PixelsPerInch, __webpack_exports__RenderingCancelledException as RenderingCancelledException, __webpack_exports__TextLayer as TextLayer, __webpack_exports__UnexpectedResponseException as UnexpectedResponseException, __webpack_exports__Util as Util, __webpack_exports__VerbosityLevel as VerbosityLevel, __webpack_exports__XfaLayer as XfaLayer, __webpack_exports__build as build, __webpack_exports__createValidAbsoluteUrl as createValidAbsoluteUrl, __webpack_exports__fetchData as fetchData, __webpack_exports__getDocument as getDocument, __webpack_exports__getFilenameFromUrl as getFilenameFromUrl, __webpack_exports__getPdfFilenameFromUrl as getPdfFilenameFromUrl, __webpack_exports__getXfaPageViewport as getXfaPageViewport, __webpack_exports__isDataScheme as isDataScheme, __webpack_exports__isPdfFile as isPdfFile, __webpack_exports__noContextMenu as noContextMenu, __webpack_exports__normalizeUnicode as normalizeUnicode, __webpack_exports__setLayerDimensions as setLayerDimensions, __webpack_exports__shadow as shadow, __webpack_exports__stopEvent as stopEvent, __webpack_exports__version as version };
+
+//# sourceMappingURL=pdf.mjs.map
\ No newline at end of file
diff --git a/pdfjs/build/pdf.mjs.map b/pdfjs/build/pdf.mjs.map
new file mode 100644
index 0000000..56ee54c
--- /dev/null
+++ b/pdfjs/build/pdf.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"pdf.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;SAAA;SACA;;;;;UCDA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoBA,MAAMA,QAAQ,GAEZ,OAAOC,OAAO,KAAK,QAAQ,IAC3BA,OAAO,GAAG,EAAE,KAAK,kBAAkB,IACnC,CAACA,OAAO,CAACC,QAAQ,CAACC,EAAE,IACpB,EAAEF,OAAO,CAACC,QAAQ,CAACE,QAAQ,IAAIH,OAAO,CAACI,IAAI,IAAIJ,OAAO,CAACI,IAAI,KAAK,SAAS,CAAC;AAE5E,MAAMC,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CA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MAAM,KAAK,IAAI,EAAE;MACzB;IACF;IACA,IAAI,CAAC,CAACo+F,OAAO,CAACxtG,GAAG,CAAC6P,EAAE,CAAC,CAAClG,MAAM,CAAC,CAAC;IAC9B,IAAI,CAAC,CAAC6jG,OAAO,CAACv/F,MAAM,CAAC4B,EAAE,CAAC;EAC1B;EAEArB,OAAOA,CAAA,EAAG;IACR,IAAI,CAAC,CAACY,MAAM,GAAG,IAAI;IACnB,KAAK,MAAMqpE,IAAI,IAAI,IAAI,CAAC,CAAC+0B,OAAO,CAAChyF,MAAM,CAAC,CAAC,EAAE;MACzCi9D,IAAI,CAAC9uE,MAAM,CAAC,CAAC;IACf;IACA,IAAI,CAAC,CAAC6jG,OAAO,CAAC/xF,KAAK,CAAC,CAAC;IACrB,IAAI,CAAC,CAACgyF,QAAQ,CAAChyF,KAAK,CAAC,CAAC;EACxB;AACF;;;AC5M0B;AAOA;AAeU;AACgD;AACd;AACN;AACD;AACN;AACL;AACc;AACQ;AACtB;AACF;AAGlD,MAAMqzF,YAAY,GACkB,SAAwC;AAE5E,MAAMC,UAAU,GACoB,WAAsC;AAEE;EAC1E91G,UAAU,CAAC+1G,iBAAiB,GAAG;IAC7BnY,iBAAiBA,EAAAA,iBAAAA;EACnB,CAAC;AACH","sources":["webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/./src/shared/util.js","webpack://pdf.js/./src/display/display_utils.js","webpack://pdf.js/./src/display/editor/toolbar.js","webpack://pdf.js/./src/display/editor/tools.js","webpack://pdf.js/./src/display/editor/alt_text.js","webpack://pdf.js/./src/display/editor/editor.js","webpack://pdf.js/./src/shared/murmurhash3.js","webpack://pdf.js/./src/display/annotation_storage.js","webpack://pdf.js/./src/display/font_loader.js","webpack://pdf.js/./src/display/canvas_factory.js","webpack://pdf.js/./src/display/cmap_reader_factory.js","webpack://pdf.js/./src/display/filter_factory.js","webpack://pdf.js/./src/display/standard_fontdata_factory.js","webpack://pdf.js/./src/display/node_utils.js","webpack://pdf.js/./src/display/pattern_helper.js","webpack://pdf.js/./src/shared/image_utils.js","webpack://pdf.js/./src/display/canvas.js","webpack://pdf.js/./src/display/worker_options.js","webpack://pdf.js/./src/shared/message_handler.js","webpack://pdf.js/./src/display/metadata.js","webpack://pdf.js/./src/display/optional_content_config.js","webpack://pdf.js/./src/display/transport_stream.js","webpack://pdf.js/./src/display/content_disposition.js","webpack://pdf.js/./src/display/network_utils.js","webpack://pdf.js/./src/display/fetch_stream.js","webpack://pdf.js/./src/display/network.js","webpack://pdf.js/./src/display/node_stream.js","webpack://pdf.js/./src/display/text_layer.js","webpack://pdf.js/./src/display/xfa_text.js","webpack://pdf.js/./src/display/api.js","webpack://pdf.js/./src/shared/scripting_utils.js","webpack://pdf.js/./src/display/svg_factory.js","webpack://pdf.js/./src/display/xfa_layer.js","webpack://pdf.js/./src/display/annotation_layer.js","webpack://pdf.js/./src/display/editor/freetext.js","webpack://pdf.js/./src/display/editor/drawers/outline.js","webpack://pdf.js/./src/display/editor/drawers/freedraw.js","webpack://pdf.js/./src/display/editor/drawers/highlight.js","webpack://pdf.js/./src/display/editor/color_picker.js","webpack://pdf.js/./src/display/editor/highlight.js","webpack://pdf.js/./src/display/editor/draw.js","webpack://pdf.js/./src/display/editor/drawers/inkdraw.js","webpack://pdf.js/./src/display/editor/ink.js","webpack://pdf.js/./src/display/editor/stamp.js","webpack://pdf.js/./src/display/editor/annotation_editor_layer.js","webpack://pdf.js/./src/display/draw_layer.js","webpack://pdf.js/./src/pdf.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/* 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/* globals process */\n\n// NW.js / Electron is a browser context, but copies some Node.js objects; see\n// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context\n// https://www.electronjs.org/docs/api/process#processversionselectron-readonly\n// https://www.electronjs.org/docs/api/process#processtype-readonly\nconst isNodeJS =\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n typeof process === \"object\" &&\n process + \"\" === \"[object process]\" &&\n !process.versions.nw &&\n !(process.versions.electron && process.type && process.type !== \"browser\");\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\nconst MAX_IMAGE_SIZE_TO_CACHE = 10e6; // Ten megabytes.\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 * - SAVE is used, on the worker-thread, when saving modified annotations.\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 * - IS_EDITING is used when editing is active in the viewer.\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 IS_EDITING: 0x80,\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 HIGHLIGHT: 9,\n STAMP: 13,\n INK: 15,\n};\n\nconst AnnotationEditorParamsType = {\n RESIZE: 1,\n CREATE: 2,\n FREETEXT_SIZE: 11,\n FREETEXT_COLOR: 12,\n FREETEXT_OPACITY: 13,\n INK_COLOR: 21,\n INK_THICKNESS: 22,\n INK_OPACITY: 23,\n HIGHLIGHT_COLOR: 31,\n HIGHLIGHT_DEFAULT_COLOR: 32,\n HIGHLIGHT_THICKNESS: 33,\n HIGHLIGHT_FREE: 34,\n HIGHLIGHT_SHOW_ALL: 35,\n DRAW_STEP: 41,\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 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\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 setStrokeTransparent: 92,\n setFillTransparent: 93,\n};\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 // eslint-disable-next-line no-console\n console.log(`Info: ${msg}`);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n // eslint-disable-next-line no-console\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 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?.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 {}\n }\n }\n\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch {\n /* `new URL()` will throw on incorrect data. */\n }\n return null;\n}\n\nfunction shadow(obj, prop, value, nonSerializable = false) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\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 (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseException\n ) {\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 (typeof bytes !== \"object\" || bytes?.length === undefined) {\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\nfunction string32(value) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\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 {\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 isImageDecoderSupported() {\n return shadow(\n this,\n \"isImageDecoderSupported\",\n typeof ImageDecoder !== \"undefined\"\n );\n }\n\n static get platform() {\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (typeof navigator !== \"undefined\" &&\n typeof navigator?.platform === \"string\")\n ) {\n return shadow(this, \"platform\", {\n isMac: navigator.platform.includes(\"Mac\"),\n isWindows: navigator.platform.includes(\"Win\"),\n isFirefox:\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (typeof navigator?.userAgent === \"string\" &&\n navigator.userAgent.includes(\"Firefox\")),\n });\n }\n return shadow(this, \"platform\", {\n isMac: false,\n isWindows: false,\n isFirefox: false,\n });\n }\n\n static get isCSSRoundSupported() {\n return shadow(\n this,\n \"isCSSRoundSupported\",\n globalThis.CSS?.supports?.(\"width: round(1.5px, 1px)\")\n );\n }\n}\n\nconst hexNumbers = Array.from(Array(256).keys(), 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 // swapped.\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[2];\n minMax[2] = temp;\n }\n minMax[0] *= transform[0];\n minMax[2] *= transform[0];\n\n if (transform[3] < 0) {\n temp = minMax[1];\n minMax[1] = minMax[3];\n minMax[3] = temp;\n }\n minMax[1] *= transform[3];\n minMax[3] *= transform[3];\n } else {\n temp = minMax[0];\n minMax[0] = minMax[1];\n minMax[1] = temp;\n temp = minMax[2];\n minMax[2] = minMax[3];\n minMax[3] = temp;\n\n if (transform[1] < 0) {\n temp = minMax[1];\n minMax[1] = minMax[3];\n minMax[3] = temp;\n }\n minMax[1] *= transform[1];\n minMax[3] *= transform[1];\n\n if (transform[2] < 0) {\n temp = minMax[0];\n minMax[0] = minMax[2];\n minMax[2] = temp;\n }\n minMax[0] *= transform[2];\n minMax[2] *= transform[2];\n }\n minMax[0] += transform[4];\n minMax[1] += transform[5];\n minMax[2] += transform[4];\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 = this.applyTransform(r, m);\n const p2 = this.applyTransform(r.slice(2, 4), m);\n const p3 = this.applyTransform([r[0], r[3]], m);\n const p4 = this.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 static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {\n if (t <= 0 || t >= 1) {\n return;\n }\n const mt = 1 - t;\n const tt = t * t;\n const ttt = tt * t;\n const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;\n const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;\n minMax[0] = Math.min(minMax[0], x);\n minMax[1] = Math.min(minMax[1], y);\n minMax[2] = Math.max(minMax[2], x);\n minMax[3] = Math.max(minMax[3], y);\n }\n\n static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {\n if (Math.abs(a) < 1e-12) {\n if (Math.abs(b) >= 1e-12) {\n this.#getExtremumOnCurve(\n x0,\n x1,\n x2,\n x3,\n y0,\n y1,\n y2,\n y3,\n -c / b,\n minMax\n );\n }\n return;\n }\n\n const delta = b ** 2 - 4 * c * a;\n if (delta < 0) {\n return;\n }\n const sqrtDelta = Math.sqrt(delta);\n const a2 = 2 * a;\n this.#getExtremumOnCurve(\n x0,\n x1,\n x2,\n x3,\n y0,\n y1,\n y2,\n y3,\n (-b + sqrtDelta) / a2,\n minMax\n );\n this.#getExtremumOnCurve(\n x0,\n x1,\n x2,\n x3,\n y0,\n y1,\n y2,\n y3,\n (-b - sqrtDelta) / a2,\n minMax\n );\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, minMax) {\n if (minMax) {\n minMax[0] = Math.min(minMax[0], x0, x3);\n minMax[1] = Math.min(minMax[1], y0, y3);\n minMax[2] = Math.max(minMax[2], x0, x3);\n minMax[3] = Math.max(minMax[3], y0, y3);\n } else {\n minMax = [\n Math.min(x0, x3),\n Math.min(y0, y3),\n Math.max(x0, x3),\n Math.max(y0, y3),\n ];\n }\n this.#getExtremum(\n x0,\n x1,\n x2,\n x3,\n y0,\n y1,\n y2,\n y3,\n 3 * (-x0 + 3 * (x1 - x2) + x3),\n 6 * (x0 - 2 * x1 + x2),\n 3 * (x1 - x0),\n minMax\n );\n this.#getExtremum(\n x0,\n x1,\n x2,\n x3,\n y0,\n y1,\n y2,\n y3,\n 3 * (-y0 + 3 * (y1 - y2) + y3),\n 6 * (y0 - 2 * y1 + y2),\n 3 * (y1 - y0),\n minMax\n );\n return minMax;\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 // See section 7.9.2.2 Text String Type.\n // The string can contain some language codes bracketed with 0x0b,\n // so we must remove them.\n if (str[0] >= \"\\xEF\") {\n let encoding;\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n encoding = \"utf-16be\";\n if (str.length % 2 === 1) {\n str = str.slice(0, -1);\n }\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n encoding = \"utf-16le\";\n if (str.length % 2 === 1) {\n str = str.slice(0, -1);\n }\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 const decoded = decoder.decode(buffer);\n if (!decoded.includes(\"\\x1b\")) {\n return decoded;\n }\n return decoded.replaceAll(/\\x1b[^\\x1b]*(?:\\x1b|$)/g, \"\");\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 charCode = str.charCodeAt(i);\n if (charCode === 0x1b) {\n // eslint-disable-next-line no-empty\n while (++i < ii && str.charCodeAt(i) !== 0x1b) {}\n continue;\n }\n const code = PDFStringTranslateTable[charCode];\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 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\nlet NormalizeRegex = null;\nlet NormalizationMap = null;\nfunction normalizeUnicode(str) {\n if (!NormalizeRegex) {\n // In order to generate the following regex:\n // - create a PDF containing all the chars in the range 0000-FFFF with\n // a NFKC which is different of the char.\n // - copy and paste all those chars and get the ones where NFKC is\n // required.\n // It appears that most the chars here contain some ligatures.\n NormalizeRegex =\n /([\\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;\n NormalizationMap = new Map([[\"ſt\", \"ſt\"]]);\n }\n return str.replaceAll(NormalizeRegex, (_, p1, p2) =>\n p1 ? p1.normalize(\"NFKC\") : NormalizationMap.get(p2)\n );\n}\n\nfunction getUuid() {\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n const buf = new Uint8Array(32);\n crypto.getRandomValues(buf);\n return bytesToString(buf);\n}\n\nconst AnnotationPrefix = \"pdfjs_internal_id_\";\n\nconst FontRenderOps = {\n BEZIER_CURVE_TO: 0,\n MOVE_TO: 1,\n LINE_TO: 2,\n QUADRATIC_CURVE_TO: 3,\n RESTORE: 4,\n SAVE: 5,\n SCALE: 6,\n TRANSFORM: 7,\n TRANSLATE: 8,\n};\n\n// TODO: Remove this once `Uint8Array.prototype.toHex` is generally available.\nfunction toHexUtil(arr) {\n if (Uint8Array.prototype.toHex) {\n return arr.toHex();\n }\n return Array.from(arr, num => hexNumbers[num]).join(\"\");\n}\n\n// TODO: Remove this once `Uint8Array.prototype.toBase64` is generally\n// available.\nfunction toBase64Util(arr) {\n if (Uint8Array.prototype.toBase64) {\n return arr.toBase64();\n }\n return btoa(bytesToString(arr));\n}\n\n// TODO: Remove this once `Uint8Array.fromBase64` is generally available.\nfunction fromBase64Util(str) {\n if (Uint8Array.fromBase64) {\n return Uint8Array.fromBase64(str);\n }\n return stringToBytes(atob(str));\n}\n\n// TODO: Remove this once https://bugzilla.mozilla.org/show_bug.cgi?id=1928493\n// is fixed.\nif (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"SKIP_BABEL\")) &&\n typeof Promise.try !== \"function\"\n) {\n Promise.try = function (fn, ...args) {\n return new Promise(resolve => {\n resolve(fn(...args));\n });\n };\n}\n\nexport {\n AbortException,\n AnnotationActionEventType,\n AnnotationBorderStyleType,\n AnnotationEditorParamsType,\n AnnotationEditorPrefix,\n AnnotationEditorType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMode,\n AnnotationPrefix,\n AnnotationReplyType,\n AnnotationType,\n assert,\n BaseException,\n BASELINE_FACTOR,\n bytesToString,\n createValidAbsoluteUrl,\n DocumentActionEventType,\n FeatureTest,\n FONT_IDENTITY_MATRIX,\n FontRenderOps,\n FormatError,\n fromBase64Util,\n getModificationDate,\n getUuid,\n getVerbosityLevel,\n hexNumbers,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n InvalidPDFException,\n isArrayEqual,\n isNodeJS,\n LINE_DESCENT_FACTOR,\n LINE_FACTOR,\n MAX_IMAGE_SIZE_TO_CACHE,\n MissingPDFException,\n normalizeUnicode,\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 toBase64Util,\n toHexUtil,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n utf8StringToString,\n Util,\n VerbosityLevel,\n warn,\n};\n","/* Copyright 2015 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\nimport {\n BaseException,\n FeatureTest,\n shadow,\n Util,\n warn,\n} from \"../shared/util.js\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nclass PixelsPerInch {\n static CSS = 96.0;\n\n static PDF = 72.0;\n\n static PDF_TO_CSS_UNITS = this.CSS / this.PDF;\n}\n\nasync function fetchData(url, type = \"text\") {\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n isValidFetchUrl(url, document.baseURI)\n ) {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n switch (type) {\n case \"arraybuffer\":\n return response.arrayBuffer();\n case \"blob\":\n return response.blob();\n case \"json\":\n return response.json();\n }\n return response.text();\n }\n\n // The Fetch API is not supported.\n return new Promise((resolve, reject) => {\n const request = new XMLHttpRequest();\n request.open(\"GET\", url, /* async = */ true);\n request.responseType = type;\n\n request.onreadystatechange = () => {\n if (request.readyState !== XMLHttpRequest.DONE) {\n return;\n }\n if (request.status === 200 || request.status === 0) {\n switch (type) {\n case \"arraybuffer\":\n case \"blob\":\n case \"json\":\n resolve(request.response);\n return;\n }\n resolve(request.responseText);\n return;\n }\n reject(new Error(request.statusText));\n };\n\n request.send(null);\n });\n}\n\n/**\n * @typedef {Object} PageViewportParameters\n * @property {Array} viewBox - The xMin, yMin, xMax and\n * yMax coordinates.\n * @property {number} scale - The scale of the viewport.\n * @property {number} rotation - The rotation, in degrees, of the viewport.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The\n * default value is `0`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The\n * default value is `0`.\n * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * @typedef {Object} PageViewportCloneParameters\n * @property {number} [scale] - The scale, overriding the one in the cloned\n * viewport. The default value is `this.scale`.\n * @property {number} [rotation] - The rotation, in degrees, overriding the one\n * in the cloned viewport. The default value is `this.rotation`.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.\n * The default value is `this.offsetX`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.\n * The default value is `this.offsetY`.\n * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * PDF page viewport created based on scale, rotation and offset.\n */\nclass PageViewport {\n /**\n * @param {PageViewportParameters}\n */\n constructor({\n viewBox,\n scale,\n rotation,\n offsetX = 0,\n offsetY = 0,\n dontFlip = false,\n }) {\n this.viewBox = viewBox;\n this.scale = scale;\n this.rotation = rotation;\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n // creating transform to convert pdf coordinate system to the normal\n // canvas like coordinates taking in account scale and rotation\n const centerX = (viewBox[2] + viewBox[0]) / 2;\n const centerY = (viewBox[3] + viewBox[1]) / 2;\n let rotateA, rotateB, rotateC, rotateD;\n // Normalize the rotation, by clamping it to the [0, 360) range.\n rotation %= 360;\n if (rotation < 0) {\n rotation += 360;\n }\n switch (rotation) {\n case 180:\n rotateA = -1;\n rotateB = 0;\n rotateC = 0;\n rotateD = 1;\n break;\n case 90:\n rotateA = 0;\n rotateB = 1;\n rotateC = 1;\n rotateD = 0;\n break;\n case 270:\n rotateA = 0;\n rotateB = -1;\n rotateC = -1;\n rotateD = 0;\n break;\n case 0:\n rotateA = 1;\n rotateB = 0;\n rotateC = 0;\n rotateD = -1;\n break;\n default:\n throw new Error(\n \"PageViewport: Invalid rotation, must be a multiple of 90 degrees.\"\n );\n }\n\n if (dontFlip) {\n rotateC = -rotateC;\n rotateD = -rotateD;\n }\n\n let offsetCanvasX, offsetCanvasY;\n let width, height;\n if (rotateA === 0) {\n offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;\n width = (viewBox[3] - viewBox[1]) * scale;\n height = (viewBox[2] - viewBox[0]) * scale;\n } else {\n offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;\n width = (viewBox[2] - viewBox[0]) * scale;\n height = (viewBox[3] - viewBox[1]) * scale;\n }\n // creating transform for the following operations:\n // translate(-centerX, -centerY), rotate and flip vertically,\n // scale, and translate(offsetCanvasX, offsetCanvasY)\n this.transform = [\n rotateA * scale,\n rotateB * scale,\n rotateC * scale,\n rotateD * scale,\n offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,\n offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY,\n ];\n\n this.width = width;\n this.height = height;\n }\n\n /**\n * The original, un-scaled, viewport dimensions.\n * @type {Object}\n */\n get rawDims() {\n const { viewBox } = this;\n return shadow(this, \"rawDims\", {\n pageWidth: viewBox[2] - viewBox[0],\n pageHeight: viewBox[3] - viewBox[1],\n pageX: viewBox[0],\n pageY: viewBox[1],\n });\n }\n\n /**\n * Clones viewport, with optional additional properties.\n * @param {PageViewportCloneParameters} [params]\n * @returns {PageViewport} Cloned viewport.\n */\n clone({\n scale = this.scale,\n rotation = this.rotation,\n offsetX = this.offsetX,\n offsetY = this.offsetY,\n dontFlip = false,\n } = {}) {\n return new PageViewport({\n viewBox: this.viewBox.slice(),\n scale,\n rotation,\n offsetX,\n offsetY,\n dontFlip,\n });\n }\n\n /**\n * Converts PDF point to the viewport coordinates. For examples, useful for\n * converting PDF location into canvas pixel coordinates.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Array} Array containing `x`- and `y`-coordinates of the\n * point in the viewport coordinate space.\n * @see {@link convertToPdfPoint}\n * @see {@link convertToViewportRectangle}\n */\n convertToViewportPoint(x, y) {\n return Util.applyTransform([x, y], this.transform);\n }\n\n /**\n * Converts PDF rectangle to the viewport coordinates.\n * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.\n * @returns {Array} Array containing corresponding coordinates of the\n * rectangle in the viewport coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToViewportRectangle(rect) {\n const topLeft = Util.applyTransform([rect[0], rect[1]], this.transform);\n const bottomRight = Util.applyTransform([rect[2], rect[3]], this.transform);\n return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];\n }\n\n /**\n * Converts viewport coordinates to the PDF location. For examples, useful\n * for converting canvas pixel location into PDF one.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Array} Array containing `x`- and `y`-coordinates of the\n * point in the PDF coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToPdfPoint(x, y) {\n return Util.applyInverseTransform([x, y], this.transform);\n }\n}\n\nclass RenderingCancelledException extends BaseException {\n constructor(msg, extraDelay = 0) {\n super(msg, \"RenderingCancelledException\");\n this.extraDelay = extraDelay;\n }\n}\n\nfunction isDataScheme(url) {\n const ii = url.length;\n let i = 0;\n while (i < ii && url[i].trim() === \"\") {\n i++;\n }\n return url.substring(i, i + 5).toLowerCase() === \"data:\";\n}\n\nfunction isPdfFile(filename) {\n return typeof filename === \"string\" && /\\.pdf$/i.test(filename);\n}\n\n/**\n * Gets the filename from a given URL.\n * @param {string} url\n * @returns {string}\n */\nfunction getFilenameFromUrl(url) {\n [url] = url.split(/[#?]/, 1);\n return url.substring(url.lastIndexOf(\"/\") + 1);\n}\n\n/**\n * Returns the filename or guessed filename from the url (see issue 3455).\n * @param {string} url - The original PDF location.\n * @param {string} defaultFilename - The value returned if the filename is\n * unknown, or the protocol is unsupported.\n * @returns {string} Guessed PDF filename.\n */\nfunction getPdfFilenameFromUrl(url, defaultFilename = \"document.pdf\") {\n if (typeof url !== \"string\") {\n return defaultFilename;\n }\n if (isDataScheme(url)) {\n warn('getPdfFilenameFromUrl: ignore \"data:\"-URL for performance reasons.');\n return defaultFilename;\n }\n const reURI = /^(?:(?:[^:]+:)?\\/\\/[^/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n // SCHEME HOST 1.PATH 2.QUERY 3.REF\n // Pattern to get last matching NAME.pdf\n const reFilename = /[^/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n const splitURI = reURI.exec(url);\n let suggestedFilename =\n reFilename.exec(splitURI[1]) ||\n reFilename.exec(splitURI[2]) ||\n reFilename.exec(splitURI[3]);\n if (suggestedFilename) {\n suggestedFilename = suggestedFilename[0];\n if (suggestedFilename.includes(\"%\")) {\n // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf\n try {\n suggestedFilename = reFilename.exec(\n decodeURIComponent(suggestedFilename)\n )[0];\n } catch {\n // Possible (extremely rare) errors:\n // URIError \"Malformed URI\", e.g. for \"%AA.pdf\"\n // TypeError \"null has no properties\", e.g. for \"%2F.pdf\"\n }\n }\n }\n return suggestedFilename || defaultFilename;\n}\n\nclass StatTimer {\n started = Object.create(null);\n\n times = [];\n\n time(name) {\n if (name in this.started) {\n warn(`Timer is already running for ${name}`);\n }\n this.started[name] = Date.now();\n }\n\n timeEnd(name) {\n if (!(name in this.started)) {\n warn(`Timer has not been started for ${name}`);\n }\n this.times.push({\n name,\n start: this.started[name],\n end: Date.now(),\n });\n // Remove timer from started so it can be called again.\n delete this.started[name];\n }\n\n toString() {\n // Find the longest name for padding purposes.\n const outBuf = [];\n let longest = 0;\n for (const { name } of this.times) {\n longest = Math.max(name.length, longest);\n }\n for (const { name, start, end } of this.times) {\n outBuf.push(`${name.padEnd(longest)} ${end - start}ms\\n`);\n }\n return outBuf.join(\"\");\n }\n}\n\nfunction isValidFetchUrl(url, baseUrl) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: isValidFetchUrl\");\n }\n try {\n const { protocol } = baseUrl ? new URL(url, baseUrl) : new URL(url);\n // The Fetch API only supports the http/https protocols, and not file/ftp.\n return protocol === \"http:\" || protocol === \"https:\";\n } catch {\n return false; // `new URL()` will throw on incorrect data.\n }\n}\n\n/**\n * Event handler to suppress context menu.\n */\nfunction noContextMenu(e) {\n e.preventDefault();\n}\n\nfunction stopEvent(e) {\n e.preventDefault();\n e.stopPropagation();\n}\n\n// Deprecated API function -- display regardless of the `verbosity` setting.\nfunction deprecated(details) {\n // eslint-disable-next-line no-console\n console.log(\"Deprecated API usage: \" + details);\n}\n\nclass PDFDateString {\n static #regex;\n\n /**\n * Convert a PDF date string to a JavaScript `Date` object.\n *\n * The PDF date string format is described in section 7.9.4 of the official\n * PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth\n * edition) Adobe describes the same format including a trailing apostrophe.\n * This syntax in incorrect, but Adobe Acrobat creates PDF files that contain\n * them. We ignore all apostrophes as they are not necessary for date parsing.\n *\n * Moreover, Adobe Acrobat doesn't handle changing the date to universal time\n * and doesn't use the user's time zone (effectively ignoring the HH' and mm'\n * parts of the date string).\n *\n * @param {string} input\n * @returns {Date|null}\n */\n static toDateObject(input) {\n if (!input || typeof input !== \"string\") {\n return null;\n }\n\n // Lazily initialize the regular expression.\n this.#regex ||= new RegExp(\n \"^D:\" + // Prefix (required)\n \"(\\\\d{4})\" + // Year (required)\n \"(\\\\d{2})?\" + // Month (optional)\n \"(\\\\d{2})?\" + // Day (optional)\n \"(\\\\d{2})?\" + // Hour (optional)\n \"(\\\\d{2})?\" + // Minute (optional)\n \"(\\\\d{2})?\" + // Second (optional)\n \"([Z|+|-])?\" + // Universal time relation (optional)\n \"(\\\\d{2})?\" + // Offset hour (optional)\n \"'?\" + // Splitting apostrophe (optional)\n \"(\\\\d{2})?\" + // Offset minute (optional)\n \"'?\" // Trailing apostrophe (optional)\n );\n\n // Optional fields that don't satisfy the requirements from the regular\n // expression (such as incorrect digit counts or numbers that are out of\n // range) will fall back the defaults from the specification.\n const matches = this.#regex.exec(input);\n if (!matches) {\n return null;\n }\n\n // JavaScript's `Date` object expects the month to be between 0 and 11\n // instead of 1 and 12, so we have to correct for that.\n const year = parseInt(matches[1], 10);\n let month = parseInt(matches[2], 10);\n month = month >= 1 && month <= 12 ? month - 1 : 0;\n let day = parseInt(matches[3], 10);\n day = day >= 1 && day <= 31 ? day : 1;\n let hour = parseInt(matches[4], 10);\n hour = hour >= 0 && hour <= 23 ? hour : 0;\n let minute = parseInt(matches[5], 10);\n minute = minute >= 0 && minute <= 59 ? minute : 0;\n let second = parseInt(matches[6], 10);\n second = second >= 0 && second <= 59 ? second : 0;\n const universalTimeRelation = matches[7] || \"Z\";\n let offsetHour = parseInt(matches[8], 10);\n offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;\n let offsetMinute = parseInt(matches[9], 10) || 0;\n offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;\n\n // Universal time relation 'Z' means that the local time is equal to the\n // universal time, whereas the relations '+'/'-' indicate that the local\n // time is later respectively earlier than the universal time. Every date\n // is normalized to universal time.\n if (universalTimeRelation === \"-\") {\n hour += offsetHour;\n minute += offsetMinute;\n } else if (universalTimeRelation === \"+\") {\n hour -= offsetHour;\n minute -= offsetMinute;\n }\n\n return new Date(Date.UTC(year, month, day, hour, minute, second));\n }\n}\n\n/**\n * NOTE: This is (mostly) intended to support printing of XFA forms.\n */\nfunction getXfaPageViewport(xfaPage, { scale = 1, rotation = 0 }) {\n const { width, height } = xfaPage.attributes.style;\n const viewBox = [0, 0, parseInt(width), parseInt(height)];\n\n return new PageViewport({\n viewBox,\n scale,\n rotation,\n });\n}\n\nfunction getRGB(color) {\n if (color.startsWith(\"#\")) {\n const colorRGB = parseInt(color.slice(1), 16);\n return [\n (colorRGB & 0xff0000) >> 16,\n (colorRGB & 0x00ff00) >> 8,\n colorRGB & 0x0000ff,\n ];\n }\n\n if (color.startsWith(\"rgb(\")) {\n // getComputedStyle(...).color returns a `rgb(R, G, B)` color.\n return color\n .slice(/* \"rgb(\".length */ 4, -1) // Strip out \"rgb(\" and \")\".\n .split(\",\")\n .map(x => parseInt(x));\n }\n\n if (color.startsWith(\"rgba(\")) {\n return color\n .slice(/* \"rgba(\".length */ 5, -1) // Strip out \"rgba(\" and \")\".\n .split(\",\")\n .map(x => parseInt(x))\n .slice(0, 3);\n }\n\n warn(`Not a valid color format: \"${color}\"`);\n return [0, 0, 0];\n}\n\nfunction getColorValues(colors) {\n const span = document.createElement(\"span\");\n span.style.visibility = \"hidden\";\n document.body.append(span);\n for (const name of colors.keys()) {\n span.style.color = name;\n const computedColor = window.getComputedStyle(span).color;\n colors.set(name, getRGB(computedColor));\n }\n span.remove();\n}\n\nfunction getCurrentTransform(ctx) {\n const { a, b, c, d, e, f } = ctx.getTransform();\n return [a, b, c, d, e, f];\n}\n\nfunction getCurrentTransformInverse(ctx) {\n const { a, b, c, d, e, f } = ctx.getTransform().invertSelf();\n return [a, b, c, d, e, f];\n}\n\n/**\n * @param {HTMLDivElement} div\n * @param {PageViewport} viewport\n * @param {boolean} mustFlip\n * @param {boolean} mustRotate\n */\nfunction setLayerDimensions(\n div,\n viewport,\n mustFlip = false,\n mustRotate = true\n) {\n if (viewport instanceof PageViewport) {\n const { pageWidth, pageHeight } = viewport.rawDims;\n const { style } = div;\n const useRound = FeatureTest.isCSSRoundSupported;\n\n const w = `var(--scale-factor) * ${pageWidth}px`,\n h = `var(--scale-factor) * ${pageHeight}px`;\n const widthStr = useRound\n ? `round(down, ${w}, var(--scale-round-x, 1px))`\n : `calc(${w})`,\n heightStr = useRound\n ? `round(down, ${h}, var(--scale-round-y, 1px))`\n : `calc(${h})`;\n\n if (!mustFlip || viewport.rotation % 180 === 0) {\n style.width = widthStr;\n style.height = heightStr;\n } else {\n style.width = heightStr;\n style.height = widthStr;\n }\n }\n\n if (mustRotate) {\n div.setAttribute(\"data-main-rotation\", viewport.rotation);\n }\n}\n\n/**\n * Scale factors for the canvas, necessary with HiDPI displays.\n */\nclass OutputScale {\n constructor() {\n const pixelRatio = window.devicePixelRatio || 1;\n\n /**\n * @type {number} Horizontal scale.\n */\n this.sx = pixelRatio;\n\n /**\n * @type {number} Vertical scale.\n */\n this.sy = pixelRatio;\n }\n\n /**\n * @type {boolean} Returns `true` when scaling is required, `false` otherwise.\n */\n get scaled() {\n return this.sx !== 1 || this.sy !== 1;\n }\n\n get symmetric() {\n return this.sx === this.sy;\n }\n}\n\nexport {\n deprecated,\n fetchData,\n getColorValues,\n getCurrentTransform,\n getCurrentTransformInverse,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getXfaPageViewport,\n isDataScheme,\n isPdfFile,\n isValidFetchUrl,\n noContextMenu,\n OutputScale,\n PageViewport,\n PDFDateString,\n PixelsPerInch,\n RenderingCancelledException,\n setLayerDimensions,\n StatTimer,\n stopEvent,\n SVG_NS,\n};\n","/* Copyright 2023 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\nimport { noContextMenu, stopEvent } from \"../display_utils.js\";\n\nclass EditorToolbar {\n #toolbar = null;\n\n #colorPicker = null;\n\n #editor;\n\n #buttons = null;\n\n #altText = null;\n\n static #l10nRemove = null;\n\n constructor(editor) {\n this.#editor = editor;\n\n EditorToolbar.#l10nRemove ||= Object.freeze({\n freetext: \"pdfjs-editor-remove-freetext-button\",\n highlight: \"pdfjs-editor-remove-highlight-button\",\n ink: \"pdfjs-editor-remove-ink-button\",\n stamp: \"pdfjs-editor-remove-stamp-button\",\n });\n }\n\n render() {\n const editToolbar = (this.#toolbar = document.createElement(\"div\"));\n editToolbar.classList.add(\"editToolbar\", \"hidden\");\n editToolbar.setAttribute(\"role\", \"toolbar\");\n const signal = this.#editor._uiManager._signal;\n editToolbar.addEventListener(\"contextmenu\", noContextMenu, { signal });\n editToolbar.addEventListener(\"pointerdown\", EditorToolbar.#pointerDown, {\n signal,\n });\n\n const buttons = (this.#buttons = document.createElement(\"div\"));\n buttons.className = \"buttons\";\n editToolbar.append(buttons);\n\n const position = this.#editor.toolbarPosition;\n if (position) {\n const { style } = editToolbar;\n const x =\n this.#editor._uiManager.direction === \"ltr\"\n ? 1 - position[0]\n : position[0];\n style.insetInlineEnd = `${100 * x}%`;\n style.top = `calc(${\n 100 * position[1]\n }% + var(--editor-toolbar-vert-offset))`;\n }\n\n this.#addDeleteButton();\n\n return editToolbar;\n }\n\n get div() {\n return this.#toolbar;\n }\n\n static #pointerDown(e) {\n e.stopPropagation();\n }\n\n #focusIn(e) {\n this.#editor._focusEventsAllowed = false;\n stopEvent(e);\n }\n\n #focusOut(e) {\n this.#editor._focusEventsAllowed = true;\n stopEvent(e);\n }\n\n #addListenersToElement(element) {\n // If we're clicking on a button with the keyboard or with\n // the mouse, we don't want to trigger any focus events on\n // the editor.\n const signal = this.#editor._uiManager._signal;\n element.addEventListener(\"focusin\", this.#focusIn.bind(this), {\n capture: true,\n signal,\n });\n element.addEventListener(\"focusout\", this.#focusOut.bind(this), {\n capture: true,\n signal,\n });\n element.addEventListener(\"contextmenu\", noContextMenu, { signal });\n }\n\n hide() {\n this.#toolbar.classList.add(\"hidden\");\n this.#colorPicker?.hideDropdown();\n }\n\n show() {\n this.#toolbar.classList.remove(\"hidden\");\n this.#altText?.shown();\n }\n\n #addDeleteButton() {\n const { editorType, _uiManager } = this.#editor;\n\n const button = document.createElement(\"button\");\n button.className = \"delete\";\n button.tabIndex = 0;\n button.setAttribute(\"data-l10n-id\", EditorToolbar.#l10nRemove[editorType]);\n this.#addListenersToElement(button);\n button.addEventListener(\n \"click\",\n e => {\n _uiManager.delete();\n },\n { signal: _uiManager._signal }\n );\n this.#buttons.append(button);\n }\n\n get #divider() {\n const divider = document.createElement(\"div\");\n divider.className = \"divider\";\n return divider;\n }\n\n async addAltText(altText) {\n const button = await altText.render();\n this.#addListenersToElement(button);\n this.#buttons.prepend(button, this.#divider);\n this.#altText = altText;\n }\n\n addColorPicker(colorPicker) {\n this.#colorPicker = colorPicker;\n const button = colorPicker.renderButton();\n this.#addListenersToElement(button);\n this.#buttons.prepend(button, this.#divider);\n }\n\n remove() {\n this.#toolbar.remove();\n this.#colorPicker?.destroy();\n this.#colorPicker = null;\n }\n}\n\nclass HighlightToolbar {\n #buttons = null;\n\n #toolbar = null;\n\n #uiManager;\n\n constructor(uiManager) {\n this.#uiManager = uiManager;\n }\n\n #render() {\n const editToolbar = (this.#toolbar = document.createElement(\"div\"));\n editToolbar.className = \"editToolbar\";\n editToolbar.setAttribute(\"role\", \"toolbar\");\n editToolbar.addEventListener(\"contextmenu\", noContextMenu, {\n signal: this.#uiManager._signal,\n });\n\n const buttons = (this.#buttons = document.createElement(\"div\"));\n buttons.className = \"buttons\";\n editToolbar.append(buttons);\n\n this.#addHighlightButton();\n\n return editToolbar;\n }\n\n #getLastPoint(boxes, isLTR) {\n let lastY = 0;\n let lastX = 0;\n for (const box of boxes) {\n const y = box.y + box.height;\n if (y < lastY) {\n continue;\n }\n const x = box.x + (isLTR ? box.width : 0);\n if (y > lastY) {\n lastX = x;\n lastY = y;\n continue;\n }\n if (isLTR) {\n if (x > lastX) {\n lastX = x;\n }\n } else if (x < lastX) {\n lastX = x;\n }\n }\n return [isLTR ? 1 - lastX : lastX, lastY];\n }\n\n show(parent, boxes, isLTR) {\n const [x, y] = this.#getLastPoint(boxes, isLTR);\n const { style } = (this.#toolbar ||= this.#render());\n parent.append(this.#toolbar);\n style.insetInlineEnd = `${100 * x}%`;\n style.top = `calc(${100 * y}% + var(--editor-toolbar-vert-offset))`;\n }\n\n hide() {\n this.#toolbar.remove();\n }\n\n #addHighlightButton() {\n const button = document.createElement(\"button\");\n button.className = \"highlightButton\";\n button.tabIndex = 0;\n button.setAttribute(\"data-l10n-id\", `pdfjs-highlight-floating-button1`);\n const span = document.createElement(\"span\");\n button.append(span);\n span.className = \"visuallyHidden\";\n span.setAttribute(\"data-l10n-id\", \"pdfjs-highlight-floating-button-label\");\n const signal = this.#uiManager._signal;\n button.addEventListener(\"contextmenu\", noContextMenu, { signal });\n button.addEventListener(\n \"click\",\n () => {\n this.#uiManager.highlightSelection(\"floating_button\");\n },\n { signal }\n );\n this.#buttons.append(button);\n }\n}\n\nexport { EditorToolbar, HighlightToolbar };\n","/* Copyright 2022 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/** @typedef {import(\"./editor.js\").AnnotationEditor} AnnotationEditor */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./annotation_editor_layer.js\").AnnotationEditorLayer} AnnotationEditorLayer */\n\nimport {\n AnnotationEditorParamsType,\n AnnotationEditorPrefix,\n AnnotationEditorType,\n FeatureTest,\n getUuid,\n shadow,\n Util,\n warn,\n} from \"../../shared/util.js\";\nimport {\n fetchData,\n getColorValues,\n getRGB,\n PixelsPerInch,\n stopEvent,\n} from \"../display_utils.js\";\nimport { HighlightToolbar } from \"./toolbar.js\";\n\nfunction bindEvents(obj, element, names) {\n for (const name of names) {\n element.addEventListener(name, obj[name].bind(obj));\n }\n}\n\n/**\n * Convert a number between 0 and 100 into an hex number between 0 and 255.\n * @param {number} opacity\n * @return {string}\n */\nfunction opacityToHex(opacity) {\n return Math.round(Math.min(255, Math.max(1, 255 * opacity)))\n .toString(16)\n .padStart(2, \"0\");\n}\n\n/**\n * Class to create some unique ids for the different editors.\n */\nclass IdManager {\n #id = 0;\n\n constructor() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.defineProperty(this, \"reset\", {\n value: () => (this.#id = 0),\n });\n }\n }\n\n /**\n * Get a unique id.\n * @returns {string}\n */\n get id() {\n return `${AnnotationEditorPrefix}${this.#id++}`;\n }\n}\n\n/**\n * Class to manage the images used by the editors.\n * The main idea is to try to minimize the memory used by the images.\n * The images are cached and reused when possible\n * We use a refCounter to know when an image is not used anymore but we need to\n * be able to restore an image after a remove+undo, so we keep a file reference\n * or an url one.\n */\nclass ImageManager {\n #baseId = getUuid();\n\n #id = 0;\n\n #cache = null;\n\n static get _isSVGFittingCanvas() {\n // By default, Firefox doesn't rescale without preserving the aspect ratio\n // when drawing an SVG image on a canvas, see https://bugzilla.mozilla.org/1547776.\n // The \"workaround\" is to append \"svgView(preserveAspectRatio(none))\" to the\n // url, but according to comment #15, it seems that it leads to unexpected\n // behavior in Safari.\n const svg = `data:image/svg+xml;charset=UTF-8,`;\n const canvas = new OffscreenCanvas(1, 3);\n const ctx = canvas.getContext(\"2d\", { willReadFrequently: true });\n const image = new Image();\n image.src = svg;\n const promise = image.decode().then(() => {\n ctx.drawImage(image, 0, 0, 1, 1, 0, 0, 1, 3);\n return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;\n });\n\n return shadow(this, \"_isSVGFittingCanvas\", promise);\n }\n\n async #get(key, rawData) {\n this.#cache ||= new Map();\n let data = this.#cache.get(key);\n if (data === null) {\n // We already tried to load the image but it failed.\n return null;\n }\n if (data?.bitmap) {\n data.refCounter += 1;\n return data;\n }\n try {\n data ||= {\n bitmap: null,\n id: `image_${this.#baseId}_${this.#id++}`,\n refCounter: 0,\n isSvg: false,\n };\n let image;\n if (typeof rawData === \"string\") {\n data.url = rawData;\n image = await fetchData(rawData, \"blob\");\n } else if (rawData instanceof File) {\n image = data.file = rawData;\n } else if (rawData instanceof Blob) {\n image = rawData;\n }\n\n if (image.type === \"image/svg+xml\") {\n // Unfortunately, createImageBitmap doesn't work with SVG images.\n // (see https://bugzilla.mozilla.org/1841972).\n const mustRemoveAspectRatioPromise = ImageManager._isSVGFittingCanvas;\n const fileReader = new FileReader();\n const imageElement = new Image();\n const imagePromise = new Promise((resolve, reject) => {\n imageElement.onload = () => {\n data.bitmap = imageElement;\n data.isSvg = true;\n resolve();\n };\n fileReader.onload = async () => {\n const url = (data.svgUrl = fileReader.result);\n // We need to set the preserveAspectRatio to none in order to let\n // the image fits the canvas when resizing.\n imageElement.src = (await mustRemoveAspectRatioPromise)\n ? `${url}#svgView(preserveAspectRatio(none))`\n : url;\n };\n imageElement.onerror = fileReader.onerror = reject;\n });\n fileReader.readAsDataURL(image);\n await imagePromise;\n } else {\n data.bitmap = await createImageBitmap(image);\n }\n data.refCounter = 1;\n } catch (e) {\n warn(e);\n data = null;\n }\n this.#cache.set(key, data);\n if (data) {\n this.#cache.set(data.id, data);\n }\n return data;\n }\n\n async getFromFile(file) {\n const { lastModified, name, size, type } = file;\n return this.#get(`${lastModified}_${name}_${size}_${type}`, file);\n }\n\n async getFromUrl(url) {\n return this.#get(url, url);\n }\n\n async getFromBlob(id, blobPromise) {\n const blob = await blobPromise;\n return this.#get(id, blob);\n }\n\n async getFromId(id) {\n this.#cache ||= new Map();\n const data = this.#cache.get(id);\n if (!data) {\n return null;\n }\n if (data.bitmap) {\n data.refCounter += 1;\n return data;\n }\n\n if (data.file) {\n return this.getFromFile(data.file);\n }\n if (data.blobPromise) {\n const { blobPromise } = data;\n delete data.blobPromise;\n return this.getFromBlob(data.id, blobPromise);\n }\n return this.getFromUrl(data.url);\n }\n\n getFromCanvas(id, canvas) {\n this.#cache ||= new Map();\n let data = this.#cache.get(id);\n if (data?.bitmap) {\n data.refCounter += 1;\n return data;\n }\n const offscreen = new OffscreenCanvas(canvas.width, canvas.height);\n const ctx = offscreen.getContext(\"2d\");\n ctx.drawImage(canvas, 0, 0);\n data = {\n bitmap: offscreen.transferToImageBitmap(),\n id: `image_${this.#baseId}_${this.#id++}`,\n refCounter: 1,\n isSvg: false,\n };\n this.#cache.set(id, data);\n this.#cache.set(data.id, data);\n return data;\n }\n\n getSvgUrl(id) {\n const data = this.#cache.get(id);\n if (!data?.isSvg) {\n return null;\n }\n return data.svgUrl;\n }\n\n deleteId(id) {\n this.#cache ||= new Map();\n const data = this.#cache.get(id);\n if (!data) {\n return;\n }\n data.refCounter -= 1;\n if (data.refCounter !== 0) {\n return;\n }\n const { bitmap } = data;\n if (!data.url && !data.file) {\n // The image has no way to be restored (ctrl+z) so we must fix that.\n const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);\n const ctx = canvas.getContext(\"bitmaprenderer\");\n ctx.transferFromImageBitmap(bitmap);\n data.blobPromise = canvas.convertToBlob();\n }\n\n bitmap.close?.();\n data.bitmap = null;\n }\n\n // We can use the id only if it belongs this manager.\n // We must take care of having the right manager because we can copy/paste\n // some images from other documents, hence it'd be a pity to use an id from an\n // other manager.\n isValidId(id) {\n return id.startsWith(`image_${this.#baseId}_`);\n }\n}\n\n/**\n * Class to handle undo/redo.\n * Commands are just saved in a buffer.\n * If we hit some memory issues we could likely use a circular buffer.\n * It has to be used as a singleton.\n */\nclass CommandManager {\n #commands = [];\n\n #locked = false;\n\n #maxSize;\n\n #position = -1;\n\n constructor(maxSize = 128) {\n this.#maxSize = maxSize;\n }\n\n /**\n * @typedef {Object} addOptions\n * @property {function} cmd\n * @property {function} undo\n * @property {function} [post]\n * @property {boolean} mustExec\n * @property {number} type\n * @property {boolean} overwriteIfSameType\n * @property {boolean} keepUndo\n */\n\n /**\n * Add a new couple of commands to be used in case of redo/undo.\n * @param {addOptions} options\n */\n add({\n cmd,\n undo,\n post,\n mustExec,\n type = NaN,\n overwriteIfSameType = false,\n keepUndo = false,\n }) {\n if (mustExec) {\n cmd();\n }\n\n if (this.#locked) {\n return;\n }\n\n const save = { cmd, undo, post, type };\n if (this.#position === -1) {\n if (this.#commands.length > 0) {\n // All the commands have been undone and then a new one is added\n // hence we clear the queue.\n this.#commands.length = 0;\n }\n this.#position = 0;\n this.#commands.push(save);\n return;\n }\n\n if (overwriteIfSameType && this.#commands[this.#position].type === type) {\n // For example when we change a color we don't want to\n // be able to undo all the steps, hence we only want to\n // keep the last undoable action in this sequence of actions.\n if (keepUndo) {\n save.undo = this.#commands[this.#position].undo;\n }\n this.#commands[this.#position] = save;\n return;\n }\n\n const next = this.#position + 1;\n if (next === this.#maxSize) {\n this.#commands.splice(0, 1);\n } else {\n this.#position = next;\n if (next < this.#commands.length) {\n this.#commands.splice(next);\n }\n }\n\n this.#commands.push(save);\n }\n\n /**\n * Undo the last command.\n */\n undo() {\n if (this.#position === -1) {\n // Nothing to undo.\n return;\n }\n\n // Avoid to insert something during the undo execution.\n this.#locked = true;\n const { undo, post } = this.#commands[this.#position];\n undo();\n post?.();\n this.#locked = false;\n\n this.#position -= 1;\n }\n\n /**\n * Redo the last command.\n */\n redo() {\n if (this.#position < this.#commands.length - 1) {\n this.#position += 1;\n\n // Avoid to insert something during the redo execution.\n this.#locked = true;\n const { cmd, post } = this.#commands[this.#position];\n cmd();\n post?.();\n this.#locked = false;\n }\n }\n\n /**\n * Check if there is something to undo.\n * @returns {boolean}\n */\n hasSomethingToUndo() {\n return this.#position !== -1;\n }\n\n /**\n * Check if there is something to redo.\n * @returns {boolean}\n */\n hasSomethingToRedo() {\n return this.#position < this.#commands.length - 1;\n }\n\n cleanType(type) {\n if (this.#position === -1) {\n return;\n }\n for (let i = this.#position; i >= 0; i--) {\n if (this.#commands[i].type !== type) {\n this.#commands.splice(i + 1, this.#position - i);\n this.#position = i;\n return;\n }\n }\n this.#commands.length = 0;\n this.#position = -1;\n }\n\n destroy() {\n this.#commands = null;\n }\n}\n\n/**\n * Class to handle the different keyboards shortcuts we can have on mac or\n * non-mac OSes.\n */\nclass KeyboardManager {\n /**\n * Create a new keyboard manager class.\n * @param {Array} callbacks - an array containing an array of shortcuts\n * and a callback to call.\n * A shortcut is a string like `ctrl+c` or `mac+ctrl+c` for mac OS.\n */\n constructor(callbacks) {\n this.buffer = [];\n this.callbacks = new Map();\n this.allKeys = new Set();\n\n const { isMac } = FeatureTest.platform;\n for (const [keys, callback, options = {}] of callbacks) {\n for (const key of keys) {\n const isMacKey = key.startsWith(\"mac+\");\n if (isMac && isMacKey) {\n this.callbacks.set(key.slice(4), { callback, options });\n this.allKeys.add(key.split(\"+\").at(-1));\n } else if (!isMac && !isMacKey) {\n this.callbacks.set(key, { callback, options });\n this.allKeys.add(key.split(\"+\").at(-1));\n }\n }\n }\n }\n\n /**\n * Serialize an event into a string in order to match a\n * potential key for a callback.\n * @param {KeyboardEvent} event\n * @returns {string}\n */\n #serialize(event) {\n if (event.altKey) {\n this.buffer.push(\"alt\");\n }\n if (event.ctrlKey) {\n this.buffer.push(\"ctrl\");\n }\n if (event.metaKey) {\n this.buffer.push(\"meta\");\n }\n if (event.shiftKey) {\n this.buffer.push(\"shift\");\n }\n this.buffer.push(event.key);\n const str = this.buffer.join(\"+\");\n this.buffer.length = 0;\n\n return str;\n }\n\n /**\n * Execute a callback, if any, for a given keyboard event.\n * The self is used as `this` in the callback.\n * @param {Object} self\n * @param {KeyboardEvent} event\n * @returns\n */\n exec(self, event) {\n if (!this.allKeys.has(event.key)) {\n return;\n }\n const info = this.callbacks.get(this.#serialize(event));\n if (!info) {\n return;\n }\n const {\n callback,\n options: { bubbles = false, args = [], checker = null },\n } = info;\n\n if (checker && !checker(self, event)) {\n return;\n }\n callback.bind(self, ...args, event)();\n\n // For example, ctrl+s in a FreeText must be handled by the viewer, hence\n // the event must bubble.\n if (!bubbles) {\n stopEvent(event);\n }\n }\n}\n\nclass ColorManager {\n static _colorsMapping = new Map([\n [\"CanvasText\", [0, 0, 0]],\n [\"Canvas\", [255, 255, 255]],\n ]);\n\n get _colors() {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ) {\n return shadow(this, \"_colors\", ColorManager._colorsMapping);\n }\n\n const colors = new Map([\n [\"CanvasText\", null],\n [\"Canvas\", null],\n ]);\n getColorValues(colors);\n return shadow(this, \"_colors\", colors);\n }\n\n /**\n * In High Contrast Mode, the color on the screen is not always the\n * real color used in the pdf.\n * For example in some cases white can appear to be black but when saving\n * we want to have white.\n * @param {string} color\n * @returns {Array}\n */\n convert(color) {\n const rgb = getRGB(color);\n if (!window.matchMedia(\"(forced-colors: active)\").matches) {\n return rgb;\n }\n\n for (const [name, RGB] of this._colors) {\n if (RGB.every((x, i) => x === rgb[i])) {\n return ColorManager._colorsMapping.get(name);\n }\n }\n return rgb;\n }\n\n /**\n * An input element must have its color value as a hex string\n * and not as color name.\n * So this function converts a name into an hex string.\n * @param {string} name\n * @returns {string}\n */\n getHexCode(name) {\n const rgb = this._colors.get(name);\n if (!rgb) {\n return name;\n }\n return Util.makeHexColor(...rgb);\n }\n}\n\n/**\n * A pdf has several pages and each of them when it will rendered\n * will have an AnnotationEditorLayer which will contain the some\n * new Annotations associated to an editor in order to modify them.\n *\n * This class is used to manage all the different layers, editors and\n * some action like copy/paste, undo/redo, ...\n */\nclass AnnotationEditorUIManager {\n #abortController = new AbortController();\n\n #activeEditor = null;\n\n #allEditors = new Map();\n\n #allLayers = new Map();\n\n #altTextManager = null;\n\n #annotationStorage = null;\n\n #changedExistingAnnotations = null;\n\n #commandManager = new CommandManager();\n\n #copyPasteAC = null;\n\n #currentDrawingSession = null;\n\n #currentPageIndex = 0;\n\n #deletedAnnotationsElementIds = new Set();\n\n #draggingEditors = null;\n\n #editorTypes = null;\n\n #editorsToRescale = new Set();\n\n _editorUndoBar = null;\n\n #enableHighlightFloatingButton = false;\n\n #enableUpdatedAddImage = false;\n\n #enableNewAltTextWhenAddingImage = false;\n\n #filterFactory = null;\n\n #focusMainContainerTimeoutId = null;\n\n #focusManagerAC = null;\n\n #highlightColors = null;\n\n #highlightWhenShiftUp = false;\n\n #highlightToolbar = null;\n\n #idManager = new IdManager();\n\n #isEnabled = false;\n\n #isWaiting = false;\n\n #keyboardManagerAC = null;\n\n #lastActiveElement = null;\n\n #mainHighlightColorPicker = null;\n\n #mlManager = null;\n\n #mode = AnnotationEditorType.NONE;\n\n #selectedEditors = new Set();\n\n #selectedTextNode = null;\n\n #pageColors = null;\n\n #showAllStates = null;\n\n #previousStates = {\n isEditing: false,\n isEmpty: true,\n hasSomethingToUndo: false,\n hasSomethingToRedo: false,\n hasSelectedEditor: false,\n hasSelectedText: false,\n };\n\n #translation = [0, 0];\n\n #translationTimeoutId = null;\n\n #container = null;\n\n #viewer = null;\n\n #updateModeCapability = null;\n\n static TRANSLATE_SMALL = 1; // page units.\n\n static TRANSLATE_BIG = 10; // page units.\n\n static get _keyboardManager() {\n const proto = AnnotationEditorUIManager.prototype;\n\n /**\n * If the focused element is an input, we don't want to handle the arrow.\n * For example, sliders can be controlled with the arrow keys.\n */\n const arrowChecker = self =>\n self.#container.contains(document.activeElement) &&\n document.activeElement.tagName !== \"BUTTON\" &&\n self.hasSomethingToControl();\n\n const textInputChecker = (_self, { target: el }) => {\n if (el instanceof HTMLInputElement) {\n const { type } = el;\n return type !== \"text\" && type !== \"number\";\n }\n return true;\n };\n\n const small = this.TRANSLATE_SMALL;\n const big = this.TRANSLATE_BIG;\n\n return shadow(\n this,\n \"_keyboardManager\",\n new KeyboardManager([\n [\n [\"ctrl+a\", \"mac+meta+a\"],\n proto.selectAll,\n { checker: textInputChecker },\n ],\n [[\"ctrl+z\", \"mac+meta+z\"], proto.undo, { checker: textInputChecker }],\n [\n // On mac, depending of the OS version, the event.key is either \"z\" or\n // \"Z\" when the user presses \"meta+shift+z\".\n [\n \"ctrl+y\",\n \"ctrl+shift+z\",\n \"mac+meta+shift+z\",\n \"ctrl+shift+Z\",\n \"mac+meta+shift+Z\",\n ],\n proto.redo,\n { checker: textInputChecker },\n ],\n [\n [\n \"Backspace\",\n \"alt+Backspace\",\n \"ctrl+Backspace\",\n \"shift+Backspace\",\n \"mac+Backspace\",\n \"mac+alt+Backspace\",\n \"mac+ctrl+Backspace\",\n \"Delete\",\n \"ctrl+Delete\",\n \"shift+Delete\",\n \"mac+Delete\",\n ],\n proto.delete,\n { checker: textInputChecker },\n ],\n [\n [\"Enter\", \"mac+Enter\"],\n proto.addNewEditorFromKeyboard,\n {\n // Those shortcuts can be used in the toolbar for some other actions\n // like zooming, hence we need to check if the container has the\n // focus.\n checker: (self, { target: el }) =>\n !(el instanceof HTMLButtonElement) &&\n self.#container.contains(el) &&\n !self.isEnterHandled,\n },\n ],\n [\n [\" \", \"mac+ \"],\n proto.addNewEditorFromKeyboard,\n {\n // Those shortcuts can be used in the toolbar for some other actions\n // like zooming, hence we need to check if the container has the\n // focus.\n checker: (self, { target: el }) =>\n !(el instanceof HTMLButtonElement) &&\n self.#container.contains(document.activeElement),\n },\n ],\n [[\"Escape\", \"mac+Escape\"], proto.unselectAll],\n [\n [\"ArrowLeft\", \"mac+ArrowLeft\"],\n proto.translateSelectedEditors,\n { args: [-small, 0], checker: arrowChecker },\n ],\n [\n [\"ctrl+ArrowLeft\", \"mac+shift+ArrowLeft\"],\n proto.translateSelectedEditors,\n { args: [-big, 0], checker: arrowChecker },\n ],\n [\n [\"ArrowRight\", \"mac+ArrowRight\"],\n proto.translateSelectedEditors,\n { args: [small, 0], checker: arrowChecker },\n ],\n [\n [\"ctrl+ArrowRight\", \"mac+shift+ArrowRight\"],\n proto.translateSelectedEditors,\n { args: [big, 0], checker: arrowChecker },\n ],\n [\n [\"ArrowUp\", \"mac+ArrowUp\"],\n proto.translateSelectedEditors,\n { args: [0, -small], checker: arrowChecker },\n ],\n [\n [\"ctrl+ArrowUp\", \"mac+shift+ArrowUp\"],\n proto.translateSelectedEditors,\n { args: [0, -big], checker: arrowChecker },\n ],\n [\n [\"ArrowDown\", \"mac+ArrowDown\"],\n proto.translateSelectedEditors,\n { args: [0, small], checker: arrowChecker },\n ],\n [\n [\"ctrl+ArrowDown\", \"mac+shift+ArrowDown\"],\n proto.translateSelectedEditors,\n { args: [0, big], checker: arrowChecker },\n ],\n ])\n );\n }\n\n constructor(\n container,\n viewer,\n altTextManager,\n eventBus,\n pdfDocument,\n pageColors,\n highlightColors,\n enableHighlightFloatingButton,\n enableUpdatedAddImage,\n enableNewAltTextWhenAddingImage,\n mlManager,\n editorUndoBar\n ) {\n const signal = (this._signal = this.#abortController.signal);\n this.#container = container;\n this.#viewer = viewer;\n this.#altTextManager = altTextManager;\n this._eventBus = eventBus;\n eventBus._on(\"editingaction\", this.onEditingAction.bind(this), { signal });\n eventBus._on(\"pagechanging\", this.onPageChanging.bind(this), { signal });\n eventBus._on(\"scalechanging\", this.onScaleChanging.bind(this), { signal });\n eventBus._on(\"rotationchanging\", this.onRotationChanging.bind(this), {\n signal,\n });\n eventBus._on(\"setpreference\", this.onSetPreference.bind(this), { signal });\n eventBus._on(\n \"switchannotationeditorparams\",\n evt => this.updateParams(evt.type, evt.value),\n { signal }\n );\n this.#addSelectionListener();\n this.#addDragAndDropListeners();\n this.#addKeyboardManager();\n this.#annotationStorage = pdfDocument.annotationStorage;\n this.#filterFactory = pdfDocument.filterFactory;\n this.#pageColors = pageColors;\n this.#highlightColors = highlightColors || null;\n this.#enableHighlightFloatingButton = enableHighlightFloatingButton;\n this.#enableUpdatedAddImage = enableUpdatedAddImage;\n this.#enableNewAltTextWhenAddingImage = enableNewAltTextWhenAddingImage;\n this.#mlManager = mlManager || null;\n this.viewParameters = {\n realScale: PixelsPerInch.PDF_TO_CSS_UNITS,\n rotation: 0,\n };\n this.isShiftKeyDown = false;\n this._editorUndoBar = editorUndoBar || null;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.defineProperty(this, \"reset\", {\n value: () => {\n this.selectAll();\n this.delete();\n this.#idManager.reset();\n },\n });\n }\n }\n\n destroy() {\n this.#updateModeCapability?.resolve();\n this.#updateModeCapability = null;\n\n this.#abortController?.abort();\n this.#abortController = null;\n this._signal = null;\n\n for (const layer of this.#allLayers.values()) {\n layer.destroy();\n }\n this.#allLayers.clear();\n this.#allEditors.clear();\n this.#editorsToRescale.clear();\n this.#activeEditor = null;\n this.#selectedEditors.clear();\n this.#commandManager.destroy();\n this.#altTextManager?.destroy();\n this.#highlightToolbar?.hide();\n this.#highlightToolbar = null;\n if (this.#focusMainContainerTimeoutId) {\n clearTimeout(this.#focusMainContainerTimeoutId);\n this.#focusMainContainerTimeoutId = null;\n }\n if (this.#translationTimeoutId) {\n clearTimeout(this.#translationTimeoutId);\n this.#translationTimeoutId = null;\n }\n this._editorUndoBar?.destroy();\n }\n\n combinedSignal(ac) {\n return AbortSignal.any([this._signal, ac.signal]);\n }\n\n get mlManager() {\n return this.#mlManager;\n }\n\n get useNewAltTextFlow() {\n return this.#enableUpdatedAddImage;\n }\n\n get useNewAltTextWhenAddingImage() {\n return this.#enableNewAltTextWhenAddingImage;\n }\n\n get hcmFilter() {\n return shadow(\n this,\n \"hcmFilter\",\n this.#pageColors\n ? this.#filterFactory.addHCMFilter(\n this.#pageColors.foreground,\n this.#pageColors.background\n )\n : \"none\"\n );\n }\n\n get direction() {\n return shadow(\n this,\n \"direction\",\n getComputedStyle(this.#container).direction\n );\n }\n\n get highlightColors() {\n return shadow(\n this,\n \"highlightColors\",\n this.#highlightColors\n ? new Map(\n this.#highlightColors\n .split(\",\")\n .map(pair => pair.split(\"=\").map(x => x.trim()))\n )\n : null\n );\n }\n\n get highlightColorNames() {\n return shadow(\n this,\n \"highlightColorNames\",\n this.highlightColors\n ? new Map(Array.from(this.highlightColors, e => e.reverse()))\n : null\n );\n }\n\n /**\n * Set the current drawing session.\n * @param {AnnotationEditorLayer} layer\n */\n setCurrentDrawingSession(layer) {\n if (layer) {\n this.unselectAll();\n this.disableUserSelect(true);\n } else {\n this.disableUserSelect(false);\n }\n this.#currentDrawingSession = layer;\n }\n\n setMainHighlightColorPicker(colorPicker) {\n this.#mainHighlightColorPicker = colorPicker;\n }\n\n editAltText(editor, firstTime = false) {\n this.#altTextManager?.editAltText(this, editor, firstTime);\n }\n\n switchToMode(mode, callback) {\n // Switching to a mode can be asynchronous.\n this._eventBus.on(\"annotationeditormodechanged\", callback, {\n once: true,\n signal: this._signal,\n });\n this._eventBus.dispatch(\"showannotationeditorui\", {\n source: this,\n mode,\n });\n }\n\n setPreference(name, value) {\n this._eventBus.dispatch(\"setpreference\", {\n source: this,\n name,\n value,\n });\n }\n\n onSetPreference({ name, value }) {\n switch (name) {\n case \"enableNewAltTextWhenAddingImage\":\n this.#enableNewAltTextWhenAddingImage = value;\n break;\n }\n }\n\n onPageChanging({ pageNumber }) {\n this.#currentPageIndex = pageNumber - 1;\n }\n\n focusMainContainer() {\n this.#container.focus();\n }\n\n findParent(x, y) {\n for (const layer of this.#allLayers.values()) {\n const {\n x: layerX,\n y: layerY,\n width,\n height,\n } = layer.div.getBoundingClientRect();\n if (\n x >= layerX &&\n x <= layerX + width &&\n y >= layerY &&\n y <= layerY + height\n ) {\n return layer;\n }\n }\n return null;\n }\n\n disableUserSelect(value = false) {\n this.#viewer.classList.toggle(\"noUserSelect\", value);\n }\n\n addShouldRescale(editor) {\n this.#editorsToRescale.add(editor);\n }\n\n removeShouldRescale(editor) {\n this.#editorsToRescale.delete(editor);\n }\n\n onScaleChanging({ scale }) {\n this.commitOrRemove();\n this.viewParameters.realScale = scale * PixelsPerInch.PDF_TO_CSS_UNITS;\n for (const editor of this.#editorsToRescale) {\n editor.onScaleChanging();\n }\n this.#currentDrawingSession?.onScaleChanging();\n }\n\n onRotationChanging({ pagesRotation }) {\n this.commitOrRemove();\n this.viewParameters.rotation = pagesRotation;\n }\n\n #getAnchorElementForSelection({ anchorNode }) {\n return anchorNode.nodeType === Node.TEXT_NODE\n ? anchorNode.parentElement\n : anchorNode;\n }\n\n #getLayerForTextLayer(textLayer) {\n const { currentLayer } = this;\n if (currentLayer.hasTextLayer(textLayer)) {\n return currentLayer;\n }\n for (const layer of this.#allLayers.values()) {\n if (layer.hasTextLayer(textLayer)) {\n return layer;\n }\n }\n return null;\n }\n\n highlightSelection(methodOfCreation = \"\") {\n const selection = document.getSelection();\n if (!selection || selection.isCollapsed) {\n return;\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = selection;\n const text = selection.toString();\n const anchorElement = this.#getAnchorElementForSelection(selection);\n const textLayer = anchorElement.closest(\".textLayer\");\n const boxes = this.getSelectionBoxes(textLayer);\n if (!boxes) {\n return;\n }\n selection.empty();\n\n const layer = this.#getLayerForTextLayer(textLayer);\n const isNoneMode = this.#mode === AnnotationEditorType.NONE;\n const callback = () => {\n layer?.createAndAddNewEditor({ x: 0, y: 0 }, false, {\n methodOfCreation,\n boxes,\n anchorNode,\n anchorOffset,\n focusNode,\n focusOffset,\n text,\n });\n if (isNoneMode) {\n this.showAllEditors(\"highlight\", true, /* updateButton = */ true);\n }\n };\n if (isNoneMode) {\n this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);\n return;\n }\n callback();\n }\n\n #displayHighlightToolbar() {\n const selection = document.getSelection();\n if (!selection || selection.isCollapsed) {\n return;\n }\n const anchorElement = this.#getAnchorElementForSelection(selection);\n const textLayer = anchorElement.closest(\".textLayer\");\n const boxes = this.getSelectionBoxes(textLayer);\n if (!boxes) {\n return;\n }\n this.#highlightToolbar ||= new HighlightToolbar(this);\n this.#highlightToolbar.show(textLayer, boxes, this.direction === \"ltr\");\n }\n\n /**\n * Add an editor in the annotation storage.\n * @param {AnnotationEditor} editor\n */\n addToAnnotationStorage(editor) {\n if (\n !editor.isEmpty() &&\n this.#annotationStorage &&\n !this.#annotationStorage.has(editor.id)\n ) {\n this.#annotationStorage.setValue(editor.id, editor);\n }\n }\n\n #selectionChange() {\n const selection = document.getSelection();\n if (!selection || selection.isCollapsed) {\n if (this.#selectedTextNode) {\n this.#highlightToolbar?.hide();\n this.#selectedTextNode = null;\n this.#dispatchUpdateStates({\n hasSelectedText: false,\n });\n }\n return;\n }\n const { anchorNode } = selection;\n if (anchorNode === this.#selectedTextNode) {\n return;\n }\n\n const anchorElement = this.#getAnchorElementForSelection(selection);\n const textLayer = anchorElement.closest(\".textLayer\");\n if (!textLayer) {\n if (this.#selectedTextNode) {\n this.#highlightToolbar?.hide();\n this.#selectedTextNode = null;\n this.#dispatchUpdateStates({\n hasSelectedText: false,\n });\n }\n return;\n }\n\n this.#highlightToolbar?.hide();\n this.#selectedTextNode = anchorNode;\n this.#dispatchUpdateStates({\n hasSelectedText: true,\n });\n\n if (\n this.#mode !== AnnotationEditorType.HIGHLIGHT &&\n this.#mode !== AnnotationEditorType.NONE\n ) {\n return;\n }\n\n if (this.#mode === AnnotationEditorType.HIGHLIGHT) {\n this.showAllEditors(\"highlight\", true, /* updateButton = */ true);\n }\n\n this.#highlightWhenShiftUp = this.isShiftKeyDown;\n if (!this.isShiftKeyDown) {\n const activeLayer =\n this.#mode === AnnotationEditorType.HIGHLIGHT\n ? this.#getLayerForTextLayer(textLayer)\n : null;\n activeLayer?.toggleDrawing();\n\n const ac = new AbortController();\n const signal = this.combinedSignal(ac);\n\n const pointerup = e => {\n if (e.type === \"pointerup\" && e.button !== 0) {\n // Do nothing on right click.\n return;\n }\n ac.abort();\n activeLayer?.toggleDrawing(true);\n if (e.type === \"pointerup\") {\n this.#onSelectEnd(\"main_toolbar\");\n }\n };\n window.addEventListener(\"pointerup\", pointerup, { signal });\n window.addEventListener(\"blur\", pointerup, { signal });\n }\n }\n\n #onSelectEnd(methodOfCreation = \"\") {\n if (this.#mode === AnnotationEditorType.HIGHLIGHT) {\n this.highlightSelection(methodOfCreation);\n } else if (this.#enableHighlightFloatingButton) {\n this.#displayHighlightToolbar();\n }\n }\n\n #addSelectionListener() {\n document.addEventListener(\n \"selectionchange\",\n this.#selectionChange.bind(this),\n { signal: this._signal }\n );\n }\n\n #addFocusManager() {\n if (this.#focusManagerAC) {\n return;\n }\n this.#focusManagerAC = new AbortController();\n const signal = this.combinedSignal(this.#focusManagerAC);\n\n window.addEventListener(\"focus\", this.focus.bind(this), { signal });\n window.addEventListener(\"blur\", this.blur.bind(this), { signal });\n }\n\n #removeFocusManager() {\n this.#focusManagerAC?.abort();\n this.#focusManagerAC = null;\n }\n\n blur() {\n this.isShiftKeyDown = false;\n if (this.#highlightWhenShiftUp) {\n this.#highlightWhenShiftUp = false;\n this.#onSelectEnd(\"main_toolbar\");\n }\n if (!this.hasSelection) {\n return;\n }\n // When several editors are selected and the window loses focus, we want to\n // keep the last active element in order to be able to focus it again when\n // the window gets the focus back but we don't want to trigger any focus\n // callbacks else only one editor will be selected.\n const { activeElement } = document;\n for (const editor of this.#selectedEditors) {\n if (editor.div.contains(activeElement)) {\n this.#lastActiveElement = [editor, activeElement];\n editor._focusEventsAllowed = false;\n break;\n }\n }\n }\n\n focus() {\n if (!this.#lastActiveElement) {\n return;\n }\n const [lastEditor, lastActiveElement] = this.#lastActiveElement;\n this.#lastActiveElement = null;\n lastActiveElement.addEventListener(\n \"focusin\",\n () => {\n lastEditor._focusEventsAllowed = true;\n },\n { once: true, signal: this._signal }\n );\n lastActiveElement.focus();\n }\n\n #addKeyboardManager() {\n if (this.#keyboardManagerAC) {\n return;\n }\n this.#keyboardManagerAC = new AbortController();\n const signal = this.combinedSignal(this.#keyboardManagerAC);\n\n // The keyboard events are caught at the container level in order to be able\n // to execute some callbacks even if the current page doesn't have focus.\n window.addEventListener(\"keydown\", this.keydown.bind(this), { signal });\n window.addEventListener(\"keyup\", this.keyup.bind(this), { signal });\n }\n\n #removeKeyboardManager() {\n this.#keyboardManagerAC?.abort();\n this.#keyboardManagerAC = null;\n }\n\n #addCopyPasteListeners() {\n if (this.#copyPasteAC) {\n return;\n }\n this.#copyPasteAC = new AbortController();\n const signal = this.combinedSignal(this.#copyPasteAC);\n\n document.addEventListener(\"copy\", this.copy.bind(this), { signal });\n document.addEventListener(\"cut\", this.cut.bind(this), { signal });\n document.addEventListener(\"paste\", this.paste.bind(this), { signal });\n }\n\n #removeCopyPasteListeners() {\n this.#copyPasteAC?.abort();\n this.#copyPasteAC = null;\n }\n\n #addDragAndDropListeners() {\n const signal = this._signal;\n document.addEventListener(\"dragover\", this.dragOver.bind(this), { signal });\n document.addEventListener(\"drop\", this.drop.bind(this), { signal });\n }\n\n addEditListeners() {\n this.#addKeyboardManager();\n this.#addCopyPasteListeners();\n }\n\n removeEditListeners() {\n this.#removeKeyboardManager();\n this.#removeCopyPasteListeners();\n }\n\n dragOver(event) {\n for (const { type } of event.dataTransfer.items) {\n for (const editorType of this.#editorTypes) {\n if (editorType.isHandlingMimeForPasting(type)) {\n event.dataTransfer.dropEffect = \"copy\";\n event.preventDefault();\n return;\n }\n }\n }\n }\n\n /**\n * Drop callback.\n * @param {DragEvent} event\n */\n drop(event) {\n for (const item of event.dataTransfer.items) {\n for (const editorType of this.#editorTypes) {\n if (editorType.isHandlingMimeForPasting(item.type)) {\n editorType.paste(item, this.currentLayer);\n event.preventDefault();\n return;\n }\n }\n }\n }\n\n /**\n * Copy callback.\n * @param {ClipboardEvent} event\n */\n copy(event) {\n event.preventDefault();\n\n // An editor is being edited so just commit it.\n this.#activeEditor?.commitOrRemove();\n\n if (!this.hasSelection) {\n return;\n }\n\n const editors = [];\n for (const editor of this.#selectedEditors) {\n const serialized = editor.serialize(/* isForCopying = */ true);\n if (serialized) {\n editors.push(serialized);\n }\n }\n if (editors.length === 0) {\n return;\n }\n\n event.clipboardData.setData(\"application/pdfjs\", JSON.stringify(editors));\n }\n\n /**\n * Cut callback.\n * @param {ClipboardEvent} event\n */\n cut(event) {\n this.copy(event);\n this.delete();\n }\n\n /**\n * Paste callback.\n * @param {ClipboardEvent} event\n */\n async paste(event) {\n event.preventDefault();\n const { clipboardData } = event;\n for (const item of clipboardData.items) {\n for (const editorType of this.#editorTypes) {\n if (editorType.isHandlingMimeForPasting(item.type)) {\n editorType.paste(item, this.currentLayer);\n return;\n }\n }\n }\n\n let data = clipboardData.getData(\"application/pdfjs\");\n if (!data) {\n return;\n }\n\n try {\n data = JSON.parse(data);\n } catch (ex) {\n warn(`paste: \"${ex.message}\".`);\n return;\n }\n\n if (!Array.isArray(data)) {\n return;\n }\n\n this.unselectAll();\n const layer = this.currentLayer;\n\n try {\n const newEditors = [];\n for (const editor of data) {\n const deserializedEditor = await layer.deserialize(editor);\n if (!deserializedEditor) {\n return;\n }\n newEditors.push(deserializedEditor);\n }\n\n const cmd = () => {\n for (const editor of newEditors) {\n this.#addEditorToLayer(editor);\n }\n this.#selectEditors(newEditors);\n };\n const undo = () => {\n for (const editor of newEditors) {\n editor.remove();\n }\n };\n this.addCommands({ cmd, undo, mustExec: true });\n } catch (ex) {\n warn(`paste: \"${ex.message}\".`);\n }\n }\n\n /**\n * Keydown callback.\n * @param {KeyboardEvent} event\n */\n keydown(event) {\n if (!this.isShiftKeyDown && event.key === \"Shift\") {\n this.isShiftKeyDown = true;\n }\n if (\n this.#mode !== AnnotationEditorType.NONE &&\n !this.isEditorHandlingKeyboard\n ) {\n AnnotationEditorUIManager._keyboardManager.exec(this, event);\n }\n }\n\n /**\n * Keyup callback.\n * @param {KeyboardEvent} event\n */\n keyup(event) {\n if (this.isShiftKeyDown && event.key === \"Shift\") {\n this.isShiftKeyDown = false;\n if (this.#highlightWhenShiftUp) {\n this.#highlightWhenShiftUp = false;\n this.#onSelectEnd(\"main_toolbar\");\n }\n }\n }\n\n /**\n * Execute an action for a given name.\n * For example, the user can click on the \"Undo\" entry in the context menu\n * and it'll trigger the undo action.\n */\n onEditingAction({ name }) {\n switch (name) {\n case \"undo\":\n case \"redo\":\n case \"delete\":\n case \"selectAll\":\n this[name]();\n break;\n case \"highlightSelection\":\n this.highlightSelection(\"context_menu\");\n break;\n }\n }\n\n /**\n * Update the different possible states of this manager, e.g. is there\n * something to undo, redo, ...\n * @param {Object} details\n */\n #dispatchUpdateStates(details) {\n const hasChanged = Object.entries(details).some(\n ([key, value]) => this.#previousStates[key] !== value\n );\n\n if (hasChanged) {\n this._eventBus.dispatch(\"annotationeditorstateschanged\", {\n source: this,\n details: Object.assign(this.#previousStates, details),\n });\n // We could listen on our own event but it sounds like a bit weird and\n // it's a way to simpler to handle that stuff here instead of having to\n // add something in every place where an editor can be unselected.\n if (\n this.#mode === AnnotationEditorType.HIGHLIGHT &&\n details.hasSelectedEditor === false\n ) {\n this.#dispatchUpdateUI([\n [AnnotationEditorParamsType.HIGHLIGHT_FREE, true],\n ]);\n }\n }\n }\n\n #dispatchUpdateUI(details) {\n this._eventBus.dispatch(\"annotationeditorparamschanged\", {\n source: this,\n details,\n });\n }\n\n /**\n * Set the editing state.\n * It can be useful to temporarily disable it when the user is editing a\n * FreeText annotation.\n * @param {boolean} isEditing\n */\n setEditingState(isEditing) {\n if (isEditing) {\n this.#addFocusManager();\n this.#addCopyPasteListeners();\n this.#dispatchUpdateStates({\n isEditing: this.#mode !== AnnotationEditorType.NONE,\n isEmpty: this.#isEmpty(),\n hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),\n hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),\n hasSelectedEditor: false,\n });\n } else {\n this.#removeFocusManager();\n this.#removeCopyPasteListeners();\n this.#dispatchUpdateStates({\n isEditing: false,\n });\n this.disableUserSelect(false);\n }\n }\n\n registerEditorTypes(types) {\n if (this.#editorTypes) {\n return;\n }\n this.#editorTypes = types;\n for (const editorType of this.#editorTypes) {\n this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);\n }\n }\n\n /**\n * Get an id.\n * @returns {string}\n */\n getId() {\n return this.#idManager.id;\n }\n\n get currentLayer() {\n return this.#allLayers.get(this.#currentPageIndex);\n }\n\n getLayer(pageIndex) {\n return this.#allLayers.get(pageIndex);\n }\n\n get currentPageIndex() {\n return this.#currentPageIndex;\n }\n\n /**\n * Add a new layer for a page which will contains the editors.\n * @param {AnnotationEditorLayer} layer\n */\n addLayer(layer) {\n this.#allLayers.set(layer.pageIndex, layer);\n if (this.#isEnabled) {\n layer.enable();\n } else {\n layer.disable();\n }\n }\n\n /**\n * Remove a layer.\n * @param {AnnotationEditorLayer} layer\n */\n removeLayer(layer) {\n this.#allLayers.delete(layer.pageIndex);\n }\n\n /**\n * Change the editor mode (None, FreeText, Ink, ...)\n * @param {number} mode\n * @param {string|null} editId\n * @param {boolean} [isFromKeyboard] - true if the mode change is due to a\n * keyboard action.\n */\n async updateMode(mode, editId = null, isFromKeyboard = false) {\n if (this.#mode === mode) {\n return;\n }\n\n if (this.#updateModeCapability) {\n await this.#updateModeCapability.promise;\n if (!this.#updateModeCapability) {\n // This ui manager has been destroyed.\n return;\n }\n }\n\n this.#updateModeCapability = Promise.withResolvers();\n\n this.#mode = mode;\n if (mode === AnnotationEditorType.NONE) {\n this.setEditingState(false);\n this.#disableAll();\n\n this._editorUndoBar?.hide();\n\n this.#updateModeCapability.resolve();\n return;\n }\n this.setEditingState(true);\n await this.#enableAll();\n this.unselectAll();\n for (const layer of this.#allLayers.values()) {\n layer.updateMode(mode);\n }\n if (!editId) {\n if (isFromKeyboard) {\n this.addNewEditorFromKeyboard();\n }\n\n this.#updateModeCapability.resolve();\n return;\n }\n\n for (const editor of this.#allEditors.values()) {\n if (editor.annotationElementId === editId) {\n this.setSelected(editor);\n editor.enterInEditMode();\n } else {\n editor.unselect();\n }\n }\n\n this.#updateModeCapability.resolve();\n }\n\n addNewEditorFromKeyboard() {\n if (this.currentLayer.canCreateNewEmptyEditor()) {\n this.currentLayer.addNewEditor();\n }\n }\n\n /**\n * Update the toolbar if it's required to reflect the tool currently used.\n * @param {number} mode\n * @returns {undefined}\n */\n updateToolbar(mode) {\n if (mode === this.#mode) {\n return;\n }\n this._eventBus.dispatch(\"switchannotationeditormode\", {\n source: this,\n mode,\n });\n }\n\n /**\n * Update a parameter in the current editor or globally.\n * @param {number} type\n * @param {*} value\n */\n updateParams(type, value) {\n if (!this.#editorTypes) {\n return;\n }\n\n switch (type) {\n case AnnotationEditorParamsType.CREATE:\n this.currentLayer.addNewEditor();\n return;\n case AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:\n this.#mainHighlightColorPicker?.updateColor(value);\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:\n this._eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data: {\n type: \"highlight\",\n action: \"toggle_visibility\",\n },\n },\n });\n (this.#showAllStates ||= new Map()).set(type, value);\n this.showAllEditors(\"highlight\", value);\n break;\n }\n\n for (const editor of this.#selectedEditors) {\n editor.updateParams(type, value);\n }\n\n for (const editorType of this.#editorTypes) {\n editorType.updateDefaultParams(type, value);\n }\n }\n\n showAllEditors(type, visible, updateButton = false) {\n for (const editor of this.#allEditors.values()) {\n if (editor.editorType === type) {\n editor.show(visible);\n }\n }\n const state =\n this.#showAllStates?.get(AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL) ??\n true;\n if (state !== visible) {\n this.#dispatchUpdateUI([\n [AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL, visible],\n ]);\n }\n }\n\n enableWaiting(mustWait = false) {\n if (this.#isWaiting === mustWait) {\n return;\n }\n this.#isWaiting = mustWait;\n for (const layer of this.#allLayers.values()) {\n if (mustWait) {\n layer.disableClick();\n } else {\n layer.enableClick();\n }\n layer.div.classList.toggle(\"waiting\", mustWait);\n }\n }\n\n /**\n * Enable all the layers.\n */\n async #enableAll() {\n if (!this.#isEnabled) {\n this.#isEnabled = true;\n const promises = [];\n for (const layer of this.#allLayers.values()) {\n promises.push(layer.enable());\n }\n await Promise.all(promises);\n for (const editor of this.#allEditors.values()) {\n editor.enable();\n }\n }\n }\n\n /**\n * Disable all the layers.\n */\n #disableAll() {\n this.unselectAll();\n if (this.#isEnabled) {\n this.#isEnabled = false;\n for (const layer of this.#allLayers.values()) {\n layer.disable();\n }\n for (const editor of this.#allEditors.values()) {\n editor.disable();\n }\n }\n }\n\n /**\n * Get all the editors belonging to a given page.\n * @param {number} pageIndex\n * @returns {Array}\n */\n getEditors(pageIndex) {\n const editors = [];\n for (const editor of this.#allEditors.values()) {\n if (editor.pageIndex === pageIndex) {\n editors.push(editor);\n }\n }\n return editors;\n }\n\n /**\n * Get an editor with the given id.\n * @param {string} id\n * @returns {AnnotationEditor}\n */\n getEditor(id) {\n return this.#allEditors.get(id);\n }\n\n /**\n * Add a new editor.\n * @param {AnnotationEditor} editor\n */\n addEditor(editor) {\n this.#allEditors.set(editor.id, editor);\n }\n\n /**\n * Remove an editor.\n * @param {AnnotationEditor} editor\n */\n removeEditor(editor) {\n if (editor.div.contains(document.activeElement)) {\n if (this.#focusMainContainerTimeoutId) {\n clearTimeout(this.#focusMainContainerTimeoutId);\n }\n this.#focusMainContainerTimeoutId = setTimeout(() => {\n // When the div is removed from DOM the focus can move on the\n // document.body, so we need to move it back to the main container.\n this.focusMainContainer();\n this.#focusMainContainerTimeoutId = null;\n }, 0);\n }\n this.#allEditors.delete(editor.id);\n this.unselect(editor);\n if (\n !editor.annotationElementId ||\n !this.#deletedAnnotationsElementIds.has(editor.annotationElementId)\n ) {\n this.#annotationStorage?.remove(editor.id);\n }\n }\n\n /**\n * The annotation element with the given id has been deleted.\n * @param {AnnotationEditor} editor\n */\n addDeletedAnnotationElement(editor) {\n this.#deletedAnnotationsElementIds.add(editor.annotationElementId);\n this.addChangedExistingAnnotation(editor);\n editor.deleted = true;\n }\n\n /**\n * Check if the annotation element with the given id has been deleted.\n * @param {string} annotationElementId\n * @returns {boolean}\n */\n isDeletedAnnotationElement(annotationElementId) {\n return this.#deletedAnnotationsElementIds.has(annotationElementId);\n }\n\n /**\n * The annotation element with the given id have been restored.\n * @param {AnnotationEditor} editor\n */\n removeDeletedAnnotationElement(editor) {\n this.#deletedAnnotationsElementIds.delete(editor.annotationElementId);\n this.removeChangedExistingAnnotation(editor);\n editor.deleted = false;\n }\n\n /**\n * Add an editor to the layer it belongs to or add it to the global map.\n * @param {AnnotationEditor} editor\n */\n #addEditorToLayer(editor) {\n const layer = this.#allLayers.get(editor.pageIndex);\n if (layer) {\n layer.addOrRebuild(editor);\n } else {\n this.addEditor(editor);\n this.addToAnnotationStorage(editor);\n }\n }\n\n /**\n * Set the given editor as the active one.\n * @param {AnnotationEditor} editor\n */\n setActiveEditor(editor) {\n if (this.#activeEditor === editor) {\n return;\n }\n\n this.#activeEditor = editor;\n if (editor) {\n this.#dispatchUpdateUI(editor.propertiesToUpdate);\n }\n }\n\n get #lastSelectedEditor() {\n let ed = null;\n for (ed of this.#selectedEditors) {\n // Iterate to get the last element.\n }\n return ed;\n }\n\n /**\n * Update the UI of the active editor.\n * @param {AnnotationEditor} editor\n */\n updateUI(editor) {\n if (this.#lastSelectedEditor === editor) {\n this.#dispatchUpdateUI(editor.propertiesToUpdate);\n }\n }\n\n updateUIForDefaultProperties(editorType) {\n this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);\n }\n\n /**\n * Add or remove an editor the current selection.\n * @param {AnnotationEditor} editor\n */\n toggleSelected(editor) {\n if (this.#selectedEditors.has(editor)) {\n this.#selectedEditors.delete(editor);\n editor.unselect();\n this.#dispatchUpdateStates({\n hasSelectedEditor: this.hasSelection,\n });\n return;\n }\n this.#selectedEditors.add(editor);\n editor.select();\n this.#dispatchUpdateUI(editor.propertiesToUpdate);\n this.#dispatchUpdateStates({\n hasSelectedEditor: true,\n });\n }\n\n /**\n * Set the last selected editor.\n * @param {AnnotationEditor} editor\n */\n setSelected(editor) {\n this.#currentDrawingSession?.commitOrRemove();\n for (const ed of this.#selectedEditors) {\n if (ed !== editor) {\n ed.unselect();\n }\n }\n this.#selectedEditors.clear();\n\n this.#selectedEditors.add(editor);\n editor.select();\n this.#dispatchUpdateUI(editor.propertiesToUpdate);\n this.#dispatchUpdateStates({\n hasSelectedEditor: true,\n });\n }\n\n /**\n * Check if the editor is selected.\n * @param {AnnotationEditor} editor\n */\n isSelected(editor) {\n return this.#selectedEditors.has(editor);\n }\n\n get firstSelectedEditor() {\n return this.#selectedEditors.values().next().value;\n }\n\n /**\n * Unselect an editor.\n * @param {AnnotationEditor} editor\n */\n unselect(editor) {\n editor.unselect();\n this.#selectedEditors.delete(editor);\n this.#dispatchUpdateStates({\n hasSelectedEditor: this.hasSelection,\n });\n }\n\n get hasSelection() {\n return this.#selectedEditors.size !== 0;\n }\n\n get isEnterHandled() {\n return (\n this.#selectedEditors.size === 1 &&\n this.firstSelectedEditor.isEnterHandled\n );\n }\n\n /**\n * Undo the last command.\n */\n undo() {\n this.#commandManager.undo();\n this.#dispatchUpdateStates({\n hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),\n hasSomethingToRedo: true,\n isEmpty: this.#isEmpty(),\n });\n this._editorUndoBar?.hide();\n }\n\n /**\n * Redo the last undoed command.\n */\n redo() {\n this.#commandManager.redo();\n this.#dispatchUpdateStates({\n hasSomethingToUndo: true,\n hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),\n isEmpty: this.#isEmpty(),\n });\n }\n\n /**\n * Add a command to execute (cmd) and another one to undo it.\n * @param {Object} params\n */\n addCommands(params) {\n this.#commandManager.add(params);\n this.#dispatchUpdateStates({\n hasSomethingToUndo: true,\n hasSomethingToRedo: false,\n isEmpty: this.#isEmpty(),\n });\n }\n\n cleanUndoStack(type) {\n this.#commandManager.cleanType(type);\n }\n\n #isEmpty() {\n if (this.#allEditors.size === 0) {\n return true;\n }\n\n if (this.#allEditors.size === 1) {\n for (const editor of this.#allEditors.values()) {\n return editor.isEmpty();\n }\n }\n\n return false;\n }\n\n /**\n * Delete the current editor or all.\n */\n delete() {\n this.commitOrRemove();\n const drawingEditor = this.currentLayer?.endDrawingSession(\n /* isAborted = */ true\n );\n if (!this.hasSelection && !drawingEditor) {\n return;\n }\n\n const editors = drawingEditor\n ? [drawingEditor]\n : [...this.#selectedEditors];\n const cmd = () => {\n this._editorUndoBar?.show(\n undo,\n editors.length === 1 ? editors[0].editorType : editors.length\n );\n for (const editor of editors) {\n editor.remove();\n }\n };\n const undo = () => {\n for (const editor of editors) {\n this.#addEditorToLayer(editor);\n }\n };\n\n this.addCommands({ cmd, undo, mustExec: true });\n }\n\n commitOrRemove() {\n // An editor is being edited so just commit it.\n this.#activeEditor?.commitOrRemove();\n }\n\n hasSomethingToControl() {\n return this.#activeEditor || this.hasSelection;\n }\n\n /**\n * Select the editors.\n * @param {Array} editors\n */\n #selectEditors(editors) {\n for (const editor of this.#selectedEditors) {\n editor.unselect();\n }\n this.#selectedEditors.clear();\n for (const editor of editors) {\n if (editor.isEmpty()) {\n continue;\n }\n this.#selectedEditors.add(editor);\n editor.select();\n }\n this.#dispatchUpdateStates({ hasSelectedEditor: this.hasSelection });\n }\n\n /**\n * Select all the editors.\n */\n selectAll() {\n for (const editor of this.#selectedEditors) {\n editor.commit();\n }\n this.#selectEditors(this.#allEditors.values());\n }\n\n /**\n * Unselect all the selected editors.\n */\n unselectAll() {\n if (this.#activeEditor) {\n // An editor is being edited so just commit it.\n this.#activeEditor.commitOrRemove();\n if (this.#mode !== AnnotationEditorType.NONE) {\n // If the mode is NONE, we want to really unselect the editor, hence we\n // mustn't return here.\n return;\n }\n }\n\n if (this.#currentDrawingSession?.commitOrRemove()) {\n return;\n }\n\n if (!this.hasSelection) {\n return;\n }\n for (const editor of this.#selectedEditors) {\n editor.unselect();\n }\n this.#selectedEditors.clear();\n this.#dispatchUpdateStates({\n hasSelectedEditor: false,\n });\n }\n\n translateSelectedEditors(x, y, noCommit = false) {\n if (!noCommit) {\n this.commitOrRemove();\n }\n if (!this.hasSelection) {\n return;\n }\n\n this.#translation[0] += x;\n this.#translation[1] += y;\n const [totalX, totalY] = this.#translation;\n const editors = [...this.#selectedEditors];\n\n // We don't want to have an undo/redo for each translation so we wait a bit\n // before adding the command to the command manager.\n const TIME_TO_WAIT = 1000;\n\n if (this.#translationTimeoutId) {\n clearTimeout(this.#translationTimeoutId);\n }\n\n this.#translationTimeoutId = setTimeout(() => {\n this.#translationTimeoutId = null;\n this.#translation[0] = this.#translation[1] = 0;\n\n this.addCommands({\n cmd: () => {\n for (const editor of editors) {\n if (this.#allEditors.has(editor.id)) {\n editor.translateInPage(totalX, totalY);\n }\n }\n },\n undo: () => {\n for (const editor of editors) {\n if (this.#allEditors.has(editor.id)) {\n editor.translateInPage(-totalX, -totalY);\n }\n }\n },\n mustExec: false,\n });\n }, TIME_TO_WAIT);\n\n for (const editor of editors) {\n editor.translateInPage(x, y);\n }\n }\n\n /**\n * Set up the drag session for moving the selected editors.\n */\n setUpDragSession() {\n // Note: don't use any references to the editor's parent which can be null\n // if the editor belongs to a destroyed page.\n if (!this.hasSelection) {\n return;\n }\n // Avoid to have spurious text selection in the text layer when dragging.\n this.disableUserSelect(true);\n this.#draggingEditors = new Map();\n for (const editor of this.#selectedEditors) {\n this.#draggingEditors.set(editor, {\n savedX: editor.x,\n savedY: editor.y,\n savedPageIndex: editor.pageIndex,\n newX: 0,\n newY: 0,\n newPageIndex: -1,\n });\n }\n }\n\n /**\n * Ends the drag session.\n * @returns {boolean} true if at least one editor has been moved.\n */\n endDragSession() {\n if (!this.#draggingEditors) {\n return false;\n }\n this.disableUserSelect(false);\n const map = this.#draggingEditors;\n this.#draggingEditors = null;\n let mustBeAddedInUndoStack = false;\n\n for (const [{ x, y, pageIndex }, value] of map) {\n value.newX = x;\n value.newY = y;\n value.newPageIndex = pageIndex;\n mustBeAddedInUndoStack ||=\n x !== value.savedX ||\n y !== value.savedY ||\n pageIndex !== value.savedPageIndex;\n }\n\n if (!mustBeAddedInUndoStack) {\n return false;\n }\n\n const move = (editor, x, y, pageIndex) => {\n if (this.#allEditors.has(editor.id)) {\n // The editor can be undone/redone on a page which is not visible (and\n // which potentially has no annotation editor layer), hence we need to\n // use the pageIndex instead of the parent.\n const parent = this.#allLayers.get(pageIndex);\n if (parent) {\n editor._setParentAndPosition(parent, x, y);\n } else {\n editor.pageIndex = pageIndex;\n editor.x = x;\n editor.y = y;\n }\n }\n };\n\n this.addCommands({\n cmd: () => {\n for (const [editor, { newX, newY, newPageIndex }] of map) {\n move(editor, newX, newY, newPageIndex);\n }\n },\n undo: () => {\n for (const [editor, { savedX, savedY, savedPageIndex }] of map) {\n move(editor, savedX, savedY, savedPageIndex);\n }\n },\n mustExec: true,\n });\n\n return true;\n }\n\n /**\n * Drag the set of selected editors.\n * @param {number} tx\n * @param {number} ty\n */\n dragSelectedEditors(tx, ty) {\n if (!this.#draggingEditors) {\n return;\n }\n for (const editor of this.#draggingEditors.keys()) {\n editor.drag(tx, ty);\n }\n }\n\n /**\n * Rebuild the editor (usually on undo/redo actions) on a potentially\n * non-rendered page.\n * @param {AnnotationEditor} editor\n */\n rebuild(editor) {\n if (editor.parent === null) {\n const parent = this.getLayer(editor.pageIndex);\n if (parent) {\n parent.changeParent(editor);\n parent.addOrRebuild(editor);\n } else {\n this.addEditor(editor);\n this.addToAnnotationStorage(editor);\n editor.rebuild();\n }\n } else {\n editor.parent.addOrRebuild(editor);\n }\n }\n\n get isEditorHandlingKeyboard() {\n return (\n this.getActive()?.shouldGetKeyboardEvents() ||\n (this.#selectedEditors.size === 1 &&\n this.firstSelectedEditor.shouldGetKeyboardEvents())\n );\n }\n\n /**\n * Is the current editor the one passed as argument?\n * @param {AnnotationEditor} editor\n * @returns\n */\n isActive(editor) {\n return this.#activeEditor === editor;\n }\n\n /**\n * Get the current active editor.\n * @returns {AnnotationEditor|null}\n */\n getActive() {\n return this.#activeEditor;\n }\n\n /**\n * Get the current editor mode.\n * @returns {number}\n */\n getMode() {\n return this.#mode;\n }\n\n get imageManager() {\n return shadow(this, \"imageManager\", new ImageManager());\n }\n\n getSelectionBoxes(textLayer) {\n if (!textLayer) {\n return null;\n }\n const selection = document.getSelection();\n for (let i = 0, ii = selection.rangeCount; i < ii; i++) {\n if (\n !textLayer.contains(selection.getRangeAt(i).commonAncestorContainer)\n ) {\n return null;\n }\n }\n\n const {\n x: layerX,\n y: layerY,\n width: parentWidth,\n height: parentHeight,\n } = textLayer.getBoundingClientRect();\n\n // We must rotate the boxes because we want to have them in the non-rotated\n // page coordinates.\n let rotator;\n switch (textLayer.getAttribute(\"data-main-rotation\")) {\n case \"90\":\n rotator = (x, y, w, h) => ({\n x: (y - layerY) / parentHeight,\n y: 1 - (x + w - layerX) / parentWidth,\n width: h / parentHeight,\n height: w / parentWidth,\n });\n break;\n case \"180\":\n rotator = (x, y, w, h) => ({\n x: 1 - (x + w - layerX) / parentWidth,\n y: 1 - (y + h - layerY) / parentHeight,\n width: w / parentWidth,\n height: h / parentHeight,\n });\n break;\n case \"270\":\n rotator = (x, y, w, h) => ({\n x: 1 - (y + h - layerY) / parentHeight,\n y: (x - layerX) / parentWidth,\n width: h / parentHeight,\n height: w / parentWidth,\n });\n break;\n default:\n rotator = (x, y, w, h) => ({\n x: (x - layerX) / parentWidth,\n y: (y - layerY) / parentHeight,\n width: w / parentWidth,\n height: h / parentHeight,\n });\n break;\n }\n\n const boxes = [];\n for (let i = 0, ii = selection.rangeCount; i < ii; i++) {\n const range = selection.getRangeAt(i);\n if (range.collapsed) {\n continue;\n }\n for (const { x, y, width, height } of range.getClientRects()) {\n if (width === 0 || height === 0) {\n continue;\n }\n boxes.push(rotator(x, y, width, height));\n }\n }\n return boxes.length === 0 ? null : boxes;\n }\n\n addChangedExistingAnnotation({ annotationElementId, id }) {\n (this.#changedExistingAnnotations ||= new Map()).set(\n annotationElementId,\n id\n );\n }\n\n removeChangedExistingAnnotation({ annotationElementId }) {\n this.#changedExistingAnnotations?.delete(annotationElementId);\n }\n\n renderAnnotationElement(annotation) {\n const editorId = this.#changedExistingAnnotations?.get(annotation.data.id);\n if (!editorId) {\n return;\n }\n const editor = this.#annotationStorage.getRawValue(editorId);\n if (!editor) {\n return;\n }\n if (this.#mode === AnnotationEditorType.NONE && !editor.hasBeenModified) {\n return;\n }\n editor.renderAnnotationElement(annotation);\n }\n}\n\nexport {\n AnnotationEditorUIManager,\n bindEvents,\n ColorManager,\n CommandManager,\n KeyboardManager,\n opacityToHex,\n};\n","/* Copyright 2023 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\nimport { noContextMenu } from \"../display_utils.js\";\n\nclass AltText {\n #altText = null;\n\n #altTextDecorative = false;\n\n #altTextButton = null;\n\n #altTextButtonLabel = null;\n\n #altTextTooltip = null;\n\n #altTextTooltipTimeout = null;\n\n #altTextWasFromKeyBoard = false;\n\n #badge = null;\n\n #editor = null;\n\n #guessedText = null;\n\n #textWithDisclaimer = null;\n\n #useNewAltTextFlow = false;\n\n static #l10nNewButton = null;\n\n static _l10n = null;\n\n constructor(editor) {\n this.#editor = editor;\n this.#useNewAltTextFlow = editor._uiManager.useNewAltTextFlow;\n\n AltText.#l10nNewButton ||= Object.freeze({\n added: \"pdfjs-editor-new-alt-text-added-button\",\n \"added-label\": \"pdfjs-editor-new-alt-text-added-button-label\",\n missing: \"pdfjs-editor-new-alt-text-missing-button\",\n \"missing-label\": \"pdfjs-editor-new-alt-text-missing-button-label\",\n review: \"pdfjs-editor-new-alt-text-to-review-button\",\n \"review-label\": \"pdfjs-editor-new-alt-text-to-review-button-label\",\n });\n }\n\n static initialize(l10n) {\n AltText._l10n ??= l10n;\n }\n\n async render() {\n const altText = (this.#altTextButton = document.createElement(\"button\"));\n altText.className = \"altText\";\n altText.tabIndex = \"0\";\n\n const label = (this.#altTextButtonLabel = document.createElement(\"span\"));\n altText.append(label);\n\n if (this.#useNewAltTextFlow) {\n altText.classList.add(\"new\");\n altText.setAttribute(\"data-l10n-id\", AltText.#l10nNewButton.missing);\n label.setAttribute(\n \"data-l10n-id\",\n AltText.#l10nNewButton[\"missing-label\"]\n );\n } else {\n altText.setAttribute(\"data-l10n-id\", \"pdfjs-editor-alt-text-button\");\n label.setAttribute(\"data-l10n-id\", \"pdfjs-editor-alt-text-button-label\");\n }\n\n const signal = this.#editor._uiManager._signal;\n altText.addEventListener(\"contextmenu\", noContextMenu, { signal });\n altText.addEventListener(\"pointerdown\", event => event.stopPropagation(), {\n signal,\n });\n\n const onClick = event => {\n event.preventDefault();\n this.#editor._uiManager.editAltText(this.#editor);\n if (this.#useNewAltTextFlow) {\n this.#editor._reportTelemetry({\n action: \"pdfjs.image.alt_text.image_status_label_clicked\",\n data: { label: this.#label },\n });\n }\n };\n altText.addEventListener(\"click\", onClick, { capture: true, signal });\n altText.addEventListener(\n \"keydown\",\n event => {\n if (event.target === altText && event.key === \"Enter\") {\n this.#altTextWasFromKeyBoard = true;\n onClick(event);\n }\n },\n { signal }\n );\n await this.#setState();\n\n return altText;\n }\n\n get #label() {\n return (\n (this.#altText && \"added\") ||\n (this.#altText === null && this.guessedText && \"review\") ||\n \"missing\"\n );\n }\n\n finish() {\n if (!this.#altTextButton) {\n return;\n }\n this.#altTextButton.focus({ focusVisible: this.#altTextWasFromKeyBoard });\n this.#altTextWasFromKeyBoard = false;\n }\n\n isEmpty() {\n if (this.#useNewAltTextFlow) {\n return this.#altText === null;\n }\n return !this.#altText && !this.#altTextDecorative;\n }\n\n hasData() {\n if (this.#useNewAltTextFlow) {\n return this.#altText !== null || !!this.#guessedText;\n }\n return this.isEmpty();\n }\n\n get guessedText() {\n return this.#guessedText;\n }\n\n async setGuessedText(guessedText) {\n if (this.#altText !== null) {\n // The user provided their own alt text, so we don't want to overwrite it.\n return;\n }\n this.#guessedText = guessedText;\n this.#textWithDisclaimer = await AltText._l10n.get(\n \"pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer\",\n { generatedAltText: guessedText }\n );\n this.#setState();\n }\n\n toggleAltTextBadge(visibility = false) {\n if (!this.#useNewAltTextFlow || this.#altText) {\n this.#badge?.remove();\n this.#badge = null;\n return;\n }\n if (!this.#badge) {\n const badge = (this.#badge = document.createElement(\"div\"));\n badge.className = \"noAltTextBadge\";\n this.#editor.div.append(badge);\n }\n this.#badge.classList.toggle(\"hidden\", !visibility);\n }\n\n serialize(isForCopying) {\n let altText = this.#altText;\n if (!isForCopying && this.#guessedText === altText) {\n altText = this.#textWithDisclaimer;\n }\n return {\n altText,\n decorative: this.#altTextDecorative,\n guessedText: this.#guessedText,\n textWithDisclaimer: this.#textWithDisclaimer,\n };\n }\n\n get data() {\n return {\n altText: this.#altText,\n decorative: this.#altTextDecorative,\n };\n }\n\n /**\n * Set the alt text data.\n */\n set data({\n altText,\n decorative,\n guessedText,\n textWithDisclaimer,\n cancel = false,\n }) {\n if (guessedText) {\n this.#guessedText = guessedText;\n this.#textWithDisclaimer = textWithDisclaimer;\n }\n if (this.#altText === altText && this.#altTextDecorative === decorative) {\n return;\n }\n if (!cancel) {\n this.#altText = altText;\n this.#altTextDecorative = decorative;\n }\n this.#setState();\n }\n\n toggle(enabled = false) {\n if (!this.#altTextButton) {\n return;\n }\n if (!enabled && this.#altTextTooltipTimeout) {\n clearTimeout(this.#altTextTooltipTimeout);\n this.#altTextTooltipTimeout = null;\n }\n this.#altTextButton.disabled = !enabled;\n }\n\n shown() {\n this.#editor._reportTelemetry({\n action: \"pdfjs.image.alt_text.image_status_label_displayed\",\n data: { label: this.#label },\n });\n }\n\n destroy() {\n this.#altTextButton?.remove();\n this.#altTextButton = null;\n this.#altTextButtonLabel = null;\n this.#altTextTooltip = null;\n this.#badge?.remove();\n this.#badge = null;\n }\n\n async #setState() {\n const button = this.#altTextButton;\n if (!button) {\n return;\n }\n\n if (this.#useNewAltTextFlow) {\n button.classList.toggle(\"done\", !!this.#altText);\n button.setAttribute(\"data-l10n-id\", AltText.#l10nNewButton[this.#label]);\n\n this.#altTextButtonLabel?.setAttribute(\n \"data-l10n-id\",\n AltText.#l10nNewButton[`${this.#label}-label`]\n );\n if (!this.#altText) {\n this.#altTextTooltip?.remove();\n return;\n }\n } else {\n if (!this.#altText && !this.#altTextDecorative) {\n button.classList.remove(\"done\");\n this.#altTextTooltip?.remove();\n return;\n }\n button.classList.add(\"done\");\n button.setAttribute(\"data-l10n-id\", \"pdfjs-editor-alt-text-edit-button\");\n }\n\n let tooltip = this.#altTextTooltip;\n if (!tooltip) {\n this.#altTextTooltip = tooltip = document.createElement(\"span\");\n tooltip.className = \"tooltip\";\n tooltip.setAttribute(\"role\", \"tooltip\");\n tooltip.id = `alt-text-tooltip-${this.#editor.id}`;\n\n const DELAY_TO_SHOW_TOOLTIP = 100;\n const signal = this.#editor._uiManager._signal;\n signal.addEventListener(\n \"abort\",\n () => {\n clearTimeout(this.#altTextTooltipTimeout);\n this.#altTextTooltipTimeout = null;\n },\n { once: true }\n );\n button.addEventListener(\n \"mouseenter\",\n () => {\n this.#altTextTooltipTimeout = setTimeout(() => {\n this.#altTextTooltipTimeout = null;\n this.#altTextTooltip.classList.add(\"show\");\n this.#editor._reportTelemetry({\n action: \"alt_text_tooltip\",\n });\n }, DELAY_TO_SHOW_TOOLTIP);\n },\n { signal }\n );\n button.addEventListener(\n \"mouseleave\",\n () => {\n if (this.#altTextTooltipTimeout) {\n clearTimeout(this.#altTextTooltipTimeout);\n this.#altTextTooltipTimeout = null;\n }\n this.#altTextTooltip?.classList.remove(\"show\");\n },\n { signal }\n );\n }\n if (this.#altTextDecorative) {\n tooltip.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-alt-text-decorative-tooltip\"\n );\n } else {\n tooltip.removeAttribute(\"data-l10n-id\");\n tooltip.textContent = this.#altText;\n }\n\n if (!tooltip.parentNode) {\n button.append(tooltip);\n }\n\n const element = this.#editor.getImageForAltText();\n element?.setAttribute(\"aria-describedby\", tooltip.id);\n }\n}\n\nexport { AltText };\n","/* Copyright 2022 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// eslint-disable-next-line max-len\n/** @typedef {import(\"./annotation_editor_layer.js\").AnnotationEditorLayer} AnnotationEditorLayer */\n\nimport {\n AnnotationEditorUIManager,\n bindEvents,\n ColorManager,\n KeyboardManager,\n} from \"./tools.js\";\nimport { FeatureTest, shadow, unreachable } from \"../../shared/util.js\";\nimport { noContextMenu, stopEvent } from \"../display_utils.js\";\nimport { AltText } from \"./alt_text.js\";\nimport { EditorToolbar } from \"./toolbar.js\";\n\n/**\n * @typedef {Object} AnnotationEditorParameters\n * @property {AnnotationEditorUIManager} uiManager - the global manager\n * @property {AnnotationEditorLayer} parent - the layer containing this editor\n * @property {string} id - editor id\n * @property {number} x - x-coordinate\n * @property {number} y - y-coordinate\n */\n\n/**\n * Base class for editors.\n */\nclass AnnotationEditor {\n #accessibilityData = null;\n\n #allResizerDivs = null;\n\n #altText = null;\n\n #disabled = false;\n\n #dragPointerId = null;\n\n #dragPointerType = \"\";\n\n #keepAspectRatio = false;\n\n #resizersDiv = null;\n\n #lastPointerCoords = null;\n\n #savedDimensions = null;\n\n #focusAC = null;\n\n #focusedResizerName = \"\";\n\n #hasBeenClicked = false;\n\n #initialRect = null;\n\n #isEditing = false;\n\n #isInEditMode = false;\n\n #isResizerEnabledForKeyboard = false;\n\n #moveInDOMTimeout = null;\n\n #prevDragX = 0;\n\n #prevDragY = 0;\n\n #telemetryTimeouts = null;\n\n _editToolbar = null;\n\n _initialOptions = Object.create(null);\n\n _initialData = null;\n\n _isVisible = true;\n\n _uiManager = null;\n\n _focusEventsAllowed = true;\n\n static _l10n = null;\n\n static _l10nResizer = null;\n\n #isDraggable = false;\n\n #zIndex = AnnotationEditor._zIndex++;\n\n static _borderLineWidth = -1;\n\n static _colorManager = new ColorManager();\n\n static _zIndex = 1;\n\n // Time to wait (in ms) before sending the telemetry data.\n // We wait a bit to avoid sending too many requests when changing something\n // like the thickness of a line.\n static _telemetryTimeout = 1000;\n\n static get _resizerKeyboardManager() {\n const resize = AnnotationEditor.prototype._resizeWithKeyboard;\n const small = AnnotationEditorUIManager.TRANSLATE_SMALL;\n const big = AnnotationEditorUIManager.TRANSLATE_BIG;\n\n return shadow(\n this,\n \"_resizerKeyboardManager\",\n new KeyboardManager([\n [[\"ArrowLeft\", \"mac+ArrowLeft\"], resize, { args: [-small, 0] }],\n [\n [\"ctrl+ArrowLeft\", \"mac+shift+ArrowLeft\"],\n resize,\n { args: [-big, 0] },\n ],\n [[\"ArrowRight\", \"mac+ArrowRight\"], resize, { args: [small, 0] }],\n [\n [\"ctrl+ArrowRight\", \"mac+shift+ArrowRight\"],\n resize,\n { args: [big, 0] },\n ],\n [[\"ArrowUp\", \"mac+ArrowUp\"], resize, { args: [0, -small] }],\n [[\"ctrl+ArrowUp\", \"mac+shift+ArrowUp\"], resize, { args: [0, -big] }],\n [[\"ArrowDown\", \"mac+ArrowDown\"], resize, { args: [0, small] }],\n [[\"ctrl+ArrowDown\", \"mac+shift+ArrowDown\"], resize, { args: [0, big] }],\n [\n [\"Escape\", \"mac+Escape\"],\n AnnotationEditor.prototype._stopResizingWithKeyboard,\n ],\n ])\n );\n }\n\n /**\n * @param {AnnotationEditorParameters} parameters\n */\n constructor(parameters) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === AnnotationEditor\n ) {\n unreachable(\"Cannot initialize AnnotationEditor.\");\n }\n\n this.parent = parameters.parent;\n this.id = parameters.id;\n this.width = this.height = null;\n this.pageIndex = parameters.parent.pageIndex;\n this.name = parameters.name;\n this.div = null;\n this._uiManager = parameters.uiManager;\n this.annotationElementId = null;\n this._willKeepAspectRatio = false;\n this._initialOptions.isCentered = parameters.isCentered;\n this._structTreeParentId = null;\n\n const {\n rotation,\n rawDims: { pageWidth, pageHeight, pageX, pageY },\n } = this.parent.viewport;\n\n this.rotation = rotation;\n this.pageRotation =\n (360 + rotation - this._uiManager.viewParameters.rotation) % 360;\n this.pageDimensions = [pageWidth, pageHeight];\n this.pageTranslation = [pageX, pageY];\n\n const [width, height] = this.parentDimensions;\n this.x = parameters.x / width;\n this.y = parameters.y / height;\n\n this.isAttachedToDOM = false;\n this.deleted = false;\n }\n\n get editorType() {\n return Object.getPrototypeOf(this).constructor._type;\n }\n\n static get isDrawer() {\n return false;\n }\n\n static get _defaultLineColor() {\n return shadow(\n this,\n \"_defaultLineColor\",\n this._colorManager.getHexCode(\"CanvasText\")\n );\n }\n\n static deleteAnnotationElement(editor) {\n const fakeEditor = new FakeEditor({\n id: editor.parent.getNextId(),\n parent: editor.parent,\n uiManager: editor._uiManager,\n });\n fakeEditor.annotationElementId = editor.annotationElementId;\n fakeEditor.deleted = true;\n fakeEditor._uiManager.addToAnnotationStorage(fakeEditor);\n }\n\n /**\n * Initialize the l10n stuff for this type of editor.\n * @param {Object} l10n\n */\n static initialize(l10n, _uiManager) {\n AnnotationEditor._l10n ??= l10n;\n\n AnnotationEditor._l10nResizer ||= Object.freeze({\n topLeft: \"pdfjs-editor-resizer-top-left\",\n topMiddle: \"pdfjs-editor-resizer-top-middle\",\n topRight: \"pdfjs-editor-resizer-top-right\",\n middleRight: \"pdfjs-editor-resizer-middle-right\",\n bottomRight: \"pdfjs-editor-resizer-bottom-right\",\n bottomMiddle: \"pdfjs-editor-resizer-bottom-middle\",\n bottomLeft: \"pdfjs-editor-resizer-bottom-left\",\n middleLeft: \"pdfjs-editor-resizer-middle-left\",\n });\n\n if (AnnotationEditor._borderLineWidth !== -1) {\n return;\n }\n const style = getComputedStyle(document.documentElement);\n AnnotationEditor._borderLineWidth =\n parseFloat(style.getPropertyValue(\"--outline-width\")) || 0;\n }\n\n /**\n * Update the default parameters for this type of editor.\n * @param {number} _type\n * @param {*} _value\n */\n static updateDefaultParams(_type, _value) {}\n\n /**\n * Get the default properties to set in the UI for this type of editor.\n * @returns {Array}\n */\n static get defaultPropertiesToUpdate() {\n return [];\n }\n\n /**\n * Check if this kind of editor is able to handle the given mime type for\n * pasting.\n * @param {string} mime\n * @returns {boolean}\n */\n static isHandlingMimeForPasting(mime) {\n return false;\n }\n\n /**\n * Extract the data from the clipboard item and delegate the creation of the\n * editor to the parent.\n * @param {DataTransferItem} item\n * @param {AnnotationEditorLayer} parent\n */\n static paste(item, parent) {\n unreachable(\"Not implemented\");\n }\n\n /**\n * Get the properties to update in the UI for this editor.\n * @returns {Array}\n */\n get propertiesToUpdate() {\n return [];\n }\n\n get _isDraggable() {\n return this.#isDraggable;\n }\n\n set _isDraggable(value) {\n this.#isDraggable = value;\n this.div?.classList.toggle(\"draggable\", value);\n }\n\n /**\n * @returns {boolean} true if the editor handles the Enter key itself.\n */\n get isEnterHandled() {\n return true;\n }\n\n center() {\n const [pageWidth, pageHeight] = this.pageDimensions;\n switch (this.parentRotation) {\n case 90:\n this.x -= (this.height * pageHeight) / (pageWidth * 2);\n this.y += (this.width * pageWidth) / (pageHeight * 2);\n break;\n case 180:\n this.x += this.width / 2;\n this.y += this.height / 2;\n break;\n case 270:\n this.x += (this.height * pageHeight) / (pageWidth * 2);\n this.y -= (this.width * pageWidth) / (pageHeight * 2);\n break;\n default:\n this.x -= this.width / 2;\n this.y -= this.height / 2;\n break;\n }\n this.fixAndSetPosition();\n }\n\n /**\n * Add some commands into the CommandManager (undo/redo stuff).\n * @param {Object} params\n */\n addCommands(params) {\n this._uiManager.addCommands(params);\n }\n\n get currentLayer() {\n return this._uiManager.currentLayer;\n }\n\n /**\n * This editor will be behind the others.\n */\n setInBackground() {\n this.div.style.zIndex = 0;\n }\n\n /**\n * This editor will be in the foreground.\n */\n setInForeground() {\n this.div.style.zIndex = this.#zIndex;\n }\n\n setParent(parent) {\n if (parent !== null) {\n this.pageIndex = parent.pageIndex;\n this.pageDimensions = parent.pageDimensions;\n } else {\n // The editor is being removed from the DOM, so we need to stop resizing.\n this.#stopResizing();\n }\n this.parent = parent;\n }\n\n /**\n * onfocus callback.\n */\n focusin(event) {\n if (!this._focusEventsAllowed) {\n return;\n }\n if (!this.#hasBeenClicked) {\n this.parent.setSelected(this);\n } else {\n this.#hasBeenClicked = false;\n }\n }\n\n /**\n * onblur callback.\n * @param {FocusEvent} event\n */\n focusout(event) {\n if (!this._focusEventsAllowed) {\n return;\n }\n\n if (!this.isAttachedToDOM) {\n return;\n }\n\n // In case of focusout, the relatedTarget is the element which\n // is grabbing the focus.\n // So if the related target is an element under the div for this\n // editor, then the editor isn't unactive.\n const target = event.relatedTarget;\n if (target?.closest(`#${this.id}`)) {\n return;\n }\n\n event.preventDefault();\n\n if (!this.parent?.isMultipleSelection) {\n this.commitOrRemove();\n }\n }\n\n commitOrRemove() {\n if (this.isEmpty()) {\n this.remove();\n } else {\n this.commit();\n }\n }\n\n /**\n * Commit the data contained in this editor.\n */\n commit() {\n this.addToAnnotationStorage();\n }\n\n addToAnnotationStorage() {\n this._uiManager.addToAnnotationStorage(this);\n }\n\n /**\n * Set the editor position within its parent.\n * @param {number} x\n * @param {number} y\n * @param {number} tx - x-translation in screen coordinates.\n * @param {number} ty - y-translation in screen coordinates.\n */\n setAt(x, y, tx, ty) {\n const [width, height] = this.parentDimensions;\n [tx, ty] = this.screenToPageTranslation(tx, ty);\n\n this.x = (x + tx) / width;\n this.y = (y + ty) / height;\n\n this.fixAndSetPosition();\n }\n\n #translate([width, height], x, y) {\n [x, y] = this.screenToPageTranslation(x, y);\n\n this.x += x / width;\n this.y += y / height;\n\n this._onTranslating(this.x, this.y);\n\n this.fixAndSetPosition();\n }\n\n /**\n * Translate the editor position within its parent.\n * @param {number} x - x-translation in screen coordinates.\n * @param {number} y - y-translation in screen coordinates.\n */\n translate(x, y) {\n // We don't change the initial position because the move here hasn't been\n // done by the user.\n this.#translate(this.parentDimensions, x, y);\n }\n\n /**\n * Translate the editor position within its page and adjust the scroll\n * in order to have the editor in the view.\n * @param {number} x - x-translation in page coordinates.\n * @param {number} y - y-translation in page coordinates.\n */\n translateInPage(x, y) {\n this.#initialRect ||= [this.x, this.y, this.width, this.height];\n this.#translate(this.pageDimensions, x, y);\n this.div.scrollIntoView({ block: \"nearest\" });\n }\n\n drag(tx, ty) {\n this.#initialRect ||= [this.x, this.y, this.width, this.height];\n const {\n div,\n parentDimensions: [parentWidth, parentHeight],\n } = this;\n this.x += tx / parentWidth;\n this.y += ty / parentHeight;\n if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {\n // It's possible to not have a parent: for example, when the user is\n // dragging all the selected editors but this one on a page which has been\n // destroyed.\n // It's why we need to check for it. In such a situation, it isn't really\n // a problem to not find a new parent: it's something which is related to\n // what the user is seeing, hence it depends on how pages are layed out.\n\n // The element will be outside of its parent so change the parent.\n const { x, y } = this.div.getBoundingClientRect();\n if (this.parent.findNewParent(this, x, y)) {\n this.x -= Math.floor(this.x);\n this.y -= Math.floor(this.y);\n }\n }\n\n // The editor can be moved wherever the user wants, so we don't need to fix\n // the position: it'll be done when the user will release the mouse button.\n\n let { x, y } = this;\n const [bx, by] = this.getBaseTranslation();\n x += bx;\n y += by;\n\n const { style } = div;\n style.left = `${(100 * x).toFixed(2)}%`;\n style.top = `${(100 * y).toFixed(2)}%`;\n\n this._onTranslating(x, y);\n\n div.scrollIntoView({ block: \"nearest\" });\n }\n\n /**\n * Called when the editor is being translated.\n * @param {number} x - in page coordinates.\n * @param {number} y - in page coordinates.\n */\n _onTranslating(x, y) {}\n\n /**\n * Called when the editor has been translated.\n * @param {number} x - in page coordinates.\n * @param {number} y - in page coordinates.\n */\n _onTranslated(x, y) {}\n\n get _hasBeenMoved() {\n return (\n !!this.#initialRect &&\n (this.#initialRect[0] !== this.x || this.#initialRect[1] !== this.y)\n );\n }\n\n get _hasBeenResized() {\n return (\n !!this.#initialRect &&\n (this.#initialRect[2] !== this.width ||\n this.#initialRect[3] !== this.height)\n );\n }\n\n /**\n * Get the translation to take into account the editor border.\n * The CSS engine positions the element by taking the border into account so\n * we must apply the opposite translation to have the editor in the right\n * position.\n * @returns {Array}\n */\n getBaseTranslation() {\n const [parentWidth, parentHeight] = this.parentDimensions;\n const { _borderLineWidth } = AnnotationEditor;\n const x = _borderLineWidth / parentWidth;\n const y = _borderLineWidth / parentHeight;\n switch (this.rotation) {\n case 90:\n return [-x, y];\n case 180:\n return [x, y];\n case 270:\n return [x, -y];\n default:\n return [-x, -y];\n }\n }\n\n /**\n * @returns {boolean} true if position must be fixed (i.e. make the x and y\n * living in the page).\n */\n get _mustFixPosition() {\n return true;\n }\n\n /**\n * Fix the position of the editor in order to keep it inside its parent page.\n * @param {number} [rotation] - the rotation of the page.\n */\n fixAndSetPosition(rotation = this.rotation) {\n const {\n div: { style },\n pageDimensions: [pageWidth, pageHeight],\n } = this;\n let { x, y, width, height } = this;\n width *= pageWidth;\n height *= pageHeight;\n x *= pageWidth;\n y *= pageHeight;\n\n if (this._mustFixPosition) {\n switch (rotation) {\n case 0:\n x = Math.max(0, Math.min(pageWidth - width, x));\n y = Math.max(0, Math.min(pageHeight - height, y));\n break;\n case 90:\n x = Math.max(0, Math.min(pageWidth - height, x));\n y = Math.min(pageHeight, Math.max(width, y));\n break;\n case 180:\n x = Math.min(pageWidth, Math.max(width, x));\n y = Math.min(pageHeight, Math.max(height, y));\n break;\n case 270:\n x = Math.min(pageWidth, Math.max(height, x));\n y = Math.max(0, Math.min(pageHeight - width, y));\n break;\n }\n }\n\n this.x = x /= pageWidth;\n this.y = y /= pageHeight;\n\n const [bx, by] = this.getBaseTranslation();\n x += bx;\n y += by;\n\n style.left = `${(100 * x).toFixed(2)}%`;\n style.top = `${(100 * y).toFixed(2)}%`;\n\n this.moveInDOM();\n }\n\n static #rotatePoint(x, y, angle) {\n switch (angle) {\n case 90:\n return [y, -x];\n case 180:\n return [-x, -y];\n case 270:\n return [-y, x];\n default:\n return [x, y];\n }\n }\n\n /**\n * Convert a screen translation into a page one.\n * @param {number} x\n * @param {number} y\n */\n screenToPageTranslation(x, y) {\n return AnnotationEditor.#rotatePoint(x, y, this.parentRotation);\n }\n\n /**\n * Convert a page translation into a screen one.\n * @param {number} x\n * @param {number} y\n */\n pageTranslationToScreen(x, y) {\n return AnnotationEditor.#rotatePoint(x, y, 360 - this.parentRotation);\n }\n\n #getRotationMatrix(rotation) {\n switch (rotation) {\n case 90: {\n const [pageWidth, pageHeight] = this.pageDimensions;\n return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];\n }\n case 180:\n return [-1, 0, 0, -1];\n case 270: {\n const [pageWidth, pageHeight] = this.pageDimensions;\n return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];\n }\n default:\n return [1, 0, 0, 1];\n }\n }\n\n get parentScale() {\n return this._uiManager.viewParameters.realScale;\n }\n\n get parentRotation() {\n return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;\n }\n\n get parentDimensions() {\n const {\n parentScale,\n pageDimensions: [pageWidth, pageHeight],\n } = this;\n return [pageWidth * parentScale, pageHeight * parentScale];\n }\n\n /**\n * Set the dimensions of this editor.\n * @param {number} width\n * @param {number} height\n */\n setDims(width, height) {\n const [parentWidth, parentHeight] = this.parentDimensions;\n const { style } = this.div;\n style.width = `${((100 * width) / parentWidth).toFixed(2)}%`;\n if (!this.#keepAspectRatio) {\n style.height = `${((100 * height) / parentHeight).toFixed(2)}%`;\n }\n }\n\n fixDims() {\n const { style } = this.div;\n const { height, width } = style;\n const widthPercent = width.endsWith(\"%\");\n const heightPercent = !this.#keepAspectRatio && height.endsWith(\"%\");\n if (widthPercent && heightPercent) {\n return;\n }\n\n const [parentWidth, parentHeight] = this.parentDimensions;\n if (!widthPercent) {\n style.width = `${((100 * parseFloat(width)) / parentWidth).toFixed(2)}%`;\n }\n if (!this.#keepAspectRatio && !heightPercent) {\n style.height = `${((100 * parseFloat(height)) / parentHeight).toFixed(2)}%`;\n }\n }\n\n /**\n * Get the translation used to position this editor when it's created.\n * @returns {Array}\n */\n getInitialTranslation() {\n return [0, 0];\n }\n\n #createResizers() {\n if (this.#resizersDiv) {\n return;\n }\n this.#resizersDiv = document.createElement(\"div\");\n this.#resizersDiv.classList.add(\"resizers\");\n // When the resizers are used with the keyboard, they're focusable, hence\n // we want to have them in this order (top left, top middle, top right, ...)\n // in the DOM to have the focus order correct.\n const classes = this._willKeepAspectRatio\n ? [\"topLeft\", \"topRight\", \"bottomRight\", \"bottomLeft\"]\n : [\n \"topLeft\",\n \"topMiddle\",\n \"topRight\",\n \"middleRight\",\n \"bottomRight\",\n \"bottomMiddle\",\n \"bottomLeft\",\n \"middleLeft\",\n ];\n const signal = this._uiManager._signal;\n for (const name of classes) {\n const div = document.createElement(\"div\");\n this.#resizersDiv.append(div);\n div.classList.add(\"resizer\", name);\n div.setAttribute(\"data-resizer-name\", name);\n div.addEventListener(\n \"pointerdown\",\n this.#resizerPointerdown.bind(this, name),\n { signal }\n );\n div.addEventListener(\"contextmenu\", noContextMenu, { signal });\n div.tabIndex = -1;\n }\n this.div.prepend(this.#resizersDiv);\n }\n\n #resizerPointerdown(name, event) {\n event.preventDefault();\n const { isMac } = FeatureTest.platform;\n if (event.button !== 0 || (event.ctrlKey && isMac)) {\n return;\n }\n\n this.#altText?.toggle(false);\n\n const savedDraggable = this._isDraggable;\n this._isDraggable = false;\n this.#lastPointerCoords = [event.screenX, event.screenY];\n\n const ac = new AbortController();\n const signal = this._uiManager.combinedSignal(ac);\n\n this.parent.togglePointerEvents(false);\n window.addEventListener(\n \"pointermove\",\n this.#resizerPointermove.bind(this, name),\n { passive: true, capture: true, signal }\n );\n window.addEventListener(\n \"touchmove\",\n stopEvent /* Prevent the page from scrolling */,\n { passive: false, signal }\n );\n window.addEventListener(\"contextmenu\", noContextMenu, { signal });\n this.#savedDimensions = {\n savedX: this.x,\n savedY: this.y,\n savedWidth: this.width,\n savedHeight: this.height,\n };\n const savedParentCursor = this.parent.div.style.cursor;\n const savedCursor = this.div.style.cursor;\n this.div.style.cursor = this.parent.div.style.cursor =\n window.getComputedStyle(event.target).cursor;\n\n const pointerUpCallback = () => {\n ac.abort();\n this.parent.togglePointerEvents(true);\n this.#altText?.toggle(true);\n this._isDraggable = savedDraggable;\n this.parent.div.style.cursor = savedParentCursor;\n this.div.style.cursor = savedCursor;\n\n this.#addResizeToUndoStack();\n };\n window.addEventListener(\"pointerup\", pointerUpCallback, { signal });\n // If the user switches to another window (with alt+tab), then we end the\n // resize session.\n window.addEventListener(\"blur\", pointerUpCallback, { signal });\n }\n\n #resize(x, y, width, height) {\n this.width = width;\n this.height = height;\n this.x = x;\n this.y = y;\n const [parentWidth, parentHeight] = this.parentDimensions;\n this.setDims(parentWidth * width, parentHeight * height);\n this.fixAndSetPosition();\n this._onResized();\n }\n\n /**\n * Called when the editor has been resized.\n */\n _onResized() {}\n\n #addResizeToUndoStack() {\n if (!this.#savedDimensions) {\n return;\n }\n const { savedX, savedY, savedWidth, savedHeight } = this.#savedDimensions;\n this.#savedDimensions = null;\n\n const newX = this.x;\n const newY = this.y;\n const newWidth = this.width;\n const newHeight = this.height;\n if (\n newX === savedX &&\n newY === savedY &&\n newWidth === savedWidth &&\n newHeight === savedHeight\n ) {\n return;\n }\n\n this.addCommands({\n cmd: this.#resize.bind(this, newX, newY, newWidth, newHeight),\n undo: this.#resize.bind(this, savedX, savedY, savedWidth, savedHeight),\n mustExec: true,\n });\n }\n\n #resizerPointermove(name, event) {\n const [parentWidth, parentHeight] = this.parentDimensions;\n const savedX = this.x;\n const savedY = this.y;\n const savedWidth = this.width;\n const savedHeight = this.height;\n const minWidth = AnnotationEditor.MIN_SIZE / parentWidth;\n const minHeight = AnnotationEditor.MIN_SIZE / parentHeight;\n\n // 10000 because we multiply by 100 and use toFixed(2) in fixAndSetPosition.\n // Without rounding, the positions of the corners other than the top left\n // one can be slightly wrong.\n const round = x => Math.round(x * 10000) / 10000;\n const rotationMatrix = this.#getRotationMatrix(this.rotation);\n const transf = (x, y) => [\n rotationMatrix[0] * x + rotationMatrix[2] * y,\n rotationMatrix[1] * x + rotationMatrix[3] * y,\n ];\n const invRotationMatrix = this.#getRotationMatrix(360 - this.rotation);\n const invTransf = (x, y) => [\n invRotationMatrix[0] * x + invRotationMatrix[2] * y,\n invRotationMatrix[1] * x + invRotationMatrix[3] * y,\n ];\n let getPoint;\n let getOpposite;\n let isDiagonal = false;\n let isHorizontal = false;\n\n switch (name) {\n case \"topLeft\":\n isDiagonal = true;\n getPoint = (w, h) => [0, 0];\n getOpposite = (w, h) => [w, h];\n break;\n case \"topMiddle\":\n getPoint = (w, h) => [w / 2, 0];\n getOpposite = (w, h) => [w / 2, h];\n break;\n case \"topRight\":\n isDiagonal = true;\n getPoint = (w, h) => [w, 0];\n getOpposite = (w, h) => [0, h];\n break;\n case \"middleRight\":\n isHorizontal = true;\n getPoint = (w, h) => [w, h / 2];\n getOpposite = (w, h) => [0, h / 2];\n break;\n case \"bottomRight\":\n isDiagonal = true;\n getPoint = (w, h) => [w, h];\n getOpposite = (w, h) => [0, 0];\n break;\n case \"bottomMiddle\":\n getPoint = (w, h) => [w / 2, h];\n getOpposite = (w, h) => [w / 2, 0];\n break;\n case \"bottomLeft\":\n isDiagonal = true;\n getPoint = (w, h) => [0, h];\n getOpposite = (w, h) => [w, 0];\n break;\n case \"middleLeft\":\n isHorizontal = true;\n getPoint = (w, h) => [0, h / 2];\n getOpposite = (w, h) => [w, h / 2];\n break;\n }\n\n const point = getPoint(savedWidth, savedHeight);\n const oppositePoint = getOpposite(savedWidth, savedHeight);\n let transfOppositePoint = transf(...oppositePoint);\n const oppositeX = round(savedX + transfOppositePoint[0]);\n const oppositeY = round(savedY + transfOppositePoint[1]);\n let ratioX = 1;\n let ratioY = 1;\n\n let deltaX, deltaY;\n\n if (!event.fromKeyboard) {\n // We can't use event.movementX/Y because they're not reliable:\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX\n // (it was buggy on a laptop with a touch screen).\n const { screenX, screenY } = event;\n const [lastScreenX, lastScreenY] = this.#lastPointerCoords;\n [deltaX, deltaY] = this.screenToPageTranslation(\n screenX - lastScreenX,\n screenY - lastScreenY\n );\n this.#lastPointerCoords[0] = screenX;\n this.#lastPointerCoords[1] = screenY;\n } else {\n ({ deltaX, deltaY } = event);\n }\n [deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);\n\n if (isDiagonal) {\n const oldDiag = Math.hypot(savedWidth, savedHeight);\n ratioX = ratioY = Math.max(\n Math.min(\n Math.hypot(\n oppositePoint[0] - point[0] - deltaX,\n oppositePoint[1] - point[1] - deltaY\n ) / oldDiag,\n // Avoid the editor to be larger than the page.\n 1 / savedWidth,\n 1 / savedHeight\n ),\n // Avoid the editor to be smaller than the minimum size.\n minWidth / savedWidth,\n minHeight / savedHeight\n );\n } else if (isHorizontal) {\n ratioX =\n Math.max(\n minWidth,\n Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))\n ) / savedWidth;\n } else {\n ratioY =\n Math.max(\n minHeight,\n Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY))\n ) / savedHeight;\n }\n\n const newWidth = round(savedWidth * ratioX);\n const newHeight = round(savedHeight * ratioY);\n transfOppositePoint = transf(...getOpposite(newWidth, newHeight));\n const newX = oppositeX - transfOppositePoint[0];\n const newY = oppositeY - transfOppositePoint[1];\n\n this.#initialRect ||= [this.x, this.y, this.width, this.height];\n this.width = newWidth;\n this.height = newHeight;\n this.x = newX;\n this.y = newY;\n\n this.setDims(parentWidth * newWidth, parentHeight * newHeight);\n this.fixAndSetPosition();\n\n this._onResizing();\n }\n\n /**\n * Called when the editor is being resized.\n */\n _onResizing() {}\n\n /**\n * Called when the alt text dialog is closed.\n */\n altTextFinish() {\n this.#altText?.finish();\n }\n\n /**\n * Add a toolbar for this editor.\n * @returns {Promise}\n */\n async addEditToolbar() {\n if (this._editToolbar || this.#isInEditMode) {\n return this._editToolbar;\n }\n this._editToolbar = new EditorToolbar(this);\n this.div.append(this._editToolbar.render());\n if (this.#altText) {\n await this._editToolbar.addAltText(this.#altText);\n }\n\n return this._editToolbar;\n }\n\n removeEditToolbar() {\n if (!this._editToolbar) {\n return;\n }\n this._editToolbar.remove();\n this._editToolbar = null;\n\n // We destroy the alt text but we don't null it because we want to be able\n // to restore it in case the user undoes the deletion.\n this.#altText?.destroy();\n }\n\n addContainer(container) {\n const editToolbarDiv = this._editToolbar?.div;\n if (editToolbarDiv) {\n editToolbarDiv.before(container);\n } else {\n this.div.append(container);\n }\n }\n\n getClientDimensions() {\n return this.div.getBoundingClientRect();\n }\n\n async addAltTextButton() {\n if (this.#altText) {\n return;\n }\n AltText.initialize(AnnotationEditor._l10n);\n this.#altText = new AltText(this);\n if (this.#accessibilityData) {\n this.#altText.data = this.#accessibilityData;\n this.#accessibilityData = null;\n }\n await this.addEditToolbar();\n }\n\n get altTextData() {\n return this.#altText?.data;\n }\n\n /**\n * Set the alt text data.\n */\n set altTextData(data) {\n if (!this.#altText) {\n return;\n }\n this.#altText.data = data;\n }\n\n get guessedAltText() {\n return this.#altText?.guessedText;\n }\n\n async setGuessedAltText(text) {\n await this.#altText?.setGuessedText(text);\n }\n\n serializeAltText(isForCopying) {\n return this.#altText?.serialize(isForCopying);\n }\n\n hasAltText() {\n return !!this.#altText && !this.#altText.isEmpty();\n }\n\n hasAltTextData() {\n return this.#altText?.hasData() ?? false;\n }\n\n /**\n * Render this editor in a div.\n * @returns {HTMLDivElement | null}\n */\n render() {\n this.div = document.createElement(\"div\");\n this.div.setAttribute(\"data-editor-rotation\", (360 - this.rotation) % 360);\n this.div.className = this.name;\n this.div.setAttribute(\"id\", this.id);\n this.div.tabIndex = this.#disabled ? -1 : 0;\n if (!this._isVisible) {\n this.div.classList.add(\"hidden\");\n }\n\n this.setInForeground();\n this.#addFocusListeners();\n\n const [parentWidth, parentHeight] = this.parentDimensions;\n if (this.parentRotation % 180 !== 0) {\n this.div.style.maxWidth = `${((100 * parentHeight) / parentWidth).toFixed(\n 2\n )}%`;\n this.div.style.maxHeight = `${(\n (100 * parentWidth) /\n parentHeight\n ).toFixed(2)}%`;\n }\n\n const [tx, ty] = this.getInitialTranslation();\n this.translate(tx, ty);\n\n bindEvents(this, this.div, [\"pointerdown\"]);\n\n this._uiManager._editorUndoBar?.hide();\n\n return this.div;\n }\n\n /**\n * Onpointerdown callback.\n * @param {PointerEvent} event\n */\n pointerdown(event) {\n const { isMac } = FeatureTest.platform;\n if (event.button !== 0 || (event.ctrlKey && isMac)) {\n // Avoid to focus this editor because of a non-left click.\n event.preventDefault();\n return;\n }\n\n this.#hasBeenClicked = true;\n\n if (this._isDraggable) {\n this.#setUpDragSession(event);\n return;\n }\n\n this.#selectOnPointerEvent(event);\n }\n\n get isSelected() {\n return this._uiManager.isSelected(this);\n }\n\n #selectOnPointerEvent(event) {\n const { isMac } = FeatureTest.platform;\n if (\n (event.ctrlKey && !isMac) ||\n event.shiftKey ||\n (event.metaKey && isMac)\n ) {\n this.parent.toggleSelected(this);\n } else {\n this.parent.setSelected(this);\n }\n }\n\n #setUpDragSession(event) {\n const { isSelected } = this;\n this._uiManager.setUpDragSession();\n\n const ac = new AbortController();\n const signal = this._uiManager.combinedSignal(ac);\n const opts = { capture: true, passive: false, signal };\n const cancelDrag = e => {\n ac.abort();\n\n this.#dragPointerId = null;\n this.#hasBeenClicked = false;\n if (!this._uiManager.endDragSession()) {\n this.#selectOnPointerEvent(e);\n }\n };\n\n if (isSelected) {\n this.#prevDragX = event.clientX;\n this.#prevDragY = event.clientY;\n this.#dragPointerId = event.pointerId;\n this.#dragPointerType = event.pointerType;\n window.addEventListener(\n \"pointermove\",\n e => {\n const { clientX: x, clientY: y, pointerId } = e;\n if (pointerId !== this.#dragPointerId) {\n stopEvent(e);\n return;\n }\n const [tx, ty] = this.screenToPageTranslation(\n x - this.#prevDragX,\n y - this.#prevDragY\n );\n this.#prevDragX = x;\n this.#prevDragY = y;\n this._uiManager.dragSelectedEditors(tx, ty);\n },\n opts\n );\n window.addEventListener(\n \"touchmove\",\n stopEvent /* Prevent the page from scrolling */,\n opts\n );\n window.addEventListener(\n \"pointerdown\",\n // If the user drags with one finger and then clicks with another.\n e => {\n if (e.isPrimary && e.pointerType === this.#dragPointerType) {\n // We cannot have two primaries at the same time.\n // It's possible to be in this state with Firefox and Gnome when\n // trying to drag with three fingers (see bug 1933716).\n cancelDrag(e);\n }\n stopEvent(e);\n },\n opts\n );\n }\n\n this._onStartDragging();\n\n const pointerUpCallback = e => {\n if (!this.#dragPointerId || this.#dragPointerId === e.pointerId) {\n cancelDrag(e);\n this._onStopDragging();\n return;\n }\n stopEvent(e);\n };\n window.addEventListener(\"pointerup\", pointerUpCallback, { signal });\n // If the user is using alt+tab during the dragging session, the pointerup\n // event could be not fired, but a blur event is fired so we can use it in\n // order to interrupt the dragging session.\n window.addEventListener(\"blur\", pointerUpCallback, { signal });\n }\n\n _onStartDragging() {}\n\n _onStopDragging() {}\n\n moveInDOM() {\n // Moving the editor in the DOM can be expensive, so we wait a bit before.\n // It's important to not block the UI (for example when changing the font\n // size in a FreeText).\n if (this.#moveInDOMTimeout) {\n clearTimeout(this.#moveInDOMTimeout);\n }\n this.#moveInDOMTimeout = setTimeout(() => {\n this.#moveInDOMTimeout = null;\n this.parent?.moveEditorInDOM(this);\n }, 0);\n }\n\n _setParentAndPosition(parent, x, y) {\n parent.changeParent(this);\n this.x = x;\n this.y = y;\n this.fixAndSetPosition();\n this._onTranslated();\n }\n\n /**\n * Convert the current rect into a page one.\n * @param {number} tx - x-translation in screen coordinates.\n * @param {number} ty - y-translation in screen coordinates.\n * @param {number} [rotation] - the rotation of the page.\n */\n getRect(tx, ty, rotation = this.rotation) {\n const scale = this.parentScale;\n const [pageWidth, pageHeight] = this.pageDimensions;\n const [pageX, pageY] = this.pageTranslation;\n const shiftX = tx / scale;\n const shiftY = ty / scale;\n const x = this.x * pageWidth;\n const y = this.y * pageHeight;\n const width = this.width * pageWidth;\n const height = this.height * pageHeight;\n\n switch (rotation) {\n case 0:\n return [\n x + shiftX + pageX,\n pageHeight - y - shiftY - height + pageY,\n x + shiftX + width + pageX,\n pageHeight - y - shiftY + pageY,\n ];\n case 90:\n return [\n x + shiftY + pageX,\n pageHeight - y + shiftX + pageY,\n x + shiftY + height + pageX,\n pageHeight - y + shiftX + width + pageY,\n ];\n case 180:\n return [\n x - shiftX - width + pageX,\n pageHeight - y + shiftY + pageY,\n x - shiftX + pageX,\n pageHeight - y + shiftY + height + pageY,\n ];\n case 270:\n return [\n x - shiftY - height + pageX,\n pageHeight - y - shiftX - width + pageY,\n x - shiftY + pageX,\n pageHeight - y - shiftX + pageY,\n ];\n default:\n throw new Error(\"Invalid rotation\");\n }\n }\n\n getRectInCurrentCoords(rect, pageHeight) {\n const [x1, y1, x2, y2] = rect;\n\n const width = x2 - x1;\n const height = y2 - y1;\n\n switch (this.rotation) {\n case 0:\n return [x1, pageHeight - y2, width, height];\n case 90:\n return [x1, pageHeight - y1, height, width];\n case 180:\n return [x2, pageHeight - y1, width, height];\n case 270:\n return [x2, pageHeight - y2, height, width];\n default:\n throw new Error(\"Invalid rotation\");\n }\n }\n\n /**\n * Executed once this editor has been rendered.\n */\n onceAdded() {}\n\n /**\n * Check if the editor contains something.\n * @returns {boolean}\n */\n isEmpty() {\n return false;\n }\n\n /**\n * Enable edit mode.\n */\n enableEditMode() {\n this.#isInEditMode = true;\n }\n\n /**\n * Disable edit mode.\n */\n disableEditMode() {\n this.#isInEditMode = false;\n }\n\n /**\n * Check if the editor is edited.\n * @returns {boolean}\n */\n isInEditMode() {\n return this.#isInEditMode;\n }\n\n /**\n * If it returns true, then this editor handles the keyboard\n * events itself.\n * @returns {boolean}\n */\n shouldGetKeyboardEvents() {\n return this.#isResizerEnabledForKeyboard;\n }\n\n /**\n * Check if this editor needs to be rebuilt or not.\n * @returns {boolean}\n */\n needsToBeRebuilt() {\n return this.div && !this.isAttachedToDOM;\n }\n\n get isOnScreen() {\n const { top, left, bottom, right } = this.getClientDimensions();\n const { innerHeight, innerWidth } = window;\n return left < innerWidth && right > 0 && top < innerHeight && bottom > 0;\n }\n\n #addFocusListeners() {\n if (this.#focusAC || !this.div) {\n return;\n }\n this.#focusAC = new AbortController();\n const signal = this._uiManager.combinedSignal(this.#focusAC);\n\n this.div.addEventListener(\"focusin\", this.focusin.bind(this), { signal });\n this.div.addEventListener(\"focusout\", this.focusout.bind(this), { signal });\n }\n\n /**\n * Rebuild the editor in case it has been removed on undo.\n *\n * To implement in subclasses.\n */\n rebuild() {\n this.#addFocusListeners();\n }\n\n /**\n * Rotate the editor when the page is rotated.\n * @param {number} angle\n */\n rotate(_angle) {}\n\n /**\n * Resize the editor when the page is resized.\n */\n resize() {}\n\n /**\n * Serialize the editor when it has been deleted.\n * @returns {Object}\n */\n serializeDeleted() {\n return {\n id: this.annotationElementId,\n deleted: true,\n pageIndex: this.pageIndex,\n popupRef: this._initialData?.popupRef || \"\",\n };\n }\n\n /**\n * Serialize the editor.\n * The result of the serialization will be used to construct a\n * new annotation to add to the pdf document.\n *\n * To implement in subclasses.\n * @param {boolean} [isForCopying]\n * @param {Object | null} [context]\n * @returns {Object | null}\n */\n serialize(isForCopying = false, context = null) {\n unreachable(\"An editor must be serializable\");\n }\n\n /**\n * Deserialize the editor.\n * The result of the deserialization is a new editor.\n *\n * @param {Object} data\n * @param {AnnotationEditorLayer} parent\n * @param {AnnotationEditorUIManager} uiManager\n * @returns {Promise}\n */\n static async deserialize(data, parent, uiManager) {\n const editor = new this.prototype.constructor({\n parent,\n id: parent.getNextId(),\n uiManager,\n });\n editor.rotation = data.rotation;\n editor.#accessibilityData = data.accessibilityData;\n\n const [pageWidth, pageHeight] = editor.pageDimensions;\n const [x, y, width, height] = editor.getRectInCurrentCoords(\n data.rect,\n pageHeight\n );\n\n editor.x = x / pageWidth;\n editor.y = y / pageHeight;\n editor.width = width / pageWidth;\n editor.height = height / pageHeight;\n\n return editor;\n }\n\n /**\n * Check if an existing annotation associated with this editor has been\n * modified.\n * @returns {boolean}\n */\n get hasBeenModified() {\n return (\n !!this.annotationElementId && (this.deleted || this.serialize() !== null)\n );\n }\n\n /**\n * Remove this editor.\n * It's used on ctrl+backspace action.\n */\n remove() {\n this.#focusAC?.abort();\n this.#focusAC = null;\n\n if (!this.isEmpty()) {\n // The editor is removed but it can be back at some point thanks to\n // undo/redo so we must commit it before.\n this.commit();\n }\n if (this.parent) {\n this.parent.remove(this);\n } else {\n this._uiManager.removeEditor(this);\n }\n\n if (this.#moveInDOMTimeout) {\n clearTimeout(this.#moveInDOMTimeout);\n this.#moveInDOMTimeout = null;\n }\n this.#stopResizing();\n this.removeEditToolbar();\n if (this.#telemetryTimeouts) {\n for (const timeout of this.#telemetryTimeouts.values()) {\n clearTimeout(timeout);\n }\n this.#telemetryTimeouts = null;\n }\n this.parent = null;\n }\n\n /**\n * @returns {boolean} true if this editor can be resized.\n */\n get isResizable() {\n return false;\n }\n\n /**\n * Add the resizers to this editor.\n */\n makeResizable() {\n if (this.isResizable) {\n this.#createResizers();\n this.#resizersDiv.classList.remove(\"hidden\");\n bindEvents(this, this.div, [\"keydown\"]);\n }\n }\n\n get toolbarPosition() {\n return null;\n }\n\n /**\n * onkeydown callback.\n * @param {KeyboardEvent} event\n */\n keydown(event) {\n if (\n !this.isResizable ||\n event.target !== this.div ||\n event.key !== \"Enter\"\n ) {\n return;\n }\n this._uiManager.setSelected(this);\n this.#savedDimensions = {\n savedX: this.x,\n savedY: this.y,\n savedWidth: this.width,\n savedHeight: this.height,\n };\n const children = this.#resizersDiv.children;\n if (!this.#allResizerDivs) {\n this.#allResizerDivs = Array.from(children);\n const boundResizerKeydown = this.#resizerKeydown.bind(this);\n const boundResizerBlur = this.#resizerBlur.bind(this);\n const signal = this._uiManager._signal;\n for (const div of this.#allResizerDivs) {\n const name = div.getAttribute(\"data-resizer-name\");\n div.setAttribute(\"role\", \"spinbutton\");\n div.addEventListener(\"keydown\", boundResizerKeydown, { signal });\n div.addEventListener(\"blur\", boundResizerBlur, { signal });\n div.addEventListener(\"focus\", this.#resizerFocus.bind(this, name), {\n signal,\n });\n div.setAttribute(\"data-l10n-id\", AnnotationEditor._l10nResizer[name]);\n }\n }\n\n // We want to have the resizers in the visual order, so we move the first\n // (top-left) to the right place.\n const first = this.#allResizerDivs[0];\n let firstPosition = 0;\n for (const div of children) {\n if (div === first) {\n break;\n }\n firstPosition++;\n }\n const nextFirstPosition =\n (((360 - this.rotation + this.parentRotation) % 360) / 90) *\n (this.#allResizerDivs.length / 4);\n\n if (nextFirstPosition !== firstPosition) {\n // We need to reorder the resizers in the DOM in order to have the focus\n // on the top-left one.\n if (nextFirstPosition < firstPosition) {\n for (let i = 0; i < firstPosition - nextFirstPosition; i++) {\n this.#resizersDiv.append(this.#resizersDiv.firstChild);\n }\n } else if (nextFirstPosition > firstPosition) {\n for (let i = 0; i < nextFirstPosition - firstPosition; i++) {\n this.#resizersDiv.firstChild.before(this.#resizersDiv.lastChild);\n }\n }\n\n let i = 0;\n for (const child of children) {\n const div = this.#allResizerDivs[i++];\n const name = div.getAttribute(\"data-resizer-name\");\n child.setAttribute(\"data-l10n-id\", AnnotationEditor._l10nResizer[name]);\n }\n }\n\n this.#setResizerTabIndex(0);\n this.#isResizerEnabledForKeyboard = true;\n this.#resizersDiv.firstChild.focus({ focusVisible: true });\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n\n #resizerKeydown(event) {\n AnnotationEditor._resizerKeyboardManager.exec(this, event);\n }\n\n #resizerBlur(event) {\n if (\n this.#isResizerEnabledForKeyboard &&\n event.relatedTarget?.parentNode !== this.#resizersDiv\n ) {\n this.#stopResizing();\n }\n }\n\n #resizerFocus(name) {\n this.#focusedResizerName = this.#isResizerEnabledForKeyboard ? name : \"\";\n }\n\n #setResizerTabIndex(value) {\n if (!this.#allResizerDivs) {\n return;\n }\n for (const div of this.#allResizerDivs) {\n div.tabIndex = value;\n }\n }\n\n _resizeWithKeyboard(x, y) {\n if (!this.#isResizerEnabledForKeyboard) {\n return;\n }\n this.#resizerPointermove(this.#focusedResizerName, {\n deltaX: x,\n deltaY: y,\n fromKeyboard: true,\n });\n }\n\n #stopResizing() {\n this.#isResizerEnabledForKeyboard = false;\n this.#setResizerTabIndex(-1);\n this.#addResizeToUndoStack();\n }\n\n _stopResizingWithKeyboard() {\n this.#stopResizing();\n this.div.focus();\n }\n\n /**\n * Select this editor.\n */\n select() {\n this.makeResizable();\n this.div?.classList.add(\"selectedEditor\");\n if (!this._editToolbar) {\n this.addEditToolbar().then(() => {\n if (this.div?.classList.contains(\"selectedEditor\")) {\n // The editor can have been unselected while we were waiting for the\n // edit toolbar to be created, hence we want to be sure that this\n // editor is still selected.\n this._editToolbar?.show();\n }\n });\n return;\n }\n this._editToolbar?.show();\n this.#altText?.toggleAltTextBadge(false);\n }\n\n /**\n * Unselect this editor.\n */\n unselect() {\n this.#resizersDiv?.classList.add(\"hidden\");\n this.div?.classList.remove(\"selectedEditor\");\n if (this.div?.contains(document.activeElement)) {\n // Don't use this.div.blur() because we don't know where the focus will\n // go.\n this._uiManager.currentLayer.div.focus({\n preventScroll: true,\n });\n }\n this._editToolbar?.hide();\n this.#altText?.toggleAltTextBadge(true);\n }\n\n /**\n * Update some parameters which have been changed through the UI.\n * @param {number} type\n * @param {*} value\n */\n updateParams(type, value) {}\n\n /**\n * When the user disables the editing mode some editors can change some of\n * their properties.\n */\n disableEditing() {}\n\n /**\n * When the user enables the editing mode some editors can change some of\n * their properties.\n */\n enableEditing() {}\n\n /**\n * The editor is about to be edited.\n */\n enterInEditMode() {}\n\n /**\n * @returns {HTMLElement | null} the element requiring an alt text.\n */\n getImageForAltText() {\n return null;\n }\n\n /**\n * Get the div which really contains the displayed content.\n * @returns {HTMLDivElement | undefined}\n */\n get contentDiv() {\n return this.div;\n }\n\n /**\n * If true then the editor is currently edited.\n * @type {boolean}\n */\n get isEditing() {\n return this.#isEditing;\n }\n\n /**\n * When set to true, it means that this editor is currently edited.\n * @param {boolean} value\n */\n set isEditing(value) {\n this.#isEditing = value;\n if (!this.parent) {\n return;\n }\n if (value) {\n this.parent.setSelected(this);\n this.parent.setActiveEditor(this);\n } else {\n this.parent.setActiveEditor(null);\n }\n }\n\n /**\n * Set the aspect ratio to use when resizing.\n * @param {number} width\n * @param {number} height\n */\n setAspectRatio(width, height) {\n this.#keepAspectRatio = true;\n const aspectRatio = width / height;\n const { style } = this.div;\n style.aspectRatio = aspectRatio;\n style.height = \"auto\";\n }\n\n static get MIN_SIZE() {\n return 16;\n }\n\n static canCreateNewEmptyEditor() {\n return true;\n }\n\n /**\n * Get the data to report to the telemetry when the editor is added.\n * @returns {Object}\n */\n get telemetryInitialData() {\n return { action: \"added\" };\n }\n\n /**\n * The telemetry data to use when saving/printing.\n * @returns {Object|null}\n */\n get telemetryFinalData() {\n return null;\n }\n\n _reportTelemetry(data, mustWait = false) {\n if (mustWait) {\n this.#telemetryTimeouts ||= new Map();\n const { action } = data;\n let timeout = this.#telemetryTimeouts.get(action);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n this._reportTelemetry(data);\n this.#telemetryTimeouts.delete(action);\n if (this.#telemetryTimeouts.size === 0) {\n this.#telemetryTimeouts = null;\n }\n }, AnnotationEditor._telemetryTimeout);\n this.#telemetryTimeouts.set(action, timeout);\n return;\n }\n data.type ||= this.editorType;\n this._uiManager._eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data,\n },\n });\n }\n\n /**\n * Show or hide this editor.\n * @param {boolean|undefined} visible\n */\n show(visible = this._isVisible) {\n this.div.classList.toggle(\"hidden\", !visible);\n this._isVisible = visible;\n }\n\n enable() {\n if (this.div) {\n this.div.tabIndex = 0;\n }\n this.#disabled = false;\n }\n\n disable() {\n if (this.div) {\n this.div.tabIndex = -1;\n }\n this.#disabled = true;\n }\n\n /**\n * Render an annotation in the annotation layer.\n * @param {Object} annotation\n * @returns {HTMLElement|null}\n */\n renderAnnotationElement(annotation) {\n let content = annotation.container.querySelector(\".annotationContent\");\n if (!content) {\n content = document.createElement(\"div\");\n content.classList.add(\"annotationContent\", this.editorType);\n annotation.container.prepend(content);\n } else if (content.nodeName === \"CANVAS\") {\n const canvas = content;\n content = document.createElement(\"div\");\n content.classList.add(\"annotationContent\", this.editorType);\n canvas.before(content);\n }\n\n return content;\n }\n\n resetAnnotationElement(annotation) {\n const { firstChild } = annotation.container;\n if (\n firstChild?.nodeName === \"DIV\" &&\n firstChild.classList.contains(\"annotationContent\")\n ) {\n firstChild.remove();\n }\n }\n}\n\n// This class is used to fake an editor which has been deleted.\nclass FakeEditor extends AnnotationEditor {\n constructor(params) {\n super(params);\n this.annotationElementId = params.annotationElementId;\n this.deleted = true;\n }\n\n serialize() {\n return this.serializeDeleted();\n }\n}\n\nexport { AnnotationEditor };\n","/* Copyright 2014 Opera Software ASA\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 * Based on https://code.google.com/p/smhasher/wiki/MurmurHash3.\n * Hashes roughly 100 KB per millisecond on i7 3.4 GHz.\n */\n\nconst SEED = 0xc3d2e1f0;\n// Workaround for missing math precision in JS.\nconst MASK_HIGH = 0xffff0000;\nconst MASK_LOW = 0xffff;\n\nclass MurmurHash3_64 {\n constructor(seed) {\n this.h1 = seed ? seed & 0xffffffff : SEED;\n this.h2 = seed ? seed & 0xffffffff : SEED;\n }\n\n update(input) {\n let data, length;\n if (typeof input === \"string\") {\n data = new Uint8Array(input.length * 2);\n length = 0;\n for (let i = 0, ii = input.length; i < ii; i++) {\n const code = input.charCodeAt(i);\n if (code <= 0xff) {\n data[length++] = code;\n } else {\n data[length++] = code >>> 8;\n data[length++] = code & 0xff;\n }\n }\n } else if (ArrayBuffer.isView(input)) {\n data = input.slice();\n length = data.byteLength;\n } else {\n throw new Error(\"Invalid data format, must be a string or TypedArray.\");\n }\n\n const blockCounts = length >> 2;\n const tailLength = length - blockCounts * 4;\n // We don't care about endianness here.\n const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);\n let k1 = 0,\n k2 = 0;\n let h1 = this.h1,\n h2 = this.h2;\n const C1 = 0xcc9e2d51,\n C2 = 0x1b873593;\n const C1_LOW = C1 & MASK_LOW,\n C2_LOW = C2 & MASK_LOW;\n\n for (let i = 0; i < blockCounts; i++) {\n if (i & 1) {\n k1 = dataUint32[i];\n k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1 = h1 * 5 + 0xe6546b64;\n } else {\n k2 = dataUint32[i];\n k2 = ((k2 * C1) & MASK_HIGH) | ((k2 * C1_LOW) & MASK_LOW);\n k2 = (k2 << 15) | (k2 >>> 17);\n k2 = ((k2 * C2) & MASK_HIGH) | ((k2 * C2_LOW) & MASK_LOW);\n h2 ^= k2;\n h2 = (h2 << 13) | (h2 >>> 19);\n h2 = h2 * 5 + 0xe6546b64;\n }\n }\n\n k1 = 0;\n\n switch (tailLength) {\n case 3:\n k1 ^= data[blockCounts * 4 + 2] << 16;\n /* falls through */\n case 2:\n k1 ^= data[blockCounts * 4 + 1] << 8;\n /* falls through */\n case 1:\n k1 ^= data[blockCounts * 4];\n /* falls through */\n\n k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);\n if (blockCounts & 1) {\n h1 ^= k1;\n } else {\n h2 ^= k1;\n }\n }\n\n this.h1 = h1;\n this.h2 = h2;\n }\n\n hexdigest() {\n let h1 = this.h1,\n h2 = this.h2;\n\n h1 ^= h2 >>> 1;\n h1 = ((h1 * 0xed558ccd) & MASK_HIGH) | ((h1 * 0x8ccd) & MASK_LOW);\n h2 =\n ((h2 * 0xff51afd7) & MASK_HIGH) |\n (((((h2 << 16) | (h1 >>> 16)) * 0xafd7ed55) & MASK_HIGH) >>> 16);\n h1 ^= h2 >>> 1;\n h1 = ((h1 * 0x1a85ec53) & MASK_HIGH) | ((h1 * 0xec53) & MASK_LOW);\n h2 =\n ((h2 * 0xc4ceb9fe) & MASK_HIGH) |\n (((((h2 << 16) | (h1 >>> 16)) * 0xb9fe1a85) & MASK_HIGH) >>> 16);\n h1 ^= h2 >>> 1;\n\n return (\n (h1 >>> 0).toString(16).padStart(8, \"0\") +\n (h2 >>> 0).toString(16).padStart(8, \"0\")\n );\n }\n}\n\nexport { MurmurHash3_64 };\n","/* Copyright 2020 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\nimport { objectFromMap, shadow, unreachable } from \"../shared/util.js\";\nimport { AnnotationEditor } from \"./editor/editor.js\";\nimport { MurmurHash3_64 } from \"../shared/murmurhash3.js\";\n\nconst SerializableEmpty = Object.freeze({\n map: null,\n hash: \"\",\n transfer: undefined,\n});\n\n/**\n * Key/value storage for annotation data in forms.\n */\nclass AnnotationStorage {\n #modified = false;\n\n #modifiedIds = null;\n\n #storage = new Map();\n\n constructor() {\n // Callbacks to signal when the modification state is set or reset.\n // This is used by the viewer to only bind on `beforeunload` if forms\n // are actually edited to prevent doing so unconditionally since that\n // can have undesirable effects.\n this.onSetModified = null;\n this.onResetModified = null;\n this.onAnnotationEditor = null;\n }\n\n /**\n * Get the value for a given key if it exists, or return the default value.\n * @param {string} key\n * @param {Object} defaultValue\n * @returns {Object}\n */\n getValue(key, defaultValue) {\n const value = this.#storage.get(key);\n if (value === undefined) {\n return defaultValue;\n }\n\n return Object.assign(defaultValue, value);\n }\n\n /**\n * Get the value for a given key.\n * @param {string} key\n * @returns {Object}\n */\n getRawValue(key) {\n return this.#storage.get(key);\n }\n\n /**\n * Remove a value from the storage.\n * @param {string} key\n */\n remove(key) {\n this.#storage.delete(key);\n\n if (this.#storage.size === 0) {\n this.resetModified();\n }\n\n if (typeof this.onAnnotationEditor === \"function\") {\n for (const value of this.#storage.values()) {\n if (value instanceof AnnotationEditor) {\n return;\n }\n }\n this.onAnnotationEditor(null);\n }\n }\n\n /**\n * Set the value for a given key\n * @param {string} key\n * @param {Object} value\n */\n setValue(key, value) {\n const obj = this.#storage.get(key);\n let modified = false;\n if (obj !== undefined) {\n for (const [entry, val] of Object.entries(value)) {\n if (obj[entry] !== val) {\n modified = true;\n obj[entry] = val;\n }\n }\n } else {\n modified = true;\n this.#storage.set(key, value);\n }\n if (modified) {\n this.#setModified();\n }\n\n if (\n value instanceof AnnotationEditor &&\n typeof this.onAnnotationEditor === \"function\"\n ) {\n this.onAnnotationEditor(value.constructor._type);\n }\n }\n\n /**\n * Check if the storage contains the given key.\n * @param {string} key\n * @returns {boolean}\n */\n has(key) {\n return this.#storage.has(key);\n }\n\n /**\n * @returns {Object | null}\n */\n getAll() {\n return this.#storage.size > 0 ? objectFromMap(this.#storage) : null;\n }\n\n /**\n * @param {Object} obj\n */\n setAll(obj) {\n for (const [key, val] of Object.entries(obj)) {\n this.setValue(key, val);\n }\n }\n\n get size() {\n return this.#storage.size;\n }\n\n #setModified() {\n if (!this.#modified) {\n this.#modified = true;\n if (typeof this.onSetModified === \"function\") {\n this.onSetModified();\n }\n }\n }\n\n resetModified() {\n if (this.#modified) {\n this.#modified = false;\n if (typeof this.onResetModified === \"function\") {\n this.onResetModified();\n }\n }\n }\n\n /**\n * @returns {PrintAnnotationStorage}\n */\n get print() {\n return new PrintAnnotationStorage(this);\n }\n\n /**\n * PLEASE NOTE: Only intended for usage within the API itself.\n * @ignore\n */\n get serializable() {\n if (this.#storage.size === 0) {\n return SerializableEmpty;\n }\n const map = new Map(),\n hash = new MurmurHash3_64(),\n transfer = [];\n const context = Object.create(null);\n let hasBitmap = false;\n\n for (const [key, val] of this.#storage) {\n const serialized =\n val instanceof AnnotationEditor\n ? val.serialize(/* isForCopying = */ false, context)\n : val;\n if (serialized) {\n map.set(key, serialized);\n\n hash.update(`${key}:${JSON.stringify(serialized)}`);\n hasBitmap ||= !!serialized.bitmap;\n }\n }\n\n if (hasBitmap) {\n // We must transfer the bitmap data separately, since it can be changed\n // during serialization with SVG images.\n for (const value of map.values()) {\n if (value.bitmap) {\n transfer.push(value.bitmap);\n }\n }\n }\n\n return map.size > 0\n ? { map, hash: hash.hexdigest(), transfer }\n : SerializableEmpty;\n }\n\n get editorStats() {\n let stats = null;\n const typeToEditor = new Map();\n for (const value of this.#storage.values()) {\n if (!(value instanceof AnnotationEditor)) {\n continue;\n }\n const editorStats = value.telemetryFinalData;\n if (!editorStats) {\n continue;\n }\n const { type } = editorStats;\n if (!typeToEditor.has(type)) {\n typeToEditor.set(type, Object.getPrototypeOf(value).constructor);\n }\n stats ||= Object.create(null);\n const map = (stats[type] ||= new Map());\n for (const [key, val] of Object.entries(editorStats)) {\n if (key === \"type\") {\n continue;\n }\n let counters = map.get(key);\n if (!counters) {\n counters = new Map();\n map.set(key, counters);\n }\n const count = counters.get(val) ?? 0;\n counters.set(val, count + 1);\n }\n }\n for (const [type, editor] of typeToEditor) {\n stats[type] = editor.computeTelemetryFinalData(stats[type]);\n }\n return stats;\n }\n\n resetModifiedIds() {\n this.#modifiedIds = null;\n }\n\n /**\n * @returns {{ids: Set, hash: string}}\n */\n get modifiedIds() {\n if (this.#modifiedIds) {\n return this.#modifiedIds;\n }\n const ids = [];\n for (const value of this.#storage.values()) {\n if (\n !(value instanceof AnnotationEditor) ||\n !value.annotationElementId ||\n !value.serialize()\n ) {\n continue;\n }\n ids.push(value.annotationElementId);\n }\n return (this.#modifiedIds = {\n ids: new Set(ids),\n hash: ids.join(\",\"),\n });\n }\n}\n\n/**\n * A special `AnnotationStorage` for use during printing, where the serializable\n * data is *frozen* upon initialization, to prevent scripting from modifying its\n * contents. (Necessary since printing is triggered synchronously in browsers.)\n */\nclass PrintAnnotationStorage extends AnnotationStorage {\n #serializable;\n\n constructor(parent) {\n super();\n const { map, hash, transfer } = parent.serializable;\n // Create a *copy* of the data, since Objects are passed by reference in JS.\n const clone = structuredClone(map, transfer ? { transfer } : null);\n\n this.#serializable = { map: clone, hash, transfer };\n }\n\n /**\n * @returns {PrintAnnotationStorage}\n */\n // eslint-disable-next-line getter-return\n get print() {\n unreachable(\"Should not call PrintAnnotationStorage.print\");\n }\n\n /**\n * PLEASE NOTE: Only intended for usage within the API itself.\n * @ignore\n */\n get serializable() {\n return this.#serializable;\n }\n\n get modifiedIds() {\n return shadow(this, \"modifiedIds\", {\n ids: new Set(),\n hash: \"\",\n });\n }\n}\n\nexport { AnnotationStorage, PrintAnnotationStorage, SerializableEmpty };\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\nimport {\n assert,\n FontRenderOps,\n isNodeJS,\n shadow,\n string32,\n toBase64Util,\n unreachable,\n warn,\n} from \"../shared/util.js\";\n\nclass FontLoader {\n #systemFonts = new Set();\n\n constructor({\n ownerDocument = globalThis.document,\n styleElement = null, // For testing only.\n }) {\n this._document = ownerDocument;\n\n this.nativeFontFaces = new Set();\n this.styleElement =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")\n ? styleElement\n : null;\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n this.loadingRequests = [];\n this.loadTestFontId = 0;\n }\n }\n\n addNativeFontFace(nativeFontFace) {\n this.nativeFontFaces.add(nativeFontFace);\n this._document.fonts.add(nativeFontFace);\n }\n\n removeNativeFontFace(nativeFontFace) {\n this.nativeFontFaces.delete(nativeFontFace);\n this._document.fonts.delete(nativeFontFace);\n }\n\n insertRule(rule) {\n if (!this.styleElement) {\n this.styleElement = this._document.createElement(\"style\");\n this._document.documentElement\n .getElementsByTagName(\"head\")[0]\n .append(this.styleElement);\n }\n const styleSheet = this.styleElement.sheet;\n styleSheet.insertRule(rule, styleSheet.cssRules.length);\n }\n\n clear() {\n for (const nativeFontFace of this.nativeFontFaces) {\n this._document.fonts.delete(nativeFontFace);\n }\n this.nativeFontFaces.clear();\n this.#systemFonts.clear();\n\n if (this.styleElement) {\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.styleElement.remove();\n this.styleElement = null;\n }\n }\n\n async loadSystemFont({ systemFontInfo: info, _inspectFont }) {\n if (!info || this.#systemFonts.has(info.loadedName)) {\n return;\n }\n assert(\n !this.disableFontFace,\n \"loadSystemFont shouldn't be called when `disableFontFace` is set.\"\n );\n\n if (this.isFontLoadingAPISupported) {\n const { loadedName, src, style } = info;\n const fontFace = new FontFace(loadedName, src, style);\n this.addNativeFontFace(fontFace);\n try {\n await fontFace.load();\n this.#systemFonts.add(loadedName);\n _inspectFont?.(info);\n } catch {\n warn(\n `Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`\n );\n\n this.removeNativeFontFace(fontFace);\n }\n return;\n }\n\n unreachable(\n \"Not implemented: loadSystemFont without the Font Loading API.\"\n );\n }\n\n async bind(font) {\n // Add the font to the DOM only once; skip if the font is already loaded.\n if (font.attached || (font.missingFile && !font.systemFontInfo)) {\n return;\n }\n font.attached = true;\n\n if (font.systemFontInfo) {\n await this.loadSystemFont(font);\n return;\n }\n\n if (this.isFontLoadingAPISupported) {\n const nativeFontFace = font.createNativeFontFace();\n if (nativeFontFace) {\n this.addNativeFontFace(nativeFontFace);\n try {\n await nativeFontFace.loaded;\n } catch (ex) {\n warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);\n\n // When font loading failed, fall back to the built-in font renderer.\n font.disableFontFace = true;\n throw ex;\n }\n }\n return; // The font was, asynchronously, loaded.\n }\n\n // !this.isFontLoadingAPISupported\n const rule = font.createFontFaceRule();\n if (rule) {\n this.insertRule(rule);\n\n if (this.isSyncFontLoadingSupported) {\n return; // The font was, synchronously, loaded.\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: async font loading\");\n }\n await new Promise(resolve => {\n const request = this._queueLoadingCallback(resolve);\n this._prepareFontLoadEvent(font, request);\n });\n // The font was, asynchronously, loaded.\n }\n }\n\n get isFontLoadingAPISupported() {\n const hasFonts = !!this._document?.fonts;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n return shadow(\n this,\n \"isFontLoadingAPISupported\",\n hasFonts && !this.styleElement\n );\n }\n return shadow(this, \"isFontLoadingAPISupported\", hasFonts);\n }\n\n get isSyncFontLoadingSupported() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return shadow(this, \"isSyncFontLoadingSupported\", true);\n }\n\n let supported = false;\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n if (isNodeJS) {\n // Node.js - we can pretend that sync font loading is supported.\n supported = true;\n } else if (\n typeof navigator !== \"undefined\" &&\n typeof navigator?.userAgent === \"string\" &&\n // User agent string sniffing is bad, but there is no reliable way to\n // tell if the font is fully loaded and ready to be used with canvas.\n /Mozilla\\/5.0.*?rv:\\d+.*? Gecko/.test(navigator.userAgent)\n ) {\n // Firefox, from version 14, supports synchronous font loading.\n supported = true;\n }\n }\n return shadow(this, \"isSyncFontLoadingSupported\", supported);\n }\n\n _queueLoadingCallback(callback) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: _queueLoadingCallback\");\n }\n\n function completeRequest() {\n assert(!request.done, \"completeRequest() cannot be called twice.\");\n request.done = true;\n\n // Sending all completed requests in order of how they were queued.\n while (loadingRequests.length > 0 && loadingRequests[0].done) {\n const otherRequest = loadingRequests.shift();\n setTimeout(otherRequest.callback, 0);\n }\n }\n\n const { loadingRequests } = this;\n const request = {\n done: false,\n complete: completeRequest,\n callback,\n };\n loadingRequests.push(request);\n return request;\n }\n\n get _loadTestFont() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: _loadTestFont\");\n }\n\n // This is a CFF font with 1 glyph for '.' that fills its entire width\n // and height.\n const testFont = atob(\n \"T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA\" +\n \"FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA\" +\n \"ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA\" +\n \"AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1\" +\n \"AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD\" +\n \"6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM\" +\n \"AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D\" +\n \"IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA\" +\n \"AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA\" +\n \"AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB\" +\n \"AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY\" +\n \"AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA\" +\n \"AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA\" +\n \"AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC\" +\n \"AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3\" +\n \"Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj\" +\n \"FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==\"\n );\n return shadow(this, \"_loadTestFont\", testFont);\n }\n\n _prepareFontLoadEvent(font, request) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: _prepareFontLoadEvent\");\n }\n\n /** Hack begin */\n // There's currently no event when a font has finished downloading so the\n // following code is a dirty hack to 'guess' when a font is ready.\n // It's assumed fonts are loaded in order, so add a known test font after\n // the desired fonts and then test for the loading of that test font.\n\n function int32(data, offset) {\n return (\n (data.charCodeAt(offset) << 24) |\n (data.charCodeAt(offset + 1) << 16) |\n (data.charCodeAt(offset + 2) << 8) |\n (data.charCodeAt(offset + 3) & 0xff)\n );\n }\n function spliceString(s, offset, remove, insert) {\n const chunk1 = s.substring(0, offset);\n const chunk2 = s.substring(offset + remove);\n return chunk1 + insert + chunk2;\n }\n let i, ii;\n\n // The temporary canvas is used to determine if fonts are loaded.\n const canvas = this._document.createElement(\"canvas\");\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext(\"2d\");\n\n let called = 0;\n function isFontReady(name, callback) {\n // With setTimeout clamping this gives the font ~100ms to load.\n if (++called > 30) {\n warn(\"Load test font never loaded.\");\n callback();\n return;\n }\n ctx.font = \"30px \" + name;\n ctx.fillText(\".\", 0, 20);\n const imageData = ctx.getImageData(0, 0, 1, 1);\n if (imageData.data[3] > 0) {\n callback();\n return;\n }\n setTimeout(isFontReady.bind(null, name, callback));\n }\n\n const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;\n // Chromium seems to cache fonts based on a hash of the actual font data,\n // so the font must be modified for each load test else it will appear to\n // be loaded already.\n // TODO: This could maybe be made faster by avoiding the btoa of the full\n // font by splitting it in chunks before hand and padding the font id.\n let data = this._loadTestFont;\n const COMMENT_OFFSET = 976; // has to be on 4 byte boundary (for checksum)\n data = spliceString(\n data,\n COMMENT_OFFSET,\n loadTestFontId.length,\n loadTestFontId\n );\n // CFF checksum is important for IE, adjusting it\n const CFF_CHECKSUM_OFFSET = 16;\n const XXXX_VALUE = 0x58585858; // the \"comment\" filled with 'X'\n let checksum = int32(data, CFF_CHECKSUM_OFFSET);\n for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {\n checksum = (checksum - XXXX_VALUE + int32(loadTestFontId, i)) | 0;\n }\n if (i < loadTestFontId.length) {\n // align to 4 bytes boundary\n checksum = (checksum - XXXX_VALUE + int32(loadTestFontId + \"XXX\", i)) | 0;\n }\n data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));\n\n const url = `url(data:font/opentype;base64,${btoa(data)});`;\n const rule = `@font-face {font-family:\"${loadTestFontId}\";src:${url}}`;\n this.insertRule(rule);\n\n const div = this._document.createElement(\"div\");\n div.style.visibility = \"hidden\";\n div.style.width = div.style.height = \"10px\";\n div.style.position = \"absolute\";\n div.style.top = div.style.left = \"0px\";\n\n for (const name of [font.loadedName, loadTestFontId]) {\n const span = this._document.createElement(\"span\");\n span.textContent = \"Hi\";\n span.style.fontFamily = name;\n div.append(span);\n }\n this._document.body.append(div);\n\n isFontReady(loadTestFontId, () => {\n div.remove();\n request.complete();\n });\n /** Hack end */\n }\n}\n\nclass FontFaceObject {\n constructor(translatedData, { disableFontFace = false, inspectFont = null }) {\n this.compiledGlyphs = Object.create(null);\n // importing translated data\n for (const i in translatedData) {\n this[i] = translatedData[i];\n }\n this.disableFontFace = disableFontFace === true;\n this._inspectFont = inspectFont;\n }\n\n createNativeFontFace() {\n if (!this.data || this.disableFontFace) {\n return null;\n }\n let nativeFontFace;\n if (!this.cssFontInfo) {\n nativeFontFace = new FontFace(this.loadedName, this.data, {});\n } else {\n const css = {\n weight: this.cssFontInfo.fontWeight,\n };\n if (this.cssFontInfo.italicAngle) {\n css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;\n }\n nativeFontFace = new FontFace(\n this.cssFontInfo.fontFamily,\n this.data,\n css\n );\n }\n\n this._inspectFont?.(this);\n return nativeFontFace;\n }\n\n createFontFaceRule() {\n if (!this.data || this.disableFontFace) {\n return null;\n }\n // Add the @font-face rule to the document.\n const url = `url(data:${this.mimetype};base64,${toBase64Util(this.data)});`;\n let rule;\n if (!this.cssFontInfo) {\n rule = `@font-face {font-family:\"${this.loadedName}\";src:${url}}`;\n } else {\n let css = `font-weight: ${this.cssFontInfo.fontWeight};`;\n if (this.cssFontInfo.italicAngle) {\n css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;\n }\n rule = `@font-face {font-family:\"${this.cssFontInfo.fontFamily}\";${css}src:${url}}`;\n }\n\n this._inspectFont?.(this, url);\n return rule;\n }\n\n getPathGenerator(objs, character) {\n if (this.compiledGlyphs[character] !== undefined) {\n return this.compiledGlyphs[character];\n }\n\n let cmds;\n try {\n cmds = objs.get(this.loadedName + \"_path_\" + character);\n } catch (ex) {\n warn(`getPathGenerator - ignoring character: \"${ex}\".`);\n }\n\n if (!Array.isArray(cmds) || cmds.length === 0) {\n return (this.compiledGlyphs[character] = function (c, size) {\n // No-op function, to allow rendering to continue.\n });\n }\n\n const commands = [];\n for (let i = 0, ii = cmds.length; i < ii; ) {\n switch (cmds[i++]) {\n case FontRenderOps.BEZIER_CURVE_TO:\n {\n const [a, b, c, d, e, f] = cmds.slice(i, i + 6);\n commands.push(ctx => ctx.bezierCurveTo(a, b, c, d, e, f));\n i += 6;\n }\n break;\n case FontRenderOps.MOVE_TO:\n {\n const [a, b] = cmds.slice(i, i + 2);\n commands.push(ctx => ctx.moveTo(a, b));\n i += 2;\n }\n break;\n case FontRenderOps.LINE_TO:\n {\n const [a, b] = cmds.slice(i, i + 2);\n commands.push(ctx => ctx.lineTo(a, b));\n i += 2;\n }\n break;\n case FontRenderOps.QUADRATIC_CURVE_TO:\n {\n const [a, b, c, d] = cmds.slice(i, i + 4);\n commands.push(ctx => ctx.quadraticCurveTo(a, b, c, d));\n i += 4;\n }\n break;\n case FontRenderOps.RESTORE:\n commands.push(ctx => ctx.restore());\n break;\n case FontRenderOps.SAVE:\n commands.push(ctx => ctx.save());\n break;\n case FontRenderOps.SCALE:\n // The scale command must be at the third position, after save and\n // transform (for the font matrix) commands (see also\n // font_renderer.js).\n // The goal is to just scale the canvas and then run the commands loop\n // without the need to pass the size parameter to each command.\n assert(\n commands.length === 2,\n \"Scale command is only valid at the third position.\"\n );\n break;\n case FontRenderOps.TRANSFORM:\n {\n const [a, b, c, d, e, f] = cmds.slice(i, i + 6);\n commands.push(ctx => ctx.transform(a, b, c, d, e, f));\n i += 6;\n }\n break;\n case FontRenderOps.TRANSLATE:\n {\n const [a, b] = cmds.slice(i, i + 2);\n commands.push(ctx => ctx.translate(a, b));\n i += 2;\n }\n break;\n }\n }\n // From https://learn.microsoft.com/en-us/typography/opentype/spec/cff2#paths\n // All contours must be closed with a lineto operation.\n commands.push(ctx => ctx.closePath());\n\n return (this.compiledGlyphs[character] = function glyphDrawer(ctx, size) {\n commands[0](ctx);\n commands[1](ctx);\n ctx.scale(size, -size);\n for (let i = 2, ii = commands.length; i < ii; i++) {\n commands[i](ctx);\n }\n });\n }\n}\n\nexport { FontFaceObject, FontLoader };\n","/* Copyright 2015 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\nimport { unreachable } from \"../shared/util.js\";\n\nclass BaseCanvasFactory {\n #enableHWA = false;\n\n constructor({ enableHWA = false }) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseCanvasFactory\n ) {\n unreachable(\"Cannot initialize BaseCanvasFactory.\");\n }\n this.#enableHWA = enableHWA;\n }\n\n create(width, height) {\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n const canvas = this._createCanvas(width, height);\n return {\n canvas,\n context: canvas.getContext(\"2d\", {\n willReadFrequently: !this.#enableHWA,\n }),\n };\n }\n\n reset(canvasAndContext, width, height) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n canvasAndContext.canvas.width = width;\n canvasAndContext.canvas.height = height;\n }\n\n destroy(canvasAndContext) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n // Zeroing the width and height cause Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvasAndContext.canvas.width = 0;\n canvasAndContext.canvas.height = 0;\n canvasAndContext.canvas = null;\n canvasAndContext.context = null;\n }\n\n /**\n * @ignore\n */\n _createCanvas(width, height) {\n unreachable(\"Abstract method `_createCanvas` called.\");\n }\n}\n\nclass DOMCanvasFactory extends BaseCanvasFactory {\n constructor({ ownerDocument = globalThis.document, enableHWA = false }) {\n super({ enableHWA });\n this._document = ownerDocument;\n }\n\n /**\n * @ignore\n */\n _createCanvas(width, height) {\n const canvas = this._document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n return canvas;\n }\n}\n\nexport { BaseCanvasFactory, DOMCanvasFactory };\n","/* Copyright 2015 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\nimport { stringToBytes, unreachable } from \"../shared/util.js\";\nimport { fetchData } from \"./display_utils.js\";\n\nclass BaseCMapReaderFactory {\n constructor({ baseUrl = null, isCompressed = true }) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseCMapReaderFactory\n ) {\n unreachable(\"Cannot initialize BaseCMapReaderFactory.\");\n }\n this.baseUrl = baseUrl;\n this.isCompressed = isCompressed;\n }\n\n async fetch({ name }) {\n if (!this.baseUrl) {\n throw new Error(\n \"Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.\"\n );\n }\n if (!name) {\n throw new Error(\"CMap name must be specified.\");\n }\n const url = this.baseUrl + name + (this.isCompressed ? \".bcmap\" : \"\");\n\n return this._fetch(url)\n .then(cMapData => ({ cMapData, isCompressed: this.isCompressed }))\n .catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}CMap at: ${url}`\n );\n });\n }\n\n /**\n * @ignore\n * @returns {Promise}\n */\n async _fetch(url) {\n unreachable(\"Abstract method `_fetch` called.\");\n }\n}\n\nclass DOMCMapReaderFactory extends BaseCMapReaderFactory {\n /**\n * @ignore\n */\n async _fetch(url) {\n const data = await fetchData(\n url,\n /* type = */ this.isCompressed ? \"arraybuffer\" : \"text\"\n );\n return data instanceof ArrayBuffer\n ? new Uint8Array(data)\n : stringToBytes(data);\n }\n}\n\nexport { BaseCMapReaderFactory, DOMCMapReaderFactory };\n","/* Copyright 2015 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\nimport { getRGB, isDataScheme, SVG_NS } from \"./display_utils.js\";\nimport { unreachable, Util, warn } from \"../shared/util.js\";\n\nclass BaseFilterFactory {\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseFilterFactory\n ) {\n unreachable(\"Cannot initialize BaseFilterFactory.\");\n }\n }\n\n addFilter(maps) {\n return \"none\";\n }\n\n addHCMFilter(fgColor, bgColor) {\n return \"none\";\n }\n\n addAlphaFilter(map) {\n return \"none\";\n }\n\n addLuminosityFilter(map) {\n return \"none\";\n }\n\n addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {\n return \"none\";\n }\n\n destroy(keepHCM = false) {}\n}\n\n/**\n * FilterFactory aims to create some SVG filters we can use when drawing an\n * image (or whatever) on a canvas.\n * Filters aren't applied with ctx.putImageData because it just overwrites the\n * underlying pixels.\n * With these filters, it's possible for example to apply some transfer maps on\n * an image without the need to apply them on the pixel arrays: the renderer\n * does the magic for us.\n */\nclass DOMFilterFactory extends BaseFilterFactory {\n #baseUrl;\n\n #_cache;\n\n #_defs;\n\n #docId;\n\n #document;\n\n #_hcmCache;\n\n #id = 0;\n\n constructor({ docId, ownerDocument = globalThis.document }) {\n super();\n this.#docId = docId;\n this.#document = ownerDocument;\n }\n\n get #cache() {\n return (this.#_cache ||= new Map());\n }\n\n get #hcmCache() {\n return (this.#_hcmCache ||= new Map());\n }\n\n get #defs() {\n if (!this.#_defs) {\n const div = this.#document.createElement(\"div\");\n const { style } = div;\n style.visibility = \"hidden\";\n style.contain = \"strict\";\n style.width = style.height = 0;\n style.position = \"absolute\";\n style.top = style.left = 0;\n style.zIndex = -1;\n\n const svg = this.#document.createElementNS(SVG_NS, \"svg\");\n svg.setAttribute(\"width\", 0);\n svg.setAttribute(\"height\", 0);\n this.#_defs = this.#document.createElementNS(SVG_NS, \"defs\");\n div.append(svg);\n svg.append(this.#_defs);\n this.#document.body.append(div);\n }\n return this.#_defs;\n }\n\n #createTables(maps) {\n if (maps.length === 1) {\n const mapR = maps[0];\n const buffer = new Array(256);\n for (let i = 0; i < 256; i++) {\n buffer[i] = mapR[i] / 255;\n }\n\n const table = buffer.join(\",\");\n return [table, table, table];\n }\n\n const [mapR, mapG, mapB] = maps;\n const bufferR = new Array(256);\n const bufferG = new Array(256);\n const bufferB = new Array(256);\n for (let i = 0; i < 256; i++) {\n bufferR[i] = mapR[i] / 255;\n bufferG[i] = mapG[i] / 255;\n bufferB[i] = mapB[i] / 255;\n }\n return [bufferR.join(\",\"), bufferG.join(\",\"), bufferB.join(\",\")];\n }\n\n #createUrl(id) {\n if (this.#baseUrl === undefined) {\n // Unless a ``-element is present a relative URL should work.\n this.#baseUrl = \"\";\n\n const url = this.#document.URL;\n if (url !== this.#document.baseURI) {\n if (isDataScheme(url)) {\n warn('#createUrl: ignore \"data:\"-URL for performance reasons.');\n } else {\n this.#baseUrl = url.split(\"#\", 1)[0];\n }\n }\n }\n return `url(${this.#baseUrl}#${id})`;\n }\n\n addFilter(maps) {\n if (!maps) {\n return \"none\";\n }\n\n // When a page is zoomed the page is re-drawn but the maps are likely\n // the same.\n let value = this.#cache.get(maps);\n if (value) {\n return value;\n }\n\n const [tableR, tableG, tableB] = this.#createTables(maps);\n const key = maps.length === 1 ? tableR : `${tableR}${tableG}${tableB}`;\n\n value = this.#cache.get(key);\n if (value) {\n this.#cache.set(maps, value);\n return value;\n }\n\n // We create a SVG filter: feComponentTransferElement\n // https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\n\n const id = `g_${this.#docId}_transfer_map_${this.#id++}`;\n const url = this.#createUrl(id);\n this.#cache.set(maps, url);\n this.#cache.set(key, url);\n\n const filter = this.#createFilter(id);\n this.#addTransferMapConversion(tableR, tableG, tableB, filter);\n\n return url;\n }\n\n addHCMFilter(fgColor, bgColor) {\n const key = `${fgColor}-${bgColor}`;\n const filterName = \"base\";\n let info = this.#hcmCache.get(filterName);\n if (info?.key === key) {\n return info.url;\n }\n\n if (info) {\n info.filter?.remove();\n info.key = key;\n info.url = \"none\";\n info.filter = null;\n } else {\n info = {\n key,\n url: \"none\",\n filter: null,\n };\n this.#hcmCache.set(filterName, info);\n }\n\n if (!fgColor || !bgColor) {\n return info.url;\n }\n\n const fgRGB = this.#getRGB(fgColor);\n fgColor = Util.makeHexColor(...fgRGB);\n const bgRGB = this.#getRGB(bgColor);\n bgColor = Util.makeHexColor(...bgRGB);\n this.#defs.style.color = \"\";\n\n if (\n (fgColor === \"#000000\" && bgColor === \"#ffffff\") ||\n fgColor === bgColor\n ) {\n return info.url;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_Colors_and_Luminance\n //\n // Relative luminance:\n // https://www.w3.org/TR/WCAG20/#relativeluminancedef\n //\n // We compute the rounded luminance of the default background color.\n // Then for every color in the pdf, if its rounded luminance is the\n // same as the background one then it's replaced by the new\n // background color else by the foreground one.\n const map = new Array(256);\n for (let i = 0; i <= 255; i++) {\n const x = i / 255;\n map[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;\n }\n const table = map.join(\",\");\n\n const id = `g_${this.#docId}_hcm_filter`;\n const filter = (info.filter = this.#createFilter(id));\n this.#addTransferMapConversion(table, table, table, filter);\n this.#addGrayConversion(filter);\n\n const getSteps = (c, n) => {\n const start = fgRGB[c] / 255;\n const end = bgRGB[c] / 255;\n const arr = new Array(n + 1);\n for (let i = 0; i <= n; i++) {\n arr[i] = start + (i / n) * (end - start);\n }\n return arr.join(\",\");\n };\n this.#addTransferMapConversion(\n getSteps(0, 5),\n getSteps(1, 5),\n getSteps(2, 5),\n filter\n );\n\n info.url = this.#createUrl(id);\n return info.url;\n }\n\n addAlphaFilter(map) {\n // When a page is zoomed the page is re-drawn but the maps are likely\n // the same.\n let value = this.#cache.get(map);\n if (value) {\n return value;\n }\n\n const [tableA] = this.#createTables([map]);\n const key = `alpha_${tableA}`;\n\n value = this.#cache.get(key);\n if (value) {\n this.#cache.set(map, value);\n return value;\n }\n\n const id = `g_${this.#docId}_alpha_map_${this.#id++}`;\n const url = this.#createUrl(id);\n this.#cache.set(map, url);\n this.#cache.set(key, url);\n\n const filter = this.#createFilter(id);\n this.#addTransferMapAlphaConversion(tableA, filter);\n\n return url;\n }\n\n addLuminosityFilter(map) {\n // When a page is zoomed the page is re-drawn but the maps are likely\n // the same.\n let value = this.#cache.get(map || \"luminosity\");\n if (value) {\n return value;\n }\n\n let tableA, key;\n if (map) {\n [tableA] = this.#createTables([map]);\n key = `luminosity_${tableA}`;\n } else {\n key = \"luminosity\";\n }\n\n value = this.#cache.get(key);\n if (value) {\n this.#cache.set(map, value);\n return value;\n }\n\n const id = `g_${this.#docId}_luminosity_map_${this.#id++}`;\n const url = this.#createUrl(id);\n this.#cache.set(map, url);\n this.#cache.set(key, url);\n\n const filter = this.#createFilter(id);\n this.#addLuminosityConversion(filter);\n if (map) {\n this.#addTransferMapAlphaConversion(tableA, filter);\n }\n\n return url;\n }\n\n addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {\n const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;\n let info = this.#hcmCache.get(filterName);\n if (info?.key === key) {\n return info.url;\n }\n\n if (info) {\n info.filter?.remove();\n info.key = key;\n info.url = \"none\";\n info.filter = null;\n } else {\n info = {\n key,\n url: \"none\",\n filter: null,\n };\n this.#hcmCache.set(filterName, info);\n }\n\n if (!fgColor || !bgColor) {\n return info.url;\n }\n\n const [fgRGB, bgRGB] = [fgColor, bgColor].map(this.#getRGB.bind(this));\n let fgGray = Math.round(\n 0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]\n );\n let bgGray = Math.round(\n 0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]\n );\n let [newFgRGB, newBgRGB] = [newFgColor, newBgColor].map(\n this.#getRGB.bind(this)\n );\n if (bgGray < fgGray) {\n [fgGray, bgGray, newFgRGB, newBgRGB] = [\n bgGray,\n fgGray,\n newBgRGB,\n newFgRGB,\n ];\n }\n this.#defs.style.color = \"\";\n\n // Now we can create the filters to highlight some canvas parts.\n // The colors in the pdf will almost be Canvas and CanvasText, hence we\n // want to filter them to finally get Highlight and HighlightText.\n // Since we're in HCM the background color and the foreground color should\n // be really different when converted to grayscale (if they're not then it\n // means that we've a poor contrast). Once the canvas colors are converted\n // to grayscale we can easily map them on their new colors.\n // The grayscale step is important because if we've something like:\n // fgColor = #FF....\n // bgColor = #FF....\n // then we are enable to map the red component on the new red components\n // which can be different.\n\n const getSteps = (fg, bg, n) => {\n const arr = new Array(256);\n const step = (bgGray - fgGray) / n;\n const newStart = fg / 255;\n const newStep = (bg - fg) / (255 * n);\n let prev = 0;\n for (let i = 0; i <= n; i++) {\n const k = Math.round(fgGray + i * step);\n const value = newStart + i * newStep;\n for (let j = prev; j <= k; j++) {\n arr[j] = value;\n }\n prev = k + 1;\n }\n for (let i = prev; i < 256; i++) {\n arr[i] = arr[prev - 1];\n }\n return arr.join(\",\");\n };\n\n const id = `g_${this.#docId}_hcm_${filterName}_filter`;\n const filter = (info.filter = this.#createFilter(id));\n\n this.#addGrayConversion(filter);\n this.#addTransferMapConversion(\n getSteps(newFgRGB[0], newBgRGB[0], 5),\n getSteps(newFgRGB[1], newBgRGB[1], 5),\n getSteps(newFgRGB[2], newBgRGB[2], 5),\n filter\n );\n\n info.url = this.#createUrl(id);\n return info.url;\n }\n\n destroy(keepHCM = false) {\n if (keepHCM && this.#_hcmCache?.size) {\n return;\n }\n this.#_defs?.parentNode.parentNode.remove();\n this.#_defs = null;\n\n this.#_cache?.clear();\n this.#_cache = null;\n\n this.#_hcmCache?.clear();\n this.#_hcmCache = null;\n\n this.#id = 0;\n }\n\n #addLuminosityConversion(filter) {\n const feColorMatrix = this.#document.createElementNS(\n SVG_NS,\n \"feColorMatrix\"\n );\n feColorMatrix.setAttribute(\"type\", \"matrix\");\n feColorMatrix.setAttribute(\n \"values\",\n \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0\"\n );\n filter.append(feColorMatrix);\n }\n\n #addGrayConversion(filter) {\n const feColorMatrix = this.#document.createElementNS(\n SVG_NS,\n \"feColorMatrix\"\n );\n feColorMatrix.setAttribute(\"type\", \"matrix\");\n feColorMatrix.setAttribute(\n \"values\",\n \"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\"\n );\n filter.append(feColorMatrix);\n }\n\n #createFilter(id) {\n const filter = this.#document.createElementNS(SVG_NS, \"filter\");\n filter.setAttribute(\"color-interpolation-filters\", \"sRGB\");\n filter.setAttribute(\"id\", id);\n this.#defs.append(filter);\n\n return filter;\n }\n\n #appendFeFunc(feComponentTransfer, func, table) {\n const feFunc = this.#document.createElementNS(SVG_NS, func);\n feFunc.setAttribute(\"type\", \"discrete\");\n feFunc.setAttribute(\"tableValues\", table);\n feComponentTransfer.append(feFunc);\n }\n\n #addTransferMapConversion(rTable, gTable, bTable, filter) {\n const feComponentTransfer = this.#document.createElementNS(\n SVG_NS,\n \"feComponentTransfer\"\n );\n filter.append(feComponentTransfer);\n this.#appendFeFunc(feComponentTransfer, \"feFuncR\", rTable);\n this.#appendFeFunc(feComponentTransfer, \"feFuncG\", gTable);\n this.#appendFeFunc(feComponentTransfer, \"feFuncB\", bTable);\n }\n\n #addTransferMapAlphaConversion(aTable, filter) {\n const feComponentTransfer = this.#document.createElementNS(\n SVG_NS,\n \"feComponentTransfer\"\n );\n filter.append(feComponentTransfer);\n this.#appendFeFunc(feComponentTransfer, \"feFuncA\", aTable);\n }\n\n #getRGB(color) {\n this.#defs.style.color = color;\n return getRGB(getComputedStyle(this.#defs).getPropertyValue(\"color\"));\n }\n}\n\nexport { BaseFilterFactory, DOMFilterFactory };\n","/* Copyright 2015 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\nimport { fetchData } from \"./display_utils.js\";\nimport { unreachable } from \"../shared/util.js\";\n\nclass BaseStandardFontDataFactory {\n constructor({ baseUrl = null }) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseStandardFontDataFactory\n ) {\n unreachable(\"Cannot initialize BaseStandardFontDataFactory.\");\n }\n this.baseUrl = baseUrl;\n }\n\n async fetch({ filename }) {\n if (!this.baseUrl) {\n throw new Error(\n \"Ensure that the `standardFontDataUrl` API parameter is provided.\"\n );\n }\n if (!filename) {\n throw new Error(\"Font filename must be specified.\");\n }\n const url = `${this.baseUrl}${filename}`;\n\n return this._fetch(url).catch(reason => {\n throw new Error(`Unable to load font data at: ${url}`);\n });\n }\n\n /**\n * @ignore\n * @returns {Promise}\n */\n async _fetch(url) {\n unreachable(\"Abstract method `_fetch` called.\");\n }\n}\n\nclass DOMStandardFontDataFactory extends BaseStandardFontDataFactory {\n /**\n * @ignore\n */\n async _fetch(url) {\n const data = await fetchData(url, /* type = */ \"arraybuffer\");\n return new Uint8Array(data);\n }\n}\n\nexport { BaseStandardFontDataFactory, DOMStandardFontDataFactory };\n","/* Copyright 2020 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/* globals process */\n\nimport { isNodeJS, warn } from \"../shared/util.js\";\nimport { BaseCanvasFactory } from \"./canvas_factory.js\";\nimport { BaseCMapReaderFactory } from \"./cmap_reader_factory.js\";\nimport { BaseFilterFactory } from \"./filter_factory.js\";\nimport { BaseStandardFontDataFactory } from \"./standard_fontdata_factory.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\n 'Module \"./node_utils.js\" shall not be used with MOZCENTRAL builds.'\n );\n}\n\nif (\n typeof PDFJSDev !== \"undefined\" &&\n !PDFJSDev.test(\"SKIP_BABEL\") &&\n isNodeJS\n) {\n let canvas;\n try {\n const require = process\n .getBuiltinModule(\"module\")\n .createRequire(import.meta.url);\n\n try {\n canvas = require(\"@napi-rs/canvas\");\n } catch (ex) {\n warn(`Cannot load \"@napi-rs/canvas\" package: \"${ex}\".`);\n }\n } catch {}\n\n if (!globalThis.DOMMatrix) {\n if (canvas?.DOMMatrix) {\n globalThis.DOMMatrix = canvas.DOMMatrix;\n } else {\n warn(\"Cannot polyfill `DOMMatrix`, rendering may be broken.\");\n }\n }\n if (!globalThis.ImageData) {\n if (canvas?.ImageData) {\n globalThis.ImageData = canvas.ImageData;\n } else {\n warn(\"Cannot polyfill `ImageData`, rendering may be broken.\");\n }\n }\n if (!globalThis.Path2D) {\n if (canvas?.Path2D) {\n globalThis.Path2D = canvas.Path2D;\n } else {\n warn(\"Cannot polyfill `Path2D`, rendering may be broken.\");\n }\n }\n}\n\nasync function fetchData(url) {\n const fs = process.getBuiltinModule(\"fs\");\n const data = await fs.promises.readFile(url);\n return new Uint8Array(data);\n}\n\nclass NodeFilterFactory extends BaseFilterFactory {}\n\nclass NodeCanvasFactory extends BaseCanvasFactory {\n /**\n * @ignore\n */\n _createCanvas(width, height) {\n const require = process\n .getBuiltinModule(\"module\")\n .createRequire(import.meta.url);\n const canvas = require(\"@napi-rs/canvas\");\n return canvas.createCanvas(width, height);\n }\n}\n\nclass NodeCMapReaderFactory extends BaseCMapReaderFactory {\n /**\n * @ignore\n */\n async _fetch(url) {\n return fetchData(url);\n }\n}\n\nclass NodeStandardFontDataFactory extends BaseStandardFontDataFactory {\n /**\n * @ignore\n */\n async _fetch(url) {\n return fetchData(url);\n }\n}\n\nexport {\n fetchData,\n NodeCanvasFactory,\n NodeCMapReaderFactory,\n NodeFilterFactory,\n NodeStandardFontDataFactory,\n};\n","/* Copyright 2014 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\nimport { FormatError, info, unreachable, Util } from \"../shared/util.js\";\nimport { getCurrentTransform } from \"./display_utils.js\";\n\nconst PathType = {\n FILL: \"Fill\",\n STROKE: \"Stroke\",\n SHADING: \"Shading\",\n};\n\nfunction applyBoundingBox(ctx, bbox) {\n if (!bbox) {\n return;\n }\n const width = bbox[2] - bbox[0];\n const height = bbox[3] - bbox[1];\n const region = new Path2D();\n region.rect(bbox[0], bbox[1], width, height);\n ctx.clip(region);\n}\n\nclass BaseShadingPattern {\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseShadingPattern\n ) {\n unreachable(\"Cannot initialize BaseShadingPattern.\");\n }\n }\n\n getPattern() {\n unreachable(\"Abstract method `getPattern` called.\");\n }\n}\n\nclass RadialAxialShadingPattern extends BaseShadingPattern {\n constructor(IR) {\n super();\n this._type = IR[1];\n this._bbox = IR[2];\n this._colorStops = IR[3];\n this._p0 = IR[4];\n this._p1 = IR[5];\n this._r0 = IR[6];\n this._r1 = IR[7];\n this.matrix = null;\n }\n\n _createGradient(ctx) {\n let grad;\n if (this._type === \"axial\") {\n grad = ctx.createLinearGradient(\n this._p0[0],\n this._p0[1],\n this._p1[0],\n this._p1[1]\n );\n } else if (this._type === \"radial\") {\n grad = ctx.createRadialGradient(\n this._p0[0],\n this._p0[1],\n this._r0,\n this._p1[0],\n this._p1[1],\n this._r1\n );\n }\n\n for (const colorStop of this._colorStops) {\n grad.addColorStop(colorStop[0], colorStop[1]);\n }\n return grad;\n }\n\n getPattern(ctx, owner, inverse, pathType) {\n let pattern;\n if (pathType === PathType.STROKE || pathType === PathType.FILL) {\n const ownerBBox = owner.current.getClippedPathBoundingBox(\n pathType,\n getCurrentTransform(ctx)\n ) || [0, 0, 0, 0];\n // Create a canvas that is only as big as the current path. This doesn't\n // allow us to cache the pattern, but it generally creates much smaller\n // canvases and saves memory use. See bug 1722807 for an example.\n const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;\n const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;\n\n const tmpCanvas = owner.cachedCanvases.getCanvas(\n \"pattern\",\n width,\n height\n );\n\n const tmpCtx = tmpCanvas.context;\n tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n tmpCtx.beginPath();\n tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n // Non shading fill patterns are positioned relative to the base transform\n // (usually the page's initial transform), but we may have created a\n // smaller canvas based on the path, so we must account for the shift.\n tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);\n inverse = Util.transform(inverse, [\n 1,\n 0,\n 0,\n 1,\n ownerBBox[0],\n ownerBBox[1],\n ]);\n\n tmpCtx.transform(...owner.baseTransform);\n if (this.matrix) {\n tmpCtx.transform(...this.matrix);\n }\n applyBoundingBox(tmpCtx, this._bbox);\n\n tmpCtx.fillStyle = this._createGradient(tmpCtx);\n tmpCtx.fill();\n\n pattern = ctx.createPattern(tmpCanvas.canvas, \"no-repeat\");\n const domMatrix = new DOMMatrix(inverse);\n pattern.setTransform(domMatrix);\n } else {\n // Shading fills are applied relative to the current matrix which is also\n // how canvas gradients work, so there's no need to do anything special\n // here.\n applyBoundingBox(ctx, this._bbox);\n pattern = this._createGradient(ctx);\n }\n return pattern;\n }\n}\n\nfunction drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {\n // Very basic Gouraud-shaded triangle rasterization algorithm.\n const coords = context.coords,\n colors = context.colors;\n const bytes = data.data,\n rowSize = data.width * 4;\n let tmp;\n if (coords[p1 + 1] > coords[p2 + 1]) {\n tmp = p1;\n p1 = p2;\n p2 = tmp;\n tmp = c1;\n c1 = c2;\n c2 = tmp;\n }\n if (coords[p2 + 1] > coords[p3 + 1]) {\n tmp = p2;\n p2 = p3;\n p3 = tmp;\n tmp = c2;\n c2 = c3;\n c3 = tmp;\n }\n if (coords[p1 + 1] > coords[p2 + 1]) {\n tmp = p1;\n p1 = p2;\n p2 = tmp;\n tmp = c1;\n c1 = c2;\n c2 = tmp;\n }\n const x1 = (coords[p1] + context.offsetX) * context.scaleX;\n const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;\n const x2 = (coords[p2] + context.offsetX) * context.scaleX;\n const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;\n const x3 = (coords[p3] + context.offsetX) * context.scaleX;\n const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;\n if (y1 >= y3) {\n return;\n }\n const c1r = colors[c1],\n c1g = colors[c1 + 1],\n c1b = colors[c1 + 2];\n const c2r = colors[c2],\n c2g = colors[c2 + 1],\n c2b = colors[c2 + 2];\n const c3r = colors[c3],\n c3g = colors[c3 + 1],\n c3b = colors[c3 + 2];\n\n const minY = Math.round(y1),\n maxY = Math.round(y3);\n let xa, car, cag, cab;\n let xb, cbr, cbg, cbb;\n for (let y = minY; y <= maxY; y++) {\n if (y < y2) {\n const k = y < y1 ? 0 : (y1 - y) / (y1 - y2);\n xa = x1 - (x1 - x2) * k;\n car = c1r - (c1r - c2r) * k;\n cag = c1g - (c1g - c2g) * k;\n cab = c1b - (c1b - c2b) * k;\n } else {\n let k;\n if (y > y3) {\n k = 1;\n } else if (y2 === y3) {\n k = 0;\n } else {\n k = (y2 - y) / (y2 - y3);\n }\n xa = x2 - (x2 - x3) * k;\n car = c2r - (c2r - c3r) * k;\n cag = c2g - (c2g - c3g) * k;\n cab = c2b - (c2b - c3b) * k;\n }\n\n let k;\n if (y < y1) {\n k = 0;\n } else if (y > y3) {\n k = 1;\n } else {\n k = (y1 - y) / (y1 - y3);\n }\n xb = x1 - (x1 - x3) * k;\n cbr = c1r - (c1r - c3r) * k;\n cbg = c1g - (c1g - c3g) * k;\n cbb = c1b - (c1b - c3b) * k;\n const x1_ = Math.round(Math.min(xa, xb));\n const x2_ = Math.round(Math.max(xa, xb));\n let j = rowSize * y + x1_ * 4;\n for (let x = x1_; x <= x2_; x++) {\n k = (xa - x) / (xa - xb);\n if (k < 0) {\n k = 0;\n } else if (k > 1) {\n k = 1;\n }\n bytes[j++] = (car - (car - cbr) * k) | 0;\n bytes[j++] = (cag - (cag - cbg) * k) | 0;\n bytes[j++] = (cab - (cab - cbb) * k) | 0;\n bytes[j++] = 255;\n }\n }\n}\n\nfunction drawFigure(data, figure, context) {\n const ps = figure.coords;\n const cs = figure.colors;\n let i, ii;\n switch (figure.type) {\n case \"lattice\":\n const verticesPerRow = figure.verticesPerRow;\n const rows = Math.floor(ps.length / verticesPerRow) - 1;\n const cols = verticesPerRow - 1;\n for (i = 0; i < rows; i++) {\n let q = i * verticesPerRow;\n for (let j = 0; j < cols; j++, q++) {\n drawTriangle(\n data,\n context,\n ps[q],\n ps[q + 1],\n ps[q + verticesPerRow],\n cs[q],\n cs[q + 1],\n cs[q + verticesPerRow]\n );\n drawTriangle(\n data,\n context,\n ps[q + verticesPerRow + 1],\n ps[q + 1],\n ps[q + verticesPerRow],\n cs[q + verticesPerRow + 1],\n cs[q + 1],\n cs[q + verticesPerRow]\n );\n }\n }\n break;\n case \"triangles\":\n for (i = 0, ii = ps.length; i < ii; i += 3) {\n drawTriangle(\n data,\n context,\n ps[i],\n ps[i + 1],\n ps[i + 2],\n cs[i],\n cs[i + 1],\n cs[i + 2]\n );\n }\n break;\n default:\n throw new Error(\"illegal figure\");\n }\n}\n\nclass MeshShadingPattern extends BaseShadingPattern {\n constructor(IR) {\n super();\n this._coords = IR[2];\n this._colors = IR[3];\n this._figures = IR[4];\n this._bounds = IR[5];\n this._bbox = IR[7];\n this._background = IR[8];\n this.matrix = null;\n }\n\n _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {\n // we will increase scale on some weird factor to let antialiasing take\n // care of \"rough\" edges\n const EXPECTED_SCALE = 1.1;\n // MAX_PATTERN_SIZE is used to avoid OOM situation.\n const MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough\n // We need to keep transparent border around our pattern for fill():\n // createPattern with 'no-repeat' will bleed edges across entire area.\n const BORDER_SIZE = 2;\n\n const offsetX = Math.floor(this._bounds[0]);\n const offsetY = Math.floor(this._bounds[1]);\n const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;\n const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;\n\n const width = Math.min(\n Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n const height = Math.min(\n Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n const scaleX = boundsWidth / width;\n const scaleY = boundsHeight / height;\n\n const context = {\n coords: this._coords,\n colors: this._colors,\n offsetX: -offsetX,\n offsetY: -offsetY,\n scaleX: 1 / scaleX,\n scaleY: 1 / scaleY,\n };\n\n const paddedWidth = width + BORDER_SIZE * 2;\n const paddedHeight = height + BORDER_SIZE * 2;\n\n const tmpCanvas = cachedCanvases.getCanvas(\n \"mesh\",\n paddedWidth,\n paddedHeight\n );\n const tmpCtx = tmpCanvas.context;\n\n const data = tmpCtx.createImageData(width, height);\n if (backgroundColor) {\n const bytes = data.data;\n for (let i = 0, ii = bytes.length; i < ii; i += 4) {\n bytes[i] = backgroundColor[0];\n bytes[i + 1] = backgroundColor[1];\n bytes[i + 2] = backgroundColor[2];\n bytes[i + 3] = 255;\n }\n }\n for (const figure of this._figures) {\n drawFigure(data, figure, context);\n }\n tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);\n const canvas = tmpCanvas.canvas;\n\n return {\n canvas,\n offsetX: offsetX - BORDER_SIZE * scaleX,\n offsetY: offsetY - BORDER_SIZE * scaleY,\n scaleX,\n scaleY,\n };\n }\n\n getPattern(ctx, owner, inverse, pathType) {\n applyBoundingBox(ctx, this._bbox);\n let scale;\n if (pathType === PathType.SHADING) {\n scale = Util.singularValueDecompose2dScale(getCurrentTransform(ctx));\n } else {\n // Obtain scale from matrix and current transformation matrix.\n scale = Util.singularValueDecompose2dScale(owner.baseTransform);\n if (this.matrix) {\n const matrixScale = Util.singularValueDecompose2dScale(this.matrix);\n scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];\n }\n }\n\n // Rasterizing on the main thread since sending/queue large canvases\n // might cause OOM.\n const temporaryPatternCanvas = this._createMeshCanvas(\n scale,\n pathType === PathType.SHADING ? null : this._background,\n owner.cachedCanvases\n );\n\n if (pathType !== PathType.SHADING) {\n ctx.setTransform(...owner.baseTransform);\n if (this.matrix) {\n ctx.transform(...this.matrix);\n }\n }\n\n ctx.translate(\n temporaryPatternCanvas.offsetX,\n temporaryPatternCanvas.offsetY\n );\n ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);\n\n return ctx.createPattern(temporaryPatternCanvas.canvas, \"no-repeat\");\n }\n}\n\nclass DummyShadingPattern extends BaseShadingPattern {\n getPattern() {\n return \"hotpink\";\n }\n}\n\nfunction getShadingPattern(IR) {\n switch (IR[0]) {\n case \"RadialAxial\":\n return new RadialAxialShadingPattern(IR);\n case \"Mesh\":\n return new MeshShadingPattern(IR);\n case \"Dummy\":\n return new DummyShadingPattern();\n }\n throw new Error(`Unknown IR type: ${IR[0]}`);\n}\n\nconst PaintType = {\n COLORED: 1,\n UNCOLORED: 2,\n};\n\nclass TilingPattern {\n // 10in @ 300dpi shall be enough.\n static MAX_PATTERN_SIZE = 3000;\n\n constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {\n this.operatorList = IR[2];\n this.matrix = IR[3];\n this.bbox = IR[4];\n this.xstep = IR[5];\n this.ystep = IR[6];\n this.paintType = IR[7];\n this.tilingType = IR[8];\n this.color = color;\n this.ctx = ctx;\n this.canvasGraphicsFactory = canvasGraphicsFactory;\n this.baseTransform = baseTransform;\n }\n\n createPatternCanvas(owner) {\n const {\n bbox,\n operatorList,\n paintType,\n tilingType,\n color,\n canvasGraphicsFactory,\n } = this;\n let { xstep, ystep } = this;\n xstep = Math.abs(xstep);\n ystep = Math.abs(ystep);\n\n info(\"TilingType: \" + tilingType);\n\n // A tiling pattern as defined by PDF spec 8.7.2 is a cell whose size is\n // described by bbox, and may repeat regularly by shifting the cell by\n // xstep and ystep.\n // Because the HTML5 canvas API does not support pattern repetition with\n // gaps in between, we use the xstep/ystep instead of the bbox's size.\n //\n // This has the following consequences (similarly for ystep):\n //\n // - If xstep is the same as bbox, then there is no observable difference.\n //\n // - If xstep is larger than bbox, then the pattern canvas is partially\n // empty: the area bounded by bbox is painted, the outside area is void.\n //\n // - If xstep is smaller than bbox, then the pixels between xstep and the\n // bbox boundary will be missing. This is INCORRECT behavior.\n // \"Figures on adjacent tiles should not overlap\" (PDF spec 8.7.3.1),\n // but overlapping cells without common pixels are still valid.\n\n const x0 = bbox[0],\n y0 = bbox[1],\n x1 = bbox[2],\n y1 = bbox[3];\n const width = x1 - x0;\n const height = y1 - y0;\n\n // Obtain scale from matrix and current transformation matrix.\n const matrixScale = Util.singularValueDecompose2dScale(this.matrix);\n const curMatrixScale = Util.singularValueDecompose2dScale(\n this.baseTransform\n );\n const combinedScaleX = matrixScale[0] * curMatrixScale[0];\n const combinedScaleY = matrixScale[1] * curMatrixScale[1];\n\n let canvasWidth = width,\n canvasHeight = height,\n redrawHorizontally = false,\n redrawVertically = false;\n\n const xScaledStep = Math.ceil(xstep * combinedScaleX);\n const yScaledStep = Math.ceil(ystep * combinedScaleY);\n const xScaledWidth = Math.ceil(width * combinedScaleX);\n const yScaledHeight = Math.ceil(height * combinedScaleY);\n\n if (xScaledStep >= xScaledWidth) {\n canvasWidth = xstep;\n } else {\n redrawHorizontally = true;\n }\n if (yScaledStep >= yScaledHeight) {\n canvasHeight = ystep;\n } else {\n redrawVertically = true;\n }\n\n // Use width and height values that are as close as possible to the end\n // result when the pattern is used. Too low value makes the pattern look\n // blurry. Too large value makes it look too crispy.\n const dimx = this.getSizeAndScale(\n canvasWidth,\n this.ctx.canvas.width,\n combinedScaleX\n );\n const dimy = this.getSizeAndScale(\n canvasHeight,\n this.ctx.canvas.height,\n combinedScaleY\n );\n\n const tmpCanvas = owner.cachedCanvases.getCanvas(\n \"pattern\",\n dimx.size,\n dimy.size\n );\n const tmpCtx = tmpCanvas.context;\n const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);\n graphics.groupLevel = owner.groupLevel;\n\n this.setFillAndStrokeStyleToContext(graphics, paintType, color);\n\n tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);\n graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);\n\n // To match CanvasGraphics beginDrawing we must save the context here or\n // else we end up with unbalanced save/restores.\n tmpCtx.save();\n\n this.clipBbox(graphics, x0, y0, x1, y1);\n\n graphics.baseTransform = getCurrentTransform(graphics.ctx);\n\n graphics.executeOperatorList(operatorList);\n\n graphics.endDrawing();\n\n tmpCtx.restore();\n\n if (redrawHorizontally || redrawVertically) {\n // The tile is overlapping itself, so we create a new tile with\n // dimensions xstep * ystep.\n // Then we draw the overlapping parts of the original tile on the new\n // tile.\n // Just as a side note, the code here works correctly even if we don't\n // have to redraw the tile horizontally or vertically. In that case, the\n // original tile is drawn on the new tile only once, but it's useless.\n const image = tmpCanvas.canvas;\n if (redrawHorizontally) {\n canvasWidth = xstep;\n }\n if (redrawVertically) {\n canvasHeight = ystep;\n }\n\n const dimx2 = this.getSizeAndScale(\n canvasWidth,\n this.ctx.canvas.width,\n combinedScaleX\n );\n const dimy2 = this.getSizeAndScale(\n canvasHeight,\n this.ctx.canvas.height,\n combinedScaleY\n );\n\n const xSize = dimx2.size;\n const ySize = dimy2.size;\n const tmpCanvas2 = owner.cachedCanvases.getCanvas(\n \"pattern-workaround\",\n xSize,\n ySize\n );\n const tmpCtx2 = tmpCanvas2.context;\n const ii = redrawHorizontally ? Math.floor(width / xstep) : 0;\n const jj = redrawVertically ? Math.floor(height / ystep) : 0;\n\n // Draw the overlapping parts of the original tile on the new tile.\n for (let i = 0; i <= ii; i++) {\n for (let j = 0; j <= jj; j++) {\n tmpCtx2.drawImage(\n image,\n xSize * i,\n ySize * j,\n xSize,\n ySize,\n 0,\n 0,\n xSize,\n ySize\n );\n }\n }\n return {\n canvas: tmpCanvas2.canvas,\n scaleX: dimx2.scale,\n scaleY: dimy2.scale,\n offsetX: x0,\n offsetY: y0,\n };\n }\n\n return {\n canvas: tmpCanvas.canvas,\n scaleX: dimx.scale,\n scaleY: dimy.scale,\n offsetX: x0,\n offsetY: y0,\n };\n }\n\n getSizeAndScale(step, realOutputSize, scale) {\n // MAX_PATTERN_SIZE is used to avoid OOM situation.\n // Use the destination canvas's size if it is bigger than the hard-coded\n // limit of MAX_PATTERN_SIZE to avoid clipping patterns that cover the\n // whole canvas.\n const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);\n let size = Math.ceil(step * scale);\n if (size >= maxSize) {\n size = maxSize;\n } else {\n scale = size / step;\n }\n return { scale, size };\n }\n\n clipBbox(graphics, x0, y0, x1, y1) {\n const bboxWidth = x1 - x0;\n const bboxHeight = y1 - y0;\n graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);\n graphics.current.updateRectMinMax(getCurrentTransform(graphics.ctx), [\n x0,\n y0,\n x1,\n y1,\n ]);\n graphics.clip();\n graphics.endPath();\n }\n\n setFillAndStrokeStyleToContext(graphics, paintType, color) {\n const context = graphics.ctx,\n current = graphics.current;\n switch (paintType) {\n case PaintType.COLORED:\n const ctx = this.ctx;\n context.fillStyle = ctx.fillStyle;\n context.strokeStyle = ctx.strokeStyle;\n current.fillColor = ctx.fillStyle;\n current.strokeColor = ctx.strokeStyle;\n break;\n case PaintType.UNCOLORED:\n const cssColor = Util.makeHexColor(color[0], color[1], color[2]);\n context.fillStyle = cssColor;\n context.strokeStyle = cssColor;\n // Set color needed by image masks (fixes issues 3226 and 8741).\n current.fillColor = cssColor;\n current.strokeColor = cssColor;\n break;\n default:\n throw new FormatError(`Unsupported paint type: ${paintType}`);\n }\n }\n\n getPattern(ctx, owner, inverse, pathType) {\n // PDF spec 8.7.2 NOTE 1: pattern's matrix is relative to initial matrix.\n let matrix = inverse;\n if (pathType !== PathType.SHADING) {\n matrix = Util.transform(matrix, owner.baseTransform);\n if (this.matrix) {\n matrix = Util.transform(matrix, this.matrix);\n }\n }\n\n const temporaryPatternCanvas = this.createPatternCanvas(owner);\n\n let domMatrix = new DOMMatrix(matrix);\n // Rescale and so that the ctx.createPattern call generates a pattern with\n // the desired size.\n domMatrix = domMatrix.translate(\n temporaryPatternCanvas.offsetX,\n temporaryPatternCanvas.offsetY\n );\n domMatrix = domMatrix.scale(\n 1 / temporaryPatternCanvas.scaleX,\n 1 / temporaryPatternCanvas.scaleY\n );\n\n const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, \"repeat\");\n pattern.setTransform(domMatrix);\n\n return pattern;\n }\n}\n\nexport { getShadingPattern, PathType, TilingPattern };\n","/* Copyright 2022 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\nimport { FeatureTest, ImageKind } from \"./util.js\";\n\nfunction convertToRGBA(params) {\n switch (params.kind) {\n case ImageKind.GRAYSCALE_1BPP:\n return convertBlackAndWhiteToRGBA(params);\n case ImageKind.RGB_24BPP:\n return convertRGBToRGBA(params);\n }\n\n return null;\n}\n\nfunction convertBlackAndWhiteToRGBA({\n src,\n srcPos = 0,\n dest,\n width,\n height,\n nonBlackColor = 0xffffffff,\n inverseDecode = false,\n}) {\n const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;\n const [zeroMapping, oneMapping] = inverseDecode\n ? [nonBlackColor, black]\n : [black, nonBlackColor];\n const widthInSource = width >> 3;\n const widthRemainder = width & 7;\n const srcLength = src.length;\n dest = new Uint32Array(dest.buffer);\n let destPos = 0;\n\n for (let i = 0; i < height; i++) {\n for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {\n const elem = srcPos < srcLength ? src[srcPos] : 255;\n dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;\n dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;\n }\n if (widthRemainder === 0) {\n continue;\n }\n const elem = srcPos < srcLength ? src[srcPos++] : 255;\n for (let j = 0; j < widthRemainder; j++) {\n dest[destPos++] = elem & (1 << (7 - j)) ? oneMapping : zeroMapping;\n }\n }\n return { srcPos, destPos };\n}\n\nfunction convertRGBToRGBA({\n src,\n srcPos = 0,\n dest,\n destPos = 0,\n width,\n height,\n}) {\n let i = 0;\n const len = width * height * 3;\n const len32 = len >> 2;\n const src32 = new Uint32Array(src.buffer, srcPos, len32);\n\n if (FeatureTest.isLittleEndian) {\n // It's a way faster to do the shuffle manually instead of working\n // component by component with some Uint8 arrays.\n for (; i < len32 - 2; i += 3, destPos += 4) {\n const s1 = src32[i]; // R2B1G1R1\n const s2 = src32[i + 1]; // G3R3B2G2\n const s3 = src32[i + 2]; // B4G4R4B3\n\n dest[destPos] = s1 | 0xff000000;\n dest[destPos + 1] = (s1 >>> 24) | (s2 << 8) | 0xff000000;\n dest[destPos + 2] = (s2 >>> 16) | (s3 << 16) | 0xff000000;\n dest[destPos + 3] = (s3 >>> 8) | 0xff000000;\n }\n\n for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {\n dest[destPos++] =\n src[j] | (src[j + 1] << 8) | (src[j + 2] << 16) | 0xff000000;\n }\n } else {\n for (; i < len32 - 2; i += 3, destPos += 4) {\n const s1 = src32[i]; // R1G1B1R2\n const s2 = src32[i + 1]; // G2B2R3G3\n const s3 = src32[i + 2]; // B3R4G4B4\n\n dest[destPos] = s1 | 0xff;\n dest[destPos + 1] = (s1 << 24) | (s2 >>> 8) | 0xff;\n dest[destPos + 2] = (s2 << 16) | (s3 >>> 16) | 0xff;\n dest[destPos + 3] = (s3 << 8) | 0xff;\n }\n\n for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {\n dest[destPos++] =\n (src[j] << 24) | (src[j + 1] << 16) | (src[j + 2] << 8) | 0xff;\n }\n }\n\n return { srcPos: srcPos + len, destPos };\n}\n\nfunction grayToRGBA(src, dest) {\n if (FeatureTest.isLittleEndian) {\n for (let i = 0, ii = src.length; i < ii; i++) {\n dest[i] = (src[i] * 0x10101) | 0xff000000;\n }\n } else {\n for (let i = 0, ii = src.length; i < ii; i++) {\n dest[i] = (src[i] * 0x1010100) | 0x000000ff;\n }\n }\n}\n\nexport { convertBlackAndWhiteToRGBA, convertToRGBA, grayToRGBA };\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\nimport {\n FeatureTest,\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n isNodeJS,\n OPS,\n shadow,\n TextRenderingMode,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.js\";\nimport {\n getCurrentTransform,\n getCurrentTransformInverse,\n PixelsPerInch,\n} from \"./display_utils.js\";\nimport {\n getShadingPattern,\n PathType,\n TilingPattern,\n} from \"./pattern_helper.js\";\nimport { convertBlackAndWhiteToRGBA } from \"../shared/image_utils.js\";\n\n//