From 0890e590294e603c4296f3bb04bd891ae615a63e Mon Sep 17 00:00:00 2001 From: Colin Yip Date: Mon, 17 Jan 2022 14:08:02 +1300 Subject: [PATCH 01/17] feat: allow user to skip removing field during flattening (#1) --- .gitignore | 1 - cjs/api/Embeddable.d.ts | 8 + cjs/api/Embeddable.d.ts.map | 1 + cjs/api/Embeddable.js | 3 + cjs/api/Embeddable.js.map | 1 + cjs/api/PDFDocument.d.ts | 779 +++++++++ cjs/api/PDFDocument.d.ts.map | 1 + cjs/api/PDFDocument.js | 1369 ++++++++++++++++ cjs/api/PDFDocument.js.map | 1 + cjs/api/PDFDocumentOptions.d.ts | 38 + cjs/api/PDFDocumentOptions.d.ts.map | 1 + cjs/api/PDFDocumentOptions.js | 11 + cjs/api/PDFDocumentOptions.js.map | 1 + cjs/api/PDFEmbeddedFile.d.ts | 39 + cjs/api/PDFEmbeddedFile.d.ts.map | 1 + cjs/api/PDFEmbeddedFile.js | 84 + cjs/api/PDFEmbeddedFile.js.map | 1 + cjs/api/PDFEmbeddedPage.d.ts | 74 + cjs/api/PDFEmbeddedPage.d.ts.map | 1 + cjs/api/PDFEmbeddedPage.js | 95 ++ cjs/api/PDFEmbeddedPage.js.map | 1 + cjs/api/PDFFont.d.ts | 95 ++ cjs/api/PDFFont.d.ts.map | 1 + cjs/api/PDFFont.js | 143 ++ cjs/api/PDFFont.js.map | 1 + cjs/api/PDFImage.d.ts | 96 ++ cjs/api/PDFImage.d.ts.map | 1 + cjs/api/PDFImage.js | 132 ++ cjs/api/PDFImage.js.map | 1 + cjs/api/PDFJavaScript.d.ts | 39 + cjs/api/PDFJavaScript.d.ts.map | 1 + cjs/api/PDFJavaScript.js | 73 + cjs/api/PDFJavaScript.js.map | 1 + cjs/api/PDFPage.d.ts | 898 ++++++++++ cjs/api/PDFPage.d.ts.map | 1 + cjs/api/PDFPage.js | 1442 +++++++++++++++++ cjs/api/PDFPage.js.map | 1 + cjs/api/PDFPageOptions.d.ts | 155 ++ cjs/api/PDFPageOptions.d.ts.map | 1 + cjs/api/PDFPageOptions.js | 19 + cjs/api/PDFPageOptions.js.map | 1 + cjs/api/StandardFonts.d.ts | 17 + cjs/api/StandardFonts.d.ts.map | 1 + cjs/api/StandardFonts.js | 21 + cjs/api/StandardFonts.js.map | 1 + cjs/api/colors.d.ts | 31 + cjs/api/colors.d.ts.map | 1 + cjs/api/colors.js | 59 + cjs/api/colors.js.map | 1 + cjs/api/errors.d.ts | 43 + cjs/api/errors.d.ts.map | 1 + cjs/api/errors.js | 168 ++ cjs/api/errors.js.map | 1 + cjs/api/form/PDFButton.d.ts | 138 ++ cjs/api/form/PDFButton.d.ts.map | 1 + cjs/api/form/PDFButton.js | 220 +++ cjs/api/form/PDFButton.js.map | 1 + cjs/api/form/PDFCheckBox.d.ts | 143 ++ cjs/api/form/PDFCheckBox.d.ts.map | 1 + cjs/api/form/PDFCheckBox.js | 236 +++ cjs/api/form/PDFCheckBox.js.map | 1 + cjs/api/form/PDFDropdown.d.ts | 403 +++++ cjs/api/form/PDFDropdown.d.ts.map | 1 + cjs/api/form/PDFDropdown.js | 580 +++++++ cjs/api/form/PDFDropdown.js.map | 1 + cjs/api/form/PDFField.d.ts | 204 +++ cjs/api/form/PDFField.d.ts.map | 1 + cjs/api/form/PDFField.js | 384 +++++ cjs/api/form/PDFField.js.map | 1 + cjs/api/form/PDFForm.d.ts | 426 +++++ cjs/api/form/PDFForm.d.ts.map | 1 + cjs/api/form/PDFForm.js | 758 +++++++++ cjs/api/form/PDFForm.js.map | 1 + cjs/api/form/PDFOptionList.d.ts | 336 ++++ cjs/api/form/PDFOptionList.d.ts.map | 1 + cjs/api/form/PDFOptionList.js | 499 ++++++ cjs/api/form/PDFOptionList.js.map | 1 + cjs/api/form/PDFRadioGroup.d.ts | 253 +++ cjs/api/form/PDFRadioGroup.d.ts.map | 1 + cjs/api/form/PDFRadioGroup.js | 415 +++++ cjs/api/form/PDFRadioGroup.js.map | 1 + cjs/api/form/PDFSignature.d.ts | 30 + cjs/api/form/PDFSignature.d.ts.map | 1 + cjs/api/form/PDFSignature.js | 43 + cjs/api/form/PDFSignature.js.map | 1 + cjs/api/form/PDFTextField.d.ts | 538 ++++++ cjs/api/form/PDFTextField.d.ts.map | 1 + cjs/api/form/PDFTextField.js | 739 +++++++++ cjs/api/form/PDFTextField.js.map | 1 + cjs/api/form/appearances.d.ts | 42 + cjs/api/form/appearances.d.ts.map | 1 + cjs/api/form/appearances.js | 421 +++++ cjs/api/form/appearances.js.map | 1 + cjs/api/form/index.d.ts | 11 + cjs/api/form/index.d.ts.map | 1 + cjs/api/form/index.js | 23 + cjs/api/form/index.js.map | 1 + cjs/api/image/alignment.d.ts | 6 + cjs/api/image/alignment.d.ts.map | 1 + cjs/api/image/alignment.js | 10 + cjs/api/image/alignment.js.map | 1 + cjs/api/image/index.d.ts | 2 + cjs/api/image/index.d.ts.map | 1 + cjs/api/image/index.js | 5 + cjs/api/image/index.js.map | 1 + cjs/api/index.d.ts | 21 + cjs/api/index.d.ts.map | 1 + cjs/api/index.js | 29 + cjs/api/index.js.map | 1 + cjs/api/objects.d.ts | 5 + cjs/api/objects.d.ts.map | 1 + cjs/api/objects.js | 14 + cjs/api/objects.js.map | 1 + cjs/api/operations.d.ts | 212 +++ cjs/api/operations.d.ts.map | 1 + cjs/api/operations.js | 488 ++++++ cjs/api/operations.js.map | 1 + cjs/api/operators.d.ts | 86 + cjs/api/operators.d.ts.map | 1 + cjs/api/operators.js | 231 +++ cjs/api/operators.js.map | 1 + cjs/api/rotations.d.ts | 39 + cjs/api/rotations.d.ts.map | 1 + cjs/api/rotations.js | 71 + cjs/api/rotations.js.map | 1 + cjs/api/sizes.d.ts | 53 + cjs/api/sizes.d.ts.map | 1 + cjs/api/sizes.js | 56 + cjs/api/sizes.js.map | 1 + cjs/api/svgPath.d.ts | 3 + cjs/api/svgPath.d.ts.map | 1 + cjs/api/svgPath.js | 380 +++++ cjs/api/svgPath.js.map | 1 + cjs/api/text/alignment.d.ts | 6 + cjs/api/text/alignment.d.ts.map | 1 + cjs/api/text/alignment.js | 10 + cjs/api/text/alignment.js.map | 1 + cjs/api/text/index.d.ts | 3 + cjs/api/text/index.d.ts.map | 1 + cjs/api/text/index.js | 6 + cjs/api/text/index.js.map | 1 + cjs/api/text/layout.d.ts | 55 + cjs/api/text/layout.d.ts.map | 1 + cjs/api/text/layout.js | 212 +++ cjs/api/text/layout.js.map | 1 + cjs/core/PDFContext.d.ts | 84 + cjs/core/PDFContext.d.ts.map | 1 + cjs/core/PDFContext.js | 201 +++ cjs/core/PDFContext.js.map | 1 + cjs/core/PDFObjectCopier.d.ts | 38 + cjs/core/PDFObjectCopier.d.ts.map | 1 + cjs/core/PDFObjectCopier.js | 119 ++ cjs/core/PDFObjectCopier.js.map | 1 + cjs/core/acroform/PDFAcroButton.d.ts | 22 + cjs/core/acroform/PDFAcroButton.d.ts.map | 1 + cjs/core/acroform/PDFAcroButton.js | 96 ++ cjs/core/acroform/PDFAcroButton.js.map | 1 + cjs/core/acroform/PDFAcroCheckBox.d.ts | 14 + cjs/core/acroform/PDFAcroCheckBox.d.ts.map | 1 + cjs/core/acroform/PDFAcroCheckBox.js | 50 + cjs/core/acroform/PDFAcroCheckBox.js.map | 1 + cjs/core/acroform/PDFAcroChoice.d.ts | 21 + cjs/core/acroform/PDFAcroChoice.d.ts.map | 1 + cjs/core/acroform/PDFAcroChoice.js | 127 ++ cjs/core/acroform/PDFAcroChoice.js.map | 1 + cjs/core/acroform/PDFAcroComboBox.d.ts | 10 + cjs/core/acroform/PDFAcroComboBox.d.ts.map | 1 + cjs/core/acroform/PDFAcroComboBox.js | 26 + cjs/core/acroform/PDFAcroComboBox.js.map | 1 + cjs/core/acroform/PDFAcroField.d.ts | 37 + cjs/core/acroform/PDFAcroField.d.ts.map | 1 + cjs/core/acroform/PDFAcroField.js | 149 ++ cjs/core/acroform/PDFAcroField.js.map | 1 + cjs/core/acroform/PDFAcroForm.d.ts | 21 + cjs/core/acroform/PDFAcroForm.d.ts.map | 1 + cjs/core/acroform/PDFAcroForm.js | 78 + cjs/core/acroform/PDFAcroForm.js.map | 1 + cjs/core/acroform/PDFAcroListBox.d.ts | 10 + cjs/core/acroform/PDFAcroListBox.d.ts.map | 1 + cjs/core/acroform/PDFAcroListBox.js | 24 + cjs/core/acroform/PDFAcroListBox.js.map | 1 + cjs/core/acroform/PDFAcroNonTerminal.d.ts | 14 + cjs/core/acroform/PDFAcroNonTerminal.d.ts.map | 1 + cjs/core/acroform/PDFAcroNonTerminal.js | 34 + cjs/core/acroform/PDFAcroNonTerminal.js.map | 1 + cjs/core/acroform/PDFAcroPushButton.d.ts | 10 + cjs/core/acroform/PDFAcroPushButton.d.ts.map | 1 + cjs/core/acroform/PDFAcroPushButton.js | 26 + cjs/core/acroform/PDFAcroPushButton.js.map | 1 + cjs/core/acroform/PDFAcroRadioButton.d.ts | 14 + cjs/core/acroform/PDFAcroRadioButton.d.ts.map | 1 + cjs/core/acroform/PDFAcroRadioButton.js | 57 + cjs/core/acroform/PDFAcroRadioButton.js.map | 1 + cjs/core/acroform/PDFAcroSignature.d.ts | 8 + cjs/core/acroform/PDFAcroSignature.d.ts.map | 1 + cjs/core/acroform/PDFAcroSignature.js | 16 + cjs/core/acroform/PDFAcroSignature.js.map | 1 + cjs/core/acroform/PDFAcroTerminal.d.ts | 17 + cjs/core/acroform/PDFAcroTerminal.d.ts.map | 1 + cjs/core/acroform/PDFAcroTerminal.js | 70 + cjs/core/acroform/PDFAcroTerminal.js.map | 1 + cjs/core/acroform/PDFAcroText.d.ts | 23 + cjs/core/acroform/PDFAcroText.d.ts.map | 1 + cjs/core/acroform/PDFAcroText.js | 73 + cjs/core/acroform/PDFAcroText.js.map | 1 + cjs/core/acroform/flags.d.ts | 142 ++ cjs/core/acroform/flags.d.ts.map | 1 + cjs/core/acroform/flags.js | 150 ++ cjs/core/acroform/flags.js.map | 1 + cjs/core/acroform/index.d.ts | 16 + cjs/core/acroform/index.d.ts.map | 1 + cjs/core/acroform/index.js | 32 + cjs/core/acroform/index.js.map | 1 + cjs/core/acroform/utils.d.ts | 7 + cjs/core/acroform/utils.d.ts.map | 1 + cjs/core/acroform/utils.js | 127 ++ cjs/core/acroform/utils.js.map | 1 + .../annotation/AppearanceCharacteristics.d.ts | 34 + .../AppearanceCharacteristics.d.ts.map | 1 + .../annotation/AppearanceCharacteristics.js | 123 ++ .../AppearanceCharacteristics.js.map | 1 + cjs/core/annotation/BorderStyle.d.ts | 12 + cjs/core/annotation/BorderStyle.d.ts.map | 1 + cjs/core/annotation/BorderStyle.js | 29 + cjs/core/annotation/BorderStyle.js.map | 1 + cjs/core/annotation/PDFAnnotation.d.ts | 52 + cjs/core/annotation/PDFAnnotation.d.ts.map | 1 + cjs/core/annotation/PDFAnnotation.js | 123 ++ cjs/core/annotation/PDFAnnotation.js.map | 1 + cjs/core/annotation/PDFWidgetAnnotation.d.ts | 27 + .../annotation/PDFWidgetAnnotation.d.ts.map | 1 + cjs/core/annotation/PDFWidgetAnnotation.js | 110 ++ .../annotation/PDFWidgetAnnotation.js.map | 1 + cjs/core/annotation/flags.d.ts | 80 + cjs/core/annotation/flags.d.ts.map | 1 + cjs/core/annotation/flags.js | 85 + cjs/core/annotation/flags.js.map | 1 + cjs/core/annotation/index.d.ts | 5 + cjs/core/annotation/index.d.ts.map | 1 + cjs/core/annotation/index.js | 11 + cjs/core/annotation/index.js.map | 1 + cjs/core/document/PDFCrossRefSection.d.ts | 28 + cjs/core/document/PDFCrossRefSection.d.ts.map | 1 + cjs/core/document/PDFCrossRefSection.js | 124 ++ cjs/core/document/PDFCrossRefSection.js.map | 1 + cjs/core/document/PDFHeader.d.ts | 11 + cjs/core/document/PDFHeader.d.ts.map | 1 + cjs/core/document/PDFHeader.js | 42 + cjs/core/document/PDFHeader.js.map | 1 + cjs/core/document/PDFTrailer.d.ts | 10 + cjs/core/document/PDFTrailer.d.ts.map | 1 + cjs/core/document/PDFTrailer.js | 43 + cjs/core/document/PDFTrailer.js.map | 1 + cjs/core/document/PDFTrailerDict.d.ts | 11 + cjs/core/document/PDFTrailerDict.d.ts.map | 1 + cjs/core/document/PDFTrailerDict.js | 32 + cjs/core/document/PDFTrailerDict.js.map | 1 + cjs/core/embedders/CMap.d.ts | 4 + cjs/core/embedders/CMap.d.ts.map | 1 + cjs/core/embedders/CMap.js | 43 + cjs/core/embedders/CMap.js.map | 1 + cjs/core/embedders/CustomFontEmbedder.d.ts | 45 + .../embedders/CustomFontEmbedder.d.ts.map | 1 + cjs/core/embedders/CustomFontEmbedder.js | 240 +++ cjs/core/embedders/CustomFontEmbedder.js.map | 1 + .../embedders/CustomFontSubsetEmbedder.d.ts | 21 + .../CustomFontSubsetEmbedder.d.ts.map | 1 + .../embedders/CustomFontSubsetEmbedder.js | 68 + .../embedders/CustomFontSubsetEmbedder.js.map | 1 + cjs/core/embedders/FileEmbedder.d.ts | 34 + cjs/core/embedders/FileEmbedder.d.ts.map | 1 + cjs/core/embedders/FileEmbedder.js | 75 + cjs/core/embedders/FileEmbedder.js.map | 1 + cjs/core/embedders/FontFlags.d.ts | 14 + cjs/core/embedders/FontFlags.d.ts.map | 1 + cjs/core/embedders/FontFlags.js | 40 + cjs/core/embedders/FontFlags.js.map | 1 + cjs/core/embedders/JavaScriptEmbedder.d.ts | 11 + .../embedders/JavaScriptEmbedder.d.ts.map | 1 + cjs/core/embedders/JavaScriptEmbedder.js | 36 + cjs/core/embedders/JavaScriptEmbedder.js.map | 1 + cjs/core/embedders/JpegEmbedder.d.ts | 24 + cjs/core/embedders/JpegEmbedder.d.ts.map | 1 + cjs/core/embedders/JpegEmbedder.js | 107 ++ cjs/core/embedders/JpegEmbedder.js.map | 1 + cjs/core/embedders/PDFPageEmbedder.d.ts | 38 + cjs/core/embedders/PDFPageEmbedder.d.ts.map | 1 + cjs/core/embedders/PDFPageEmbedder.js | 91 ++ cjs/core/embedders/PDFPageEmbedder.js.map | 1 + cjs/core/embedders/PngEmbedder.d.ts | 20 + cjs/core/embedders/PngEmbedder.d.ts.map | 1 + cjs/core/embedders/PngEmbedder.js | 69 + cjs/core/embedders/PngEmbedder.js.map | 1 + cjs/core/embedders/StandardFontEmbedder.d.ts | 37 + .../embedders/StandardFontEmbedder.d.ts.map | 1 + cjs/core/embedders/StandardFontEmbedder.js | 98 ++ .../embedders/StandardFontEmbedder.js.map | 1 + cjs/core/errors.d.ts | 92 ++ cjs/core/errors.d.ts.map | 1 + cjs/core/errors.js | 323 ++++ cjs/core/errors.js.map | 1 + cjs/core/index.d.ts | 48 + cjs/core/index.d.ts.map | 1 + cjs/core/index.js | 100 ++ cjs/core/index.js.map | 1 + cjs/core/interactive/ViewerPreferences.d.ts | 348 ++++ .../interactive/ViewerPreferences.d.ts.map | 1 + cjs/core/interactive/ViewerPreferences.js | 511 ++++++ cjs/core/interactive/ViewerPreferences.js.map | 1 + cjs/core/objects/PDFArray.d.ts | 64 + cjs/core/objects/PDFArray.d.ts.map | 1 + cjs/core/objects/PDFArray.js | 117 ++ cjs/core/objects/PDFArray.js.map | 1 + cjs/core/objects/PDFBool.d.ts | 14 + cjs/core/objects/PDFBool.d.ts.map | 1 + cjs/core/objects/PDFBool.js | 52 + cjs/core/objects/PDFBool.js.map | 1 + cjs/core/objects/PDFDict.d.ts | 62 + cjs/core/objects/PDFDict.d.ts.map | 1 + cjs/core/objects/PDFDict.js | 138 ++ cjs/core/objects/PDFDict.js.map | 1 + cjs/core/objects/PDFHexString.d.ts | 17 + cjs/core/objects/PDFHexString.d.ts.map | 1 + cjs/core/objects/PDFHexString.js | 74 + cjs/core/objects/PDFHexString.js.map | 1 + cjs/core/objects/PDFInvalidObject.d.ts | 12 + cjs/core/objects/PDFInvalidObject.d.ts.map | 1 + cjs/core/objects/PDFInvalidObject.js | 32 + cjs/core/objects/PDFInvalidObject.js.map | 1 + cjs/core/objects/PDFName.d.ts | 42 + cjs/core/objects/PDFName.d.ts.map | 1 + cjs/core/objects/PDFName.js | 138 ++ cjs/core/objects/PDFName.js.map | 1 + cjs/core/objects/PDFNull.d.ts | 11 + cjs/core/objects/PDFNull.d.ts.map | 1 + cjs/core/objects/PDFNull.js | 33 + cjs/core/objects/PDFNull.js.map | 1 + cjs/core/objects/PDFNumber.d.ts | 16 + cjs/core/objects/PDFNumber.d.ts.map | 1 + cjs/core/objects/PDFNumber.js | 38 + cjs/core/objects/PDFNumber.js.map | 1 + cjs/core/objects/PDFObject.d.ts | 9 + cjs/core/objects/PDFObject.d.ts.map | 1 + cjs/core/objects/PDFObject.js | 22 + cjs/core/objects/PDFObject.js.map | 1 + cjs/core/objects/PDFRawStream.d.ts | 15 + cjs/core/objects/PDFRawStream.d.ts.map | 1 + cjs/core/objects/PDFRawStream.js | 34 + cjs/core/objects/PDFRawStream.js.map | 1 + cjs/core/objects/PDFRef.d.ts | 14 + cjs/core/objects/PDFRef.d.ts.map | 1 + cjs/core/objects/PDFRef.js | 47 + cjs/core/objects/PDFRef.js.map | 1 + cjs/core/objects/PDFStream.d.ts | 17 + cjs/core/objects/PDFStream.d.ts.map | 1 + cjs/core/objects/PDFStream.js | 75 + cjs/core/objects/PDFStream.js.map | 1 + cjs/core/objects/PDFString.d.ts | 17 + cjs/core/objects/PDFString.d.ts.map | 1 + cjs/core/objects/PDFString.js | 116 ++ cjs/core/objects/PDFString.js.map | 1 + cjs/core/operators/PDFOperator.d.ts | 20 + cjs/core/operators/PDFOperator.d.ts.map | 1 + cjs/core/operators/PDFOperator.js | 58 + cjs/core/operators/PDFOperator.js.map | 1 + cjs/core/operators/PDFOperatorNames.d.ts | 77 + cjs/core/operators/PDFOperatorNames.d.ts.map | 1 + cjs/core/operators/PDFOperatorNames.js | 88 + cjs/core/operators/PDFOperatorNames.js.map | 1 + cjs/core/parser/BaseParser.d.ts | 15 + cjs/core/parser/BaseParser.d.ts.map | 1 + cjs/core/parser/BaseParser.js | 110 ++ cjs/core/parser/BaseParser.js.map | 1 + cjs/core/parser/ByteStream.d.ts | 27 + cjs/core/parser/ByteStream.d.ts.map | 1 + cjs/core/parser/ByteStream.js | 64 + cjs/core/parser/ByteStream.js.map | 1 + cjs/core/parser/PDFObjectParser.d.ts | 30 + cjs/core/parser/PDFObjectParser.d.ts.map | 1 + cjs/core/parser/PDFObjectParser.js | 233 +++ cjs/core/parser/PDFObjectParser.js.map | 1 + cjs/core/parser/PDFObjectStreamParser.d.ts | 14 + .../parser/PDFObjectStreamParser.d.ts.map | 1 + cjs/core/parser/PDFObjectStreamParser.js | 70 + cjs/core/parser/PDFObjectStreamParser.js.map | 1 + cjs/core/parser/PDFParser.d.ts | 46 + cjs/core/parser/PDFParser.d.ts.map | 1 + cjs/core/parser/PDFParser.js | 356 ++++ cjs/core/parser/PDFParser.js.map | 1 + cjs/core/parser/PDFXRefStreamParser.d.ts | 22 + cjs/core/parser/PDFXRefStreamParser.d.ts.map | 1 + cjs/core/parser/PDFXRefStreamParser.js | 92 ++ cjs/core/parser/PDFXRefStreamParser.js.map | 1 + cjs/core/streams/Ascii85Stream.d.ts | 10 + cjs/core/streams/Ascii85Stream.d.ts.map | 1 + cjs/core/streams/Ascii85Stream.js | 87 + cjs/core/streams/Ascii85Stream.js.map | 1 + cjs/core/streams/AsciiHexStream.d.ts | 10 + cjs/core/streams/AsciiHexStream.d.ts.map | 1 + cjs/core/streams/AsciiHexStream.js | 75 + cjs/core/streams/AsciiHexStream.js.map | 1 + cjs/core/streams/DecodeStream.d.ts | 27 + cjs/core/streams/DecodeStream.d.ts.map | 1 + cjs/core/streams/DecodeStream.js | 149 ++ cjs/core/streams/DecodeStream.js.map | 1 + cjs/core/streams/FlateStream.d.ts | 14 + cjs/core/streams/FlateStream.d.ts.map | 1 + cjs/core/streams/FlateStream.js | 371 +++++ cjs/core/streams/FlateStream.js.map | 1 + cjs/core/streams/LZWStream.d.ts | 13 + cjs/core/streams/LZWStream.d.ts.map | 1 + cjs/core/streams/LZWStream.js | 137 ++ cjs/core/streams/LZWStream.js.map | 1 + cjs/core/streams/RunLengthStream.d.ts | 9 + cjs/core/streams/RunLengthStream.d.ts.map | 1 + cjs/core/streams/RunLengthStream.js | 55 + cjs/core/streams/RunLengthStream.js.map | 1 + cjs/core/streams/Stream.d.ts | 35 + cjs/core/streams/Stream.d.ts.map | 1 + cjs/core/streams/Stream.js | 106 ++ cjs/core/streams/Stream.js.map | 1 + cjs/core/streams/decode.d.ts | 4 + cjs/core/streams/decode.d.ts.map | 1 + cjs/core/streams/decode.js | 59 + cjs/core/streams/decode.js.map | 1 + cjs/core/structures/PDFCatalog.d.ts | 28 + cjs/core/structures/PDFCatalog.d.ts.map | 1 + cjs/core/structures/PDFCatalog.js | 79 + cjs/core/structures/PDFCatalog.js.map | 1 + cjs/core/structures/PDFContentStream.d.ts | 16 + cjs/core/structures/PDFContentStream.d.ts.map | 1 + cjs/core/structures/PDFContentStream.js | 60 + cjs/core/structures/PDFContentStream.js.map | 1 + cjs/core/structures/PDFCrossRefStream.d.ts | 54 + .../structures/PDFCrossRefStream.d.ts.map | 1 + cjs/core/structures/PDFCrossRefStream.js | 187 +++ cjs/core/structures/PDFCrossRefStream.js.map | 1 + cjs/core/structures/PDFFlateStream.d.ts | 14 + cjs/core/structures/PDFFlateStream.d.ts.map | 1 + cjs/core/structures/PDFFlateStream.js | 35 + cjs/core/structures/PDFFlateStream.js.map | 1 + cjs/core/structures/PDFObjectStream.d.ts | 21 + cjs/core/structures/PDFObjectStream.d.ts.map | 1 + cjs/core/structures/PDFObjectStream.js | 77 + cjs/core/structures/PDFObjectStream.js.map | 1 + cjs/core/structures/PDFPageLeaf.d.ts | 55 + cjs/core/structures/PDFPageLeaf.d.ts.map | 1 + cjs/core/structures/PDFPageLeaf.js | 206 +++ cjs/core/structures/PDFPageLeaf.js.map | 1 + cjs/core/structures/PDFPageTree.d.ts | 42 + cjs/core/structures/PDFPageTree.d.ts.map | 1 + cjs/core/structures/PDFPageTree.js | 177 ++ cjs/core/structures/PDFPageTree.js.map | 1 + cjs/core/syntax/CharCodes.d.ts | 62 + cjs/core/syntax/CharCodes.d.ts.map | 1 + cjs/core/syntax/CharCodes.js | 65 + cjs/core/syntax/CharCodes.js.map | 1 + cjs/core/syntax/Delimiters.d.ts | 2 + cjs/core/syntax/Delimiters.d.ts.map | 1 + cjs/core/syntax/Delimiters.js | 17 + cjs/core/syntax/Delimiters.js.map | 1 + cjs/core/syntax/Irregular.d.ts | 2 + cjs/core/syntax/Irregular.d.ts.map | 1 + cjs/core/syntax/Irregular.js | 13 + cjs/core/syntax/Irregular.js.map | 1 + cjs/core/syntax/Keywords.d.ts | 23 + cjs/core/syntax/Keywords.d.ts.map | 1 + cjs/core/syntax/Keywords.js | 84 + cjs/core/syntax/Keywords.js.map | 1 + cjs/core/syntax/Numeric.d.ts | 4 + cjs/core/syntax/Numeric.d.ts.map | 1 + cjs/core/syntax/Numeric.js | 25 + cjs/core/syntax/Numeric.js.map | 1 + cjs/core/syntax/Whitespace.d.ts | 2 + cjs/core/syntax/Whitespace.d.ts.map | 1 + cjs/core/syntax/Whitespace.js | 13 + cjs/core/syntax/Whitespace.js.map | 1 + cjs/core/writers/PDFStreamWriter.d.ts | 20 + cjs/core/writers/PDFStreamWriter.d.ts.map | 1 + cjs/core/writers/PDFStreamWriter.js | 113 ++ cjs/core/writers/PDFStreamWriter.js.map | 1 + cjs/core/writers/PDFWriter.d.ts | 30 + cjs/core/writers/PDFWriter.d.ts.map | 1 + cjs/core/writers/PDFWriter.js | 144 ++ cjs/core/writers/PDFWriter.js.map | 1 + cjs/index.d.ts | 5 + cjs/index.d.ts.map | 1 + cjs/index.js | 8 + cjs/index.js.map | 1 + cjs/types/fontkit.d.ts | 582 +++++++ cjs/types/fontkit.d.ts.map | 1 + cjs/types/fontkit.js | 3 + cjs/types/fontkit.js.map | 1 + cjs/types/index.d.ts | 2 + cjs/types/index.d.ts.map | 1 + cjs/types/index.js | 3 + cjs/types/index.js.map | 1 + cjs/types/matrix.d.ts | 22 + cjs/types/matrix.d.ts.map | 1 + cjs/types/matrix.js | 5 + cjs/types/matrix.js.map | 1 + cjs/utils/Cache.d.ts | 11 + cjs/utils/Cache.d.ts.map | 1 + cjs/utils/Cache.js | 23 + cjs/utils/Cache.js.map | 1 + cjs/utils/arrays.d.ts | 16 + cjs/utils/arrays.d.ts.map | 1 + cjs/utils/arrays.js | 132 ++ cjs/utils/arrays.js.map | 1 + cjs/utils/async.d.ts | 6 + cjs/utils/async.d.ts.map | 1 + cjs/utils/async.js | 13 + cjs/utils/async.js.map | 1 + cjs/utils/base64.d.ts | 11 + cjs/utils/base64.d.ts.map | 1 + cjs/utils/base64.js | 87 + cjs/utils/base64.js.map | 1 + cjs/utils/errors.d.ts | 2 + cjs/utils/errors.d.ts.map | 1 + cjs/utils/errors.js | 7 + cjs/utils/errors.js.map | 1 + cjs/utils/index.d.ts | 12 + cjs/utils/index.d.ts.map | 1 + cjs/utils/index.js | 16 + cjs/utils/index.js.map | 1 + cjs/utils/numbers.d.ts | 24 + cjs/utils/numbers.d.ts.map | 1 + cjs/utils/numbers.js | 57 + cjs/utils/numbers.js.map | 1 + cjs/utils/objects.d.ts | 16 + cjs/utils/objects.d.ts.map | 1 + cjs/utils/objects.js | 11 + cjs/utils/objects.js.map | 1 + cjs/utils/pdfDocEncoding.d.ts | 8 + cjs/utils/pdfDocEncoding.d.ts.map | 1 + cjs/utils/pdfDocEncoding.js | 69 + cjs/utils/pdfDocEncoding.js.map | 1 + cjs/utils/png.d.ts | 18 + cjs/utils/png.d.ts.map | 1 + cjs/utils/png.js | 63 + cjs/utils/png.js.map | 1 + cjs/utils/rng.d.ts | 14 + cjs/utils/rng.d.ts.map | 1 + cjs/utils/rng.js | 23 + cjs/utils/rng.js.map | 1 + cjs/utils/strings.d.ts | 25 + cjs/utils/strings.d.ts.map | 1 + cjs/utils/strings.js | 141 ++ cjs/utils/strings.js.map | 1 + cjs/utils/unicode.d.ts | 187 +++ cjs/utils/unicode.d.ts.map | 1 + cjs/utils/unicode.js | 370 +++++ cjs/utils/unicode.js.map | 1 + cjs/utils/validators.d.ts | 27 + cjs/utils/validators.d.ts.map | 1 + cjs/utils/validators.js | 183 +++ cjs/utils/validators.js.map | 1 + src/api/form/PDFForm.ts | 43 +- 558 files changed, 28168 insertions(+), 3 deletions(-) create mode 100644 cjs/api/Embeddable.d.ts create mode 100644 cjs/api/Embeddable.d.ts.map create mode 100644 cjs/api/Embeddable.js create mode 100644 cjs/api/Embeddable.js.map create mode 100644 cjs/api/PDFDocument.d.ts create mode 100644 cjs/api/PDFDocument.d.ts.map create mode 100644 cjs/api/PDFDocument.js create mode 100644 cjs/api/PDFDocument.js.map create mode 100644 cjs/api/PDFDocumentOptions.d.ts create mode 100644 cjs/api/PDFDocumentOptions.d.ts.map create mode 100644 cjs/api/PDFDocumentOptions.js create mode 100644 cjs/api/PDFDocumentOptions.js.map create mode 100644 cjs/api/PDFEmbeddedFile.d.ts create mode 100644 cjs/api/PDFEmbeddedFile.d.ts.map create mode 100644 cjs/api/PDFEmbeddedFile.js create mode 100644 cjs/api/PDFEmbeddedFile.js.map create mode 100644 cjs/api/PDFEmbeddedPage.d.ts create mode 100644 cjs/api/PDFEmbeddedPage.d.ts.map create mode 100644 cjs/api/PDFEmbeddedPage.js create mode 100644 cjs/api/PDFEmbeddedPage.js.map create mode 100644 cjs/api/PDFFont.d.ts create mode 100644 cjs/api/PDFFont.d.ts.map create mode 100644 cjs/api/PDFFont.js create mode 100644 cjs/api/PDFFont.js.map create mode 100644 cjs/api/PDFImage.d.ts create mode 100644 cjs/api/PDFImage.d.ts.map create mode 100644 cjs/api/PDFImage.js create mode 100644 cjs/api/PDFImage.js.map create mode 100644 cjs/api/PDFJavaScript.d.ts create mode 100644 cjs/api/PDFJavaScript.d.ts.map create mode 100644 cjs/api/PDFJavaScript.js create mode 100644 cjs/api/PDFJavaScript.js.map create mode 100644 cjs/api/PDFPage.d.ts create mode 100644 cjs/api/PDFPage.d.ts.map create mode 100644 cjs/api/PDFPage.js create mode 100644 cjs/api/PDFPage.js.map create mode 100644 cjs/api/PDFPageOptions.d.ts create mode 100644 cjs/api/PDFPageOptions.d.ts.map create mode 100644 cjs/api/PDFPageOptions.js create mode 100644 cjs/api/PDFPageOptions.js.map create mode 100644 cjs/api/StandardFonts.d.ts create mode 100644 cjs/api/StandardFonts.d.ts.map create mode 100644 cjs/api/StandardFonts.js create mode 100644 cjs/api/StandardFonts.js.map create mode 100644 cjs/api/colors.d.ts create mode 100644 cjs/api/colors.d.ts.map create mode 100644 cjs/api/colors.js create mode 100644 cjs/api/colors.js.map create mode 100644 cjs/api/errors.d.ts create mode 100644 cjs/api/errors.d.ts.map create mode 100644 cjs/api/errors.js create mode 100644 cjs/api/errors.js.map create mode 100644 cjs/api/form/PDFButton.d.ts create mode 100644 cjs/api/form/PDFButton.d.ts.map create mode 100644 cjs/api/form/PDFButton.js create mode 100644 cjs/api/form/PDFButton.js.map create mode 100644 cjs/api/form/PDFCheckBox.d.ts create mode 100644 cjs/api/form/PDFCheckBox.d.ts.map create mode 100644 cjs/api/form/PDFCheckBox.js create mode 100644 cjs/api/form/PDFCheckBox.js.map create mode 100644 cjs/api/form/PDFDropdown.d.ts create mode 100644 cjs/api/form/PDFDropdown.d.ts.map create mode 100644 cjs/api/form/PDFDropdown.js create mode 100644 cjs/api/form/PDFDropdown.js.map create mode 100644 cjs/api/form/PDFField.d.ts create mode 100644 cjs/api/form/PDFField.d.ts.map create mode 100644 cjs/api/form/PDFField.js create mode 100644 cjs/api/form/PDFField.js.map create mode 100644 cjs/api/form/PDFForm.d.ts create mode 100644 cjs/api/form/PDFForm.d.ts.map create mode 100644 cjs/api/form/PDFForm.js create mode 100644 cjs/api/form/PDFForm.js.map create mode 100644 cjs/api/form/PDFOptionList.d.ts create mode 100644 cjs/api/form/PDFOptionList.d.ts.map create mode 100644 cjs/api/form/PDFOptionList.js create mode 100644 cjs/api/form/PDFOptionList.js.map create mode 100644 cjs/api/form/PDFRadioGroup.d.ts create mode 100644 cjs/api/form/PDFRadioGroup.d.ts.map create mode 100644 cjs/api/form/PDFRadioGroup.js create mode 100644 cjs/api/form/PDFRadioGroup.js.map create mode 100644 cjs/api/form/PDFSignature.d.ts create mode 100644 cjs/api/form/PDFSignature.d.ts.map create mode 100644 cjs/api/form/PDFSignature.js create mode 100644 cjs/api/form/PDFSignature.js.map create mode 100644 cjs/api/form/PDFTextField.d.ts create mode 100644 cjs/api/form/PDFTextField.d.ts.map create mode 100644 cjs/api/form/PDFTextField.js create mode 100644 cjs/api/form/PDFTextField.js.map create mode 100644 cjs/api/form/appearances.d.ts create mode 100644 cjs/api/form/appearances.d.ts.map create mode 100644 cjs/api/form/appearances.js create mode 100644 cjs/api/form/appearances.js.map create mode 100644 cjs/api/form/index.d.ts create mode 100644 cjs/api/form/index.d.ts.map create mode 100644 cjs/api/form/index.js create mode 100644 cjs/api/form/index.js.map create mode 100644 cjs/api/image/alignment.d.ts create mode 100644 cjs/api/image/alignment.d.ts.map create mode 100644 cjs/api/image/alignment.js create mode 100644 cjs/api/image/alignment.js.map create mode 100644 cjs/api/image/index.d.ts create mode 100644 cjs/api/image/index.d.ts.map create mode 100644 cjs/api/image/index.js create mode 100644 cjs/api/image/index.js.map create mode 100644 cjs/api/index.d.ts create mode 100644 cjs/api/index.d.ts.map create mode 100644 cjs/api/index.js create mode 100644 cjs/api/index.js.map create mode 100644 cjs/api/objects.d.ts create mode 100644 cjs/api/objects.d.ts.map create mode 100644 cjs/api/objects.js create mode 100644 cjs/api/objects.js.map create mode 100644 cjs/api/operations.d.ts create mode 100644 cjs/api/operations.d.ts.map create mode 100644 cjs/api/operations.js create mode 100644 cjs/api/operations.js.map create mode 100644 cjs/api/operators.d.ts create mode 100644 cjs/api/operators.d.ts.map create mode 100644 cjs/api/operators.js create mode 100644 cjs/api/operators.js.map create mode 100644 cjs/api/rotations.d.ts create mode 100644 cjs/api/rotations.d.ts.map create mode 100644 cjs/api/rotations.js create mode 100644 cjs/api/rotations.js.map create mode 100644 cjs/api/sizes.d.ts create mode 100644 cjs/api/sizes.d.ts.map create mode 100644 cjs/api/sizes.js create mode 100644 cjs/api/sizes.js.map create mode 100644 cjs/api/svgPath.d.ts create mode 100644 cjs/api/svgPath.d.ts.map create mode 100644 cjs/api/svgPath.js create mode 100644 cjs/api/svgPath.js.map create mode 100644 cjs/api/text/alignment.d.ts create mode 100644 cjs/api/text/alignment.d.ts.map create mode 100644 cjs/api/text/alignment.js create mode 100644 cjs/api/text/alignment.js.map create mode 100644 cjs/api/text/index.d.ts create mode 100644 cjs/api/text/index.d.ts.map create mode 100644 cjs/api/text/index.js create mode 100644 cjs/api/text/index.js.map create mode 100644 cjs/api/text/layout.d.ts create mode 100644 cjs/api/text/layout.d.ts.map create mode 100644 cjs/api/text/layout.js create mode 100644 cjs/api/text/layout.js.map create mode 100644 cjs/core/PDFContext.d.ts create mode 100644 cjs/core/PDFContext.d.ts.map create mode 100644 cjs/core/PDFContext.js create mode 100644 cjs/core/PDFContext.js.map create mode 100644 cjs/core/PDFObjectCopier.d.ts create mode 100644 cjs/core/PDFObjectCopier.d.ts.map create mode 100644 cjs/core/PDFObjectCopier.js create mode 100644 cjs/core/PDFObjectCopier.js.map create mode 100644 cjs/core/acroform/PDFAcroButton.d.ts create mode 100644 cjs/core/acroform/PDFAcroButton.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroButton.js create mode 100644 cjs/core/acroform/PDFAcroButton.js.map create mode 100644 cjs/core/acroform/PDFAcroCheckBox.d.ts create mode 100644 cjs/core/acroform/PDFAcroCheckBox.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroCheckBox.js create mode 100644 cjs/core/acroform/PDFAcroCheckBox.js.map create mode 100644 cjs/core/acroform/PDFAcroChoice.d.ts create mode 100644 cjs/core/acroform/PDFAcroChoice.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroChoice.js create mode 100644 cjs/core/acroform/PDFAcroChoice.js.map create mode 100644 cjs/core/acroform/PDFAcroComboBox.d.ts create mode 100644 cjs/core/acroform/PDFAcroComboBox.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroComboBox.js create mode 100644 cjs/core/acroform/PDFAcroComboBox.js.map create mode 100644 cjs/core/acroform/PDFAcroField.d.ts create mode 100644 cjs/core/acroform/PDFAcroField.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroField.js create mode 100644 cjs/core/acroform/PDFAcroField.js.map create mode 100644 cjs/core/acroform/PDFAcroForm.d.ts create mode 100644 cjs/core/acroform/PDFAcroForm.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroForm.js create mode 100644 cjs/core/acroform/PDFAcroForm.js.map create mode 100644 cjs/core/acroform/PDFAcroListBox.d.ts create mode 100644 cjs/core/acroform/PDFAcroListBox.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroListBox.js create mode 100644 cjs/core/acroform/PDFAcroListBox.js.map create mode 100644 cjs/core/acroform/PDFAcroNonTerminal.d.ts create mode 100644 cjs/core/acroform/PDFAcroNonTerminal.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroNonTerminal.js create mode 100644 cjs/core/acroform/PDFAcroNonTerminal.js.map create mode 100644 cjs/core/acroform/PDFAcroPushButton.d.ts create mode 100644 cjs/core/acroform/PDFAcroPushButton.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroPushButton.js create mode 100644 cjs/core/acroform/PDFAcroPushButton.js.map create mode 100644 cjs/core/acroform/PDFAcroRadioButton.d.ts create mode 100644 cjs/core/acroform/PDFAcroRadioButton.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroRadioButton.js create mode 100644 cjs/core/acroform/PDFAcroRadioButton.js.map create mode 100644 cjs/core/acroform/PDFAcroSignature.d.ts create mode 100644 cjs/core/acroform/PDFAcroSignature.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroSignature.js create mode 100644 cjs/core/acroform/PDFAcroSignature.js.map create mode 100644 cjs/core/acroform/PDFAcroTerminal.d.ts create mode 100644 cjs/core/acroform/PDFAcroTerminal.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroTerminal.js create mode 100644 cjs/core/acroform/PDFAcroTerminal.js.map create mode 100644 cjs/core/acroform/PDFAcroText.d.ts create mode 100644 cjs/core/acroform/PDFAcroText.d.ts.map create mode 100644 cjs/core/acroform/PDFAcroText.js create mode 100644 cjs/core/acroform/PDFAcroText.js.map create mode 100644 cjs/core/acroform/flags.d.ts create mode 100644 cjs/core/acroform/flags.d.ts.map create mode 100644 cjs/core/acroform/flags.js create mode 100644 cjs/core/acroform/flags.js.map create mode 100644 cjs/core/acroform/index.d.ts create mode 100644 cjs/core/acroform/index.d.ts.map create mode 100644 cjs/core/acroform/index.js create mode 100644 cjs/core/acroform/index.js.map create mode 100644 cjs/core/acroform/utils.d.ts create mode 100644 cjs/core/acroform/utils.d.ts.map create mode 100644 cjs/core/acroform/utils.js create mode 100644 cjs/core/acroform/utils.js.map create mode 100644 cjs/core/annotation/AppearanceCharacteristics.d.ts create mode 100644 cjs/core/annotation/AppearanceCharacteristics.d.ts.map create mode 100644 cjs/core/annotation/AppearanceCharacteristics.js create mode 100644 cjs/core/annotation/AppearanceCharacteristics.js.map create mode 100644 cjs/core/annotation/BorderStyle.d.ts create mode 100644 cjs/core/annotation/BorderStyle.d.ts.map create mode 100644 cjs/core/annotation/BorderStyle.js create mode 100644 cjs/core/annotation/BorderStyle.js.map create mode 100644 cjs/core/annotation/PDFAnnotation.d.ts create mode 100644 cjs/core/annotation/PDFAnnotation.d.ts.map create mode 100644 cjs/core/annotation/PDFAnnotation.js create mode 100644 cjs/core/annotation/PDFAnnotation.js.map create mode 100644 cjs/core/annotation/PDFWidgetAnnotation.d.ts create mode 100644 cjs/core/annotation/PDFWidgetAnnotation.d.ts.map create mode 100644 cjs/core/annotation/PDFWidgetAnnotation.js create mode 100644 cjs/core/annotation/PDFWidgetAnnotation.js.map create mode 100644 cjs/core/annotation/flags.d.ts create mode 100644 cjs/core/annotation/flags.d.ts.map create mode 100644 cjs/core/annotation/flags.js create mode 100644 cjs/core/annotation/flags.js.map create mode 100644 cjs/core/annotation/index.d.ts create mode 100644 cjs/core/annotation/index.d.ts.map create mode 100644 cjs/core/annotation/index.js create mode 100644 cjs/core/annotation/index.js.map create mode 100644 cjs/core/document/PDFCrossRefSection.d.ts create mode 100644 cjs/core/document/PDFCrossRefSection.d.ts.map create mode 100644 cjs/core/document/PDFCrossRefSection.js create mode 100644 cjs/core/document/PDFCrossRefSection.js.map create mode 100644 cjs/core/document/PDFHeader.d.ts create mode 100644 cjs/core/document/PDFHeader.d.ts.map create mode 100644 cjs/core/document/PDFHeader.js create mode 100644 cjs/core/document/PDFHeader.js.map create mode 100644 cjs/core/document/PDFTrailer.d.ts create mode 100644 cjs/core/document/PDFTrailer.d.ts.map create mode 100644 cjs/core/document/PDFTrailer.js create mode 100644 cjs/core/document/PDFTrailer.js.map create mode 100644 cjs/core/document/PDFTrailerDict.d.ts create mode 100644 cjs/core/document/PDFTrailerDict.d.ts.map create mode 100644 cjs/core/document/PDFTrailerDict.js create mode 100644 cjs/core/document/PDFTrailerDict.js.map create mode 100644 cjs/core/embedders/CMap.d.ts create mode 100644 cjs/core/embedders/CMap.d.ts.map create mode 100644 cjs/core/embedders/CMap.js create mode 100644 cjs/core/embedders/CMap.js.map create mode 100644 cjs/core/embedders/CustomFontEmbedder.d.ts create mode 100644 cjs/core/embedders/CustomFontEmbedder.d.ts.map create mode 100644 cjs/core/embedders/CustomFontEmbedder.js create mode 100644 cjs/core/embedders/CustomFontEmbedder.js.map create mode 100644 cjs/core/embedders/CustomFontSubsetEmbedder.d.ts create mode 100644 cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map create mode 100644 cjs/core/embedders/CustomFontSubsetEmbedder.js create mode 100644 cjs/core/embedders/CustomFontSubsetEmbedder.js.map create mode 100644 cjs/core/embedders/FileEmbedder.d.ts create mode 100644 cjs/core/embedders/FileEmbedder.d.ts.map create mode 100644 cjs/core/embedders/FileEmbedder.js create mode 100644 cjs/core/embedders/FileEmbedder.js.map create mode 100644 cjs/core/embedders/FontFlags.d.ts create mode 100644 cjs/core/embedders/FontFlags.d.ts.map create mode 100644 cjs/core/embedders/FontFlags.js create mode 100644 cjs/core/embedders/FontFlags.js.map create mode 100644 cjs/core/embedders/JavaScriptEmbedder.d.ts create mode 100644 cjs/core/embedders/JavaScriptEmbedder.d.ts.map create mode 100644 cjs/core/embedders/JavaScriptEmbedder.js create mode 100644 cjs/core/embedders/JavaScriptEmbedder.js.map create mode 100644 cjs/core/embedders/JpegEmbedder.d.ts create mode 100644 cjs/core/embedders/JpegEmbedder.d.ts.map create mode 100644 cjs/core/embedders/JpegEmbedder.js create mode 100644 cjs/core/embedders/JpegEmbedder.js.map create mode 100644 cjs/core/embedders/PDFPageEmbedder.d.ts create mode 100644 cjs/core/embedders/PDFPageEmbedder.d.ts.map create mode 100644 cjs/core/embedders/PDFPageEmbedder.js create mode 100644 cjs/core/embedders/PDFPageEmbedder.js.map create mode 100644 cjs/core/embedders/PngEmbedder.d.ts create mode 100644 cjs/core/embedders/PngEmbedder.d.ts.map create mode 100644 cjs/core/embedders/PngEmbedder.js create mode 100644 cjs/core/embedders/PngEmbedder.js.map create mode 100644 cjs/core/embedders/StandardFontEmbedder.d.ts create mode 100644 cjs/core/embedders/StandardFontEmbedder.d.ts.map create mode 100644 cjs/core/embedders/StandardFontEmbedder.js create mode 100644 cjs/core/embedders/StandardFontEmbedder.js.map create mode 100644 cjs/core/errors.d.ts create mode 100644 cjs/core/errors.d.ts.map create mode 100644 cjs/core/errors.js create mode 100644 cjs/core/errors.js.map create mode 100644 cjs/core/index.d.ts create mode 100644 cjs/core/index.d.ts.map create mode 100644 cjs/core/index.js create mode 100644 cjs/core/index.js.map create mode 100644 cjs/core/interactive/ViewerPreferences.d.ts create mode 100644 cjs/core/interactive/ViewerPreferences.d.ts.map create mode 100644 cjs/core/interactive/ViewerPreferences.js create mode 100644 cjs/core/interactive/ViewerPreferences.js.map create mode 100644 cjs/core/objects/PDFArray.d.ts create mode 100644 cjs/core/objects/PDFArray.d.ts.map create mode 100644 cjs/core/objects/PDFArray.js create mode 100644 cjs/core/objects/PDFArray.js.map create mode 100644 cjs/core/objects/PDFBool.d.ts create mode 100644 cjs/core/objects/PDFBool.d.ts.map create mode 100644 cjs/core/objects/PDFBool.js create mode 100644 cjs/core/objects/PDFBool.js.map create mode 100644 cjs/core/objects/PDFDict.d.ts create mode 100644 cjs/core/objects/PDFDict.d.ts.map create mode 100644 cjs/core/objects/PDFDict.js create mode 100644 cjs/core/objects/PDFDict.js.map create mode 100644 cjs/core/objects/PDFHexString.d.ts create mode 100644 cjs/core/objects/PDFHexString.d.ts.map create mode 100644 cjs/core/objects/PDFHexString.js create mode 100644 cjs/core/objects/PDFHexString.js.map create mode 100644 cjs/core/objects/PDFInvalidObject.d.ts create mode 100644 cjs/core/objects/PDFInvalidObject.d.ts.map create mode 100644 cjs/core/objects/PDFInvalidObject.js create mode 100644 cjs/core/objects/PDFInvalidObject.js.map create mode 100644 cjs/core/objects/PDFName.d.ts create mode 100644 cjs/core/objects/PDFName.d.ts.map create mode 100644 cjs/core/objects/PDFName.js create mode 100644 cjs/core/objects/PDFName.js.map create mode 100644 cjs/core/objects/PDFNull.d.ts create mode 100644 cjs/core/objects/PDFNull.d.ts.map create mode 100644 cjs/core/objects/PDFNull.js create mode 100644 cjs/core/objects/PDFNull.js.map create mode 100644 cjs/core/objects/PDFNumber.d.ts create mode 100644 cjs/core/objects/PDFNumber.d.ts.map create mode 100644 cjs/core/objects/PDFNumber.js create mode 100644 cjs/core/objects/PDFNumber.js.map create mode 100644 cjs/core/objects/PDFObject.d.ts create mode 100644 cjs/core/objects/PDFObject.d.ts.map create mode 100644 cjs/core/objects/PDFObject.js create mode 100644 cjs/core/objects/PDFObject.js.map create mode 100644 cjs/core/objects/PDFRawStream.d.ts create mode 100644 cjs/core/objects/PDFRawStream.d.ts.map create mode 100644 cjs/core/objects/PDFRawStream.js create mode 100644 cjs/core/objects/PDFRawStream.js.map create mode 100644 cjs/core/objects/PDFRef.d.ts create mode 100644 cjs/core/objects/PDFRef.d.ts.map create mode 100644 cjs/core/objects/PDFRef.js create mode 100644 cjs/core/objects/PDFRef.js.map create mode 100644 cjs/core/objects/PDFStream.d.ts create mode 100644 cjs/core/objects/PDFStream.d.ts.map create mode 100644 cjs/core/objects/PDFStream.js create mode 100644 cjs/core/objects/PDFStream.js.map create mode 100644 cjs/core/objects/PDFString.d.ts create mode 100644 cjs/core/objects/PDFString.d.ts.map create mode 100644 cjs/core/objects/PDFString.js create mode 100644 cjs/core/objects/PDFString.js.map create mode 100644 cjs/core/operators/PDFOperator.d.ts create mode 100644 cjs/core/operators/PDFOperator.d.ts.map create mode 100644 cjs/core/operators/PDFOperator.js create mode 100644 cjs/core/operators/PDFOperator.js.map create mode 100644 cjs/core/operators/PDFOperatorNames.d.ts create mode 100644 cjs/core/operators/PDFOperatorNames.d.ts.map create mode 100644 cjs/core/operators/PDFOperatorNames.js create mode 100644 cjs/core/operators/PDFOperatorNames.js.map create mode 100644 cjs/core/parser/BaseParser.d.ts create mode 100644 cjs/core/parser/BaseParser.d.ts.map create mode 100644 cjs/core/parser/BaseParser.js create mode 100644 cjs/core/parser/BaseParser.js.map create mode 100644 cjs/core/parser/ByteStream.d.ts create mode 100644 cjs/core/parser/ByteStream.d.ts.map create mode 100644 cjs/core/parser/ByteStream.js create mode 100644 cjs/core/parser/ByteStream.js.map create mode 100644 cjs/core/parser/PDFObjectParser.d.ts create mode 100644 cjs/core/parser/PDFObjectParser.d.ts.map create mode 100644 cjs/core/parser/PDFObjectParser.js create mode 100644 cjs/core/parser/PDFObjectParser.js.map create mode 100644 cjs/core/parser/PDFObjectStreamParser.d.ts create mode 100644 cjs/core/parser/PDFObjectStreamParser.d.ts.map create mode 100644 cjs/core/parser/PDFObjectStreamParser.js create mode 100644 cjs/core/parser/PDFObjectStreamParser.js.map create mode 100644 cjs/core/parser/PDFParser.d.ts create mode 100644 cjs/core/parser/PDFParser.d.ts.map create mode 100644 cjs/core/parser/PDFParser.js create mode 100644 cjs/core/parser/PDFParser.js.map create mode 100644 cjs/core/parser/PDFXRefStreamParser.d.ts create mode 100644 cjs/core/parser/PDFXRefStreamParser.d.ts.map create mode 100644 cjs/core/parser/PDFXRefStreamParser.js create mode 100644 cjs/core/parser/PDFXRefStreamParser.js.map create mode 100644 cjs/core/streams/Ascii85Stream.d.ts create mode 100644 cjs/core/streams/Ascii85Stream.d.ts.map create mode 100644 cjs/core/streams/Ascii85Stream.js create mode 100644 cjs/core/streams/Ascii85Stream.js.map create mode 100644 cjs/core/streams/AsciiHexStream.d.ts create mode 100644 cjs/core/streams/AsciiHexStream.d.ts.map create mode 100644 cjs/core/streams/AsciiHexStream.js create mode 100644 cjs/core/streams/AsciiHexStream.js.map create mode 100644 cjs/core/streams/DecodeStream.d.ts create mode 100644 cjs/core/streams/DecodeStream.d.ts.map create mode 100644 cjs/core/streams/DecodeStream.js create mode 100644 cjs/core/streams/DecodeStream.js.map create mode 100644 cjs/core/streams/FlateStream.d.ts create mode 100644 cjs/core/streams/FlateStream.d.ts.map create mode 100644 cjs/core/streams/FlateStream.js create mode 100644 cjs/core/streams/FlateStream.js.map create mode 100644 cjs/core/streams/LZWStream.d.ts create mode 100644 cjs/core/streams/LZWStream.d.ts.map create mode 100644 cjs/core/streams/LZWStream.js create mode 100644 cjs/core/streams/LZWStream.js.map create mode 100644 cjs/core/streams/RunLengthStream.d.ts create mode 100644 cjs/core/streams/RunLengthStream.d.ts.map create mode 100644 cjs/core/streams/RunLengthStream.js create mode 100644 cjs/core/streams/RunLengthStream.js.map create mode 100644 cjs/core/streams/Stream.d.ts create mode 100644 cjs/core/streams/Stream.d.ts.map create mode 100644 cjs/core/streams/Stream.js create mode 100644 cjs/core/streams/Stream.js.map create mode 100644 cjs/core/streams/decode.d.ts create mode 100644 cjs/core/streams/decode.d.ts.map create mode 100644 cjs/core/streams/decode.js create mode 100644 cjs/core/streams/decode.js.map create mode 100644 cjs/core/structures/PDFCatalog.d.ts create mode 100644 cjs/core/structures/PDFCatalog.d.ts.map create mode 100644 cjs/core/structures/PDFCatalog.js create mode 100644 cjs/core/structures/PDFCatalog.js.map create mode 100644 cjs/core/structures/PDFContentStream.d.ts create mode 100644 cjs/core/structures/PDFContentStream.d.ts.map create mode 100644 cjs/core/structures/PDFContentStream.js create mode 100644 cjs/core/structures/PDFContentStream.js.map create mode 100644 cjs/core/structures/PDFCrossRefStream.d.ts create mode 100644 cjs/core/structures/PDFCrossRefStream.d.ts.map create mode 100644 cjs/core/structures/PDFCrossRefStream.js create mode 100644 cjs/core/structures/PDFCrossRefStream.js.map create mode 100644 cjs/core/structures/PDFFlateStream.d.ts create mode 100644 cjs/core/structures/PDFFlateStream.d.ts.map create mode 100644 cjs/core/structures/PDFFlateStream.js create mode 100644 cjs/core/structures/PDFFlateStream.js.map create mode 100644 cjs/core/structures/PDFObjectStream.d.ts create mode 100644 cjs/core/structures/PDFObjectStream.d.ts.map create mode 100644 cjs/core/structures/PDFObjectStream.js create mode 100644 cjs/core/structures/PDFObjectStream.js.map create mode 100644 cjs/core/structures/PDFPageLeaf.d.ts create mode 100644 cjs/core/structures/PDFPageLeaf.d.ts.map create mode 100644 cjs/core/structures/PDFPageLeaf.js create mode 100644 cjs/core/structures/PDFPageLeaf.js.map create mode 100644 cjs/core/structures/PDFPageTree.d.ts create mode 100644 cjs/core/structures/PDFPageTree.d.ts.map create mode 100644 cjs/core/structures/PDFPageTree.js create mode 100644 cjs/core/structures/PDFPageTree.js.map create mode 100644 cjs/core/syntax/CharCodes.d.ts create mode 100644 cjs/core/syntax/CharCodes.d.ts.map create mode 100644 cjs/core/syntax/CharCodes.js create mode 100644 cjs/core/syntax/CharCodes.js.map create mode 100644 cjs/core/syntax/Delimiters.d.ts create mode 100644 cjs/core/syntax/Delimiters.d.ts.map create mode 100644 cjs/core/syntax/Delimiters.js create mode 100644 cjs/core/syntax/Delimiters.js.map create mode 100644 cjs/core/syntax/Irregular.d.ts create mode 100644 cjs/core/syntax/Irregular.d.ts.map create mode 100644 cjs/core/syntax/Irregular.js create mode 100644 cjs/core/syntax/Irregular.js.map create mode 100644 cjs/core/syntax/Keywords.d.ts create mode 100644 cjs/core/syntax/Keywords.d.ts.map create mode 100644 cjs/core/syntax/Keywords.js create mode 100644 cjs/core/syntax/Keywords.js.map create mode 100644 cjs/core/syntax/Numeric.d.ts create mode 100644 cjs/core/syntax/Numeric.d.ts.map create mode 100644 cjs/core/syntax/Numeric.js create mode 100644 cjs/core/syntax/Numeric.js.map create mode 100644 cjs/core/syntax/Whitespace.d.ts create mode 100644 cjs/core/syntax/Whitespace.d.ts.map create mode 100644 cjs/core/syntax/Whitespace.js create mode 100644 cjs/core/syntax/Whitespace.js.map create mode 100644 cjs/core/writers/PDFStreamWriter.d.ts create mode 100644 cjs/core/writers/PDFStreamWriter.d.ts.map create mode 100644 cjs/core/writers/PDFStreamWriter.js create mode 100644 cjs/core/writers/PDFStreamWriter.js.map create mode 100644 cjs/core/writers/PDFWriter.d.ts create mode 100644 cjs/core/writers/PDFWriter.d.ts.map create mode 100644 cjs/core/writers/PDFWriter.js create mode 100644 cjs/core/writers/PDFWriter.js.map create mode 100644 cjs/index.d.ts create mode 100644 cjs/index.d.ts.map create mode 100644 cjs/index.js create mode 100644 cjs/index.js.map create mode 100644 cjs/types/fontkit.d.ts create mode 100644 cjs/types/fontkit.d.ts.map create mode 100644 cjs/types/fontkit.js create mode 100644 cjs/types/fontkit.js.map create mode 100644 cjs/types/index.d.ts create mode 100644 cjs/types/index.d.ts.map create mode 100644 cjs/types/index.js create mode 100644 cjs/types/index.js.map create mode 100644 cjs/types/matrix.d.ts create mode 100644 cjs/types/matrix.d.ts.map create mode 100644 cjs/types/matrix.js create mode 100644 cjs/types/matrix.js.map create mode 100644 cjs/utils/Cache.d.ts create mode 100644 cjs/utils/Cache.d.ts.map create mode 100644 cjs/utils/Cache.js create mode 100644 cjs/utils/Cache.js.map create mode 100644 cjs/utils/arrays.d.ts create mode 100644 cjs/utils/arrays.d.ts.map create mode 100644 cjs/utils/arrays.js create mode 100644 cjs/utils/arrays.js.map create mode 100644 cjs/utils/async.d.ts create mode 100644 cjs/utils/async.d.ts.map create mode 100644 cjs/utils/async.js create mode 100644 cjs/utils/async.js.map create mode 100644 cjs/utils/base64.d.ts create mode 100644 cjs/utils/base64.d.ts.map create mode 100644 cjs/utils/base64.js create mode 100644 cjs/utils/base64.js.map create mode 100644 cjs/utils/errors.d.ts create mode 100644 cjs/utils/errors.d.ts.map create mode 100644 cjs/utils/errors.js create mode 100644 cjs/utils/errors.js.map create mode 100644 cjs/utils/index.d.ts create mode 100644 cjs/utils/index.d.ts.map create mode 100644 cjs/utils/index.js create mode 100644 cjs/utils/index.js.map create mode 100644 cjs/utils/numbers.d.ts create mode 100644 cjs/utils/numbers.d.ts.map create mode 100644 cjs/utils/numbers.js create mode 100644 cjs/utils/numbers.js.map create mode 100644 cjs/utils/objects.d.ts create mode 100644 cjs/utils/objects.d.ts.map create mode 100644 cjs/utils/objects.js create mode 100644 cjs/utils/objects.js.map create mode 100644 cjs/utils/pdfDocEncoding.d.ts create mode 100644 cjs/utils/pdfDocEncoding.d.ts.map create mode 100644 cjs/utils/pdfDocEncoding.js create mode 100644 cjs/utils/pdfDocEncoding.js.map create mode 100644 cjs/utils/png.d.ts create mode 100644 cjs/utils/png.d.ts.map create mode 100644 cjs/utils/png.js create mode 100644 cjs/utils/png.js.map create mode 100644 cjs/utils/rng.d.ts create mode 100644 cjs/utils/rng.d.ts.map create mode 100644 cjs/utils/rng.js create mode 100644 cjs/utils/rng.js.map create mode 100644 cjs/utils/strings.d.ts create mode 100644 cjs/utils/strings.d.ts.map create mode 100644 cjs/utils/strings.js create mode 100644 cjs/utils/strings.js.map create mode 100644 cjs/utils/unicode.d.ts create mode 100644 cjs/utils/unicode.d.ts.map create mode 100644 cjs/utils/unicode.js create mode 100644 cjs/utils/unicode.js.map create mode 100644 cjs/utils/validators.d.ts create mode 100644 cjs/utils/validators.d.ts.map create mode 100644 cjs/utils/validators.js create mode 100644 cjs/utils/validators.js.map diff --git a/.gitignore b/.gitignore index 7b6199b96..010bf4813 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ coverage/ ts3.4/ build/ dist/ -cjs/ es/ tsBuildInfo.json diff --git a/cjs/api/Embeddable.d.ts b/cjs/api/Embeddable.d.ts new file mode 100644 index 000000000..68451fc8e --- /dev/null +++ b/cjs/api/Embeddable.d.ts @@ -0,0 +1,8 @@ +/** + * A PDF entity, like images or fonts, which needs to be embedded into the + * document before saving. + */ +export default interface Embeddable { + embed: () => Promise; +} +//# sourceMappingURL=Embeddable.d.ts.map \ No newline at end of file diff --git a/cjs/api/Embeddable.d.ts.map b/cjs/api/Embeddable.d.ts.map new file mode 100644 index 000000000..1f834d2ea --- /dev/null +++ b/cjs/api/Embeddable.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Embeddable.d.ts","sourceRoot":"","sources":["../../src/api/Embeddable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,UAAU;IACjC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B"} \ No newline at end of file diff --git a/cjs/api/Embeddable.js b/cjs/api/Embeddable.js new file mode 100644 index 000000000..246b48fde --- /dev/null +++ b/cjs/api/Embeddable.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Embeddable.js.map \ No newline at end of file diff --git a/cjs/api/Embeddable.js.map b/cjs/api/Embeddable.js.map new file mode 100644 index 000000000..0a1a3b715 --- /dev/null +++ b/cjs/api/Embeddable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Embeddable.js","sourceRoot":"","sources":["../../src/api/Embeddable.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/cjs/api/PDFDocument.d.ts b/cjs/api/PDFDocument.d.ts new file mode 100644 index 000000000..f0ebc790b --- /dev/null +++ b/cjs/api/PDFDocument.d.ts @@ -0,0 +1,779 @@ +import PDFEmbeddedPage from "./PDFEmbeddedPage"; +import PDFFont from "./PDFFont"; +import PDFImage from "./PDFImage"; +import PDFPage from "./PDFPage"; +import PDFForm from "./form/PDFForm"; +import { StandardFonts } from "./StandardFonts"; +import { PageBoundingBox, PDFCatalog, PDFContext } from "../core"; +import { AttachmentOptions, SaveOptions, Base64SaveOptions, LoadOptions, CreateOptions, EmbedFontOptions, SetTitleOptions } from "./PDFDocumentOptions"; +import PDFRef from "../core/objects/PDFRef"; +import { Fontkit } from "../types/fontkit"; +import { TransformationMatrix } from "../types/matrix"; +/** + * Represents a PDF document. + */ +export default class PDFDocument { + /** + * Load an existing [[PDFDocument]]. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------ | + * | `string` | A base64 encoded string (or data URI) containing a PDF | + * | `Uint8Array` | The raw bytes of a PDF | + * | `ArrayBuffer` | The raw bytes of a PDF | + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * + * // pdf=string + * const base64 = + * 'JVBERi0xLjcKJYGBgYEKCjUgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbm' + + * 'd0aCAxMDQKPj4Kc3RyZWFtCniccwrhMlAAwaJ0Ln2P1Jyy1JLM5ERdc0MjCwUjE4WQNC4Q' + + * '6cNlCFZkqGCqYGSqEJLLZWNuYGZiZmbkYuZsZmlmZGRgZmluDCQNzc3NTM2NzdzMXMxMjQ' + + * 'ztFEKyuEK0uFxDuAAOERdVCmVuZHN0cmVhbQplbmRvYmoKCjYgMCBvYmoKPDwKL0ZpbHRl' + + * 'ciAvRmxhdGVEZWNvZGUKL1R5cGUgL09ialN0bQovTiA0Ci9GaXJzdCAyMAovTGVuZ3RoID' + + * 'IxNQo+PgpzdHJlYW0KeJxVj9GqwjAMhu/zFHkBzTo3nCCCiiKIHPEICuJF3cKoSCu2E8/b' + + * '20wPIr1p8v9/8kVhgilmGfawX2CGaVrgcAi0/bsy0lrX7IGWpvJ4iJYEN3gEmrrGBlQwGs' + + * 'HHO9VBX1wNrxAqMX87RBD5xpJuddqwd82tjAHxzV1U5LPgy52DKXWnr1Lheg+j/c/pzGVr' + + * 'iqV0VlwZPXGPCJjElw/ybkwUmeoWgxesDXGhHJC/D/iikp1Av80ptKU0FdBEe25pPihAM1' + + * 'u6ytgaaWfs2Hrz35CJT1+EWmAKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovU2l6' + + * 'ZSA4Ci9Sb290IDIgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9UeXBlIC9YUmVmCi9MZW' + + * '5ndGggMzgKL1cgWyAxIDIgMiBdCi9JbmRleCBbIDAgOCBdCj4+CnN0cmVhbQp4nBXEwREA' + + * 'EBAEsCwz3vrvRmOOyyOoGhZdutHN2MT55fIAVocD+AplbmRzdHJlYW0KZW5kb2JqCgpzdG' + + * 'FydHhyZWYKNTEwCiUlRU9G' + * + * const dataUri = 'data:application/pdf;base64,' + base64 + * + * const pdfDoc1 = await PDFDocument.load(base64) + * const pdfDoc2 = await PDFDocument.load(dataUri) + * + * // pdf=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('with_update_sections.pdf') + * const pdfDoc3 = await PDFDocument.load(uint8Array) + * + * // pdf=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/with_update_sections.pdf' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const pdfDoc4 = await PDFDocument.load(arrayBuffer) + * + * ``` + * + * @param pdf The input data containing a PDF document. + * @param options The options to be used when loading the document. + * @returns Resolves with a document loaded from the input. + */ + static load(pdf: string | Uint8Array | ArrayBuffer, options?: LoadOptions): Promise; + /** + * Create a new [[PDFDocument]]. + * @returns Resolves with the newly created document. + */ + static create(options?: CreateOptions): Promise; + /** The low-level context of this document. */ + readonly context: PDFContext; + /** The catalog of this document. */ + readonly catalog: PDFCatalog; + /** Whether or not this document is encrypted. */ + readonly isEncrypted: boolean; + /** The default word breaks used in PDFPage.drawText */ + defaultWordBreaks: string[]; + private fontkit?; + private pageCount; + private readonly pageCache; + private readonly pageMap; + private readonly formCache; + private readonly fonts; + private readonly images; + private readonly embeddedPages; + private readonly embeddedFiles; + private readonly javaScripts; + private constructor(); + /** + * Register a fontkit instance. This must be done before custom fonts can + * be embedded. See [here](https://github.com/Hopding/pdf-lib/tree/master#fontkit-installation) + * for instructions on how to install and register a fontkit instance. + * + * > You do **not** need to call this method to embed standard fonts. + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * import fontkit from '@pdf-lib/fontkit' + * + * const pdfDoc = await PDFDocument.create() + * pdfDoc.registerFontkit(fontkit) + * ``` + * + * @param fontkit The fontkit instance to be registered. + */ + registerFontkit(fontkit: Fontkit): void; + /** + * Get the [[PDFForm]] containing all interactive fields for this document. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const fields = form.getFields() + * fields.forEach(field => { + * const type = field.constructor.name + * const name = field.getName() + * console.log(`${type}: ${name}`) + * }) + * ``` + * @returns The form for this document. + */ + getForm(): PDFForm; + /** + * Get this document's title metadata. The title appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const title = pdfDoc.getTitle() + * ``` + * @returns A string containing the title of this document, if it has one. + */ + getTitle(): string | undefined; + /** + * Get this document's author metadata. The author appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const author = pdfDoc.getAuthor() + * ``` + * @returns A string containing the author of this document, if it has one. + */ + getAuthor(): string | undefined; + /** + * Get this document's subject metadata. The subject appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const subject = pdfDoc.getSubject() + * ``` + * @returns A string containing the subject of this document, if it has one. + */ + getSubject(): string | undefined; + /** + * Get this document's keywords metadata. The keywords appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const keywords = pdfDoc.getKeywords() + * ``` + * @returns A string containing the keywords of this document, if it has any. + */ + getKeywords(): string | undefined; + /** + * Get this document's creator metadata. The creator appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const creator = pdfDoc.getCreator() + * ``` + * @returns A string containing the creator of this document, if it has one. + */ + getCreator(): string | undefined; + /** + * Get this document's producer metadata. The producer appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const producer = pdfDoc.getProducer() + * ``` + * @returns A string containing the producer of this document, if it has one. + */ + getProducer(): string | undefined; + /** + * Get this document's creation date metadata. The creation date appears in + * the "Document Properties" section of most PDF readers. For example: + * ```js + * const creationDate = pdfDoc.getCreationDate() + * ``` + * @returns A Date containing the creation date of this document, + * if it has one. + */ + getCreationDate(): Date | undefined; + /** + * Get this document's modification date metadata. The modification date + * appears in the "Document Properties" section of most PDF readers. + * For example: + * ```js + * const modification = pdfDoc.getModificationDate() + * ``` + * @returns A Date containing the modification date of this document, + * if it has one. + */ + getModificationDate(): Date | undefined; + /** + * Set this document's title metadata. The title will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setTitle('🥚 The Life of an Egg 🍳') + * ``` + * + * To display the title in the window's title bar, set the + * `showInWindowTitleBar` option to `true` (works for _most_ PDF readers). + * For example: + * ```js + * pdfDoc.setTitle('🥚 The Life of an Egg 🍳', { showInWindowTitleBar: true }) + * ``` + * + * @param title The title of this document. + * @param options The options to be used when setting the title. + */ + setTitle(title: string, options?: SetTitleOptions): void; + /** + * Set this document's author metadata. The author will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setAuthor('Humpty Dumpty') + * ``` + * @param author The author of this document. + */ + setAuthor(author: string): void; + /** + * Set this document's subject metadata. The subject will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setSubject('📘 An Epic Tale of Woe 📖') + * ``` + * @param subject The subject of this document. + */ + setSubject(subject: string): void; + /** + * Set this document's keyword metadata. These keywords will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men']) + * ``` + * @param keywords An array of keywords associated with this document. + */ + setKeywords(keywords: string[]): void; + /** + * Set this document's creator metadata. The creator will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setCreator('PDF App 9000 🤖') + * ``` + * @param creator The creator of this document. + */ + setCreator(creator: string): void; + /** + * Set this document's producer metadata. The producer will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setProducer('PDF App 9000 🤖') + * ``` + * @param producer The producer of this document. + */ + setProducer(producer: string): void; + /** + * Set this document's language metadata. The language will appear in the + * "Document Properties" section of some PDF readers. For example: + * ```js + * pdfDoc.setLanguage('en-us') + * ``` + * + * @param language An RFC 3066 _Language-Tag_ denoting the language of this + * document, or an empty string if the language is unknown. + */ + setLanguage(language: string): void; + /** + * Set this document's creation date metadata. The creation date will appear + * in the "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setCreationDate(new Date()) + * ``` + * @param creationDate The date this document was created. + */ + setCreationDate(creationDate: Date): void; + /** + * Set this document's modification date metadata. The modification date will + * appear in the "Document Properties" section of most PDF readers. For + * example: + * ```js + * pdfDoc.setModificationDate(new Date()) + * ``` + * @param modificationDate The date this document was last modified. + */ + setModificationDate(modificationDate: Date): void; + /** + * Get the number of pages contained in this document. For example: + * ```js + * const totalPages = pdfDoc.getPageCount() + * ``` + * @returns The number of pages in this document. + */ + getPageCount(): number; + /** + * Get an array of all the pages contained in this document. The pages are + * stored in the array in the same order that they are rendered in the + * document. For example: + * ```js + * const pages = pdfDoc.getPages() + * pages[0] // The first page of the document + * pages[2] // The third page of the document + * pages[197] // The 198th page of the document + * ``` + * @returns An array of all the pages contained in this document. + */ + getPages(): PDFPage[]; + /** + * Get the page rendered at a particular `index` of the document. For example: + * ```js + * pdfDoc.getPage(0) // The first page of the document + * pdfDoc.getPage(2) // The third page of the document + * pdfDoc.getPage(197) // The 198th page of the document + * ``` + * @returns The [[PDFPage]] rendered at the given `index` of the document. + */ + getPage(index: number): PDFPage; + /** + * Get an array of indices for all the pages contained in this document. The + * array will contain a range of integers from + * `0..pdfDoc.getPageCount() - 1`. For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * pdfDoc.addPage() + * pdfDoc.addPage() + * pdfDoc.addPage() + * + * const indices = pdfDoc.getPageIndices() + * indices // => [0, 1, 2] + * ``` + * @returns An array of indices for all pages contained in this document. + */ + getPageIndices(): number[]; + /** + * Remove the page at a given index from this document. For example: + * ```js + * pdfDoc.removePage(0) // Remove the first page of the document + * pdfDoc.removePage(2) // Remove the third page of the document + * pdfDoc.removePage(197) // Remove the 198th page of the document + * ``` + * Once a page has been removed, it will no longer be rendered at that index + * in the document. + * @param index The index of the page to be removed. + */ + removePage(index: number): void; + /** + * Add a page to the end of this document. This method accepts three + * different value types for the `page` parameter: + * + * | Type | Behavior | + * | ------------------ | ----------------------------------------------------------------------------------- | + * | `undefined` | Create a new page and add it to the end of this document | + * | `[number, number]` | Create a new page with the given dimensions and add it to the end of this document | + * | `PDFPage` | Add the existing page to the end of this document | + * + * For example: + * ```js + * // page=undefined + * const newPage = pdfDoc.addPage() + * + * // page=[number, number] + * import { PageSizes } from 'pdf-lib' + * const newPage1 = pdfDoc.addPage(PageSizes.A7) + * const newPage2 = pdfDoc.addPage(PageSizes.Letter) + * const newPage3 = pdfDoc.addPage([500, 750]) + * + * // page=PDFPage + * const pdfDoc1 = await PDFDocument.create() + * const pdfDoc2 = await PDFDocument.load(...) + * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0]) + * pdfDoc1.addPage(existingPage) + * ``` + * + * @param page Optionally, the desired dimensions or existing page. + * @returns The newly created (or existing) page. + */ + addPage(page?: PDFPage | [number, number]): PDFPage; + /** + * Insert a page at a given index within this document. This method accepts + * three different value types for the `page` parameter: + * + * | Type | Behavior | + * | ------------------ | ------------------------------------------------------------------------------ | + * | `undefined` | Create a new page and insert it into this document | + * | `[number, number]` | Create a new page with the given dimensions and insert it into this document | + * | `PDFPage` | Insert the existing page into this document | + * + * For example: + * ```js + * // page=undefined + * const newPage = pdfDoc.insertPage(2) + * + * // page=[number, number] + * import { PageSizes } from 'pdf-lib' + * const newPage1 = pdfDoc.insertPage(2, PageSizes.A7) + * const newPage2 = pdfDoc.insertPage(0, PageSizes.Letter) + * const newPage3 = pdfDoc.insertPage(198, [500, 750]) + * + * // page=PDFPage + * const pdfDoc1 = await PDFDocument.create() + * const pdfDoc2 = await PDFDocument.load(...) + * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0]) + * pdfDoc1.insertPage(0, existingPage) + * ``` + * + * @param index The index at which the page should be inserted (zero-based). + * @param page Optionally, the desired dimensions or existing page. + * @returns The newly created (or existing) page. + */ + insertPage(index: number, page?: PDFPage | [number, number]): PDFPage; + /** + * Copy pages from a source document into this document. Allows pages to be + * copied between different [[PDFDocument]] instances. For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * const srcDoc = await PDFDocument.load(...) + * + * const copiedPages = await pdfDoc.copyPages(srcDoc, [0, 3, 89]) + * const [firstPage, fourthPage, ninetiethPage] = copiedPages; + * + * pdfDoc.addPage(fourthPage) + * pdfDoc.insertPage(0, ninetiethPage) + * pdfDoc.addPage(firstPage) + * ``` + * @param srcDoc The document from which pages should be copied. + * @param indices The indices of the pages that should be copied. + * @returns Resolves with an array of pages copied into this document. + */ + copyPages(srcDoc: PDFDocument, indices: number[]): Promise; + /** + * Get a copy of this document. + * + * For example: + * ```js + * const srcDoc = await PDFDocument.load(...) + * const pdfDoc = await srcDoc.copy() + * ``` + * + * > **NOTE:** This method won't copy all information over to the new + * > document (acroforms, outlines, etc...). + * + * @returns Resolves with a copy this document. + */ + copy(): Promise; + /** + * Add JavaScript to this document. The supplied `script` is executed when the + * document is opened. The `script` can be used to perform some operation + * when the document is opened (e.g. logging to the console), or it can be + * used to define a function that can be referenced later in a JavaScript + * action. For example: + * ```js + * // Show "Hello World!" in the console when the PDF is opened + * pdfDoc.addJavaScript( + * 'main', + * 'console.show(); console.println("Hello World!");' + * ); + * + * // Define a function named "foo" that can be called in JavaScript Actions + * pdfDoc.addJavaScript( + * 'foo', + * 'function foo() { return "foo"; }' + * ); + * ``` + * See the [JavaScript for Acrobat API Reference](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf) + * for details. + * @param name The name of the script. Must be unique per document. + * @param script The JavaScript to execute. + */ + addJavaScript(name: string, script: string): void; + /** + * Add an attachment to this document. Attachments are visible in the + * "Attachments" panel of Adobe Acrobat and some other PDF readers. Any + * type of file can be added as an attachment. This includes, but is not + * limited to, `.png`, `.jpg`, `.pdf`, `.csv`, `.docx`, and `.xlsx` files. + * + * The input data can be provided in multiple formats: + * + * | Type | Contents | + * | ------------- | -------------------------------------------------------------- | + * | `string` | A base64 encoded string (or data URI) containing an attachment | + * | `Uint8Array` | The raw bytes of an attachment | + * | `ArrayBuffer` | The raw bytes of an attachment | + * + * For example: + * ```js + * // attachment=string + * await pdfDoc.attach('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...', 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * await pdfDoc.attach('data:image/jpeg;base64,/9j/4AAQ...', 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * + * // attachment=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg') + * await pdfDoc.attach(uint8Array, 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * + * // attachment=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * await pdfDoc.attach(arrayBuffer, 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * ``` + * + * @param attachment The input data containing the file to be attached. + * @param name The name of the file to be attached. + * @returns Resolves when the attachment is complete. + */ + attach(attachment: string | Uint8Array | ArrayBuffer, name: string, options?: AttachmentOptions): Promise; + /** + * Embed a font into this document. The input data can be provided in multiple + * formats: + * + * | Type | Contents | + * | --------------- | ------------------------------------------------------- | + * | `StandardFonts` | One of the standard 14 fonts | + * | `string` | A base64 encoded string (or data URI) containing a font | + * | `Uint8Array` | The raw bytes of a font | + * | `ArrayBuffer` | The raw bytes of a font | + * + * For example: + * ```js + * // font=StandardFonts + * import { StandardFonts } from 'pdf-lib' + * const font1 = await pdfDoc.embedFont(StandardFonts.Helvetica) + * + * // font=string + * const font2 = await pdfDoc.embedFont('AAEAAAAVAQAABABQRFNJRx/upe...') + * const font3 = await pdfDoc.embedFont('data:font/opentype;base64,AAEAAA...') + * + * // font=Uint8Array + * import fs from 'fs' + * const font4 = await pdfDoc.embedFont(fs.readFileSync('Ubuntu-R.ttf')) + * + * // font=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf' + * const ubuntuBytes = await fetch(url).then(res => res.arrayBuffer()) + * const font5 = await pdfDoc.embedFont(ubuntuBytes) + * ``` + * See also: [[registerFontkit]] + * @param font The input data for a font. + * @param options The options to be used when embedding the font. + * @returns Resolves with the embedded font. + */ + embedFont(font: StandardFonts | string | Uint8Array | ArrayBuffer, options?: EmbedFontOptions): Promise; + /** + * Embed a standard font into this document. + * For example: + * ```js + * import { StandardFonts } from 'pdf-lib' + * const helveticaFont = pdfDoc.embedFont(StandardFonts.Helvetica) + * ``` + * @param font The standard font to be embedded. + * @param customName The name to be used when embedding the font. + * @returns The embedded font. + */ + embedStandardFont(font: StandardFonts, customName?: string): PDFFont; + /** + * Embed a JPEG image into this document. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------------- | + * | `string` | A base64 encoded string (or data URI) containing a JPEG image | + * | `Uint8Array` | The raw bytes of a JPEG image | + * | `ArrayBuffer` | The raw bytes of a JPEG image | + * + * For example: + * ```js + * // jpg=string + * const image1 = await pdfDoc.embedJpg('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...') + * const image2 = await pdfDoc.embedJpg('data:image/jpeg;base64,/9j/4AAQ...') + * + * // jpg=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg') + * const image3 = await pdfDoc.embedJpg(uint8Array) + * + * // jpg=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const image4 = await pdfDoc.embedJpg(arrayBuffer) + * ``` + * + * @param jpg The input data for a JPEG image. + * @returns Resolves with the embedded image. + */ + embedJpg(jpg: string | Uint8Array | ArrayBuffer): Promise; + /** + * Embed a PNG image into this document. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------------ | + * | `string` | A base64 encoded string (or data URI) containing a PNG image | + * | `Uint8Array` | The raw bytes of a PNG image | + * | `ArrayBuffer` | The raw bytes of a PNG image | + * + * For example: + * ```js + * // png=string + * const image1 = await pdfDoc.embedPng('iVBORw0KGgoAAAANSUhEUgAAAlgAAAF3...') + * const image2 = await pdfDoc.embedPng('data:image/png;base64,iVBORw0KGg...') + * + * // png=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('small_mario.png') + * const image3 = await pdfDoc.embedPng(uint8Array) + * + * // png=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/small_mario.png' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const image4 = await pdfDoc.embedPng(arrayBuffer) + * ``` + * + * @param png The input data for a PNG image. + * @returns Resolves with the embedded image. + */ + embedPng(png: string | Uint8Array | ArrayBuffer): Promise; + /** + * Embed one or more PDF pages into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * + * // Embed page 74 of `sourcePdf` into `pdfDoc` + * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, [73]) + * ``` + * + * See [[PDFDocument.load]] for examples of the allowed input data formats. + * + * @param pdf The input data containing a PDF document. + * @param indices The indices of the pages that should be embedded. + * @returns Resolves with an array of the embedded pages. + */ + embedPdf(pdf: string | Uint8Array | ArrayBuffer | PDFDocument, indices?: number[]): Promise; + /** + * Embed a single PDF page into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * const sourcePdfDoc = await PDFDocument.load(sourceBuffer) + * const sourcePdfPage = sourcePdfDoc.getPages()[73] + * + * const embeddedPage = await pdfDoc.embedPage( + * sourcePdfPage, + * + * // Clip a section of the source page so that we only embed part of it + * { left: 100, right: 450, bottom: 330, top: 570 }, + * + * // Translate all drawings of the embedded page by (10, 200) units + * [1, 0, 0, 1, 10, 200], + * ) + * ``` + * + * @param page The page to be embedded. + * @param boundingBox + * Optionally, an area of the source page that should be embedded + * (defaults to entire page). + * @param transformationMatrix + * Optionally, a transformation matrix that is always applied to the embedded + * page anywhere it is drawn. + * @returns Resolves with the embedded pdf page. + */ + embedPage(page: PDFPage, boundingBox?: PageBoundingBox, transformationMatrix?: TransformationMatrix): Promise; + /** + * Embed one or more PDF pages into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * const sourcePdfDoc = await PDFDocument.load(sourceBuffer) + * + * const page1 = sourcePdfDoc.getPages()[0] + * const page2 = sourcePdfDoc.getPages()[52] + * const page3 = sourcePdfDoc.getPages()[73] + * + * const embeddedPages = await pdfDoc.embedPages([page1, page2, page3]) + * ``` + * + * @param page + * The pages to be embedded (they must all share the same context). + * @param boundingBoxes + * Optionally, an array of clipping boundaries - one for each page + * (defaults to entirety of each page). + * @param transformationMatrices + * Optionally, an array of transformation matrices - one for each page + * (each page's transformation will apply anywhere it is drawn). + * @returns Resolves with an array of the embedded pdf pages. + */ + embedPages(pages: PDFPage[], boundingBoxes?: (PageBoundingBox | undefined)[], transformationMatrices?: (TransformationMatrix | undefined)[]): Promise; + /** + * > **NOTE:** You shouldn't need to call this method directly. The [[save]] + * > and [[saveAsBase64]] methods will automatically ensure that all embedded + * > assets are flushed before serializing the document. + * + * Flush all embedded fonts, PDF pages, and images to this document's + * [[context]]. + * + * @returns Resolves when the flush is complete. + */ + flush(): Promise; + /** + * Serialize this document to an array of bytes making up a PDF file. + * For example: + * ```js + * const pdfBytes = await pdfDoc.save() + * ``` + * + * There are a number of things you can do with the serialized document, + * depending on the JavaScript environment you're running in: + * * Write it to a file in Node or React Native + * * Download it as a Blob in the browser + * * Render it in an `iframe` + * + * @param options The options to be used when saving the document. + * @returns Resolves with the bytes of the serialized document. + */ + save(options?: SaveOptions): Promise; + /** + * Serialize this document to a base64 encoded string or data URI making up a + * PDF file. For example: + * ```js + * const base64String = await pdfDoc.saveAsBase64() + * base64String // => 'JVBERi0xLjcKJYGBgYEKC...' + * + * const base64DataUri = await pdfDoc.saveAsBase64({ dataUri: true }) + * base64DataUri // => 'data:application/pdf;base64,JVBERi0xLjcKJYGBgYEKC...' + * ``` + * + * @param options The options to be used when saving the document. + * @returns Resolves with a base64 encoded string or data URI of the + * serialized document. + */ + saveAsBase64(options?: Base64SaveOptions): Promise; + findPageForAnnotationRef(ref: PDFRef): PDFPage | undefined; + private embedAll; + private updateInfoDict; + private getInfoDict; + private assertFontkit; + private computePages; + private getOrCreateForm; +} +//# sourceMappingURL=PDFDocument.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFDocument.d.ts.map b/cjs/api/PDFDocument.d.ts.map new file mode 100644 index 000000000..14529553b --- /dev/null +++ b/cjs/api/PDFDocument.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDocument.d.ts","sourceRoot":"","sources":["../../src/api/PDFDocument.ts"],"names":[],"mappings":"AAOA,OAAO,eAAe,0BAAgC;AACtD,OAAO,OAAO,kBAAwB;AACtC,OAAO,QAAQ,mBAAyB;AACxC,OAAO,OAAO,kBAAwB;AACtC,OAAO,OAAO,uBAA6B;AAE3C,OAAO,EAAE,aAAa,EAAE,wBAA8B;AACtD,OAAO,EAIL,eAAe,EAEf,UAAU,EACV,UAAU,EAeX,gBAAiB;AAClB,OAAO,EAEL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EAChB,6BAAmC;AAEpC,OAAO,MAAM,+BAAgC;AAC7C,OAAO,EAAE,OAAO,EAAE,yBAA0B;AAC5C,OAAO,EAAE,oBAAoB,EAAE,wBAAyB;AAmBxD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;WACU,IAAI,CACf,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,EACtC,OAAO,GAAE,WAAgB;IAyB3B;;;OAGG;WACU,MAAM,CAAC,OAAO,GAAE,aAAkB;IAY/C,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B,iDAAiD;IACjD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,uDAAuD;IACvD,iBAAiB,EAAE,MAAM,EAAE,CAAS;IAEpC,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAA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;;;;;;;;;;;;;;;;OA2BG;IACG,UAAU,CACd,KAAK,EAAE,OAAO,EAAE,EAChB,aAAa,GAAE,CAAC,eAAe,GAAG,SAAS,CAAC,EAAO,EACnD,sBAAsB,GAAE,CAAC,oBAAoB,GAAG,SAAS,CAAC,EAAO;IAoCnE;;;;;;;;;OASG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA0B1D;;;;;;;;;;;;;;OAcG;IACG,YAAY,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQpE,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;YAc5C,QAAQ;IAMtB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,YAAY,CAalB;IAEF,OAAO,CAAC,eAAe,CAGrB;CACH"} \ No newline at end of file diff --git a/cjs/api/PDFDocument.js b/cjs/api/PDFDocument.js new file mode 100644 index 000000000..9d74ce0a8 --- /dev/null +++ b/cjs/api/PDFDocument.js @@ -0,0 +1,1369 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("./errors"); +var PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage")); +var PDFFont_1 = tslib_1.__importDefault(require("./PDFFont")); +var PDFImage_1 = tslib_1.__importDefault(require("./PDFImage")); +var PDFPage_1 = tslib_1.__importDefault(require("./PDFPage")); +var PDFForm_1 = tslib_1.__importDefault(require("./form/PDFForm")); +var sizes_1 = require("./sizes"); +var core_1 = require("../core"); +var PDFDocumentOptions_1 = require("./PDFDocumentOptions"); +var utils_1 = require("../utils"); +var FileEmbedder_1 = tslib_1.__importStar(require("../core/embedders/FileEmbedder")); +var PDFEmbeddedFile_1 = tslib_1.__importDefault(require("./PDFEmbeddedFile")); +var PDFJavaScript_1 = tslib_1.__importDefault(require("./PDFJavaScript")); +var JavaScriptEmbedder_1 = tslib_1.__importDefault(require("../core/embedders/JavaScriptEmbedder")); +/** + * Represents a PDF document. + */ +var PDFDocument = /** @class */ (function () { + function PDFDocument(context, ignoreEncryption, updateMetadata) { + var _this = this; + /** The default word breaks used in PDFPage.drawText */ + this.defaultWordBreaks = [' ']; + this.computePages = function () { + var pages = []; + _this.catalog.Pages().traverse(function (node, ref) { + if (node instanceof core_1.PDFPageLeaf) { + var page = _this.pageMap.get(node); + if (!page) { + page = PDFPage_1.default.of(node, ref, _this); + _this.pageMap.set(node, page); + } + pages.push(page); + } + }); + return pages; + }; + this.getOrCreateForm = function () { + var acroForm = _this.catalog.getOrCreateAcroForm(); + return PDFForm_1.default.of(acroForm, _this); + }; + utils_1.assertIs(context, 'context', [[core_1.PDFContext, 'PDFContext']]); + utils_1.assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']); + this.context = context; + this.catalog = context.lookup(context.trailerInfo.Root); + this.isEncrypted = !!context.lookup(context.trailerInfo.Encrypt); + this.pageCache = utils_1.Cache.populatedBy(this.computePages); + this.pageMap = new Map(); + this.formCache = utils_1.Cache.populatedBy(this.getOrCreateForm); + this.fonts = []; + this.images = []; + this.embeddedPages = []; + this.embeddedFiles = []; + this.javaScripts = []; + if (!ignoreEncryption && this.isEncrypted) + throw new errors_1.EncryptedPDFError(); + if (updateMetadata) + this.updateInfoDict(); + } + /** + * Load an existing [[PDFDocument]]. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------ | + * | `string` | A base64 encoded string (or data URI) containing a PDF | + * | `Uint8Array` | The raw bytes of a PDF | + * | `ArrayBuffer` | The raw bytes of a PDF | + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * + * // pdf=string + * const base64 = + * 'JVBERi0xLjcKJYGBgYEKCjUgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbm' + + * 'd0aCAxMDQKPj4Kc3RyZWFtCniccwrhMlAAwaJ0Ln2P1Jyy1JLM5ERdc0MjCwUjE4WQNC4Q' + + * '6cNlCFZkqGCqYGSqEJLLZWNuYGZiZmbkYuZsZmlmZGRgZmluDCQNzc3NTM2NzdzMXMxMjQ' + + * 'ztFEKyuEK0uFxDuAAOERdVCmVuZHN0cmVhbQplbmRvYmoKCjYgMCBvYmoKPDwKL0ZpbHRl' + + * 'ciAvRmxhdGVEZWNvZGUKL1R5cGUgL09ialN0bQovTiA0Ci9GaXJzdCAyMAovTGVuZ3RoID' + + * 'IxNQo+PgpzdHJlYW0KeJxVj9GqwjAMhu/zFHkBzTo3nCCCiiKIHPEICuJF3cKoSCu2E8/b' + + * '20wPIr1p8v9/8kVhgilmGfawX2CGaVrgcAi0/bsy0lrX7IGWpvJ4iJYEN3gEmrrGBlQwGs' + + * 'HHO9VBX1wNrxAqMX87RBD5xpJuddqwd82tjAHxzV1U5LPgy52DKXWnr1Lheg+j/c/pzGVr' + + * 'iqV0VlwZPXGPCJjElw/ybkwUmeoWgxesDXGhHJC/D/iikp1Av80ptKU0FdBEe25pPihAM1' + + * 'u6ytgaaWfs2Hrz35CJT1+EWmAKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovU2l6' + + * 'ZSA4Ci9Sb290IDIgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9UeXBlIC9YUmVmCi9MZW' + + * '5ndGggMzgKL1cgWyAxIDIgMiBdCi9JbmRleCBbIDAgOCBdCj4+CnN0cmVhbQp4nBXEwREA' + + * 'EBAEsCwz3vrvRmOOyyOoGhZdutHN2MT55fIAVocD+AplbmRzdHJlYW0KZW5kb2JqCgpzdG' + + * 'FydHhyZWYKNTEwCiUlRU9G' + * + * const dataUri = 'data:application/pdf;base64,' + base64 + * + * const pdfDoc1 = await PDFDocument.load(base64) + * const pdfDoc2 = await PDFDocument.load(dataUri) + * + * // pdf=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('with_update_sections.pdf') + * const pdfDoc3 = await PDFDocument.load(uint8Array) + * + * // pdf=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/with_update_sections.pdf' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const pdfDoc4 = await PDFDocument.load(arrayBuffer) + * + * ``` + * + * @param pdf The input data containing a PDF document. + * @param options The options to be used when loading the document. + * @returns Resolves with a document loaded from the input. + */ + PDFDocument.load = function (pdf, options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, ignoreEncryption, _b, parseSpeed, _c, throwOnInvalidObject, _d, updateMetadata, _e, capNumbers, bytes, context; + return tslib_1.__generator(this, function (_f) { + switch (_f.label) { + case 0: + _a = options.ignoreEncryption, ignoreEncryption = _a === void 0 ? false : _a, _b = options.parseSpeed, parseSpeed = _b === void 0 ? PDFDocumentOptions_1.ParseSpeeds.Slow : _b, _c = options.throwOnInvalidObject, throwOnInvalidObject = _c === void 0 ? false : _c, _d = options.updateMetadata, updateMetadata = _d === void 0 ? true : _d, _e = options.capNumbers, capNumbers = _e === void 0 ? false : _e; + utils_1.assertIs(pdf, 'pdf', ['string', Uint8Array, ArrayBuffer]); + utils_1.assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']); + utils_1.assertIs(parseSpeed, 'parseSpeed', ['number']); + utils_1.assertIs(throwOnInvalidObject, 'throwOnInvalidObject', ['boolean']); + bytes = utils_1.toUint8Array(pdf); + return [4 /*yield*/, core_1.PDFParser.forBytesWithOptions(bytes, parseSpeed, throwOnInvalidObject, capNumbers).parseDocument()]; + case 1: + context = _f.sent(); + return [2 /*return*/, new PDFDocument(context, ignoreEncryption, updateMetadata)]; + } + }); + }); + }; + /** + * Create a new [[PDFDocument]]. + * @returns Resolves with the newly created document. + */ + PDFDocument.create = function (options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, updateMetadata, context, pageTree, pageTreeRef, catalog; + return tslib_1.__generator(this, function (_b) { + _a = options.updateMetadata, updateMetadata = _a === void 0 ? true : _a; + context = core_1.PDFContext.create(); + pageTree = core_1.PDFPageTree.withContext(context); + pageTreeRef = context.register(pageTree); + catalog = core_1.PDFCatalog.withContextAndPages(context, pageTreeRef); + context.trailerInfo.Root = context.register(catalog); + return [2 /*return*/, new PDFDocument(context, false, updateMetadata)]; + }); + }); + }; + /** + * Register a fontkit instance. This must be done before custom fonts can + * be embedded. See [here](https://github.com/Hopding/pdf-lib/tree/master#fontkit-installation) + * for instructions on how to install and register a fontkit instance. + * + * > You do **not** need to call this method to embed standard fonts. + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * import fontkit from '@pdf-lib/fontkit' + * + * const pdfDoc = await PDFDocument.create() + * pdfDoc.registerFontkit(fontkit) + * ``` + * + * @param fontkit The fontkit instance to be registered. + */ + PDFDocument.prototype.registerFontkit = function (fontkit) { + this.fontkit = fontkit; + }; + /** + * Get the [[PDFForm]] containing all interactive fields for this document. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const fields = form.getFields() + * fields.forEach(field => { + * const type = field.constructor.name + * const name = field.getName() + * console.log(`${type}: ${name}`) + * }) + * ``` + * @returns The form for this document. + */ + PDFDocument.prototype.getForm = function () { + var form = this.formCache.access(); + if (form.hasXFA()) { + console.warn('Removing XFA form data as pdf-lib does not support reading or writing XFA'); + form.deleteXFA(); + } + return form; + }; + /** + * Get this document's title metadata. The title appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const title = pdfDoc.getTitle() + * ``` + * @returns A string containing the title of this document, if it has one. + */ + PDFDocument.prototype.getTitle = function () { + var title = this.getInfoDict().lookup(core_1.PDFName.Title); + if (!title) + return undefined; + assertIsLiteralOrHexString(title); + return title.decodeText(); + }; + /** + * Get this document's author metadata. The author appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const author = pdfDoc.getAuthor() + * ``` + * @returns A string containing the author of this document, if it has one. + */ + PDFDocument.prototype.getAuthor = function () { + var author = this.getInfoDict().lookup(core_1.PDFName.Author); + if (!author) + return undefined; + assertIsLiteralOrHexString(author); + return author.decodeText(); + }; + /** + * Get this document's subject metadata. The subject appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const subject = pdfDoc.getSubject() + * ``` + * @returns A string containing the subject of this document, if it has one. + */ + PDFDocument.prototype.getSubject = function () { + var subject = this.getInfoDict().lookup(core_1.PDFName.Subject); + if (!subject) + return undefined; + assertIsLiteralOrHexString(subject); + return subject.decodeText(); + }; + /** + * Get this document's keywords metadata. The keywords appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const keywords = pdfDoc.getKeywords() + * ``` + * @returns A string containing the keywords of this document, if it has any. + */ + PDFDocument.prototype.getKeywords = function () { + var keywords = this.getInfoDict().lookup(core_1.PDFName.Keywords); + if (!keywords) + return undefined; + assertIsLiteralOrHexString(keywords); + return keywords.decodeText(); + }; + /** + * Get this document's creator metadata. The creator appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const creator = pdfDoc.getCreator() + * ``` + * @returns A string containing the creator of this document, if it has one. + */ + PDFDocument.prototype.getCreator = function () { + var creator = this.getInfoDict().lookup(core_1.PDFName.Creator); + if (!creator) + return undefined; + assertIsLiteralOrHexString(creator); + return creator.decodeText(); + }; + /** + * Get this document's producer metadata. The producer appears in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * const producer = pdfDoc.getProducer() + * ``` + * @returns A string containing the producer of this document, if it has one. + */ + PDFDocument.prototype.getProducer = function () { + var producer = this.getInfoDict().lookup(core_1.PDFName.Producer); + if (!producer) + return undefined; + assertIsLiteralOrHexString(producer); + return producer.decodeText(); + }; + /** + * Get this document's creation date metadata. The creation date appears in + * the "Document Properties" section of most PDF readers. For example: + * ```js + * const creationDate = pdfDoc.getCreationDate() + * ``` + * @returns A Date containing the creation date of this document, + * if it has one. + */ + PDFDocument.prototype.getCreationDate = function () { + var creationDate = this.getInfoDict().lookup(core_1.PDFName.CreationDate); + if (!creationDate) + return undefined; + assertIsLiteralOrHexString(creationDate); + return creationDate.decodeDate(); + }; + /** + * Get this document's modification date metadata. The modification date + * appears in the "Document Properties" section of most PDF readers. + * For example: + * ```js + * const modification = pdfDoc.getModificationDate() + * ``` + * @returns A Date containing the modification date of this document, + * if it has one. + */ + PDFDocument.prototype.getModificationDate = function () { + var modificationDate = this.getInfoDict().lookup(core_1.PDFName.ModDate); + if (!modificationDate) + return undefined; + assertIsLiteralOrHexString(modificationDate); + return modificationDate.decodeDate(); + }; + /** + * Set this document's title metadata. The title will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setTitle('🥚 The Life of an Egg 🍳') + * ``` + * + * To display the title in the window's title bar, set the + * `showInWindowTitleBar` option to `true` (works for _most_ PDF readers). + * For example: + * ```js + * pdfDoc.setTitle('🥚 The Life of an Egg 🍳', { showInWindowTitleBar: true }) + * ``` + * + * @param title The title of this document. + * @param options The options to be used when setting the title. + */ + PDFDocument.prototype.setTitle = function (title, options) { + utils_1.assertIs(title, 'title', ['string']); + var key = core_1.PDFName.of('Title'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(title)); + // Indicate that readers should display the title rather than the filename + if (options === null || options === void 0 ? void 0 : options.showInWindowTitleBar) { + var prefs = this.catalog.getOrCreateViewerPreferences(); + prefs.setDisplayDocTitle(true); + } + }; + /** + * Set this document's author metadata. The author will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setAuthor('Humpty Dumpty') + * ``` + * @param author The author of this document. + */ + PDFDocument.prototype.setAuthor = function (author) { + utils_1.assertIs(author, 'author', ['string']); + var key = core_1.PDFName.of('Author'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(author)); + }; + /** + * Set this document's subject metadata. The subject will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setSubject('📘 An Epic Tale of Woe 📖') + * ``` + * @param subject The subject of this document. + */ + PDFDocument.prototype.setSubject = function (subject) { + utils_1.assertIs(subject, 'author', ['string']); + var key = core_1.PDFName.of('Subject'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(subject)); + }; + /** + * Set this document's keyword metadata. These keywords will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men']) + * ``` + * @param keywords An array of keywords associated with this document. + */ + PDFDocument.prototype.setKeywords = function (keywords) { + utils_1.assertIs(keywords, 'keywords', [Array]); + var key = core_1.PDFName.of('Keywords'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(keywords.join(' '))); + }; + /** + * Set this document's creator metadata. The creator will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setCreator('PDF App 9000 🤖') + * ``` + * @param creator The creator of this document. + */ + PDFDocument.prototype.setCreator = function (creator) { + utils_1.assertIs(creator, 'creator', ['string']); + var key = core_1.PDFName.of('Creator'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(creator)); + }; + /** + * Set this document's producer metadata. The producer will appear in the + * "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setProducer('PDF App 9000 🤖') + * ``` + * @param producer The producer of this document. + */ + PDFDocument.prototype.setProducer = function (producer) { + utils_1.assertIs(producer, 'creator', ['string']); + var key = core_1.PDFName.of('Producer'); + this.getInfoDict().set(key, core_1.PDFHexString.fromText(producer)); + }; + /** + * Set this document's language metadata. The language will appear in the + * "Document Properties" section of some PDF readers. For example: + * ```js + * pdfDoc.setLanguage('en-us') + * ``` + * + * @param language An RFC 3066 _Language-Tag_ denoting the language of this + * document, or an empty string if the language is unknown. + */ + PDFDocument.prototype.setLanguage = function (language) { + utils_1.assertIs(language, 'language', ['string']); + var key = core_1.PDFName.of('Lang'); + this.catalog.set(key, core_1.PDFString.of(language)); + }; + /** + * Set this document's creation date metadata. The creation date will appear + * in the "Document Properties" section of most PDF readers. For example: + * ```js + * pdfDoc.setCreationDate(new Date()) + * ``` + * @param creationDate The date this document was created. + */ + PDFDocument.prototype.setCreationDate = function (creationDate) { + utils_1.assertIs(creationDate, 'creationDate', [[Date, 'Date']]); + var key = core_1.PDFName.of('CreationDate'); + this.getInfoDict().set(key, core_1.PDFString.fromDate(creationDate)); + }; + /** + * Set this document's modification date metadata. The modification date will + * appear in the "Document Properties" section of most PDF readers. For + * example: + * ```js + * pdfDoc.setModificationDate(new Date()) + * ``` + * @param modificationDate The date this document was last modified. + */ + PDFDocument.prototype.setModificationDate = function (modificationDate) { + utils_1.assertIs(modificationDate, 'modificationDate', [[Date, 'Date']]); + var key = core_1.PDFName.of('ModDate'); + this.getInfoDict().set(key, core_1.PDFString.fromDate(modificationDate)); + }; + /** + * Get the number of pages contained in this document. For example: + * ```js + * const totalPages = pdfDoc.getPageCount() + * ``` + * @returns The number of pages in this document. + */ + PDFDocument.prototype.getPageCount = function () { + if (this.pageCount === undefined) + this.pageCount = this.getPages().length; + return this.pageCount; + }; + /** + * Get an array of all the pages contained in this document. The pages are + * stored in the array in the same order that they are rendered in the + * document. For example: + * ```js + * const pages = pdfDoc.getPages() + * pages[0] // The first page of the document + * pages[2] // The third page of the document + * pages[197] // The 198th page of the document + * ``` + * @returns An array of all the pages contained in this document. + */ + PDFDocument.prototype.getPages = function () { + return this.pageCache.access(); + }; + /** + * Get the page rendered at a particular `index` of the document. For example: + * ```js + * pdfDoc.getPage(0) // The first page of the document + * pdfDoc.getPage(2) // The third page of the document + * pdfDoc.getPage(197) // The 198th page of the document + * ``` + * @returns The [[PDFPage]] rendered at the given `index` of the document. + */ + PDFDocument.prototype.getPage = function (index) { + var pages = this.getPages(); + utils_1.assertRange(index, 'index', 0, pages.length - 1); + return pages[index]; + }; + /** + * Get an array of indices for all the pages contained in this document. The + * array will contain a range of integers from + * `0..pdfDoc.getPageCount() - 1`. For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * pdfDoc.addPage() + * pdfDoc.addPage() + * pdfDoc.addPage() + * + * const indices = pdfDoc.getPageIndices() + * indices // => [0, 1, 2] + * ``` + * @returns An array of indices for all pages contained in this document. + */ + PDFDocument.prototype.getPageIndices = function () { + return utils_1.range(0, this.getPageCount()); + }; + /** + * Remove the page at a given index from this document. For example: + * ```js + * pdfDoc.removePage(0) // Remove the first page of the document + * pdfDoc.removePage(2) // Remove the third page of the document + * pdfDoc.removePage(197) // Remove the 198th page of the document + * ``` + * Once a page has been removed, it will no longer be rendered at that index + * in the document. + * @param index The index of the page to be removed. + */ + PDFDocument.prototype.removePage = function (index) { + var pageCount = this.getPageCount(); + if (this.pageCount === 0) + throw new errors_1.RemovePageFromEmptyDocumentError(); + utils_1.assertRange(index, 'index', 0, pageCount - 1); + this.catalog.removeLeafNode(index); + this.pageCount = pageCount - 1; + }; + /** + * Add a page to the end of this document. This method accepts three + * different value types for the `page` parameter: + * + * | Type | Behavior | + * | ------------------ | ----------------------------------------------------------------------------------- | + * | `undefined` | Create a new page and add it to the end of this document | + * | `[number, number]` | Create a new page with the given dimensions and add it to the end of this document | + * | `PDFPage` | Add the existing page to the end of this document | + * + * For example: + * ```js + * // page=undefined + * const newPage = pdfDoc.addPage() + * + * // page=[number, number] + * import { PageSizes } from 'pdf-lib' + * const newPage1 = pdfDoc.addPage(PageSizes.A7) + * const newPage2 = pdfDoc.addPage(PageSizes.Letter) + * const newPage3 = pdfDoc.addPage([500, 750]) + * + * // page=PDFPage + * const pdfDoc1 = await PDFDocument.create() + * const pdfDoc2 = await PDFDocument.load(...) + * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0]) + * pdfDoc1.addPage(existingPage) + * ``` + * + * @param page Optionally, the desired dimensions or existing page. + * @returns The newly created (or existing) page. + */ + PDFDocument.prototype.addPage = function (page) { + utils_1.assertIs(page, 'page', ['undefined', [PDFPage_1.default, 'PDFPage'], Array]); + return this.insertPage(this.getPageCount(), page); + }; + /** + * Insert a page at a given index within this document. This method accepts + * three different value types for the `page` parameter: + * + * | Type | Behavior | + * | ------------------ | ------------------------------------------------------------------------------ | + * | `undefined` | Create a new page and insert it into this document | + * | `[number, number]` | Create a new page with the given dimensions and insert it into this document | + * | `PDFPage` | Insert the existing page into this document | + * + * For example: + * ```js + * // page=undefined + * const newPage = pdfDoc.insertPage(2) + * + * // page=[number, number] + * import { PageSizes } from 'pdf-lib' + * const newPage1 = pdfDoc.insertPage(2, PageSizes.A7) + * const newPage2 = pdfDoc.insertPage(0, PageSizes.Letter) + * const newPage3 = pdfDoc.insertPage(198, [500, 750]) + * + * // page=PDFPage + * const pdfDoc1 = await PDFDocument.create() + * const pdfDoc2 = await PDFDocument.load(...) + * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0]) + * pdfDoc1.insertPage(0, existingPage) + * ``` + * + * @param index The index at which the page should be inserted (zero-based). + * @param page Optionally, the desired dimensions or existing page. + * @returns The newly created (or existing) page. + */ + PDFDocument.prototype.insertPage = function (index, page) { + var pageCount = this.getPageCount(); + utils_1.assertRange(index, 'index', 0, pageCount); + utils_1.assertIs(page, 'page', ['undefined', [PDFPage_1.default, 'PDFPage'], Array]); + if (!page || Array.isArray(page)) { + var dims = Array.isArray(page) ? page : sizes_1.PageSizes.A4; + page = PDFPage_1.default.create(this); + page.setSize.apply(page, dims); + } + else if (page.doc !== this) { + throw new errors_1.ForeignPageError(); + } + var parentRef = this.catalog.insertLeafNode(page.ref, index); + page.node.setParent(parentRef); + this.pageMap.set(page.node, page); + this.pageCache.invalidate(); + this.pageCount = pageCount + 1; + return page; + }; + /** + * Copy pages from a source document into this document. Allows pages to be + * copied between different [[PDFDocument]] instances. For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * const srcDoc = await PDFDocument.load(...) + * + * const copiedPages = await pdfDoc.copyPages(srcDoc, [0, 3, 89]) + * const [firstPage, fourthPage, ninetiethPage] = copiedPages; + * + * pdfDoc.addPage(fourthPage) + * pdfDoc.insertPage(0, ninetiethPage) + * pdfDoc.addPage(firstPage) + * ``` + * @param srcDoc The document from which pages should be copied. + * @param indices The indices of the pages that should be copied. + * @returns Resolves with an array of pages copied into this document. + */ + PDFDocument.prototype.copyPages = function (srcDoc, indices) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var copier, srcPages, copiedPages, idx, len, srcPage, copiedPage, ref; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.assertIs(srcDoc, 'srcDoc', [[PDFDocument, 'PDFDocument']]); + utils_1.assertIs(indices, 'indices', [Array]); + return [4 /*yield*/, srcDoc.flush()]; + case 1: + _a.sent(); + copier = core_1.PDFObjectCopier.for(srcDoc.context, this.context); + srcPages = srcDoc.getPages(); + copiedPages = new Array(indices.length); + for (idx = 0, len = indices.length; idx < len; idx++) { + srcPage = srcPages[indices[idx]]; + copiedPage = copier.copy(srcPage.node); + ref = this.context.register(copiedPage); + copiedPages[idx] = PDFPage_1.default.of(copiedPage, ref, this); + } + return [2 /*return*/, copiedPages]; + } + }); + }); + }; + /** + * Get a copy of this document. + * + * For example: + * ```js + * const srcDoc = await PDFDocument.load(...) + * const pdfDoc = await srcDoc.copy() + * ``` + * + * > **NOTE:** This method won't copy all information over to the new + * > document (acroforms, outlines, etc...). + * + * @returns Resolves with a copy this document. + */ + PDFDocument.prototype.copy = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var pdfCopy, contentPages, idx, len; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, PDFDocument.create()]; + case 1: + pdfCopy = _a.sent(); + return [4 /*yield*/, pdfCopy.copyPages(this, this.getPageIndices())]; + case 2: + contentPages = _a.sent(); + for (idx = 0, len = contentPages.length; idx < len; idx++) { + pdfCopy.addPage(contentPages[idx]); + } + if (this.getAuthor() !== undefined) { + pdfCopy.setAuthor(this.getAuthor()); + } + if (this.getCreationDate() !== undefined) { + pdfCopy.setCreationDate(this.getCreationDate()); + } + if (this.getCreator() !== undefined) { + pdfCopy.setCreator(this.getCreator()); + } + if (this.getModificationDate() !== undefined) { + pdfCopy.setModificationDate(this.getModificationDate()); + } + if (this.getProducer() !== undefined) { + pdfCopy.setProducer(this.getProducer()); + } + if (this.getSubject() !== undefined) { + pdfCopy.setSubject(this.getSubject()); + } + if (this.getTitle() !== undefined) { + pdfCopy.setTitle(this.getTitle()); + } + pdfCopy.defaultWordBreaks = this.defaultWordBreaks; + return [2 /*return*/, pdfCopy]; + } + }); + }); + }; + /** + * Add JavaScript to this document. The supplied `script` is executed when the + * document is opened. The `script` can be used to perform some operation + * when the document is opened (e.g. logging to the console), or it can be + * used to define a function that can be referenced later in a JavaScript + * action. For example: + * ```js + * // Show "Hello World!" in the console when the PDF is opened + * pdfDoc.addJavaScript( + * 'main', + * 'console.show(); console.println("Hello World!");' + * ); + * + * // Define a function named "foo" that can be called in JavaScript Actions + * pdfDoc.addJavaScript( + * 'foo', + * 'function foo() { return "foo"; }' + * ); + * ``` + * See the [JavaScript for Acrobat API Reference](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf) + * for details. + * @param name The name of the script. Must be unique per document. + * @param script The JavaScript to execute. + */ + PDFDocument.prototype.addJavaScript = function (name, script) { + utils_1.assertIs(name, 'name', ['string']); + utils_1.assertIs(script, 'script', ['string']); + var embedder = JavaScriptEmbedder_1.default.for(script, name); + var ref = this.context.nextRef(); + var javaScript = PDFJavaScript_1.default.of(ref, this, embedder); + this.javaScripts.push(javaScript); + }; + /** + * Add an attachment to this document. Attachments are visible in the + * "Attachments" panel of Adobe Acrobat and some other PDF readers. Any + * type of file can be added as an attachment. This includes, but is not + * limited to, `.png`, `.jpg`, `.pdf`, `.csv`, `.docx`, and `.xlsx` files. + * + * The input data can be provided in multiple formats: + * + * | Type | Contents | + * | ------------- | -------------------------------------------------------------- | + * | `string` | A base64 encoded string (or data URI) containing an attachment | + * | `Uint8Array` | The raw bytes of an attachment | + * | `ArrayBuffer` | The raw bytes of an attachment | + * + * For example: + * ```js + * // attachment=string + * await pdfDoc.attach('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...', 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * await pdfDoc.attach('data:image/jpeg;base64,/9j/4AAQ...', 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * + * // attachment=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg') + * await pdfDoc.attach(uint8Array, 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * + * // attachment=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * await pdfDoc.attach(arrayBuffer, 'cat_riding_unicorn.jpg', { + * mimeType: 'image/jpeg', + * description: 'Cool cat riding a unicorn! 🦄🐈🕶️', + * creationDate: new Date('2019/12/01'), + * modificationDate: new Date('2020/04/19'), + * }) + * ``` + * + * @param attachment The input data containing the file to be attached. + * @param name The name of the file to be attached. + * @returns Resolves when the attachment is complete. + */ + PDFDocument.prototype.attach = function (attachment, name, options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var bytes, embedder, ref, embeddedFile; + return tslib_1.__generator(this, function (_a) { + utils_1.assertIs(attachment, 'attachment', ['string', Uint8Array, ArrayBuffer]); + utils_1.assertIs(name, 'name', ['string']); + utils_1.assertOrUndefined(options.mimeType, 'mimeType', ['string']); + utils_1.assertOrUndefined(options.description, 'description', ['string']); + utils_1.assertOrUndefined(options.creationDate, 'options.creationDate', [Date]); + utils_1.assertOrUndefined(options.modificationDate, 'options.modificationDate', [ + Date, + ]); + utils_1.assertIsOneOfOrUndefined(options.afRelationship, 'options.afRelationship', FileEmbedder_1.AFRelationship); + bytes = utils_1.toUint8Array(attachment); + embedder = FileEmbedder_1.default.for(bytes, name, options); + ref = this.context.nextRef(); + embeddedFile = PDFEmbeddedFile_1.default.of(ref, this, embedder); + this.embeddedFiles.push(embeddedFile); + return [2 /*return*/]; + }); + }); + }; + /** + * Embed a font into this document. The input data can be provided in multiple + * formats: + * + * | Type | Contents | + * | --------------- | ------------------------------------------------------- | + * | `StandardFonts` | One of the standard 14 fonts | + * | `string` | A base64 encoded string (or data URI) containing a font | + * | `Uint8Array` | The raw bytes of a font | + * | `ArrayBuffer` | The raw bytes of a font | + * + * For example: + * ```js + * // font=StandardFonts + * import { StandardFonts } from 'pdf-lib' + * const font1 = await pdfDoc.embedFont(StandardFonts.Helvetica) + * + * // font=string + * const font2 = await pdfDoc.embedFont('AAEAAAAVAQAABABQRFNJRx/upe...') + * const font3 = await pdfDoc.embedFont('data:font/opentype;base64,AAEAAA...') + * + * // font=Uint8Array + * import fs from 'fs' + * const font4 = await pdfDoc.embedFont(fs.readFileSync('Ubuntu-R.ttf')) + * + * // font=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf' + * const ubuntuBytes = await fetch(url).then(res => res.arrayBuffer()) + * const font5 = await pdfDoc.embedFont(ubuntuBytes) + * ``` + * See also: [[registerFontkit]] + * @param font The input data for a font. + * @param options The options to be used when embedding the font. + * @returns Resolves with the embedded font. + */ + PDFDocument.prototype.embedFont = function (font, options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, subset, customName, features, embedder, bytes, fontkit, _b, ref, pdfFont; + return tslib_1.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _a = options.subset, subset = _a === void 0 ? false : _a, customName = options.customName, features = options.features; + utils_1.assertIs(font, 'font', ['string', Uint8Array, ArrayBuffer]); + utils_1.assertIs(subset, 'subset', ['boolean']); + if (!utils_1.isStandardFont(font)) return [3 /*break*/, 1]; + embedder = core_1.StandardFontEmbedder.for(font, customName); + return [3 /*break*/, 7]; + case 1: + if (!utils_1.canBeConvertedToUint8Array(font)) return [3 /*break*/, 6]; + bytes = utils_1.toUint8Array(font); + fontkit = this.assertFontkit(); + if (!subset) return [3 /*break*/, 3]; + return [4 /*yield*/, core_1.CustomFontSubsetEmbedder.for(fontkit, bytes, customName, features)]; + case 2: + _b = _c.sent(); + return [3 /*break*/, 5]; + case 3: return [4 /*yield*/, core_1.CustomFontEmbedder.for(fontkit, bytes, customName, features)]; + case 4: + _b = _c.sent(); + _c.label = 5; + case 5: + embedder = _b; + return [3 /*break*/, 7]; + case 6: throw new TypeError('`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`'); + case 7: + ref = this.context.nextRef(); + pdfFont = PDFFont_1.default.of(ref, this, embedder); + this.fonts.push(pdfFont); + return [2 /*return*/, pdfFont]; + } + }); + }); + }; + /** + * Embed a standard font into this document. + * For example: + * ```js + * import { StandardFonts } from 'pdf-lib' + * const helveticaFont = pdfDoc.embedFont(StandardFonts.Helvetica) + * ``` + * @param font The standard font to be embedded. + * @param customName The name to be used when embedding the font. + * @returns The embedded font. + */ + PDFDocument.prototype.embedStandardFont = function (font, customName) { + utils_1.assertIs(font, 'font', ['string']); + if (!utils_1.isStandardFont(font)) { + throw new TypeError('`font` must be one of type `StandardFonts`'); + } + var embedder = core_1.StandardFontEmbedder.for(font, customName); + var ref = this.context.nextRef(); + var pdfFont = PDFFont_1.default.of(ref, this, embedder); + this.fonts.push(pdfFont); + return pdfFont; + }; + /** + * Embed a JPEG image into this document. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------------- | + * | `string` | A base64 encoded string (or data URI) containing a JPEG image | + * | `Uint8Array` | The raw bytes of a JPEG image | + * | `ArrayBuffer` | The raw bytes of a JPEG image | + * + * For example: + * ```js + * // jpg=string + * const image1 = await pdfDoc.embedJpg('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...') + * const image2 = await pdfDoc.embedJpg('data:image/jpeg;base64,/9j/4AAQ...') + * + * // jpg=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg') + * const image3 = await pdfDoc.embedJpg(uint8Array) + * + * // jpg=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const image4 = await pdfDoc.embedJpg(arrayBuffer) + * ``` + * + * @param jpg The input data for a JPEG image. + * @returns Resolves with the embedded image. + */ + PDFDocument.prototype.embedJpg = function (jpg) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var bytes, embedder, ref, pdfImage; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.assertIs(jpg, 'jpg', ['string', Uint8Array, ArrayBuffer]); + bytes = utils_1.toUint8Array(jpg); + return [4 /*yield*/, core_1.JpegEmbedder.for(bytes)]; + case 1: + embedder = _a.sent(); + ref = this.context.nextRef(); + pdfImage = PDFImage_1.default.of(ref, this, embedder); + this.images.push(pdfImage); + return [2 /*return*/, pdfImage]; + } + }); + }); + }; + /** + * Embed a PNG image into this document. The input data can be provided in + * multiple formats: + * + * | Type | Contents | + * | ------------- | ------------------------------------------------------------ | + * | `string` | A base64 encoded string (or data URI) containing a PNG image | + * | `Uint8Array` | The raw bytes of a PNG image | + * | `ArrayBuffer` | The raw bytes of a PNG image | + * + * For example: + * ```js + * // png=string + * const image1 = await pdfDoc.embedPng('iVBORw0KGgoAAAANSUhEUgAAAlgAAAF3...') + * const image2 = await pdfDoc.embedPng('data:image/png;base64,iVBORw0KGg...') + * + * // png=Uint8Array + * import fs from 'fs' + * const uint8Array = fs.readFileSync('small_mario.png') + * const image3 = await pdfDoc.embedPng(uint8Array) + * + * // png=ArrayBuffer + * const url = 'https://pdf-lib.js.org/assets/small_mario.png' + * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer()) + * const image4 = await pdfDoc.embedPng(arrayBuffer) + * ``` + * + * @param png The input data for a PNG image. + * @returns Resolves with the embedded image. + */ + PDFDocument.prototype.embedPng = function (png) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var bytes, embedder, ref, pdfImage; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.assertIs(png, 'png', ['string', Uint8Array, ArrayBuffer]); + bytes = utils_1.toUint8Array(png); + return [4 /*yield*/, core_1.PngEmbedder.for(bytes)]; + case 1: + embedder = _a.sent(); + ref = this.context.nextRef(); + pdfImage = PDFImage_1.default.of(ref, this, embedder); + this.images.push(pdfImage); + return [2 /*return*/, pdfImage]; + } + }); + }); + }; + /** + * Embed one or more PDF pages into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * + * // Embed page 74 of `sourcePdf` into `pdfDoc` + * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, [73]) + * ``` + * + * See [[PDFDocument.load]] for examples of the allowed input data formats. + * + * @param pdf The input data containing a PDF document. + * @param indices The indices of the pages that should be embedded. + * @returns Resolves with an array of the embedded pages. + */ + PDFDocument.prototype.embedPdf = function (pdf, indices) { + if (indices === void 0) { indices = [0]; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var srcDoc, _a, srcPages; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + utils_1.assertIs(pdf, 'pdf', [ + 'string', + Uint8Array, + ArrayBuffer, + [PDFDocument, 'PDFDocument'], + ]); + utils_1.assertIs(indices, 'indices', [Array]); + if (!(pdf instanceof PDFDocument)) return [3 /*break*/, 1]; + _a = pdf; + return [3 /*break*/, 3]; + case 1: return [4 /*yield*/, PDFDocument.load(pdf)]; + case 2: + _a = _b.sent(); + _b.label = 3; + case 3: + srcDoc = _a; + srcPages = utils_1.pluckIndices(srcDoc.getPages(), indices); + return [2 /*return*/, this.embedPages(srcPages)]; + } + }); + }); + }; + /** + * Embed a single PDF page into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * const sourcePdfDoc = await PDFDocument.load(sourceBuffer) + * const sourcePdfPage = sourcePdfDoc.getPages()[73] + * + * const embeddedPage = await pdfDoc.embedPage( + * sourcePdfPage, + * + * // Clip a section of the source page so that we only embed part of it + * { left: 100, right: 450, bottom: 330, top: 570 }, + * + * // Translate all drawings of the embedded page by (10, 200) units + * [1, 0, 0, 1, 10, 200], + * ) + * ``` + * + * @param page The page to be embedded. + * @param boundingBox + * Optionally, an area of the source page that should be embedded + * (defaults to entire page). + * @param transformationMatrix + * Optionally, a transformation matrix that is always applied to the embedded + * page anywhere it is drawn. + * @returns Resolves with the embedded pdf page. + */ + PDFDocument.prototype.embedPage = function (page, boundingBox, transformationMatrix) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var embeddedPage; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + return [4 /*yield*/, this.embedPages([page], [boundingBox], [transformationMatrix])]; + case 1: + embeddedPage = (_a.sent())[0]; + return [2 /*return*/, embeddedPage]; + } + }); + }); + }; + /** + * Embed one or more PDF pages into this document. + * + * For example: + * ```js + * const pdfDoc = await PDFDocument.create() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * const sourcePdfDoc = await PDFDocument.load(sourceBuffer) + * + * const page1 = sourcePdfDoc.getPages()[0] + * const page2 = sourcePdfDoc.getPages()[52] + * const page3 = sourcePdfDoc.getPages()[73] + * + * const embeddedPages = await pdfDoc.embedPages([page1, page2, page3]) + * ``` + * + * @param page + * The pages to be embedded (they must all share the same context). + * @param boundingBoxes + * Optionally, an array of clipping boundaries - one for each page + * (defaults to entirety of each page). + * @param transformationMatrices + * Optionally, an array of transformation matrices - one for each page + * (each page's transformation will apply anywhere it is drawn). + * @returns Resolves with an array of the embedded pdf pages. + */ + PDFDocument.prototype.embedPages = function (pages, boundingBoxes, transformationMatrices) { + if (boundingBoxes === void 0) { boundingBoxes = []; } + if (transformationMatrices === void 0) { transformationMatrices = []; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var idx, len, currPage, nextPage, context, maybeCopyPage, embeddedPages, idx, len, page, box, matrix, embedder, ref; + var _a; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (pages.length === 0) + return [2 /*return*/, []]; + // Assert all pages have the same context + for (idx = 0, len = pages.length - 1; idx < len; idx++) { + currPage = pages[idx]; + nextPage = pages[idx + 1]; + if (currPage.node.context !== nextPage.node.context) { + throw new core_1.PageEmbeddingMismatchedContextError(); + } + } + context = pages[0].node.context; + maybeCopyPage = context === this.context + ? function (p) { return p; } + : core_1.PDFObjectCopier.for(context, this.context).copy; + embeddedPages = new Array(pages.length); + idx = 0, len = pages.length; + _b.label = 1; + case 1: + if (!(idx < len)) return [3 /*break*/, 4]; + page = maybeCopyPage(pages[idx].node); + box = boundingBoxes[idx]; + matrix = transformationMatrices[idx]; + return [4 /*yield*/, core_1.PDFPageEmbedder.for(page, box, matrix)]; + case 2: + embedder = _b.sent(); + ref = this.context.nextRef(); + embeddedPages[idx] = PDFEmbeddedPage_1.default.of(ref, this, embedder); + _b.label = 3; + case 3: + idx++; + return [3 /*break*/, 1]; + case 4: + (_a = this.embeddedPages).push.apply(_a, embeddedPages); + return [2 /*return*/, embeddedPages]; + } + }); + }); + }; + /** + * > **NOTE:** You shouldn't need to call this method directly. The [[save]] + * > and [[saveAsBase64]] methods will automatically ensure that all embedded + * > assets are flushed before serializing the document. + * + * Flush all embedded fonts, PDF pages, and images to this document's + * [[context]]. + * + * @returns Resolves when the flush is complete. + */ + PDFDocument.prototype.flush = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.embedAll(this.fonts)]; + case 1: + _a.sent(); + return [4 /*yield*/, this.embedAll(this.images)]; + case 2: + _a.sent(); + return [4 /*yield*/, this.embedAll(this.embeddedPages)]; + case 3: + _a.sent(); + return [4 /*yield*/, this.embedAll(this.embeddedFiles)]; + case 4: + _a.sent(); + return [4 /*yield*/, this.embedAll(this.javaScripts)]; + case 5: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + /** + * Serialize this document to an array of bytes making up a PDF file. + * For example: + * ```js + * const pdfBytes = await pdfDoc.save() + * ``` + * + * There are a number of things you can do with the serialized document, + * depending on the JavaScript environment you're running in: + * * Write it to a file in Node or React Native + * * Download it as a Blob in the browser + * * Render it in an `iframe` + * + * @param options The options to be used when saving the document. + * @returns Resolves with the bytes of the serialized document. + */ + PDFDocument.prototype.save = function (options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, useObjectStreams, _b, addDefaultPage, _c, objectsPerTick, _d, updateFieldAppearances, form, Writer; + return tslib_1.__generator(this, function (_e) { + switch (_e.label) { + case 0: + _a = options.useObjectStreams, useObjectStreams = _a === void 0 ? true : _a, _b = options.addDefaultPage, addDefaultPage = _b === void 0 ? true : _b, _c = options.objectsPerTick, objectsPerTick = _c === void 0 ? 50 : _c, _d = options.updateFieldAppearances, updateFieldAppearances = _d === void 0 ? true : _d; + utils_1.assertIs(useObjectStreams, 'useObjectStreams', ['boolean']); + utils_1.assertIs(addDefaultPage, 'addDefaultPage', ['boolean']); + utils_1.assertIs(objectsPerTick, 'objectsPerTick', ['number']); + utils_1.assertIs(updateFieldAppearances, 'updateFieldAppearances', ['boolean']); + if (addDefaultPage && this.getPageCount() === 0) + this.addPage(); + if (updateFieldAppearances) { + form = this.formCache.getValue(); + if (form) + form.updateFieldAppearances(); + } + return [4 /*yield*/, this.flush()]; + case 1: + _e.sent(); + Writer = useObjectStreams ? core_1.PDFStreamWriter : core_1.PDFWriter; + return [2 /*return*/, Writer.forContext(this.context, objectsPerTick).serializeToBuffer()]; + } + }); + }); + }; + /** + * Serialize this document to a base64 encoded string or data URI making up a + * PDF file. For example: + * ```js + * const base64String = await pdfDoc.saveAsBase64() + * base64String // => 'JVBERi0xLjcKJYGBgYEKC...' + * + * const base64DataUri = await pdfDoc.saveAsBase64({ dataUri: true }) + * base64DataUri // => 'data:application/pdf;base64,JVBERi0xLjcKJYGBgYEKC...' + * ``` + * + * @param options The options to be used when saving the document. + * @returns Resolves with a base64 encoded string or data URI of the + * serialized document. + */ + PDFDocument.prototype.saveAsBase64 = function (options) { + if (options === void 0) { options = {}; } + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, dataUri, otherOptions, bytes, base64; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = options.dataUri, dataUri = _a === void 0 ? false : _a, otherOptions = tslib_1.__rest(options, ["dataUri"]); + utils_1.assertIs(dataUri, 'dataUri', ['boolean']); + return [4 /*yield*/, this.save(otherOptions)]; + case 1: + bytes = _b.sent(); + base64 = utils_1.encodeToBase64(bytes); + return [2 /*return*/, dataUri ? "data:application/pdf;base64," + base64 : base64]; + } + }); + }); + }; + PDFDocument.prototype.findPageForAnnotationRef = function (ref) { + var pages = this.getPages(); + for (var idx = 0, len = pages.length; idx < len; idx++) { + var page = pages[idx]; + var annotations = page.node.Annots(); + if ((annotations === null || annotations === void 0 ? void 0 : annotations.indexOf(ref)) !== undefined) { + return page; + } + } + return undefined; + }; + PDFDocument.prototype.embedAll = function (embeddables) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var idx, len; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + idx = 0, len = embeddables.length; + _a.label = 1; + case 1: + if (!(idx < len)) return [3 /*break*/, 4]; + return [4 /*yield*/, embeddables[idx].embed()]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + idx++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + }); + }; + PDFDocument.prototype.updateInfoDict = function () { + var pdfLib = "pdf-lib (https://github.com/Hopding/pdf-lib)"; + var now = new Date(); + var info = this.getInfoDict(); + this.setProducer(pdfLib); + this.setModificationDate(now); + if (!info.get(core_1.PDFName.of('Creator'))) + this.setCreator(pdfLib); + if (!info.get(core_1.PDFName.of('CreationDate'))) + this.setCreationDate(now); + }; + PDFDocument.prototype.getInfoDict = function () { + var existingInfo = this.context.lookup(this.context.trailerInfo.Info); + if (existingInfo instanceof core_1.PDFDict) + return existingInfo; + var newInfo = this.context.obj({}); + this.context.trailerInfo.Info = this.context.register(newInfo); + return newInfo; + }; + PDFDocument.prototype.assertFontkit = function () { + if (!this.fontkit) + throw new errors_1.FontkitNotRegisteredError(); + return this.fontkit; + }; + return PDFDocument; +}()); +exports.default = PDFDocument; +/* tslint:disable-next-line only-arrow-functions */ +function assertIsLiteralOrHexString(pdfObject) { + if (!(pdfObject instanceof core_1.PDFHexString) && + !(pdfObject instanceof core_1.PDFString)) { + throw new core_1.UnexpectedObjectTypeError([core_1.PDFHexString, core_1.PDFString], pdfObject); + } +} +//# sourceMappingURL=PDFDocument.js.map \ No newline at end of file diff --git a/cjs/api/PDFDocument.js.map b/cjs/api/PDFDocument.js.map new file mode 100644 index 000000000..5c031ff58 --- /dev/null +++ b/cjs/api/PDFDocument.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDocument.js","sourceRoot":"","sources":["../../src/api/PDFDocument.ts"],"names":[],"mappings":";;;AACA,mCAKwB;AACxB,8EAAsD;AACtD,8DAAsC;AACtC,gEAAwC;AACxC,8DAAsC;AACtC,mEAA2C;AAC3C,iCAA0C;AAE1C,gCAsBkB;AAClB,2DASoC;AAKpC,kCAYmB;AACnB,qFAA+E;AAC/E,8EAAsD;AACt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QACE,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,kCAAyB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAqBH,kBAAC;AAAD,CAAC,AA9xCD,IA8xCC;;AAED,mDAAmD;AACnD,SAAS,0BAA0B,CACjC,SAAoB;IAEpB,IACE,CAAC,CAAC,SAAS,YAAY,mBAAY,CAAC;QACpC,CAAC,CAAC,SAAS,YAAY,gBAAS,CAAC,EACjC;QACA,MAAM,IAAI,gCAAyB,CAAC,CAAC,mBAAY,EAAE,gBAAS,CAAC,EAAE,SAAS,CAAC,CAAC;KAC3E;AACH,CAAC"} \ No newline at end of file diff --git a/cjs/api/PDFDocumentOptions.d.ts b/cjs/api/PDFDocumentOptions.d.ts new file mode 100644 index 000000000..8ae6d3ee9 --- /dev/null +++ b/cjs/api/PDFDocumentOptions.d.ts @@ -0,0 +1,38 @@ +import { EmbeddedFileOptions } from "../core/embedders/FileEmbedder"; +import { TypeFeatures } from "../types/fontkit"; +export declare enum ParseSpeeds { + Fastest = Infinity, + Fast = 1500, + Medium = 500, + Slow = 100 +} +export interface AttachmentOptions extends EmbeddedFileOptions { +} +export interface SaveOptions { + useObjectStreams?: boolean; + addDefaultPage?: boolean; + objectsPerTick?: number; + updateFieldAppearances?: boolean; +} +export interface Base64SaveOptions extends SaveOptions { + dataUri?: boolean; +} +export interface LoadOptions { + ignoreEncryption?: boolean; + parseSpeed?: ParseSpeeds | number; + throwOnInvalidObject?: boolean; + updateMetadata?: boolean; + capNumbers?: boolean; +} +export interface CreateOptions { + updateMetadata?: boolean; +} +export interface EmbedFontOptions { + subset?: boolean; + customName?: string; + features?: TypeFeatures; +} +export interface SetTitleOptions { + showInWindowTitleBar: boolean; +} +//# sourceMappingURL=PDFDocumentOptions.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFDocumentOptions.d.ts.map b/cjs/api/PDFDocumentOptions.d.ts.map new file mode 100644 index 000000000..0a5ad221b --- /dev/null +++ b/cjs/api/PDFDocumentOptions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDocumentOptions.d.ts","sourceRoot":"","sources":["../../src/api/PDFDocumentOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uCAAwC;AACtE,OAAO,EAAE,YAAY,EAAE,yBAA0B;AAEjD,oBAAY,WAAW;IACrB,OAAO,WAAW;IAClB,IAAI,OAAO;IACX,MAAM,MAAM;IACZ,IAAI,MAAM;CACX;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;CAAG;AAEjE,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,oBAAoB,EAAE,OAAO,CAAC;CAC/B"} \ No newline at end of file diff --git a/cjs/api/PDFDocumentOptions.js b/cjs/api/PDFDocumentOptions.js new file mode 100644 index 000000000..e58721bb6 --- /dev/null +++ b/cjs/api/PDFDocumentOptions.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ParseSpeeds = void 0; +var ParseSpeeds; +(function (ParseSpeeds) { + ParseSpeeds[ParseSpeeds["Fastest"] = Infinity] = "Fastest"; + ParseSpeeds[ParseSpeeds["Fast"] = 1500] = "Fast"; + ParseSpeeds[ParseSpeeds["Medium"] = 500] = "Medium"; + ParseSpeeds[ParseSpeeds["Slow"] = 100] = "Slow"; +})(ParseSpeeds = exports.ParseSpeeds || (exports.ParseSpeeds = {})); +//# sourceMappingURL=PDFDocumentOptions.js.map \ No newline at end of file diff --git a/cjs/api/PDFDocumentOptions.js.map b/cjs/api/PDFDocumentOptions.js.map new file mode 100644 index 000000000..85ecfe384 --- /dev/null +++ b/cjs/api/PDFDocumentOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDocumentOptions.js","sourceRoot":"","sources":["../../src/api/PDFDocumentOptions.ts"],"names":[],"mappings":";;;AAGA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0DAAkB,CAAA;IAClB,gDAAW,CAAA;IACX,mDAAY,CAAA;IACZ,+CAAU,CAAA;AACZ,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB"} \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedFile.d.ts b/cjs/api/PDFEmbeddedFile.d.ts new file mode 100644 index 000000000..981039bc1 --- /dev/null +++ b/cjs/api/PDFEmbeddedFile.d.ts @@ -0,0 +1,39 @@ +import Embeddable from "./Embeddable"; +import PDFDocument from "./PDFDocument"; +import FileEmbedder from "../core/embedders/FileEmbedder"; +import { PDFRef } from "../core"; +/** + * Represents a file that has been embedded in a [[PDFDocument]]. + */ +export default class PDFEmbeddedFile implements Embeddable { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.attach]] method, which will create + * instances of [[PDFEmbeddedFile]] for you. + * + * Create an instance of [[PDFEmbeddedFile]] from an existing ref and embedder + * + * @param ref The unique reference for this file. + * @param doc The document to which the file will belong. + * @param embedder The embedder that will be used to embed the file. + */ + static of: (ref: PDFRef, doc: PDFDocument, embedder: FileEmbedder) => PDFEmbeddedFile; + /** The unique reference assigned to this embedded file within the document. */ + readonly ref: PDFRef; + /** The document to which this embedded file belongs. */ + readonly doc: PDFDocument; + private alreadyEmbedded; + private readonly embedder; + private constructor(); + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all embeddable files get embedded. + * + * Embed this embeddable file in its document. + * + * @returns Resolves when the embedding is complete. + */ + embed(): Promise; +} +//# sourceMappingURL=PDFEmbeddedFile.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedFile.d.ts.map b/cjs/api/PDFEmbeddedFile.d.ts.map new file mode 100644 index 000000000..f94123063 --- /dev/null +++ b/cjs/api/PDFEmbeddedFile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFEmbeddedFile.d.ts","sourceRoot":"","sources":["../../src/api/PDFEmbeddedFile.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,qBAA2B;AAC5C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,YAAY,uCAAwC;AAC3D,OAAO,EAA4C,MAAM,EAAE,gBAAiB;AAE5E;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,UAAU;IACxD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,QAAS,MAAM,OAAO,WAAW,YAAY,YAAY,qBACxB;IAE1C,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC,OAAO;IAMP;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA0C7B"} \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedFile.js b/cjs/api/PDFEmbeddedFile.js new file mode 100644 index 000000000..0fa7d0d6a --- /dev/null +++ b/cjs/api/PDFEmbeddedFile.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var core_1 = require("../core"); +/** + * Represents a file that has been embedded in a [[PDFDocument]]. + */ +var PDFEmbeddedFile = /** @class */ (function () { + function PDFEmbeddedFile(ref, doc, embedder) { + this.alreadyEmbedded = false; + this.ref = ref; + this.doc = doc; + this.embedder = embedder; + } + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all embeddable files get embedded. + * + * Embed this embeddable file in its document. + * + * @returns Resolves when the embedding is complete. + */ + PDFEmbeddedFile.prototype.embed = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var ref, Names, EmbeddedFiles, EFNames, AF; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!!this.alreadyEmbedded) return [3 /*break*/, 2]; + return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + ref = _a.sent(); + if (!this.doc.catalog.has(core_1.PDFName.of('Names'))) { + this.doc.catalog.set(core_1.PDFName.of('Names'), this.doc.context.obj({})); + } + Names = this.doc.catalog.lookup(core_1.PDFName.of('Names'), core_1.PDFDict); + if (!Names.has(core_1.PDFName.of('EmbeddedFiles'))) { + Names.set(core_1.PDFName.of('EmbeddedFiles'), this.doc.context.obj({})); + } + EmbeddedFiles = Names.lookup(core_1.PDFName.of('EmbeddedFiles'), core_1.PDFDict); + if (!EmbeddedFiles.has(core_1.PDFName.of('Names'))) { + EmbeddedFiles.set(core_1.PDFName.of('Names'), this.doc.context.obj([])); + } + EFNames = EmbeddedFiles.lookup(core_1.PDFName.of('Names'), core_1.PDFArray); + EFNames.push(core_1.PDFHexString.fromText(this.embedder.fileName)); + EFNames.push(ref); + /** + * The AF-Tag is needed to achieve PDF-A3 compliance for embedded files + * + * The following document outlines the uses cases of the associated files (AF) tag. + * See: + * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf + */ + if (!this.doc.catalog.has(core_1.PDFName.of('AF'))) { + this.doc.catalog.set(core_1.PDFName.of('AF'), this.doc.context.obj([])); + } + AF = this.doc.catalog.lookup(core_1.PDFName.of('AF'), core_1.PDFArray); + AF.push(ref); + this.alreadyEmbedded = true; + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.attach]] method, which will create + * instances of [[PDFEmbeddedFile]] for you. + * + * Create an instance of [[PDFEmbeddedFile]] from an existing ref and embedder + * + * @param ref The unique reference for this file. + * @param doc The document to which the file will belong. + * @param embedder The embedder that will be used to embed the file. + */ + PDFEmbeddedFile.of = function (ref, doc, embedder) { + return new PDFEmbeddedFile(ref, doc, embedder); + }; + return PDFEmbeddedFile; +}()); +exports.default = PDFEmbeddedFile; +//# sourceMappingURL=PDFEmbeddedFile.js.map \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedFile.js.map b/cjs/api/PDFEmbeddedFile.js.map new file mode 100644 index 000000000..387ac0a2f --- /dev/null +++ b/cjs/api/PDFEmbeddedFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFEmbeddedFile.js","sourceRoot":"","sources":["../../src/api/PDFEmbeddedFile.ts"],"names":[],"mappings":";;;AAGA,gCAA4E;AAE5E;;GAEG;AACH;IAwBE,yBAAoB,GAAW,EAAE,GAAgB,EAAE,QAAsB;QAHjE,oBAAe,GAAG,KAAK,CAAC;QAI9B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC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AC,CAAC;yBAClE;wBACK,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,cAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,eAAQ,CAAC,CAAC;wBAEpE,OAAO,CAAC,IAAI,CAAC,mBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAC5D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAElB;;;;;;2BAMG;wBAEH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE;4BAC3C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;yBAClE;wBACK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,eAAQ,CAAC,CAAC;wBAC/D,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAEb,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;;;;;;KAE/B;IA/ED;;;;;;;;;;OAUG;IACI,kBAAE,GAAG,UAAC,GAAW,EAAE,GAAgB,EAAE,QAAsB;QAChE,OAAA,IAAI,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC;IAAvC,CAAuC,CAAC;IAoE5C,sBAAC;CAAA,AAjFD,IAiFC;kBAjFoB,eAAe"} \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedPage.d.ts b/cjs/api/PDFEmbeddedPage.d.ts new file mode 100644 index 000000000..3406fb3d6 --- /dev/null +++ b/cjs/api/PDFEmbeddedPage.d.ts @@ -0,0 +1,74 @@ +import Embeddable from "./Embeddable"; +import PDFDocument from "./PDFDocument"; +import { PDFPageEmbedder, PDFRef } from "../core"; +/** + * Represents a PDF page that has been embedded in a [[PDFDocument]]. + */ +export default class PDFEmbeddedPage implements Embeddable { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedPdf]] and + * > [[PDFDocument.embedPage]] methods, which will create instances of + * > [[PDFEmbeddedPage]] for you. + * + * Create an instance of [[PDFEmbeddedPage]] from an existing ref and embedder + * + * @param ref The unique reference for this embedded page. + * @param doc The document to which the embedded page will belong. + * @param embedder The embedder that will be used to embed the page. + */ + static of: (ref: PDFRef, doc: PDFDocument, embedder: PDFPageEmbedder) => PDFEmbeddedPage; + /** The unique reference assigned to this embedded page within the document. */ + readonly ref: PDFRef; + /** The document to which this embedded page belongs. */ + readonly doc: PDFDocument; + /** The width of this page in pixels. */ + readonly width: number; + /** The height of this page in pixels. */ + readonly height: number; + private alreadyEmbedded; + private readonly embedder; + private constructor(); + /** + * Compute the width and height of this page after being scaled by the + * given `factor`. For example: + * ```js + * embeddedPage.width // => 500 + * embeddedPage.height // => 250 + * + * const scaled = embeddedPage.scale(0.5) + * scaled.width // => 250 + * scaled.height // => 125 + * ``` + * This operation is often useful before drawing a page with + * [[PDFPage.drawPage]] to compute the `width` and `height` options. + * @param factor The factor by which this page should be scaled. + * @returns The width and height of the page after being scaled. + */ + scale(factor: number): { + width: number; + height: number; + }; + /** + * Get the width and height of this page. For example: + * ```js + * const { width, height } = embeddedPage.size() + * ``` + * @returns The width and height of the page. + */ + size(): { + width: number; + height: number; + }; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all embeddable pages get embedded. + * + * Embed this embeddable page in its document. + * + * @returns Resolves when the embedding is complete. + */ + embed(): Promise; +} +//# sourceMappingURL=PDFEmbeddedPage.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedPage.d.ts.map b/cjs/api/PDFEmbeddedPage.d.ts.map new file mode 100644 index 000000000..b18d76065 --- /dev/null +++ b/cjs/api/PDFEmbeddedPage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFEmbeddedPage.d.ts","sourceRoot":"","sources":["../../src/api/PDFEmbeddedPage.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,qBAA2B;AAC5C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAiB;AAGnD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,UAAU;IACxD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,QAAS,MAAM,OAAO,WAAW,YAAY,eAAe,qBAC3B;IAE1C,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAE3C,OAAO;IAiBP;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM;;;;IAKpB;;;;;;OAMG;IACH,IAAI;;;;IAIJ;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAM7B"} \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedPage.js b/cjs/api/PDFEmbeddedPage.js new file mode 100644 index 000000000..62a168e39 --- /dev/null +++ b/cjs/api/PDFEmbeddedPage.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument")); +var core_1 = require("../core"); +var utils_1 = require("../utils"); +/** + * Represents a PDF page that has been embedded in a [[PDFDocument]]. + */ +var PDFEmbeddedPage = /** @class */ (function () { + function PDFEmbeddedPage(ref, doc, embedder) { + this.alreadyEmbedded = false; + utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + utils_1.assertIs(embedder, 'embedder', [[core_1.PDFPageEmbedder, 'PDFPageEmbedder']]); + this.ref = ref; + this.doc = doc; + this.width = embedder.width; + this.height = embedder.height; + this.embedder = embedder; + } + /** + * Compute the width and height of this page after being scaled by the + * given `factor`. For example: + * ```js + * embeddedPage.width // => 500 + * embeddedPage.height // => 250 + * + * const scaled = embeddedPage.scale(0.5) + * scaled.width // => 250 + * scaled.height // => 125 + * ``` + * This operation is often useful before drawing a page with + * [[PDFPage.drawPage]] to compute the `width` and `height` options. + * @param factor The factor by which this page should be scaled. + * @returns The width and height of the page after being scaled. + */ + PDFEmbeddedPage.prototype.scale = function (factor) { + utils_1.assertIs(factor, 'factor', ['number']); + return { width: this.width * factor, height: this.height * factor }; + }; + /** + * Get the width and height of this page. For example: + * ```js + * const { width, height } = embeddedPage.size() + * ``` + * @returns The width and height of the page. + */ + PDFEmbeddedPage.prototype.size = function () { + return this.scale(1); + }; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all embeddable pages get embedded. + * + * Embed this embeddable page in its document. + * + * @returns Resolves when the embedding is complete. + */ + PDFEmbeddedPage.prototype.embed = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!!this.alreadyEmbedded) return [3 /*break*/, 2]; + return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + _a.sent(); + this.alreadyEmbedded = true; + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedPdf]] and + * > [[PDFDocument.embedPage]] methods, which will create instances of + * > [[PDFEmbeddedPage]] for you. + * + * Create an instance of [[PDFEmbeddedPage]] from an existing ref and embedder + * + * @param ref The unique reference for this embedded page. + * @param doc The document to which the embedded page will belong. + * @param embedder The embedder that will be used to embed the page. + */ + PDFEmbeddedPage.of = function (ref, doc, embedder) { + return new PDFEmbeddedPage(ref, doc, embedder); + }; + return PDFEmbeddedPage; +}()); +exports.default = PDFEmbeddedPage; +//# sourceMappingURL=PDFEmbeddedPage.js.map \ No newline at end of file diff --git a/cjs/api/PDFEmbeddedPage.js.map b/cjs/api/PDFEmbeddedPage.js.map new file mode 100644 index 000000000..1d298d878 --- /dev/null +++ b/cjs/api/PDFEmbeddedPage.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFEmbeddedPage.js","sourceRoot":"","sources":["../../src/api/PDFEmbeddedPage.ts"],"names":[],"mappings":";;;AACA,sEAA8C;AAC9C,gCAAmD;AACnD,kCAAqC;AAErC;;GAEG;AACH;IA+BE,yBACE,GAAW,EACX,GAAgB,EAChB,QAAyB;QANnB,oBAAe,GAAG,KAAK,CAAC;QAQ9B,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3C,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,qBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACrD,gBAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,sBAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,+BAAK,GAAL,UAAM,MAAc;QAClB,gBAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,8BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACG,+BAAK,GAAX;;;;;6BACM,CAAC,IAAI,CAAC,eAAe,EAArB,wBAAqB;wBACvB,qBAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAA;;wBAAhE,SAAgE,CAAC;wBACjE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;;;;;;KAE/B;IA7FD;;;;;;;;;;;OAWG;IACI,kBAAE,GAAG,UAAC,GAAW,EAAE,GAAgB,EAAE,QAAyB;QACnE,OAAA,IAAI,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC;IAAvC,CAAuC,CAAC;IAiF5C,sBAAC;CAAA,AA/FD,IA+FC;kBA/FoB,eAAe"} \ No newline at end of file diff --git a/cjs/api/PDFFont.d.ts b/cjs/api/PDFFont.d.ts new file mode 100644 index 000000000..d4a3ae10c --- /dev/null +++ b/cjs/api/PDFFont.d.ts @@ -0,0 +1,95 @@ +import Embeddable from "./Embeddable"; +import PDFDocument from "./PDFDocument"; +import { CustomFontEmbedder, PDFHexString, PDFRef, StandardFontEmbedder } from "../core"; +export declare type FontEmbedder = CustomFontEmbedder | StandardFontEmbedder; +/** + * Represents a font that has been embedded in a [[PDFDocument]]. + */ +export default class PDFFont implements Embeddable { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedFont]] and + * > [[PDFDocument.embedStandardFont]] methods, which will create instances + * > of [[PDFFont]] for you. + * + * Create an instance of [[PDFFont]] from an existing ref and embedder + * + * @param ref The unique reference for this font. + * @param doc The document to which the font will belong. + * @param embedder The embedder that will be used to embed the font. + */ + static of: (ref: PDFRef, doc: PDFDocument, embedder: FontEmbedder) => PDFFont; + /** The unique reference assigned to this font within the document. */ + readonly ref: PDFRef; + /** The document to which this font belongs. */ + readonly doc: PDFDocument; + /** The name of this font. */ + readonly name: string; + private modified; + private readonly embedder; + private constructor(); + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFPage.drawText]] method will automatically encode the text it is + * > given. + * + * Encodes a string of text in this font. + * + * @param text The text to be encoded. + * @returns The encoded text as a hex string. + */ + encodeText(text: string): PDFHexString; + /** + * Measure the width of a string of text drawn in this font at a given size. + * For example: + * ```js + * const width = font.widthOfTextAtSize('Foo Bar Qux Baz', 36) + * ``` + * @param text The string of text to be measured. + * @param size The font size to be used for this measurement. + * @returns The width of the string of text when drawn in this font at the + * given size. + */ + widthOfTextAtSize(text: string, size: number): number; + /** + * Measure the height of this font at a given size. For example: + * ```js + * const height = font.heightAtSize(24) + * ``` + * + * The `options.descender` value controls whether or not the font's + * descender is included in the height calculation. + * + * @param size The font size to be used for this measurement. + * @param options The options to be used when computing this measurement. + * @returns The height of this font at the given size. + */ + heightAtSize(size: number, options?: { + descender?: boolean; + }): number; + /** + * Compute the font size at which this font is a given height. For example: + * ```js + * const fontSize = font.sizeAtHeight(12) + * ``` + * @param height The height to be used for this calculation. + * @returns The font size at which this font is the given height. + */ + sizeAtHeight(height: number): number; + /** + * Get the set of unicode code points that can be represented by this font. + * @returns The set of unicode code points supported by this font. + */ + getCharacterSet(): number[]; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all fonts get embedded. + * + * Embed this font in its document. + * + * @returns Resolves when the embedding is complete. + */ + embed(): Promise; +} +//# sourceMappingURL=PDFFont.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFFont.d.ts.map b/cjs/api/PDFFont.d.ts.map new file mode 100644 index 000000000..dd5f8144f --- /dev/null +++ b/cjs/api/PDFFont.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFFont.d.ts","sourceRoot":"","sources":["../../src/api/PDFFont.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,qBAA4B;AAC7C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,oBAAoB,EACrB,gBAAiB;AAGlB,oBAAY,YAAY,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,YAAW,UAAU;IAChD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,QAAS,MAAM,OAAO,WAAW,YAAY,YAAY,aAChC;IAElC,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC,OAAO;IAeP;;;;;;;;;OASG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAMtC;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAMrD;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAQrE;;;;;;;OAOG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKpC;;;OAGG;IACH,eAAe,IAAI,MAAM,EAAE;IAQ3B;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"} \ No newline at end of file diff --git a/cjs/api/PDFFont.js b/cjs/api/PDFFont.js new file mode 100644 index 000000000..0559aba82 --- /dev/null +++ b/cjs/api/PDFFont.js @@ -0,0 +1,143 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument")); +var core_1 = require("../core"); +var utils_1 = require("../utils"); +/** + * Represents a font that has been embedded in a [[PDFDocument]]. + */ +var PDFFont = /** @class */ (function () { + function PDFFont(ref, doc, embedder) { + this.modified = true; + utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + utils_1.assertIs(embedder, 'embedder', [ + [core_1.CustomFontEmbedder, 'CustomFontEmbedder'], + [core_1.StandardFontEmbedder, 'StandardFontEmbedder'], + ]); + this.ref = ref; + this.doc = doc; + this.name = embedder.fontName; + this.embedder = embedder; + } + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFPage.drawText]] method will automatically encode the text it is + * > given. + * + * Encodes a string of text in this font. + * + * @param text The text to be encoded. + * @returns The encoded text as a hex string. + */ + PDFFont.prototype.encodeText = function (text) { + utils_1.assertIs(text, 'text', ['string']); + this.modified = true; + return this.embedder.encodeText(text); + }; + /** + * Measure the width of a string of text drawn in this font at a given size. + * For example: + * ```js + * const width = font.widthOfTextAtSize('Foo Bar Qux Baz', 36) + * ``` + * @param text The string of text to be measured. + * @param size The font size to be used for this measurement. + * @returns The width of the string of text when drawn in this font at the + * given size. + */ + PDFFont.prototype.widthOfTextAtSize = function (text, size) { + utils_1.assertIs(text, 'text', ['string']); + utils_1.assertIs(size, 'size', ['number']); + return this.embedder.widthOfTextAtSize(text, size); + }; + /** + * Measure the height of this font at a given size. For example: + * ```js + * const height = font.heightAtSize(24) + * ``` + * + * The `options.descender` value controls whether or not the font's + * descender is included in the height calculation. + * + * @param size The font size to be used for this measurement. + * @param options The options to be used when computing this measurement. + * @returns The height of this font at the given size. + */ + PDFFont.prototype.heightAtSize = function (size, options) { + var _a; + utils_1.assertIs(size, 'size', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.descender, 'options.descender', ['boolean']); + return this.embedder.heightOfFontAtSize(size, { + descender: (_a = options === null || options === void 0 ? void 0 : options.descender) !== null && _a !== void 0 ? _a : true, + }); + }; + /** + * Compute the font size at which this font is a given height. For example: + * ```js + * const fontSize = font.sizeAtHeight(12) + * ``` + * @param height The height to be used for this calculation. + * @returns The font size at which this font is the given height. + */ + PDFFont.prototype.sizeAtHeight = function (height) { + utils_1.assertIs(height, 'height', ['number']); + return this.embedder.sizeOfFontAtHeight(height); + }; + /** + * Get the set of unicode code points that can be represented by this font. + * @returns The set of unicode code points supported by this font. + */ + PDFFont.prototype.getCharacterSet = function () { + if (this.embedder instanceof core_1.StandardFontEmbedder) { + return this.embedder.encoding.supportedCodePoints; + } + else { + return this.embedder.font.characterSet; + } + }; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all fonts get embedded. + * + * Embed this font in its document. + * + * @returns Resolves when the embedding is complete. + */ + PDFFont.prototype.embed = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.modified) return [3 /*break*/, 2]; + return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + _a.sent(); + this.modified = false; + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedFont]] and + * > [[PDFDocument.embedStandardFont]] methods, which will create instances + * > of [[PDFFont]] for you. + * + * Create an instance of [[PDFFont]] from an existing ref and embedder + * + * @param ref The unique reference for this font. + * @param doc The document to which the font will belong. + * @param embedder The embedder that will be used to embed the font. + */ + PDFFont.of = function (ref, doc, embedder) { + return new PDFFont(ref, doc, embedder); + }; + return PDFFont; +}()); +exports.default = PDFFont; +//# sourceMappingURL=PDFFont.js.map \ No newline at end of file diff --git a/cjs/api/PDFFont.js.map b/cjs/api/PDFFont.js.map new file mode 100644 index 000000000..6c4c011cc --- /dev/null +++ b/cjs/api/PDFFont.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFFont.js","sourceRoot":"","sources":["../../src/api/PDFFont.ts"],"names":[],"mappings":";;;AACA,sEAA8C;AAC9C,gCAKkB;AAClB,kCAAwD;AAIxD;;GAEG;AACH;IA4BE,iBAAoB,GAAW,EAAE,GAAgB,EAAE,QAAsB;QAHjE,aAAQ,GAAG,IAAI,CAAC;QAItB,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3C,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,qBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACrD,gBAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE;YAC7B,CAAC,yBAAkB,EAAE,oBAAoB,CAAC;YAC1C,CAAC,2BAAoB,EAAE,sBAAsB,CAAC;SAC/C,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAE9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;;;;OASG;IACH,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AQ,YAAY,2BAAoB,EAAE;YACjD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SACnD;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;SACxC;IACH,CAAC;IAED;;;;;;;;OAQG;IACG,uBAAK,GAAX;;;;;6BAEM,IAAI,CAAC,QAAQ,EAAb,wBAAa;wBACf,qBAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAA;;wBAAhE,SAAgE,CAAC;wBACjE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;;;;;;KAEzB;IAxID;;;;;;;;;;;OAWG;IACI,UAAE,GAAG,UAAC,GAAW,EAAE,GAAgB,EAAE,QAAsB;QAChE,OAAA,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC;IAA/B,CAA+B,CAAC;IA4HpC,cAAC;CAAA,AA1ID,IA0IC;kBA1IoB,OAAO"} \ No newline at end of file diff --git a/cjs/api/PDFImage.d.ts b/cjs/api/PDFImage.d.ts new file mode 100644 index 000000000..dfb4ade01 --- /dev/null +++ b/cjs/api/PDFImage.d.ts @@ -0,0 +1,96 @@ +import Embeddable from "./Embeddable"; +import PDFDocument from "./PDFDocument"; +import { JpegEmbedder, PDFRef, PngEmbedder } from "../core"; +export declare type ImageEmbedder = JpegEmbedder | PngEmbedder; +/** + * Represents an image that has been embedded in a [[PDFDocument]]. + */ +export default class PDFImage implements Embeddable { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedPng]] and [[PDFDocument.embedJpg]] + * > methods, which will create instances of [[PDFImage]] for you. + * + * Create an instance of [[PDFImage]] from an existing ref and embedder + * + * @param ref The unique reference for this image. + * @param doc The document to which the image will belong. + * @param embedder The embedder that will be used to embed the image. + */ + static of: (ref: PDFRef, doc: PDFDocument, embedder: ImageEmbedder) => PDFImage; + /** The unique reference assigned to this image within the document. */ + readonly ref: PDFRef; + /** The document to which this image belongs. */ + readonly doc: PDFDocument; + /** The width of this image in pixels. */ + readonly width: number; + /** The height of this image in pixels. */ + readonly height: number; + private embedder; + private embedTask; + private constructor(); + /** + * Compute the width and height of this image after being scaled by the + * given `factor`. For example: + * ```js + * image.width // => 500 + * image.height // => 250 + * + * const scaled = image.scale(0.5) + * scaled.width // => 250 + * scaled.height // => 125 + * ``` + * This operation is often useful before drawing an image with + * [[PDFPage.drawImage]] to compute the `width` and `height` options. + * @param factor The factor by which this image should be scaled. + * @returns The width and height of the image after being scaled. + */ + scale(factor: number): { + width: number; + height: number; + }; + /** + * Get the width and height of this image after scaling it as large as + * possible while maintaining its aspect ratio and not exceeding the + * specified `width` and `height`. For example: + * ``` + * image.width // => 500 + * image.height // => 250 + * + * const scaled = image.scaleToFit(750, 1000) + * scaled.width // => 750 + * scaled.height // => 375 + * ``` + * The `width` and `height` parameters can also be thought of as the width + * and height of a box that the scaled image must fit within. + * @param width The bounding box's width. + * @param height The bounding box's height. + * @returns The width and height of the image after being scaled. + */ + scaleToFit(width: number, height: number): { + width: number; + height: number; + }; + /** + * Get the width and height of this image. For example: + * ```js + * const { width, height } = image.size() + * ``` + * @returns The width and height of the image. + */ + size(): { + width: number; + height: number; + }; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all images get embedded. + * + * Embed this image in its document. + * + * @returns Resolves when the embedding is complete. + */ + embed(): Promise; +} +//# sourceMappingURL=PDFImage.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFImage.d.ts.map b/cjs/api/PDFImage.d.ts.map new file mode 100644 index 000000000..8465e8001 --- /dev/null +++ b/cjs/api/PDFImage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFImage.d.ts","sourceRoot":"","sources":["../../src/api/PDFImage.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,qBAA2B;AAC5C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAiB;AAG7D,oBAAY,aAAa,GAAG,YAAY,GAAG,WAAW,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,YAAW,UAAU;IACjD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,QAAS,MAAM,OAAO,WAAW,YAAY,aAAa,cAChC;IAEnC,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,gDAAgD;IAChD,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,SAAS,CAA8B;IAE/C,OAAO;IAgBP;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM;;;;IAKpB;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;IAWxC;;;;;;OAMG;IACH,IAAI;;;;IAIJ;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB7B"} \ No newline at end of file diff --git a/cjs/api/PDFImage.js b/cjs/api/PDFImage.js new file mode 100644 index 000000000..e901a2d33 --- /dev/null +++ b/cjs/api/PDFImage.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument")); +var core_1 = require("../core"); +var utils_1 = require("../utils"); +/** + * Represents an image that has been embedded in a [[PDFDocument]]. + */ +var PDFImage = /** @class */ (function () { + function PDFImage(ref, doc, embedder) { + utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + utils_1.assertIs(embedder, 'embedder', [ + [core_1.JpegEmbedder, 'JpegEmbedder'], + [core_1.PngEmbedder, 'PngEmbedder'], + ]); + this.ref = ref; + this.doc = doc; + this.width = embedder.width; + this.height = embedder.height; + this.embedder = embedder; + } + /** + * Compute the width and height of this image after being scaled by the + * given `factor`. For example: + * ```js + * image.width // => 500 + * image.height // => 250 + * + * const scaled = image.scale(0.5) + * scaled.width // => 250 + * scaled.height // => 125 + * ``` + * This operation is often useful before drawing an image with + * [[PDFPage.drawImage]] to compute the `width` and `height` options. + * @param factor The factor by which this image should be scaled. + * @returns The width and height of the image after being scaled. + */ + PDFImage.prototype.scale = function (factor) { + utils_1.assertIs(factor, 'factor', ['number']); + return { width: this.width * factor, height: this.height * factor }; + }; + /** + * Get the width and height of this image after scaling it as large as + * possible while maintaining its aspect ratio and not exceeding the + * specified `width` and `height`. For example: + * ``` + * image.width // => 500 + * image.height // => 250 + * + * const scaled = image.scaleToFit(750, 1000) + * scaled.width // => 750 + * scaled.height // => 375 + * ``` + * The `width` and `height` parameters can also be thought of as the width + * and height of a box that the scaled image must fit within. + * @param width The bounding box's width. + * @param height The bounding box's height. + * @returns The width and height of the image after being scaled. + */ + PDFImage.prototype.scaleToFit = function (width, height) { + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var imgWidthScale = width / this.width; + var imgHeightScale = height / this.height; + var scale = Math.min(imgWidthScale, imgHeightScale); + return this.scale(scale); + }; + /** + * Get the width and height of this image. For example: + * ```js + * const { width, height } = image.size() + * ``` + * @returns The width and height of the image. + */ + PDFImage.prototype.size = function () { + return this.scale(1); + }; + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all images get embedded. + * + * Embed this image in its document. + * + * @returns Resolves when the embedding is complete. + */ + PDFImage.prototype.embed = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, doc, ref; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!this.embedder) + return [2 /*return*/]; + // The image should only be embedded once. If there's a pending embed + // operation then wait on it. Otherwise we need to start the embed. + if (!this.embedTask) { + _a = this, doc = _a.doc, ref = _a.ref; + this.embedTask = this.embedder.embedIntoContext(doc.context, ref); + } + return [4 /*yield*/, this.embedTask]; + case 1: + _b.sent(); + // We clear `this.embedder` so that the indirectly referenced image data + // can be garbage collected, thus avoiding a memory leak. + // See https://github.com/Hopding/pdf-lib/pull/1032/files. + this.embedder = undefined; + return [2 /*return*/]; + } + }); + }); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.embedPng]] and [[PDFDocument.embedJpg]] + * > methods, which will create instances of [[PDFImage]] for you. + * + * Create an instance of [[PDFImage]] from an existing ref and embedder + * + * @param ref The unique reference for this image. + * @param doc The document to which the image will belong. + * @param embedder The embedder that will be used to embed the image. + */ + PDFImage.of = function (ref, doc, embedder) { + return new PDFImage(ref, doc, embedder); + }; + return PDFImage; +}()); +exports.default = PDFImage; +//# sourceMappingURL=PDFImage.js.map \ No newline at end of file diff --git a/cjs/api/PDFImage.js.map b/cjs/api/PDFImage.js.map new file mode 100644 index 000000000..9284ad47a --- /dev/null +++ b/cjs/api/PDFImage.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFImage.js","sourceRoot":"","sources":["../../src/api/PDFImage.ts"],"names":[],"mappings":";;;AACA,sEAA8C;AAC9C,gCAA6D;AAC7D,kCAAqC;AAIrC;;GAEG;AACH;IA8BE,kBAAoB,GAAW,EAAE,GAAgB,EAAE,QAAuB;QACxE,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3C,gBAAQ,C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3B,CAAC;IAED;;;;;;OAMG;IACH,uBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACG,wBAAK,GAAX;;;;;;wBACE,IAAI,CAAC,IAAI,CAAC,QAAQ;4BAAE,sBAAO;wBAE3B,qEAAqE;wBACrE,mEAAmE;wBACnE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;4BACb,KAAe,IAAI,EAAjB,GAAG,SAAA,EAAE,GAAG,SAAA,CAAU;4BAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;yBACnE;wBACD,qBAAM,IAAI,CAAC,SAAS,EAAA;;wBAApB,SAAoB,CAAC;wBAErB,wEAAwE;wBACxE,yDAAyD;wBACzD,0DAA0D;wBAC1D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;;;;;KAC3B;IAlID;;;;;;;;;;OAUG;IACI,WAAE,GAAG,UAAC,GAAW,EAAE,GAAgB,EAAE,QAAuB;QACjE,OAAA,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC;IAAhC,CAAgC,CAAC;IAuHrC,eAAC;CAAA,AApID,IAoIC;kBApIoB,QAAQ"} \ No newline at end of file diff --git a/cjs/api/PDFJavaScript.d.ts b/cjs/api/PDFJavaScript.d.ts new file mode 100644 index 000000000..29adddf06 --- /dev/null +++ b/cjs/api/PDFJavaScript.d.ts @@ -0,0 +1,39 @@ +import Embeddable from "./Embeddable"; +import PDFDocument from "./PDFDocument"; +import JavaScriptEmbedder from "../core/embedders/JavaScriptEmbedder"; +import { PDFRef } from "../core"; +/** + * Represents JavaScript that has been embedded in a [[PDFDocument]]. + */ +export default class PDFJavaScript implements Embeddable { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addJavaScript]] method, which will + * create instances of [[PDFJavaScript]] for you. + * + * Create an instance of [[PDFJavaScript]] from an existing ref and script + * + * @param ref The unique reference for this script. + * @param doc The document to which the script will belong. + * @param embedder The embedder that will be used to embed the script. + */ + static of: (ref: PDFRef, doc: PDFDocument, embedder: JavaScriptEmbedder) => PDFJavaScript; + /** The unique reference assigned to this embedded script within the document. */ + readonly ref: PDFRef; + /** The document to which this embedded script belongs. */ + readonly doc: PDFDocument; + private alreadyEmbedded; + private readonly embedder; + private constructor(); + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all JavaScripts get embedded. + * + * Embed this JavaScript in its document. + * + * @returns Resolves when the embedding is complete. + */ + embed(): Promise; +} +//# sourceMappingURL=PDFJavaScript.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFJavaScript.d.ts.map b/cjs/api/PDFJavaScript.d.ts.map new file mode 100644 index 000000000..c5ab420c5 --- /dev/null +++ b/cjs/api/PDFJavaScript.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFJavaScript.d.ts","sourceRoot":"","sources":["../../src/api/PDFJavaScript.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,qBAA2B;AAC5C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,kBAAkB,6CAA8C;AACvE,OAAO,EAA4C,MAAM,EAAE,gBAAiB;AAE5E;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,UAAU;IACtD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,QAAS,MAAM,OAAO,WAAW,YAAY,kBAAkB,mBAChC;IAExC,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,OAAO;IAUP;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA8B7B"} \ No newline at end of file diff --git a/cjs/api/PDFJavaScript.js b/cjs/api/PDFJavaScript.js new file mode 100644 index 000000000..ed1d9d336 --- /dev/null +++ b/cjs/api/PDFJavaScript.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var core_1 = require("../core"); +/** + * Represents JavaScript that has been embedded in a [[PDFDocument]]. + */ +var PDFJavaScript = /** @class */ (function () { + function PDFJavaScript(ref, doc, embedder) { + this.alreadyEmbedded = false; + this.ref = ref; + this.doc = doc; + this.embedder = embedder; + } + /** + * > **NOTE:** You probably don't need to call this method directly. The + * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will + * > automatically ensure all JavaScripts get embedded. + * + * Embed this JavaScript in its document. + * + * @returns Resolves when the embedding is complete. + */ + PDFJavaScript.prototype.embed = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, catalog, context, ref, Names, Javascript, JSNames; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!!this.alreadyEmbedded) return [3 /*break*/, 2]; + _a = this.doc, catalog = _a.catalog, context = _a.context; + return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)]; + case 1: + ref = _b.sent(); + if (!catalog.has(core_1.PDFName.of('Names'))) { + catalog.set(core_1.PDFName.of('Names'), context.obj({})); + } + Names = catalog.lookup(core_1.PDFName.of('Names'), core_1.PDFDict); + if (!Names.has(core_1.PDFName.of('JavaScript'))) { + Names.set(core_1.PDFName.of('JavaScript'), context.obj({})); + } + Javascript = Names.lookup(core_1.PDFName.of('JavaScript'), core_1.PDFDict); + if (!Javascript.has(core_1.PDFName.of('Names'))) { + Javascript.set(core_1.PDFName.of('Names'), context.obj([])); + } + JSNames = Javascript.lookup(core_1.PDFName.of('Names'), core_1.PDFArray); + JSNames.push(core_1.PDFHexString.fromText(this.embedder.scriptName)); + JSNames.push(ref); + this.alreadyEmbedded = true; + _b.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addJavaScript]] method, which will + * create instances of [[PDFJavaScript]] for you. + * + * Create an instance of [[PDFJavaScript]] from an existing ref and script + * + * @param ref The unique reference for this script. + * @param doc The document to which the script will belong. + * @param embedder The embedder that will be used to embed the script. + */ + PDFJavaScript.of = function (ref, doc, embedder) { + return new PDFJavaScript(ref, doc, embedder); + }; + return PDFJavaScript; +}()); +exports.default = PDFJavaScript; +//# sourceMappingURL=PDFJavaScript.js.map \ No newline at end of file diff --git a/cjs/api/PDFJavaScript.js.map b/cjs/api/PDFJavaScript.js.map new file mode 100644 index 000000000..f44fa3e00 --- /dev/null +++ b/cjs/api/PDFJavaScript.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFJavaScript.js","sourceRoot":"","sources":["../../src/api/PDFJavaScript.ts"],"names":[],"mappings":";;;AAGA,gCAA4E;AAE5E;;GAEG;AACH;IAwBE,uBACE,GAAW,EACX,GAAgB,EAChB,QAA4B;QANtB,oBAAe,GAAG,KAAK,CAAC;QAQ9B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IACG,6BAAK,GAAX;;;;;;6BACM,CAAC,IAAI,CAAC,eAAe,EAArB,wBAAqB;wBACjB,KAAuB,IAAI,CAAC,GAAG,EAA7B,OAAO,aAAA,EAAE,OAAO,aAAA,CAAc;wBAE1B,qBAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAC9C,IAAI,CAAC,GAAG,CAAC,OAAO,EAChB,IAAI,CAAC,GAAG,CACT,EAAA;;wBAHK,GAAG,GAAG,SAGX;wBAED,IAAI,CAAC,OAAO,CAAC,GAAG,CA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OAAA,IAAI,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC;IAArC,CAAqC,CAAC;IA4D1C,oBAAC;CAAA,AAzED,IAyEC;kBAzEoB,aAAa"} \ No newline at end of file diff --git a/cjs/api/PDFPage.d.ts b/cjs/api/PDFPage.d.ts new file mode 100644 index 000000000..6c28ac986 --- /dev/null +++ b/cjs/api/PDFPage.d.ts @@ -0,0 +1,898 @@ +import { Color } from "./colors"; +import PDFDocument from "./PDFDocument"; +import PDFEmbeddedPage from "./PDFEmbeddedPage"; +import PDFFont from "./PDFFont"; +import PDFImage from "./PDFImage"; +import { PDFPageDrawCircleOptions, PDFPageDrawEllipseOptions, PDFPageDrawImageOptions, PDFPageDrawLineOptions, PDFPageDrawPageOptions, PDFPageDrawRectangleOptions, PDFPageDrawSquareOptions, PDFPageDrawSVGOptions, PDFPageDrawTextOptions } from "./PDFPageOptions"; +import { Rotation } from "./rotations"; +import { PDFOperator, PDFPageLeaf, PDFRef } from "../core"; +/** + * Represents a single page of a [[PDFDocument]]. + */ +export default class PDFPage { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]] + * > methods, which can create instances of [[PDFPage]] for you. + * + * Create an instance of [[PDFPage]] from an existing leaf node. + * + * @param leafNode The leaf node to be wrapped. + * @param ref The unique reference for the page. + * @param doc The document to which the page will belong. + */ + static of: (leafNode: PDFPageLeaf, ref: PDFRef, doc: PDFDocument) => PDFPage; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]] + * > methods, which can create instances of [[PDFPage]] for you. + * + * Create an instance of [[PDFPage]]. + * + * @param doc The document to which the page will belong. + */ + static create: (doc: PDFDocument) => PDFPage; + /** The low-level PDFDictionary wrapped by this page. */ + readonly node: PDFPageLeaf; + /** The unique reference assigned to this page within the document. */ + readonly ref: PDFRef; + /** The document to which this page belongs. */ + readonly doc: PDFDocument; + private fontKey?; + private font?; + private fontSize; + private fontColor; + private lineHeight; + private x; + private y; + private contentStream?; + private contentStreamRef?; + private constructor(); + /** + * Rotate this page by a multiple of 90 degrees. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * page.setRotation(degrees(-90)) + * page.setRotation(degrees(0)) + * page.setRotation(degrees(90)) + * page.setRotation(degrees(180)) + * page.setRotation(degrees(270)) + * ``` + * @param angle The angle to rotate this page. + */ + setRotation(angle: Rotation): void; + /** + * Get this page's rotation angle in degrees. For example: + * ```js + * const rotationAngle = page.getRotation().angle; + * ``` + * @returns The rotation angle of the page in degrees (always a multiple of + * 90 degrees). + */ + getRotation(): Rotation; + /** + * Resize this page by increasing or decreasing its width and height. For + * example: + * ```js + * page.setSize(250, 500) + * page.setSize(page.getWidth() + 50, page.getHeight() + 100) + * page.setSize(page.getWidth() - 50, page.getHeight() - 100) + * ``` + * + * Note that the PDF specification does not allow for pages to have explicit + * widths and heights. Instead it defines the "size" of a page in terms of + * five rectangles: the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. As a + * result, this method cannot directly change the width and height of a page. + * Instead, it works by adjusting these five boxes. + * + * This method performs the following steps: + * 1. Set width & height of MediaBox. + * 2. Set width & height of CropBox, if it has same dimensions as MediaBox. + * 3. Set width & height of BleedBox, if it has same dimensions as MediaBox. + * 4. Set width & height of TrimBox, if it has same dimensions as MediaBox. + * 5. Set width & height of ArtBox, if it has same dimensions as MediaBox. + * + * This approach works well for most PDF documents as all PDF pages must + * have a MediaBox, but relatively few have a CropBox, BleedBox, TrimBox, or + * ArtBox. And when they do have these additional boxes, they often have the + * same dimensions as the MediaBox. However, if you find this method does not + * work for your document, consider setting the boxes directly: + * * [[PDFPage.setMediaBox]] + * * [[PDFPage.setCropBox]] + * * [[PDFPage.setBleedBox]] + * * [[PDFPage.setTrimBox]] + * * [[PDFPage.setArtBox]] + * + * @param width The new width of the page. + * @param height The new height of the page. + */ + setSize(width: number, height: number): void; + /** + * Resize this page by increasing or decreasing its width. For example: + * ```js + * page.setWidth(250) + * page.setWidth(page.getWidth() + 50) + * page.setWidth(page.getWidth() - 50) + * ``` + * + * This method uses [[PDFPage.setSize]] to set the page's width. + * + * @param width The new width of the page. + */ + setWidth(width: number): void; + /** + * Resize this page by increasing or decreasing its height. For example: + * ```js + * page.setHeight(500) + * page.setHeight(page.getWidth() + 100) + * page.setHeight(page.getWidth() - 100) + * ``` + * + * This method uses [[PDFPage.setSize]] to set the page's height. + * + * @param height The new height of the page. + */ + setHeight(height: number): void; + /** + * Set the MediaBox of this page. For example: + * ```js + * const mediaBox = page.getMediaBox() + * + * page.setMediaBox(0, 0, 250, 500) + * page.setMediaBox(mediaBox.x, mediaBox.y, 50, 100) + * page.setMediaBox(15, 5, mediaBox.width - 50, mediaBox.height - 100) + * ``` + * + * See [[PDFPage.getMediaBox]] for details about what the MediaBox represents. + * + * @param x The x coordinate of the lower left corner of the new MediaBox. + * @param y The y coordinate of the lower left corner of the new MediaBox. + * @param width The width of the new MediaBox. + * @param height The height of the new MediaBox. + */ + setMediaBox(x: number, y: number, width: number, height: number): void; + /** + * Set the CropBox of this page. For example: + * ```js + * const cropBox = page.getCropBox() + * + * page.setCropBox(0, 0, 250, 500) + * page.setCropBox(cropBox.x, cropBox.y, 50, 100) + * page.setCropBox(15, 5, cropBox.width - 50, cropBox.height - 100) + * ``` + * + * See [[PDFPage.getCropBox]] for details about what the CropBox represents. + * + * @param x The x coordinate of the lower left corner of the new CropBox. + * @param y The y coordinate of the lower left corner of the new CropBox. + * @param width The width of the new CropBox. + * @param height The height of the new CropBox. + */ + setCropBox(x: number, y: number, width: number, height: number): void; + /** + * Set the BleedBox of this page. For example: + * ```js + * const bleedBox = page.getBleedBox() + * + * page.setBleedBox(0, 0, 250, 500) + * page.setBleedBox(bleedBox.x, bleedBox.y, 50, 100) + * page.setBleedBox(15, 5, bleedBox.width - 50, bleedBox.height - 100) + * ``` + * + * See [[PDFPage.getBleedBox]] for details about what the BleedBox represents. + * + * @param x The x coordinate of the lower left corner of the new BleedBox. + * @param y The y coordinate of the lower left corner of the new BleedBox. + * @param width The width of the new BleedBox. + * @param height The height of the new BleedBox. + */ + setBleedBox(x: number, y: number, width: number, height: number): void; + /** + * Set the TrimBox of this page. For example: + * ```js + * const trimBox = page.getTrimBox() + * + * page.setTrimBox(0, 0, 250, 500) + * page.setTrimBox(trimBox.x, trimBox.y, 50, 100) + * page.setTrimBox(15, 5, trimBox.width - 50, trimBox.height - 100) + * ``` + * + * See [[PDFPage.getTrimBox]] for details about what the TrimBox represents. + * + * @param x The x coordinate of the lower left corner of the new TrimBox. + * @param y The y coordinate of the lower left corner of the new TrimBox. + * @param width The width of the new TrimBox. + * @param height The height of the new TrimBox. + */ + setTrimBox(x: number, y: number, width: number, height: number): void; + /** + * Set the ArtBox of this page. For example: + * ```js + * const artBox = page.getArtBox() + * + * page.setArtBox(0, 0, 250, 500) + * page.setArtBox(artBox.x, artBox.y, 50, 100) + * page.setArtBox(15, 5, artBox.width - 50, artBox.height - 100) + * ``` + * + * See [[PDFPage.getArtBox]] for details about what the ArtBox represents. + * + * @param x The x coordinate of the lower left corner of the new ArtBox. + * @param y The y coordinate of the lower left corner of the new ArtBox. + * @param width The width of the new ArtBox. + * @param height The height of the new ArtBox. + */ + setArtBox(x: number, y: number, width: number, height: number): void; + /** + * Get this page's width and height. For example: + * ```js + * const { width, height } = page.getSize() + * ``` + * + * This method uses [[PDFPage.getMediaBox]] to obtain the page's + * width and height. + * + * @returns The width and height of the page. + */ + getSize(): { + width: number; + height: number; + }; + /** + * Get this page's width. For example: + * ```js + * const width = page.getWidth() + * ``` + * + * This method uses [[PDFPage.getSize]] to obtain the page's size. + * + * @returns The width of the page. + */ + getWidth(): number; + /** + * Get this page's height. For example: + * ```js + * const height = page.getHeight() + * ``` + * + * This method uses [[PDFPage.getSize]] to obtain the page's size. + * + * @returns The height of the page. + */ + getHeight(): number; + /** + * Get the rectangle defining this page's MediaBox. For example: + * ```js + * const { x, y, width, height } = page.getMediaBox() + * ``` + * + * The MediaBox of a page defines the boundaries of the physical medium on + * which the page is to be displayed/printed. It may include extended area + * surrounding the page content for bleed marks, printing marks, etc... + * It may also include areas close to the edges of the medium that cannot be + * marked because of physical limitations of the output device. Content + * falling outside this boundary may safely be discarded without affecting + * the meaning of the PDF file. + * + * @returns An object defining the lower left corner of the MediaBox and its + * width & height. + */ + getMediaBox(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Get the rectangle defining this page's CropBox. For example: + * ```js + * const { x, y, width, height } = page.getCropBox() + * ``` + * + * The CropBox of a page defines the region to which the contents of the page + * shall be clipped when displayed or printed. Unlike the other boxes, the + * CropBox does not necessarily represent the physical page geometry. It + * merely imposes clipping on the page contents. + * + * The CropBox's default value is the page's MediaBox. + * + * @returns An object defining the lower left corner of the CropBox and its + * width & height. + */ + getCropBox(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Get the rectangle defining this page's BleedBox. For example: + * ```js + * const { x, y, width, height } = page.getBleedBox() + * ``` + * + * The BleedBox of a page defines the region to which the contents of the + * page shall be clipped when output in a production environment. This may + * include any extra bleed area needed to accommodate the physical + * limitations of cutting, folding, and trimming equipment. The actual + * printed page may include printing marks that fall outside the BleedBox. + * + * The BleedBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the BleedBox and its + * width & height. + */ + getBleedBox(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Get the rectangle defining this page's TrimBox. For example: + * ```js + * const { x, y, width, height } = page.getTrimBox() + * ``` + * + * The TrimBox of a page defines the intended dimensions of the finished + * page after trimming. It may be smaller than the MediaBox to allow for + * production-related content, such as printing instructions, cut marks, or + * color bars. + * + * The TrimBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the TrimBox and its + * width & height. + */ + getTrimBox(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Get the rectangle defining this page's ArtBox. For example: + * ```js + * const { x, y, width, height } = page.getArtBox() + * ``` + * + * The ArtBox of a page defines the extent of the page's meaningful content + * (including potential white space). + * + * The ArtBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the ArtBox and its + * width & height. + */ + getArtBox(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Translate this page's content to a new location on the page. This operation + * is often useful after resizing the page with [[setSize]]. For example: + * ```js + * // Add 50 units of whitespace to the top and right of the page + * page.setSize(page.getWidth() + 50, page.getHeight() + 50) + * + * // Move the page's content from the lower-left corner of the page + * // to the top-right corner. + * page.translateContent(50, 50) + * + * // Now there are 50 units of whitespace to the left and bottom of the page + * ``` + * See also: [[resetPosition]] + * @param x The new position on the x-axis for this page's content. + * @param y The new position on the y-axis for this page's content. + */ + translateContent(x: number, y: number): void; + /** + * Scale the size, content, and annotations of a page. + * + * For example: + * ```js + * page.scale(0.5, 0.5); + * ``` + * + * @param x The factor by which the width for the page should be scaled + * (e.g. `0.5` is 50%). + * @param y The factor by which the height for the page should be scaled + * (e.g. `2.0` is 200%). + */ + scale(x: number, y: number): void; + /** + * Scale the content of a page. This is useful after resizing an existing + * page. This scales only the content, not the annotations. + * + * For example: + * ```js + * // Bisect the size of the page + * page.setSize(page.getWidth() / 2, page.getHeight() / 2); + * + * // Scale the content of the page down by 50% in x and y + * page.scaleContent(0.5, 0.5); + * ``` + * See also: [[scaleAnnotations]] + * @param x The factor by which the x-axis for the content should be scaled + * (e.g. `0.5` is 50%). + * @param y The factor by which the y-axis for the content should be scaled + * (e.g. `2.0` is 200%). + */ + scaleContent(x: number, y: number): void; + /** + * Scale the annotations of a page. This is useful if you want to scale a + * page with comments or other annotations. + * ```js + * // Scale the content of the page down by 50% in x and y + * page.scaleContent(0.5, 0.5); + * + * // Scale the content of the page down by 50% in x and y + * page.scaleAnnotations(0.5, 0.5); + * ``` + * See also: [[scaleContent]] + * @param x The factor by which the x-axis for the annotations should be + * scaled (e.g. `0.5` is 50%). + * @param y The factor by which the y-axis for the annotations should be + * scaled (e.g. `2.0` is 200%). + */ + scaleAnnotations(x: number, y: number): void; + /** + * Reset the x and y coordinates of this page to `(0, 0)`. This operation is + * often useful after calling [[translateContent]]. For example: + * ```js + * // Shift the page's contents up and to the right by 50 units + * page.translateContent(50, 50) + * + * // This text will shifted - it will be drawn at (50, 50) + * page.drawText('I am shifted') + * + * // Move back to (0, 0) + * page.resetPosition() + * + * // This text will not be shifted - it will be drawn at (0, 0) + * page.drawText('I am not shifted') + * ``` + */ + resetPosition(): void; + /** + * Choose a default font for this page. The default font will be used whenever + * text is drawn on this page and no font is specified. For example: + * ```js + * import { StandardFonts } from 'pdf-lib' + * + * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman) + * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const courierFont = await pdfDoc.embedFont(StandardFonts.Courier) + * + * const page = pdfDoc.addPage() + * + * page.setFont(helveticaFont) + * page.drawText('I will be drawn in Helvetica') + * + * page.setFont(timesRomanFont) + * page.drawText('I will be drawn in Courier', { font: courierFont }) + * ``` + * @param font The default font to be used when drawing text on this page. + */ + setFont(font: PDFFont): void; + /** + * Choose a default font size for this page. The default font size will be + * used whenever text is drawn on this page and no font size is specified. + * For example: + * ```js + * page.setFontSize(12) + * page.drawText('I will be drawn in size 12') + * + * page.setFontSize(36) + * page.drawText('I will be drawn in size 24', { fontSize: 24 }) + * ``` + * @param fontSize The default font size to be used when drawing text on this + * page. + */ + setFontSize(fontSize: number): void; + /** + * Choose a default font color for this page. The default font color will be + * used whenever text is drawn on this page and no font color is specified. + * For example: + * ```js + * import { rgb, cmyk, grayscale } from 'pdf-lib' + * + * page.setFontColor(rgb(0.97, 0.02, 0.97)) + * page.drawText('I will be drawn in pink') + * + * page.setFontColor(cmyk(0.4, 0.7, 0.39, 0.15)) + * page.drawText('I will be drawn in gray', { color: grayscale(0.5) }) + * ``` + * @param fontColor The default font color to be used when drawing text on + * this page. + */ + setFontColor(fontColor: Color): void; + /** + * Choose a default line height for this page. The default line height will be + * used whenever text is drawn on this page and no line height is specified. + * For example: + * ```js + * page.setLineHeight(12); + * page.drawText('These lines will be vertically \n separated by 12 units') + * + * page.setLineHeight(36); + * page.drawText('These lines will be vertically \n separated by 24 units', { + * lineHeight: 24 + * }) + * ``` + * @param lineHeight The default line height to be used when drawing text on + * this page. + */ + setLineHeight(lineHeight: number): void; + /** + * Get the default position of this page. For example: + * ```js + * const { x, y } = page.getPosition() + * ``` + * @returns The default position of the page. + */ + getPosition(): { + x: number; + y: number; + }; + /** + * Get the default x coordinate of this page. For example: + * ```js + * const x = page.getX() + * ``` + * @returns The default x coordinate of the page. + */ + getX(): number; + /** + * Get the default y coordinate of this page. For example: + * ```js + * const y = page.getY() + * ``` + * @returns The default y coordinate of the page. + */ + getY(): number; + /** + * Change the default position of this page. For example: + * ```js + * page.moveTo(0, 0) + * page.drawText('I will be drawn at the origin') + * + * page.moveTo(0, 25) + * page.drawText('I will be drawn 25 units up') + * + * page.moveTo(25, 25) + * page.drawText('I will be drawn 25 units up and 25 units to the right') + * ``` + * @param x The new default position on the x-axis for this page. + * @param y The new default position on the y-axis for this page. + */ + moveTo(x: number, y: number): void; + /** + * Change the default position of this page to be further down the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveDown(10) + * page.drawText('I will be drawn at (50, 40)') + * ``` + * @param yDecrease The amount by which the page's default position along the + * y-axis should be decreased. + */ + moveDown(yDecrease: number): void; + /** + * Change the default position of this page to be further up the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveUp(10) + * page.drawText('I will be drawn at (50, 60)') + * ``` + * @param yIncrease The amount by which the page's default position along the + * y-axis should be increased. + */ + moveUp(yIncrease: number): void; + /** + * Change the default position of this page to be further left on the x-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveLeft(10) + * page.drawText('I will be drawn at (40, 50)') + * ``` + * @param xDecrease The amount by which the page's default position along the + * x-axis should be decreased. + */ + moveLeft(xDecrease: number): void; + /** + * Change the default position of this page to be further right on the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveRight(10) + * page.drawText('I will be drawn at (60, 50)') + * ``` + * @param xIncrease The amount by which the page's default position along the + * x-axis should be increased. + */ + moveRight(xIncrease: number): void; + /** + * Push one or more operators to the end of this page's current content + * stream. For example: + * ```js + * import { + * pushGraphicsState, + * moveTo, + * lineTo, + * closePath, + * setFillingColor, + * rgb, + * fill, + * popGraphicsState, + * } from 'pdf-lib' + * + * // Draw a green triangle in the lower-left corner of the page + * page.pushOperators( + * pushGraphicsState(), + * moveTo(0, 0), + * lineTo(100, 0), + * lineTo(50, 100), + * closePath(), + * setFillingColor(rgb(0.0, 1.0, 0.0)), + * fill(), + * popGraphicsState(), + * ) + * ``` + * @param operator The operators to be pushed. + */ + pushOperators(...operator: PDFOperator[]): void; + /** + * Draw one or more lines of text on this page. For example: + * ```js + * import { StandardFonts, rgb } from 'pdf-lib' + * + * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman) + * + * const page = pdfDoc.addPage() + * + * page.setFont(helveticaFont) + * + * page.moveTo(5, 200) + * page.drawText('The Life of an Egg', { size: 36 }) + * + * page.moveDown(36) + * page.drawText('An Epic Tale of Woe', { size: 30 }) + * + * page.drawText( + * `Humpty Dumpty sat on a wall \n` + + * `Humpty Dumpty had a great fall; \n` + + * `All the king's horses and all the king's men \n` + + * `Couldn't put Humpty together again. \n`, + * { + * x: 25, + * y: 100, + * font: timesRomanFont, + * size: 24, + * color: rgb(1, 0, 0), + * lineHeight: 24, + * opacity: 0.75, + * }, + * ) + * ``` + * @param text The text to be drawn. + * @param options The options to be used when drawing the text. + */ + drawText(text: string, options?: PDFPageDrawTextOptions): void; + /** + * Draw an image on this page. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * const jpgUrl = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const jpgImageBytes = await fetch(jpgUrl).then((res) => res.arrayBuffer()) + * + * const jpgImage = await pdfDoc.embedJpg(jpgImageBytes) + * const jpgDims = jpgImage.scale(0.5) + * + * const page = pdfDoc.addPage() + * + * page.drawImage(jpgImage, { + * x: 25, + * y: 25, + * width: jpgDims.width, + * height: jpgDims.height, + * rotate: degrees(30), + * opacity: 0.75, + * }) + * ``` + * @param image The image to be drawn. + * @param options The options to be used when drawing the image. + */ + drawImage(image: PDFImage, options?: PDFPageDrawImageOptions): void; + /** + * Draw an embedded PDF page on this page. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const page = pdfDoc.addPage() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * + * // Embed page 74 from the PDF + * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, 73) + * + * page.drawPage(embeddedPage, { + * x: 250, + * y: 200, + * xScale: 0.5, + * yScale: 0.5, + * rotate: degrees(30), + * opacity: 0.75, + * }) + * ``` + * + * The `options` argument accepts both `width`/`height` and `xScale`/`yScale` + * as options. Since each of these options defines the size of the drawn page, + * if both options are given, `width` and `height` take precedence and the + * corresponding scale variants are ignored. + * + * @param embeddedPage The embedded page to be drawn. + * @param options The options to be used when drawing the embedded page. + */ + drawPage(embeddedPage: PDFEmbeddedPage, options?: PDFPageDrawPageOptions): void; + /** + * Draw an SVG path on this page. For example: + * ```js + * import { rgb } from 'pdf-lib' + * + * const svgPath = 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90' + * + * // Draw path as black line + * page.drawSvgPath(svgPath, { x: 25, y: 75 }) + * + * // Change border style and opacity + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 275, + * borderColor: rgb(0.5, 0.5, 0.5), + * borderWidth: 2, + * borderOpacity: 0.75, + * }) + * + * // Set fill color and opacity + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 475, + * color: rgb(1.0, 0, 0), + * opacity: 0.75, + * }) + * + * // Draw 50% of original size + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 675, + * scale: 0.5, + * }) + * ``` + * @param path The SVG path to be drawn. + * @param options The options to be used when drawing the SVG path. + */ + drawSvgPath(path: string, options?: PDFPageDrawSVGOptions): void; + /** + * Draw a line on this page. For example: + * ```js + * import { rgb } from 'pdf-lib' + * + * page.drawLine({ + * start: { x: 25, y: 75 }, + * end: { x: 125, y: 175 }, + * thickness: 2, + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the line. + */ + drawLine(options: PDFPageDrawLineOptions): void; + /** + * Draw a rectangle on this page. For example: + * ```js + * import { degrees, grayscale, rgb } from 'pdf-lib' + * + * page.drawRectangle({ + * x: 25, + * y: 75, + * width: 250, + * height: 75, + * rotate: degrees(-15), + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the rectangle. + */ + drawRectangle(options?: PDFPageDrawRectangleOptions): void; + /** + * Draw a square on this page. For example: + * ```js + * import { degrees, grayscale, rgb } from 'pdf-lib' + * + * page.drawSquare({ + * x: 25, + * y: 75, + * size: 100, + * rotate: degrees(-15), + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the square. + */ + drawSquare(options?: PDFPageDrawSquareOptions): void; + /** + * Draw an ellipse on this page. For example: + * ```js + * import { grayscale, rgb } from 'pdf-lib' + * + * page.drawEllipse({ + * x: 200, + * y: 75, + * xScale: 100, + * yScale: 50, + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the ellipse. + */ + drawEllipse(options?: PDFPageDrawEllipseOptions): void; + /** + * Draw a circle on this page. For example: + * ```js + * import { grayscale, rgb } from 'pdf-lib' + * + * page.drawCircle({ + * x: 200, + * y: 150, + * size: 100, + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the ellipse. + */ + drawCircle(options?: PDFPageDrawCircleOptions): void; + private setOrEmbedFont; + private getFont; + private resetFont; + private getContentStream; + private createContentStream; + private maybeEmbedGraphicsState; + private scaleAnnot; +} +//# sourceMappingURL=PDFPage.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFPage.d.ts.map b/cjs/api/PDFPage.d.ts.map new file mode 100644 index 000000000..cc9c4221d --- /dev/null +++ b/cjs/api/PDFPage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPage.d.ts","sourceRoot":"","sources":["../../src/api/PDFPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAO,iBAAuB;AAiB5C,OAAO,WAAW,sBAA4B;AAC9C,OAAO,eAAe,0BAAgC;AACtD,OAAO,OAAO,kBAAwB;AACtC,OAAO,QAAQ,mBAAyB;AACxC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EAEvB,yBAA+B;AAChC,OAAO,EAAW,QAAQ,EAAa,oBAA0B;AAEjE,OAAO,EAIL,WAAW,EACX,WAAW,EACX,MAAM,EAGP,gBAAiB;AAclB;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,aAAc,WAAW,OAAO,MAAM,OAAO,WAAW,aAC/B;IAElC;;;;;;;;OAQG;I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,wBAA6B,GAAG,IAAI;IAMxD;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,OAAO,GAAE,yBAA8B,GAAG,IAAI;IA2D1D;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,OAAO,GAAE,wBAA6B,GAAG,IAAI;IAMxD,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,UAAU;CAenB"} \ No newline at end of file diff --git a/cjs/api/PDFPage.js b/cjs/api/PDFPage.js new file mode 100644 index 000000000..ffd224d57 --- /dev/null +++ b/cjs/api/PDFPage.js @@ -0,0 +1,1442 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var colors_1 = require("./colors"); +var operations_1 = require("./operations"); +var operators_1 = require("./operators"); +var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument")); +var PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage")); +var PDFFont_1 = tslib_1.__importDefault(require("./PDFFont")); +var PDFImage_1 = tslib_1.__importDefault(require("./PDFImage")); +var PDFPageOptions_1 = require("./PDFPageOptions"); +var rotations_1 = require("./rotations"); +var StandardFonts_1 = require("./StandardFonts"); +var core_1 = require("../core"); +var utils_1 = require("../utils"); +/** + * Represents a single page of a [[PDFDocument]]. + */ +var PDFPage = /** @class */ (function () { + function PDFPage(leafNode, ref, doc) { + this.fontSize = 24; + this.fontColor = colors_1.rgb(0, 0, 0); + this.lineHeight = 24; + this.x = 0; + this.y = 0; + utils_1.assertIs(leafNode, 'leafNode', [[core_1.PDFPageLeaf, 'PDFPageLeaf']]); + utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + this.node = leafNode; + this.ref = ref; + this.doc = doc; + } + /** + * Rotate this page by a multiple of 90 degrees. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * page.setRotation(degrees(-90)) + * page.setRotation(degrees(0)) + * page.setRotation(degrees(90)) + * page.setRotation(degrees(180)) + * page.setRotation(degrees(270)) + * ``` + * @param angle The angle to rotate this page. + */ + PDFPage.prototype.setRotation = function (angle) { + var degreesAngle = rotations_1.toDegrees(angle); + utils_1.assertMultiple(degreesAngle, 'degreesAngle', 90); + this.node.set(core_1.PDFName.of('Rotate'), this.doc.context.obj(degreesAngle)); + }; + /** + * Get this page's rotation angle in degrees. For example: + * ```js + * const rotationAngle = page.getRotation().angle; + * ``` + * @returns The rotation angle of the page in degrees (always a multiple of + * 90 degrees). + */ + PDFPage.prototype.getRotation = function () { + var Rotate = this.node.Rotate(); + return rotations_1.degrees(Rotate ? Rotate.asNumber() : 0); + }; + /** + * Resize this page by increasing or decreasing its width and height. For + * example: + * ```js + * page.setSize(250, 500) + * page.setSize(page.getWidth() + 50, page.getHeight() + 100) + * page.setSize(page.getWidth() - 50, page.getHeight() - 100) + * ``` + * + * Note that the PDF specification does not allow for pages to have explicit + * widths and heights. Instead it defines the "size" of a page in terms of + * five rectangles: the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. As a + * result, this method cannot directly change the width and height of a page. + * Instead, it works by adjusting these five boxes. + * + * This method performs the following steps: + * 1. Set width & height of MediaBox. + * 2. Set width & height of CropBox, if it has same dimensions as MediaBox. + * 3. Set width & height of BleedBox, if it has same dimensions as MediaBox. + * 4. Set width & height of TrimBox, if it has same dimensions as MediaBox. + * 5. Set width & height of ArtBox, if it has same dimensions as MediaBox. + * + * This approach works well for most PDF documents as all PDF pages must + * have a MediaBox, but relatively few have a CropBox, BleedBox, TrimBox, or + * ArtBox. And when they do have these additional boxes, they often have the + * same dimensions as the MediaBox. However, if you find this method does not + * work for your document, consider setting the boxes directly: + * * [[PDFPage.setMediaBox]] + * * [[PDFPage.setCropBox]] + * * [[PDFPage.setBleedBox]] + * * [[PDFPage.setTrimBox]] + * * [[PDFPage.setArtBox]] + * + * @param width The new width of the page. + * @param height The new height of the page. + */ + PDFPage.prototype.setSize = function (width, height) { + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var mediaBox = this.getMediaBox(); + this.setMediaBox(mediaBox.x, mediaBox.y, width, height); + var cropBox = this.getCropBox(); + var bleedBox = this.getBleedBox(); + var trimBox = this.getTrimBox(); + var artBox = this.getArtBox(); + var hasCropBox = this.node.CropBox(); + var hasBleedBox = this.node.BleedBox(); + var hasTrimBox = this.node.TrimBox(); + var hasArtBox = this.node.ArtBox(); + if (hasCropBox && utils_1.rectanglesAreEqual(cropBox, mediaBox)) { + this.setCropBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasBleedBox && utils_1.rectanglesAreEqual(bleedBox, mediaBox)) { + this.setBleedBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasTrimBox && utils_1.rectanglesAreEqual(trimBox, mediaBox)) { + this.setTrimBox(mediaBox.x, mediaBox.y, width, height); + } + if (hasArtBox && utils_1.rectanglesAreEqual(artBox, mediaBox)) { + this.setArtBox(mediaBox.x, mediaBox.y, width, height); + } + }; + /** + * Resize this page by increasing or decreasing its width. For example: + * ```js + * page.setWidth(250) + * page.setWidth(page.getWidth() + 50) + * page.setWidth(page.getWidth() - 50) + * ``` + * + * This method uses [[PDFPage.setSize]] to set the page's width. + * + * @param width The new width of the page. + */ + PDFPage.prototype.setWidth = function (width) { + utils_1.assertIs(width, 'width', ['number']); + this.setSize(width, this.getSize().height); + }; + /** + * Resize this page by increasing or decreasing its height. For example: + * ```js + * page.setHeight(500) + * page.setHeight(page.getWidth() + 100) + * page.setHeight(page.getWidth() - 100) + * ``` + * + * This method uses [[PDFPage.setSize]] to set the page's height. + * + * @param height The new height of the page. + */ + PDFPage.prototype.setHeight = function (height) { + utils_1.assertIs(height, 'height', ['number']); + this.setSize(this.getSize().width, height); + }; + /** + * Set the MediaBox of this page. For example: + * ```js + * const mediaBox = page.getMediaBox() + * + * page.setMediaBox(0, 0, 250, 500) + * page.setMediaBox(mediaBox.x, mediaBox.y, 50, 100) + * page.setMediaBox(15, 5, mediaBox.width - 50, mediaBox.height - 100) + * ``` + * + * See [[PDFPage.getMediaBox]] for details about what the MediaBox represents. + * + * @param x The x coordinate of the lower left corner of the new MediaBox. + * @param y The y coordinate of the lower left corner of the new MediaBox. + * @param width The width of the new MediaBox. + * @param height The height of the new MediaBox. + */ + PDFPage.prototype.setMediaBox = function (x, y, width, height) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var mediaBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(core_1.PDFName.MediaBox, mediaBox); + }; + /** + * Set the CropBox of this page. For example: + * ```js + * const cropBox = page.getCropBox() + * + * page.setCropBox(0, 0, 250, 500) + * page.setCropBox(cropBox.x, cropBox.y, 50, 100) + * page.setCropBox(15, 5, cropBox.width - 50, cropBox.height - 100) + * ``` + * + * See [[PDFPage.getCropBox]] for details about what the CropBox represents. + * + * @param x The x coordinate of the lower left corner of the new CropBox. + * @param y The y coordinate of the lower left corner of the new CropBox. + * @param width The width of the new CropBox. + * @param height The height of the new CropBox. + */ + PDFPage.prototype.setCropBox = function (x, y, width, height) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var cropBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(core_1.PDFName.CropBox, cropBox); + }; + /** + * Set the BleedBox of this page. For example: + * ```js + * const bleedBox = page.getBleedBox() + * + * page.setBleedBox(0, 0, 250, 500) + * page.setBleedBox(bleedBox.x, bleedBox.y, 50, 100) + * page.setBleedBox(15, 5, bleedBox.width - 50, bleedBox.height - 100) + * ``` + * + * See [[PDFPage.getBleedBox]] for details about what the BleedBox represents. + * + * @param x The x coordinate of the lower left corner of the new BleedBox. + * @param y The y coordinate of the lower left corner of the new BleedBox. + * @param width The width of the new BleedBox. + * @param height The height of the new BleedBox. + */ + PDFPage.prototype.setBleedBox = function (x, y, width, height) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var bleedBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(core_1.PDFName.BleedBox, bleedBox); + }; + /** + * Set the TrimBox of this page. For example: + * ```js + * const trimBox = page.getTrimBox() + * + * page.setTrimBox(0, 0, 250, 500) + * page.setTrimBox(trimBox.x, trimBox.y, 50, 100) + * page.setTrimBox(15, 5, trimBox.width - 50, trimBox.height - 100) + * ``` + * + * See [[PDFPage.getTrimBox]] for details about what the TrimBox represents. + * + * @param x The x coordinate of the lower left corner of the new TrimBox. + * @param y The y coordinate of the lower left corner of the new TrimBox. + * @param width The width of the new TrimBox. + * @param height The height of the new TrimBox. + */ + PDFPage.prototype.setTrimBox = function (x, y, width, height) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var trimBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(core_1.PDFName.TrimBox, trimBox); + }; + /** + * Set the ArtBox of this page. For example: + * ```js + * const artBox = page.getArtBox() + * + * page.setArtBox(0, 0, 250, 500) + * page.setArtBox(artBox.x, artBox.y, 50, 100) + * page.setArtBox(15, 5, artBox.width - 50, artBox.height - 100) + * ``` + * + * See [[PDFPage.getArtBox]] for details about what the ArtBox represents. + * + * @param x The x coordinate of the lower left corner of the new ArtBox. + * @param y The y coordinate of the lower left corner of the new ArtBox. + * @param width The width of the new ArtBox. + * @param height The height of the new ArtBox. + */ + PDFPage.prototype.setArtBox = function (x, y, width, height) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + utils_1.assertIs(width, 'width', ['number']); + utils_1.assertIs(height, 'height', ['number']); + var artBox = this.doc.context.obj([x, y, x + width, y + height]); + this.node.set(core_1.PDFName.ArtBox, artBox); + }; + /** + * Get this page's width and height. For example: + * ```js + * const { width, height } = page.getSize() + * ``` + * + * This method uses [[PDFPage.getMediaBox]] to obtain the page's + * width and height. + * + * @returns The width and height of the page. + */ + PDFPage.prototype.getSize = function () { + var _a = this.getMediaBox(), width = _a.width, height = _a.height; + return { width: width, height: height }; + }; + /** + * Get this page's width. For example: + * ```js + * const width = page.getWidth() + * ``` + * + * This method uses [[PDFPage.getSize]] to obtain the page's size. + * + * @returns The width of the page. + */ + PDFPage.prototype.getWidth = function () { + return this.getSize().width; + }; + /** + * Get this page's height. For example: + * ```js + * const height = page.getHeight() + * ``` + * + * This method uses [[PDFPage.getSize]] to obtain the page's size. + * + * @returns The height of the page. + */ + PDFPage.prototype.getHeight = function () { + return this.getSize().height; + }; + /** + * Get the rectangle defining this page's MediaBox. For example: + * ```js + * const { x, y, width, height } = page.getMediaBox() + * ``` + * + * The MediaBox of a page defines the boundaries of the physical medium on + * which the page is to be displayed/printed. It may include extended area + * surrounding the page content for bleed marks, printing marks, etc... + * It may also include areas close to the edges of the medium that cannot be + * marked because of physical limitations of the output device. Content + * falling outside this boundary may safely be discarded without affecting + * the meaning of the PDF file. + * + * @returns An object defining the lower left corner of the MediaBox and its + * width & height. + */ + PDFPage.prototype.getMediaBox = function () { + var mediaBox = this.node.MediaBox(); + return mediaBox.asRectangle(); + }; + /** + * Get the rectangle defining this page's CropBox. For example: + * ```js + * const { x, y, width, height } = page.getCropBox() + * ``` + * + * The CropBox of a page defines the region to which the contents of the page + * shall be clipped when displayed or printed. Unlike the other boxes, the + * CropBox does not necessarily represent the physical page geometry. It + * merely imposes clipping on the page contents. + * + * The CropBox's default value is the page's MediaBox. + * + * @returns An object defining the lower left corner of the CropBox and its + * width & height. + */ + PDFPage.prototype.getCropBox = function () { + var _a; + var cropBox = this.node.CropBox(); + return (_a = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getMediaBox(); + }; + /** + * Get the rectangle defining this page's BleedBox. For example: + * ```js + * const { x, y, width, height } = page.getBleedBox() + * ``` + * + * The BleedBox of a page defines the region to which the contents of the + * page shall be clipped when output in a production environment. This may + * include any extra bleed area needed to accommodate the physical + * limitations of cutting, folding, and trimming equipment. The actual + * printed page may include printing marks that fall outside the BleedBox. + * + * The BleedBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the BleedBox and its + * width & height. + */ + PDFPage.prototype.getBleedBox = function () { + var _a; + var bleedBox = this.node.BleedBox(); + return (_a = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox(); + }; + /** + * Get the rectangle defining this page's TrimBox. For example: + * ```js + * const { x, y, width, height } = page.getTrimBox() + * ``` + * + * The TrimBox of a page defines the intended dimensions of the finished + * page after trimming. It may be smaller than the MediaBox to allow for + * production-related content, such as printing instructions, cut marks, or + * color bars. + * + * The TrimBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the TrimBox and its + * width & height. + */ + PDFPage.prototype.getTrimBox = function () { + var _a; + var trimBox = this.node.TrimBox(); + return (_a = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox(); + }; + /** + * Get the rectangle defining this page's ArtBox. For example: + * ```js + * const { x, y, width, height } = page.getArtBox() + * ``` + * + * The ArtBox of a page defines the extent of the page's meaningful content + * (including potential white space). + * + * The ArtBox's default value is the page's CropBox. + * + * @returns An object defining the lower left corner of the ArtBox and its + * width & height. + */ + PDFPage.prototype.getArtBox = function () { + var _a; + var artBox = this.node.ArtBox(); + return (_a = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox(); + }; + /** + * Translate this page's content to a new location on the page. This operation + * is often useful after resizing the page with [[setSize]]. For example: + * ```js + * // Add 50 units of whitespace to the top and right of the page + * page.setSize(page.getWidth() + 50, page.getHeight() + 50) + * + * // Move the page's content from the lower-left corner of the page + * // to the top-right corner. + * page.translateContent(50, 50) + * + * // Now there are 50 units of whitespace to the left and bottom of the page + * ``` + * See also: [[resetPosition]] + * @param x The new position on the x-axis for this page's content. + * @param y The new position on the y-axis for this page's content. + */ + PDFPage.prototype.translateContent = function (x, y) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + this.node.normalize(); + this.getContentStream(); + var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.translate(x, y)); + var startRef = this.doc.context.register(start); + var end = this.createContentStream(operators_1.popGraphicsState()); + var endRef = this.doc.context.register(end); + this.node.wrapContentStreams(startRef, endRef); + }; + /** + * Scale the size, content, and annotations of a page. + * + * For example: + * ```js + * page.scale(0.5, 0.5); + * ``` + * + * @param x The factor by which the width for the page should be scaled + * (e.g. `0.5` is 50%). + * @param y The factor by which the height for the page should be scaled + * (e.g. `2.0` is 200%). + */ + PDFPage.prototype.scale = function (x, y) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + this.setSize(this.getWidth() * x, this.getHeight() * y); + this.scaleContent(x, y); + this.scaleAnnotations(x, y); + }; + /** + * Scale the content of a page. This is useful after resizing an existing + * page. This scales only the content, not the annotations. + * + * For example: + * ```js + * // Bisect the size of the page + * page.setSize(page.getWidth() / 2, page.getHeight() / 2); + * + * // Scale the content of the page down by 50% in x and y + * page.scaleContent(0.5, 0.5); + * ``` + * See also: [[scaleAnnotations]] + * @param x The factor by which the x-axis for the content should be scaled + * (e.g. `0.5` is 50%). + * @param y The factor by which the y-axis for the content should be scaled + * (e.g. `2.0` is 200%). + */ + PDFPage.prototype.scaleContent = function (x, y) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + this.node.normalize(); + this.getContentStream(); + var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.scale(x, y)); + var startRef = this.doc.context.register(start); + var end = this.createContentStream(operators_1.popGraphicsState()); + var endRef = this.doc.context.register(end); + this.node.wrapContentStreams(startRef, endRef); + }; + /** + * Scale the annotations of a page. This is useful if you want to scale a + * page with comments or other annotations. + * ```js + * // Scale the content of the page down by 50% in x and y + * page.scaleContent(0.5, 0.5); + * + * // Scale the content of the page down by 50% in x and y + * page.scaleAnnotations(0.5, 0.5); + * ``` + * See also: [[scaleContent]] + * @param x The factor by which the x-axis for the annotations should be + * scaled (e.g. `0.5` is 50%). + * @param y The factor by which the y-axis for the annotations should be + * scaled (e.g. `2.0` is 200%). + */ + PDFPage.prototype.scaleAnnotations = function (x, y) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + var annots = this.node.Annots(); + if (!annots) + return; + for (var idx = 0; idx < annots.size(); idx++) { + var annot = annots.lookup(idx); + if (annot instanceof core_1.PDFDict) + this.scaleAnnot(annot, x, y); + } + }; + /** + * Reset the x and y coordinates of this page to `(0, 0)`. This operation is + * often useful after calling [[translateContent]]. For example: + * ```js + * // Shift the page's contents up and to the right by 50 units + * page.translateContent(50, 50) + * + * // This text will shifted - it will be drawn at (50, 50) + * page.drawText('I am shifted') + * + * // Move back to (0, 0) + * page.resetPosition() + * + * // This text will not be shifted - it will be drawn at (0, 0) + * page.drawText('I am not shifted') + * ``` + */ + PDFPage.prototype.resetPosition = function () { + this.getContentStream(false); + this.x = 0; + this.y = 0; + }; + /** + * Choose a default font for this page. The default font will be used whenever + * text is drawn on this page and no font is specified. For example: + * ```js + * import { StandardFonts } from 'pdf-lib' + * + * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman) + * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const courierFont = await pdfDoc.embedFont(StandardFonts.Courier) + * + * const page = pdfDoc.addPage() + * + * page.setFont(helveticaFont) + * page.drawText('I will be drawn in Helvetica') + * + * page.setFont(timesRomanFont) + * page.drawText('I will be drawn in Courier', { font: courierFont }) + * ``` + * @param font The default font to be used when drawing text on this page. + */ + PDFPage.prototype.setFont = function (font) { + // TODO: Reuse image Font name if we've already added this image to Resources.Fonts + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + this.font = font; + this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref); + }; + /** + * Choose a default font size for this page. The default font size will be + * used whenever text is drawn on this page and no font size is specified. + * For example: + * ```js + * page.setFontSize(12) + * page.drawText('I will be drawn in size 12') + * + * page.setFontSize(36) + * page.drawText('I will be drawn in size 24', { fontSize: 24 }) + * ``` + * @param fontSize The default font size to be used when drawing text on this + * page. + */ + PDFPage.prototype.setFontSize = function (fontSize) { + utils_1.assertIs(fontSize, 'fontSize', ['number']); + this.fontSize = fontSize; + }; + /** + * Choose a default font color for this page. The default font color will be + * used whenever text is drawn on this page and no font color is specified. + * For example: + * ```js + * import { rgb, cmyk, grayscale } from 'pdf-lib' + * + * page.setFontColor(rgb(0.97, 0.02, 0.97)) + * page.drawText('I will be drawn in pink') + * + * page.setFontColor(cmyk(0.4, 0.7, 0.39, 0.15)) + * page.drawText('I will be drawn in gray', { color: grayscale(0.5) }) + * ``` + * @param fontColor The default font color to be used when drawing text on + * this page. + */ + PDFPage.prototype.setFontColor = function (fontColor) { + utils_1.assertIs(fontColor, 'fontColor', [[Object, 'Color']]); + this.fontColor = fontColor; + }; + /** + * Choose a default line height for this page. The default line height will be + * used whenever text is drawn on this page and no line height is specified. + * For example: + * ```js + * page.setLineHeight(12); + * page.drawText('These lines will be vertically \n separated by 12 units') + * + * page.setLineHeight(36); + * page.drawText('These lines will be vertically \n separated by 24 units', { + * lineHeight: 24 + * }) + * ``` + * @param lineHeight The default line height to be used when drawing text on + * this page. + */ + PDFPage.prototype.setLineHeight = function (lineHeight) { + utils_1.assertIs(lineHeight, 'lineHeight', ['number']); + this.lineHeight = lineHeight; + }; + /** + * Get the default position of this page. For example: + * ```js + * const { x, y } = page.getPosition() + * ``` + * @returns The default position of the page. + */ + PDFPage.prototype.getPosition = function () { + return { x: this.x, y: this.y }; + }; + /** + * Get the default x coordinate of this page. For example: + * ```js + * const x = page.getX() + * ``` + * @returns The default x coordinate of the page. + */ + PDFPage.prototype.getX = function () { + return this.x; + }; + /** + * Get the default y coordinate of this page. For example: + * ```js + * const y = page.getY() + * ``` + * @returns The default y coordinate of the page. + */ + PDFPage.prototype.getY = function () { + return this.y; + }; + /** + * Change the default position of this page. For example: + * ```js + * page.moveTo(0, 0) + * page.drawText('I will be drawn at the origin') + * + * page.moveTo(0, 25) + * page.drawText('I will be drawn 25 units up') + * + * page.moveTo(25, 25) + * page.drawText('I will be drawn 25 units up and 25 units to the right') + * ``` + * @param x The new default position on the x-axis for this page. + * @param y The new default position on the y-axis for this page. + */ + PDFPage.prototype.moveTo = function (x, y) { + utils_1.assertIs(x, 'x', ['number']); + utils_1.assertIs(y, 'y', ['number']); + this.x = x; + this.y = y; + }; + /** + * Change the default position of this page to be further down the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveDown(10) + * page.drawText('I will be drawn at (50, 40)') + * ``` + * @param yDecrease The amount by which the page's default position along the + * y-axis should be decreased. + */ + PDFPage.prototype.moveDown = function (yDecrease) { + utils_1.assertIs(yDecrease, 'yDecrease', ['number']); + this.y -= yDecrease; + }; + /** + * Change the default position of this page to be further up the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveUp(10) + * page.drawText('I will be drawn at (50, 60)') + * ``` + * @param yIncrease The amount by which the page's default position along the + * y-axis should be increased. + */ + PDFPage.prototype.moveUp = function (yIncrease) { + utils_1.assertIs(yIncrease, 'yIncrease', ['number']); + this.y += yIncrease; + }; + /** + * Change the default position of this page to be further left on the x-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveLeft(10) + * page.drawText('I will be drawn at (40, 50)') + * ``` + * @param xDecrease The amount by which the page's default position along the + * x-axis should be decreased. + */ + PDFPage.prototype.moveLeft = function (xDecrease) { + utils_1.assertIs(xDecrease, 'xDecrease', ['number']); + this.x -= xDecrease; + }; + /** + * Change the default position of this page to be further right on the y-axis. + * For example: + * ```js + * page.moveTo(50, 50) + * page.drawText('I will be drawn at (50, 50)') + * + * page.moveRight(10) + * page.drawText('I will be drawn at (60, 50)') + * ``` + * @param xIncrease The amount by which the page's default position along the + * x-axis should be increased. + */ + PDFPage.prototype.moveRight = function (xIncrease) { + utils_1.assertIs(xIncrease, 'xIncrease', ['number']); + this.x += xIncrease; + }; + /** + * Push one or more operators to the end of this page's current content + * stream. For example: + * ```js + * import { + * pushGraphicsState, + * moveTo, + * lineTo, + * closePath, + * setFillingColor, + * rgb, + * fill, + * popGraphicsState, + * } from 'pdf-lib' + * + * // Draw a green triangle in the lower-left corner of the page + * page.pushOperators( + * pushGraphicsState(), + * moveTo(0, 0), + * lineTo(100, 0), + * lineTo(50, 100), + * closePath(), + * setFillingColor(rgb(0.0, 1.0, 0.0)), + * fill(), + * popGraphicsState(), + * ) + * ``` + * @param operator The operators to be pushed. + */ + PDFPage.prototype.pushOperators = function () { + var operator = []; + for (var _i = 0; _i < arguments.length; _i++) { + operator[_i] = arguments[_i]; + } + utils_1.assertEachIs(operator, 'operator', [[core_1.PDFOperator, 'PDFOperator']]); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operator); + }; + /** + * Draw one or more lines of text on this page. For example: + * ```js + * import { StandardFonts, rgb } from 'pdf-lib' + * + * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman) + * + * const page = pdfDoc.addPage() + * + * page.setFont(helveticaFont) + * + * page.moveTo(5, 200) + * page.drawText('The Life of an Egg', { size: 36 }) + * + * page.moveDown(36) + * page.drawText('An Epic Tale of Woe', { size: 30 }) + * + * page.drawText( + * `Humpty Dumpty sat on a wall \n` + + * `Humpty Dumpty had a great fall; \n` + + * `All the king's horses and all the king's men \n` + + * `Couldn't put Humpty together again. \n`, + * { + * x: 25, + * y: 100, + * font: timesRomanFont, + * size: 24, + * color: rgb(1, 0, 0), + * lineHeight: 24, + * opacity: 0.75, + * }, + * ) + * ``` + * @param text The text to be drawn. + * @param options The options to be used when drawing the text. + */ + PDFPage.prototype.drawText = function (text, options) { + var _a, _b, _c, _d, _e, _f, _g; + if (options === void 0) { options = {}; } + utils_1.assertIs(text, 'text', ['string']); + utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertOrUndefined(options.font, 'options.font', [[PDFFont_1.default, 'PDFFont']]); + utils_1.assertOrUndefined(options.size, 'options.size', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.lineHeight, 'options.lineHeight', ['number']); + utils_1.assertOrUndefined(options.maxWidth, 'options.maxWidth', ['number']); + utils_1.assertOrUndefined(options.wordBreaks, 'options.wordBreaks', [Array]); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var _h = this.setOrEmbedFont(options.font), oldFont = _h.oldFont, newFont = _h.newFont, newFontKey = _h.newFontKey; + var fontSize = options.size || this.fontSize; + var wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks; + var textWidth = function (t) { return newFont.widthOfTextAtSize(t, fontSize); }; + var lines = options.maxWidth === undefined + ? utils_1.lineSplit(utils_1.cleanText(text)) + : utils_1.breakTextIntoLines(text, wordBreaks, options.maxWidth, textWidth); + var encodedLines = new Array(lines.length); + for (var idx = 0, len = lines.length; idx < len; idx++) { + encodedLines[idx] = newFont.encodeText(lines[idx]); + } + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode, + }); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawLinesOfText(encodedLines, { + color: (_a = options.color) !== null && _a !== void 0 ? _a : this.fontColor, + font: newFontKey, + size: fontSize, + rotate: (_b = options.rotate) !== null && _b !== void 0 ? _b : rotations_1.degrees(0), + xSkew: (_c = options.xSkew) !== null && _c !== void 0 ? _c : rotations_1.degrees(0), + ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0), + x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x, + y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y, + lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight, + graphicsState: graphicsStateKey, + })); + if (options.font) { + if (oldFont) + this.setFont(oldFont); + else + this.resetFont(); + } + }; + /** + * Draw an image on this page. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * const jpgUrl = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg' + * const jpgImageBytes = await fetch(jpgUrl).then((res) => res.arrayBuffer()) + * + * const jpgImage = await pdfDoc.embedJpg(jpgImageBytes) + * const jpgDims = jpgImage.scale(0.5) + * + * const page = pdfDoc.addPage() + * + * page.drawImage(jpgImage, { + * x: 25, + * y: 25, + * width: jpgDims.width, + * height: jpgDims.height, + * rotate: degrees(30), + * opacity: 0.75, + * }) + * ``` + * @param image The image to be drawn. + * @param options The options to be used when drawing the image. + */ + PDFPage.prototype.drawImage = function (image, options) { + var _a, _b, _c, _d, _e, _f, _g; + if (options === void 0) { options = {}; } + // TODO: Reuse image XObject name if we've already added this image to Resources.XObjects + utils_1.assertIs(image, 'image', [[PDFImage_1.default, 'PDFImage']]); + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.width, 'options.width', ['number']); + utils_1.assertOrUndefined(options.height, 'options.height', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var xObjectKey = this.node.newXObject('Image', image.ref); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode, + }); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawImage(xObjectKey, { + x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x, + y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y, + width: (_c = options.width) !== null && _c !== void 0 ? _c : image.size().width, + height: (_d = options.height) !== null && _d !== void 0 ? _d : image.size().height, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0), + xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0), + graphicsState: graphicsStateKey, + })); + }; + /** + * Draw an embedded PDF page on this page. For example: + * ```js + * import { degrees } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const page = pdfDoc.addPage() + * + * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf' + * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer()) + * + * // Embed page 74 from the PDF + * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, 73) + * + * page.drawPage(embeddedPage, { + * x: 250, + * y: 200, + * xScale: 0.5, + * yScale: 0.5, + * rotate: degrees(30), + * opacity: 0.75, + * }) + * ``` + * + * The `options` argument accepts both `width`/`height` and `xScale`/`yScale` + * as options. Since each of these options defines the size of the drawn page, + * if both options are given, `width` and `height` take precedence and the + * corresponding scale variants are ignored. + * + * @param embeddedPage The embedded page to be drawn. + * @param options The options to be used when drawing the embedded page. + */ + PDFPage.prototype.drawPage = function (embeddedPage, options) { + var _a, _b, _c, _d, _e; + if (options === void 0) { options = {}; } + // TODO: Reuse embeddedPage XObject name if we've already added this embeddedPage to Resources.XObjects + utils_1.assertIs(embeddedPage, 'embeddedPage', [ + [PDFEmbeddedPage_1.default, 'PDFEmbeddedPage'], + ]); + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']); + utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']); + utils_1.assertOrUndefined(options.width, 'options.width', ['number']); + utils_1.assertOrUndefined(options.height, 'options.height', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var xObjectKey = this.node.newXObject('EmbeddedPdfPage', embeddedPage.ref); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + blendMode: options.blendMode, + }); + // prettier-ignore + var xScale = (options.width !== undefined ? options.width / embeddedPage.width + : options.xScale !== undefined ? options.xScale + : 1); + // prettier-ignore + var yScale = (options.height !== undefined ? options.height / embeddedPage.height + : options.yScale !== undefined ? options.yScale + : 1); + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawPage(xObjectKey, { + x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x, + y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y, + xScale: xScale, + yScale: yScale, + rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0), + xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0), + ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : rotations_1.degrees(0), + graphicsState: graphicsStateKey, + })); + }; + /** + * Draw an SVG path on this page. For example: + * ```js + * import { rgb } from 'pdf-lib' + * + * const svgPath = 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90' + * + * // Draw path as black line + * page.drawSvgPath(svgPath, { x: 25, y: 75 }) + * + * // Change border style and opacity + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 275, + * borderColor: rgb(0.5, 0.5, 0.5), + * borderWidth: 2, + * borderOpacity: 0.75, + * }) + * + * // Set fill color and opacity + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 475, + * color: rgb(1.0, 0, 0), + * opacity: 0.75, + * }) + * + * // Draw 50% of original size + * page.drawSvgPath(svgPath, { + * x: 25, + * y: 675, + * scale: 0.5, + * }) + * ``` + * @param path The SVG path to be drawn. + * @param options The options to be used when drawing the SVG path. + */ + PDFPage.prototype.drawSvgPath = function (path, options) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + if (options === void 0) { options = {}; } + utils_1.assertIs(path, 'path', ['string']); + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.scale, 'options.scale', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']); + utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [ + [Object, 'Color'], + ]); + utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [ + Array, + ]); + utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [ + 'number', + ]); + utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle); + utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode, + }); + if (!('color' in options) && !('borderColor' in options)) { + options.borderColor = colors_1.rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawSvgPath(path, { + x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x, + y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y, + scale: options.scale, + rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0), + color: (_d = options.color) !== null && _d !== void 0 ? _d : undefined, + borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : undefined, + borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0, + borderDashArray: (_g = options.borderDashArray) !== null && _g !== void 0 ? _g : undefined, + borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : undefined, + borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : undefined, + graphicsState: graphicsStateKey, + })); + }; + /** + * Draw a line on this page. For example: + * ```js + * import { rgb } from 'pdf-lib' + * + * page.drawLine({ + * start: { x: 25, y: 75 }, + * end: { x: 125, y: 175 }, + * thickness: 2, + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the line. + */ + PDFPage.prototype.drawLine = function (options) { + var _a, _b, _c, _d, _e; + utils_1.assertIs(options.start, 'options.start', [ + [Object, '{ x: number, y: number }'], + ]); + utils_1.assertIs(options.end, 'options.end', [ + [Object, '{ x: number, y: number }'], + ]); + utils_1.assertIs(options.start.x, 'options.start.x', ['number']); + utils_1.assertIs(options.start.y, 'options.start.y', ['number']); + utils_1.assertIs(options.end.x, 'options.end.x', ['number']); + utils_1.assertIs(options.end.y, 'options.end.y', ['number']); + utils_1.assertOrUndefined(options.thickness, 'options.thickness', ['number']); + utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]); + utils_1.assertOrUndefined(options.dashArray, 'options.dashArray', [Array]); + utils_1.assertOrUndefined(options.dashPhase, 'options.dashPhase', ['number']); + utils_1.assertIsOneOfOrUndefined(options.lineCap, 'options.lineCap', operators_1.LineCapStyle); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + borderOpacity: options.opacity, + blendMode: options.blendMode, + }); + if (!('color' in options)) { + options.color = colors_1.rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawLine({ + start: options.start, + end: options.end, + thickness: (_a = options.thickness) !== null && _a !== void 0 ? _a : 1, + color: (_b = options.color) !== null && _b !== void 0 ? _b : undefined, + dashArray: (_c = options.dashArray) !== null && _c !== void 0 ? _c : undefined, + dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : undefined, + lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : undefined, + graphicsState: graphicsStateKey, + })); + }; + /** + * Draw a rectangle on this page. For example: + * ```js + * import { degrees, grayscale, rgb } from 'pdf-lib' + * + * page.drawRectangle({ + * x: 25, + * y: 75, + * width: 250, + * height: 75, + * rotate: degrees(-15), + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the rectangle. + */ + PDFPage.prototype.drawRectangle = function (options) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; + if (options === void 0) { options = {}; } + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.width, 'options.width', ['number']); + utils_1.assertOrUndefined(options.height, 'options.height', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']); + utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [ + [Object, 'Color'], + ]); + utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [ + Array, + ]); + utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [ + 'number', + ]); + utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle); + utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode, + }); + if (!('color' in options) && !('borderColor' in options)) { + options.color = colors_1.rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawRectangle({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x, + y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y, + width: (_c = options.width) !== null && _c !== void 0 ? _c : 150, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 100, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0), + xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0), + borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0, + color: (_j = options.color) !== null && _j !== void 0 ? _j : undefined, + borderColor: (_k = options.borderColor) !== null && _k !== void 0 ? _k : undefined, + borderDashArray: (_l = options.borderDashArray) !== null && _l !== void 0 ? _l : undefined, + borderDashPhase: (_m = options.borderDashPhase) !== null && _m !== void 0 ? _m : undefined, + graphicsState: graphicsStateKey, + borderLineCap: (_o = options.borderLineCap) !== null && _o !== void 0 ? _o : undefined, + })); + }; + /** + * Draw a square on this page. For example: + * ```js + * import { degrees, grayscale, rgb } from 'pdf-lib' + * + * page.drawSquare({ + * x: 25, + * y: 75, + * size: 100, + * rotate: degrees(-15), + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the square. + */ + PDFPage.prototype.drawSquare = function (options) { + if (options === void 0) { options = {}; } + var size = options.size; + utils_1.assertOrUndefined(size, 'size', ['number']); + this.drawRectangle(tslib_1.__assign(tslib_1.__assign({}, options), { width: size, height: size })); + }; + /** + * Draw an ellipse on this page. For example: + * ```js + * import { grayscale, rgb } from 'pdf-lib' + * + * page.drawEllipse({ + * x: 200, + * y: 75, + * xScale: 100, + * yScale: 50, + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the ellipse. + */ + PDFPage.prototype.drawEllipse = function (options) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; + if (options === void 0) { options = {}; } + utils_1.assertOrUndefined(options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']); + utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']); + utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]); + utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]); + utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1); + utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [ + [Object, 'Color'], + ]); + utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1); + utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']); + utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [ + Array, + ]); + utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [ + 'number', + ]); + utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle); + utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode); + var graphicsStateKey = this.maybeEmbedGraphicsState({ + opacity: options.opacity, + borderOpacity: options.borderOpacity, + blendMode: options.blendMode, + }); + if (!('color' in options) && !('borderColor' in options)) { + options.color = colors_1.rgb(0, 0, 0); + } + var contentStream = this.getContentStream(); + contentStream.push.apply(contentStream, operations_1.drawEllipse({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x, + y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y, + xScale: (_c = options.xScale) !== null && _c !== void 0 ? _c : 100, + yScale: (_d = options.yScale) !== null && _d !== void 0 ? _d : 100, + rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : undefined, + color: (_f = options.color) !== null && _f !== void 0 ? _f : undefined, + borderColor: (_g = options.borderColor) !== null && _g !== void 0 ? _g : undefined, + borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0, + borderDashArray: (_j = options.borderDashArray) !== null && _j !== void 0 ? _j : undefined, + borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : undefined, + borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : undefined, + graphicsState: graphicsStateKey, + })); + }; + /** + * Draw a circle on this page. For example: + * ```js + * import { grayscale, rgb } from 'pdf-lib' + * + * page.drawCircle({ + * x: 200, + * y: 150, + * size: 100, + * borderWidth: 5, + * borderColor: grayscale(0.5), + * color: rgb(0.75, 0.2, 0.2), + * opacity: 0.5, + * borderOpacity: 0.75, + * }) + * ``` + * @param options The options to be used when drawing the ellipse. + */ + PDFPage.prototype.drawCircle = function (options) { + if (options === void 0) { options = {}; } + var _a = options.size, size = _a === void 0 ? 100 : _a; + utils_1.assertOrUndefined(size, 'size', ['number']); + this.drawEllipse(tslib_1.__assign(tslib_1.__assign({}, options), { xScale: size, yScale: size })); + }; + PDFPage.prototype.setOrEmbedFont = function (font) { + var oldFont = this.font; + var oldFontKey = this.fontKey; + if (font) + this.setFont(font); + else + this.getFont(); + var newFont = this.font; + var newFontKey = this.fontKey; + return { oldFont: oldFont, oldFontKey: oldFontKey, newFont: newFont, newFontKey: newFontKey }; + }; + PDFPage.prototype.getFont = function () { + if (!this.font || !this.fontKey) { + var font = this.doc.embedStandardFont(StandardFonts_1.StandardFonts.Helvetica); + this.setFont(font); + } + return [this.font, this.fontKey]; + }; + PDFPage.prototype.resetFont = function () { + this.font = undefined; + this.fontKey = undefined; + }; + PDFPage.prototype.getContentStream = function (useExisting) { + if (useExisting === void 0) { useExisting = true; } + if (useExisting && this.contentStream) + return this.contentStream; + this.contentStream = this.createContentStream(); + this.contentStreamRef = this.doc.context.register(this.contentStream); + this.node.addContentStream(this.contentStreamRef); + return this.contentStream; + }; + PDFPage.prototype.createContentStream = function () { + var operators = []; + for (var _i = 0; _i < arguments.length; _i++) { + operators[_i] = arguments[_i]; + } + var dict = this.doc.context.obj({}); + var contentStream = core_1.PDFContentStream.of(dict, operators); + return contentStream; + }; + PDFPage.prototype.maybeEmbedGraphicsState = function (options) { + var opacity = options.opacity, borderOpacity = options.borderOpacity, blendMode = options.blendMode; + if (opacity === undefined && + borderOpacity === undefined && + blendMode === undefined) { + return undefined; + } + var graphicsState = this.doc.context.obj({ + Type: 'ExtGState', + ca: opacity, + CA: borderOpacity, + BM: blendMode, + }); + var key = this.node.newExtGState('GS', graphicsState); + return key; + }; + PDFPage.prototype.scaleAnnot = function (annot, x, y) { + var selectors = ['RD', 'CL', 'Vertices', 'QuadPoints', 'L', 'Rect']; + for (var idx = 0, len = selectors.length; idx < len; idx++) { + var list = annot.lookup(core_1.PDFName.of(selectors[idx])); + if (list instanceof core_1.PDFArray) + list.scalePDFNumbers(x, y); + } + var inkLists = annot.lookup(core_1.PDFName.of('InkList')); + if (inkLists instanceof core_1.PDFArray) { + for (var idx = 0, len = inkLists.size(); idx < len; idx++) { + var arr = inkLists.lookup(idx); + if (arr instanceof core_1.PDFArray) + arr.scalePDFNumbers(x, y); + } + } + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]] + * > methods, which can create instances of [[PDFPage]] for you. + * + * Create an instance of [[PDFPage]] from an existing leaf node. + * + * @param leafNode The leaf node to be wrapped. + * @param ref The unique reference for the page. + * @param doc The document to which the page will belong. + */ + PDFPage.of = function (leafNode, ref, doc) { + return new PDFPage(leafNode, ref, doc); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]] + * > methods, which can create instances of [[PDFPage]] for you. + * + * Create an instance of [[PDFPage]]. + * + * @param doc The document to which the page will belong. + */ + PDFPage.create = function (doc) { + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + var dummyRef = core_1.PDFRef.of(-1); + var pageLeaf = core_1.PDFPageLeaf.withContextAndParent(doc.context, dummyRef); + var pageRef = doc.context.register(pageLeaf); + return new PDFPage(pageLeaf, pageRef, doc); + }; + return PDFPage; +}()); +exports.default = PDFPage; +//# sourceMappingURL=PDFPage.js.map \ No newline at end of file diff --git a/cjs/api/PDFPage.js.map b/cjs/api/PDFPage.js.map new file mode 100644 index 000000000..5e6087a00 --- /dev/null +++ b/cjs/api/PDFPage.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPage.js","sourceRoot":"","sources":["../../src/api/PDFPage.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAC5C,2CAQ4B;AAC5B,yCAM2B;AAC3B,sEAA8C;AAC9C,8EAAsD;AACtD,8DAAsC;AACtC,gEAAwC;AACxC,mDAWgC;AAChC,yCAAiE;AACjE,iDAAsD;AACtD,gCASkB;AAClB,kCAWmB;AAEnB;;GAEG;AACH;IAmDE,iBAAoB,QAAqB,EAAE,GAAW,EAAE,GAAgB;QARhE,aAAQ,GAAG,EAAE,CAAC;QACd,cAAS,GAAG,YAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAC;QAClC,eAAU,GAAG,EAAE,CAAC;QAChB,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QAKZ,gBAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,kBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC/D,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3C,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,qBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;;;;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AAC,IAAI,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBACzD,IAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjC,IAAI,GAAG,YAAY,eAAQ;oBAAE,GAAG,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACxD;SACF;IACH,CAAC;IArhDD;;;;;;;;;;OAUG;IACI,UAAE,GAAG,UAAC,QAAqB,EAAE,GAAW,EAAE,GAAgB;QAC/D,OAAA,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC;IAA/B,CAA+B,CAAC;IAElC;;;;;;;;OAQG;IACI,cAAM,GAAG,UAAC,GAAgB;QAC/B,gBAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,qBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACrD,IAAM,QAAQ,GAAG,aAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAM,QAAQ,GAAG,kBAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzE,IAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/C,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC;IAy/CJ,cAAC;CAAA,AAvhDD,IAuhDC;kBAvhDoB,OAAO"} \ No newline at end of file diff --git a/cjs/api/PDFPageOptions.d.ts b/cjs/api/PDFPageOptions.d.ts new file mode 100644 index 000000000..20a6543b2 --- /dev/null +++ b/cjs/api/PDFPageOptions.d.ts @@ -0,0 +1,155 @@ +import { Color } from "./colors"; +import PDFFont from "./PDFFont"; +import { Rotation } from "./rotations"; +import { LineCapStyle } from "./operators"; +export declare enum BlendMode { + Normal = "Normal", + Multiply = "Multiply", + Screen = "Screen", + Overlay = "Overlay", + Darken = "Darken", + Lighten = "Lighten", + ColorDodge = "ColorDodge", + ColorBurn = "ColorBurn", + HardLight = "HardLight", + SoftLight = "SoftLight", + Difference = "Difference", + Exclusion = "Exclusion" +} +export interface PDFPageDrawTextOptions { + color?: Color; + opacity?: number; + blendMode?: BlendMode; + font?: PDFFont; + size?: number; + rotate?: Rotation; + xSkew?: Rotation; + ySkew?: Rotation; + x?: number; + y?: number; + lineHeight?: number; + maxWidth?: number; + wordBreaks?: string[]; +} +export interface PDFPageDrawImageOptions { + x?: number; + y?: number; + width?: number; + height?: number; + rotate?: Rotation; + xSkew?: Rotation; + ySkew?: Rotation; + opacity?: number; + blendMode?: BlendMode; +} +export interface PDFPageDrawPageOptions { + x?: number; + y?: number; + xScale?: number; + yScale?: number; + width?: number; + height?: number; + rotate?: Rotation; + xSkew?: Rotation; + ySkew?: Rotation; + opacity?: number; + blendMode?: BlendMode; +} +export interface PDFPageDrawSVGOptions { + x?: number; + y?: number; + scale?: number; + rotate?: Rotation; + borderWidth?: number; + color?: Color; + opacity?: number; + borderColor?: Color; + borderOpacity?: number; + borderDashArray?: number[]; + borderDashPhase?: number; + borderLineCap?: LineCapStyle; + blendMode?: BlendMode; +} +export interface PDFPageDrawLineOptions { + start: { + x: number; + y: number; + }; + end: { + x: number; + y: number; + }; + thickness?: number; + color?: Color; + opacity?: number; + lineCap?: LineCapStyle; + dashArray?: number[]; + dashPhase?: number; + blendMode?: BlendMode; +} +export interface PDFPageDrawRectangleOptions { + x?: number; + y?: number; + width?: number; + height?: number; + rotate?: Rotation; + xSkew?: Rotation; + ySkew?: Rotation; + borderWidth?: number; + color?: Color; + opacity?: number; + borderColor?: Color; + borderOpacity?: number; + borderDashArray?: number[]; + borderDashPhase?: number; + borderLineCap?: LineCapStyle; + blendMode?: BlendMode; +} +export interface PDFPageDrawSquareOptions { + x?: number; + y?: number; + size?: number; + rotate?: Rotation; + xSkew?: Rotation; + ySkew?: Rotation; + borderWidth?: number; + color?: Color; + opacity?: number; + borderColor?: Color; + borderOpacity?: number; + borderDashArray?: number[]; + borderDashPhase?: number; + borderLineCap?: LineCapStyle; + blendMode?: BlendMode; +} +export interface PDFPageDrawEllipseOptions { + x?: number; + y?: number; + xScale?: number; + yScale?: number; + rotate?: Rotation; + color?: Color; + opacity?: number; + borderColor?: Color; + borderOpacity?: number; + borderWidth?: number; + borderDashArray?: number[]; + borderDashPhase?: number; + borderLineCap?: LineCapStyle; + blendMode?: BlendMode; +} +export interface PDFPageDrawCircleOptions { + x?: number; + y?: number; + size?: number; + color?: Color; + opacity?: number; + borderColor?: Color; + borderOpacity?: number; + borderWidth?: number; + borderDashArray?: number[]; + borderDashPhase?: number; + borderLineCap?: LineCapStyle; + blendMode?: BlendMode; +} +//# sourceMappingURL=PDFPageOptions.d.ts.map \ No newline at end of file diff --git a/cjs/api/PDFPageOptions.d.ts.map b/cjs/api/PDFPageOptions.d.ts.map new file mode 100644 index 000000000..b5f27ee00 --- /dev/null +++ b/cjs/api/PDFPageOptions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageOptions.d.ts","sourceRoot":"","sources":["../../src/api/PDFPageOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAuB;AACvC,OAAO,OAAO,kBAAwB;AACtC,OAAO,EAAE,QAAQ,EAAE,oBAA0B;AAC7C,OAAO,EAAE,YAAY,EAAE,oBAA0B;AAEjD,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAA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a,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACvC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"} \ No newline at end of file diff --git a/cjs/api/PDFPageOptions.js b/cjs/api/PDFPageOptions.js new file mode 100644 index 000000000..d5330a53c --- /dev/null +++ b/cjs/api/PDFPageOptions.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BlendMode = void 0; +var BlendMode; +(function (BlendMode) { + BlendMode["Normal"] = "Normal"; + BlendMode["Multiply"] = "Multiply"; + BlendMode["Screen"] = "Screen"; + BlendMode["Overlay"] = "Overlay"; + BlendMode["Darken"] = "Darken"; + BlendMode["Lighten"] = "Lighten"; + BlendMode["ColorDodge"] = "ColorDodge"; + BlendMode["ColorBurn"] = "ColorBurn"; + BlendMode["HardLight"] = "HardLight"; + BlendMode["SoftLight"] = "SoftLight"; + BlendMode["Difference"] = "Difference"; + BlendMode["Exclusion"] = "Exclusion"; +})(BlendMode = exports.BlendMode || (exports.BlendMode = {})); +//# sourceMappingURL=PDFPageOptions.js.map \ No newline at end of file diff --git a/cjs/api/PDFPageOptions.js.map b/cjs/api/PDFPageOptions.js.map new file mode 100644 index 000000000..7b3855608 --- /dev/null +++ b/cjs/api/PDFPageOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageOptions.js","sourceRoot":"","sources":["../../src/api/PDFPageOptions.ts"],"names":[],"mappings":";;;AAKA,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,gCAAmB,CAAA;IACnB,8BAAiB,CAAA;IACjB,gCAAmB,CAAA;IACnB,sCAAyB,CAAA;IACzB,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,sCAAyB,CAAA;IACzB,oCAAuB,CAAA;AACzB,CAAC,EAbW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAapB"} \ No newline at end of file diff --git a/cjs/api/StandardFonts.d.ts b/cjs/api/StandardFonts.d.ts new file mode 100644 index 000000000..bf894ee1f --- /dev/null +++ b/cjs/api/StandardFonts.d.ts @@ -0,0 +1,17 @@ +export declare enum StandardFonts { + Courier = "Courier", + CourierBold = "Courier-Bold", + CourierOblique = "Courier-Oblique", + CourierBoldOblique = "Courier-BoldOblique", + Helvetica = "Helvetica", + HelveticaBold = "Helvetica-Bold", + HelveticaOblique = "Helvetica-Oblique", + HelveticaBoldOblique = "Helvetica-BoldOblique", + TimesRoman = "Times-Roman", + TimesRomanBold = "Times-Bold", + TimesRomanItalic = "Times-Italic", + TimesRomanBoldItalic = "Times-BoldItalic", + Symbol = "Symbol", + ZapfDingbats = "ZapfDingbats" +} +//# sourceMappingURL=StandardFonts.d.ts.map \ No newline at end of file diff --git a/cjs/api/StandardFonts.d.ts.map b/cjs/api/StandardFonts.d.ts.map new file mode 100644 index 000000000..754027509 --- /dev/null +++ b/cjs/api/StandardFonts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"StandardFonts.d.ts","sourceRoot":"","sources":["../../src/api/StandardFonts.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,WAAW,iBAAiB;IAC5B,cAAc,oBAAoB;IAClC,kBAAkB,wBAAwB;IAC1C,SAAS,cAAc;IACvB,aAAa,mBAAmB;IAChC,gBAAgB,sBAAsB;IACtC,oBAAoB,0BAA0B;IAC9C,UAAU,gBAAgB;IAC1B,cAAc,eAAe;IAC7B,gBAAgB,iBAAiB;IACjC,oBAAoB,qBAAqB;IACzC,MAAM,WAAW;IACjB,YAAY,iBAAiB;CAC9B"} \ No newline at end of file diff --git a/cjs/api/StandardFonts.js b/cjs/api/StandardFonts.js new file mode 100644 index 000000000..1415a5fb4 --- /dev/null +++ b/cjs/api/StandardFonts.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StandardFonts = void 0; +var StandardFonts; +(function (StandardFonts) { + StandardFonts["Courier"] = "Courier"; + StandardFonts["CourierBold"] = "Courier-Bold"; + StandardFonts["CourierOblique"] = "Courier-Oblique"; + StandardFonts["CourierBoldOblique"] = "Courier-BoldOblique"; + StandardFonts["Helvetica"] = "Helvetica"; + StandardFonts["HelveticaBold"] = "Helvetica-Bold"; + StandardFonts["HelveticaOblique"] = "Helvetica-Oblique"; + StandardFonts["HelveticaBoldOblique"] = "Helvetica-BoldOblique"; + StandardFonts["TimesRoman"] = "Times-Roman"; + StandardFonts["TimesRomanBold"] = "Times-Bold"; + StandardFonts["TimesRomanItalic"] = "Times-Italic"; + StandardFonts["TimesRomanBoldItalic"] = "Times-BoldItalic"; + StandardFonts["Symbol"] = "Symbol"; + StandardFonts["ZapfDingbats"] = "ZapfDingbats"; +})(StandardFonts = exports.StandardFonts || (exports.StandardFonts = {})); +//# sourceMappingURL=StandardFonts.js.map \ No newline at end of file diff --git a/cjs/api/StandardFonts.js.map b/cjs/api/StandardFonts.js.map new file mode 100644 index 000000000..e03753302 --- /dev/null +++ b/cjs/api/StandardFonts.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StandardFonts.js","sourceRoot":"","sources":["../../src/api/StandardFonts.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAeX;AAfD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,6CAA4B,CAAA;IAC5B,mDAAkC,CAAA;IAClC,2DAA0C,CAAA;IAC1C,wCAAuB,CAAA;IACvB,iDAAgC,CAAA;IAChC,uDAAsC,CAAA;IACtC,+DAA8C,CAAA;IAC9C,2CAA0B,CAAA;IAC1B,8CAA6B,CAAA;IAC7B,kDAAiC,CAAA;IACjC,0DAAyC,CAAA;IACzC,kCAAiB,CAAA;IACjB,8CAA6B,CAAA;AAC/B,CAAC,EAfW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAexB"} \ No newline at end of file diff --git a/cjs/api/colors.d.ts b/cjs/api/colors.d.ts new file mode 100644 index 000000000..024fdbbf7 --- /dev/null +++ b/cjs/api/colors.d.ts @@ -0,0 +1,31 @@ +export declare enum ColorTypes { + Grayscale = "Grayscale", + RGB = "RGB", + CMYK = "CMYK" +} +export interface Grayscale { + type: ColorTypes.Grayscale; + gray: number; +} +export interface RGB { + type: ColorTypes.RGB; + red: number; + green: number; + blue: number; +} +export interface CMYK { + type: ColorTypes.CMYK; + cyan: number; + magenta: number; + yellow: number; + key: number; +} +export declare type Color = Grayscale | RGB | CMYK; +export declare const grayscale: (gray: number) => Grayscale; +export declare const rgb: (red: number, green: number, blue: number) => RGB; +export declare const cmyk: (cyan: number, magenta: number, yellow: number, key: number) => CMYK; +export declare const setFillingColor: (color: Color) => import("../core/operators/PDFOperator").default; +export declare const setStrokingColor: (color: Color) => import("../core/operators/PDFOperator").default; +export declare const componentsToColor: (comps?: number[] | undefined, scale?: number) => Grayscale | RGB | CMYK | undefined; +export declare const colorToComponents: (color: Color) => number[]; +//# sourceMappingURL=colors.d.ts.map \ No newline at end of file diff --git a/cjs/api/colors.d.ts.map b/cjs/api/colors.d.ts.map new file mode 100644 index 000000000..816740f83 --- /dev/null +++ b/cjs/api/colors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/api/colors.ts"],"names":[],"mappings":"AAUA,oBAAY,UAAU;IACpB,SAAS,cAAc;IACvB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,KAAK,GAAG,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC;AAE3C,eAAO,MAAM,SAAS,SAAU,MAAM,cAGrC,CAAC;AAEF,eAAO,MAAM,GAAG,QAAS,MAAM,SAAS,MAAM,QAAQ,MAAM,QAK3D,CAAC;AAEF,eAAO,MAAM,IAAI,SACT,MAAM,WACH,MAAM,UACP,MAAM,OACT,MAAM,SAOZ,CAAC;AAKF,eAAO,MAAM,eAAe,UAAW,KAAK,oDAIQ,CAAC;AAGrD,eAAO,MAAM,gBAAgB,UAAW,KAAK,oDAIO,CAAC;AAGrD,eAAO,MAAM,iBAAiB,sFAgB7B,CAAC;AAGF,eAAO,MAAM,iBAAiB,UAAW,KAAK,aAIM,CAAC"} \ No newline at end of file diff --git a/cjs/api/colors.js b/cjs/api/colors.js new file mode 100644 index 000000000..5ed96f7b9 --- /dev/null +++ b/cjs/api/colors.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.colorToComponents = exports.componentsToColor = exports.setStrokingColor = exports.setFillingColor = exports.cmyk = exports.rgb = exports.grayscale = exports.ColorTypes = void 0; +var operators_1 = require("./operators"); +var utils_1 = require("../utils"); +var ColorTypes; +(function (ColorTypes) { + ColorTypes["Grayscale"] = "Grayscale"; + ColorTypes["RGB"] = "RGB"; + ColorTypes["CMYK"] = "CMYK"; +})(ColorTypes = exports.ColorTypes || (exports.ColorTypes = {})); +exports.grayscale = function (gray) { + utils_1.assertRange(gray, 'gray', 0.0, 1.0); + return { type: ColorTypes.Grayscale, gray: gray }; +}; +exports.rgb = function (red, green, blue) { + utils_1.assertRange(red, 'red', 0, 1); + utils_1.assertRange(green, 'green', 0, 1); + utils_1.assertRange(blue, 'blue', 0, 1); + return { type: ColorTypes.RGB, red: red, green: green, blue: blue }; +}; +exports.cmyk = function (cyan, magenta, yellow, key) { + utils_1.assertRange(cyan, 'cyan', 0, 1); + utils_1.assertRange(magenta, 'magenta', 0, 1); + utils_1.assertRange(yellow, 'yellow', 0, 1); + utils_1.assertRange(key, 'key', 0, 1); + return { type: ColorTypes.CMYK, cyan: cyan, magenta: magenta, yellow: yellow, key: key }; +}; +var Grayscale = ColorTypes.Grayscale, RGB = ColorTypes.RGB, CMYK = ColorTypes.CMYK; +// prettier-ignore +exports.setFillingColor = function (color) { + return color.type === Grayscale ? operators_1.setFillingGrayscaleColor(color.gray) + : color.type === RGB ? operators_1.setFillingRgbColor(color.red, color.green, color.blue) + : color.type === CMYK ? operators_1.setFillingCmykColor(color.cyan, color.magenta, color.yellow, color.key) + : utils_1.error("Invalid color: " + JSON.stringify(color)); +}; +// prettier-ignore +exports.setStrokingColor = function (color) { + return color.type === Grayscale ? operators_1.setStrokingGrayscaleColor(color.gray) + : color.type === RGB ? operators_1.setStrokingRgbColor(color.red, color.green, color.blue) + : color.type === CMYK ? operators_1.setStrokingCmykColor(color.cyan, color.magenta, color.yellow, color.key) + : utils_1.error("Invalid color: " + JSON.stringify(color)); +}; +// prettier-ignore +exports.componentsToColor = function (comps, scale) { + if (scale === void 0) { scale = 1; } + return ((comps === null || comps === void 0 ? void 0 : comps.length) === 1 ? exports.grayscale(comps[0] * scale) + : (comps === null || comps === void 0 ? void 0 : comps.length) === 3 ? exports.rgb(comps[0] * scale, comps[1] * scale, comps[2] * scale) + : (comps === null || comps === void 0 ? void 0 : comps.length) === 4 ? exports.cmyk(comps[0] * scale, comps[1] * scale, comps[2] * scale, comps[3] * scale) + : undefined); +}; +// prettier-ignore +exports.colorToComponents = function (color) { + return color.type === Grayscale ? [color.gray] + : color.type === RGB ? [color.red, color.green, color.blue] + : color.type === CMYK ? [color.cyan, color.magenta, color.yellow, color.key] + : utils_1.error("Invalid color: " + JSON.stringify(color)); +}; +//# sourceMappingURL=colors.js.map \ No newline at end of file diff --git a/cjs/api/colors.js.map b/cjs/api/colors.js.map new file mode 100644 index 000000000..8ab8b648a --- /dev/null +++ b/cjs/api/colors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/api/colors.ts"],"names":[],"mappings":";;;AAAA,yCAO2B;AAC3B,kCAA+C;AAE/C,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,yBAAW,CAAA;IACX,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AAwBY,QAAA,SAAS,GAAG,UAAC,IAAY;IACpC,mBAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,SAAS,EAAE,IAAI,MAAA,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEW,QAAA,GAAG,GAAG,UAAC,GAAW,EAAE,KAAa,EAAE,IAAY;IAC1D,mBAA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,CAAC,WAAG,CACvB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAChB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAChB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CACjB;YACH,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,CAAC,CAAC,CAAC,CAAC,YAAI,CACxB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAChB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAChB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAChB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CACjB;gBACH,CAAC,CAAC,SAAS,CACZ;AAhBiE,CAgBjE,CAAC;AAEF,kBAAkB;AACL,QAAA,iBAAiB,GAAG,UAAC,KAAY;IAC1C,OAAA,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QACzC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YACjE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;gBACjF,CAAC,CAAC,aAAK,CAAC,oBAAkB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAG,CAAC;AAHhD,CAGgD,CAAC"} \ No newline at end of file diff --git a/cjs/api/errors.d.ts b/cjs/api/errors.d.ts new file mode 100644 index 000000000..412a6233d --- /dev/null +++ b/cjs/api/errors.d.ts @@ -0,0 +1,43 @@ +export declare class EncryptedPDFError extends Error { + constructor(); +} +export declare class FontkitNotRegisteredError extends Error { + constructor(); +} +export declare class ForeignPageError extends Error { + constructor(); +} +export declare class RemovePageFromEmptyDocumentError extends Error { + constructor(); +} +export declare class NoSuchFieldError extends Error { + constructor(name: string); +} +export declare class UnexpectedFieldTypeError extends Error { + constructor(name: string, expected: any, actual: any); +} +export declare class MissingOnValueCheckError extends Error { + constructor(onValue: any); +} +export declare class FieldAlreadyExistsError extends Error { + constructor(name: string); +} +export declare class InvalidFieldNamePartError extends Error { + constructor(namePart: string); +} +export declare class FieldExistsAsNonTerminalError extends Error { + constructor(name: string); +} +export declare class RichTextFieldReadError extends Error { + constructor(fieldName: string); +} +export declare class CombedTextLayoutError extends Error { + constructor(lineLength: number, cellCount: number); +} +export declare class ExceededMaxLengthError extends Error { + constructor(textLength: number, maxLength: number, name: string); +} +export declare class InvalidMaxLengthError extends Error { + constructor(textLength: number, maxLength: number, name: string); +} +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/cjs/api/errors.d.ts.map b/cjs/api/errors.d.ts.map new file mode 100644 index 000000000..91699a896 --- /dev/null +++ b/cjs/api/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,iBAAkB,SAAQ,KAAK;;CAM3C;AAGD,qBAAa,yBAA0B,SAAQ,KAAK;;CAMnD;AAGD,qBAAa,gBAAiB,SAAQ,KAAK;;CAM1C;AAGD,qBAAa,gCAAiC,SAAQ,KAAK;;CAM1D;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;CAQrD;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,GAAG;CAIzB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,QAAQ,EAAE,MAAM;CAI7B;AAED,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,SAAS,EAAE,MAAM;CAI9B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAIlD;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIhE;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIhE"} \ No newline at end of file diff --git a/cjs/api/errors.js b/cjs/api/errors.js new file mode 100644 index 000000000..31968e2d3 --- /dev/null +++ b/cjs/api/errors.js @@ -0,0 +1,168 @@ +"use strict"; +// tslint:disable: max-classes-per-file +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InvalidMaxLengthError = exports.ExceededMaxLengthError = exports.CombedTextLayoutError = exports.RichTextFieldReadError = exports.FieldExistsAsNonTerminalError = exports.InvalidFieldNamePartError = exports.FieldAlreadyExistsError = exports.MissingOnValueCheckError = exports.UnexpectedFieldTypeError = exports.NoSuchFieldError = exports.RemovePageFromEmptyDocumentError = exports.ForeignPageError = exports.FontkitNotRegisteredError = exports.EncryptedPDFError = void 0; +var tslib_1 = require("tslib"); +// TODO: Include link to documentation with example +var EncryptedPDFError = /** @class */ (function (_super) { + tslib_1.__extends(EncryptedPDFError, _super); + function EncryptedPDFError() { + var _this = this; + var msg = 'Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.'; + _this = _super.call(this, msg) || this; + return _this; + } + return EncryptedPDFError; +}(Error)); +exports.EncryptedPDFError = EncryptedPDFError; +// TODO: Include link to documentation with example +var FontkitNotRegisteredError = /** @class */ (function (_super) { + tslib_1.__extends(FontkitNotRegisteredError, _super); + function FontkitNotRegisteredError() { + var _this = this; + var msg = 'Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts.'; + _this = _super.call(this, msg) || this; + return _this; + } + return FontkitNotRegisteredError; +}(Error)); +exports.FontkitNotRegisteredError = FontkitNotRegisteredError; +// TODO: Include link to documentation with example +var ForeignPageError = /** @class */ (function (_super) { + tslib_1.__extends(ForeignPageError, _super); + function ForeignPageError() { + var _this = this; + var msg = 'A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them.'; + _this = _super.call(this, msg) || this; + return _this; + } + return ForeignPageError; +}(Error)); +exports.ForeignPageError = ForeignPageError; +// TODO: Include link to documentation with example +var RemovePageFromEmptyDocumentError = /** @class */ (function (_super) { + tslib_1.__extends(RemovePageFromEmptyDocumentError, _super); + function RemovePageFromEmptyDocumentError() { + var _this = this; + var msg = 'PDFDocument has no pages so `PDFDocument.removePage` cannot be called'; + _this = _super.call(this, msg) || this; + return _this; + } + return RemovePageFromEmptyDocumentError; +}(Error)); +exports.RemovePageFromEmptyDocumentError = RemovePageFromEmptyDocumentError; +var NoSuchFieldError = /** @class */ (function (_super) { + tslib_1.__extends(NoSuchFieldError, _super); + function NoSuchFieldError(name) { + var _this = this; + var msg = "PDFDocument has no form field with the name \"" + name + "\""; + _this = _super.call(this, msg) || this; + return _this; + } + return NoSuchFieldError; +}(Error)); +exports.NoSuchFieldError = NoSuchFieldError; +var UnexpectedFieldTypeError = /** @class */ (function (_super) { + tslib_1.__extends(UnexpectedFieldTypeError, _super); + function UnexpectedFieldTypeError(name, expected, actual) { + var _a, _b; + var _this = this; + var expectedType = expected === null || expected === void 0 ? void 0 : expected.name; + var actualType = (_b = (_a = actual === null || actual === void 0 ? void 0 : actual.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : actual; + var msg = "Expected field \"" + name + "\" to be of type " + expectedType + ", " + + ("but it is actually of type " + actualType); + _this = _super.call(this, msg) || this; + return _this; + } + return UnexpectedFieldTypeError; +}(Error)); +exports.UnexpectedFieldTypeError = UnexpectedFieldTypeError; +var MissingOnValueCheckError = /** @class */ (function (_super) { + tslib_1.__extends(MissingOnValueCheckError, _super); + function MissingOnValueCheckError(onValue) { + var _this = this; + var msg = "Failed to select check box due to missing onValue: \"" + onValue + "\""; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingOnValueCheckError; +}(Error)); +exports.MissingOnValueCheckError = MissingOnValueCheckError; +var FieldAlreadyExistsError = /** @class */ (function (_super) { + tslib_1.__extends(FieldAlreadyExistsError, _super); + function FieldAlreadyExistsError(name) { + var _this = this; + var msg = "A field already exists with the specified name: \"" + name + "\""; + _this = _super.call(this, msg) || this; + return _this; + } + return FieldAlreadyExistsError; +}(Error)); +exports.FieldAlreadyExistsError = FieldAlreadyExistsError; +var InvalidFieldNamePartError = /** @class */ (function (_super) { + tslib_1.__extends(InvalidFieldNamePartError, _super); + function InvalidFieldNamePartError(namePart) { + var _this = this; + var msg = "Field name contains invalid component: \"" + namePart + "\""; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidFieldNamePartError; +}(Error)); +exports.InvalidFieldNamePartError = InvalidFieldNamePartError; +var FieldExistsAsNonTerminalError = /** @class */ (function (_super) { + tslib_1.__extends(FieldExistsAsNonTerminalError, _super); + function FieldExistsAsNonTerminalError(name) { + var _this = this; + var msg = "A non-terminal field already exists with the specified name: \"" + name + "\""; + _this = _super.call(this, msg) || this; + return _this; + } + return FieldExistsAsNonTerminalError; +}(Error)); +exports.FieldExistsAsNonTerminalError = FieldExistsAsNonTerminalError; +var RichTextFieldReadError = /** @class */ (function (_super) { + tslib_1.__extends(RichTextFieldReadError, _super); + function RichTextFieldReadError(fieldName) { + var _this = this; + var msg = "Reading rich text fields is not supported: Attempted to read rich text field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return RichTextFieldReadError; +}(Error)); +exports.RichTextFieldReadError = RichTextFieldReadError; +var CombedTextLayoutError = /** @class */ (function (_super) { + tslib_1.__extends(CombedTextLayoutError, _super); + function CombedTextLayoutError(lineLength, cellCount) { + var _this = this; + var msg = "Failed to layout combed text as lineLength=" + lineLength + " is greater than cellCount=" + cellCount; + _this = _super.call(this, msg) || this; + return _this; + } + return CombedTextLayoutError; +}(Error)); +exports.CombedTextLayoutError = CombedTextLayoutError; +var ExceededMaxLengthError = /** @class */ (function (_super) { + tslib_1.__extends(ExceededMaxLengthError, _super); + function ExceededMaxLengthError(textLength, maxLength, name) { + var _this = this; + var msg = "Attempted to set text with length=" + textLength + " for TextField with maxLength=" + maxLength + " and name=" + name; + _this = _super.call(this, msg) || this; + return _this; + } + return ExceededMaxLengthError; +}(Error)); +exports.ExceededMaxLengthError = ExceededMaxLengthError; +var InvalidMaxLengthError = /** @class */ (function (_super) { + tslib_1.__extends(InvalidMaxLengthError, _super); + function InvalidMaxLengthError(textLength, maxLength, name) { + var _this = this; + var msg = "Attempted to set maxLength=" + maxLength + ", which is less than " + textLength + ", the length of this field's current value (name=" + name + ")"; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidMaxLengthError; +}(Error)); +exports.InvalidMaxLengthError = InvalidMaxLengthError; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/cjs/api/errors.js.map b/cjs/api/errors.js.map new file mode 100644 index 000000000..966864be1 --- /dev/null +++ b/cjs/api/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;AAEvC,mDAAmD;AACnD;IAAuC,6CAAK;IAC1C;QAAA,iBAIC;QAHC,IAAM,GAAG,GACP,8JAA8J,CAAC;Q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,CAA4C,KAAK,GAKhD;AALY,wDAAsB;AAOnC;IAA2C,iDAAK;IAC9C,+BAAY,UAAkB,EAAE,SAAiB;QAAjD,iBAGC;QAFC,IAAM,GAAG,GAAG,gDAA8C,UAAU,mCAA8B,SAAW,CAAC;QAC9G,QAAA,kBAAM,GAAG,CAAC,SAAC;;IACb,CAAC;IACH,4BAAC;AAAD,CAAC,AALD,CAA2C,KAAK,GAK/C;AALY,sDAAqB;AAOlC;IAA4C,kDAAK;IAC/C,gCAAY,UAAkB,EAAE,SAAiB,EAAE,IAAY;QAA/D,iBAGC;QAFC,IAAM,GAAG,GAAG,uCAAqC,UAAU,sCAAiC,SAAS,kBAAa,IAAM,CAAC;QACzH,QAAA,kBAAM,GAAG,CAAC,SAAC;;IACb,CAAC;IACH,6BAAC;AAAD,CAAC,AALD,CAA4C,KAAK,GAKhD;AALY,wDAAsB;AAOnC;IAA2C,iDAAK;IAC9C,+BAAY,UAAkB,EAAE,SAAiB,EAAE,IAAY;QAA/D,iBAGC;QAFC,IAAM,GAAG,GAAG,gCAA8B,SAAS,6BAAwB,UAAU,yDAAoD,IAAI,MAAG,CAAC;QACjJ,QAAA,kBAAM,GAAG,CAAC,SAAC;;IACb,CAAC;IACH,4BAAC;AAAD,CAAC,AALD,CAA2C,KAAK,GAK/C;AALY,sDAAqB"} \ No newline at end of file diff --git a/cjs/api/form/PDFButton.d.ts b/cjs/api/form/PDFButton.d.ts new file mode 100644 index 000000000..6e98dc0fd --- /dev/null +++ b/cjs/api/form/PDFButton.d.ts @@ -0,0 +1,138 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import PDFFont from "../PDFFont"; +import PDFImage from "../PDFImage"; +import { ImageAlignment } from "../image/alignment"; +import { AppearanceProviderFor } from "./appearances"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { PDFRef, PDFAcroPushButton } from "../../core"; +/** + * Represents a button field of a [[PDFForm]]. + * + * [[PDFButton]] fields are interactive controls that users can click with their + * mouse. This type of [[PDFField]] is not stateful. The purpose of a button + * is to perform an action when the user clicks on it, such as opening a print + * modal or resetting the form. Buttons are typically rectangular in shape and + * have a text label describing the action that they perform when clicked. + */ +export default class PDFButton extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getButton]] method, which will create an + * > instance of [[PDFButton]] for you. + * + * Create an instance of [[PDFButton]] from an existing acroPushButton and ref + * + * @param acroPushButton The underlying `PDFAcroPushButton` for this button. + * @param ref The unique reference for this button. + * @param doc The document to which this button will belong. + */ + static of: (acroPushButton: PDFAcroPushButton, ref: PDFRef, doc: PDFDocument) => PDFButton; + /** The low-level PDFAcroPushButton wrapped by this button. */ + readonly acroField: PDFAcroPushButton; + private constructor(); + /** + * Display an image inside the bounds of this button's widgets. For example: + * ```js + * const pngImage = await pdfDoc.embedPng(...) + * const button = form.getButton('some.button.field') + * button.setImage(pngImage, ImageAlignment.Center) + * ``` + * This will update the appearances streams for each of this button's widgets. + * @param image The image that should be displayed. + * @param alignment The alignment of the image. + */ + setImage(image: PDFImage, alignment?: ImageAlignment): void; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this button. Font sizes may + * be integer or floating point numbers. Supplying a negative font size will + * cause this method to throw an error. + * + * For example: + * ```js + * const button = form.getButton('some.button.field') + * button.setFontSize(4) + * button.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + setFontSize(fontSize: number): void; + /** + * Show this button on the specified page with the given text. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const button = form.createButton('some.button.field') + * + * button.addToPage('Do Stuff', page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this button field. + * @param text The text to be displayed for this button widget. + * @param page The page to which this button widget should be added. + * @param options The options to be used when adding this button widget. + */ + addToPage(text: string, page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if this button has been marked as dirty, or if any of this + * button's widgets do not have an appearance stream. For example: + * ```js + * const button = form.getButton('some.button.field') + * if (button.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this button needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this button's widgets using + * the default appearance provider for buttons. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const button = form.getButton('some.button.field') + * button.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + defaultUpdateAppearances(font: PDFFont): void; + /** + * Update the appearance streams for each of this button's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for buttons will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const button = form.getButton('some.button.field') + * button.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return { + * normal: drawButton(...), + * down: drawButton(...), + * } + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(font: PDFFont, provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFButton.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFButton.d.ts.map b/cjs/api/form/PDFButton.d.ts.map new file mode 100644 index 000000000..1c2b95d87 --- /dev/null +++ b/cjs/api/form/PDFButton.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFButton.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFButton.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,OAAO,mBAAwB;AACtC,OAAO,QAAQ,oBAAyB;AACxC,OAAO,EAAE,cAAc,EAAE,2BAAgC;AACzD,OAAO,EACL,qBAAqB,EAGtB,sBAAiC;AAClC,OAAO,QAAQ,EAAE,EACf,sBAAsB,EAEvB,mBAA8B;AAI/B,OAAO,EACL,MAAM,EAEN,iBAAiB,EAElB,mBAAiB;AAGlB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,QAAQ;IAC7C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,mBACS,iBAAiB,OAC5B,MAAM,OACN,WAAW,eAC2B;IAE7C,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC,OAAO;IAcP;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,iBAAwB;IAe3D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM;IAM5B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,SAAS,CAEP,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,sBAAsB;IAkClC;;;;;;;;OAQG;IACH,sBAAsB,IAAI,OAAO;IAcjC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,IAAI,EAAE,OAAO;IAKtC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CACf,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC;IAY7C,OAAO,CAAC,sBAAsB;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFButton.js b/cjs/api/form/PDFButton.js new file mode 100644 index 000000000..eaa421091 --- /dev/null +++ b/cjs/api/form/PDFButton.js @@ -0,0 +1,220 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var PDFFont_1 = tslib_1.__importDefault(require("../PDFFont")); +var alignment_1 = require("../image/alignment"); +var appearances_1 = require("./appearances"); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a button field of a [[PDFForm]]. + * + * [[PDFButton]] fields are interactive controls that users can click with their + * mouse. This type of [[PDFField]] is not stateful. The purpose of a button + * is to perform an action when the user clicks on it, such as opening a print + * modal or resetting the form. Buttons are typically rectangular in shape and + * have a text label describing the action that they perform when clicked. + */ +var PDFButton = /** @class */ (function (_super) { + tslib_1.__extends(PDFButton, _super); + function PDFButton(acroPushButton, ref, doc) { + var _this = _super.call(this, acroPushButton, ref, doc) || this; + utils_1.assertIs(acroPushButton, 'acroButton', [ + [core_1.PDFAcroPushButton, 'PDFAcroPushButton'], + ]); + _this.acroField = acroPushButton; + return _this; + } + /** + * Display an image inside the bounds of this button's widgets. For example: + * ```js + * const pngImage = await pdfDoc.embedPng(...) + * const button = form.getButton('some.button.field') + * button.setImage(pngImage, ImageAlignment.Center) + * ``` + * This will update the appearances streams for each of this button's widgets. + * @param image The image that should be displayed. + * @param alignment The alignment of the image. + */ + PDFButton.prototype.setImage = function (image, alignment) { + if (alignment === void 0) { alignment = alignment_1.ImageAlignment.Center; } + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var streamRef = this.createImageAppearanceStream(widget, image, alignment); + this.updateWidgetAppearances(widget, { normal: streamRef }); + } + this.markAsClean(); + }; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this button. Font sizes may + * be integer or floating point numbers. Supplying a negative font size will + * cause this method to throw an error. + * + * For example: + * ```js + * const button = form.getButton('some.button.field') + * button.setFontSize(4) + * button.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + PDFButton.prototype.setFontSize = function (fontSize) { + utils_1.assertPositive(fontSize, 'fontSize'); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + /** + * Show this button on the specified page with the given text. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const button = form.createButton('some.button.field') + * + * button.addToPage('Do Stuff', page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this button field. + * @param text The text to be displayed for this button widget. + * @param page The page to which this button widget should be added. + * @param options The options to be used when adding this button widget. + */ + PDFButton.prototype.addToPage = function ( + // TODO: This needs to be optional, e.g. for image buttons + text, page, options) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; + utils_1.assertOrUndefined(text, 'text', ['string']); + utils_1.assertOrUndefined(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + // Create a widget for this button + var widget = this.createWidget({ + x: ((_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0) - ((_b = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _b !== void 0 ? _b : 0) / 2, + y: ((_c = options === null || options === void 0 ? void 0 : options.y) !== null && _c !== void 0 ? _c : 0) - ((_d = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _d !== void 0 ? _d : 0) / 2, + width: (_e = options === null || options === void 0 ? void 0 : options.width) !== null && _e !== void 0 ? _e : 100, + height: (_f = options === null || options === void 0 ? void 0 : options.height) !== null && _f !== void 0 ? _f : 50, + textColor: (_g = options === null || options === void 0 ? void 0 : options.textColor) !== null && _g !== void 0 ? _g : colors_1.rgb(0, 0, 0), + backgroundColor: (_h = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _h !== void 0 ? _h : colors_1.rgb(0.75, 0.75, 0.75), + borderColor: options === null || options === void 0 ? void 0 : options.borderColor, + borderWidth: (_j = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _j !== void 0 ? _j : 0, + rotate: (_k = options === null || options === void 0 ? void 0 : options.rotate) !== null && _k !== void 0 ? _k : rotations_1.degrees(0), + caption: text, + hidden: options === null || options === void 0 ? void 0 : options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + this.acroField.addWidget(widgetRef); + // Set appearance streams for widget + var font = (_l = options === null || options === void 0 ? void 0 : options.font) !== null && _l !== void 0 ? _l : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if this button has been marked as dirty, or if any of this + * button's widgets do not have an appearance stream. For example: + * ```js + * const button = form.getButton('some.button.field') + * if (button.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this button needs an appearance update. + */ + PDFButton.prototype.needsAppearancesUpdate = function () { + var _a; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof core_1.PDFStream; + if (!hasAppearances) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this button's widgets using + * the default appearance provider for buttons. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const button = form.getButton('some.button.field') + * button.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + PDFButton.prototype.defaultUpdateAppearances = function (font) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + this.updateAppearances(font); + }; + /** + * Update the appearance streams for each of this button's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for buttons will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const button = form.getButton('some.button.field') + * button.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return { + * normal: drawButton(...), + * down: drawButton(...), + * } + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFButton.prototype.updateAppearances = function (font, provider) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + }; + PDFButton.prototype.updateWidgetAppearance = function (widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultButtonAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getButton]] method, which will create an + * > instance of [[PDFButton]] for you. + * + * Create an instance of [[PDFButton]] from an existing acroPushButton and ref + * + * @param acroPushButton The underlying `PDFAcroPushButton` for this button. + * @param ref The unique reference for this button. + * @param doc The document to which this button will belong. + */ + PDFButton.of = function (acroPushButton, ref, doc) { return new PDFButton(acroPushButton, ref, doc); }; + return PDFButton; +}(PDFField_1.default)); +exports.default = PDFButton; +//# sourceMappingURL=PDFButton.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFButton.js.map b/cjs/api/form/PDFButton.js.map new file mode 100644 index 000000000..a48f9842c --- /dev/null +++ b/cjs/api/form/PDFButton.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFButton.js","sourceRoot":"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OD;;;;;;;;;;OAUG;IACI,YAAE,GAAG,UACV,cAAiC,EACjC,GAAW,EACX,GAAgB,IACb,OAAA,IAAI,SAAS,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,EAAvC,CAAuC,CAAC;IAwN/C,gBAAC;CAAA,AAxOD,CAAuC,kBAAQ,GAwO9C;kBAxOoB,SAAS"} \ No newline at end of file diff --git a/cjs/api/form/PDFCheckBox.d.ts b/cjs/api/form/PDFCheckBox.d.ts new file mode 100644 index 000000000..fca767785 --- /dev/null +++ b/cjs/api/form/PDFCheckBox.d.ts @@ -0,0 +1,143 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import { AppearanceProviderFor } from "./appearances"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { PDFRef, PDFAcroCheckBox } from "../../core"; +/** + * Represents a check box field of a [[PDFForm]]. + * + * [[PDFCheckBox]] fields are interactive boxes that users can click with their + * mouse. This type of [[PDFField]] has two states: `on` and `off`. The purpose + * of a check box is to enable users to select from one or more options, where + * each option is represented by a single check box. Check boxes are typically + * square in shape and display a check mark when they are in the `on` state. + */ +export default class PDFCheckBox extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getCheckBox]] method, which will create an + * > instance of [[PDFCheckBox]] for you. + * + * Create an instance of [[PDFCheckBox]] from an existing acroCheckBox and ref + * + * @param acroCheckBox The underlying `PDFAcroCheckBox` for this check box. + * @param ref The unique reference for this check box. + * @param doc The document to which this check box will belong. + */ + static of: (acroCheckBox: PDFAcroCheckBox, ref: PDFRef, doc: PDFDocument) => PDFCheckBox; + /** The low-level PDFAcroCheckBox wrapped by this check box. */ + readonly acroField: PDFAcroCheckBox; + private constructor(); + /** + * Mark this check box. This operation is analogous to a human user clicking + * a check box to fill it in a PDF reader. This method will update the + * underlying state of the check box field to indicate it has been selected. + * PDF libraries and readers will be able to extract this value from the + * saved document and determine that it was selected. + * + * For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.check() + * ``` + * + * This method will mark this check box as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated appearance + * streams will display a check mark inside the widgets of this check box + * field. + */ + check(): void; + /** + * Clears this check box. This operation is analogous to a human user clicking + * a check box to unmark it in a PDF reader. This method will update the + * underlying state of the check box field to indicate it has been deselected. + * PDF libraries and readers will be able to extract this value from the + * saved document and determine that it was not selected. + * + * For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.uncheck() + * ``` + * + * This method will mark this check box as dirty. See [[PDFCheckBox.check]] + * for more details about what this means. + */ + uncheck(): void; + /** + * Returns `true` if this check box is selected (either by a human user via + * a PDF reader, or else programmatically via software). For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * if (checkBox.isChecked()) console.log('check box is selected') + * ``` + * @returns Whether or not this check box is selected. + */ + isChecked(): boolean; + /** + * Show this check box on the specified page. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const checkBox = form.createCheckBox('some.checkBox.field') + * + * checkBox.addToPage(page, { + * x: 50, + * y: 75, + * width: 25, + * height: 25, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * }) + * ``` + * This will create a new widget for this check box field. + * @param page The page to which this check box widget should be added. + * @param options The options to be used when adding this check box widget. + */ + addToPage(page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if any of this check box's widgets do not have an + * appearance stream for its current state. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * if (checkBox.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this check box needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this check box's widgets using + * the default appearance provider for check boxes. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.defaultUpdateAppearances() + * ``` + */ + defaultUpdateAppearances(): void; + /** + * Update the appearance streams for each of this check box's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for check boxs will be used. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.updateAppearances((field, widget) => { + * ... + * return { + * normal: { on: drawCheckBox(...), off: drawCheckBox(...) }, + * down: { on: drawCheckBox(...), off: drawCheckBox(...) }, + * } + * }) + * ``` + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFCheckBox.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFCheckBox.d.ts.map b/cjs/api/form/PDFCheckBox.d.ts.map new file mode 100644 index 000000000..87f440c4e --- /dev/null +++ b/cjs/api/form/PDFCheckBox.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCheckBox.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFCheckBox.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,EACL,qBAAqB,EAGtB,sBAAiC;AAGlC,OAAO,QAAQ,EAAE,EACf,sBAAsB,EAEvB,mBAA8B;AAE/B,OAAO,EAEL,MAAM,EAEN,eAAe,EAEhB,mBAAiB;AAGlB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAC/C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,iBAAkB,eAAe,OAAO,MAAM,OAAO,WAAW,iBAC/B;IAE1C,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IAEpC,OAAO;IAcP;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK;IAML;;;;;;;;;;;;;;;OAeG;IACH,OAAO;IAKP;;;;;;;;OAQG;IACH,SAAS,IAAI,OAAO;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,sBAAsB;IAsCzD;;;;;;;;OAQG;IACH,sBAAsB,IAAI,OAAO;IAcjC;;;;;;;OAOG;IACH,wBAAwB;IAIxB;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAa/D,OAAO,CAAC,sBAAsB;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFCheckBox.js b/cjs/api/form/PDFCheckBox.js new file mode 100644 index 000000000..e67b30d8b --- /dev/null +++ b/cjs/api/form/PDFCheckBox.js @@ -0,0 +1,236 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var appearances_1 = require("./appearances"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a check box field of a [[PDFForm]]. + * + * [[PDFCheckBox]] fields are interactive boxes that users can click with their + * mouse. This type of [[PDFField]] has two states: `on` and `off`. The purpose + * of a check box is to enable users to select from one or more options, where + * each option is represented by a single check box. Check boxes are typically + * square in shape and display a check mark when they are in the `on` state. + */ +var PDFCheckBox = /** @class */ (function (_super) { + tslib_1.__extends(PDFCheckBox, _super); + function PDFCheckBox(acroCheckBox, ref, doc) { + var _this = _super.call(this, acroCheckBox, ref, doc) || this; + utils_1.assertIs(acroCheckBox, 'acroCheckBox', [ + [core_1.PDFAcroCheckBox, 'PDFAcroCheckBox'], + ]); + _this.acroField = acroCheckBox; + return _this; + } + /** + * Mark this check box. This operation is analogous to a human user clicking + * a check box to fill it in a PDF reader. This method will update the + * underlying state of the check box field to indicate it has been selected. + * PDF libraries and readers will be able to extract this value from the + * saved document and determine that it was selected. + * + * For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.check() + * ``` + * + * This method will mark this check box as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated appearance + * streams will display a check mark inside the widgets of this check box + * field. + */ + PDFCheckBox.prototype.check = function () { + var _a; + var onValue = (_a = this.acroField.getOnValue()) !== null && _a !== void 0 ? _a : core_1.PDFName.of('Yes'); + this.markAsDirty(); + this.acroField.setValue(onValue); + }; + /** + * Clears this check box. This operation is analogous to a human user clicking + * a check box to unmark it in a PDF reader. This method will update the + * underlying state of the check box field to indicate it has been deselected. + * PDF libraries and readers will be able to extract this value from the + * saved document and determine that it was not selected. + * + * For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.uncheck() + * ``` + * + * This method will mark this check box as dirty. See [[PDFCheckBox.check]] + * for more details about what this means. + */ + PDFCheckBox.prototype.uncheck = function () { + this.markAsDirty(); + this.acroField.setValue(core_1.PDFName.of('Off')); + }; + /** + * Returns `true` if this check box is selected (either by a human user via + * a PDF reader, or else programmatically via software). For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * if (checkBox.isChecked()) console.log('check box is selected') + * ``` + * @returns Whether or not this check box is selected. + */ + PDFCheckBox.prototype.isChecked = function () { + var onValue = this.acroField.getOnValue(); + return !!onValue && onValue === this.acroField.getValue(); + }; + /** + * Show this check box on the specified page. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const checkBox = form.createCheckBox('some.checkBox.field') + * + * checkBox.addToPage(page, { + * x: 50, + * y: 75, + * width: 25, + * height: 25, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * }) + * ``` + * This will create a new widget for this check box field. + * @param page The page to which this check box widget should be added. + * @param options The options to be used when adding this check box widget. + */ + PDFCheckBox.prototype.addToPage = function (page, options) { + var _a, _b, _c, _d, _e, _f; + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!('textColor' in options)) + options.textColor = colors_1.rgb(0, 0, 0); + if (!('backgroundColor' in options)) + options.backgroundColor = colors_1.rgb(1, 1, 1); + if (!('borderColor' in options)) + options.borderColor = colors_1.rgb(0, 0, 0); + if (!('borderWidth' in options)) + options.borderWidth = 1; + // Create a widget for this check box + var widget = this.createWidget({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : 0, + y: (_b = options.y) !== null && _b !== void 0 ? _b : 0, + width: (_c = options.width) !== null && _c !== void 0 ? _c : 50, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + hidden: options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + this.acroField.addWidget(widgetRef); + // Set appearance streams for widget + widget.setAppearanceState(core_1.PDFName.of('Off')); + this.updateWidgetAppearance(widget, core_1.PDFName.of('Yes')); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if any of this check box's widgets do not have an + * appearance stream for its current state. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * if (checkBox.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this check box needs an appearance update. + */ + PDFCheckBox.prototype.needsAppearancesUpdate = function () { + var _a; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state = widget.getAppearanceState(); + var normal = (_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal; + if (!(normal instanceof core_1.PDFDict)) + return true; + if (state && !normal.has(state)) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this check box's widgets using + * the default appearance provider for check boxes. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.defaultUpdateAppearances() + * ``` + */ + PDFCheckBox.prototype.defaultUpdateAppearances = function () { + this.updateAppearances(); + }; + /** + * Update the appearance streams for each of this check box's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for check boxs will be used. For example: + * ```js + * const checkBox = form.getCheckBox('some.checkBox.field') + * checkBox.updateAppearances((field, widget) => { + * ... + * return { + * normal: { on: drawCheckBox(...), off: drawCheckBox(...) }, + * down: { on: drawCheckBox(...), off: drawCheckBox(...) }, + * } + * }) + * ``` + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFCheckBox.prototype.updateAppearances = function (provider) { + var _a; + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var onValue = (_a = widget.getOnValue()) !== null && _a !== void 0 ? _a : core_1.PDFName.of('Yes'); + if (!onValue) + continue; + this.updateWidgetAppearance(widget, onValue, provider); + } + this.markAsClean(); + }; + PDFCheckBox.prototype.updateWidgetAppearance = function (widget, onValue, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultCheckBoxAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget)); + this.updateOnOffWidgetAppearance(widget, onValue, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getCheckBox]] method, which will create an + * > instance of [[PDFCheckBox]] for you. + * + * Create an instance of [[PDFCheckBox]] from an existing acroCheckBox and ref + * + * @param acroCheckBox The underlying `PDFAcroCheckBox` for this check box. + * @param ref The unique reference for this check box. + * @param doc The document to which this check box will belong. + */ + PDFCheckBox.of = function (acroCheckBox, ref, doc) { + return new PDFCheckBox(acroCheckBox, ref, doc); + }; + return PDFCheckBox; +}(PDFField_1.default)); +exports.default = PDFCheckBox; +//# sourceMappingURL=PDFCheckBox.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFCheckBox.js.map b/cjs/api/form/PDFCheckBox.js.map new file mode 100644 index 000000000..15847955c --- /dev/null +++ b/cjs/api/form/PDFCheckBox.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCheckBox.js","sourceRoot":"","sources":["../../../src/api/form/PDFCheckBox.ts"],"names":[],"mappings":";;;AACA,+DAAsC;AACtC,6CAIkC;AAClC,oCAAqC;AACrC,0CAA4C;AAC5C,6DAG+B;AAE/B,mCAMkB;AAClB,qCAAwD;AAExD;;;;;;;;GAQG;AACH;IAAyC,uCAAQ;IAkB/C,qBACE,YAA6B,EAC7B,GAAW,EACX,GAAgB;QAHlB,YAKE,kBAAM,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,SAO9B;QALC,gBAAQ,CAAC,YAAY,EAAE,cAAc,EAAE;YACrC,CAAC,sBAAe,EAAE,iBAAiB,CAAC;SACrC,CAAC,CAAC;QAEH,KAAI,CAAC,SAAS,GAAG,YAAY,CAAC;;IAChC,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,2BAAK,GAAL;;QACE,IAAM,OAAO,SAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,mCAAI,cAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACjE,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,6BAAO,GAAP;QACE,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,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;IAnOD;;;;;;;;;;OAUG;IACI,cAAE,GAAG,UAAC,YAA6B,EAAE,GAAW,EAAE,GAAgB;QACvE,OAAA,IAAI,WAAW,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC;IAAvC,CAAuC,CAAC;IAwN5C,kBAAC;CAAA,AArOD,CAAyC,kBAAQ,GAqOhD;kBArOoB,WAAW"} \ No newline at end of file diff --git a/cjs/api/form/PDFDropdown.d.ts b/cjs/api/form/PDFDropdown.d.ts new file mode 100644 index 000000000..d61fe85bf --- /dev/null +++ b/cjs/api/form/PDFDropdown.d.ts @@ -0,0 +1,403 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import PDFFont from "../PDFFont"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { AppearanceProviderFor } from "./appearances"; +import { PDFRef, PDFAcroComboBox } from "../../core"; +/** + * Represents a dropdown field of a [[PDFForm]]. + * + * [[PDFDropdown]] fields are interactive text boxes that display a single + * element (the currently selected value). The purpose of a dropdown is to + * enable users to select a single option from a set of possible options. Users + * can click on a dropdown to view the full list of options it provides. + * Clicking on an option in the list will cause it to be selected and displayed + * in the dropdown's text box. Some dropdowns allow users to enter text + * directly into the box from their keyboard, rather than only being allowed to + * choose an option from the list (see [[PDFDropdown.isEditable]]). + */ +export default class PDFDropdown extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getDropdown]] method, which will create an + * > instance of [[PDFDropdown]] for you. + * + * Create an instance of [[PDFDropdown]] from an existing acroComboBox and ref + * + * @param acroComboBox The underlying `PDFAcroComboBox` for this dropdown. + * @param ref The unique reference for this dropdown. + * @param doc The document to which this dropdown will belong. + */ + static of: (acroComboBox: PDFAcroComboBox, ref: PDFRef, doc: PDFDocument) => PDFDropdown; + /** The low-level PDFAcroComboBox wrapped by this dropdown. */ + readonly acroField: PDFAcroComboBox; + private constructor(); + /** + * Get the list of available options for this dropdown. These options will be + * displayed to users who click on this dropdown in a PDF reader. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * const options = dropdown.getOptions() + * console.log('Dropdown options:', options) + * ``` + * @returns The options for this dropdown. + */ + getOptions(): string[]; + /** + * Get the selected options for this dropdown. These are the values that were + * selected by a human user via a PDF reader, or programatically via + * software. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * const selections = dropdown.getSelected() + * console.log('Dropdown selections:', selections) + * ``` + * > **NOTE:** Note that PDF readers only display one selected option when + * > rendering dropdowns. However, the PDF specification does allow for + * > multiple values to be selected in a dropdown. As such, the `pdf-lib` + * > API supports this. However, in most cases the array returned by this + * > method will contain only a single element (or no elements). + * @returns The selected options in this dropdown. + */ + getSelected(): string[]; + /** + * Set the list of options that are available for this dropdown. These are + * the values that will be available for users to select when they view this + * dropdown in a PDF reader. Note that preexisting options for this dropdown + * will be removed. Only the values passed as `options` will be available to + * select. + * For example: + * ```js + * const dropdown = form.getDropdown('planets.dropdown') + * dropdown.setOptions(['Earth', 'Mars', 'Pluto', 'Venus']) + * ``` + * @param options The options that should be available in this dropdown. + */ + setOptions(options: string[]): void; + /** + * Add to the list of options that are available for this dropdown. Users + * will be able to select these values in a PDF reader. In addition to the + * values passed as `options`, any preexisting options for this dropdown will + * still be available for users to select. + * For example: + * ```js + * const dropdown = form.getDropdown('rockets.dropdown') + * dropdown.addOptions(['Saturn IV', 'Falcon Heavy']) + * ``` + * @param options New options that should be available in this dropdown. + */ + addOptions(options: string | string[]): void; + /** + * Select one or more values for this dropdown. This operation is analogous + * to a human user opening the dropdown in a PDF reader and clicking on a + * value to select it. This method will update the underlying state of the + * dropdown to indicate which values have been selected. PDF libraries and + * readers will be able to extract these values from the saved document and + * determine which values were selected. + * + * For example: + * ```js + * const dropdown = form.getDropdown('best.superhero.dropdown') + * dropdown.select('One Punch Man') + * ``` + * + * This method will mark this dropdown as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the selected option inside the widgets of this dropdown. + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if the selected option for this field + * contains characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFDropdown.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * Selecting an option that does not exist in this dropdown's option list + * (see [[PDFDropdown.getOptions]]) will enable editing on this dropdown + * (see [[PDFDropdown.enableEditing]]). + * + * > **NOTE:** PDF readers only display one selected option when rendering + * > dropdowns. However, the PDF specification does allow for multiple values + * > to be selected in a dropdown. As such, the `pdf-lib` API supports this. + * > However, it is not recommended to select more than one value with this + * > method, as only one will be visible. [[PDFOptionList]] fields are better + * > suited for displaying multiple selected values. + * + * @param options The options to be selected. + * @param merge Whether or not existing selections should be preserved. + */ + select(options: string | string[], merge?: boolean): void; + /** + * Clear all selected values for this dropdown. This operation is equivalent + * to selecting an empty list. This method will update the underlying state + * of the dropdown to indicate that no values have been selected. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.clear() + * ``` + * This method will mark this text field as dirty. See [[PDFDropdown.select]] + * for more details about what this means. + */ + clear(): void; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this dropdown. Font sizes may + * be integer or floating point numbers. Supplying a negative font size will + * cause this method to throw an error. + * + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.setFontSize(4) + * dropdown.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + setFontSize(fontSize: number): void; + /** + * Returns `true` if users are allowed to edit the selected value of this + * dropdown directly and are not constrained by the list of available + * options. See [[PDFDropdown.enableEditing]] and + * [[PDFDropdown.disableEditing]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isEditable()) console.log('Editing is enabled') + * ``` + * @returns Whether or not this dropdown is editable. + */ + isEditable(): boolean; + /** + * Allow users to edit the selected value of this dropdown in PDF readers + * with their keyboard. This means that the selected value of this dropdown + * will not be constrained by the list of available options. However, if this + * dropdown has any available options, users will still be allowed to select + * from that list. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableEditing() + * ``` + */ + enableEditing(): void; + /** + * Do not allow users to edit the selected value of this dropdown in PDF + * readers with their keyboard. This will constrain the selected value of + * this dropdown to the list of available options. Users will only be able + * to select an option from that list. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableEditing() + * ``` + */ + disableEditing(): void; + /** + * Returns `true` if the option list of this dropdown is always displayed + * in alphabetical order, irrespective of the order in which the options + * were added to the dropdown. See [[PDFDropdown.enableSorting]] and + * [[PDFDropdown.disableSorting]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSorted()) console.log('Sorting is enabled') + * ``` + * @returns Whether or not this dropdown's options are sorted. + */ + isSorted(): boolean; + /** + * Always display the option list of this dropdown in alphabetical order, + * irrespective of the order in which the options were added to this dropdown. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSorting() + * ``` + */ + enableSorting(): void; + /** + * Do not always display the option list of this dropdown in alphabetical + * order. Instead, display the options in whichever order they were added + * to the list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSorting() + * ``` + */ + disableSorting(): void; + /** + * Returns `true` if multiple options can be selected from this dropdown's + * option list. See [[PDFDropdown.enableMultiselect]] and + * [[PDFDropdown.disableMultiselect]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isMultiselect()) console.log('Multiselect is enabled') + * ``` + * @returns Whether or not multiple options can be selected. + */ + isMultiselect(): boolean; + /** + * Allow users to select more than one option from this dropdown's option + * list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableMultiselect() + * ``` + */ + enableMultiselect(): void; + /** + * Do not allow users to select more than one option from this dropdown's + * option list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableMultiselect() + * ``` + */ + disableMultiselect(): void; + /** + * Returns `true` if the selected option should be spell checked by PDF + * readers. Spell checking will only be performed if this dropdown allows + * editing (see [[PDFDropdown.isEditable]]). See + * [[PDFDropdown.enableSpellChecking]] and + * [[PDFDropdown.disableSpellChecking]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSpellChecked()) console.log('Spell checking is enabled') + * ``` + * @returns Whether or not this dropdown can be spell checked. + */ + isSpellChecked(): boolean; + /** + * Allow PDF readers to spell check the selected option of this dropdown. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSpellChecking() + * ``` + */ + enableSpellChecking(): void; + /** + * Do not allow PDF readers to spell check the selected option of this + * dropdown. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSpellChecking() + * ``` + */ + disableSpellChecking(): void; + /** + * Returns `true` if the option selected by a user is stored, or "committed", + * when the user clicks the option. The alternative is that the user's + * selection is stored when the user leaves this dropdown field (by clicking + * outside of it - on another field, for example). See + * [[PDFDropdown.enableSelectOnClick]] and + * [[PDFDropdown.disableSelectOnClick]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSelectOnClick()) console.log('Select on click is enabled') + * ``` + * @returns Whether or not options are selected immediately after they are + * clicked. + */ + isSelectOnClick(): boolean; + /** + * Store the option selected by a user immediately after the user clicks the + * option. Do not wait for the user to leave this dropdown field (by clicking + * outside of it - on another field, for example). For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSelectOnClick() + * ``` + */ + enableSelectOnClick(): void; + /** + * Wait to store the option selected by a user until they leave this dropdown + * field (by clicking outside of it - on another field, for example). + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSelectOnClick() + * ``` + */ + disableSelectOnClick(): void; + /** + * Show this dropdown on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const dropdown = form.createDropdown('best.gundam') + * dropdown.setOptions(['Exia', 'Dynames']) + * dropdown.select('Exia') + * + * dropdown.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this dropdown field. + * @param page The page to which this dropdown widget should be added. + * @param options The options to be used when adding this dropdown widget. + */ + addToPage(page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if this dropdown has been marked as dirty, or if any of + * this dropdown's widgets do not have an appearance stream. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this dropdown needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this dropdown's widgets using + * the default appearance provider for dropdowns. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + defaultUpdateAppearances(font: PDFFont): void; + /** + * Update the appearance streams for each of this dropdown's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for dropdowns will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawTextField(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(font: PDFFont, provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFDropdown.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFDropdown.d.ts.map b/cjs/api/form/PDFDropdown.d.ts.map new file mode 100644 index 000000000..30c588c1e --- /dev/null +++ b/cjs/api/form/PDFDropdown.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDropdown.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,OAAO,mBAAwB;AACtC,OAAO,QAAQ,EAAE,EACf,sBAAsB,EAEvB,mBAA8B;AAC/B,OAAO,EACL,qBAAqB,EAGtB,sBAAiC;AAIlC,OAAO,EAEL,MAAM,EAIN,eAAe,EAEhB,mBAAiB;AAGlB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAC/C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,iBAAkB,eAAe,OAAO,MAAM,OAAO,WAAW,iBAC/B;IAE1C,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IAEpC,OAAO;IAcP;;;;;;;;;;OAUG;IACH,UAAU,IAAI,MAAM,EAAE;IAYtB;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,IAAI,MAAM,EAAE;IAWvB;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE;IAU5B;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,UAAQ;IA+BhD;;;;;;;;;;;OAWG;IACH,KAAK;IAKL;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM;IAM5B;;;;;;;;;;OAUG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;;;;;;;;OAWG;IACH,aAAa;IAIb;;;;;;;;;;OAUG;IACH,cAAc;IAId;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,OAAO;IAInB;;;;;;;;OAQG;IACH,aAAa;IAIb;;;;;;;;OAQG;IACH,cAAc;IAId;;;;;;;;;OASG;IACH,aAAa,IAAI,OAAO;IAIxB;;;;;;;OAOG;IACH,iBAAiB;IAIjB;;;;;;;OAOG;IACH,kBAAkB;IAIlB;;;;;;;;;;;OAWG;IACH,cAAc,IAAI,OAAO;IAIzB;;;;;;;OAOG;IACH,mBAAmB;IAInB;;;;;;;OAOG;IACH,oBAAoB;IAIpB;;;;;;;;;;;;;OAaG;IACH,eAAe,IAAI,OAAO;IAI1B;;;;;;;;OAQG;IACH,mBAAmB;IAInB;;;;;;;;OAQG;IACH,oBAAoB;IAIpB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,sBAAsB;IAsCzD;;;;;;;;OAQG;IACH,sBAAsB,IAAI,OAAO;IAcjC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,IAAI,EAAE,OAAO;IAKtC;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CACf,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAoB/C,OAAO,CAAC,sBAAsB;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFDropdown.js b/cjs/api/form/PDFDropdown.js new file mode 100644 index 000000000..8cb36375b --- /dev/null +++ b/cjs/api/form/PDFDropdown.js @@ -0,0 +1,580 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var PDFFont_1 = tslib_1.__importDefault(require("../PDFFont")); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var appearances_1 = require("./appearances"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a dropdown field of a [[PDFForm]]. + * + * [[PDFDropdown]] fields are interactive text boxes that display a single + * element (the currently selected value). The purpose of a dropdown is to + * enable users to select a single option from a set of possible options. Users + * can click on a dropdown to view the full list of options it provides. + * Clicking on an option in the list will cause it to be selected and displayed + * in the dropdown's text box. Some dropdowns allow users to enter text + * directly into the box from their keyboard, rather than only being allowed to + * choose an option from the list (see [[PDFDropdown.isEditable]]). + */ +var PDFDropdown = /** @class */ (function (_super) { + tslib_1.__extends(PDFDropdown, _super); + function PDFDropdown(acroComboBox, ref, doc) { + var _this = _super.call(this, acroComboBox, ref, doc) || this; + utils_1.assertIs(acroComboBox, 'acroComboBox', [ + [core_1.PDFAcroComboBox, 'PDFAcroComboBox'], + ]); + _this.acroField = acroComboBox; + return _this; + } + /** + * Get the list of available options for this dropdown. These options will be + * displayed to users who click on this dropdown in a PDF reader. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * const options = dropdown.getOptions() + * console.log('Dropdown options:', options) + * ``` + * @returns The options for this dropdown. + */ + PDFDropdown.prototype.getOptions = function () { + var rawOptions = this.acroField.getOptions(); + var options = new Array(rawOptions.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a = rawOptions[idx], display = _a.display, value = _a.value; + options[idx] = (display !== null && display !== void 0 ? display : value).decodeText(); + } + return options; + }; + /** + * Get the selected options for this dropdown. These are the values that were + * selected by a human user via a PDF reader, or programatically via + * software. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * const selections = dropdown.getSelected() + * console.log('Dropdown selections:', selections) + * ``` + * > **NOTE:** Note that PDF readers only display one selected option when + * > rendering dropdowns. However, the PDF specification does allow for + * > multiple values to be selected in a dropdown. As such, the `pdf-lib` + * > API supports this. However, in most cases the array returned by this + * > method will contain only a single element (or no elements). + * @returns The selected options in this dropdown. + */ + PDFDropdown.prototype.getSelected = function () { + var values = this.acroField.getValues(); + var selected = new Array(values.length); + for (var idx = 0, len = values.length; idx < len; idx++) { + selected[idx] = values[idx].decodeText(); + } + return selected; + }; + /** + * Set the list of options that are available for this dropdown. These are + * the values that will be available for users to select when they view this + * dropdown in a PDF reader. Note that preexisting options for this dropdown + * will be removed. Only the values passed as `options` will be available to + * select. + * For example: + * ```js + * const dropdown = form.getDropdown('planets.dropdown') + * dropdown.setOptions(['Earth', 'Mars', 'Pluto', 'Venus']) + * ``` + * @param options The options that should be available in this dropdown. + */ + PDFDropdown.prototype.setOptions = function (options) { + utils_1.assertIs(options, 'options', [Array]); + var optionObjects = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + optionObjects[idx] = { value: core_1.PDFHexString.fromText(options[idx]) }; + } + this.acroField.setOptions(optionObjects); + }; + /** + * Add to the list of options that are available for this dropdown. Users + * will be able to select these values in a PDF reader. In addition to the + * values passed as `options`, any preexisting options for this dropdown will + * still be available for users to select. + * For example: + * ```js + * const dropdown = form.getDropdown('rockets.dropdown') + * dropdown.addOptions(['Saturn IV', 'Falcon Heavy']) + * ``` + * @param options New options that should be available in this dropdown. + */ + PDFDropdown.prototype.addOptions = function (options) { + utils_1.assertIs(options, 'options', ['string', Array]); + var optionsArr = Array.isArray(options) ? options : [options]; + var existingOptions = this.acroField.getOptions(); + var newOptions = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + newOptions[idx] = { value: core_1.PDFHexString.fromText(optionsArr[idx]) }; + } + this.acroField.setOptions(existingOptions.concat(newOptions)); + }; + /** + * Select one or more values for this dropdown. This operation is analogous + * to a human user opening the dropdown in a PDF reader and clicking on a + * value to select it. This method will update the underlying state of the + * dropdown to indicate which values have been selected. PDF libraries and + * readers will be able to extract these values from the saved document and + * determine which values were selected. + * + * For example: + * ```js + * const dropdown = form.getDropdown('best.superhero.dropdown') + * dropdown.select('One Punch Man') + * ``` + * + * This method will mark this dropdown as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the selected option inside the widgets of this dropdown. + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if the selected option for this field + * contains characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFDropdown.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * Selecting an option that does not exist in this dropdown's option list + * (see [[PDFDropdown.getOptions]]) will enable editing on this dropdown + * (see [[PDFDropdown.enableEditing]]). + * + * > **NOTE:** PDF readers only display one selected option when rendering + * > dropdowns. However, the PDF specification does allow for multiple values + * > to be selected in a dropdown. As such, the `pdf-lib` API supports this. + * > However, it is not recommended to select more than one value with this + * > method, as only one will be visible. [[PDFOptionList]] fields are better + * > suited for displaying multiple selected values. + * + * @param options The options to be selected. + * @param merge Whether or not existing selections should be preserved. + */ + PDFDropdown.prototype.select = function (options, merge) { + if (merge === void 0) { merge = false; } + utils_1.assertIs(options, 'options', ['string', Array]); + utils_1.assertIs(merge, 'merge', ['boolean']); + var optionsArr = Array.isArray(options) ? options : [options]; + var validOptions = this.getOptions(); + var hasCustomOption = optionsArr.find(function (option) { return !validOptions.includes(option); }); + if (hasCustomOption) + this.enableEditing(); + this.markAsDirty(); + if (optionsArr.length > 1 || (optionsArr.length === 1 && merge)) { + this.enableMultiselect(); + } + var values = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + values[idx] = core_1.PDFHexString.fromText(optionsArr[idx]); + } + if (merge) { + var existingValues = this.acroField.getValues(); + this.acroField.setValues(existingValues.concat(values)); + } + else { + this.acroField.setValues(values); + } + }; + /** + * Clear all selected values for this dropdown. This operation is equivalent + * to selecting an empty list. This method will update the underlying state + * of the dropdown to indicate that no values have been selected. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.clear() + * ``` + * This method will mark this text field as dirty. See [[PDFDropdown.select]] + * for more details about what this means. + */ + PDFDropdown.prototype.clear = function () { + this.markAsDirty(); + this.acroField.setValues([]); + }; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this dropdown. Font sizes may + * be integer or floating point numbers. Supplying a negative font size will + * cause this method to throw an error. + * + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.setFontSize(4) + * dropdown.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + PDFDropdown.prototype.setFontSize = function (fontSize) { + utils_1.assertPositive(fontSize, 'fontSize'); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + /** + * Returns `true` if users are allowed to edit the selected value of this + * dropdown directly and are not constrained by the list of available + * options. See [[PDFDropdown.enableEditing]] and + * [[PDFDropdown.disableEditing]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isEditable()) console.log('Editing is enabled') + * ``` + * @returns Whether or not this dropdown is editable. + */ + PDFDropdown.prototype.isEditable = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.Edit); + }; + /** + * Allow users to edit the selected value of this dropdown in PDF readers + * with their keyboard. This means that the selected value of this dropdown + * will not be constrained by the list of available options. However, if this + * dropdown has any available options, users will still be allowed to select + * from that list. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableEditing() + * ``` + */ + PDFDropdown.prototype.enableEditing = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Edit, true); + }; + /** + * Do not allow users to edit the selected value of this dropdown in PDF + * readers with their keyboard. This will constrain the selected value of + * this dropdown to the list of available options. Users will only be able + * to select an option from that list. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableEditing() + * ``` + */ + PDFDropdown.prototype.disableEditing = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Edit, false); + }; + /** + * Returns `true` if the option list of this dropdown is always displayed + * in alphabetical order, irrespective of the order in which the options + * were added to the dropdown. See [[PDFDropdown.enableSorting]] and + * [[PDFDropdown.disableSorting]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSorted()) console.log('Sorting is enabled') + * ``` + * @returns Whether or not this dropdown's options are sorted. + */ + PDFDropdown.prototype.isSorted = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.Sort); + }; + /** + * Always display the option list of this dropdown in alphabetical order, + * irrespective of the order in which the options were added to this dropdown. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSorting() + * ``` + */ + PDFDropdown.prototype.enableSorting = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Sort, true); + }; + /** + * Do not always display the option list of this dropdown in alphabetical + * order. Instead, display the options in whichever order they were added + * to the list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSorting() + * ``` + */ + PDFDropdown.prototype.disableSorting = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Sort, false); + }; + /** + * Returns `true` if multiple options can be selected from this dropdown's + * option list. See [[PDFDropdown.enableMultiselect]] and + * [[PDFDropdown.disableMultiselect]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isMultiselect()) console.log('Multiselect is enabled') + * ``` + * @returns Whether or not multiple options can be selected. + */ + PDFDropdown.prototype.isMultiselect = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.MultiSelect); + }; + /** + * Allow users to select more than one option from this dropdown's option + * list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableMultiselect() + * ``` + */ + PDFDropdown.prototype.enableMultiselect = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.MultiSelect, true); + }; + /** + * Do not allow users to select more than one option from this dropdown's + * option list. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableMultiselect() + * ``` + */ + PDFDropdown.prototype.disableMultiselect = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.MultiSelect, false); + }; + /** + * Returns `true` if the selected option should be spell checked by PDF + * readers. Spell checking will only be performed if this dropdown allows + * editing (see [[PDFDropdown.isEditable]]). See + * [[PDFDropdown.enableSpellChecking]] and + * [[PDFDropdown.disableSpellChecking]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSpellChecked()) console.log('Spell checking is enabled') + * ``` + * @returns Whether or not this dropdown can be spell checked. + */ + PDFDropdown.prototype.isSpellChecked = function () { + return !this.acroField.hasFlag(core_1.AcroChoiceFlags.DoNotSpellCheck); + }; + /** + * Allow PDF readers to spell check the selected option of this dropdown. + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSpellChecking() + * ``` + */ + PDFDropdown.prototype.enableSpellChecking = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.DoNotSpellCheck, false); + }; + /** + * Do not allow PDF readers to spell check the selected option of this + * dropdown. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSpellChecking() + * ``` + */ + PDFDropdown.prototype.disableSpellChecking = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.DoNotSpellCheck, true); + }; + /** + * Returns `true` if the option selected by a user is stored, or "committed", + * when the user clicks the option. The alternative is that the user's + * selection is stored when the user leaves this dropdown field (by clicking + * outside of it - on another field, for example). See + * [[PDFDropdown.enableSelectOnClick]] and + * [[PDFDropdown.disableSelectOnClick]]. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.isSelectOnClick()) console.log('Select on click is enabled') + * ``` + * @returns Whether or not options are selected immediately after they are + * clicked. + */ + PDFDropdown.prototype.isSelectOnClick = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.CommitOnSelChange); + }; + /** + * Store the option selected by a user immediately after the user clicks the + * option. Do not wait for the user to leave this dropdown field (by clicking + * outside of it - on another field, for example). For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.enableSelectOnClick() + * ``` + */ + PDFDropdown.prototype.enableSelectOnClick = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.CommitOnSelChange, true); + }; + /** + * Wait to store the option selected by a user until they leave this dropdown + * field (by clicking outside of it - on another field, for example). + * For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.disableSelectOnClick() + * ``` + */ + PDFDropdown.prototype.disableSelectOnClick = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.CommitOnSelChange, false); + }; + /** + * Show this dropdown on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const dropdown = form.createDropdown('best.gundam') + * dropdown.setOptions(['Exia', 'Dynames']) + * dropdown.select('Exia') + * + * dropdown.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this dropdown field. + * @param page The page to which this dropdown widget should be added. + * @param options The options to be used when adding this dropdown widget. + */ + PDFDropdown.prototype.addToPage = function (page, options) { + var _a, _b, _c, _d, _e, _f, _g; + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!('textColor' in options)) + options.textColor = colors_1.rgb(0, 0, 0); + if (!('backgroundColor' in options)) + options.backgroundColor = colors_1.rgb(1, 1, 1); + if (!('borderColor' in options)) + options.borderColor = colors_1.rgb(0, 0, 0); + if (!('borderWidth' in options)) + options.borderWidth = 1; + // Create a widget for this dropdown + var widget = this.createWidget({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : 0, + y: (_b = options.y) !== null && _b !== void 0 ? _b : 0, + width: (_c = options.width) !== null && _c !== void 0 ? _c : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + hidden: options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + this.acroField.addWidget(widgetRef); + // Set appearance streams for widget + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if this dropdown has been marked as dirty, or if any of + * this dropdown's widgets do not have an appearance stream. For example: + * ```js + * const dropdown = form.getDropdown('some.dropdown.field') + * if (dropdown.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this dropdown needs an appearance update. + */ + PDFDropdown.prototype.needsAppearancesUpdate = function () { + var _a; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof core_1.PDFStream; + if (!hasAppearances) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this dropdown's widgets using + * the default appearance provider for dropdowns. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + PDFDropdown.prototype.defaultUpdateAppearances = function (font) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + this.updateAppearances(font); + }; + /** + * Update the appearance streams for each of this dropdown's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for dropdowns will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const dropdown = form.getDropdown('some.dropdown.field') + * dropdown.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawTextField(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFDropdown.prototype.updateAppearances = function (font, provider) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + // getOption(index: number): string {} + // getSelectedIndices(): number[] {} + // removeOptions(option: string | string[]) {} + // removeIndices(option: number[]) {} + // deselect(options: string | string[]) {} + // deselectIndices(optionIndices: number[]) {} + PDFDropdown.prototype.updateWidgetAppearance = function (widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultDropdownAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getDropdown]] method, which will create an + * > instance of [[PDFDropdown]] for you. + * + * Create an instance of [[PDFDropdown]] from an existing acroComboBox and ref + * + * @param acroComboBox The underlying `PDFAcroComboBox` for this dropdown. + * @param ref The unique reference for this dropdown. + * @param doc The document to which this dropdown will belong. + */ + PDFDropdown.of = function (acroComboBox, ref, doc) { + return new PDFDropdown(acroComboBox, ref, doc); + }; + return PDFDropdown; +}(PDFField_1.default)); +exports.default = PDFDropdown; +//# sourceMappingURL=PDFDropdown.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFDropdown.js.map b/cjs/api/form/PDFDropdown.js.map new file mode 100644 index 000000000..349aa3c7a --- /dev/null +++ b/cjs/api/form/PDFDropdown.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDropdown.js","sourceRoot":"","sources":["../../../src/api/form/PDFDropdown.ts"],"names":[],"mappings":";;;AACA,+DAAsC;AACtC,+DAAsC;AACtC,6DAG+B;AAC/B,6CAIkC;AAClC,oCAAqC;AACrC,0CAA4C;AAE5C,mCAQkB;AAClB,qCAAwE;AAExE;;;;;;;;;;;GAWG;AACH;IAAyC,uCAAQ;IAkB/C,qBACE,YAA6B,EAC7B,GAAW,EACX,GAAgB;QAHlB,YAKE,kBAAM,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,SAO9B;QALC,gBAAQ,CAAC,YAAY,EAAE,cAAc,EAAE;YACrC,CAAC,sBAAe,EAAE,iBAAiB,CAAC;SACrC,CAAC,CAAC;QAEH,KAAI,CAAC,SAAS,GAAG,YAAY,CAAC;;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,gCAAU,GAAV;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAE/C,IAAM,OAAO,GAAG,IAAI,KAAK,CAAS,UAAU,CAAC,MAAM,CAAC,CAAC;QACrD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAClD,IAAA,KAAqB,UAAU,CAAC,GAAG,CAAC,EAAlC,OAAO,aAAA,EAAE,KAAK,WAAoB,CAAC;YAC3C,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AAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,sCAAsC;IACtC,oCAAoC;IACpC,8CAA8C;IAC9C,qCAAqC;IACrC,0CAA0C;IAC1C,8CAA8C;IAEtC,4CAAsB,GAA9B,UACE,MAA2B,EAC3B,IAAa,EACb,QAA6C;QAE7C,IAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,+CAAiC,CAAC;QACjE,IAAM,WAAW,GAAG,iCAAmB,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAnmBD;;;;;;;;;;OAUG;IACI,cAAE,GAAG,UAAC,YAA6B,EAAE,GAAW,EAAE,GAAgB;QACvE,OAAA,IAAI,WAAW,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC;IAAvC,CAAuC,CAAC;IAwlB5C,kBAAC;CAAA,AArmBD,CAAyC,kBAAQ,GAqmBhD;kBArmBoB,WAAW"} \ No newline at end of file diff --git a/cjs/api/form/PDFField.d.ts b/cjs/api/form/PDFField.d.ts new file mode 100644 index 000000000..5a987962d --- /dev/null +++ b/cjs/api/form/PDFField.d.ts @@ -0,0 +1,204 @@ +import PDFDocument from "../PDFDocument"; +import PDFFont from "../PDFFont"; +import { AppearanceMapping } from "./appearances"; +import { Color } from "../colors"; +import { Rotation } from "../rotations"; +import { PDFRef, PDFWidgetAnnotation, PDFOperator, PDFName, PDFDict, PDFAcroTerminal } from "../../core"; +import { ImageAlignment } from '../image'; +import PDFImage from '../PDFImage'; +export interface FieldAppearanceOptions { + x?: number; + y?: number; + width?: number; + height?: number; + textColor?: Color; + backgroundColor?: Color; + borderColor?: Color; + borderWidth?: number; + rotate?: Rotation; + font?: PDFFont; + hidden?: boolean; +} +export declare const assertFieldAppearanceOptions: (options?: FieldAppearanceOptions | undefined) => void; +/** + * Represents a field of a [[PDFForm]]. + * + * This class is effectively abstract. All fields in a [[PDFForm]] will + * actually be an instance of a subclass of this class. + * + * Note that each field in a PDF is represented by a single field object. + * However, a given field object may be rendered at multiple locations within + * the document (across one or more pages). The rendering of a field is + * controlled by its widgets. Each widget causes its field to be displayed at a + * particular location in the document. + * + * Most of the time each field in a PDF has only a single widget, and thus is + * only rendered once. However, if a field is rendered multiple times, it will + * have multiple widgets - one for each location it is rendered. + * + * This abstraction of field objects and widgets is defined in the PDF + * specification and dictates how PDF files store fields and where they are + * to be rendered. + */ +export default class PDFField { + /** The low-level PDFAcroTerminal wrapped by this field. */ + readonly acroField: PDFAcroTerminal; + /** The unique reference assigned to this field within the document. */ + readonly ref: PDFRef; + /** The document to which this field belongs. */ + readonly doc: PDFDocument; + protected constructor(acroField: PDFAcroTerminal, ref: PDFRef, doc: PDFDocument); + /** + * Get the fully qualified name of this field. For example: + * ```js + * const fields = form.getFields() + * fields.forEach(field => { + * const name = field.getName() + * console.log('Field name:', name) + * }) + * ``` + * Note that PDF fields are structured as a tree. Each field is the + * descendent of a series of ancestor nodes all the way up to the form node, + * which is always the root of the tree. Each node in the tree (except for + * the form node) has a partial name. Partial names can be composed of any + * unicode characters except a period (`.`). The fully qualified name of a + * field is composed of the partial names of all its ancestors joined + * with periods. This means that splitting the fully qualified name on + * periods and taking the last element of the resulting array will give you + * the partial name of a specific field. + * @returns The fully qualified name of this field. + */ + getName(): string; + /** + * Returns `true` if this field is read only. This means that PDF readers + * will not allow users to interact with the field or change its value. See + * [[PDFField.enableReadOnly]] and [[PDFField.disableReadOnly]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isReadOnly()) console.log('Read only is enabled') + * ``` + * @returns Whether or not this is a read only field. + */ + isReadOnly(): boolean; + /** + * Prevent PDF readers from allowing users to interact with this field or + * change its value. The field will not respond to mouse or keyboard input. + * For example: + * ```js + * const field = form.getField('some.field') + * field.enableReadOnly() + * ``` + * Useful for fields whose values are computed, imported from a database, or + * prefilled by software before being displayed to the user. + */ + enableReadOnly(): void; + /** + * Allow users to interact with this field and change its value in PDF + * readers via mouse and keyboard input. For example: + * ```js + * const field = form.getField('some.field') + * field.disableReadOnly() + * ``` + */ + disableReadOnly(): void; + /** + * Returns `true` if this field must have a value when the form is submitted. + * See [[PDFField.enableRequired]] and [[PDFField.disableRequired]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isRequired()) console.log('Field is required') + * ``` + * @returns Whether or not this field is required. + */ + isRequired(): boolean; + /** + * Require this field to have a value when the form is submitted. + * For example: + * ```js + * const field = form.getField('some.field') + * field.enableRequired() + * ``` + */ + enableRequired(): void; + /** + * Do not require this field to have a value when the form is submitted. + * For example: + * ```js + * const field = form.getField('some.field') + * field.disableRequired() + * ``` + */ + disableRequired(): void; + /** + * Returns `true` if this field's value should be exported when the form is + * submitted. See [[PDFField.enableExporting]] and + * [[PDFField.disableExporting]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isExported()) console.log('Exporting is enabled') + * ``` + * @returns Whether or not this field's value should be exported. + */ + isExported(): boolean; + /** + * Indicate that this field's value should be exported when the form is + * submitted in a PDF reader. For example: + * ```js + * const field = form.getField('some.field') + * field.enableExporting() + * ``` + */ + enableExporting(): void; + /** + * Indicate that this field's value should **not** be exported when the form + * is submitted in a PDF reader. For example: + * ```js + * const field = form.getField('some.field') + * field.disableExporting() + * ``` + */ + disableExporting(): void; + /** @ignore */ + needsAppearancesUpdate(): boolean; + /** @ignore */ + defaultUpdateAppearances(_font: PDFFont): void; + protected markAsDirty(): void; + protected markAsClean(): void; + protected isDirty(): boolean; + protected createWidget(options: { + x: number; + y: number; + width: number; + height: number; + textColor?: Color; + backgroundColor?: Color; + borderColor?: Color; + borderWidth: number; + rotate: Rotation; + caption?: string; + hidden?: boolean; + page?: PDFRef; + }): PDFWidgetAnnotation; + protected updateWidgetAppearanceWithFont(widget: PDFWidgetAnnotation, font: PDFFont, { normal, rollover, down }: AppearanceMapping): void; + protected updateOnOffWidgetAppearance(widget: PDFWidgetAnnotation, onValue: PDFName, { normal, rollover, down, }: AppearanceMapping<{ + on: PDFOperator[]; + off: PDFOperator[]; + }>): void; + protected updateWidgetAppearances(widget: PDFWidgetAnnotation, { normal, rollover, down }: AppearanceMapping): void; + private createAppearanceStream; + /** + * Create a FormXObject of the supplied image and add it to context. + * The FormXObject size is calculated based on the widget (including + * the alignment). + * @param widget The widget that should display the image. + * @param alignment The alignment of the image. + * @param image The image that should be displayed. + * @returns The ref for the FormXObject that was added to the context. + */ + protected createImageAppearanceStream(widget: PDFWidgetAnnotation, image: PDFImage, alignment: ImageAlignment): PDFRef; + private createAppearanceDict; +} +//# sourceMappingURL=PDFField.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFField.d.ts.map b/cjs/api/form/PDFField.d.ts.map new file mode 100644 index 000000000..9cfbd5664 --- /dev/null +++ b/cjs/api/form/PDFField.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFField.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFField.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,EAAE,iBAAiB,EAAE,sBAAiC;AAC7D,OAAO,EAAE,KAAK,EAAsC,kBAAuB;AAC3E,OAAO,EACL,QAAQ,EAMT,qBAA0B;AAE3B,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,OAAO,EACP,OAAO,EAGP,eAAe,EAEhB,mBAAiB;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,QAAQ,MAAM,aAAa,CA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AAmB,EAC3B,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,cAAc,GACxB,MAAM;IAyDT,OAAO,CAAC,oBAAoB;CAgB7B"} \ No newline at end of file diff --git a/cjs/api/form/PDFField.js b/cjs/api/form/PDFField.js new file mode 100644 index 000000000..a70d96d8c --- /dev/null +++ b/cjs/api/form/PDFField.js @@ -0,0 +1,384 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertFieldAppearanceOptions = void 0; +var tslib_1 = require("tslib"); +var PDFDocument_1 = tslib_1.__importDefault(require("../PDFDocument")); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +var image_1 = require("../image"); +var operations_1 = require("../operations"); +exports.assertFieldAppearanceOptions = function (options) { + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.x, 'options.x', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.y, 'options.y', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.width, 'options.width', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.height, 'options.height', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.textColor, 'options.textColor', [ + [Object, 'Color'], + ]); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.backgroundColor, 'options.backgroundColor', [ + [Object, 'Color'], + ]); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderColor, 'options.borderColor', [ + [Object, 'Color'], + ]); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderWidth, 'options.borderWidth', ['number']); + utils_1.assertOrUndefined(options === null || options === void 0 ? void 0 : options.rotate, 'options.rotate', [[Object, 'Rotation']]); +}; +/** + * Represents a field of a [[PDFForm]]. + * + * This class is effectively abstract. All fields in a [[PDFForm]] will + * actually be an instance of a subclass of this class. + * + * Note that each field in a PDF is represented by a single field object. + * However, a given field object may be rendered at multiple locations within + * the document (across one or more pages). The rendering of a field is + * controlled by its widgets. Each widget causes its field to be displayed at a + * particular location in the document. + * + * Most of the time each field in a PDF has only a single widget, and thus is + * only rendered once. However, if a field is rendered multiple times, it will + * have multiple widgets - one for each location it is rendered. + * + * This abstraction of field objects and widgets is defined in the PDF + * specification and dictates how PDF files store fields and where they are + * to be rendered. + */ +var PDFField = /** @class */ (function () { + function PDFField(acroField, ref, doc) { + utils_1.assertIs(acroField, 'acroField', [[core_1.PDFAcroTerminal, 'PDFAcroTerminal']]); + utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + this.acroField = acroField; + this.ref = ref; + this.doc = doc; + } + /** + * Get the fully qualified name of this field. For example: + * ```js + * const fields = form.getFields() + * fields.forEach(field => { + * const name = field.getName() + * console.log('Field name:', name) + * }) + * ``` + * Note that PDF fields are structured as a tree. Each field is the + * descendent of a series of ancestor nodes all the way up to the form node, + * which is always the root of the tree. Each node in the tree (except for + * the form node) has a partial name. Partial names can be composed of any + * unicode characters except a period (`.`). The fully qualified name of a + * field is composed of the partial names of all its ancestors joined + * with periods. This means that splitting the fully qualified name on + * periods and taking the last element of the resulting array will give you + * the partial name of a specific field. + * @returns The fully qualified name of this field. + */ + PDFField.prototype.getName = function () { + var _a; + return (_a = this.acroField.getFullyQualifiedName()) !== null && _a !== void 0 ? _a : ''; + }; + /** + * Returns `true` if this field is read only. This means that PDF readers + * will not allow users to interact with the field or change its value. See + * [[PDFField.enableReadOnly]] and [[PDFField.disableReadOnly]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isReadOnly()) console.log('Read only is enabled') + * ``` + * @returns Whether or not this is a read only field. + */ + PDFField.prototype.isReadOnly = function () { + return this.acroField.hasFlag(core_1.AcroFieldFlags.ReadOnly); + }; + /** + * Prevent PDF readers from allowing users to interact with this field or + * change its value. The field will not respond to mouse or keyboard input. + * For example: + * ```js + * const field = form.getField('some.field') + * field.enableReadOnly() + * ``` + * Useful for fields whose values are computed, imported from a database, or + * prefilled by software before being displayed to the user. + */ + PDFField.prototype.enableReadOnly = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.ReadOnly, true); + }; + /** + * Allow users to interact with this field and change its value in PDF + * readers via mouse and keyboard input. For example: + * ```js + * const field = form.getField('some.field') + * field.disableReadOnly() + * ``` + */ + PDFField.prototype.disableReadOnly = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.ReadOnly, false); + }; + /** + * Returns `true` if this field must have a value when the form is submitted. + * See [[PDFField.enableRequired]] and [[PDFField.disableRequired]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isRequired()) console.log('Field is required') + * ``` + * @returns Whether or not this field is required. + */ + PDFField.prototype.isRequired = function () { + return this.acroField.hasFlag(core_1.AcroFieldFlags.Required); + }; + /** + * Require this field to have a value when the form is submitted. + * For example: + * ```js + * const field = form.getField('some.field') + * field.enableRequired() + * ``` + */ + PDFField.prototype.enableRequired = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.Required, true); + }; + /** + * Do not require this field to have a value when the form is submitted. + * For example: + * ```js + * const field = form.getField('some.field') + * field.disableRequired() + * ``` + */ + PDFField.prototype.disableRequired = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.Required, false); + }; + /** + * Returns `true` if this field's value should be exported when the form is + * submitted. See [[PDFField.enableExporting]] and + * [[PDFField.disableExporting]]. + * For example: + * ```js + * const field = form.getField('some.field') + * if (field.isExported()) console.log('Exporting is enabled') + * ``` + * @returns Whether or not this field's value should be exported. + */ + PDFField.prototype.isExported = function () { + return !this.acroField.hasFlag(core_1.AcroFieldFlags.NoExport); + }; + /** + * Indicate that this field's value should be exported when the form is + * submitted in a PDF reader. For example: + * ```js + * const field = form.getField('some.field') + * field.enableExporting() + * ``` + */ + PDFField.prototype.enableExporting = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.NoExport, false); + }; + /** + * Indicate that this field's value should **not** be exported when the form + * is submitted in a PDF reader. For example: + * ```js + * const field = form.getField('some.field') + * field.disableExporting() + * ``` + */ + PDFField.prototype.disableExporting = function () { + this.acroField.setFlagTo(core_1.AcroFieldFlags.NoExport, true); + }; + /** @ignore */ + PDFField.prototype.needsAppearancesUpdate = function () { + throw new core_1.MethodNotImplementedError(this.constructor.name, 'needsAppearancesUpdate'); + }; + /** @ignore */ + PDFField.prototype.defaultUpdateAppearances = function (_font) { + throw new core_1.MethodNotImplementedError(this.constructor.name, 'defaultUpdateAppearances'); + }; + PDFField.prototype.markAsDirty = function () { + this.doc.getForm().markFieldAsDirty(this.ref); + }; + PDFField.prototype.markAsClean = function () { + this.doc.getForm().markFieldAsClean(this.ref); + }; + PDFField.prototype.isDirty = function () { + return this.doc.getForm().fieldIsDirty(this.ref); + }; + PDFField.prototype.createWidget = function (options) { + var _a; + var textColor = options.textColor; + var backgroundColor = options.backgroundColor; + var borderColor = options.borderColor; + var borderWidth = options.borderWidth; + var degreesAngle = rotations_1.toDegrees(options.rotate); + var caption = options.caption; + var x = options.x; + var y = options.y; + var width = options.width + borderWidth; + var height = options.height + borderWidth; + var hidden = Boolean(options.hidden); + var pageRef = options.page; + utils_1.assertMultiple(degreesAngle, 'degreesAngle', 90); + // Create a widget for this field + var widget = core_1.PDFWidgetAnnotation.create(this.doc.context, this.ref); + // Set widget properties + var rect = rotations_1.rotateRectangle({ x: x, y: y, width: width, height: height }, borderWidth, degreesAngle); + widget.setRectangle(rect); + if (pageRef) + widget.setP(pageRef); + var ac = widget.getOrCreateAppearanceCharacteristics(); + if (backgroundColor) { + ac.setBackgroundColor(colors_1.colorToComponents(backgroundColor)); + } + ac.setRotation(degreesAngle); + if (caption) + ac.setCaptions({ normal: caption }); + if (borderColor) + ac.setBorderColor(colors_1.colorToComponents(borderColor)); + var bs = widget.getOrCreateBorderStyle(); + if (borderWidth !== undefined) + bs.setWidth(borderWidth); + widget.setFlagTo(core_1.AnnotationFlags.Print, true); + widget.setFlagTo(core_1.AnnotationFlags.Hidden, hidden); + widget.setFlagTo(core_1.AnnotationFlags.Invisible, false); + // Set acrofield properties + if (textColor) { + var da = (_a = this.acroField.getDefaultAppearance()) !== null && _a !== void 0 ? _a : ''; + var newDa = da + '\n' + colors_1.setFillingColor(textColor).toString(); + this.acroField.setDefaultAppearance(newDa); + } + return widget; + }; + PDFField.prototype.updateWidgetAppearanceWithFont = function (widget, font, _a) { + var normal = _a.normal, rollover = _a.rollover, down = _a.down; + this.updateWidgetAppearances(widget, { + normal: this.createAppearanceStream(widget, normal, font), + rollover: rollover && this.createAppearanceStream(widget, rollover, font), + down: down && this.createAppearanceStream(widget, down, font), + }); + }; + PDFField.prototype.updateOnOffWidgetAppearance = function (widget, onValue, _a) { + var normal = _a.normal, rollover = _a.rollover, down = _a.down; + this.updateWidgetAppearances(widget, { + normal: this.createAppearanceDict(widget, normal, onValue), + rollover: rollover && this.createAppearanceDict(widget, rollover, onValue), + down: down && this.createAppearanceDict(widget, down, onValue), + }); + }; + PDFField.prototype.updateWidgetAppearances = function (widget, _a) { + var normal = _a.normal, rollover = _a.rollover, down = _a.down; + widget.setNormalAppearance(normal); + if (rollover) { + widget.setRolloverAppearance(rollover); + } + else { + widget.removeRolloverAppearance(); + } + if (down) { + widget.setDownAppearance(down); + } + else { + widget.removeDownAppearance(); + } + }; + // // TODO: Do we need to do this...? + // private foo(font: PDFFont, dict: PDFDict) { + // if (!dict.lookup(PDFName.of('DR'))) { + // dict.set(PDFName.of('DR'), dict.context.obj({})); + // } + // const DR = dict.lookup(PDFName.of('DR'), PDFDict); + // if (!DR.lookup(PDFName.of('Font'))) { + // DR.set(PDFName.of('Font'), dict.context.obj({})); + // } + // const Font = DR.lookup(PDFName.of('Font'), PDFDict); + // Font.set(PDFName.of(font.name), font.ref); + // } + PDFField.prototype.createAppearanceStream = function (widget, appearance, font) { + var _a; + var context = this.acroField.dict.context; + var _b = widget.getRectangle(), width = _b.width, height = _b.height; + // TODO: Do we need to do this...? + // if (font) { + // this.foo(font, widget.dict); + // this.foo(font, this.doc.getForm().acroForm.dict); + // } + // END TODO + var Resources = font && { Font: (_a = {}, _a[font.name] = font.ref, _a) }; + var stream = context.formXObject(appearance, { + Resources: Resources, + BBox: context.obj([0, 0, width, height]), + Matrix: context.obj([1, 0, 0, 1, 0, 0]), + }); + var streamRef = context.register(stream); + return streamRef; + }; + /** + * Create a FormXObject of the supplied image and add it to context. + * The FormXObject size is calculated based on the widget (including + * the alignment). + * @param widget The widget that should display the image. + * @param alignment The alignment of the image. + * @param image The image that should be displayed. + * @returns The ref for the FormXObject that was added to the context. + */ + PDFField.prototype.createImageAppearanceStream = function (widget, image, alignment) { + // NOTE: This implementation doesn't handle image borders. + // NOTE: Acrobat seems to resize the image (maybe even skewing its aspect + // ratio) to fit perfectly within the widget's rectangle. This method + // does not currently do that. Should there be an option for that? + var _a; + var _b; + var context = this.acroField.dict.context; + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var adj = rotations_1.adjustDimsForRotation(rectangle, rotation); + var imageDims = image.scaleToFit(adj.width - borderWidth * 2, adj.height - borderWidth * 2); + // Support borders on images and maybe other properties + var options = { + x: borderWidth, + y: borderWidth, + width: imageDims.width, + height: imageDims.height, + // + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }; + if (alignment === image_1.ImageAlignment.Center) { + options.x += (adj.width - borderWidth * 2) / 2 - imageDims.width / 2; + options.y += (adj.height - borderWidth * 2) / 2 - imageDims.height / 2; + } + else if (alignment === image_1.ImageAlignment.Right) { + options.x = adj.width - borderWidth - imageDims.width; + options.y = adj.height - borderWidth - imageDims.height; + } + var imageName = this.doc.context.addRandomSuffix('Image', 10); + var appearance = tslib_1.__spreadArrays(rotate, operations_1.drawImage(imageName, options)); + //////////// + var Resources = { XObject: (_a = {}, _a[imageName] = image.ref, _a) }; + var stream = context.formXObject(appearance, { + Resources: Resources, + BBox: context.obj([0, 0, rectangle.width, rectangle.height]), + Matrix: context.obj([1, 0, 0, 1, 0, 0]), + }); + return context.register(stream); + }; + PDFField.prototype.createAppearanceDict = function (widget, appearance, onValue) { + var context = this.acroField.dict.context; + var onStreamRef = this.createAppearanceStream(widget, appearance.on); + var offStreamRef = this.createAppearanceStream(widget, appearance.off); + var appearanceDict = context.obj({}); + appearanceDict.set(onValue, onStreamRef); + appearanceDict.set(core_1.PDFName.of('Off'), offStreamRef); + return appearanceDict; + }; + return PDFField; +}()); +exports.default = PDFField; +//# sourceMappingURL=PDFField.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFField.js.map b/cjs/api/form/PDFField.js.map new file mode 100644 index 000000000..94c63390e --- /dev/null +++ b/cjs/api/form/PDFField.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFField.js","sourceRoot":"","sources":["../../../src/api/form/PDFField.ts"],"names":[],"mappings":";;;;AAAA,uEAA8C;AAG9C,oCAA2E;AAC3E,0CAO2B;AAE3B,mCAUkB;AAClB,qCAAwE;AACxE,kCAA0C;AAE1C,4CAAyD;AAgB5C,QAAA,4BAA4B,GAAG,UAC1C,OAAgC;IAEhC,yBAAiB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,CAAC,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,yBAAiB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,CAAC,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,yBAAiB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EAAE,eAAe,EAAE,CAAC,QAAQ,CA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form/PDFForm.d.ts @@ -0,0 +1,426 @@ +import PDFDocument from "../PDFDocument"; +import PDFField from "./PDFField"; +import PDFButton from "./PDFButton"; +import PDFCheckBox from "./PDFCheckBox"; +import PDFDropdown from "./PDFDropdown"; +import PDFOptionList from "./PDFOptionList"; +import PDFRadioGroup from "./PDFRadioGroup"; +import PDFSignature from "./PDFSignature"; +import PDFTextField from "./PDFTextField"; +import PDFFont from "../PDFFont"; +import { PDFAcroForm, PDFRef } from "../../core"; +export interface FlattenOptions { + updateFieldAppearances: boolean; + removeField?: boolean; +} +/** + * Represents the interactive form of a [[PDFDocument]]. + * + * Interactive forms (sometimes called _AcroForms_) are collections of fields + * designed to gather information from a user. A PDF document may contains any + * number of fields that appear on various pages, all of which make up a single, + * global interactive form spanning the entire document. This means that + * instances of [[PDFDocument]] shall contain at most one [[PDFForm]]. + * + * The fields of an interactive form are represented by [[PDFField]] instances. + */ +export default class PDFForm { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.getForm]] method, which will create an + * > instance of [[PDFForm]] for you. + * + * Create an instance of [[PDFForm]] from an existing acroForm and embedder + * + * @param acroForm The underlying `PDFAcroForm` for this form. + * @param doc The document to which the form will belong. + */ + static of: (acroForm: PDFAcroForm, doc: PDFDocument) => PDFForm; + /** The low-level PDFAcroForm wrapped by this form. */ + readonly acroForm: PDFAcroForm; + /** The document to which this form belongs. */ + readonly doc: PDFDocument; + private readonly dirtyFields; + private readonly defaultFontCache; + private constructor(); + /** + * Returns `true` if this [[PDFForm]] has XFA data. Most PDFs with form + * fields do not use XFA as it is not widely supported by PDF readers. + * + * > `pdf-lib` does not support creation, modification, or reading of XFA + * > fields. + * + * For example: + * ```js + * const form = pdfDoc.getForm() + * if (form.hasXFA()) console.log('PDF has XFA data') + * ``` + * @returns Whether or not this form has XFA data. + */ + hasXFA(): boolean; + /** + * Disconnect the XFA data from this [[PDFForm]] (if any exists). This will + * force readers to fallback to standard fields if the [[PDFDocument]] + * contains any. For example: + * + * For example: + * ```js + * const form = pdfDoc.getForm() + * form.deleteXFA() + * ``` + */ + deleteXFA(): void; + /** + * Get all fields contained in this [[PDFForm]]. For example: + * ```js + * const form = pdfDoc.getForm() + * const fields = form.getFields() + * fields.forEach(field => { + * const type = field.constructor.name + * const name = field.getName() + * console.log(`${type}: ${name}`) + * }) + * ``` + * @returns An array of all fields in this form. + */ + getFields(): PDFField[]; + /** + * Get the field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const field = form.getFieldMaybe('Page1.Foo.Bar[0]') + * if (field) console.log('Field exists!') + * ``` + * @param name A fully qualified field name. + * @returns The field with the specified name, if one exists. + */ + getFieldMaybe(name: string): PDFField | undefined; + /** + * Get the field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('Page1.Foo.Bar[0]') + * ``` + * If no field exists with the provided name, an error will be thrown. + * @param name A fully qualified field name. + * @returns The field with the specified name. + */ + getField(name: string): PDFField; + /** + * Get the button field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const button = form.getButton('Page1.Foo.Button[0]') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a button. + * @param name A fully qualified button name. + * @returns The button with the specified name. + */ + getButton(name: string): PDFButton; + /** + * Get the check box field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const checkBox = form.getCheckBox('Page1.Foo.CheckBox[0]') + * checkBox.check() + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a check box. + * @param name A fully qualified check box name. + * @returns The check box with the specified name. + */ + getCheckBox(name: string): PDFCheckBox; + /** + * Get the dropdown field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const dropdown = form.getDropdown('Page1.Foo.Dropdown[0]') + * const options = dropdown.getOptions() + * dropdown.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a dropdown. + * @param name A fully qualified dropdown name. + * @returns The dropdown with the specified name. + */ + getDropdown(name: string): PDFDropdown; + /** + * Get the option list field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const optionList = form.getOptionList('Page1.Foo.OptionList[0]') + * const options = optionList.getOptions() + * optionList.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not an option list. + * @param name A fully qualified option list name. + * @returns The option list with the specified name. + */ + getOptionList(name: string): PDFOptionList; + /** + * Get the radio group field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const radioGroup = form.getRadioGroup('Page1.Foo.RadioGroup[0]') + * const options = radioGroup.getOptions() + * radioGroup.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a radio group. + * @param name A fully qualified radio group name. + * @returns The radio group with the specified name. + */ + getRadioGroup(name: string): PDFRadioGroup; + /** + * Get the signature field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const signature = form.getSignature('Page1.Foo.Signature[0]') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a signature. + * @param name A fully qualified signature name. + * @returns The signature with the specified name. + */ + getSignature(name: string): PDFSignature; + /** + * Get the text field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const textField = form.getTextField('Page1.Foo.TextField[0]') + * textField.setText('Are you designed to act or to be acted upon?') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a text field. + * @param name A fully qualified text field name. + * @returns The text field with the specified name. + */ + getTextField(name: string): PDFTextField; + /** + * Create a new button field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const button = form.createButton('cool.new.button') + * + * button.addToPage('Do Stuff', font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new button. + * @returns The new button field. + */ + createButton(name: string): PDFButton; + /** + * Create a new check box field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const checkBox = form.createCheckBox('cool.new.checkBox') + * + * checkBox.addToPage(page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new check box. + * @returns The new check box field. + */ + createCheckBox(name: string): PDFCheckBox; + /** + * Create a new dropdown field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const dropdown = form.createDropdown('cool.new.dropdown') + * + * dropdown.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new dropdown. + * @returns The new dropdown field. + */ + createDropdown(name: string): PDFDropdown; + /** + * Create a new option list field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const optionList = form.createOptionList('cool.new.optionList') + * + * optionList.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new option list. + * @returns The new option list field. + */ + createOptionList(name: string): PDFOptionList; + /** + * Create a new radio group field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const radioGroup = form.createRadioGroup('cool.new.radioGroup') + * + * radioGroup.addOptionToPage('is-dog', page, { y: 0 }) + * radioGroup.addOptionToPage('is-cat', page, { y: 75 }) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new radio group. + * @returns The new radio group field. + */ + createRadioGroup(name: string): PDFRadioGroup; + /** + * Create a new text field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const textField = form.createTextField('cool.new.textField') + * + * textField.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new radio group. + * @returns The new radio group field. + */ + createTextField(name: string): PDFTextField; + /** + * Flatten all fields in this [[PDFForm]]. + * + * Flattening a form field will take the current appearance for each of that + * field's widgets and make them part of their page's content stream. All form + * fields and annotations associated are then removed. Note that once a form + * has been flattened its fields can no longer be accessed or edited. + * + * This operation is often used after filling form fields to ensure a + * consistent appearance across different PDF readers and/or printers. + * Another common use case is to copy a template document with form fields + * into another document. In this scenario you would load the template + * document, fill its fields, flatten it, and then copy its pages into the + * recipient document - the filled fields will be copied over. + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * form.flatten(); + * ``` + */ + flatten(options?: FlattenOptions): void; + /** + * Hide a field by removing its reference on pages, + * this is useful during the flattening process particularly + * if we only want to hide the field but preverse the accessibility tag reference to a form field object + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * const ageField = form.getFields().find(x => x.getName() === 'Age'); + * form.hideField(ageField); + * ``` + */ + hideField(field: PDFField): void; + /** + * Remove a field from this [[PDFForm]]. + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * const ageField = form.getFields().find(x => x.getName() === 'Age'); + * form.removeField(ageField); + * ``` + */ + removeField(field: PDFField): void; + /** + * Update the appearance streams for all widgets of all fields in this + * [[PDFForm]]. Appearance streams will only be created for a widget if it + * does not have any existing appearance streams, or the field's value has + * changed (e.g. by calling [[PDFTextField.setText]] or + * [[PDFDropdown.select]]). + * + * For example: + * ```js + * const courier = await pdfDoc.embedFont(StandardFonts.Courier) + * const form = pdfDoc.getForm() + * form.updateFieldAppearances(courier) + * ``` + * + * **IMPORTANT:** The default value for the `font` parameter is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if any fields contain text with + * characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing that as the `font` + * parameter allows you to generate appearance streams with non WinAnsi + * characters (assuming your custom font supports them). + * + * > **NOTE:** The [[PDFDocument.save]] method will call this method to + * > update appearances automatically if a form was accessed via the + * > [[PDFDocument.getForm]] method prior to saving. + * + * @param font Optionally, the font to use when creating new appearances. + */ + updateFieldAppearances(font?: PDFFont): void; + /** + * Mark a field as dirty. This will cause its appearance streams to be + * updated by [[PDFForm.updateFieldAppearances]]. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * form.markFieldAsDirty(field.ref) + * ``` + * @param fieldRef The reference to the field that should be marked. + */ + markFieldAsDirty(fieldRef: PDFRef): void; + /** + * Mark a field as dirty. This will cause its appearance streams to not be + * updated by [[PDFForm.updateFieldAppearances]]. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * form.markFieldAsClean(field.ref) + * ``` + * @param fieldRef The reference to the field that should be marked. + */ + markFieldAsClean(fieldRef: PDFRef): void; + /** + * Returns `true` is the specified field has been marked as dirty. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * if (form.fieldIsDirty(field.ref)) console.log('Field is dirty') + * ``` + * @param fieldRef The reference to the field that should be checked. + * @returns Whether or not the specified field is dirty. + */ + fieldIsDirty(fieldRef: PDFRef): boolean; + getDefaultFont(): PDFFont; + private findWidgetPage; + private findWidgetAppearanceRef; + private findOrCreateNonTerminals; + private findNonTerminal; + private embedDefaultFont; +} +//# sourceMappingURL=PDFForm.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFForm.d.ts.map b/cjs/api/form/PDFForm.d.ts.map new file mode 100644 index 000000000..a03a452d1 --- /dev/null +++ b/cjs/api/form/PDFForm.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFForm.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFForm.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAE9C,OAAO,QAAQ,mBAA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,MAAM,GAAG,OAAO;IAKvC,cAAc;IAId,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,uBAAuB;IA0B/B,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,gBAAgB,CAC8B;CACvD"} \ No newline at end of file diff --git a/cjs/api/form/PDFForm.js b/cjs/api/form/PDFForm.js new file mode 100644 index 000000000..a5d9f3ba7 --- /dev/null +++ b/cjs/api/form/PDFForm.js @@ -0,0 +1,758 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDocument_1 = tslib_1.__importDefault(require("../PDFDocument")); +var PDFButton_1 = tslib_1.__importDefault(require("./PDFButton")); +var PDFCheckBox_1 = tslib_1.__importDefault(require("./PDFCheckBox")); +var PDFDropdown_1 = tslib_1.__importDefault(require("./PDFDropdown")); +var PDFOptionList_1 = tslib_1.__importDefault(require("./PDFOptionList")); +var PDFRadioGroup_1 = tslib_1.__importDefault(require("./PDFRadioGroup")); +var PDFSignature_1 = tslib_1.__importDefault(require("./PDFSignature")); +var PDFTextField_1 = tslib_1.__importDefault(require("./PDFTextField")); +var errors_1 = require("../errors"); +var PDFFont_1 = tslib_1.__importDefault(require("../PDFFont")); +var StandardFonts_1 = require("../StandardFonts"); +var operations_1 = require("../operations"); +var operators_1 = require("../operators"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents the interactive form of a [[PDFDocument]]. + * + * Interactive forms (sometimes called _AcroForms_) are collections of fields + * designed to gather information from a user. A PDF document may contains any + * number of fields that appear on various pages, all of which make up a single, + * global interactive form spanning the entire document. This means that + * instances of [[PDFDocument]] shall contain at most one [[PDFForm]]. + * + * The fields of an interactive form are represented by [[PDFField]] instances. + */ +var PDFForm = /** @class */ (function () { + function PDFForm(acroForm, doc) { + var _this = this; + this.embedDefaultFont = function () { + return _this.doc.embedStandardFont(StandardFonts_1.StandardFonts.Helvetica); + }; + utils_1.assertIs(acroForm, 'acroForm', [[core_1.PDFAcroForm, 'PDFAcroForm']]); + utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]); + this.acroForm = acroForm; + this.doc = doc; + this.dirtyFields = new Set(); + this.defaultFontCache = utils_1.Cache.populatedBy(this.embedDefaultFont); + } + /** + * Returns `true` if this [[PDFForm]] has XFA data. Most PDFs with form + * fields do not use XFA as it is not widely supported by PDF readers. + * + * > `pdf-lib` does not support creation, modification, or reading of XFA + * > fields. + * + * For example: + * ```js + * const form = pdfDoc.getForm() + * if (form.hasXFA()) console.log('PDF has XFA data') + * ``` + * @returns Whether or not this form has XFA data. + */ + PDFForm.prototype.hasXFA = function () { + return this.acroForm.dict.has(core_1.PDFName.of('XFA')); + }; + /** + * Disconnect the XFA data from this [[PDFForm]] (if any exists). This will + * force readers to fallback to standard fields if the [[PDFDocument]] + * contains any. For example: + * + * For example: + * ```js + * const form = pdfDoc.getForm() + * form.deleteXFA() + * ``` + */ + PDFForm.prototype.deleteXFA = function () { + this.acroForm.dict.delete(core_1.PDFName.of('XFA')); + }; + /** + * Get all fields contained in this [[PDFForm]]. For example: + * ```js + * const form = pdfDoc.getForm() + * const fields = form.getFields() + * fields.forEach(field => { + * const type = field.constructor.name + * const name = field.getName() + * console.log(`${type}: ${name}`) + * }) + * ``` + * @returns An array of all fields in this form. + */ + PDFForm.prototype.getFields = function () { + var allFields = this.acroForm.getAllFields(); + var fields = []; + for (var idx = 0, len = allFields.length; idx < len; idx++) { + var _a = allFields[idx], acroField = _a[0], ref = _a[1]; + var field = convertToPDFField(acroField, ref, this.doc); + if (field) + fields.push(field); + } + return fields; + }; + /** + * Get the field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const field = form.getFieldMaybe('Page1.Foo.Bar[0]') + * if (field) console.log('Field exists!') + * ``` + * @param name A fully qualified field name. + * @returns The field with the specified name, if one exists. + */ + PDFForm.prototype.getFieldMaybe = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var fields = this.getFields(); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + if (field.getName() === name) + return field; + } + return undefined; + }; + /** + * Get the field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('Page1.Foo.Bar[0]') + * ``` + * If no field exists with the provided name, an error will be thrown. + * @param name A fully qualified field name. + * @returns The field with the specified name. + */ + PDFForm.prototype.getField = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getFieldMaybe(name); + if (field) + return field; + throw new errors_1.NoSuchFieldError(name); + }; + /** + * Get the button field in this [[PDFForm]] with the given name. For example: + * ```js + * const form = pdfDoc.getForm() + * const button = form.getButton('Page1.Foo.Button[0]') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a button. + * @param name A fully qualified button name. + * @returns The button with the specified name. + */ + PDFForm.prototype.getButton = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFButton_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFButton_1.default, field); + }; + /** + * Get the check box field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const checkBox = form.getCheckBox('Page1.Foo.CheckBox[0]') + * checkBox.check() + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a check box. + * @param name A fully qualified check box name. + * @returns The check box with the specified name. + */ + PDFForm.prototype.getCheckBox = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFCheckBox_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFCheckBox_1.default, field); + }; + /** + * Get the dropdown field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const dropdown = form.getDropdown('Page1.Foo.Dropdown[0]') + * const options = dropdown.getOptions() + * dropdown.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a dropdown. + * @param name A fully qualified dropdown name. + * @returns The dropdown with the specified name. + */ + PDFForm.prototype.getDropdown = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFDropdown_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFDropdown_1.default, field); + }; + /** + * Get the option list field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const optionList = form.getOptionList('Page1.Foo.OptionList[0]') + * const options = optionList.getOptions() + * optionList.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not an option list. + * @param name A fully qualified option list name. + * @returns The option list with the specified name. + */ + PDFForm.prototype.getOptionList = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFOptionList_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFOptionList_1.default, field); + }; + /** + * Get the radio group field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const radioGroup = form.getRadioGroup('Page1.Foo.RadioGroup[0]') + * const options = radioGroup.getOptions() + * radioGroup.select(options[0]) + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a radio group. + * @param name A fully qualified radio group name. + * @returns The radio group with the specified name. + */ + PDFForm.prototype.getRadioGroup = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFRadioGroup_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFRadioGroup_1.default, field); + }; + /** + * Get the signature field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const signature = form.getSignature('Page1.Foo.Signature[0]') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a signature. + * @param name A fully qualified signature name. + * @returns The signature with the specified name. + */ + PDFForm.prototype.getSignature = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFSignature_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFSignature_1.default, field); + }; + /** + * Get the text field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const form = pdfDoc.getForm() + * const textField = form.getTextField('Page1.Foo.TextField[0]') + * textField.setText('Are you designed to act or to be acted upon?') + * ``` + * An error will be thrown if no field exists with the provided name, or if + * the field exists but is not a text field. + * @param name A fully qualified text field name. + * @returns The text field with the specified name. + */ + PDFForm.prototype.getTextField = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var field = this.getField(name); + if (field instanceof PDFTextField_1.default) + return field; + throw new errors_1.UnexpectedFieldTypeError(name, PDFTextField_1.default, field); + }; + /** + * Create a new button field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const button = form.createButton('cool.new.button') + * + * button.addToPage('Do Stuff', font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new button. + * @returns The new button field. + */ + PDFForm.prototype.createButton = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var button = core_1.PDFAcroPushButton.create(this.doc.context); + button.setPartialName(nameParts.terminal); + addFieldToParent(parent, [button, button.ref], nameParts.terminal); + return PDFButton_1.default.of(button, button.ref, this.doc); + }; + /** + * Create a new check box field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const checkBox = form.createCheckBox('cool.new.checkBox') + * + * checkBox.addToPage(page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new check box. + * @returns The new check box field. + */ + PDFForm.prototype.createCheckBox = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var checkBox = core_1.PDFAcroCheckBox.create(this.doc.context); + checkBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [checkBox, checkBox.ref], nameParts.terminal); + return PDFCheckBox_1.default.of(checkBox, checkBox.ref, this.doc); + }; + /** + * Create a new dropdown field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const dropdown = form.createDropdown('cool.new.dropdown') + * + * dropdown.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new dropdown. + * @returns The new dropdown field. + */ + PDFForm.prototype.createDropdown = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var comboBox = core_1.PDFAcroComboBox.create(this.doc.context); + comboBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [comboBox, comboBox.ref], nameParts.terminal); + return PDFDropdown_1.default.of(comboBox, comboBox.ref, this.doc); + }; + /** + * Create a new option list field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const optionList = form.createOptionList('cool.new.optionList') + * + * optionList.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new option list. + * @returns The new option list field. + */ + PDFForm.prototype.createOptionList = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var listBox = core_1.PDFAcroListBox.create(this.doc.context); + listBox.setPartialName(nameParts.terminal); + addFieldToParent(parent, [listBox, listBox.ref], nameParts.terminal); + return PDFOptionList_1.default.of(listBox, listBox.ref, this.doc); + }; + /** + * Create a new radio group field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const radioGroup = form.createRadioGroup('cool.new.radioGroup') + * + * radioGroup.addOptionToPage('is-dog', page, { y: 0 }) + * radioGroup.addOptionToPage('is-cat', page, { y: 75 }) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new radio group. + * @returns The new radio group field. + */ + PDFForm.prototype.createRadioGroup = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var radioButton = core_1.PDFAcroRadioButton.create(this.doc.context); + radioButton.setPartialName(nameParts.terminal); + addFieldToParent(parent, [radioButton, radioButton.ref], nameParts.terminal); + return PDFRadioGroup_1.default.of(radioButton, radioButton.ref, this.doc); + }; + /** + * Create a new text field in this [[PDFForm]] with the given name. + * For example: + * ```js + * const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const textField = form.createTextField('cool.new.textField') + * + * textField.addToPage(font, page) + * ``` + * An error will be thrown if a field already exists with the provided name. + * @param name The fully qualified name for the new radio group. + * @returns The new radio group field. + */ + PDFForm.prototype.createTextField = function (name) { + utils_1.assertIs(name, 'name', ['string']); + var nameParts = splitFieldName(name); + var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal); + var text = core_1.PDFAcroText.create(this.doc.context); + text.setPartialName(nameParts.terminal); + addFieldToParent(parent, [text, text.ref], nameParts.terminal); + return PDFTextField_1.default.of(text, text.ref, this.doc); + }; + /** + * Flatten all fields in this [[PDFForm]]. + * + * Flattening a form field will take the current appearance for each of that + * field's widgets and make them part of their page's content stream. All form + * fields and annotations associated are then removed. Note that once a form + * has been flattened its fields can no longer be accessed or edited. + * + * This operation is often used after filling form fields to ensure a + * consistent appearance across different PDF readers and/or printers. + * Another common use case is to copy a template document with form fields + * into another document. In this scenario you would load the template + * document, fill its fields, flatten it, and then copy its pages into the + * recipient document - the filled fields will be copied over. + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * form.flatten(); + * ``` + */ + PDFForm.prototype.flatten = function (options) { + if (options === void 0) { options = { + updateFieldAppearances: true, + removeField: true, + }; } + if (options.updateFieldAppearances) { + this.updateFieldAppearances(); + } + var fields = this.getFields(); + for (var i = 0, lenFields = fields.length; i < lenFields; i++) { + var field = fields[i]; + var widgets = field.acroField.getWidgets(); + for (var j = 0, lenWidgets = widgets.length; j < lenWidgets; j++) { + var widget = widgets[j]; + var page = this.findWidgetPage(widget); + var widgetRef = this.findWidgetAppearanceRef(field, widget); + var xObjectKey = page.node.newXObject('FlatWidget', widgetRef); + var rectangle = widget.getRectangle(); + var operators = tslib_1.__spreadArrays([ + operators_1.pushGraphicsState(), + operators_1.translate(rectangle.x, rectangle.y) + ], operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: 0 })), [ + operators_1.drawObject(xObjectKey), + operators_1.popGraphicsState(), + ]).filter(Boolean); + page.pushOperators.apply(page, operators); + } + if (options.removeField !== false) { + this.removeField(field); + } + else { + this.hideField(field); + } + } + }; + /** + * Hide a field by removing its reference on pages, + * this is useful during the flattening process particularly + * if we only want to hide the field but preverse the accessibility tag reference to a form field object + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * const ageField = form.getFields().find(x => x.getName() === 'Age'); + * form.hideField(ageField); + * ``` + */ + PDFForm.prototype.hideField = function (field) { + var widgets = field.acroField.getWidgets(); + var pages = new Set(); + for (var i = 0, len = widgets.length; i < len; i++) { + var widget = widgets[i]; + var widgetRef = this.findWidgetAppearanceRef(field, widget); + var page = this.findWidgetPage(widget); + pages.add(page); + page.node.removeAnnot(widgetRef); + } + pages.forEach(function (page) { return page.node.removeAnnot(field.ref); }); + }; + /** + * Remove a field from this [[PDFForm]]. + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * const ageField = form.getFields().find(x => x.getName() === 'Age'); + * form.removeField(ageField); + * ``` + */ + PDFForm.prototype.removeField = function (field) { + var widgets = field.acroField.getWidgets(); + var pages = new Set(); + for (var i = 0, len = widgets.length; i < len; i++) { + var widget = widgets[i]; + var widgetRef = this.findWidgetAppearanceRef(field, widget); + var page = this.findWidgetPage(widget); + pages.add(page); + page.node.removeAnnot(widgetRef); + } + pages.forEach(function (page) { return page.node.removeAnnot(field.ref); }); + this.acroForm.removeField(field.acroField); + var fieldKids = field.acroField.normalizedEntries().Kids; + var kidsCount = fieldKids.size(); + for (var childIndex = 0; childIndex < kidsCount; childIndex++) { + var child = fieldKids.get(childIndex); + if (child instanceof core_1.PDFRef) { + this.doc.context.delete(child); + } + } + this.doc.context.delete(field.ref); + }; + /** + * Update the appearance streams for all widgets of all fields in this + * [[PDFForm]]. Appearance streams will only be created for a widget if it + * does not have any existing appearance streams, or the field's value has + * changed (e.g. by calling [[PDFTextField.setText]] or + * [[PDFDropdown.select]]). + * + * For example: + * ```js + * const courier = await pdfDoc.embedFont(StandardFonts.Courier) + * const form = pdfDoc.getForm() + * form.updateFieldAppearances(courier) + * ``` + * + * **IMPORTANT:** The default value for the `font` parameter is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if any fields contain text with + * characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing that as the `font` + * parameter allows you to generate appearance streams with non WinAnsi + * characters (assuming your custom font supports them). + * + * > **NOTE:** The [[PDFDocument.save]] method will call this method to + * > update appearances automatically if a form was accessed via the + * > [[PDFDocument.getForm]] method prior to saving. + * + * @param font Optionally, the font to use when creating new appearances. + */ + PDFForm.prototype.updateFieldAppearances = function (font) { + utils_1.assertOrUndefined(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + font = font !== null && font !== void 0 ? font : this.getDefaultFont(); + var fields = this.getFields(); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + if (field.needsAppearancesUpdate()) { + field.defaultUpdateAppearances(font); + } + } + }; + /** + * Mark a field as dirty. This will cause its appearance streams to be + * updated by [[PDFForm.updateFieldAppearances]]. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * form.markFieldAsDirty(field.ref) + * ``` + * @param fieldRef The reference to the field that should be marked. + */ + PDFForm.prototype.markFieldAsDirty = function (fieldRef) { + utils_1.assertOrUndefined(fieldRef, 'fieldRef', [[core_1.PDFRef, 'PDFRef']]); + this.dirtyFields.add(fieldRef); + }; + /** + * Mark a field as dirty. This will cause its appearance streams to not be + * updated by [[PDFForm.updateFieldAppearances]]. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * form.markFieldAsClean(field.ref) + * ``` + * @param fieldRef The reference to the field that should be marked. + */ + PDFForm.prototype.markFieldAsClean = function (fieldRef) { + utils_1.assertOrUndefined(fieldRef, 'fieldRef', [[core_1.PDFRef, 'PDFRef']]); + this.dirtyFields.delete(fieldRef); + }; + /** + * Returns `true` is the specified field has been marked as dirty. + * ```js + * const form = pdfDoc.getForm() + * const field = form.getField('foo.bar') + * if (form.fieldIsDirty(field.ref)) console.log('Field is dirty') + * ``` + * @param fieldRef The reference to the field that should be checked. + * @returns Whether or not the specified field is dirty. + */ + PDFForm.prototype.fieldIsDirty = function (fieldRef) { + utils_1.assertOrUndefined(fieldRef, 'fieldRef', [[core_1.PDFRef, 'PDFRef']]); + return this.dirtyFields.has(fieldRef); + }; + PDFForm.prototype.getDefaultFont = function () { + return this.defaultFontCache.access(); + }; + PDFForm.prototype.findWidgetPage = function (widget) { + var pageRef = widget.P(); + var page = this.doc.getPages().find(function (x) { return x.ref === pageRef; }); + if (page === undefined) { + var widgetRef = this.doc.context.getObjectRef(widget.dict); + if (widgetRef === undefined) { + throw new Error('Could not find PDFRef for PDFObject'); + } + page = this.doc.findPageForAnnotationRef(widgetRef); + if (page === undefined) { + throw new Error("Could not find page for PDFRef " + widgetRef); + } + } + return page; + }; + PDFForm.prototype.findWidgetAppearanceRef = function (field, widget) { + var _a; + var refOrDict = widget.getNormalAppearance(); + if (refOrDict instanceof core_1.PDFDict && + (field instanceof PDFCheckBox_1.default || field instanceof PDFRadioGroup_1.default)) { + var value = field.acroField.getValue(); + var ref = (_a = refOrDict.get(value)) !== null && _a !== void 0 ? _a : refOrDict.get(core_1.PDFName.of('Off')); + if (ref instanceof core_1.PDFRef) { + refOrDict = ref; + } + } + if (!(refOrDict instanceof core_1.PDFRef)) { + var name_1 = field.getName(); + throw new Error("Failed to extract appearance ref for: " + name_1); + } + return refOrDict; + }; + PDFForm.prototype.findOrCreateNonTerminals = function (partialNames) { + var nonTerminal = [ + this.acroForm, + ]; + for (var idx = 0, len = partialNames.length; idx < len; idx++) { + var namePart = partialNames[idx]; + if (!namePart) + throw new errors_1.InvalidFieldNamePartError(namePart); + var parent_1 = nonTerminal[0], parentRef = nonTerminal[1]; + var res = this.findNonTerminal(namePart, parent_1); + if (res) { + nonTerminal = res; + } + else { + var node = core_1.PDFAcroNonTerminal.create(this.doc.context); + node.setPartialName(namePart); + node.setParent(parentRef); + var nodeRef = this.doc.context.register(node.dict); + parent_1.addField(nodeRef); + nonTerminal = [node, nodeRef]; + } + } + return nonTerminal; + }; + PDFForm.prototype.findNonTerminal = function (partialName, parent) { + var fields = parent instanceof core_1.PDFAcroForm + ? this.acroForm.getFields() + : core_1.createPDFAcroFields(parent.Kids()); + for (var idx = 0, len = fields.length; idx < len; idx++) { + var _a = fields[idx], field = _a[0], ref = _a[1]; + if (field.getPartialName() === partialName) { + if (field instanceof core_1.PDFAcroNonTerminal) + return [field, ref]; + throw new errors_1.FieldAlreadyExistsError(partialName); + } + } + return undefined; + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFDocument.getForm]] method, which will create an + * > instance of [[PDFForm]] for you. + * + * Create an instance of [[PDFForm]] from an existing acroForm and embedder + * + * @param acroForm The underlying `PDFAcroForm` for this form. + * @param doc The document to which the form will belong. + */ + PDFForm.of = function (acroForm, doc) { + return new PDFForm(acroForm, doc); + }; + return PDFForm; +}()); +exports.default = PDFForm; +var convertToPDFField = function (field, ref, doc) { + if (field instanceof core_1.PDFAcroPushButton) + return PDFButton_1.default.of(field, ref, doc); + if (field instanceof core_1.PDFAcroCheckBox) + return PDFCheckBox_1.default.of(field, ref, doc); + if (field instanceof core_1.PDFAcroComboBox) + return PDFDropdown_1.default.of(field, ref, doc); + if (field instanceof core_1.PDFAcroListBox) + return PDFOptionList_1.default.of(field, ref, doc); + if (field instanceof core_1.PDFAcroText) + return PDFTextField_1.default.of(field, ref, doc); + if (field instanceof core_1.PDFAcroRadioButton) { + return PDFRadioGroup_1.default.of(field, ref, doc); + } + if (field instanceof core_1.PDFAcroSignature) { + return PDFSignature_1.default.of(field, ref, doc); + } + return undefined; +}; +var splitFieldName = function (fullyQualifiedName) { + if (fullyQualifiedName.length === 0) { + throw new Error('PDF field names must not be empty strings'); + } + var parts = fullyQualifiedName.split('.'); + for (var idx = 0, len = parts.length; idx < len; idx++) { + if (parts[idx] === '') { + throw new Error("Periods in PDF field names must be separated by at least one character: \"" + fullyQualifiedName + "\""); + } + } + if (parts.length === 1) + return { nonTerminal: [], terminal: parts[0] }; + return { + nonTerminal: parts.slice(0, parts.length - 1), + terminal: parts[parts.length - 1], + }; +}; +var addFieldToParent = function (_a, _b, partialName) { + var parent = _a[0], parentRef = _a[1]; + var field = _b[0], fieldRef = _b[1]; + var entries = parent.normalizedEntries(); + var fields = core_1.createPDFAcroFields('Kids' in entries ? entries.Kids : entries.Fields); + for (var idx = 0, len = fields.length; idx < len; idx++) { + if (fields[idx][0].getPartialName() === partialName) { + throw new errors_1.FieldAlreadyExistsError(partialName); + } + } + parent.addField(fieldRef); + field.setParent(parentRef); +}; +//# sourceMappingURL=PDFForm.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFForm.js.map b/cjs/api/form/PDFForm.js.map new file mode 100644 index 000000000..0578d77ca --- /dev/null +++ b/cjs/api/form/PDFForm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFForm.js","sourceRoot":"","sources":["../../../src/api/form/PDFForm.ts"],"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AA4E,kBAAkB,OAAG,CAClG,CAAC;SACH;KACF;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvE,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7C,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;KAClC,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,gBAAgB,GAAG,UACvB,EAAiE,EACjE,EAAyC,EACzC,WAAmB;QAFlB,MAAM,QAAA,EAAE,SAAS,QAAA;QACjB,KAAK,QAAA,EAAE,QAAQ,QAAA;IAGhB,IAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC3C,IAAM,MAAM,GAAG,0BAAmB,CAChC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAClD,CAAC;IACF,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;QACvD,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,KAAK,WAAW,EAAE;YACnD,MAAM,IAAI,gCAAuB,CAAC,WAAW,CAAC,CAAC;SAChD;KACF;IACD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/api/form/PDFOptionList.d.ts b/cjs/api/form/PDFOptionList.d.ts new file mode 100644 index 000000000..77a9c53fc --- /dev/null +++ b/cjs/api/form/PDFOptionList.d.ts @@ -0,0 +1,336 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import PDFFont from "../PDFFont"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { AppearanceProviderFor } from "./appearances"; +import { PDFRef, PDFAcroListBox } from "../../core"; +/** + * Represents an option list field of a [[PDFForm]]. + * + * [[PDFOptionList]] fields are interactive lists of options. The purpose of an + * option list is to enable users to select one or more options from a set of + * possible options. Users are able to see the full set of options without + * first having to click on the field (though scrolling may be necessary). + * Clicking an option in the list will cause it to be selected and displayed + * with a highlighted background. Some option lists allow users to select + * more than one option (see [[PDFOptionList.isMultiselect]]). + */ +export default class PDFOptionList extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getOptionList]] method, which will create + * > an instance of [[PDFOptionList]] for you. + * + * Create an instance of [[PDFOptionList]] from an existing acroListBox and + * ref + * + * @param acroComboBox The underlying `PDFAcroListBox` for this option list. + * @param ref The unique reference for this option list. + * @param doc The document to which this option list will belong. + */ + static of: (acroListBox: PDFAcroListBox, ref: PDFRef, doc: PDFDocument) => PDFOptionList; + /** The low-level PDFAcroListBox wrapped by this option list. */ + readonly acroField: PDFAcroListBox; + private constructor(); + /** + * Get the list of available options for this option list. These options will + * be displayed to users who view this option list in a PDF reader. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * const options = optionList.getOptions() + * console.log('Option List options:', options) + * ``` + * @returns The options for this option list. + */ + getOptions(): string[]; + /** + * Get the selected options for this option list. These are the values that + * were selected by a human user via a PDF reader, or programatically via + * software. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * const selections = optionList.getSelected() + * console.log('Option List selections:', selections) + * ``` + * @returns The selected options for this option list. + */ + getSelected(): string[]; + /** + * Set the list of options that are available for this option list. These are + * the values that will be available for users to select when they view this + * option list in a PDF reader. Note that preexisting options for this + * option list will be removed. Only the values passed as `options` will be + * available to select. + * + * For example: + * ```js + * const optionList = form.getOptionList('planets.optionList') + * optionList.setOptions(['Earth', 'Mars', 'Pluto', 'Venus']) + * ``` + * + * This method will mark this option list as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the options this field contains inside the widgets of this text + * field (with selected options highlighted). + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if this field contains any options + * with characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFOptionList.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * @param options The options that should be available in this option list. + */ + setOptions(options: string[]): void; + /** + * Add to the list of options that are available for this option list. Users + * will be able to select these values in a PDF reader. In addition to the + * values passed as `options`, any preexisting options for this option list + * will still be available for users to select. + * For example: + * ```js + * const optionList = form.getOptionList('rockets.optionList') + * optionList.addOptions(['Saturn IV', 'Falcon Heavy']) + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + * @param options New options that should be available in this option list. + */ + addOptions(options: string | string[]): void; + /** + * Select one or more values for this option list. This operation is analogous + * to a human user opening the option list in a PDF reader and clicking on one + * or more values to select them. This method will update the underlying state + * of the option list to indicate which values have been selected. PDF + * libraries and readers will be able to extract these values from the saved + * document and determine which values were selected. + * For example: + * ```js + * const optionList = form.getOptionList('best.superheroes.optionList') + * optionList.select(['One Punch Man', 'Iron Man']) + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + * @param options The options to be selected. + * @param merge Whether or not existing selections should be preserved. + */ + select(options: string | string[], merge?: boolean): void; + /** + * Clear all selected values for this option list. This operation is + * equivalent to selecting an empty list. This method will update the + * underlying state of the option list to indicate that no values have been + * selected. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.clear() + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + */ + clear(): void; + /** + * Set the font size for the text in this field. There needs to be a + * default appearance string (DA) set with a font value specified + * for this to work. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.setFontSize(4); + * ``` + * @param fontSize The font size to set the font to. + */ + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this option list. Font sizes + * may be integer or floating point numbers. Supplying a negative font size + * will cause this method to throw an error. + * + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.setFontSize(4) + * optionList.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + setFontSize(fontSize: number): void; + /** + * Returns `true` if the options of this option list are always displayed + * in alphabetical order, irrespective of the order in which the options + * were added to the option list. See [[PDFOptionList.enableSorting]] and + * [[PDFOptionList.disableSorting]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isSorted()) console.log('Sorting is enabled') + * ``` + * @returns Whether or not this option list is sorted. + */ + isSorted(): boolean; + /** + * Always display the options of this option list in alphabetical order, + * irrespective of the order in which the options were added to this option + * list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableSorting() + * ``` + */ + enableSorting(): void; + /** + * Do not always display the options of this option list in alphabetical + * order. Instead, display the options in whichever order they were added + * to this option list. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableSorting() + * ``` + */ + disableSorting(): void; + /** + * Returns `true` if multiple options can be selected from this option list. + * See [[PDFOptionList.enableMultiselect]] and + * [[PDFOptionList.disableMultiselect]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isMultiselect()) console.log('Multiselect is enabled') + * ``` + * @returns Whether or not multiple options can be selected. + */ + isMultiselect(): boolean; + /** + * Allow users to select more than one option from this option list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableMultiselect() + * ``` + */ + enableMultiselect(): void; + /** + * Do not allow users to select more than one option from this option list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableMultiselect() + * ``` + */ + disableMultiselect(): void; + /** + * Returns `true` if the option selected by a user is stored, or "committed", + * when the user clicks the option. The alternative is that the user's + * selection is stored when the user leaves this option list field (by + * clicking outside of it - on another field, for example). See + * [[PDFOptionList.enableSelectOnClick]] and + * [[PDFOptionList.disableSelectOnClick]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isSelectOnClick()) console.log('Select on click is enabled') + * ``` + * @returns Whether or not options are selected immediately after they are + * clicked. + */ + isSelectOnClick(): boolean; + /** + * Store the option selected by a user immediately after the user clicks the + * option. Do not wait for the user to leave this option list field (by + * clicking outside of it - on another field, for example). For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableSelectOnClick() + * ``` + */ + enableSelectOnClick(): void; + /** + * Wait to store the option selected by a user until they leave this option + * list field (by clicking outside of it - on another field, for example). + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableSelectOnClick() + * ``` + */ + disableSelectOnClick(): void; + /** + * Show this option list on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const optionList = form.createOptionList('best.gundams') + * optionList.setOptions(['Exia', 'Dynames', 'Kyrios', 'Virtue']) + * optionList.select(['Exia', 'Virtue']) + * + * optionList.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this option list field. + * @param page The page to which this option list widget should be added. + * @param options The options to be used when adding this option list widget. + */ + addToPage(page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if this option list has been marked as dirty, or if any of + * this option list's widgets do not have an appearance stream. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this option list needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this option list's widgets using + * the default appearance provider for option lists. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const optionList = form.getOptionList('some.optionList.field') + * optionList.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + defaultUpdateAppearances(font: PDFFont): void; + /** + * Update the appearance streams for each of this option list's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for option lists will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const optionList = form.getOptionList('some.optionList.field') + * optionList.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawOptionList(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(font: PDFFont, provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFOptionList.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFOptionList.d.ts.map b/cjs/api/form/PDFOptionList.d.ts.map new file mode 100644 index 000000000..0810c3a85 --- /dev/null +++ b/cjs/api/form/PDFOptionList.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOptionList.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFOptionList.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,OAAO,mBAAwB;AACtC,OAAO,QAAQ,EAAE,EACf,sBAAsB,EAEvB,mBAA8B;AAC/B,OAAO,EACL,qBAAqB,EAGtB,sBAAiC;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O,CAAC,EAAE,sBAAsB;IAsCzD;;;;;;;;OAQG;IACH,sBAAsB,IAAI,OAAO;IAcjC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,IAAI,EAAE,OAAO;IAKtC;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CACf,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC;IAoBjD,OAAO,CAAC,sBAAsB;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFOptionList.js b/cjs/api/form/PDFOptionList.js new file mode 100644 index 000000000..c3703533b --- /dev/null +++ b/cjs/api/form/PDFOptionList.js @@ -0,0 +1,499 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var PDFFont_1 = tslib_1.__importDefault(require("../PDFFont")); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var appearances_1 = require("./appearances"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents an option list field of a [[PDFForm]]. + * + * [[PDFOptionList]] fields are interactive lists of options. The purpose of an + * option list is to enable users to select one or more options from a set of + * possible options. Users are able to see the full set of options without + * first having to click on the field (though scrolling may be necessary). + * Clicking an option in the list will cause it to be selected and displayed + * with a highlighted background. Some option lists allow users to select + * more than one option (see [[PDFOptionList.isMultiselect]]). + */ +var PDFOptionList = /** @class */ (function (_super) { + tslib_1.__extends(PDFOptionList, _super); + function PDFOptionList(acroListBox, ref, doc) { + var _this = _super.call(this, acroListBox, ref, doc) || this; + utils_1.assertIs(acroListBox, 'acroListBox', [[core_1.PDFAcroListBox, 'PDFAcroListBox']]); + _this.acroField = acroListBox; + return _this; + } + /** + * Get the list of available options for this option list. These options will + * be displayed to users who view this option list in a PDF reader. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * const options = optionList.getOptions() + * console.log('Option List options:', options) + * ``` + * @returns The options for this option list. + */ + PDFOptionList.prototype.getOptions = function () { + var rawOptions = this.acroField.getOptions(); + var options = new Array(rawOptions.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a = rawOptions[idx], display = _a.display, value = _a.value; + options[idx] = (display !== null && display !== void 0 ? display : value).decodeText(); + } + return options; + }; + /** + * Get the selected options for this option list. These are the values that + * were selected by a human user via a PDF reader, or programatically via + * software. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * const selections = optionList.getSelected() + * console.log('Option List selections:', selections) + * ``` + * @returns The selected options for this option list. + */ + PDFOptionList.prototype.getSelected = function () { + var values = this.acroField.getValues(); + var selected = new Array(values.length); + for (var idx = 0, len = values.length; idx < len; idx++) { + selected[idx] = values[idx].decodeText(); + } + return selected; + }; + /** + * Set the list of options that are available for this option list. These are + * the values that will be available for users to select when they view this + * option list in a PDF reader. Note that preexisting options for this + * option list will be removed. Only the values passed as `options` will be + * available to select. + * + * For example: + * ```js + * const optionList = form.getOptionList('planets.optionList') + * optionList.setOptions(['Earth', 'Mars', 'Pluto', 'Venus']) + * ``` + * + * This method will mark this option list as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the options this field contains inside the widgets of this text + * field (with selected options highlighted). + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if this field contains any options + * with characters outside the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFOptionList.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * @param options The options that should be available in this option list. + */ + PDFOptionList.prototype.setOptions = function (options) { + utils_1.assertIs(options, 'options', [Array]); + this.markAsDirty(); + var optionObjects = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + optionObjects[idx] = { value: core_1.PDFHexString.fromText(options[idx]) }; + } + this.acroField.setOptions(optionObjects); + }; + /** + * Add to the list of options that are available for this option list. Users + * will be able to select these values in a PDF reader. In addition to the + * values passed as `options`, any preexisting options for this option list + * will still be available for users to select. + * For example: + * ```js + * const optionList = form.getOptionList('rockets.optionList') + * optionList.addOptions(['Saturn IV', 'Falcon Heavy']) + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + * @param options New options that should be available in this option list. + */ + PDFOptionList.prototype.addOptions = function (options) { + utils_1.assertIs(options, 'options', ['string', Array]); + this.markAsDirty(); + var optionsArr = Array.isArray(options) ? options : [options]; + var existingOptions = this.acroField.getOptions(); + var newOptions = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + newOptions[idx] = { value: core_1.PDFHexString.fromText(optionsArr[idx]) }; + } + this.acroField.setOptions(existingOptions.concat(newOptions)); + }; + /** + * Select one or more values for this option list. This operation is analogous + * to a human user opening the option list in a PDF reader and clicking on one + * or more values to select them. This method will update the underlying state + * of the option list to indicate which values have been selected. PDF + * libraries and readers will be able to extract these values from the saved + * document and determine which values were selected. + * For example: + * ```js + * const optionList = form.getOptionList('best.superheroes.optionList') + * optionList.select(['One Punch Man', 'Iron Man']) + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + * @param options The options to be selected. + * @param merge Whether or not existing selections should be preserved. + */ + PDFOptionList.prototype.select = function (options, merge) { + if (merge === void 0) { merge = false; } + utils_1.assertIs(options, 'options', ['string', Array]); + utils_1.assertIs(merge, 'merge', ['boolean']); + var optionsArr = Array.isArray(options) ? options : [options]; + var validOptions = this.getOptions(); + utils_1.assertIsSubset(optionsArr, 'option', validOptions); + this.markAsDirty(); + if (optionsArr.length > 1 || (optionsArr.length === 1 && merge)) { + this.enableMultiselect(); + } + var values = new Array(optionsArr.length); + for (var idx = 0, len = optionsArr.length; idx < len; idx++) { + values[idx] = core_1.PDFHexString.fromText(optionsArr[idx]); + } + if (merge) { + var existingValues = this.acroField.getValues(); + this.acroField.setValues(existingValues.concat(values)); + } + else { + this.acroField.setValues(values); + } + }; + /** + * Clear all selected values for this option list. This operation is + * equivalent to selecting an empty list. This method will update the + * underlying state of the option list to indicate that no values have been + * selected. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.clear() + * ``` + * This method will mark this option list as dirty. See + * [[PDFOptionList.setOptions]] for more details about what this means. + */ + PDFOptionList.prototype.clear = function () { + this.markAsDirty(); + this.acroField.setValues([]); + }; + /** + * Set the font size for the text in this field. There needs to be a + * default appearance string (DA) set with a font value specified + * for this to work. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.setFontSize(4); + * ``` + * @param fontSize The font size to set the font to. + */ + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this option list. Font sizes + * may be integer or floating point numbers. Supplying a negative font size + * will cause this method to throw an error. + * + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.setFontSize(4) + * optionList.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + PDFOptionList.prototype.setFontSize = function (fontSize) { + utils_1.assertPositive(fontSize, 'fontSize'); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + /** + * Returns `true` if the options of this option list are always displayed + * in alphabetical order, irrespective of the order in which the options + * were added to the option list. See [[PDFOptionList.enableSorting]] and + * [[PDFOptionList.disableSorting]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isSorted()) console.log('Sorting is enabled') + * ``` + * @returns Whether or not this option list is sorted. + */ + PDFOptionList.prototype.isSorted = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.Sort); + }; + /** + * Always display the options of this option list in alphabetical order, + * irrespective of the order in which the options were added to this option + * list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableSorting() + * ``` + */ + PDFOptionList.prototype.enableSorting = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Sort, true); + }; + /** + * Do not always display the options of this option list in alphabetical + * order. Instead, display the options in whichever order they were added + * to this option list. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableSorting() + * ``` + */ + PDFOptionList.prototype.disableSorting = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.Sort, false); + }; + /** + * Returns `true` if multiple options can be selected from this option list. + * See [[PDFOptionList.enableMultiselect]] and + * [[PDFOptionList.disableMultiselect]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isMultiselect()) console.log('Multiselect is enabled') + * ``` + * @returns Whether or not multiple options can be selected. + */ + PDFOptionList.prototype.isMultiselect = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.MultiSelect); + }; + /** + * Allow users to select more than one option from this option list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableMultiselect() + * ``` + */ + PDFOptionList.prototype.enableMultiselect = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.MultiSelect, true); + }; + /** + * Do not allow users to select more than one option from this option list. + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableMultiselect() + * ``` + */ + PDFOptionList.prototype.disableMultiselect = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.MultiSelect, false); + }; + /** + * Returns `true` if the option selected by a user is stored, or "committed", + * when the user clicks the option. The alternative is that the user's + * selection is stored when the user leaves this option list field (by + * clicking outside of it - on another field, for example). See + * [[PDFOptionList.enableSelectOnClick]] and + * [[PDFOptionList.disableSelectOnClick]]. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.isSelectOnClick()) console.log('Select on click is enabled') + * ``` + * @returns Whether or not options are selected immediately after they are + * clicked. + */ + PDFOptionList.prototype.isSelectOnClick = function () { + return this.acroField.hasFlag(core_1.AcroChoiceFlags.CommitOnSelChange); + }; + /** + * Store the option selected by a user immediately after the user clicks the + * option. Do not wait for the user to leave this option list field (by + * clicking outside of it - on another field, for example). For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.enableSelectOnClick() + * ``` + */ + PDFOptionList.prototype.enableSelectOnClick = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.CommitOnSelChange, true); + }; + /** + * Wait to store the option selected by a user until they leave this option + * list field (by clicking outside of it - on another field, for example). + * For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * optionList.disableSelectOnClick() + * ``` + */ + PDFOptionList.prototype.disableSelectOnClick = function () { + this.acroField.setFlagTo(core_1.AcroChoiceFlags.CommitOnSelChange, false); + }; + /** + * Show this option list on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const optionList = form.createOptionList('best.gundams') + * optionList.setOptions(['Exia', 'Dynames', 'Kyrios', 'Virtue']) + * optionList.select(['Exia', 'Virtue']) + * + * optionList.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this option list field. + * @param page The page to which this option list widget should be added. + * @param options The options to be used when adding this option list widget. + */ + PDFOptionList.prototype.addToPage = function (page, options) { + var _a, _b, _c, _d, _e, _f, _g; + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!('textColor' in options)) + options.textColor = colors_1.rgb(0, 0, 0); + if (!('backgroundColor' in options)) + options.backgroundColor = colors_1.rgb(1, 1, 1); + if (!('borderColor' in options)) + options.borderColor = colors_1.rgb(0, 0, 0); + if (!('borderWidth' in options)) + options.borderWidth = 1; + // Create a widget for this option list + var widget = this.createWidget({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : 0, + y: (_b = options.y) !== null && _b !== void 0 ? _b : 0, + width: (_c = options.width) !== null && _c !== void 0 ? _c : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 100, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + hidden: options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + this.acroField.addWidget(widgetRef); + // Set appearance streams for widget + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if this option list has been marked as dirty, or if any of + * this option list's widgets do not have an appearance stream. For example: + * ```js + * const optionList = form.getOptionList('some.optionList.field') + * if (optionList.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this option list needs an appearance update. + */ + PDFOptionList.prototype.needsAppearancesUpdate = function () { + var _a; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof core_1.PDFStream; + if (!hasAppearances) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this option list's widgets using + * the default appearance provider for option lists. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const optionList = form.getOptionList('some.optionList.field') + * optionList.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + PDFOptionList.prototype.defaultUpdateAppearances = function (font) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + this.updateAppearances(font); + }; + /** + * Update the appearance streams for each of this option list's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for option lists will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const optionList = form.getOptionList('some.optionList.field') + * optionList.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawOptionList(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFOptionList.prototype.updateAppearances = function (font, provider) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + // getOption(index: number): string {} + // getSelectedIndices(): number[] {} + // removeOptions(option: string | string[]) {} + // removeIndices(option: number[]) {} + // deselect(options: string | string[]) {} + // deselectIndices(optionIndices: number[]) {} + PDFOptionList.prototype.updateWidgetAppearance = function (widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultOptionListAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getOptionList]] method, which will create + * > an instance of [[PDFOptionList]] for you. + * + * Create an instance of [[PDFOptionList]] from an existing acroListBox and + * ref + * + * @param acroComboBox The underlying `PDFAcroListBox` for this option list. + * @param ref The unique reference for this option list. + * @param doc The document to which this option list will belong. + */ + PDFOptionList.of = function (acroListBox, ref, doc) { + return new PDFOptionList(acroListBox, ref, doc); + }; + return PDFOptionList; +}(PDFField_1.default)); +exports.default = PDFOptionList; +//# sourceMappingURL=PDFOptionList.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFOptionList.js.map b/cjs/api/form/PDFOptionList.js.map new file mode 100644 index 000000000..26bed4c1f --- /dev/null +++ b/cjs/api/form/PDFOptionList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOptionList.js","sourceRoot":"","sources":["../../../src/api/form/PDFOptionList.ts"],"names":[],"mappings":";;;AACA,+DAAsC;AACtC,+DAAsC;AACtC,6DAG+B;AAC/B,6CAIkC;AAClC,oCAAqC;AACrC,0CAA4C;AAE5C,mCAQkB;AAClB,qCAKmB;AAEnB;;;;;;;;;;GAUG;AACH;IAA2C,yCAAQ;IAmBjD,uBACE,WAA2B,EAC3B,GAAW,EACX,GAAgB;QAHlB,YAKE,kBAAM,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,SAK7B;QAHC,gBAAQ,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC,qBAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAE3E,KAAI,CAAC,SAAS,GAAG,WAAW,CAAC;;IAC/B,CAAC;IAED;;;;;;;;;;OAUG;IACH,kCAAU,GAAV;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAE/C,IAAM,OAAO,GAAG,IAAI,KAAK,CAAS,UAAU,CAAC,MAAM,CAAC,CAAC;QACrD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAClD,IAAA,KAAqB,UAAU,CAAC,GAAG,CAAC,EAAlC,OAAO,aAAA,EAAE,KAAK,WAAoB,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC;SAChD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,mCAAW,GAAX;QACE,IAAM,MAAM,GAAG,IAA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CAAC,QAAQ,CAAC,CAAC,CAAC;QAEpD,IAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC5C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,sCAAsC;IACtC,oCAAoC;IACpC,8CAA8C;IAC9C,qCAAqC;IACrC,0CAA0C;IAC1C,8CAA8C;IAEtC,8CAAsB,GAA9B,UACE,MAA2B,EAC3B,IAAa,EACb,QAA+C;QAE/C,IAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,iDAAmC,CAAC;QACnE,IAAM,WAAW,GAAG,iCAAmB,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IA9gBD;;;;;;;;;;;OAWG;IACI,gBAAE,GAAG,UAAC,WAA2B,EAAE,GAAW,EAAE,GAAgB;QACrE,OAAA,IAAI,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC;IAAxC,CAAwC,CAAC;IAkgB7C,oBAAC;CAAA,AAhhBD,CAA2C,kBAAQ,GAghBlD;kBAhhBoB,aAAa"} \ No newline at end of file diff --git a/cjs/api/form/PDFRadioGroup.d.ts b/cjs/api/form/PDFRadioGroup.d.ts new file mode 100644 index 000000000..46058fb9a --- /dev/null +++ b/cjs/api/form/PDFRadioGroup.d.ts @@ -0,0 +1,253 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { AppearanceProviderFor } from "./appearances"; +import { PDFRef, PDFAcroRadioButton } from "../../core"; +/** + * Represents a radio group field of a [[PDFForm]]. + * + * [[PDFRadioGroup]] fields are collections of radio buttons. The purpose of a + * radio group is to enable users to select one option from a set of mutually + * exclusive choices. Each choice in a radio group is represented by a radio + * button. Radio buttons each have two states: `on` and `off`. At most one + * radio button in a group may be in the `on` state at any time. Users can + * click on a radio button to select it (and thereby automatically deselect any + * other radio button that might have already been selected). Some radio + * groups allow users to toggle a selected radio button `off` by clicking on + * it (see [[PDFRadioGroup.isOffToggleable]]). + * + * Note that some radio groups allow multiple radio buttons to be in the `on` + * state at the same type **if** they represent the same underlying value (see + * [[PDFRadioGroup.isMutuallyExclusive]]). + */ +export default class PDFRadioGroup extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getOptionList]] method, which will create an + * > instance of [[PDFOptionList]] for you. + * + * Create an instance of [[PDFOptionList]] from an existing acroRadioButton + * and ref + * + * @param acroRadioButton The underlying `PDFAcroRadioButton` for this + * radio group. + * @param ref The unique reference for this radio group. + * @param doc The document to which this radio group will belong. + */ + static of: (acroRadioButton: PDFAcroRadioButton, ref: PDFRef, doc: PDFDocument) => PDFRadioGroup; + /** The low-level PDFAcroRadioButton wrapped by this radio group. */ + readonly acroField: PDFAcroRadioButton; + private constructor(); + /** + * Get the list of available options for this radio group. Each option is + * represented by a radio button. These radio buttons are displayed at + * various locations in the document, potentially on different pages (though + * typically they are stacked horizontally or vertically on the same page). + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * const options = radioGroup.getOptions() + * console.log('Radio Group options:', options) + * ``` + * @returns The options for this radio group. + */ + getOptions(): string[]; + /** + * Get the selected option for this radio group. The selected option is + * represented by the radio button in this group that is turned on. At most + * one radio button in a group can be selected. If no buttons in this group + * are selected, `undefined` is returned. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * const selected = radioGroup.getSelected() + * console.log('Selected radio button:', selected) + * ``` + * @returns The selected option for this radio group. + */ + getSelected(): string | undefined; + /** + * Select an option for this radio group. This operation is analogous to a + * human user clicking one of the radio buttons in this group via a PDF + * reader to toggle it on. This method will update the underlying state of + * the radio group to indicate which option has been selected. PDF libraries + * and readers will be able to extract this value from the saved document and + * determine which option was selected. + * + * For example: + * ```js + * const radioGroup = form.getRadioGroup('best.superhero.radioGroup') + * radioGroup.select('One Punch Man') + * ``` + * + * This method will mark this radio group as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated appearance + * streams will display a dot inside the widget of this check box field + * that represents the selected option. + * + * @param option The option to be selected. + */ + select(option: string): void; + /** + * Clear any selected option for this dropdown. This will result in all + * radio buttons in this group being toggled off. This method will update + * the underlying state of the dropdown to indicate that no radio buttons + * have been selected. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.clear() + * ``` + * This method will mark this radio group as dirty. See + * [[PDFRadioGroup.select]] for more details about what this means. + */ + clear(): void; + /** + * Returns `true` if users can click on radio buttons in this group to toggle + * them off. The alternative is that once a user clicks on a radio button + * to select it, the only way to deselect it is by selecting on another radio + * button in the group. See [[PDFRadioGroup.enableOffToggling]] and + * [[PDFRadioGroup.disableOffToggling]]. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.isOffToggleable()) console.log('Off toggling is enabled') + * ``` + */ + isOffToggleable(): boolean; + /** + * Allow users to click on selected radio buttons in this group to toggle + * them off. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.enableOffToggling() + * ``` + * > **NOTE:** This feature is documented in the PDF specification + * > (Table 226). However, most PDF readers do not respect this option and + * > prevent users from toggling radio buttons off even when it is enabled. + * > At the time of this writing (9/6/2020) Mac's Preview software did + * > respect the option. Adobe Acrobat, Foxit Reader, and Google Chrome did + * > not. + */ + enableOffToggling(): void; + /** + * Prevent users from clicking on selected radio buttons in this group to + * toggle them off. Clicking on a selected radio button will have no effect. + * The only way to deselect a selected radio button is to click on a + * different radio button in the group. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.disableOffToggling() + * ``` + */ + disableOffToggling(): void; + /** + * Returns `true` if the radio buttons in this group are mutually exclusive. + * This means that when the user selects a radio button, only that specific + * button will be turned on. Even if other radio buttons in the group + * represent the same value, they will not be enabled. The alternative to + * this is that clicking a radio button will select that button along with + * any other radio buttons in the group that share the same value. See + * [[PDFRadioGroup.enableMutualExclusion]] and + * [[PDFRadioGroup.disableMutualExclusion]]. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.isMutuallyExclusive()) console.log('Mutual exclusion is enabled') + * ``` + */ + isMutuallyExclusive(): boolean; + /** + * When the user clicks a radio button in this group it will be selected. In + * addition, any other radio buttons in this group that share the same + * underlying value will also be selected. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.enableMutualExclusion() + * ``` + * Note that this option must be enabled prior to adding options to the + * radio group. It does not currently apply retroactively to existing + * radio buttons in the group. + */ + enableMutualExclusion(): void; + /** + * When the user clicks a radio button in this group only it will be selected. + * No other radio buttons in the group will be selected, even if they share + * the same underlying value. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.disableMutualExclusion() + * ``` + * Note that this option must be disabled prior to adding options to the + * radio group. It does not currently apply retroactively to existing + * radio buttons in the group. + */ + disableMutualExclusion(): void; + /** + * Add a new radio button to this group on the specified page. For example: + * ```js + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const radioGroup = form.createRadioGroup('best.gundam') + * + * const options = { + * x: 50, + * width: 25, + * height: 25, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * } + * + * radioGroup.addOptionToPage('Exia', page, { ...options, y: 50 }) + * radioGroup.addOptionToPage('Dynames', page, { ...options, y: 110 }) + * ``` + * This will create a new radio button widget for this radio group field. + * @param option The option that the radio button widget represents. + * @param page The page to which the radio button widget should be added. + * @param options The options to be used when adding the radio button widget. + */ + addOptionToPage(option: string, page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if any of this group's radio button widgets do not have an + * appearance stream for their current state. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this radio group needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this group's radio button widgets + * using the default appearance provider for radio groups. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.defaultUpdateAppearances() + * ``` + */ + defaultUpdateAppearances(): void; + /** + * Update the appearance streams for each of this group's radio button widgets + * using the given appearance provider. If no `provider` is passed, the + * default appearance provider for radio groups will be used. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.updateAppearances((field, widget) => { + * ... + * return { + * normal: { on: drawRadioButton(...), off: drawRadioButton(...) }, + * down: { on: drawRadioButton(...), off: drawRadioButton(...) }, + * } + * }) + * ``` + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFRadioGroup.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFRadioGroup.d.ts.map b/cjs/api/form/PDFRadioGroup.d.ts.map new file mode 100644 index 000000000..decdfac0b --- /dev/null +++ b/cjs/api/form/PDFRadioGroup.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRadioGroup.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFRadioGroup.ts"],"names":[],"mappings":"AAAA,OAAO,WA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;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFRadioGroup.js b/cjs/api/form/PDFRadioGroup.js new file mode 100644 index 000000000..cf054f347 --- /dev/null +++ b/cjs/api/form/PDFRadioGroup.js @@ -0,0 +1,415 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var appearances_1 = require("./appearances"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a radio group field of a [[PDFForm]]. + * + * [[PDFRadioGroup]] fields are collections of radio buttons. The purpose of a + * radio group is to enable users to select one option from a set of mutually + * exclusive choices. Each choice in a radio group is represented by a radio + * button. Radio buttons each have two states: `on` and `off`. At most one + * radio button in a group may be in the `on` state at any time. Users can + * click on a radio button to select it (and thereby automatically deselect any + * other radio button that might have already been selected). Some radio + * groups allow users to toggle a selected radio button `off` by clicking on + * it (see [[PDFRadioGroup.isOffToggleable]]). + * + * Note that some radio groups allow multiple radio buttons to be in the `on` + * state at the same type **if** they represent the same underlying value (see + * [[PDFRadioGroup.isMutuallyExclusive]]). + */ +var PDFRadioGroup = /** @class */ (function (_super) { + tslib_1.__extends(PDFRadioGroup, _super); + function PDFRadioGroup(acroRadioButton, ref, doc) { + var _this = _super.call(this, acroRadioButton, ref, doc) || this; + utils_1.assertIs(acroRadioButton, 'acroRadioButton', [ + [core_1.PDFAcroRadioButton, 'PDFAcroRadioButton'], + ]); + _this.acroField = acroRadioButton; + return _this; + } + /** + * Get the list of available options for this radio group. Each option is + * represented by a radio button. These radio buttons are displayed at + * various locations in the document, potentially on different pages (though + * typically they are stacked horizontally or vertically on the same page). + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * const options = radioGroup.getOptions() + * console.log('Radio Group options:', options) + * ``` + * @returns The options for this radio group. + */ + PDFRadioGroup.prototype.getOptions = function () { + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + var exportOptions = new Array(exportValues.length); + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + exportOptions[idx] = exportValues[idx].decodeText(); + } + return exportOptions; + } + var onValues = this.acroField.getOnValues(); + var onOptions = new Array(onValues.length); + for (var idx = 0, len = onOptions.length; idx < len; idx++) { + onOptions[idx] = onValues[idx].decodeText(); + } + return onOptions; + }; + /** + * Get the selected option for this radio group. The selected option is + * represented by the radio button in this group that is turned on. At most + * one radio button in a group can be selected. If no buttons in this group + * are selected, `undefined` is returned. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * const selected = radioGroup.getSelected() + * console.log('Selected radio button:', selected) + * ``` + * @returns The selected option for this radio group. + */ + PDFRadioGroup.prototype.getSelected = function () { + var value = this.acroField.getValue(); + if (value === core_1.PDFName.of('Off')) + return undefined; + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + var onValues = this.acroField.getOnValues(); + for (var idx = 0, len = onValues.length; idx < len; idx++) { + if (onValues[idx] === value) + return exportValues[idx].decodeText(); + } + } + return value.decodeText(); + }; + // // TODO: Figure out why this seems to crash Acrobat. Maybe it's because we + // // aren't removing the widget reference from the page's Annots? + // removeOption(option: string) { + // assertIs(option, 'option', ['string']); + // // TODO: Assert is valid `option`! + // const onValues = this.acroField.getOnValues(); + // const exportValues = this.acroField.getExportValues(); + // if (exportValues) { + // for (let idx = 0, len = exportValues.length; idx < len; idx++) { + // if (exportValues[idx].decodeText() === option) { + // this.acroField.removeWidget(idx); + // this.acroField.removeExportValue(idx); + // } + // } + // } else { + // for (let idx = 0, len = onValues.length; idx < len; idx++) { + // const value = onValues[idx]; + // if (value.decodeText() === option) { + // this.acroField.removeWidget(idx); + // this.acroField.removeExportValue(idx); + // } + // } + // } + // } + /** + * Select an option for this radio group. This operation is analogous to a + * human user clicking one of the radio buttons in this group via a PDF + * reader to toggle it on. This method will update the underlying state of + * the radio group to indicate which option has been selected. PDF libraries + * and readers will be able to extract this value from the saved document and + * determine which option was selected. + * + * For example: + * ```js + * const radioGroup = form.getRadioGroup('best.superhero.radioGroup') + * radioGroup.select('One Punch Man') + * ``` + * + * This method will mark this radio group as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated appearance + * streams will display a dot inside the widget of this check box field + * that represents the selected option. + * + * @param option The option to be selected. + */ + PDFRadioGroup.prototype.select = function (option) { + utils_1.assertIs(option, 'option', ['string']); + var validOptions = this.getOptions(); + utils_1.assertIsOneOf(option, 'option', validOptions); + this.markAsDirty(); + var onValues = this.acroField.getOnValues(); + var exportValues = this.acroField.getExportValues(); + if (exportValues) { + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + if (exportValues[idx].decodeText() === option) { + this.acroField.setValue(onValues[idx]); + } + } + } + else { + for (var idx = 0, len = onValues.length; idx < len; idx++) { + var value = onValues[idx]; + if (value.decodeText() === option) + this.acroField.setValue(value); + } + } + }; + /** + * Clear any selected option for this dropdown. This will result in all + * radio buttons in this group being toggled off. This method will update + * the underlying state of the dropdown to indicate that no radio buttons + * have been selected. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.clear() + * ``` + * This method will mark this radio group as dirty. See + * [[PDFRadioGroup.select]] for more details about what this means. + */ + PDFRadioGroup.prototype.clear = function () { + this.markAsDirty(); + this.acroField.setValue(core_1.PDFName.of('Off')); + }; + /** + * Returns `true` if users can click on radio buttons in this group to toggle + * them off. The alternative is that once a user clicks on a radio button + * to select it, the only way to deselect it is by selecting on another radio + * button in the group. See [[PDFRadioGroup.enableOffToggling]] and + * [[PDFRadioGroup.disableOffToggling]]. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.isOffToggleable()) console.log('Off toggling is enabled') + * ``` + */ + PDFRadioGroup.prototype.isOffToggleable = function () { + return !this.acroField.hasFlag(core_1.AcroButtonFlags.NoToggleToOff); + }; + /** + * Allow users to click on selected radio buttons in this group to toggle + * them off. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.enableOffToggling() + * ``` + * > **NOTE:** This feature is documented in the PDF specification + * > (Table 226). However, most PDF readers do not respect this option and + * > prevent users from toggling radio buttons off even when it is enabled. + * > At the time of this writing (9/6/2020) Mac's Preview software did + * > respect the option. Adobe Acrobat, Foxit Reader, and Google Chrome did + * > not. + */ + PDFRadioGroup.prototype.enableOffToggling = function () { + this.acroField.setFlagTo(core_1.AcroButtonFlags.NoToggleToOff, false); + }; + /** + * Prevent users from clicking on selected radio buttons in this group to + * toggle them off. Clicking on a selected radio button will have no effect. + * The only way to deselect a selected radio button is to click on a + * different radio button in the group. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.disableOffToggling() + * ``` + */ + PDFRadioGroup.prototype.disableOffToggling = function () { + this.acroField.setFlagTo(core_1.AcroButtonFlags.NoToggleToOff, true); + }; + /** + * Returns `true` if the radio buttons in this group are mutually exclusive. + * This means that when the user selects a radio button, only that specific + * button will be turned on. Even if other radio buttons in the group + * represent the same value, they will not be enabled. The alternative to + * this is that clicking a radio button will select that button along with + * any other radio buttons in the group that share the same value. See + * [[PDFRadioGroup.enableMutualExclusion]] and + * [[PDFRadioGroup.disableMutualExclusion]]. + * For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.isMutuallyExclusive()) console.log('Mutual exclusion is enabled') + * ``` + */ + PDFRadioGroup.prototype.isMutuallyExclusive = function () { + return !this.acroField.hasFlag(core_1.AcroButtonFlags.RadiosInUnison); + }; + /** + * When the user clicks a radio button in this group it will be selected. In + * addition, any other radio buttons in this group that share the same + * underlying value will also be selected. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.enableMutualExclusion() + * ``` + * Note that this option must be enabled prior to adding options to the + * radio group. It does not currently apply retroactively to existing + * radio buttons in the group. + */ + PDFRadioGroup.prototype.enableMutualExclusion = function () { + this.acroField.setFlagTo(core_1.AcroButtonFlags.RadiosInUnison, false); + }; + /** + * When the user clicks a radio button in this group only it will be selected. + * No other radio buttons in the group will be selected, even if they share + * the same underlying value. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.disableMutualExclusion() + * ``` + * Note that this option must be disabled prior to adding options to the + * radio group. It does not currently apply retroactively to existing + * radio buttons in the group. + */ + PDFRadioGroup.prototype.disableMutualExclusion = function () { + this.acroField.setFlagTo(core_1.AcroButtonFlags.RadiosInUnison, true); + }; + /** + * Add a new radio button to this group on the specified page. For example: + * ```js + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const radioGroup = form.createRadioGroup('best.gundam') + * + * const options = { + * x: 50, + * width: 25, + * height: 25, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * } + * + * radioGroup.addOptionToPage('Exia', page, { ...options, y: 50 }) + * radioGroup.addOptionToPage('Dynames', page, { ...options, y: 110 }) + * ``` + * This will create a new radio button widget for this radio group field. + * @param option The option that the radio button widget represents. + * @param page The page to which the radio button widget should be added. + * @param options The options to be used when adding the radio button widget. + */ + PDFRadioGroup.prototype.addOptionToPage = function (option, page, options) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + utils_1.assertIs(option, 'option', ['string']); + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + // Create a widget for this radio button + var widget = this.createWidget({ + x: (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, + y: (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0, + width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : 50, + height: (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 50, + textColor: (_e = options === null || options === void 0 ? void 0 : options.textColor) !== null && _e !== void 0 ? _e : colors_1.rgb(0, 0, 0), + backgroundColor: (_f = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _f !== void 0 ? _f : colors_1.rgb(1, 1, 1), + borderColor: (_g = options === null || options === void 0 ? void 0 : options.borderColor) !== null && _g !== void 0 ? _g : colors_1.rgb(0, 0, 0), + borderWidth: (_h = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _h !== void 0 ? _h : 1, + rotate: (_j = options === null || options === void 0 ? void 0 : options.rotate) !== null && _j !== void 0 ? _j : rotations_1.degrees(0), + hidden: options === null || options === void 0 ? void 0 : options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + var apStateValue = this.acroField.addWidgetWithOpt(widgetRef, core_1.PDFHexString.fromText(option), !this.isMutuallyExclusive()); + // Set appearance streams for widget + widget.setAppearanceState(core_1.PDFName.of('Off')); + this.updateWidgetAppearance(widget, apStateValue); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if any of this group's radio button widgets do not have an + * appearance stream for their current state. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * if (radioGroup.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this radio group needs an appearance update. + */ + PDFRadioGroup.prototype.needsAppearancesUpdate = function () { + var _a; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state = widget.getAppearanceState(); + var normal = (_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal; + if (!(normal instanceof core_1.PDFDict)) + return true; + if (state && !normal.has(state)) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this group's radio button widgets + * using the default appearance provider for radio groups. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.defaultUpdateAppearances() + * ``` + */ + PDFRadioGroup.prototype.defaultUpdateAppearances = function () { + this.updateAppearances(); + }; + // rg.updateAppearances((field: any, widget: any) => { + // assert(field === rg); + // assert(widget instanceof PDFWidgetAnnotation); + // return { on: [...rectangle, ...circle], off: [...rectangle, ...circle] }; + // }); + /** + * Update the appearance streams for each of this group's radio button widgets + * using the given appearance provider. If no `provider` is passed, the + * default appearance provider for radio groups will be used. For example: + * ```js + * const radioGroup = form.getRadioGroup('some.radioGroup.field') + * radioGroup.updateAppearances((field, widget) => { + * ... + * return { + * normal: { on: drawRadioButton(...), off: drawRadioButton(...) }, + * down: { on: drawRadioButton(...), off: drawRadioButton(...) }, + * } + * }) + * ``` + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFRadioGroup.prototype.updateAppearances = function (provider) { + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var onValue = widget.getOnValue(); + if (!onValue) + continue; + this.updateWidgetAppearance(widget, onValue, provider); + } + }; + PDFRadioGroup.prototype.updateWidgetAppearance = function (widget, onValue, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultRadioGroupAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget)); + this.updateOnOffWidgetAppearance(widget, onValue, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getOptionList]] method, which will create an + * > instance of [[PDFOptionList]] for you. + * + * Create an instance of [[PDFOptionList]] from an existing acroRadioButton + * and ref + * + * @param acroRadioButton The underlying `PDFAcroRadioButton` for this + * radio group. + * @param ref The unique reference for this radio group. + * @param doc The document to which this radio group will belong. + */ + PDFRadioGroup.of = function (acroRadioButton, ref, doc) { return new PDFRadioGroup(acroRadioButton, ref, doc); }; + return PDFRadioGroup; +}(PDFField_1.default)); +exports.default = PDFRadioGroup; +//# sourceMappingURL=PDFRadioGroup.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFRadioGroup.js.map b/cjs/api/form/PDFRadioGroup.js.map new file mode 100644 index 000000000..de0b639e0 --- /dev/null +++ b/cjs/api/form/PDFRadioGroup.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRadioGroup.js","sourceRoot":"","sources":["../../../src/api/form/PDFRadioGroup.ts"],"names":[],"mappings":";;;AACA,+DAAsC;AACtC,6DAG+B;AAC/B,6CAIkC;AAClC,oCAAqC;AACrC,0CAA4C;AAE5C,mCAQkB;AAClB,qCAAuE;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH;IAA2C,yCAAQ;IAuBjD,uBACE,eAAmC,EACnC,GAAW,EACX,GAAgB;QAHlB,YAKE,kBAAM,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,SAOjC;QALC,gBAAQ,CAAC,eAAe,EAAE,iBAAiB,EAAE;YAC3C,CAAC,yBAAkB,EAAE,oBAAoB,CAAC;SAC3C,CAAC,CAAC;QAEH,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;;IACnC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,kCAAU,GAAV;QACE,IAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QACtD,IAAI,YAAY,EAAE;YAChB,IAAM,aAAa,GAAG,IAAI,KAAK,CAAS,YAAY,CAAC,MAAM,CAAC,CAAC;YAC7D,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBAC7D,aAAa,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;aACrD;YACD,OAAO,aAAa,CAAC;SACtB;QAED,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC9C,IAAM,SAAS,GAAG,IAAI,KAAK,CAAS,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrD,K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AAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO;gBAAE,SAAS;YACvB,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;SACxD;IACH,CAAC;IAEO,8CAAsB,GAA9B,UACE,MAA2B,EAC3B,OAAgB,EAChB,QAA+C;QAE/C,IAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,iDAAmC,CAAC;QACnE,IAAM,WAAW,GAAG,iCAAmB,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IA1aD;;;;;;;;;;;;OAYG;IACI,gBAAE,GAAG,UACV,eAAmC,EACnC,GAAW,EACX,GAAgB,IACb,OAAA,IAAI,aAAa,CAAC,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,EAA5C,CAA4C,CAAC;IA0ZpD,oBAAC;CAAA,AA5aD,CAA2C,kBAAQ,GA4alD;kBA5aoB,aAAa"} \ No newline at end of file diff --git a/cjs/api/form/PDFSignature.d.ts b/cjs/api/form/PDFSignature.d.ts new file mode 100644 index 000000000..cf5e199a1 --- /dev/null +++ b/cjs/api/form/PDFSignature.d.ts @@ -0,0 +1,30 @@ +import PDFDocument from "../PDFDocument"; +import PDFField from "./PDFField"; +import { PDFRef, PDFAcroSignature } from "../../core"; +/** + * Represents a signature field of a [[PDFForm]]. + * + * [[PDFSignature]] fields are digital signatures. `pdf-lib` does not + * currently provide any specialized APIs for creating digital signatures or + * reading the contents of existing digital signatures. + */ +export default class PDFSignature extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getSignature]] method, which will create an + * > instance of [[PDFSignature]] for you. + * + * Create an instance of [[PDFSignature]] from an existing acroSignature and + * ref + * + * @param acroSignature The underlying `PDFAcroSignature` for this signature. + * @param ref The unique reference for this signature. + * @param doc The document to which this signature will belong. + */ + static of: (acroSignature: PDFAcroSignature, ref: PDFRef, doc: PDFDocument) => PDFSignature; + /** The low-level PDFAcroSignature wrapped by this signature. */ + readonly acroField: PDFAcroSignature; + private constructor(); + needsAppearancesUpdate(): boolean; +} +//# sourceMappingURL=PDFSignature.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFSignature.d.ts.map b/cjs/api/form/PDFSignature.d.ts.map new file mode 100644 index 000000000..733c217e4 --- /dev/null +++ b/cjs/api/form/PDFSignature.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFSignature.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFSignature.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,QAAQ,mBAA8B;AAE7C,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAiB;AAGpD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,QAAQ;IAChD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,kBACQ,gBAAgB,OAC1B,MAAM,OACN,WAAW,kBAC6B;IAE/C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAErC,OAAO;IAcP,sBAAsB;CAGvB"} \ No newline at end of file diff --git a/cjs/api/form/PDFSignature.js b/cjs/api/form/PDFSignature.js new file mode 100644 index 000000000..4f1f5e671 --- /dev/null +++ b/cjs/api/form/PDFSignature.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFField_1 = tslib_1.__importDefault(require("./PDFField")); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a signature field of a [[PDFForm]]. + * + * [[PDFSignature]] fields are digital signatures. `pdf-lib` does not + * currently provide any specialized APIs for creating digital signatures or + * reading the contents of existing digital signatures. + */ +var PDFSignature = /** @class */ (function (_super) { + tslib_1.__extends(PDFSignature, _super); + function PDFSignature(acroSignature, ref, doc) { + var _this = _super.call(this, acroSignature, ref, doc) || this; + utils_1.assertIs(acroSignature, 'acroSignature', [ + [core_1.PDFAcroSignature, 'PDFAcroSignature'], + ]); + _this.acroField = acroSignature; + return _this; + } + PDFSignature.prototype.needsAppearancesUpdate = function () { + return false; + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getSignature]] method, which will create an + * > instance of [[PDFSignature]] for you. + * + * Create an instance of [[PDFSignature]] from an existing acroSignature and + * ref + * + * @param acroSignature The underlying `PDFAcroSignature` for this signature. + * @param ref The unique reference for this signature. + * @param doc The document to which this signature will belong. + */ + PDFSignature.of = function (acroSignature, ref, doc) { return new PDFSignature(acroSignature, ref, doc); }; + return PDFSignature; +}(PDFField_1.default)); +exports.default = PDFSignature; +//# sourceMappingURL=PDFSignature.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFSignature.js.map b/cjs/api/form/PDFSignature.js.map new file mode 100644 index 000000000..a0e8f1265 --- /dev/null +++ b/cjs/api/form/PDFSignature.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFSignature.js","sourceRoot":"","sources":["../../../src/api/form/PDFSignature.ts"],"names":[],"mappings":";;;AACA,gEAA6C;AAE7C,mCAAoD;AACpD,qCAAqC;AAErC;;;;;;GAMG;AACH;IAA0C,wCAAQ;IAsBhD,sBACE,aAA+B,EAC/B,GAAW,EACX,GAAgB;QAHlB,YAKE,kBAAM,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,SAO/B;QALC,gBAAQ,CAAC,aAAa,EAAE,eAAe,EAAE;YACvC,CAAC,uBAAgB,EAAE,kBAAkB,CAAC;SACvC,CAAC,CAAC;QAEH,KAAI,CAAC,SAAS,GAAG,aAAa,CAAC;;IACjC,CAAC;IAED,6CAAsB,GAAtB;QACE,OAAO,KAAK,CAAC;IACf,CAAC;IArCD;;;;;;;;;;;OAWG;IACI,eAAE,GAAG,UACV,aAA+B,EAC/B,GAAW,EACX,GAAgB,IACb,OAAA,IAAI,YAAY,CAAC,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,EAAzC,CAAyC,CAAC;IAsBjD,mBAAC;CAAA,AAvCD,CAA0C,kBAAQ,GAuCjD;kBAvCoB,YAAY"} \ No newline at end of file diff --git a/cjs/api/form/PDFTextField.d.ts b/cjs/api/form/PDFTextField.d.ts new file mode 100644 index 000000000..431030b08 --- /dev/null +++ b/cjs/api/form/PDFTextField.d.ts @@ -0,0 +1,538 @@ +import PDFDocument from "../PDFDocument"; +import PDFPage from "../PDFPage"; +import PDFFont from "../PDFFont"; +import PDFImage from "../PDFImage"; +import PDFField, { FieldAppearanceOptions } from "./PDFField"; +import { AppearanceProviderFor } from "./appearances"; +import { TextAlignment } from "../text/alignment"; +import { PDFRef, PDFAcroText } from "../../core"; +/** + * Represents a text field of a [[PDFForm]]. + * + * [[PDFTextField]] fields are boxes that display text entered by the user. The + * purpose of a text field is to enable users to enter text or view text values + * in the document prefilled by software. Users can click on a text field and + * input text via their keyboard. Some text fields allow multiple lines of text + * to be entered (see [[PDFTextField.isMultiline]]). + */ +export default class PDFTextField extends PDFField { + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getTextField]] method, which will create an + * > instance of [[PDFTextField]] for you. + * + * Create an instance of [[PDFTextField]] from an existing acroText and ref + * + * @param acroText The underlying `PDFAcroText` for this text field. + * @param ref The unique reference for this text field. + * @param doc The document to which this text field will belong. + */ + static of: (acroText: PDFAcroText, ref: PDFRef, doc: PDFDocument) => PDFTextField; + /** The low-level PDFAcroText wrapped by this text field. */ + readonly acroField: PDFAcroText; + private constructor(); + /** + * Get the text that this field contains. This text is visible to users who + * view this field in a PDF reader. + * + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const text = textField.getText() + * console.log('Text field contents:', text) + * ``` + * + * Note that if this text field contains no underlying value, `undefined` + * will be returned. Text fields may also contain an underlying value that + * is simply an empty string (`''`). This detail is largely irrelevant for + * most applications. In general, you'll want to treat both cases the same + * way and simply consider the text field to be empty. In either case, the + * text field will appear empty to users when viewed in a PDF reader. + * + * An error will be thrown if this is a rich text field. `pdf-lib` does not + * support reading rich text fields. Nor do most PDF readers and writers. + * Rich text fields are based on XFA (XML Forms Architecture). Relatively few + * PDFs use rich text fields or XFA. Unlike PDF itself, XFA is not an ISO + * standard. XFA has been deprecated in PDF 2.0: + * * https://en.wikipedia.org/wiki/XFA + * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/ + * + * @returns The text contained in this text field. + */ + getText(): string | undefined; + /** + * Set the text for this field. This operation is analogous to a human user + * clicking on the text field in a PDF reader and typing in text via their + * keyboard. This method will update the underlying state of the text field + * to indicate what text has been set. PDF libraries and readers will be able + * to extract these values from the saved document and determine what text + * was set. + * + * For example: + * ```js + * const textField = form.getTextField('best.superhero.text.field') + * textField.setText('One Punch Man') + * ``` + * + * This method will mark this text field as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the text this field contains inside the widgets of this text + * field. + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if this field contains text outside + * the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFTextField.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * If this is a rich text field, it will be converted to a standard text + * field in order to set the text. `pdf-lib` does not support writing rich + * text strings. Nor do most PDF readers and writers. See + * [[PDFTextField.getText]] for more information about rich text fields and + * their deprecation in PDF 2.0. + * + * @param text The text this field should contain. + */ + setText(text: string | undefined): void; + /** + * Get the alignment for this text field. This value represents the + * justification of the text when it is displayed to the user in PDF readers. + * There are three possible alignments: left, center, and right. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const alignment = textField.getAlignment() + * if (alignment === TextAlignment.Left) console.log('Text is left justified') + * if (alignment === TextAlignment.Center) console.log('Text is centered') + * if (alignment === TextAlignment.Right) console.log('Text is right justified') + * ``` + * @returns The alignment of this text field. + */ + getAlignment(): TextAlignment; + /** + * Set the alignment for this text field. This will determine the + * justification of the text when it is displayed to the user in PDF readers. + * There are three possible alignments: left, center, and right. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * + * // Text will be left justified when displayed + * textField.setAlignment(TextAlignment.Left) + * + * // Text will be centered when displayed + * textField.setAlignment(TextAlignment.Center) + * + * // Text will be right justified when displayed + * textField.setAlignment(TextAlignment.Right) + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + * @param alignment The alignment for this text field. + */ + setAlignment(alignment: TextAlignment): void; + /** + * Get the maximum length of this field. This value represents the maximum + * number of characters that can be typed into this field by the user. If + * this field does not have a maximum length, `undefined` is returned. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const maxLength = textField.getMaxLength() + * if (maxLength === undefined) console.log('No max length') + * else console.log(`Max length is ${maxLength}`) + * ``` + * @returns The maximum number of characters allowed in this field, or + * `undefined` if no limit exists. + */ + getMaxLength(): number | undefined; + /** + * Set the maximum length of this field. This limits the number of characters + * that can be typed into this field by the user. This also limits the length + * of the string that can be passed to [[PDFTextField.setText]]. This limit + * can be removed by passing `undefined` as `maxLength`. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * + * // Allow between 0 and 5 characters to be entered + * textField.setMaxLength(5) + * + * // Allow any number of characters to be entered + * textField.setMaxLength(undefined) + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + * @param maxLength The maximum number of characters allowed in this field, or + * `undefined` to remove the limit. + */ + setMaxLength(maxLength?: number): void; + /** + * Remove the maximum length for this text field. This allows any number of + * characters to be typed into this field by the user. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.removeMaxLength() + * ``` + * Calling this method is equivalent to passing `undefined` to + * [[PDFTextField.setMaxLength]]. + */ + removeMaxLength(): void; + /** + * Display an image inside the bounds of this text field's widgets. For example: + * ```js + * const pngImage = await pdfDoc.embedPng(...) + * const textField = form.getTextField('some.text.field') + * textField.setImage(pngImage) + * ``` + * This will update the appearances streams for each of this text field's widgets. + * @param image The image that should be displayed. + */ + setImage(image: PDFImage): void; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this text field. Font sizes + * may be integer or floating point numbers. Supplying a negative font size + * will cause this method to throw an error. + * + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.setFontSize(4) + * textField.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + setFontSize(fontSize: number): void; + /** + * Returns `true` if each line of text is shown on a new line when this + * field is displayed in a PDF reader. The alternative is that all lines of + * text are merged onto a single line when displayed. See + * [[PDFTextField.enableMultiline]] and [[PDFTextField.disableMultiline]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isMultiline()) console.log('Multiline is enabled') + * ``` + * @returns Whether or not this is a multiline text field. + */ + isMultiline(): boolean; + /** + * Display each line of text on a new line when this field is displayed in a + * PDF reader. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableMultiline() + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + enableMultiline(): void; + /** + * Display each line of text on the same line when this field is displayed + * in a PDF reader. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableMultiline() + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + disableMultiline(): void; + /** + * Returns `true` if this is a password text field. This means that the field + * is intended for storing a secure password. See + * [[PDFTextField.enablePassword]] and [[PDFTextField.disablePassword]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isPassword()) console.log('Password is enabled') + * ``` + * @returns Whether or not this is a password text field. + */ + isPassword(): boolean; + /** + * Indicate that this text field is intended for storing a secure password. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enablePassword() + * ``` + * Values entered into password text fields should not be displayed on the + * screen by PDF readers. Most PDF readers will display the value as + * asterisks or bullets. PDF readers should never store values entered by the + * user into password text fields. Similarly, applications should not + * write data to a password text field. + * + * **Please note that this method does not cause entered values to be + * encrypted or secured in any way! It simply sets a flag that PDF software + * and readers can access to determine the _purpose_ of this field.** + */ + enablePassword(): void; + /** + * Indicate that this text field is **not** intended for storing a secure + * password. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disablePassword() + * ``` + */ + disablePassword(): void; + /** + * Returns `true` if the contents of this text field represent a file path. + * See [[PDFTextField.enableFileSelection]] and + * [[PDFTextField.disableFileSelection]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isFileSelector()) console.log('Is a file selector') + * ``` + * @returns Whether or not this field should contain file paths. + */ + isFileSelector(): boolean; + /** + * Indicate that this text field is intended to store a file path. The + * contents of the file stored at that path should be submitted as the value + * of the field. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableFileSelection() + * ``` + */ + enableFileSelection(): void; + /** + * Indicate that this text field is **not** intended to store a file path. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableFileSelection() + * ``` + */ + disableFileSelection(): void; + /** + * Returns `true` if the text entered in this field should be spell checked + * by PDF readers. See [[PDFTextField.enableSpellChecking]] and + * [[PDFTextField.disableSpellChecking]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isSpellChecked()) console.log('Spell checking is enabled') + * ``` + * @returns Whether or not this field should be spell checked. + */ + isSpellChecked(): boolean; + /** + * Allow PDF readers to spell check the text entered in this field. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableSpellChecking() + * ``` + */ + enableSpellChecking(): void; + /** + * Do not allow PDF readers to spell check the text entered in this field. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableSpellChecking() + * ``` + */ + disableSpellChecking(): void; + /** + * Returns `true` if PDF readers should allow the user to scroll the text + * field when its contents do not fit within the field's view bounds. See + * [[PDFTextField.enableScrolling]] and [[PDFTextField.disableScrolling]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isScrollable()) console.log('Scrolling is enabled') + * ``` + * @returns Whether or not the field is scrollable in PDF readers. + */ + isScrollable(): boolean; + /** + * Allow PDF readers to present a scroll bar to the user when the contents + * of this text field do not fit within its view bounds. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableScrolling() + * ``` + * A horizontal scroll bar should be shown for singleline fields. A vertical + * scroll bar should be shown for multiline fields. + */ + enableScrolling(): void; + /** + * Do not allow PDF readers to present a scroll bar to the user when the + * contents of this text field do not fit within its view bounds. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableScrolling() + * ``` + */ + disableScrolling(): void; + /** + * Returns `true` if this is a combed text field. This means that the field + * is split into `n` equal size cells with one character in each (where `n` + * is equal to the max length of the text field). The result is that all + * characters in this field are displayed an equal distance apart from one + * another. See [[PDFTextField.enableCombing]] and + * [[PDFTextField.disableCombing]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isCombed()) console.log('Combing is enabled') + * ``` + * Note that in order for a text field to be combed, the following must be + * true (in addition to enabling combing): + * * It must not be a multiline field (see [[PDFTextField.isMultiline]]) + * * It must not be a password field (see [[PDFTextField.isPassword]]) + * * It must not be a file selector field (see [[PDFTextField.isFileSelector]]) + * * It must have a max length defined (see [[PDFTextField.setMaxLength]]) + * @returns Whether or not this field is combed. + */ + isCombed(): boolean; + /** + * Split this field into `n` equal size cells with one character in each + * (where `n` is equal to the max length of the text field). This will cause + * all characters in the field to be displayed an equal distance apart from + * one another. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableCombing() + * ``` + * + * In addition to calling this method, text fields must have a max length + * defined in order to be combed (see [[PDFTextField.setMaxLength]]). + * + * This method will also call the following three methods internally: + * * [[PDFTextField.disableMultiline]] + * * [[PDFTextField.disablePassword]] + * * [[PDFTextField.disableFileSelection]] + * + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + enableCombing(): void; + /** + * Turn off combing for this text field. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableCombing() + * ``` + * See [[PDFTextField.isCombed]] and [[PDFTextField.enableCombing]] for more + * information about what combing is. + * + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + disableCombing(): void; + /** + * Returns `true` if this text field contains rich text. See + * [[PDFTextField.enableRichFormatting]] and + * [[PDFTextField.disableRichFormatting]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isRichFormatted()) console.log('Rich formatting enabled') + * ``` + * @returns Whether or not this field contains rich text. + */ + isRichFormatted(): boolean; + /** + * Indicate that this field contains XFA data - or rich text. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableRichFormatting() + * ``` + * Note that `pdf-lib` does not support reading or writing rich text fields. + * Nor do most PDF readers and writers. Rich text fields are based on XFA + * (XML Forms Architecture). Relatively few PDFs use rich text fields or XFA. + * Unlike PDF itself, XFA is not an ISO standard. XFA has been deprecated in + * PDF 2.0: + * * https://en.wikipedia.org/wiki/XFA + * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/ + */ + enableRichFormatting(): void; + /** + * Indicate that this is a standard text field that does not XFA data (rich + * text). For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableRichFormatting() + * ``` + */ + disableRichFormatting(): void; + /** + * Show this text field on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const textField = form.createTextField('best.gundam') + * textField.setText('Exia') + * + * textField.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this text field. + * @param page The page to which this text field widget should be added. + * @param options The options to be used when adding this text field widget. + */ + addToPage(page: PDFPage, options?: FieldAppearanceOptions): void; + /** + * Returns `true` if this text field has been marked as dirty, or if any of + * this text field's widgets do not have an appearance stream. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this text field needs an appearance update. + */ + needsAppearancesUpdate(): boolean; + /** + * Update the appearance streams for each of this text field's widgets using + * the default appearance provider for text fields. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const textField = form.getTextField('some.text.field') + * textField.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + defaultUpdateAppearances(font: PDFFont): void; + /** + * Update the appearance streams for each of this text field's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for text fields will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const textField = form.getTextField('some.text.field') + * textField.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawTextField(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + updateAppearances(font: PDFFont, provider?: AppearanceProviderFor): void; + private updateWidgetAppearance; +} +//# sourceMappingURL=PDFTextField.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/PDFTextField.d.ts.map b/cjs/api/form/PDFTextField.d.ts.map new file mode 100644 index 000000000..fea724789 --- /dev/null +++ b/cjs/api/form/PDFTextField.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTextField.d.ts","sourceRoot":"","sources":["../../../src/api/form/PDFTextField.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,uBAA4B;AAC9C,OAAO,OAAO,mBAAwB;AACtC,OAAO,OAAO,mBAAwB;AACtC,OAAO,QAAQ,oBAAyB;AACxC,OAAO,QAAQ,EAAE,EACf,sBAAsB,EAEvB,mBAA8B;AAC/B,OAAO,EACL,qBAAqB,EAGtB,sBAAiC;AASlC,OAAO,EAAE,aAAa,EAAE,0BAA+B;AAEvD,OAAO,EAEL,MAAM,EAEN,WAAW,EAGZ,mBAAiB;AASlB;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,QAAQ;IAChD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,aAAc,WAAW,OAAO,MAAM,OAAO,WAAW,kBAC1B;IAEvC,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAEhC,OAAO;IAQP;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,IAAI,MAAM,GAAG,SAAS;IAQ7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAkBhC;;;;;;;;;;;;OAYG;IACH,YAAY,IAAI,aAAa;IAY7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,CAAC,SAAS,EAAE,aAAa;IAMrC;;;;;;;;;;;;;OAaG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM;IAgB/B;;;;;;;;;OASG;IACH,eAAe;IAKf;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ;I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;IAahD,OAAO,CAAC,sBAAsB;CAS/B"} \ No newline at end of file diff --git a/cjs/api/form/PDFTextField.js b/cjs/api/form/PDFTextField.js new file mode 100644 index 000000000..45e959f25 --- /dev/null +++ b/cjs/api/form/PDFTextField.js @@ -0,0 +1,739 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFPage_1 = tslib_1.__importDefault(require("../PDFPage")); +var PDFFont_1 = tslib_1.__importDefault(require("../PDFFont")); +var PDFField_1 = tslib_1.__importStar(require("./PDFField")); +var appearances_1 = require("./appearances"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var errors_1 = require("../errors"); +var alignment_1 = require("../image/alignment"); +var alignment_2 = require("../text/alignment"); +var core_1 = require("../../core"); +var utils_1 = require("../../utils"); +/** + * Represents a text field of a [[PDFForm]]. + * + * [[PDFTextField]] fields are boxes that display text entered by the user. The + * purpose of a text field is to enable users to enter text or view text values + * in the document prefilled by software. Users can click on a text field and + * input text via their keyboard. Some text fields allow multiple lines of text + * to be entered (see [[PDFTextField.isMultiline]]). + */ +var PDFTextField = /** @class */ (function (_super) { + tslib_1.__extends(PDFTextField, _super); + function PDFTextField(acroText, ref, doc) { + var _this = _super.call(this, acroText, ref, doc) || this; + utils_1.assertIs(acroText, 'acroText', [[core_1.PDFAcroText, 'PDFAcroText']]); + _this.acroField = acroText; + return _this; + } + /** + * Get the text that this field contains. This text is visible to users who + * view this field in a PDF reader. + * + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const text = textField.getText() + * console.log('Text field contents:', text) + * ``` + * + * Note that if this text field contains no underlying value, `undefined` + * will be returned. Text fields may also contain an underlying value that + * is simply an empty string (`''`). This detail is largely irrelevant for + * most applications. In general, you'll want to treat both cases the same + * way and simply consider the text field to be empty. In either case, the + * text field will appear empty to users when viewed in a PDF reader. + * + * An error will be thrown if this is a rich text field. `pdf-lib` does not + * support reading rich text fields. Nor do most PDF readers and writers. + * Rich text fields are based on XFA (XML Forms Architecture). Relatively few + * PDFs use rich text fields or XFA. Unlike PDF itself, XFA is not an ISO + * standard. XFA has been deprecated in PDF 2.0: + * * https://en.wikipedia.org/wiki/XFA + * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/ + * + * @returns The text contained in this text field. + */ + PDFTextField.prototype.getText = function () { + var value = this.acroField.getValue(); + if (!value && this.isRichFormatted()) { + throw new errors_1.RichTextFieldReadError(this.getName()); + } + return value === null || value === void 0 ? void 0 : value.decodeText(); + }; + /** + * Set the text for this field. This operation is analogous to a human user + * clicking on the text field in a PDF reader and typing in text via their + * keyboard. This method will update the underlying state of the text field + * to indicate what text has been set. PDF libraries and readers will be able + * to extract these values from the saved document and determine what text + * was set. + * + * For example: + * ```js + * const textField = form.getTextField('best.superhero.text.field') + * textField.setText('One Punch Man') + * ``` + * + * This method will mark this text field as dirty, causing its appearance + * streams to be updated when either [[PDFDocument.save]] or + * [[PDFForm.updateFieldAppearances]] is called. The updated streams will + * display the text this field contains inside the widgets of this text + * field. + * + * **IMPORTANT:** The default font used to update appearance streams is + * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means + * that encoding errors will be thrown if this field contains text outside + * the WinAnsi character set (the latin alphabet). + * + * Embedding a custom font and passing it to + * [[PDFForm.updateFieldAppearances]] or [[PDFTextField.updateAppearances]] + * allows you to generate appearance streams with characters outside the + * latin alphabet (assuming the custom font supports them). + * + * If this is a rich text field, it will be converted to a standard text + * field in order to set the text. `pdf-lib` does not support writing rich + * text strings. Nor do most PDF readers and writers. See + * [[PDFTextField.getText]] for more information about rich text fields and + * their deprecation in PDF 2.0. + * + * @param text The text this field should contain. + */ + PDFTextField.prototype.setText = function (text) { + utils_1.assertOrUndefined(text, 'text', ['string']); + var maxLength = this.getMaxLength(); + if (maxLength !== undefined && text && text.length > maxLength) { + throw new errors_1.ExceededMaxLengthError(text.length, maxLength, this.getName()); + } + this.markAsDirty(); + this.disableRichFormatting(); + if (text) { + this.acroField.setValue(core_1.PDFHexString.fromText(text)); + } + else { + this.acroField.removeValue(); + } + }; + /** + * Get the alignment for this text field. This value represents the + * justification of the text when it is displayed to the user in PDF readers. + * There are three possible alignments: left, center, and right. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const alignment = textField.getAlignment() + * if (alignment === TextAlignment.Left) console.log('Text is left justified') + * if (alignment === TextAlignment.Center) console.log('Text is centered') + * if (alignment === TextAlignment.Right) console.log('Text is right justified') + * ``` + * @returns The alignment of this text field. + */ + PDFTextField.prototype.getAlignment = function () { + var quadding = this.acroField.getQuadding(); + // prettier-ignore + return (quadding === 0 ? alignment_2.TextAlignment.Left + : quadding === 1 ? alignment_2.TextAlignment.Center + : quadding === 2 ? alignment_2.TextAlignment.Right + : alignment_2.TextAlignment.Left); + }; + /** + * Set the alignment for this text field. This will determine the + * justification of the text when it is displayed to the user in PDF readers. + * There are three possible alignments: left, center, and right. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * + * // Text will be left justified when displayed + * textField.setAlignment(TextAlignment.Left) + * + * // Text will be centered when displayed + * textField.setAlignment(TextAlignment.Center) + * + * // Text will be right justified when displayed + * textField.setAlignment(TextAlignment.Right) + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + * @param alignment The alignment for this text field. + */ + PDFTextField.prototype.setAlignment = function (alignment) { + utils_1.assertIsOneOf(alignment, 'alignment', alignment_2.TextAlignment); + this.markAsDirty(); + this.acroField.setQuadding(alignment); + }; + /** + * Get the maximum length of this field. This value represents the maximum + * number of characters that can be typed into this field by the user. If + * this field does not have a maximum length, `undefined` is returned. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * const maxLength = textField.getMaxLength() + * if (maxLength === undefined) console.log('No max length') + * else console.log(`Max length is ${maxLength}`) + * ``` + * @returns The maximum number of characters allowed in this field, or + * `undefined` if no limit exists. + */ + PDFTextField.prototype.getMaxLength = function () { + return this.acroField.getMaxLength(); + }; + /** + * Set the maximum length of this field. This limits the number of characters + * that can be typed into this field by the user. This also limits the length + * of the string that can be passed to [[PDFTextField.setText]]. This limit + * can be removed by passing `undefined` as `maxLength`. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * + * // Allow between 0 and 5 characters to be entered + * textField.setMaxLength(5) + * + * // Allow any number of characters to be entered + * textField.setMaxLength(undefined) + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + * @param maxLength The maximum number of characters allowed in this field, or + * `undefined` to remove the limit. + */ + PDFTextField.prototype.setMaxLength = function (maxLength) { + utils_1.assertRangeOrUndefined(maxLength, 'maxLength', 0, Number.MAX_SAFE_INTEGER); + this.markAsDirty(); + if (maxLength === undefined) { + this.acroField.removeMaxLength(); + } + else { + var text = this.getText(); + if (text && text.length > maxLength) { + throw new errors_1.InvalidMaxLengthError(text.length, maxLength, this.getName()); + } + this.acroField.setMaxLength(maxLength); + } + }; + /** + * Remove the maximum length for this text field. This allows any number of + * characters to be typed into this field by the user. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.removeMaxLength() + * ``` + * Calling this method is equivalent to passing `undefined` to + * [[PDFTextField.setMaxLength]]. + */ + PDFTextField.prototype.removeMaxLength = function () { + this.markAsDirty(); + this.acroField.removeMaxLength(); + }; + /** + * Display an image inside the bounds of this text field's widgets. For example: + * ```js + * const pngImage = await pdfDoc.embedPng(...) + * const textField = form.getTextField('some.text.field') + * textField.setImage(pngImage) + * ``` + * This will update the appearances streams for each of this text field's widgets. + * @param image The image that should be displayed. + */ + PDFTextField.prototype.setImage = function (image) { + var fieldAlignment = this.getAlignment(); + // prettier-ignore + var alignment = fieldAlignment === alignment_2.TextAlignment.Center ? alignment_1.ImageAlignment.Center + : fieldAlignment === alignment_2.TextAlignment.Right ? alignment_1.ImageAlignment.Right + : alignment_1.ImageAlignment.Left; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var streamRef = this.createImageAppearanceStream(widget, image, alignment); + this.updateWidgetAppearances(widget, { normal: streamRef }); + } + this.markAsClean(); + }; + /** + * Set the font size for this field. Larger font sizes will result in larger + * text being displayed when PDF readers render this text field. Font sizes + * may be integer or floating point numbers. Supplying a negative font size + * will cause this method to throw an error. + * + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.setFontSize(4) + * textField.setFontSize(15.7) + * ``` + * + * > This method depends upon the existence of a default appearance + * > (`/DA`) string. If this field does not have a default appearance string, + * > or that string does not contain a font size (via the `Tf` operator), + * > then this method will throw an error. + * + * @param fontSize The font size to be used when rendering text in this field. + */ + PDFTextField.prototype.setFontSize = function (fontSize) { + utils_1.assertPositive(fontSize, 'fontSize'); + this.acroField.setFontSize(fontSize); + this.markAsDirty(); + }; + /** + * Returns `true` if each line of text is shown on a new line when this + * field is displayed in a PDF reader. The alternative is that all lines of + * text are merged onto a single line when displayed. See + * [[PDFTextField.enableMultiline]] and [[PDFTextField.disableMultiline]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isMultiline()) console.log('Multiline is enabled') + * ``` + * @returns Whether or not this is a multiline text field. + */ + PDFTextField.prototype.isMultiline = function () { + return this.acroField.hasFlag(core_1.AcroTextFlags.Multiline); + }; + /** + * Display each line of text on a new line when this field is displayed in a + * PDF reader. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableMultiline() + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + PDFTextField.prototype.enableMultiline = function () { + this.markAsDirty(); + this.acroField.setFlagTo(core_1.AcroTextFlags.Multiline, true); + }; + /** + * Display each line of text on the same line when this field is displayed + * in a PDF reader. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableMultiline() + * ``` + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + PDFTextField.prototype.disableMultiline = function () { + this.markAsDirty(); + this.acroField.setFlagTo(core_1.AcroTextFlags.Multiline, false); + }; + /** + * Returns `true` if this is a password text field. This means that the field + * is intended for storing a secure password. See + * [[PDFTextField.enablePassword]] and [[PDFTextField.disablePassword]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isPassword()) console.log('Password is enabled') + * ``` + * @returns Whether or not this is a password text field. + */ + PDFTextField.prototype.isPassword = function () { + return this.acroField.hasFlag(core_1.AcroTextFlags.Password); + }; + /** + * Indicate that this text field is intended for storing a secure password. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enablePassword() + * ``` + * Values entered into password text fields should not be displayed on the + * screen by PDF readers. Most PDF readers will display the value as + * asterisks or bullets. PDF readers should never store values entered by the + * user into password text fields. Similarly, applications should not + * write data to a password text field. + * + * **Please note that this method does not cause entered values to be + * encrypted or secured in any way! It simply sets a flag that PDF software + * and readers can access to determine the _purpose_ of this field.** + */ + PDFTextField.prototype.enablePassword = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.Password, true); + }; + /** + * Indicate that this text field is **not** intended for storing a secure + * password. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disablePassword() + * ``` + */ + PDFTextField.prototype.disablePassword = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.Password, false); + }; + /** + * Returns `true` if the contents of this text field represent a file path. + * See [[PDFTextField.enableFileSelection]] and + * [[PDFTextField.disableFileSelection]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isFileSelector()) console.log('Is a file selector') + * ``` + * @returns Whether or not this field should contain file paths. + */ + PDFTextField.prototype.isFileSelector = function () { + return this.acroField.hasFlag(core_1.AcroTextFlags.FileSelect); + }; + /** + * Indicate that this text field is intended to store a file path. The + * contents of the file stored at that path should be submitted as the value + * of the field. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableFileSelection() + * ``` + */ + PDFTextField.prototype.enableFileSelection = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.FileSelect, true); + }; + /** + * Indicate that this text field is **not** intended to store a file path. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableFileSelection() + * ``` + */ + PDFTextField.prototype.disableFileSelection = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.FileSelect, false); + }; + /** + * Returns `true` if the text entered in this field should be spell checked + * by PDF readers. See [[PDFTextField.enableSpellChecking]] and + * [[PDFTextField.disableSpellChecking]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isSpellChecked()) console.log('Spell checking is enabled') + * ``` + * @returns Whether or not this field should be spell checked. + */ + PDFTextField.prototype.isSpellChecked = function () { + return !this.acroField.hasFlag(core_1.AcroTextFlags.DoNotSpellCheck); + }; + /** + * Allow PDF readers to spell check the text entered in this field. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableSpellChecking() + * ``` + */ + PDFTextField.prototype.enableSpellChecking = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.DoNotSpellCheck, false); + }; + /** + * Do not allow PDF readers to spell check the text entered in this field. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableSpellChecking() + * ``` + */ + PDFTextField.prototype.disableSpellChecking = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.DoNotSpellCheck, true); + }; + /** + * Returns `true` if PDF readers should allow the user to scroll the text + * field when its contents do not fit within the field's view bounds. See + * [[PDFTextField.enableScrolling]] and [[PDFTextField.disableScrolling]]. + * For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isScrollable()) console.log('Scrolling is enabled') + * ``` + * @returns Whether or not the field is scrollable in PDF readers. + */ + PDFTextField.prototype.isScrollable = function () { + return !this.acroField.hasFlag(core_1.AcroTextFlags.DoNotScroll); + }; + /** + * Allow PDF readers to present a scroll bar to the user when the contents + * of this text field do not fit within its view bounds. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableScrolling() + * ``` + * A horizontal scroll bar should be shown for singleline fields. A vertical + * scroll bar should be shown for multiline fields. + */ + PDFTextField.prototype.enableScrolling = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.DoNotScroll, false); + }; + /** + * Do not allow PDF readers to present a scroll bar to the user when the + * contents of this text field do not fit within its view bounds. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableScrolling() + * ``` + */ + PDFTextField.prototype.disableScrolling = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.DoNotScroll, true); + }; + /** + * Returns `true` if this is a combed text field. This means that the field + * is split into `n` equal size cells with one character in each (where `n` + * is equal to the max length of the text field). The result is that all + * characters in this field are displayed an equal distance apart from one + * another. See [[PDFTextField.enableCombing]] and + * [[PDFTextField.disableCombing]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isCombed()) console.log('Combing is enabled') + * ``` + * Note that in order for a text field to be combed, the following must be + * true (in addition to enabling combing): + * * It must not be a multiline field (see [[PDFTextField.isMultiline]]) + * * It must not be a password field (see [[PDFTextField.isPassword]]) + * * It must not be a file selector field (see [[PDFTextField.isFileSelector]]) + * * It must have a max length defined (see [[PDFTextField.setMaxLength]]) + * @returns Whether or not this field is combed. + */ + PDFTextField.prototype.isCombed = function () { + return (this.acroField.hasFlag(core_1.AcroTextFlags.Comb) && + !this.isMultiline() && + !this.isPassword() && + !this.isFileSelector() && + this.getMaxLength() !== undefined); + }; + /** + * Split this field into `n` equal size cells with one character in each + * (where `n` is equal to the max length of the text field). This will cause + * all characters in the field to be displayed an equal distance apart from + * one another. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableCombing() + * ``` + * + * In addition to calling this method, text fields must have a max length + * defined in order to be combed (see [[PDFTextField.setMaxLength]]). + * + * This method will also call the following three methods internally: + * * [[PDFTextField.disableMultiline]] + * * [[PDFTextField.disablePassword]] + * * [[PDFTextField.disableFileSelection]] + * + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + PDFTextField.prototype.enableCombing = function () { + if (this.getMaxLength() === undefined) { + var msg = "PDFTextFields must have a max length in order to be combed"; + console.warn(msg); + } + this.markAsDirty(); + this.disableMultiline(); + this.disablePassword(); + this.disableFileSelection(); + this.acroField.setFlagTo(core_1.AcroTextFlags.Comb, true); + }; + /** + * Turn off combing for this text field. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableCombing() + * ``` + * See [[PDFTextField.isCombed]] and [[PDFTextField.enableCombing]] for more + * information about what combing is. + * + * This method will mark this text field as dirty. See + * [[PDFTextField.setText]] for more details about what this means. + */ + PDFTextField.prototype.disableCombing = function () { + this.markAsDirty(); + this.acroField.setFlagTo(core_1.AcroTextFlags.Comb, false); + }; + /** + * Returns `true` if this text field contains rich text. See + * [[PDFTextField.enableRichFormatting]] and + * [[PDFTextField.disableRichFormatting]]. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.isRichFormatted()) console.log('Rich formatting enabled') + * ``` + * @returns Whether or not this field contains rich text. + */ + PDFTextField.prototype.isRichFormatted = function () { + return this.acroField.hasFlag(core_1.AcroTextFlags.RichText); + }; + /** + * Indicate that this field contains XFA data - or rich text. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.enableRichFormatting() + * ``` + * Note that `pdf-lib` does not support reading or writing rich text fields. + * Nor do most PDF readers and writers. Rich text fields are based on XFA + * (XML Forms Architecture). Relatively few PDFs use rich text fields or XFA. + * Unlike PDF itself, XFA is not an ISO standard. XFA has been deprecated in + * PDF 2.0: + * * https://en.wikipedia.org/wiki/XFA + * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/ + */ + PDFTextField.prototype.enableRichFormatting = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.RichText, true); + }; + /** + * Indicate that this is a standard text field that does not XFA data (rich + * text). For example: + * ```js + * const textField = form.getTextField('some.text.field') + * textField.disableRichFormatting() + * ``` + */ + PDFTextField.prototype.disableRichFormatting = function () { + this.acroField.setFlagTo(core_1.AcroTextFlags.RichText, false); + }; + /** + * Show this text field on the specified page. For example: + * ```js + * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes) + * const page = pdfDoc.addPage() + * + * const form = pdfDoc.getForm() + * const textField = form.createTextField('best.gundam') + * textField.setText('Exia') + * + * textField.addToPage(page, { + * x: 50, + * y: 75, + * width: 200, + * height: 100, + * textColor: rgb(1, 0, 0), + * backgroundColor: rgb(0, 1, 0), + * borderColor: rgb(0, 0, 1), + * borderWidth: 2, + * rotate: degrees(90), + * font: ubuntuFont, + * }) + * ``` + * This will create a new widget for this text field. + * @param page The page to which this text field widget should be added. + * @param options The options to be used when adding this text field widget. + */ + PDFTextField.prototype.addToPage = function (page, options) { + var _a, _b, _c, _d, _e, _f, _g; + utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]); + PDFField_1.assertFieldAppearanceOptions(options); + if (!options) + options = {}; + if (!('textColor' in options)) + options.textColor = colors_1.rgb(0, 0, 0); + if (!('backgroundColor' in options)) + options.backgroundColor = colors_1.rgb(1, 1, 1); + if (!('borderColor' in options)) + options.borderColor = colors_1.rgb(0, 0, 0); + if (!('borderWidth' in options)) + options.borderWidth = 1; + // Create a widget for this text field + var widget = this.createWidget({ + x: (_a = options.x) !== null && _a !== void 0 ? _a : 0, + y: (_b = options.y) !== null && _b !== void 0 ? _b : 0, + width: (_c = options.width) !== null && _c !== void 0 ? _c : 200, + height: (_d = options.height) !== null && _d !== void 0 ? _d : 50, + textColor: options.textColor, + backgroundColor: options.backgroundColor, + borderColor: options.borderColor, + borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0, + rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : rotations_1.degrees(0), + hidden: options.hidden, + page: page.ref, + }); + var widgetRef = this.doc.context.register(widget.dict); + // Add widget to this field + this.acroField.addWidget(widgetRef); + // Set appearance streams for widget + var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont(); + this.updateWidgetAppearance(widget, font); + // Add widget to the given page + page.node.addAnnot(widgetRef); + }; + /** + * Returns `true` if this text field has been marked as dirty, or if any of + * this text field's widgets do not have an appearance stream. For example: + * ```js + * const textField = form.getTextField('some.text.field') + * if (textField.needsAppearancesUpdate()) console.log('Needs update') + * ``` + * @returns Whether or not this text field needs an appearance update. + */ + PDFTextField.prototype.needsAppearancesUpdate = function () { + var _a; + if (this.isDirty()) + return true; + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof core_1.PDFStream; + if (!hasAppearances) + return true; + } + return false; + }; + /** + * Update the appearance streams for each of this text field's widgets using + * the default appearance provider for text fields. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const textField = form.getTextField('some.text.field') + * textField.defaultUpdateAppearances(helvetica) + * ``` + * @param font The font to be used for creating the appearance streams. + */ + PDFTextField.prototype.defaultUpdateAppearances = function (font) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + this.updateAppearances(font); + }; + /** + * Update the appearance streams for each of this text field's widgets using + * the given appearance provider. If no `provider` is passed, the default + * appearance provider for text fields will be used. For example: + * ```js + * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica) + * const textField = form.getTextField('some.text.field') + * textField.updateAppearances(helvetica, (field, widget, font) => { + * ... + * return drawTextField(...) + * }) + * ``` + * @param font The font to be used for creating the appearance streams. + * @param provider Optionally, the appearance provider to be used for + * generating the contents of the appearance streams. + */ + PDFTextField.prototype.updateAppearances = function (font, provider) { + utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]); + utils_1.assertOrUndefined(provider, 'provider', [Function]); + var widgets = this.acroField.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + this.updateWidgetAppearance(widget, font, provider); + } + this.markAsClean(); + }; + PDFTextField.prototype.updateWidgetAppearance = function (widget, font, provider) { + var apProvider = provider !== null && provider !== void 0 ? provider : appearances_1.defaultTextFieldAppearanceProvider; + var appearances = appearances_1.normalizeAppearance(apProvider(this, widget, font)); + this.updateWidgetAppearanceWithFont(widget, font, appearances); + }; + /** + * > **NOTE:** You probably don't want to call this method directly. Instead, + * > consider using the [[PDFForm.getTextField]] method, which will create an + * > instance of [[PDFTextField]] for you. + * + * Create an instance of [[PDFTextField]] from an existing acroText and ref + * + * @param acroText The underlying `PDFAcroText` for this text field. + * @param ref The unique reference for this text field. + * @param doc The document to which this text field will belong. + */ + PDFTextField.of = function (acroText, ref, doc) { + return new PDFTextField(acroText, ref, doc); + }; + return PDFTextField; +}(PDFField_1.default)); +exports.default = PDFTextField; +//# sourceMappingURL=PDFTextField.js.map \ No newline at end of file diff --git a/cjs/api/form/PDFTextField.js.map b/cjs/api/form/PDFTextField.js.map new file mode 100644 index 000000000..a6848ac27 --- /dev/null +++ b/cjs/api/form/PDFTextField.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTextField.js","sourceRoot":"","sources":["../../../src/api/form/PDFTextField.ts"],"names":[],"mappings":";;;AACA,+DAAsC;AACtC,+DAAsC;AAEtC,6DAG+B;AAC/B,6CAIkC;AAClC,oCAAqC;AACrC,0CAA4C;AAC5C,oCAIwB;AACxB,gDAAyD;AACzD,+CAAuD;AAEvD,mCAOkB;AAClB,qCAMmB;AAEnB;;;;;;;;GAQG;AACH;IAA0C,wCAAQ;IAkBhD,sBAAoB,QAAqB,EAAE,GAAW,EAAE,GAAgB;QAAxE,YACE,kBAAM,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,SAK1B;QAHC,gBAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,kBAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAE/D,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,8BAAO,GAAP;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK,IAAI,IAAI,C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C5B,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAEO,6CAAsB,GAA9B,UACE,MAA2B,EAC3B,IAAa,EACb,QAA8C;QAE9C,IAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,gDAAkC,CAAC;QAClE,IAAM,WAAW,GAAG,iCAAmB,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,8BAA8B,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAvwBD;;;;;;;;;;OAUG;IACI,eAAE,GAAG,UAAC,QAAqB,EAAE,GAAW,EAAE,GAAgB;QAC/D,OAAA,IAAI,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC;IAApC,CAAoC,CAAC;IA4vBzC,mBAAC;CAAA,AAzwBD,CAA0C,kBAAQ,GAywBjD;kBAzwBoB,YAAY"} \ No newline at end of file diff --git a/cjs/api/form/appearances.d.ts b/cjs/api/form/appearances.d.ts new file mode 100644 index 000000000..0ae4b9d87 --- /dev/null +++ b/cjs/api/form/appearances.d.ts @@ -0,0 +1,42 @@ +import { PDFOperator, PDFWidgetAnnotation } from "../../core"; +import PDFFont from "../PDFFont"; +import PDFButton from "./PDFButton"; +import PDFCheckBox from "./PDFCheckBox"; +import PDFDropdown from "./PDFDropdown"; +import PDFField from "./PDFField"; +import PDFOptionList from "./PDFOptionList"; +import PDFRadioGroup from "./PDFRadioGroup"; +import PDFSignature from "./PDFSignature"; +import PDFTextField from "./PDFTextField"; +/*********************** Appearance Provider Types ****************************/ +declare type CheckBoxAppearanceProvider = (checkBox: PDFCheckBox, widget: PDFWidgetAnnotation) => AppearanceOrMapping<{ + on: PDFOperator[]; + off: PDFOperator[]; +}>; +declare type RadioGroupAppearanceProvider = (radioGroup: PDFRadioGroup, widget: PDFWidgetAnnotation) => AppearanceOrMapping<{ + on: PDFOperator[]; + off: PDFOperator[]; +}>; +declare type ButtonAppearanceProvider = (button: PDFButton, widget: PDFWidgetAnnotation, font: PDFFont) => AppearanceOrMapping; +declare type DropdownAppearanceProvider = (dropdown: PDFDropdown, widget: PDFWidgetAnnotation, font: PDFFont) => AppearanceOrMapping; +declare type OptionListAppearanceProvider = (optionList: PDFOptionList, widget: PDFWidgetAnnotation, font: PDFFont) => AppearanceOrMapping; +declare type TextFieldAppearanceProvider = (textField: PDFTextField, widget: PDFWidgetAnnotation, font: PDFFont) => AppearanceOrMapping; +declare type SignatureAppearanceProvider = (signature: PDFSignature, widget: PDFWidgetAnnotation, font: PDFFont) => AppearanceOrMapping; +/******************* Appearance Provider Utility Types ************************/ +export declare type AppearanceMapping = { + normal: T; + rollover?: T; + down?: T; +}; +declare type AppearanceOrMapping = T | AppearanceMapping; +export declare type AppearanceProviderFor = T extends PDFCheckBox ? CheckBoxAppearanceProvider : T extends PDFRadioGroup ? RadioGroupAppearanceProvider : T extends PDFButton ? ButtonAppearanceProvider : T extends PDFDropdown ? DropdownAppearanceProvider : T extends PDFOptionList ? OptionListAppearanceProvider : T extends PDFTextField ? TextFieldAppearanceProvider : T extends PDFSignature ? SignatureAppearanceProvider : never; +/********************* Appearance Provider Functions **************************/ +export declare const normalizeAppearance: (appearance: T | AppearanceMapping) => AppearanceMapping; +export declare const defaultCheckBoxAppearanceProvider: AppearanceProviderFor; +export declare const defaultRadioGroupAppearanceProvider: AppearanceProviderFor; +export declare const defaultButtonAppearanceProvider: AppearanceProviderFor; +export declare const defaultTextFieldAppearanceProvider: AppearanceProviderFor; +export declare const defaultDropdownAppearanceProvider: AppearanceProviderFor; +export declare const defaultOptionListAppearanceProvider: AppearanceProviderFor; +export {}; +//# sourceMappingURL=appearances.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/appearances.d.ts.map b/cjs/api/form/appearances.d.ts.map new file mode 100644 index 000000000..3cfd3b6cb --- /dev/null +++ b/cjs/api/form/appearances.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"appearances.d.ts","sourceRoot":"","sources":["../../../src/api/form/appearances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAiB;AAC5D,OAAO,OAAO,mBAAwB;AACtC,OAAO,SAAS,oBAA+B;AAC/C,OAAO,WAAW,sBAAiC;AACnD,OAAO,WAAW,sBAAiC;AACnD,OAAO,QAAQ,mBAA8B;AAC7C,OAAO,aAAa,wBAAmC;AACvD,OAAO,aAAa,wBAAmC;AACvD,OAAO,YAAY,uBAAkC;AACrD,OAAO,YAAY,uBAAkC;AA4BrD,gFAAgF;AAEhF,aAAK,0BAA0B,GAAG,CAChC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,mBAAmB,KACxB,mBAAmB,CAAC;IACvB,EAAE,EAAE,WAAW,EAAE,CAAC;IAClB,GAAG,EAAE,WAAW,EAAE,CAAC;CACpB,CAAC,CAAC;AAEH,aAAK,4BAA4B,GAAG,CAClC,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,mBAAmB,KACxB,mBAAmB,CAAC;IACvB,EAAE,EAAE,WAAW,EAAE,CAAC;IAClB,GAAG,EAAE,WAAW,EAAE,CAAC;CACpB,CAAC,CAAC;AAEH,aAAK,wBAAwB,GAAG,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,OAAO,KACV,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC;AAExC,aAAK,0BAA0B,GAAG,CAChC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,OAAO,KACV,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC;AAExC,aAAK,4BAA4B,GAAG,CAClC,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EA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B,CAAC,YAAY,CA0FlF,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,qBAAqB,CAAC,WAAW,CAiEhF,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,qBAAqB,CAAC,aAAa,CAuFpF,CAAC"} \ No newline at end of file diff --git a/cjs/api/form/appearances.js b/cjs/api/form/appearances.js new file mode 100644 index 000000000..79cd371aa --- /dev/null +++ b/cjs/api/form/appearances.js @@ -0,0 +1,421 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultOptionListAppearanceProvider = exports.defaultDropdownAppearanceProvider = exports.defaultTextFieldAppearanceProvider = exports.defaultButtonAppearanceProvider = exports.defaultRadioGroupAppearanceProvider = exports.defaultCheckBoxAppearanceProvider = exports.normalizeAppearance = void 0; +var tslib_1 = require("tslib"); +var operations_1 = require("../operations"); +var colors_1 = require("../colors"); +var rotations_1 = require("../rotations"); +var layout_1 = require("../text/layout"); +var alignment_1 = require("../text/alignment"); +var operators_1 = require("../operators"); +var utils_1 = require("../../utils"); +/********************* Appearance Provider Functions **************************/ +exports.normalizeAppearance = function (appearance) { + if ('normal' in appearance) + return appearance; + return { normal: appearance }; +}; +// Examples: +// `/Helv 12 Tf` -> ['/Helv 12 Tf', 'Helv', '12'] +// `/HeBo 8.00 Tf` -> ['/HeBo 8 Tf', 'HeBo', '8.00'] +var tfRegex = /\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/; +var getDefaultFontSize = function (field) { + var _a, _b; + var da = (_a = field.getDefaultAppearance()) !== null && _a !== void 0 ? _a : ''; + var daMatch = (_b = utils_1.findLastMatch(da, tfRegex).match) !== null && _b !== void 0 ? _b : []; + var defaultFontSize = Number(daMatch[2]); + return isFinite(defaultFontSize) ? defaultFontSize : undefined; +}; +// Examples: +// `0.3 g` -> ['0.3', 'g'] +// `0.3 1 .3 rg` -> ['0.3', '1', '.3', 'rg'] +// `0.3 1 .3 0 k` -> ['0.3', '1', '.3', '0', 'k'] +var colorRegex = /(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/; +var getDefaultColor = function (field) { + var _a; + var da = (_a = field.getDefaultAppearance()) !== null && _a !== void 0 ? _a : ''; + var daMatch = utils_1.findLastMatch(da, colorRegex).match; + var _b = daMatch !== null && daMatch !== void 0 ? daMatch : [], c1 = _b[1], c2 = _b[2], c3 = _b[3], c4 = _b[4], colorSpace = _b[5]; + if (colorSpace === 'g' && c1) { + return colors_1.grayscale(Number(c1)); + } + if (colorSpace === 'rg' && c1 && c2 && c3) { + return colors_1.rgb(Number(c1), Number(c2), Number(c3)); + } + if (colorSpace === 'k' && c1 && c2 && c3 && c4) { + return colors_1.cmyk(Number(c1), Number(c2), Number(c3), Number(c4)); + } + return undefined; +}; +var updateDefaultAppearance = function (field, color, font, fontSize) { + var _a; + if (fontSize === void 0) { fontSize = 0; } + var da = [ + colors_1.setFillingColor(color).toString(), + operators_1.setFontAndSize((_a = font === null || font === void 0 ? void 0 : font.name) !== null && _a !== void 0 ? _a : 'dummy__noop', fontSize).toString(), + ].join('\n'); + field.setDefaultAppearance(da); +}; +exports.defaultCheckBoxAppearanceProvider = function (checkBox, widget) { + var _a, _b, _c; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(checkBox.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = (_b = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b !== void 0 ? _b : black; + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + // Update color + var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black; + if (widgetColor) { + updateDefaultAppearance(widget, textColor); + } + else { + updateDefaultAppearance(checkBox.acroField, textColor); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + thickness: 1.5, + borderWidth: borderWidth, + borderColor: borderColor, + markColor: textColor, + }; + return { + normal: { + on: tslib_1.__spreadArrays(rotate, operations_1.drawCheckBox(tslib_1.__assign(tslib_1.__assign({}, options), { color: normalBackgroundColor, filled: true }))), + off: tslib_1.__spreadArrays(rotate, operations_1.drawCheckBox(tslib_1.__assign(tslib_1.__assign({}, options), { color: normalBackgroundColor, filled: false }))), + }, + down: { + on: tslib_1.__spreadArrays(rotate, operations_1.drawCheckBox(tslib_1.__assign(tslib_1.__assign({}, options), { color: downBackgroundColor, filled: true }))), + off: tslib_1.__spreadArrays(rotate, operations_1.drawCheckBox(tslib_1.__assign(tslib_1.__assign({}, options), { color: downBackgroundColor, filled: false }))), + }, + }; +}; +exports.defaultRadioGroupAppearanceProvider = function (radioGroup, widget) { + var _a, _b, _c; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(radioGroup.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = (_b = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b !== void 0 ? _b : black; + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + // Update color + var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black; + if (widgetColor) { + updateDefaultAppearance(widget, textColor); + } + else { + updateDefaultAppearance(radioGroup.acroField, textColor); + } + var options = { + x: width / 2, + y: height / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth, + borderColor: borderColor, + dotColor: textColor, + }; + return { + normal: { + on: tslib_1.__spreadArrays(rotate, operations_1.drawRadioButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: normalBackgroundColor, filled: true }))), + off: tslib_1.__spreadArrays(rotate, operations_1.drawRadioButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: normalBackgroundColor, filled: false }))), + }, + down: { + on: tslib_1.__spreadArrays(rotate, operations_1.drawRadioButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: downBackgroundColor, filled: true }))), + off: tslib_1.__spreadArrays(rotate, operations_1.drawRadioButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: downBackgroundColor, filled: false }))), + }, + }; +}; +exports.defaultButtonAppearanceProvider = function (button, widget, font) { + var _a, _b, _c, _d, _e; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(button.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(button.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var captions = ap === null || ap === void 0 ? void 0 : ap.getCaptions(); + var normalText = (_a = captions === null || captions === void 0 ? void 0 : captions.normal) !== null && _a !== void 0 ? _a : ''; + var downText = (_c = (_b = captions === null || captions === void 0 ? void 0 : captions.down) !== null && _b !== void 0 ? _b : normalText) !== null && _c !== void 0 ? _c : ''; + var borderWidth = (_d = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _d !== void 0 ? _d : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _f = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _f.width, height = _f.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var downBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8); + var bounds = { + x: borderWidth, + y: borderWidth, + width: width - borderWidth * 2, + height: height - borderWidth * 2, + }; + var normalLayout = layout_1.layoutSinglelineText(normalText, { + alignment: alignment_1.TextAlignment.Center, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }); + var downLayout = layout_1.layoutSinglelineText(downText, { + alignment: alignment_1.TextAlignment.Center, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }); + // Update font size and color + var fontSize = Math.min(normalLayout.fontSize, downLayout.fontSize); + var textColor = (_e = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _e !== void 0 ? _e : black; + if (widgetColor || widgetFontSize !== undefined) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } + else { + updateDefaultAppearance(button.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth, + borderColor: borderColor, + textColor: textColor, + font: font.name, + fontSize: fontSize, + }; + return { + normal: tslib_1.__spreadArrays(rotate, operations_1.drawButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: normalBackgroundColor, textLines: [normalLayout.line] }))), + down: tslib_1.__spreadArrays(rotate, operations_1.drawButton(tslib_1.__assign(tslib_1.__assign({}, options), { color: downBackgroundColor, textLines: [downLayout.line] }))), + }; +}; +exports.defaultTextFieldAppearanceProvider = function (textField, widget, font) { + var _a, _b, _c, _d; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(textField.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(textField.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var text = (_a = textField.getText()) !== null && _a !== void 0 ? _a : ''; + var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _e = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _e.width, height = _e.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var textLines; + var fontSize; + var padding = textField.isCombed() ? 0 : 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2, + }; + if (textField.isMultiline()) { + var layout = layout_1.layoutMultilineText(text, { + alignment: textField.getAlignment(), + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }); + textLines = layout.lines; + fontSize = layout.fontSize; + } + else if (textField.isCombed()) { + var layout = layout_1.layoutCombedText(text, { + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + cellCount: (_c = textField.getMaxLength()) !== null && _c !== void 0 ? _c : 0, + }); + textLines = layout.cells; + fontSize = layout.fontSize; + } + else { + var layout = layout_1.layoutSinglelineText(text, { + alignment: textField.getAlignment(), + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }); + textLines = [layout.line]; + fontSize = layout.fontSize; + } + // Update font size and color + var textColor = (_d = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _d !== void 0 ? _d : black; + if (widgetColor || widgetFontSize !== undefined) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } + else { + updateDefaultAppearance(textField.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor: borderColor, + textColor: textColor, + font: font.name, + fontSize: fontSize, + color: normalBackgroundColor, + textLines: textLines, + padding: padding, + }; + return tslib_1.__spreadArrays(rotate, operations_1.drawTextField(options)); +}; +exports.defaultDropdownAppearanceProvider = function (dropdown, widget, font) { + var _a, _b, _c; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(dropdown.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(dropdown.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var text = (_a = dropdown.getSelected()[0]) !== null && _a !== void 0 ? _a : ''; + var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _d = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var padding = 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2, + }; + var _e = layout_1.layoutSinglelineText(text, { + alignment: alignment_1.TextAlignment.Left, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }), line = _e.line, fontSize = _e.fontSize; + // Update font size and color + var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black; + if (widgetColor || widgetFontSize !== undefined) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } + else { + updateDefaultAppearance(dropdown.acroField, textColor, font, fontSize); + } + var options = { + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor: borderColor, + textColor: textColor, + font: font.name, + fontSize: fontSize, + color: normalBackgroundColor, + textLines: [line], + padding: padding, + }; + return tslib_1.__spreadArrays(rotate, operations_1.drawTextField(options)); +}; +exports.defaultOptionListAppearanceProvider = function (optionList, widget, font) { + var _a, _b; + // The `/DA` entry can be at the widget or field level - so we handle both + var widgetColor = getDefaultColor(widget); + var fieldColor = getDefaultColor(optionList.acroField); + var widgetFontSize = getDefaultFontSize(widget); + var fieldFontSize = getDefaultFontSize(optionList.acroField); + var rectangle = widget.getRectangle(); + var ap = widget.getAppearanceCharacteristics(); + var bs = widget.getBorderStyle(); + var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0; + var rotation = rotations_1.reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation()); + var _c = rotations_1.adjustDimsForRotation(rectangle, rotation), width = _c.width, height = _c.height; + var rotate = operations_1.rotateInPlace(tslib_1.__assign(tslib_1.__assign({}, rectangle), { rotation: rotation })); + var black = colors_1.rgb(0, 0, 0); + var borderColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor()); + var normalBackgroundColor = colors_1.componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor()); + var options = optionList.getOptions(); + var selected = optionList.getSelected(); + if (optionList.isSorted()) + options.sort(); + var text = ''; + for (var idx = 0, len = options.length; idx < len; idx++) { + text += options[idx]; + if (idx < len - 1) + text += '\n'; + } + var padding = 1; + var bounds = { + x: borderWidth + padding, + y: borderWidth + padding, + width: width - (borderWidth + padding) * 2, + height: height - (borderWidth + padding) * 2, + }; + var _d = layout_1.layoutMultilineText(text, { + alignment: alignment_1.TextAlignment.Left, + fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize, + font: font, + bounds: bounds, + }), lines = _d.lines, fontSize = _d.fontSize, lineHeight = _d.lineHeight; + var selectedLines = []; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var line = lines[idx]; + if (selected.includes(line.text)) + selectedLines.push(idx); + } + var blue = colors_1.rgb(153 / 255, 193 / 255, 218 / 255); + // Update font size and color + var textColor = (_b = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _b !== void 0 ? _b : black; + if (widgetColor || widgetFontSize !== undefined) { + updateDefaultAppearance(widget, textColor, font, fontSize); + } + else { + updateDefaultAppearance(optionList.acroField, textColor, font, fontSize); + } + return tslib_1.__spreadArrays(rotate, operations_1.drawOptionList({ + x: 0 + borderWidth / 2, + y: 0 + borderWidth / 2, + width: width - borderWidth, + height: height - borderWidth, + borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0, + borderColor: borderColor, + textColor: textColor, + font: font.name, + fontSize: fontSize, + color: normalBackgroundColor, + textLines: lines, + lineHeight: lineHeight, + selectedColor: blue, + selectedLines: selectedLines, + padding: padding, + })); +}; +//# sourceMappingURL=appearances.js.map \ No newline at end of file diff --git a/cjs/api/form/appearances.js.map b/cjs/api/form/appearances.js.map new file mode 100644 index 000000000..a05f23e7f --- /dev/null +++ b/cjs/api/form/appearances.js.map @@ -0,0 +1 @@ +{"version":3,"file":"appearances.js","sourceRoot":"","sources":["../../../src/api/form/appearances.ts"],"names":[],"mappings":";;;;AAUA,4CAO4B;AAC5B,oCAOwB;AACxB,0CAA0E;AAC1E,yCAK6B;AAC7B,+CAAuD;AACvD,0CAAmD;AACnD,qCAA0C;AAmE1C,gFAAgF;AAEnE,QAAA,mBAAmB,GAAG,UACjC,UAAoC;IAEpC,IAAI,QAAQ,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,YAAY;AACZ,mDAAmD;AACnD,sDAAsD;AACtD,IAAM,OAAO,GAAG,oEAAoE,CAAC;AAErF,IAAM,kBAAkB,GAAG,UAAC,KAE3B;;IACC,IAAM,EAAE,SAAG,KAAK,CAAC,oBAAoB,EAAE,mCAAI,EAAE,CAAC;IAC9C,IAAM,OAAO,SAAG,qBAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CA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AAA;QACV,aAAa,EAAE,IAAI;QACnB,aAAa,eAAA;QACb,OAAO,SAAA;KACR,CAAC,EACF;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/api/form/index.d.ts b/cjs/api/form/index.d.ts new file mode 100644 index 000000000..82d8e0c1c --- /dev/null +++ b/cjs/api/form/index.d.ts @@ -0,0 +1,11 @@ +export * from "./appearances"; +export { default as PDFButton } from "./PDFButton"; +export { default as PDFCheckBox } from "./PDFCheckBox"; +export { default as PDFDropdown } from "./PDFDropdown"; +export { default as PDFField } from "./PDFField"; +export { default as PDFForm } from "./PDFForm"; +export { default as PDFOptionList } from "./PDFOptionList"; +export { default as PDFRadioGroup } from "./PDFRadioGroup"; +export { default as PDFSignature } from "./PDFSignature"; +export { default as PDFTextField } from "./PDFTextField"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/api/form/index.d.ts.map b/cjs/api/form/index.d.ts.map new file mode 100644 index 000000000..2644b451a --- /dev/null +++ b/cjs/api/form/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/form/index.ts"],"names":[],"mappings":"AAAA,cAUmJ,eAAe,CAVzH;AACzC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MASmI,aAAa,CATjH;AAC9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAQ8I,eAAe,CAR5H;AAClE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAO6J,eAAe,CAP3I;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAM+K,YAAY,CAN7J;AAC5D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAK4L,WAAW,CAL1K;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAIiM,iBAAiB,CAJ/K;AACtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAGkN,iBAAiB,CAHhM;AACtE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAEoO,gBAAgB,CAFlN;AACpE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MACoP,gBAAgB,CADlO"} \ No newline at end of file diff --git a/cjs/api/form/index.js b/cjs/api/form/index.js new file mode 100644 index 000000000..6f8b6f840 --- /dev/null +++ b/cjs/api/form/index.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./appearances"), exports); +var PDFButton_1 = require("./PDFButton"); +Object.defineProperty(exports, "PDFButton", { enumerable: true, get: function () { return PDFButton_1.default; } }); +var PDFCheckBox_1 = require("./PDFCheckBox"); +Object.defineProperty(exports, "PDFCheckBox", { enumerable: true, get: function () { return PDFCheckBox_1.default; } }); +var PDFDropdown_1 = require("./PDFDropdown"); +Object.defineProperty(exports, "PDFDropdown", { enumerable: true, get: function () { return PDFDropdown_1.default; } }); +var PDFField_1 = require("./PDFField"); +Object.defineProperty(exports, "PDFField", { enumerable: true, get: function () { return PDFField_1.default; } }); +var PDFForm_1 = require("./PDFForm"); +Object.defineProperty(exports, "PDFForm", { enumerable: true, get: function () { return PDFForm_1.default; } }); +var PDFOptionList_1 = require("./PDFOptionList"); +Object.defineProperty(exports, "PDFOptionList", { enumerable: true, get: function () { return PDFOptionList_1.default; } }); +var PDFRadioGroup_1 = require("./PDFRadioGroup"); +Object.defineProperty(exports, "PDFRadioGroup", { enumerable: true, get: function () { return PDFRadioGroup_1.default; } }); +var PDFSignature_1 = require("./PDFSignature"); +Object.defineProperty(exports, "PDFSignature", { enumerable: true, get: function () { return PDFSignature_1.default; } }); +var PDFTextField_1 = require("./PDFTextField"); +Object.defineProperty(exports, "PDFTextField", { enumerable: true, get: function () { return PDFTextField_1.default; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/api/form/index.js.map b/cjs/api/form/index.js.map new file mode 100644 index 000000000..c29de9257 --- /dev/null +++ b/cjs/api/form/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/form/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyC;AACzC,yCAA8D;AAArD,sGAAA,OAAO,OAAa;AAC7B,6CAAkE;AAAzD,0GAAA,OAAO,OAAe;AAC/B,6CAAkE;AAAzD,0GAAA,OAAO,OAAe;AAC/B,uCAA4D;AAAnD,oGAAA,OAAO,OAAY;AAC5B,qCAA0D;AAAjD,kGAAA,OAAO,OAAW;AAC3B,iDAAsE;AAA7D,8GAAA,OAAO,OAAiB;AACjC,iDAAsE;AAA7D,8GAAA,OAAO,OAAiB;AACjC,+CAAoE;AAA3D,4GAAA,OAAO,OAAgB;AAChC,+CAAoE;AAA3D,4GAAA,OAAO,OAAgB"} \ No newline at end of file diff --git a/cjs/api/image/alignment.d.ts b/cjs/api/image/alignment.d.ts new file mode 100644 index 000000000..fd26e2fc8 --- /dev/null +++ b/cjs/api/image/alignment.d.ts @@ -0,0 +1,6 @@ +export declare enum ImageAlignment { + Left = 0, + Center = 1, + Right = 2 +} +//# sourceMappingURL=alignment.d.ts.map \ No newline at end of file diff --git a/cjs/api/image/alignment.d.ts.map b/cjs/api/image/alignment.d.ts.map new file mode 100644 index 000000000..ff73b3263 --- /dev/null +++ b/cjs/api/image/alignment.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"alignment.d.ts","sourceRoot":"","sources":["../../../src/api/image/alignment.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,IAAI;CACV"} \ No newline at end of file diff --git a/cjs/api/image/alignment.js b/cjs/api/image/alignment.js new file mode 100644 index 000000000..3706fab11 --- /dev/null +++ b/cjs/api/image/alignment.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ImageAlignment = void 0; +var ImageAlignment; +(function (ImageAlignment) { + ImageAlignment[ImageAlignment["Left"] = 0] = "Left"; + ImageAlignment[ImageAlignment["Center"] = 1] = "Center"; + ImageAlignment[ImageAlignment["Right"] = 2] = "Right"; +})(ImageAlignment = exports.ImageAlignment || (exports.ImageAlignment = {})); +//# sourceMappingURL=alignment.js.map \ No newline at end of file diff --git a/cjs/api/image/alignment.js.map b/cjs/api/image/alignment.js.map new file mode 100644 index 000000000..7a25e8f07 --- /dev/null +++ b/cjs/api/image/alignment.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alignment.js","sourceRoot":"","sources":["../../../src/api/image/alignment.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mDAAQ,CAAA;IACR,uDAAU,CAAA;IACV,qDAAS,CAAA;AACX,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"} \ No newline at end of file diff --git a/cjs/api/image/index.d.ts b/cjs/api/image/index.d.ts new file mode 100644 index 000000000..46c179c2b --- /dev/null +++ b/cjs/api/image/index.d.ts @@ -0,0 +1,2 @@ +export * from "./alignment"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/api/image/index.d.ts.map b/cjs/api/image/index.d.ts.map new file mode 100644 index 000000000..f3a76f610 --- /dev/null +++ b/cjs/api/image/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/image/index.ts"],"names":[],"mappings":"AAAA,cACa,aAAa,CADc"} \ No newline at end of file diff --git a/cjs/api/image/index.js b/cjs/api/image/index.js new file mode 100644 index 000000000..727c7eb0c --- /dev/null +++ b/cjs/api/image/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./alignment"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/api/image/index.js.map b/cjs/api/image/index.js.map new file mode 100644 index 000000000..6b6affac8 --- /dev/null +++ b/cjs/api/image/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/image/index.ts"],"names":[],"mappings":";;;AAAA,sDAAwC"} \ No newline at end of file diff --git a/cjs/api/index.d.ts b/cjs/api/index.d.ts new file mode 100644 index 000000000..31c73d33d --- /dev/null +++ b/cjs/api/index.d.ts @@ -0,0 +1,21 @@ +export * from "./form"; +export * from "./text"; +export * from "./colors"; +export * from "./errors"; +export * from "./image"; +export * from "./objects"; +export * from "./operations"; +export * from "./operators"; +export * from "./rotations"; +export * from "./sizes"; +export * from "./PDFPageOptions"; +export * from "./PDFDocumentOptions"; +export * from "./StandardFonts"; +export { default as PDFDocument } from "./PDFDocument"; +export { default as PDFFont } from "./PDFFont"; +export { default as PDFImage } from "./PDFImage"; +export { default as PDFPage } from "./PDFPage"; +export { default as PDFEmbeddedPage } from "./PDFEmbeddedPage"; +export { default as PDFJavaScript } from "./PDFJavaScript"; +export { default as Embeddable } from "./Embeddable"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/api/index.d.ts.map b/cjs/api/index.d.ts.map new file mode 100644 index 000000000..dae79e130 --- /dev/null +++ b/cjs/api/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAoBqQ,QAAQ,CApBhP;AAC7B,cAmB6Q,QAAQ,CAnBxP;AAC7B,cAkBqR,UAAU,CAlBhQ;AAC/B,cAiB+R,UAAU,CAjB1Q;AAC/B,cAgByS,SAAS,CAhBpR;AAC9B,cAekT,WAAW,CAf7R;AAChC,cAc6T,cAAc,CAdxS;AACnC,cAa2U,aAAa,CAbtT;AAClC,cAYwV,aAAa,CAZnU;AAClC,cAWqW,SAAS,CAXhV;AAC9B,cAU8W,kBAAkB,CAVzV;AACvC,cASgY,sBAAsB,CAT3W;AAC3C,cAQsZ,iBAAiB,CARjY;AACtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAOsY,eAAe,CAPzX;AAC7D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAMyZ,WAAW,CAN5Y;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAKma,YAAY,CALtZ;AACvD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAIgb,WAAW,CAJna;AACrD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAGmb,mBAAmB,CAHta;AACrE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAEwc,iBAAiB,CAF3b;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAC4d,cAAc,CAD/c"} \ No newline at end of file diff --git a/cjs/api/index.js b/cjs/api/index.js new file mode 100644 index 000000000..0e531fc28 --- /dev/null +++ b/cjs/api/index.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./form"), exports); +tslib_1.__exportStar(require("./text"), exports); +tslib_1.__exportStar(require("./colors"), exports); +tslib_1.__exportStar(require("./errors"), exports); +tslib_1.__exportStar(require("./image"), exports); +tslib_1.__exportStar(require("./objects"), exports); +tslib_1.__exportStar(require("./operations"), exports); +tslib_1.__exportStar(require("./operators"), exports); +tslib_1.__exportStar(require("./rotations"), exports); +tslib_1.__exportStar(require("./sizes"), exports); +tslib_1.__exportStar(require("./PDFPageOptions"), exports); +tslib_1.__exportStar(require("./PDFDocumentOptions"), exports); +tslib_1.__exportStar(require("./StandardFonts"), exports); +var PDFDocument_1 = require("./PDFDocument"); +Object.defineProperty(exports, "PDFDocument", { enumerable: true, get: function () { return PDFDocument_1.default; } }); +var PDFFont_1 = require("./PDFFont"); +Object.defineProperty(exports, "PDFFont", { enumerable: true, get: function () { return PDFFont_1.default; } }); +var PDFImage_1 = require("./PDFImage"); +Object.defineProperty(exports, "PDFImage", { enumerable: true, get: function () { return PDFImage_1.default; } }); +var PDFPage_1 = require("./PDFPage"); +Object.defineProperty(exports, "PDFPage", { enumerable: true, get: function () { return PDFPage_1.default; } }); +var PDFEmbeddedPage_1 = require("./PDFEmbeddedPage"); +Object.defineProperty(exports, "PDFEmbeddedPage", { enumerable: true, get: function () { return PDFEmbeddedPage_1.default; } }); +var PDFJavaScript_1 = require("./PDFJavaScript"); +Object.defineProperty(exports, "PDFJavaScript", { enumerable: true, get: function () { return PDFJavaScript_1.default; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/api/index.js.map b/cjs/api/index.js.map new file mode 100644 index 000000000..34ecb6b38 --- /dev/null +++ b/cjs/api/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6B;AAC7B,iDAA6B;AAC7B,mDAA+B;AAC/B,mDAA+B;AAC/B,kDAA8B;AAC9B,oDAAgC;AAChC,uDAAmC;AACnC,sDAAkC;AAClC,sDAAkC;AAClC,kDAA8B;AAC9B,2DAAuC;AACvC,+DAA2C;AAC3C,0DAAsC;AACtC,6CAA6D;AAApD,0GAAA,OAAO,OAAe;AAC/B,qCAAqD;AAA5C,kGAAA,OAAO,OAAW;AAC3B,uCAAuD;AAA9C,oGAAA,OAAO,OAAY;AAC5B,qCAAqD;AAA5C,kGAAA,OAAO,OAAW;AAC3B,qDAAqE;AAA5D,kHAAA,OAAO,OAAmB;AACnC,iDAAiE;AAAxD,8GAAA,OAAO,OAAiB"} \ No newline at end of file diff --git a/cjs/api/objects.d.ts b/cjs/api/objects.d.ts new file mode 100644 index 000000000..616a25d12 --- /dev/null +++ b/cjs/api/objects.d.ts @@ -0,0 +1,5 @@ +import { PDFName, PDFNumber } from "../core"; +export declare const asPDFName: (name: string | PDFName) => PDFName; +export declare const asPDFNumber: (num: number | PDFNumber) => PDFNumber; +export declare const asNumber: (num: number | PDFNumber) => number; +//# sourceMappingURL=objects.d.ts.map \ No newline at end of file diff --git a/cjs/api/objects.d.ts.map b/cjs/api/objects.d.ts.map new file mode 100644 index 000000000..2de3763dc --- /dev/null +++ b/cjs/api/objects.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/api/objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAiB;AAE9C,eAAO,MAAM,SAAS,SAAU,MAAM,GAAG,OAAO,YACG,CAAC;AAEpD,eAAO,MAAM,WAAW,QAAS,MAAM,GAAG,SAAS,cACC,CAAC;AAErD,eAAO,MAAM,QAAQ,QAAS,MAAM,GAAG,SAAS,WACC,CAAC"} \ No newline at end of file diff --git a/cjs/api/objects.js b/cjs/api/objects.js new file mode 100644 index 000000000..7b076e2e0 --- /dev/null +++ b/cjs/api/objects.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.asNumber = exports.asPDFNumber = exports.asPDFName = void 0; +var core_1 = require("../core"); +exports.asPDFName = function (name) { + return name instanceof core_1.PDFName ? name : core_1.PDFName.of(name); +}; +exports.asPDFNumber = function (num) { + return num instanceof core_1.PDFNumber ? num : core_1.PDFNumber.of(num); +}; +exports.asNumber = function (num) { + return num instanceof core_1.PDFNumber ? num.asNumber() : num; +}; +//# sourceMappingURL=objects.js.map \ No newline at end of file diff --git a/cjs/api/objects.js.map b/cjs/api/objects.js.map new file mode 100644 index 000000000..aa95dc47d --- /dev/null +++ b/cjs/api/objects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/api/objects.ts"],"names":[],"mappings":";;;AAAA,gCAA8C;AAEjC,QAAA,SAAS,GAAG,UAAC,IAAsB;IAC9C,OAAA,IAAI,YAAY,cAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAO,CAAC,EAAE,CAAC,IAAI,CAAC;AAAjD,CAAiD,CAAC;AAEvC,QAAA,WAAW,GAAG,UAAC,GAAuB;IACjD,OAAA,GAAG,YAAY,gBAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAS,CAAC,EAAE,CAAC,GAAG,CAAC;AAAlD,CAAkD,CAAC;AAExC,QAAA,QAAQ,GAAG,UAAC,GAAuB;IAC9C,OAAA,GAAG,YAAY,gBAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG;AAA/C,CAA+C,CAAC"} \ No newline at end of file diff --git a/cjs/api/operations.d.ts b/cjs/api/operations.d.ts new file mode 100644 index 000000000..a7c8e80e5 --- /dev/null +++ b/cjs/api/operations.d.ts @@ -0,0 +1,212 @@ +import { Color } from "./colors"; +import { scale, LineCapStyle } from "./operators"; +import { Rotation } from "./rotations"; +import { PDFHexString, PDFName, PDFNumber, PDFOperator } from "../core"; +export interface DrawTextOptions { + color: Color; + font: string | PDFName; + size: number | PDFNumber; + rotate: Rotation; + xSkew: Rotation; + ySkew: Rotation; + x: number | PDFNumber; + y: number | PDFNumber; + graphicsState?: string | PDFName; +} +export declare const drawText: (line: PDFHexString, options: DrawTextOptions) => PDFOperator[]; +export interface DrawLinesOfTextOptions extends DrawTextOptions { + lineHeight: number | PDFNumber; +} +export declare const drawLinesOfText: (lines: PDFHexString[], options: DrawLinesOfTextOptions) => PDFOperator[]; +export declare const drawImage: (name: string | PDFName, options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + rotate: Rotation; + xSkew: Rotation; + ySkew: Rotation; + graphicsState?: string | PDFName; +}) => PDFOperator[]; +export declare const drawPage: (name: string | PDFName, options: { + x: number | PDFNumber; + y: number | PDFNumber; + xScale: number | PDFNumber; + yScale: number | PDFNumber; + rotate: Rotation; + xSkew: Rotation; + ySkew: Rotation; + graphicsState?: string | PDFName; +}) => PDFOperator[]; +export declare const drawLine: (options: { + start: { + x: number | PDFNumber; + y: number | PDFNumber; + }; + end: { + x: number | PDFNumber; + y: number | PDFNumber; + }; + thickness: number | PDFNumber; + color: Color | undefined; + dashArray?: (number | PDFNumber)[]; + dashPhase?: number | PDFNumber; + lineCap?: LineCapStyle; + graphicsState?: string | PDFName; +}) => PDFOperator[]; +export declare const drawRectangle: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + borderWidth: number | PDFNumber; + color: Color | undefined; + borderColor: Color | undefined; + rotate: Rotation; + xSkew: Rotation; + ySkew: Rotation; + borderLineCap?: LineCapStyle; + borderDashArray?: (number | PDFNumber)[]; + borderDashPhase?: number | PDFNumber; + graphicsState?: string | PDFName; +}) => PDFOperator[]; +/** @deprecated */ +export declare const drawEllipsePath: (config: { + x: number | PDFNumber; + y: number | PDFNumber; + xScale: number | PDFNumber; + yScale: number | PDFNumber; +}) => PDFOperator[]; +export declare const drawEllipse: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + xScale: number | PDFNumber; + yScale: number | PDFNumber; + rotate?: Rotation; + color: Color | undefined; + borderColor: Color | undefined; + borderWidth: number | PDFNumber; + borderDashArray?: (number | PDFNumber)[]; + borderDashPhase?: number | PDFNumber; + graphicsState?: string | PDFName; + borderLineCap?: LineCapStyle; +}) => PDFOperator[]; +export declare const drawSvgPath: (path: string, options: { + x: number | PDFNumber; + y: number | PDFNumber; + rotate?: Rotation; + scale: number | PDFNumber | undefined; + color: Color | undefined; + borderColor: Color | undefined; + borderWidth: number | PDFNumber; + borderDashArray?: (number | PDFNumber)[]; + borderDashPhase?: number | PDFNumber; + borderLineCap?: LineCapStyle; + graphicsState?: string | PDFName; +}) => PDFOperator[]; +export declare const drawCheckMark: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + size: number | PDFNumber; + thickness: number | PDFNumber; + color: Color | undefined; +}) => PDFOperator[]; +export declare const rotateInPlace: (options: { + width: number | PDFNumber; + height: number | PDFNumber; + rotation: 0 | 90 | 180 | 270; +}) => PDFOperator[]; +export declare const drawCheckBox: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + thickness: number | PDFNumber; + borderWidth: number | PDFNumber; + markColor: Color | undefined; + color: Color | undefined; + borderColor: Color | undefined; + filled: boolean; +}) => PDFOperator[]; +export declare const drawRadioButton: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + borderWidth: number | PDFNumber; + dotColor: Color | undefined; + color: Color | undefined; + borderColor: Color | undefined; + filled: boolean; +}) => PDFOperator[]; +export declare const drawButton: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + borderWidth: number | PDFNumber; + color: Color | undefined; + borderColor: Color | undefined; + textLines: { + encoded: PDFHexString; + x: number; + y: number; + }[]; + textColor: Color; + font: string | PDFName; + fontSize: number | PDFNumber; +}) => PDFOperator[]; +export interface DrawTextLinesOptions { + color: Color; + font: string | PDFName; + size: number | PDFNumber; + rotate: Rotation; + xSkew: Rotation; + ySkew: Rotation; +} +export declare const drawTextLines: (lines: { + encoded: PDFHexString; + x: number; + y: number; +}[], options: DrawTextLinesOptions) => PDFOperator[]; +export declare const drawTextField: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + borderWidth: number | PDFNumber; + color: Color | undefined; + borderColor: Color | undefined; + textLines: { + encoded: PDFHexString; + x: number; + y: number; + }[]; + textColor: Color; + font: string | PDFName; + fontSize: number | PDFNumber; + padding: number | PDFNumber; +}) => PDFOperator[]; +export declare const drawOptionList: (options: { + x: number | PDFNumber; + y: number | PDFNumber; + width: number | PDFNumber; + height: number | PDFNumber; + borderWidth: number | PDFNumber; + color: Color | undefined; + borderColor: Color | undefined; + textLines: { + encoded: PDFHexString; + x: number; + y: number; + height: number; + }[]; + textColor: Color; + font: string | PDFName; + fontSize: number | PDFNumber; + lineHeight: number | PDFNumber; + selectedLines: number[]; + selectedColor: Color; + padding: number | PDFNumber; +}) => PDFOperator[]; +//# sourceMappingURL=operations.d.ts.map \ No newline at end of file diff --git a/cjs/api/operations.d.ts.map b/cjs/api/operations.d.ts.map new file mode 100644 index 000000000..ee5e70f6b --- /dev/null +++ b/cjs/api/operations.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/api/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqC,iBAAuB;AAC1E,OAAO,EAcL,KAAK,EAQL,YAAY,EAUb,oBAA0B;AAC3B,OAAO,EAAE,QAAQ,EAAsB,oBAA0B;AAEjE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAiB;AAGzE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,QAAQ,CAAC;IAChB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,QAAQ,SACb,YAAY,WACT,eAAe,KACvB,WAAW,EAiBsB,CAAC;AAErC,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,UACnB,YAAY,EAAE,WACZ,sBAAsB,KAC9B,WAAW,EAuBb,CAAC;AAEF,eAAO,MAAM,SAAS,SACd,MAAM,GAAG,OAAO,WACb;IACP,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,QAAQ,C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M,GAAG,SAAS;aACnB,MAAM,GAAG,SAAS;mBA6D5B,CAAC;AAEF,eAAO,MAAM,cAAc;OACtB,MAAM,GAAG,SAAS;OAClB,MAAM,GAAG,SAAS;WACd,MAAM,GAAG,SAAS;YACjB,MAAM,GAAG,SAAS;iBACb,MAAM,GAAG,SAAS;WACxB,KAAK,GAAG,SAAS;iBACX,KAAK,GAAG,SAAS;;iBACR,YAAY;WAAK,MAAM;WAAK,MAAM;gBAAU,MAAM;;eAC7D,KAAK;UACV,MAAM,GAAG,OAAO;cACZ,MAAM,GAAG,SAAS;gBAChB,MAAM,GAAG,SAAS;mBACf,MAAM,EAAE;mBACR,KAAK;aACX,MAAM,GAAG,SAAS;mBAkF5B,CAAC"} \ No newline at end of file diff --git a/cjs/api/operations.js b/cjs/api/operations.js new file mode 100644 index 000000000..a7d34f64c --- /dev/null +++ b/cjs/api/operations.js @@ -0,0 +1,488 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawOptionList = exports.drawTextField = exports.drawTextLines = exports.drawButton = exports.drawRadioButton = exports.drawCheckBox = exports.rotateInPlace = exports.drawCheckMark = exports.drawSvgPath = exports.drawEllipse = exports.drawEllipsePath = exports.drawRectangle = exports.drawLine = exports.drawPage = exports.drawImage = exports.drawLinesOfText = exports.drawText = void 0; +var tslib_1 = require("tslib"); +var colors_1 = require("./colors"); +var operators_1 = require("./operators"); +var rotations_1 = require("./rotations"); +var svgPath_1 = require("./svgPath"); +var objects_1 = require("./objects"); +exports.drawText = function (line, options) { + return [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + operators_1.beginText(), + colors_1.setFillingColor(options.color), + operators_1.setFontAndSize(options.font, options.size), + operators_1.rotateAndSkewTextRadiansAndTranslate(rotations_1.toRadians(options.rotate), rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew), options.x, options.y), + operators_1.showText(line), + operators_1.endText(), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +exports.drawLinesOfText = function (lines, options) { + var operators = [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + operators_1.beginText(), + colors_1.setFillingColor(options.color), + operators_1.setFontAndSize(options.font, options.size), + operators_1.setLineHeight(options.lineHeight), + operators_1.rotateAndSkewTextRadiansAndTranslate(rotations_1.toRadians(options.rotate), rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew), options.x, options.y), + ].filter(Boolean); + for (var idx = 0, len = lines.length; idx < len; idx++) { + operators.push(operators_1.showText(lines[idx]), operators_1.nextLine()); + } + operators.push(operators_1.endText(), operators_1.popGraphicsState()); + return operators; +}; +exports.drawImage = function (name, options) { + return [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + operators_1.translate(options.x, options.y), + operators_1.rotateRadians(rotations_1.toRadians(options.rotate)), + operators_1.scale(options.width, options.height), + operators_1.skewRadians(rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew)), + operators_1.drawObject(name), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +exports.drawPage = function (name, options) { + return [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + operators_1.translate(options.x, options.y), + operators_1.rotateRadians(rotations_1.toRadians(options.rotate)), + operators_1.scale(options.xScale, options.yScale), + operators_1.skewRadians(rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew)), + operators_1.drawObject(name), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +exports.drawLine = function (options) { + var _a, _b; + return [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + options.color && colors_1.setStrokingColor(options.color), + operators_1.setLineWidth(options.thickness), + operators_1.setDashPattern((_a = options.dashArray) !== null && _a !== void 0 ? _a : [], (_b = options.dashPhase) !== null && _b !== void 0 ? _b : 0), + operators_1.moveTo(options.start.x, options.start.y), + options.lineCap && operators_1.setLineCap(options.lineCap), + operators_1.moveTo(options.start.x, options.start.y), + operators_1.lineTo(options.end.x, options.end.y), + operators_1.stroke(), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +exports.drawRectangle = function (options) { + var _a, _b; + return [ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + options.color && colors_1.setFillingColor(options.color), + options.borderColor && colors_1.setStrokingColor(options.borderColor), + operators_1.setLineWidth(options.borderWidth), + options.borderLineCap && operators_1.setLineCap(options.borderLineCap), + operators_1.setDashPattern((_a = options.borderDashArray) !== null && _a !== void 0 ? _a : [], (_b = options.borderDashPhase) !== null && _b !== void 0 ? _b : 0), + operators_1.translate(options.x, options.y), + operators_1.rotateRadians(rotations_1.toRadians(options.rotate)), + operators_1.skewRadians(rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew)), + operators_1.moveTo(0, 0), + operators_1.lineTo(0, options.height), + operators_1.lineTo(options.width, options.height), + operators_1.lineTo(options.width, 0), + operators_1.closePath(), + // prettier-ignore + options.color && options.borderWidth ? operators_1.fillAndStroke() + : options.color ? operators_1.fill() + : options.borderColor ? operators_1.stroke() + : operators_1.closePath(), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +var KAPPA = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0); +/** @deprecated */ +exports.drawEllipsePath = function (config) { + var x = objects_1.asNumber(config.x); + var y = objects_1.asNumber(config.y); + var xScale = objects_1.asNumber(config.xScale); + var yScale = objects_1.asNumber(config.yScale); + x -= xScale; + y -= yScale; + var ox = xScale * KAPPA; + var oy = yScale * KAPPA; + var xe = x + xScale * 2; + var ye = y + yScale * 2; + var xm = x + xScale; + var ym = y + yScale; + return [ + operators_1.pushGraphicsState(), + operators_1.moveTo(x, ym), + operators_1.appendBezierCurve(x, ym - oy, xm - ox, y, xm, y), + operators_1.appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym), + operators_1.appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye), + operators_1.appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym), + operators_1.popGraphicsState(), + ]; +}; +var drawEllipseCurves = function (config) { + var centerX = objects_1.asNumber(config.x); + var centerY = objects_1.asNumber(config.y); + var xScale = objects_1.asNumber(config.xScale); + var yScale = objects_1.asNumber(config.yScale); + var x = -xScale; + var y = -yScale; + var ox = xScale * KAPPA; + var oy = yScale * KAPPA; + var xe = x + xScale * 2; + var ye = y + yScale * 2; + var xm = x + xScale; + var ym = y + yScale; + return [ + operators_1.translate(centerX, centerY), + operators_1.rotateRadians(rotations_1.toRadians(config.rotate)), + operators_1.moveTo(x, ym), + operators_1.appendBezierCurve(x, ym - oy, xm - ox, y, xm, y), + operators_1.appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym), + operators_1.appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye), + operators_1.appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym), + ]; +}; +exports.drawEllipse = function (options) { + var _a, _b, _c; + return tslib_1.__spreadArrays([ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + options.color && colors_1.setFillingColor(options.color), + options.borderColor && colors_1.setStrokingColor(options.borderColor), + operators_1.setLineWidth(options.borderWidth), + options.borderLineCap && operators_1.setLineCap(options.borderLineCap), + operators_1.setDashPattern((_a = options.borderDashArray) !== null && _a !== void 0 ? _a : [], (_b = options.borderDashPhase) !== null && _b !== void 0 ? _b : 0) + ], (options.rotate === undefined + ? exports.drawEllipsePath({ + x: options.x, + y: options.y, + xScale: options.xScale, + yScale: options.yScale, + }) + : drawEllipseCurves({ + x: options.x, + y: options.y, + xScale: options.xScale, + yScale: options.yScale, + rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0), + })), [ + // prettier-ignore + options.color && options.borderWidth ? operators_1.fillAndStroke() + : options.color ? operators_1.fill() + : options.borderColor ? operators_1.stroke() + : operators_1.closePath(), + operators_1.popGraphicsState(), + ]).filter(Boolean); +}; +exports.drawSvgPath = function (path, options) { + var _a, _b, _c; + return tslib_1.__spreadArrays([ + operators_1.pushGraphicsState(), + options.graphicsState && operators_1.setGraphicsState(options.graphicsState), + operators_1.translate(options.x, options.y), + operators_1.rotateRadians(rotations_1.toRadians((_a = options.rotate) !== null && _a !== void 0 ? _a : rotations_1.degrees(0))), + // SVG path Y axis is opposite pdf-lib's + options.scale ? operators_1.scale(options.scale, -options.scale) : operators_1.scale(1, -1), + options.color && colors_1.setFillingColor(options.color), + options.borderColor && colors_1.setStrokingColor(options.borderColor), + options.borderWidth && operators_1.setLineWidth(options.borderWidth), + options.borderLineCap && operators_1.setLineCap(options.borderLineCap), + operators_1.setDashPattern((_b = options.borderDashArray) !== null && _b !== void 0 ? _b : [], (_c = options.borderDashPhase) !== null && _c !== void 0 ? _c : 0) + ], svgPath_1.svgPathToOperators(path), [ + // prettier-ignore + options.color && options.borderWidth ? operators_1.fillAndStroke() + : options.color ? operators_1.fill() + : options.borderColor ? operators_1.stroke() + : operators_1.closePath(), + operators_1.popGraphicsState(), + ]).filter(Boolean); +}; +exports.drawCheckMark = function (options) { + var size = objects_1.asNumber(options.size); + /*********************** Define Check Mark Points ***************************/ + // A check mark is defined by three points in some coordinate space. Here, we + // define these points in a unit coordinate system, where the range of the x + // and y axis are both [-1, 1]. + // + // Note that we do not hard code `p1y` in case we wish to change the + // size/shape of the check mark in the future. We want the check mark to + // always form a right angle. This means that the dot product between (p1-p2) + // and (p3-p2) should be zero: + // + // (p1x-p2x) * (p3x-p2x) + (p1y-p2y) * (p3y-p2y) = 0 + // + // We can now rejigger this equation to solve for `p1y`: + // + // (p1y-p2y) * (p3y-p2y) = -((p1x-p2x) * (p3x-p2x)) + // (p1y-p2y) = -((p1x-p2x) * (p3x-p2x)) / (p3y-p2y) + // p1y = -((p1x-p2x) * (p3x-p2x)) / (p3y-p2y) + p2y + // + // Thanks to my friend Joel Walker (https://github.com/JWalker1995) for + // devising the above equation and unit coordinate system approach! + // (x, y) coords of the check mark's bottommost point + var p2x = -1 + 0.75; + var p2y = -1 + 0.51; + // (x, y) coords of the check mark's topmost point + var p3y = 1 - 0.525; + var p3x = 1 - 0.31; + // (x, y) coords of the check mark's center (vertically) point + var p1x = -1 + 0.325; + var p1y = -((p1x - p2x) * (p3x - p2x)) / (p3y - p2y) + p2y; + /****************************************************************************/ + return [ + operators_1.pushGraphicsState(), + options.color && colors_1.setStrokingColor(options.color), + operators_1.setLineWidth(options.thickness), + operators_1.translate(options.x, options.y), + operators_1.moveTo(p1x * size, p1y * size), + operators_1.lineTo(p2x * size, p2y * size), + operators_1.lineTo(p3x * size, p3y * size), + operators_1.stroke(), + operators_1.popGraphicsState(), + ].filter(Boolean); +}; +// prettier-ignore +exports.rotateInPlace = function (options) { + return options.rotation === 0 ? [ + operators_1.translate(0, 0), + operators_1.rotateDegrees(0) + ] + : options.rotation === 90 ? [ + operators_1.translate(options.width, 0), + operators_1.rotateDegrees(90) + ] + : options.rotation === 180 ? [ + operators_1.translate(options.width, options.height), + operators_1.rotateDegrees(180) + ] + : options.rotation === 270 ? [ + operators_1.translate(0, options.height), + operators_1.rotateDegrees(270) + ] + : []; +}; // Invalid rotation - noop +exports.drawCheckBox = function (options) { + var outline = exports.drawRectangle({ + x: options.x, + y: options.y, + width: options.width, + height: options.height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + if (!options.filled) + return outline; + var width = objects_1.asNumber(options.width); + var height = objects_1.asNumber(options.height); + var checkMarkSize = Math.min(width, height) / 2; + var checkMark = exports.drawCheckMark({ + x: width / 2, + y: height / 2, + size: checkMarkSize, + thickness: options.thickness, + color: options.markColor, + }); + return tslib_1.__spreadArrays([operators_1.pushGraphicsState()], outline, checkMark, [operators_1.popGraphicsState()]); +}; +exports.drawRadioButton = function (options) { + var width = objects_1.asNumber(options.width); + var height = objects_1.asNumber(options.height); + var outlineScale = Math.min(width, height) / 2; + var outline = exports.drawEllipse({ + x: options.x, + y: options.y, + xScale: outlineScale, + yScale: outlineScale, + color: options.color, + borderColor: options.borderColor, + borderWidth: options.borderWidth, + }); + if (!options.filled) + return outline; + var dot = exports.drawEllipse({ + x: options.x, + y: options.y, + xScale: outlineScale * 0.45, + yScale: outlineScale * 0.45, + color: options.dotColor, + borderColor: undefined, + borderWidth: 0, + }); + return tslib_1.__spreadArrays([operators_1.pushGraphicsState()], outline, dot, [operators_1.popGraphicsState()]); +}; +exports.drawButton = function (options) { + var x = objects_1.asNumber(options.x); + var y = objects_1.asNumber(options.y); + var width = objects_1.asNumber(options.width); + var height = objects_1.asNumber(options.height); + var background = exports.drawRectangle({ + x: x, + y: y, + width: width, + height: height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + var lines = exports.drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + return tslib_1.__spreadArrays([operators_1.pushGraphicsState()], background, lines, [operators_1.popGraphicsState()]); +}; +exports.drawTextLines = function (lines, options) { + var operators = [ + operators_1.beginText(), + colors_1.setFillingColor(options.color), + operators_1.setFontAndSize(options.font, options.size), + ]; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var _a = lines[idx], encoded = _a.encoded, x = _a.x, y = _a.y; + operators.push(operators_1.rotateAndSkewTextRadiansAndTranslate(rotations_1.toRadians(options.rotate), rotations_1.toRadians(options.xSkew), rotations_1.toRadians(options.ySkew), x, y), operators_1.showText(encoded)); + } + operators.push(operators_1.endText()); + return operators; +}; +exports.drawTextField = function (options) { + var x = objects_1.asNumber(options.x); + var y = objects_1.asNumber(options.y); + var width = objects_1.asNumber(options.width); + var height = objects_1.asNumber(options.height); + var borderWidth = objects_1.asNumber(options.borderWidth); + var padding = objects_1.asNumber(options.padding); + var clipX = x + borderWidth / 2 + padding; + var clipY = y + borderWidth / 2 + padding; + var clipWidth = width - (borderWidth / 2 + padding) * 2; + var clipHeight = height - (borderWidth / 2 + padding) * 2; + var clippingArea = [ + operators_1.moveTo(clipX, clipY), + operators_1.lineTo(clipX, clipY + clipHeight), + operators_1.lineTo(clipX + clipWidth, clipY + clipHeight), + operators_1.lineTo(clipX + clipWidth, clipY), + operators_1.closePath(), + operators_1.clip(), + operators_1.endPath(), + ]; + var background = exports.drawRectangle({ + x: x, + y: y, + width: width, + height: height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + var lines = exports.drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + var markedContent = tslib_1.__spreadArrays([ + operators_1.beginMarkedContent('Tx'), + operators_1.pushGraphicsState() + ], lines, [ + operators_1.popGraphicsState(), + operators_1.endMarkedContent(), + ]); + return tslib_1.__spreadArrays([ + operators_1.pushGraphicsState() + ], background, clippingArea, markedContent, [ + operators_1.popGraphicsState(), + ]); +}; +exports.drawOptionList = function (options) { + var x = objects_1.asNumber(options.x); + var y = objects_1.asNumber(options.y); + var width = objects_1.asNumber(options.width); + var height = objects_1.asNumber(options.height); + var lineHeight = objects_1.asNumber(options.lineHeight); + var borderWidth = objects_1.asNumber(options.borderWidth); + var padding = objects_1.asNumber(options.padding); + var clipX = x + borderWidth / 2 + padding; + var clipY = y + borderWidth / 2 + padding; + var clipWidth = width - (borderWidth / 2 + padding) * 2; + var clipHeight = height - (borderWidth / 2 + padding) * 2; + var clippingArea = [ + operators_1.moveTo(clipX, clipY), + operators_1.lineTo(clipX, clipY + clipHeight), + operators_1.lineTo(clipX + clipWidth, clipY + clipHeight), + operators_1.lineTo(clipX + clipWidth, clipY), + operators_1.closePath(), + operators_1.clip(), + operators_1.endPath(), + ]; + var background = exports.drawRectangle({ + x: x, + y: y, + width: width, + height: height, + borderWidth: options.borderWidth, + color: options.color, + borderColor: options.borderColor, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + var highlights = []; + for (var idx = 0, len = options.selectedLines.length; idx < len; idx++) { + var line = options.textLines[options.selectedLines[idx]]; + highlights.push.apply(highlights, exports.drawRectangle({ + x: line.x - padding, + y: line.y - (lineHeight - line.height) / 2, + width: width - borderWidth, + height: line.height + (lineHeight - line.height) / 2, + borderWidth: 0, + color: options.selectedColor, + borderColor: undefined, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + })); + } + var lines = exports.drawTextLines(options.textLines, { + color: options.textColor, + font: options.font, + size: options.fontSize, + rotate: rotations_1.degrees(0), + xSkew: rotations_1.degrees(0), + ySkew: rotations_1.degrees(0), + }); + var markedContent = tslib_1.__spreadArrays([ + operators_1.beginMarkedContent('Tx'), + operators_1.pushGraphicsState() + ], lines, [ + operators_1.popGraphicsState(), + operators_1.endMarkedContent(), + ]); + return tslib_1.__spreadArrays([ + operators_1.pushGraphicsState() + ], background, highlights, clippingArea, markedContent, [ + operators_1.popGraphicsState(), + ]); +}; +//# sourceMappingURL=operations.js.map \ No newline at end of file diff --git a/cjs/api/operations.js.map b/cjs/api/operations.js.map new file mode 100644 index 000000000..f4ee836d7 --- /dev/null +++ b/cjs/api/operations.js.map @@ -0,0 +1 @@ +{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/api/operations.ts"],"names":[],"mappings":";;;;AAAA,mCAA0E;AAC1E,yCAgC2B;AAC3B,yCAAiE;AACjE,qCAAqD;AAErD,qCAA2C;AAc9B,QAAA,QAAQ,GAAG,UACtB,IAAkB,EAClB,OAAwB;IAExB,OAAA;QACE,6BAAiB,EAAE;QACnB,OAAO,CAAC,aAAa,IAAI,4BAA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AAiB,EAAE;OAChB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa;QAChB,4BAAgB,EAAE;OAClB;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/api/operators.d.ts b/cjs/api/operators.d.ts new file mode 100644 index 000000000..474d0a837 --- /dev/null +++ b/cjs/api/operators.d.ts @@ -0,0 +1,86 @@ +import { PDFHexString, PDFName, PDFNumber, PDFOperator } from "../core"; +export declare const clip: () => PDFOperator; +export declare const clipEvenOdd: () => PDFOperator; +export declare const concatTransformationMatrix: (a: number | PDFNumber, b: number | PDFNumber, c: number | PDFNumber, d: number | PDFNumber, e: number | PDFNumber, f: number | PDFNumber) => PDFOperator; +export declare const translate: (xPos: number | PDFNumber, yPos: number | PDFNumber) => PDFOperator; +export declare const scale: (xPos: number | PDFNumber, yPos: number | PDFNumber) => PDFOperator; +export declare const rotateRadians: (angle: number | PDFNumber) => PDFOperator; +export declare const rotateDegrees: (angle: number | PDFNumber) => PDFOperator; +export declare const skewRadians: (xSkewAngle: number | PDFNumber, ySkewAngle: number | PDFNumber) => PDFOperator; +export declare const skewDegrees: (xSkewAngle: number | PDFNumber, ySkewAngle: number | PDFNumber) => PDFOperator; +export declare const setDashPattern: (dashArray: (number | PDFNumber)[], dashPhase: number | PDFNumber) => PDFOperator; +export declare const restoreDashPattern: () => PDFOperator; +export declare enum LineCapStyle { + Butt = 0, + Round = 1, + Projecting = 2 +} +export declare const setLineCap: (style: LineCapStyle) => PDFOperator; +export declare enum LineJoinStyle { + Miter = 0, + Round = 1, + Bevel = 2 +} +export declare const setLineJoin: (style: LineJoinStyle) => PDFOperator; +export declare const setGraphicsState: (state: string | PDFName) => PDFOperator; +export declare const pushGraphicsState: () => PDFOperator; +export declare const popGraphicsState: () => PDFOperator; +export declare const setLineWidth: (width: number | PDFNumber) => PDFOperator; +export declare const appendBezierCurve: (x1: number | PDFNumber, y1: number | PDFNumber, x2: number | PDFNumber, y2: number | PDFNumber, x3: number | PDFNumber, y3: number | PDFNumber) => PDFOperator; +export declare const appendQuadraticCurve: (x1: number | PDFNumber, y1: number | PDFNumber, x2: number | PDFNumber, y2: number | PDFNumber) => PDFOperator; +export declare const closePath: () => PDFOperator; +export declare const moveTo: (xPos: number | PDFNumber, yPos: number | PDFNumber) => PDFOperator; +export declare const lineTo: (xPos: number | PDFNumber, yPos: number | PDFNumber) => PDFOperator; +/** + * @param xPos x coordinate for the lower left corner of the rectangle + * @param yPos y coordinate for the lower left corner of the rectangle + * @param width width of the rectangle + * @param height height of the rectangle + */ +export declare const rectangle: (xPos: number | PDFNumber, yPos: number | PDFNumber, width: number | PDFNumber, height: number | PDFNumber) => PDFOperator; +/** + * @param xPos x coordinate for the lower left corner of the square + * @param yPos y coordinate for the lower left corner of the square + * @param size width and height of the square + */ +export declare const square: (xPos: number, yPos: number, size: number) => PDFOperator; +export declare const stroke: () => PDFOperator; +export declare const fill: () => PDFOperator; +export declare const fillAndStroke: () => PDFOperator; +export declare const endPath: () => PDFOperator; +export declare const nextLine: () => PDFOperator; +export declare const moveText: (x: number | PDFNumber, y: number | PDFNumber) => PDFOperator; +export declare const showText: (text: PDFHexString) => PDFOperator; +export declare const beginText: () => PDFOperator; +export declare const endText: () => PDFOperator; +export declare const setFontAndSize: (name: string | PDFName, size: number | PDFNumber) => PDFOperator; +export declare const setCharacterSpacing: (spacing: number | PDFNumber) => PDFOperator; +export declare const setWordSpacing: (spacing: number | PDFNumber) => PDFOperator; +/** @param squeeze horizontal character spacing */ +export declare const setCharacterSqueeze: (squeeze: number | PDFNumber) => PDFOperator; +export declare const setLineHeight: (lineHeight: number | PDFNumber) => PDFOperator; +export declare const setTextRise: (rise: number | PDFNumber) => PDFOperator; +export declare enum TextRenderingMode { + Fill = 0, + Outline = 1, + FillAndOutline = 2, + Invisible = 3, + FillAndClip = 4, + OutlineAndClip = 5, + FillAndOutlineAndClip = 6, + Clip = 7 +} +export declare const setTextRenderingMode: (mode: TextRenderingMode) => PDFOperator; +export declare const setTextMatrix: (a: number | PDFNumber, b: number | PDFNumber, c: number | PDFNumber, d: number | PDFNumber, e: number | PDFNumber, f: number | PDFNumber) => PDFOperator; +export declare const rotateAndSkewTextRadiansAndTranslate: (rotationAngle: number | PDFNumber, xSkewAngle: number | PDFNumber, ySkewAngle: number | PDFNumber, x: number | PDFNumber, y: number | PDFNumber) => PDFOperator; +export declare const rotateAndSkewTextDegreesAndTranslate: (rotationAngle: number | PDFNumber, xSkewAngle: number | PDFNumber, ySkewAngle: number | PDFNumber, x: number | PDFNumber, y: number | PDFNumber) => PDFOperator; +export declare const drawObject: (name: string | PDFName) => PDFOperator; +export declare const setFillingGrayscaleColor: (gray: number | PDFNumber) => PDFOperator; +export declare const setStrokingGrayscaleColor: (gray: number | PDFNumber) => PDFOperator; +export declare const setFillingRgbColor: (red: number | PDFNumber, green: number | PDFNumber, blue: number | PDFNumber) => PDFOperator; +export declare const setStrokingRgbColor: (red: number | PDFNumber, green: number | PDFNumber, blue: number | PDFNumber) => PDFOperator; +export declare const setFillingCmykColor: (cyan: number | PDFNumber, magenta: number | PDFNumber, yellow: number | PDFNumber, key: number | PDFNumber) => PDFOperator; +export declare const setStrokingCmykColor: (cyan: number | PDFNumber, magenta: number | PDFNumber, yellow: number | PDFNumber, key: number | PDFNumber) => PDFOperator; +export declare const beginMarkedContent: (tag: string | PDFName) => PDFOperator; +export declare const endMarkedContent: () => PDFOperator; +//# sourceMappingURL=operators.d.ts.map \ No newline at end of file diff --git a/cjs/api/operators.d.ts.map b/cjs/api/operators.d.ts.map new file mode 100644 index 000000000..46b1adb77 --- /dev/null +++ b/cjs/api/operators.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/api/operators.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EAEZ,gBAAiB;AAIlB,eAAO,MAAM,IAAI,mBAAwC,CAAC;AAC1D,eAAO,MAAM,WAAW,mBAAwC,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,MAAM,GAAG,SAAS,gBACF,CAAC;AAEhE,eAAO,MAAM,yBAAyB,SAAU,MAAM,GAAG,SAAS,gBACN,CAAC;AAE7D,eAAO,MAAM,kBAAkB,QACxB,MAAM,GAAG,SAAS,SAChB,MAAM,GAAG,SAAS,QACnB,MAAM,GAAG,SAAS,gBAMtB,CAAC;AAEL,eAAO,MAAM,mBAAmB,QACzB,MAAM,GAAG,SAAS,SAChB,MAAM,GAAG,SAAS,QACnB,MAAM,GAAG,SAAS,gBAMtB,CAAC;AAEL,eAAO,MAAM,mBAAmB,SACxB,MAAM,GAAG,SAAS,WACf,MAAM,GAAG,SAAS,UACnB,MAAM,GAAG,SAAS,OACrB,MAAM,GAAG,SAAS,gBAOrB,CAAC;AAEL,eAAO,MAAM,oBAAoB,SACzB,MAAM,GAAG,SAAS,WACf,MAAM,GAAG,SAAS,UACnB,MAAM,GAAG,SAAS,OACrB,MAAM,GAAG,SAAS,gBAOrB,CAAC;AAIL,eAAO,MAAM,kBAAkB,QAAS,MAAM,GAAG,OAAO,gBACE,CAAC;AAE3D,eAAO,MAAM,gBAAgB,mBAA6C,CAAC"} \ No newline at end of file diff --git a/cjs/api/operators.js b/cjs/api/operators.js new file mode 100644 index 000000000..f3a2eea19 --- /dev/null +++ b/cjs/api/operators.js @@ -0,0 +1,231 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.endMarkedContent = exports.beginMarkedContent = exports.setStrokingCmykColor = exports.setFillingCmykColor = exports.setStrokingRgbColor = exports.setFillingRgbColor = exports.setStrokingGrayscaleColor = exports.setFillingGrayscaleColor = exports.drawObject = exports.rotateAndSkewTextDegreesAndTranslate = exports.rotateAndSkewTextRadiansAndTranslate = exports.setTextMatrix = exports.setTextRenderingMode = exports.TextRenderingMode = exports.setTextRise = exports.setLineHeight = exports.setCharacterSqueeze = exports.setWordSpacing = exports.setCharacterSpacing = exports.setFontAndSize = exports.endText = exports.beginText = exports.showText = exports.moveText = exports.nextLine = exports.endPath = exports.fillAndStroke = exports.fill = exports.stroke = exports.square = exports.rectangle = exports.lineTo = exports.moveTo = exports.closePath = exports.appendQuadraticCurve = exports.appendBezierCurve = exports.setLineWidth = exports.popGraphicsState = exports.pushGraphicsState = exports.setGraphicsState = exports.setLineJoin = exports.LineJoinStyle = exports.setLineCap = exports.LineCapStyle = exports.restoreDashPattern = exports.setDashPattern = exports.skewDegrees = exports.skewRadians = exports.rotateDegrees = exports.rotateRadians = exports.scale = exports.translate = exports.concatTransformationMatrix = exports.clipEvenOdd = exports.clip = void 0; +var objects_1 = require("./objects"); +var rotations_1 = require("./rotations"); +var core_1 = require("../core"); +/* ==================== Clipping Path Operators ==================== */ +exports.clip = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.ClipNonZero); }; +exports.clipEvenOdd = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.ClipEvenOdd); }; +/* ==================== Graphics State Operators ==================== */ +var cos = Math.cos, sin = Math.sin, tan = Math.tan; +exports.concatTransformationMatrix = function (a, b, c, d, e, f) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.ConcatTransformationMatrix, [ + objects_1.asPDFNumber(a), + objects_1.asPDFNumber(b), + objects_1.asPDFNumber(c), + objects_1.asPDFNumber(d), + objects_1.asPDFNumber(e), + objects_1.asPDFNumber(f), + ]); +}; +exports.translate = function (xPos, yPos) { + return exports.concatTransformationMatrix(1, 0, 0, 1, xPos, yPos); +}; +exports.scale = function (xPos, yPos) { + return exports.concatTransformationMatrix(xPos, 0, 0, yPos, 0, 0); +}; +exports.rotateRadians = function (angle) { + return exports.concatTransformationMatrix(cos(objects_1.asNumber(angle)), sin(objects_1.asNumber(angle)), -sin(objects_1.asNumber(angle)), cos(objects_1.asNumber(angle)), 0, 0); +}; +exports.rotateDegrees = function (angle) { + return exports.rotateRadians(rotations_1.degreesToRadians(objects_1.asNumber(angle))); +}; +exports.skewRadians = function (xSkewAngle, ySkewAngle) { + return exports.concatTransformationMatrix(1, tan(objects_1.asNumber(xSkewAngle)), tan(objects_1.asNumber(ySkewAngle)), 1, 0, 0); +}; +exports.skewDegrees = function (xSkewAngle, ySkewAngle) { + return exports.skewRadians(rotations_1.degreesToRadians(objects_1.asNumber(xSkewAngle)), rotations_1.degreesToRadians(objects_1.asNumber(ySkewAngle))); +}; +exports.setDashPattern = function (dashArray, dashPhase) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetLineDashPattern, [ + "[" + dashArray.map(objects_1.asPDFNumber).join(' ') + "]", + objects_1.asPDFNumber(dashPhase), + ]); +}; +exports.restoreDashPattern = function () { return exports.setDashPattern([], 0); }; +var LineCapStyle; +(function (LineCapStyle) { + LineCapStyle[LineCapStyle["Butt"] = 0] = "Butt"; + LineCapStyle[LineCapStyle["Round"] = 1] = "Round"; + LineCapStyle[LineCapStyle["Projecting"] = 2] = "Projecting"; +})(LineCapStyle = exports.LineCapStyle || (exports.LineCapStyle = {})); +exports.setLineCap = function (style) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetLineCapStyle, [objects_1.asPDFNumber(style)]); +}; +var LineJoinStyle; +(function (LineJoinStyle) { + LineJoinStyle[LineJoinStyle["Miter"] = 0] = "Miter"; + LineJoinStyle[LineJoinStyle["Round"] = 1] = "Round"; + LineJoinStyle[LineJoinStyle["Bevel"] = 2] = "Bevel"; +})(LineJoinStyle = exports.LineJoinStyle || (exports.LineJoinStyle = {})); +exports.setLineJoin = function (style) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetLineJoinStyle, [objects_1.asPDFNumber(style)]); +}; +exports.setGraphicsState = function (state) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetGraphicsStateParams, [objects_1.asPDFName(state)]); +}; +exports.pushGraphicsState = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.PushGraphicsState); }; +exports.popGraphicsState = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.PopGraphicsState); }; +exports.setLineWidth = function (width) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetLineWidth, [objects_1.asPDFNumber(width)]); +}; +/* ==================== Path Construction Operators ==================== */ +exports.appendBezierCurve = function (x1, y1, x2, y2, x3, y3) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.AppendBezierCurve, [ + objects_1.asPDFNumber(x1), + objects_1.asPDFNumber(y1), + objects_1.asPDFNumber(x2), + objects_1.asPDFNumber(y2), + objects_1.asPDFNumber(x3), + objects_1.asPDFNumber(y3), + ]); +}; +exports.appendQuadraticCurve = function (x1, y1, x2, y2) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.CurveToReplicateInitialPoint, [ + objects_1.asPDFNumber(x1), + objects_1.asPDFNumber(y1), + objects_1.asPDFNumber(x2), + objects_1.asPDFNumber(y2), + ]); +}; +exports.closePath = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.ClosePath); }; +exports.moveTo = function (xPos, yPos) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.MoveTo, [objects_1.asPDFNumber(xPos), objects_1.asPDFNumber(yPos)]); +}; +exports.lineTo = function (xPos, yPos) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.LineTo, [objects_1.asPDFNumber(xPos), objects_1.asPDFNumber(yPos)]); +}; +/** + * @param xPos x coordinate for the lower left corner of the rectangle + * @param yPos y coordinate for the lower left corner of the rectangle + * @param width width of the rectangle + * @param height height of the rectangle + */ +exports.rectangle = function (xPos, yPos, width, height) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.AppendRectangle, [ + objects_1.asPDFNumber(xPos), + objects_1.asPDFNumber(yPos), + objects_1.asPDFNumber(width), + objects_1.asPDFNumber(height), + ]); +}; +/** + * @param xPos x coordinate for the lower left corner of the square + * @param yPos y coordinate for the lower left corner of the square + * @param size width and height of the square + */ +exports.square = function (xPos, yPos, size) { + return exports.rectangle(xPos, yPos, size, size); +}; +/* ==================== Path Painting Operators ==================== */ +exports.stroke = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.StrokePath); }; +exports.fill = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.FillNonZero); }; +exports.fillAndStroke = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.FillNonZeroAndStroke); }; +exports.endPath = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.EndPath); }; +/* ==================== Text Positioning Operators ==================== */ +exports.nextLine = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.NextLine); }; +exports.moveText = function (x, y) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.MoveText, [objects_1.asPDFNumber(x), objects_1.asPDFNumber(y)]); +}; +/* ==================== Text Showing Operators ==================== */ +exports.showText = function (text) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.ShowText, [text]); +}; +/* ==================== Text State Operators ==================== */ +exports.beginText = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.BeginText); }; +exports.endText = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.EndText); }; +exports.setFontAndSize = function (name, size) { return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetFontAndSize, [objects_1.asPDFName(name), objects_1.asPDFNumber(size)]); }; +exports.setCharacterSpacing = function (spacing) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetCharacterSpacing, [objects_1.asPDFNumber(spacing)]); +}; +exports.setWordSpacing = function (spacing) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetWordSpacing, [objects_1.asPDFNumber(spacing)]); +}; +/** @param squeeze horizontal character spacing */ +exports.setCharacterSqueeze = function (squeeze) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetTextHorizontalScaling, [objects_1.asPDFNumber(squeeze)]); +}; +exports.setLineHeight = function (lineHeight) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetTextLineHeight, [objects_1.asPDFNumber(lineHeight)]); +}; +exports.setTextRise = function (rise) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetTextRise, [objects_1.asPDFNumber(rise)]); +}; +var TextRenderingMode; +(function (TextRenderingMode) { + TextRenderingMode[TextRenderingMode["Fill"] = 0] = "Fill"; + TextRenderingMode[TextRenderingMode["Outline"] = 1] = "Outline"; + TextRenderingMode[TextRenderingMode["FillAndOutline"] = 2] = "FillAndOutline"; + TextRenderingMode[TextRenderingMode["Invisible"] = 3] = "Invisible"; + TextRenderingMode[TextRenderingMode["FillAndClip"] = 4] = "FillAndClip"; + TextRenderingMode[TextRenderingMode["OutlineAndClip"] = 5] = "OutlineAndClip"; + TextRenderingMode[TextRenderingMode["FillAndOutlineAndClip"] = 6] = "FillAndOutlineAndClip"; + TextRenderingMode[TextRenderingMode["Clip"] = 7] = "Clip"; +})(TextRenderingMode = exports.TextRenderingMode || (exports.TextRenderingMode = {})); +exports.setTextRenderingMode = function (mode) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetTextRenderingMode, [objects_1.asPDFNumber(mode)]); +}; +exports.setTextMatrix = function (a, b, c, d, e, f) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.SetTextMatrix, [ + objects_1.asPDFNumber(a), + objects_1.asPDFNumber(b), + objects_1.asPDFNumber(c), + objects_1.asPDFNumber(d), + objects_1.asPDFNumber(e), + objects_1.asPDFNumber(f), + ]); +}; +exports.rotateAndSkewTextRadiansAndTranslate = function (rotationAngle, xSkewAngle, ySkewAngle, x, y) { + return exports.setTextMatrix(cos(objects_1.asNumber(rotationAngle)), sin(objects_1.asNumber(rotationAngle)) + tan(objects_1.asNumber(xSkewAngle)), -sin(objects_1.asNumber(rotationAngle)) + tan(objects_1.asNumber(ySkewAngle)), cos(objects_1.asNumber(rotationAngle)), x, y); +}; +exports.rotateAndSkewTextDegreesAndTranslate = function (rotationAngle, xSkewAngle, ySkewAngle, x, y) { + return exports.rotateAndSkewTextRadiansAndTranslate(rotations_1.degreesToRadians(objects_1.asNumber(rotationAngle)), rotations_1.degreesToRadians(objects_1.asNumber(xSkewAngle)), rotations_1.degreesToRadians(objects_1.asNumber(ySkewAngle)), x, y); +}; +/* ==================== XObject Operator ==================== */ +exports.drawObject = function (name) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.DrawObject, [objects_1.asPDFName(name)]); +}; +/* ==================== Color Operators ==================== */ +exports.setFillingGrayscaleColor = function (gray) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.NonStrokingColorGray, [objects_1.asPDFNumber(gray)]); +}; +exports.setStrokingGrayscaleColor = function (gray) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.StrokingColorGray, [objects_1.asPDFNumber(gray)]); +}; +exports.setFillingRgbColor = function (red, green, blue) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.NonStrokingColorRgb, [ + objects_1.asPDFNumber(red), + objects_1.asPDFNumber(green), + objects_1.asPDFNumber(blue), + ]); +}; +exports.setStrokingRgbColor = function (red, green, blue) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.StrokingColorRgb, [ + objects_1.asPDFNumber(red), + objects_1.asPDFNumber(green), + objects_1.asPDFNumber(blue), + ]); +}; +exports.setFillingCmykColor = function (cyan, magenta, yellow, key) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.NonStrokingColorCmyk, [ + objects_1.asPDFNumber(cyan), + objects_1.asPDFNumber(magenta), + objects_1.asPDFNumber(yellow), + objects_1.asPDFNumber(key), + ]); +}; +exports.setStrokingCmykColor = function (cyan, magenta, yellow, key) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.StrokingColorCmyk, [ + objects_1.asPDFNumber(cyan), + objects_1.asPDFNumber(magenta), + objects_1.asPDFNumber(yellow), + objects_1.asPDFNumber(key), + ]); +}; +/* ==================== Marked Content Operators ==================== */ +exports.beginMarkedContent = function (tag) { + return core_1.PDFOperator.of(core_1.PDFOperatorNames.BeginMarkedContent, [objects_1.asPDFName(tag)]); +}; +exports.endMarkedContent = function () { return core_1.PDFOperator.of(core_1.PDFOperatorNames.EndMarkedContent); }; +//# sourceMappingURL=operators.js.map \ No newline at end of file diff --git a/cjs/api/operators.js.map b/cjs/api/operators.js.map new file mode 100644 index 000000000..e729f4c47 --- /dev/null +++ b/cjs/api/operators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/api/operators.ts"],"names":[],"mappings":";;;AAAA,qCAAmE;AACnE,yCAAqD;AACrD,gCAMkB;AAElB,uEAAuE;AAE1D,QAAA,IAAI,GAAG,cAAM,OAAA,kBAAW,CAAC,EAAE,CAAC,uBAAG,CAAC,WAAW,CAAC,EAA/B,CAA+B,CAAC;AAC7C,QAAA,WAAW,GAAG,cAAM,OAAA,kBAAW,CAAC,EAAE,CAAC,uBAAG,CAAC,WAAW,CAAC,EAA/B,CAA+B,CAAC;AAEjE,wEAAwE;AAEhE,IAAA,GAAG,GAAe,IAAI,IAAnB,EAAE,GAAG,GAAU,IAAI,IAAd,EAAE,GAAG,GAAK,IAAI,IAAT,CAAU;AAElB,QAAA,0BAA0B,GAAG,UACxC,CAAqB,EACrB,CAAqB,EACrB,CAAqB,EACrB,CAAqB,EACrB,CAAqB,EACrB,CAAqB;IAErB,OAAA,kBAAW,CAAC,EAAE,CAAC,uBAAG,CAAC,0BAA0B,EAAE;QAC7C,qBAAW,CAAC,CAAC,CAAC;QACd,qBAAW,CAAC,CAAC,CAAC;QACd,qBAAW,CAAC,CAAC,CAAC;QACd,qBAAW,CAAC,CAAC,CAAC;QACd,qBAAW,CAAC,CAAC,CAAC;QACd,qBAAW,CAAC,CAAC,CAAC;KACf,CAAC;AAPF,CAOE,CAAC;AAEQ,QAAA,SAAS,GAAG,UAAC,IAAwB,EAAE,IAAwB;IAC1E,OAAA,kCAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;AAAlD,CAAkD,CAAC;AAExC,QAAA,KAAK,GAAG,UAAC,IAAwB,EAAE,IAAwB;IACtE,OAAA,kCAA0B,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AAAlD,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BAAgB,GAAG,cAAM,OAAA,kBAAW,CAAC,EAAE,CAAC,uBAAG,CAAC,gBAAgB,CAAC,EAApC,CAAoC,CAAC"} \ No newline at end of file diff --git a/cjs/api/rotations.d.ts b/cjs/api/rotations.d.ts new file mode 100644 index 000000000..fdc4b9657 --- /dev/null +++ b/cjs/api/rotations.d.ts @@ -0,0 +1,39 @@ +export declare enum RotationTypes { + Degrees = "degrees", + Radians = "radians" +} +export interface Radians { + type: RotationTypes.Radians; + angle: number; +} +export interface Degrees { + type: RotationTypes.Degrees; + angle: number; +} +export declare type Rotation = Radians | Degrees; +export declare const radians: (radianAngle: number) => Radians; +export declare const degrees: (degreeAngle: number) => Degrees; +export declare const degreesToRadians: (degree: number) => number; +export declare const radiansToDegrees: (radian: number) => number; +export declare const toRadians: (rotation: Rotation) => number; +export declare const toDegrees: (rotation: Rotation) => number; +export declare const reduceRotation: (degreeAngle?: number) => 0 | 180 | 90 | 270; +export declare const adjustDimsForRotation: (dims: { + width: number; + height: number; +}, degreeAngle?: number) => { + width: number; + height: number; +}; +export declare const rotateRectangle: (rectangle: { + x: number; + y: number; + width: number; + height: number; +}, borderWidth?: number, degreeAngle?: number) => { + x: number; + y: number; + width: number; + height: number; +}; +//# sourceMappingURL=rotations.d.ts.map \ No newline at end of file diff --git a/cjs/api/rotations.d.ts.map b/cjs/api/rotations.d.ts.map new file mode 100644 index 000000000..d0b67e8d4 --- /dev/null +++ b/cjs/api/rotations.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rotations.d.ts","sourceRoot":"","sources":["../../src/api/rotations.ts"],"names":[],"mappings":"AAEA,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzC,eAAO,MAAM,OAAO,gBAAiB,MAAM,YAG1C,CAAC;AAEF,eAAO,MAAM,OAAO,gBAAiB,MAAM,YAG1C,CAAC;AAIF,eAAO,MAAM,gBAAgB,WAAY,MAAM,WAA6B,CAAC;AAC7E,eAAO,MAAM,gBAAgB,WAAY,MAAM,WAA6B,CAAC;AAG7E,eAAO,MAAM,SAAS,aAAc,QAAQ,WAGc,CAAC;AAG3D,eAAO,MAAM,SAAS,aAAc,QAAQ,WAGc,CAAC;AAE3D,eAAO,MAAM,cAAc,8CAO1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAC1B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;;;CAOxC,CAAC;AAEF,eAAO,MAAM,eAAe;OAErB,MAAM;OACN,MAAM;WACF,MAAM;YACL,MAAM;;;;;;CAgBjB,CAAC"} \ No newline at end of file diff --git a/cjs/api/rotations.js b/cjs/api/rotations.js new file mode 100644 index 000000000..076308677 --- /dev/null +++ b/cjs/api/rotations.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.rotateRectangle = exports.adjustDimsForRotation = exports.reduceRotation = exports.toDegrees = exports.toRadians = exports.radiansToDegrees = exports.degreesToRadians = exports.degrees = exports.radians = exports.RotationTypes = void 0; +var utils_1 = require("../utils"); +var RotationTypes; +(function (RotationTypes) { + RotationTypes["Degrees"] = "degrees"; + RotationTypes["Radians"] = "radians"; +})(RotationTypes = exports.RotationTypes || (exports.RotationTypes = {})); +exports.radians = function (radianAngle) { + utils_1.assertIs(radianAngle, 'radianAngle', ['number']); + return { type: RotationTypes.Radians, angle: radianAngle }; +}; +exports.degrees = function (degreeAngle) { + utils_1.assertIs(degreeAngle, 'degreeAngle', ['number']); + return { type: RotationTypes.Degrees, angle: degreeAngle }; +}; +var Radians = RotationTypes.Radians, Degrees = RotationTypes.Degrees; +exports.degreesToRadians = function (degree) { return (degree * Math.PI) / 180; }; +exports.radiansToDegrees = function (radian) { return (radian * 180) / Math.PI; }; +// prettier-ignore +exports.toRadians = function (rotation) { + return rotation.type === Radians ? rotation.angle + : rotation.type === Degrees ? exports.degreesToRadians(rotation.angle) + : utils_1.error("Invalid rotation: " + JSON.stringify(rotation)); +}; +// prettier-ignore +exports.toDegrees = function (rotation) { + return rotation.type === Radians ? exports.radiansToDegrees(rotation.angle) + : rotation.type === Degrees ? rotation.angle + : utils_1.error("Invalid rotation: " + JSON.stringify(rotation)); +}; +exports.reduceRotation = function (degreeAngle) { + if (degreeAngle === void 0) { degreeAngle = 0; } + var quadrants = (degreeAngle / 90) % 4; + if (quadrants === 0) + return 0; + if (quadrants === 1) + return 90; + if (quadrants === 2) + return 180; + if (quadrants === 3) + return 270; + return 0; // `degreeAngle` is not a multiple of 90 +}; +exports.adjustDimsForRotation = function (dims, degreeAngle) { + if (degreeAngle === void 0) { degreeAngle = 0; } + var rotation = exports.reduceRotation(degreeAngle); + return rotation === 90 || rotation === 270 + ? { width: dims.height, height: dims.width } + : { width: dims.width, height: dims.height }; +}; +exports.rotateRectangle = function (rectangle, borderWidth, degreeAngle) { + if (borderWidth === void 0) { borderWidth = 0; } + if (degreeAngle === void 0) { degreeAngle = 0; } + var x = rectangle.x, y = rectangle.y, w = rectangle.width, h = rectangle.height; + var r = exports.reduceRotation(degreeAngle); + var b = borderWidth / 2; + // prettier-ignore + if (r === 0) + return { x: x - b, y: y - b, width: w, height: h }; + else if (r === 90) + return { x: x - h + b, y: y - b, width: h, height: w }; + else if (r === 180) + return { x: x - w + b, y: y - h + b, width: w, height: h }; + else if (r === 270) + return { x: x - b, y: y - w + b, width: h, height: w }; + else + return { x: x - b, y: y - b, width: w, height: h }; +}; +//# sourceMappingURL=rotations.js.map \ No newline at end of file diff --git a/cjs/api/rotations.js.map b/cjs/api/rotations.js.map new file mode 100644 index 000000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C,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAC1D,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/api/sizes.d.ts b/cjs/api/sizes.d.ts new file mode 100644 index 000000000..fbab81137 --- /dev/null +++ b/cjs/api/sizes.d.ts @@ -0,0 +1,53 @@ +export declare const PageSizes: { + '4A0': [number, number]; + '2A0': [number, number]; + A0: [number, number]; + A1: [number, number]; + A2: [number, number]; + A3: [number, number]; + A4: [number, number]; + A5: [number, number]; + A6: [number, number]; + A7: [number, number]; + A8: [number, number]; + A9: [number, number]; + A10: [number, number]; + B0: [number, number]; + B1: [number, number]; + B2: [number, number]; + B3: [number, number]; + B4: [number, number]; + B5: [number, number]; + B6: [number, number]; + B7: [number, number]; + B8: [number, number]; + B9: [number, number]; + B10: [number, number]; + C0: [number, number]; + C1: [number, number]; + C2: [number, number]; + C3: [number, number]; + C4: [number, number]; + C5: [number, number]; + C6: [number, number]; + C7: [number, number]; + C8: [number, number]; + C9: [number, number]; + C10: [number, number]; + RA0: [number, number]; + RA1: [number, number]; + RA2: [number, number]; + RA3: [number, number]; + RA4: [number, number]; + SRA0: [number, number]; + SRA1: [number, number]; + SRA2: [number, number]; + SRA3: [number, number]; + SRA4: [number, number]; + Executive: [number, number]; + Folio: [number, number]; + Legal: [number, number]; + Letter: [number, number]; + Tabloid: [number, number]; +}; +//# sourceMappingURL=sizes.d.ts.map \ No newline at end of file diff --git a/cjs/api/sizes.d.ts.map b/cjs/api/sizes.d.ts.map new file mode 100644 index 000000000..b7be5a7ea --- /dev/null +++ b/cjs/api/sizes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../src/api/sizes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDrB,CAAC"} \ No newline at end of file diff --git a/cjs/api/sizes.js b/cjs/api/sizes.js new file mode 100644 index 000000000..6e3c274c9 --- /dev/null +++ b/cjs/api/sizes.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageSizes = void 0; +exports.PageSizes = { + '4A0': [4767.87, 6740.79], + '2A0': [3370.39, 4767.87], + A0: [2383.94, 3370.39], + A1: [1683.78, 2383.94], + A2: [1190.55, 1683.78], + A3: [841.89, 1190.55], + A4: [595.28, 841.89], + A5: [419.53, 595.28], + A6: [297.64, 419.53], + A7: [209.76, 297.64], + A8: [147.4, 209.76], + A9: [104.88, 147.4], + A10: [73.7, 104.88], + B0: [2834.65, 4008.19], + B1: [2004.09, 2834.65], + B2: [1417.32, 2004.09], + B3: [1000.63, 1417.32], + B4: [708.66, 1000.63], + B5: [498.9, 708.66], + B6: [354.33, 498.9], + B7: [249.45, 354.33], + B8: [175.75, 249.45], + B9: [124.72, 175.75], + B10: [87.87, 124.72], + C0: [2599.37, 3676.54], + C1: [1836.85, 2599.37], + C2: [1298.27, 1836.85], + C3: [918.43, 1298.27], + C4: [649.13, 918.43], + C5: [459.21, 649.13], + C6: [323.15, 459.21], + C7: [229.61, 323.15], + C8: [161.57, 229.61], + C9: [113.39, 161.57], + C10: [79.37, 113.39], + RA0: [2437.8, 3458.27], + RA1: [1729.13, 2437.8], + RA2: [1218.9, 1729.13], + RA3: [864.57, 1218.9], + RA4: [609.45, 864.57], + SRA0: [2551.18, 3628.35], + SRA1: [1814.17, 2551.18], + SRA2: [1275.59, 1814.17], + SRA3: [907.09, 1275.59], + SRA4: [637.8, 907.09], + Executive: [521.86, 756.0], + Folio: [612.0, 936.0], + Legal: [612.0, 1008.0], + Letter: [612.0, 792.0], + Tabloid: [792.0, 1224.0], +}; +//# sourceMappingURL=sizes.js.map \ No newline at end of file diff --git a/cjs/api/sizes.js.map b/cjs/api/sizes.js.map new file mode 100644 index 000000000..42260e9d4 --- /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,KAAK,CAAqB;IACzC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,CAAqB;IAC1C,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAqB;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAqB;CAC7C,CAAC"} \ No newline at end of file diff --git a/cjs/api/svgPath.d.ts b/cjs/api/svgPath.d.ts new file mode 100644 index 000000000..5fc6c4ee4 --- /dev/null +++ b/cjs/api/svgPath.d.ts @@ -0,0 +1,3 @@ +import { PDFOperator } from "../core"; +export declare const svgPathToOperators: (path: string) => PDFOperator[]; +//# sourceMappingURL=svgPath.d.ts.map \ No newline at end of file diff --git a/cjs/api/svgPath.d.ts.map b/cjs/api/svgPath.d.ts.map new file mode 100644 index 000000000..0a333684d --- /dev/null +++ b/cjs/api/svgPath.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"svgPath.d.ts","sourceRoot":"","sources":["../../src/api/svgPath.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,gBAAiB;AA4dvC,eAAO,MAAM,kBAAkB,SAAU,MAAM,kBAAuB,CAAC"} \ No newline at end of file diff --git a/cjs/api/svgPath.js b/cjs/api/svgPath.js new file mode 100644 index 000000000..1354e06fd --- /dev/null +++ b/cjs/api/svgPath.js @@ -0,0 +1,380 @@ +"use strict"; +// Originated from pdfkit Copyright (c) 2014 Devon Govett +// https://github.com/foliojs/pdfkit/blob/1e62e6ffe24b378eb890df507a47610f4c4a7b24/lib/path.js +// MIT LICENSE +// Updated for pdf-lib & TypeScript by Jeremy Messenger +Object.defineProperty(exports, "__esModule", { value: true }); +exports.svgPathToOperators = void 0; +var operators_1 = require("./operators"); +var cx = 0; +var cy = 0; +var px = 0; +var py = 0; +var sx = 0; +var sy = 0; +var parameters = new Map([ + ['A', 7], + ['a', 7], + ['C', 6], + ['c', 6], + ['H', 1], + ['h', 1], + ['L', 2], + ['l', 2], + ['M', 2], + ['m', 2], + ['Q', 4], + ['q', 4], + ['S', 4], + ['s', 4], + ['T', 2], + ['t', 2], + ['V', 1], + ['v', 1], + ['Z', 0], + ['z', 0], +]); +var parse = function (path) { + var cmd; + var ret = []; + var args = []; + var curArg = ''; + var foundDecimal = false; + var params = 0; + for (var _i = 0, path_1 = path; _i < path_1.length; _i++) { + var c = path_1[_i]; + if (parameters.has(c)) { + params = parameters.get(c); + if (cmd) { + // save existing command + if (curArg.length > 0) { + args[args.length] = +curArg; + } + ret[ret.length] = { cmd: cmd, args: args }; + args = []; + curArg = ''; + foundDecimal = false; + } + cmd = c; + } + else if ([' ', ','].includes(c) || + (c === '-' && curArg.length > 0 && curArg[curArg.length - 1] !== 'e') || + (c === '.' && foundDecimal)) { + if (curArg.length === 0) { + continue; + } + if (args.length === params) { + // handle reused commands + ret[ret.length] = { cmd: cmd, args: args }; + args = [+curArg]; + // handle assumed commands + if (cmd === 'M') { + cmd = 'L'; + } + if (cmd === 'm') { + cmd = 'l'; + } + } + else { + args[args.length] = +curArg; + } + foundDecimal = c === '.'; + // fix for negative numbers or repeated decimals with no delimeter between commands + curArg = ['-', '.'].includes(c) ? c : ''; + } + else { + curArg += c; + if (c === '.') { + foundDecimal = true; + } + } + } + // add the last command + if (curArg.length > 0) { + if (args.length === params) { + // handle reused commands + ret[ret.length] = { cmd: cmd, args: args }; + args = [+curArg]; + // handle assumed commands + if (cmd === 'M') { + cmd = 'L'; + } + if (cmd === 'm') { + cmd = 'l'; + } + } + else { + args[args.length] = +curArg; + } + } + ret[ret.length] = { cmd: cmd, args: args }; + return ret; +}; +var apply = function (commands) { + // current point, control point, and subpath starting point + cx = cy = px = py = sx = sy = 0; + // run the commands + var cmds = []; + for (var i = 0; i < commands.length; i++) { + var c = commands[i]; + if (c.cmd && typeof runners[c.cmd] === 'function') { + var cmd = runners[c.cmd](c.args); + if (Array.isArray(cmd)) { + cmds = cmds.concat(cmd); + } + else { + cmds.push(cmd); + } + } + } + return cmds; +}; +var runners = { + M: function (a) { + cx = a[0]; + cy = a[1]; + px = py = null; + sx = cx; + sy = cy; + return operators_1.moveTo(cx, cy); + }, + m: function (a) { + cx += a[0]; + cy += a[1]; + px = py = null; + sx = cx; + sy = cy; + return operators_1.moveTo(cx, cy); + }, + C: function (a) { + cx = a[4]; + cy = a[5]; + px = a[2]; + py = a[3]; + return operators_1.appendBezierCurve(a[0], a[1], a[2], a[3], a[4], a[5]); + }, + c: function (a) { + var cmd = operators_1.appendBezierCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy, a[4] + cx, a[5] + cy); + px = cx + a[2]; + py = cy + a[3]; + cx += a[4]; + cy += a[5]; + return cmd; + }, + S: function (a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + var cmd = operators_1.appendBezierCurve(cx - (px - cx), cy - (py - cy), a[0], a[1], a[2], a[3]); + px = a[0]; + py = a[1]; + cx = a[2]; + cy = a[3]; + return cmd; + }, + s: function (a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + var cmd = operators_1.appendBezierCurve(cx - (px - cx), cy - (py - cy), cx + a[0], cy + a[1], cx + a[2], cy + a[3]); + px = cx + a[0]; + py = cy + a[1]; + cx += a[2]; + cy += a[3]; + return cmd; + }, + Q: function (a) { + px = a[0]; + py = a[1]; + cx = a[2]; + cy = a[3]; + return operators_1.appendQuadraticCurve(a[0], a[1], cx, cy); + }, + q: function (a) { + var cmd = operators_1.appendQuadraticCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy); + px = cx + a[0]; + py = cy + a[1]; + cx += a[2]; + cy += a[3]; + return cmd; + }, + T: function (a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + else { + px = cx - (px - cx); + py = cy - (py - cy); + } + var cmd = operators_1.appendQuadraticCurve(px, py, a[0], a[1]); + px = cx - (px - cx); + py = cy - (py - cy); + cx = a[0]; + cy = a[1]; + return cmd; + }, + t: function (a) { + if (px === null || py === null) { + px = cx; + py = cy; + } + else { + px = cx - (px - cx); + py = cy - (py - cy); + } + var cmd = operators_1.appendQuadraticCurve(px, py, cx + a[0], cy + a[1]); + cx += a[0]; + cy += a[1]; + return cmd; + }, + A: function (a) { + var cmds = solveArc(cx, cy, a); + cx = a[5]; + cy = a[6]; + return cmds; + }, + a: function (a) { + a[5] += cx; + a[6] += cy; + var cmds = solveArc(cx, cy, a); + cx = a[5]; + cy = a[6]; + return cmds; + }, + L: function (a) { + cx = a[0]; + cy = a[1]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + l: function (a) { + cx += a[0]; + cy += a[1]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + H: function (a) { + cx = a[0]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + h: function (a) { + cx += a[0]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + V: function (a) { + cy = a[0]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + v: function (a) { + cy += a[0]; + px = py = null; + return operators_1.lineTo(cx, cy); + }, + Z: function () { + var cmd = operators_1.closePath(); + cx = sx; + cy = sy; + return cmd; + }, + z: function () { + var cmd = operators_1.closePath(); + cx = sx; + cy = sy; + return cmd; + }, +}; +var solveArc = function (x, y, coords) { + var rx = coords[0], ry = coords[1], rot = coords[2], large = coords[3], sweep = coords[4], ex = coords[5], ey = coords[6]; + var segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y); + var cmds = []; + for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { + var seg = segs_1[_i]; + var bez = segmentToBezier.apply(void 0, seg); + cmds.push(operators_1.appendBezierCurve.apply(void 0, bez)); + } + return cmds; +}; +// from Inkscape svgtopdf, thanks! +var arcToSegments = function (x, y, rx, ry, large, sweep, rotateX, ox, oy) { + var th = rotateX * (Math.PI / 180); + var sinTh = Math.sin(th); + var cosTh = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + px = cosTh * (ox - x) * 0.5 + sinTh * (oy - y) * 0.5; + py = cosTh * (oy - y) * 0.5 - sinTh * (ox - x) * 0.5; + var pl = (px * px) / (rx * rx) + (py * py) / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; + } + var a00 = cosTh / rx; + var a01 = sinTh / rx; + var a10 = -sinTh / ry; + var a11 = cosTh / ry; + var x0 = a00 * ox + a01 * oy; + var y0 = a10 * ox + a11 * oy; + var x1 = a00 * x + a01 * y; + var y1 = a10 * x + a11 * y; + var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); + var sfactorSq = 1 / d - 0.25; + if (sfactorSq < 0) { + sfactorSq = 0; + } + var sfactor = Math.sqrt(sfactorSq); + if (sweep === large) { + sfactor = -sfactor; + } + var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); + var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); + var th0 = Math.atan2(y0 - yc, x0 - xc); + var th1 = Math.atan2(y1 - yc, x1 - xc); + var thArc = th1 - th0; + if (thArc < 0 && sweep === 1) { + thArc += 2 * Math.PI; + } + else if (thArc > 0 && sweep === 0) { + thArc -= 2 * Math.PI; + } + var segments = Math.ceil(Math.abs(thArc / (Math.PI * 0.5 + 0.001))); + var result = []; + for (var i = 0; i < segments; i++) { + var th2 = th0 + (i * thArc) / segments; + var th3 = th0 + ((i + 1) * thArc) / segments; + result[i] = [xc, yc, th2, th3, rx, ry, sinTh, cosTh]; + } + return result; +}; +var segmentToBezier = function (cx1, cy1, th0, th1, rx, ry, sinTh, cosTh) { + var a00 = cosTh * rx; + var a01 = -sinTh * ry; + var a10 = sinTh * rx; + var a11 = cosTh * ry; + var thHalf = 0.5 * (th1 - th0); + var t = ((8 / 3) * Math.sin(thHalf * 0.5) * Math.sin(thHalf * 0.5)) / + Math.sin(thHalf); + var x1 = cx1 + Math.cos(th0) - t * Math.sin(th0); + var y1 = cy1 + Math.sin(th0) + t * Math.cos(th0); + var x3 = cx1 + Math.cos(th1); + var y3 = cy1 + Math.sin(th1); + var x2 = x3 + t * Math.sin(th1); + var y2 = y3 - t * Math.cos(th1); + var result = [ + a00 * x1 + a01 * y1, + a10 * x1 + a11 * y1, + a00 * x2 + a01 * y2, + a10 * x2 + a11 * y2, + a00 * x3 + a01 * y3, + a10 * x3 + a11 * y3, + ]; + return result; +}; +exports.svgPathToOperators = function (path) { return apply(parse(path)); }; +//# sourceMappingURL=svgPath.js.map \ No newline at end of file diff --git a/cjs/api/svgPath.js.map b/cjs/api/svgPath.js.map new file mode 100644 index 000000000..8e39aebfd --- /dev/null +++ b/cjs/api/svgPath.js.map @@ -0,0 +1 @@ +{"version":3,"file":"svgPath.js","sourceRoot":"","sources":["../../src/api/svgPath.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,8FAA8F;AAC9F,cAAc;AACd,uDAAuD;;;AAEvD,yCAM2B;AAG3B,IAAI,EAAE,GAAW,CAAC,CAAC;AACnB,IAAI,EAAE,GAAW,CAAC,CAAC;AACnB,IAAI,EAAE,GAAkB,CAAC,CAAC;AAC1B,IAAI,EAAE,GAAkB,CAAC,CAAC;AAC1B,IAAI,EAAE,GAAW,CAAC,CAAC;AACnB,IAAI,EAAE,GAAW,CAAC,CAAC;AAEnB,IAAM,UAAU,GAAG,IAAI,GAAG,CAAiB;IACzC,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC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G,GAAG,GAAG,EAAE;QACnB,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;QACnB,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;QACnB,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;QACnB,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;KACpB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEW,QAAA,kBAAkB,GAAG,UAAC,IAAY,IAAK,OAAA,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAlB,CAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/api/text/alignment.d.ts b/cjs/api/text/alignment.d.ts new file mode 100644 index 000000000..af5e76ed7 --- /dev/null +++ b/cjs/api/text/alignment.d.ts @@ -0,0 +1,6 @@ +export declare enum TextAlignment { + Left = 0, + Center = 1, + Right = 2 +} +//# sourceMappingURL=alignment.d.ts.map \ No newline at end of file diff --git a/cjs/api/text/alignment.d.ts.map b/cjs/api/text/alignment.d.ts.map new file mode 100644 index 000000000..1747ce35b --- /dev/null +++ b/cjs/api/text/alignment.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"alignment.d.ts","sourceRoot":"","sources":["../../../src/api/text/alignment.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,IAAI;CACV"} \ No newline at end of file diff --git a/cjs/api/text/alignment.js b/cjs/api/text/alignment.js new file mode 100644 index 000000000..f993c5ec3 --- /dev/null +++ b/cjs/api/text/alignment.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TextAlignment = void 0; +var TextAlignment; +(function (TextAlignment) { + TextAlignment[TextAlignment["Left"] = 0] = "Left"; + TextAlignment[TextAlignment["Center"] = 1] = "Center"; + TextAlignment[TextAlignment["Right"] = 2] = "Right"; +})(TextAlignment = exports.TextAlignment || (exports.TextAlignment = {})); +//# sourceMappingURL=alignment.js.map \ No newline at end of file diff --git a/cjs/api/text/alignment.js.map b/cjs/api/text/alignment.js.map new file mode 100644 index 000000000..2568839d2 --- /dev/null +++ b/cjs/api/text/alignment.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alignment.js","sourceRoot":"","sources":["../../../src/api/text/alignment.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iDAAQ,CAAA;IACR,qDAAU,CAAA;IACV,mDAAS,CAAA;AACX,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"} \ No newline at end of file diff --git a/cjs/api/text/index.d.ts b/cjs/api/text/index.d.ts new file mode 100644 index 000000000..0153f0296 --- /dev/null +++ b/cjs/api/text/index.d.ts @@ -0,0 +1,3 @@ +export * from "./alignment"; +export * from "./layout"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/api/text/index.d.ts.map b/cjs/api/text/index.d.ts.map new file mode 100644 index 000000000..422beeadf --- /dev/null +++ b/cjs/api/text/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/text/index.ts"],"names":[],"mappings":"AAAA,cAEuB,aAAa,CAFG;AACvC,cACoC,UAAU,CADV"} \ No newline at end of file diff --git a/cjs/api/text/index.js b/cjs/api/text/index.js new file mode 100644 index 000000000..d3265ad16 --- /dev/null +++ b/cjs/api/text/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./alignment"), exports); +tslib_1.__exportStar(require("./layout"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/api/text/index.js.map b/cjs/api/text/index.js.map new file mode 100644 index 000000000..82fddea3d --- /dev/null +++ b/cjs/api/text/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/text/index.ts"],"names":[],"mappings":";;;AAAA,sDAAuC;AACvC,mDAAoC"} \ No newline at end of file diff --git a/cjs/api/text/layout.d.ts b/cjs/api/text/layout.d.ts new file mode 100644 index 000000000..e65f581f2 --- /dev/null +++ b/cjs/api/text/layout.d.ts @@ -0,0 +1,55 @@ +import PDFFont from "../PDFFont"; +import { TextAlignment } from "./alignment"; +import { PDFHexString } from "../../core"; +export interface TextPosition { + text: string; + encoded: PDFHexString; + x: number; + y: number; + width: number; + height: number; +} +export interface LayoutBounds { + x: number; + y: number; + width: number; + height: number; +} +export interface LayoutTextOptions { + alignment: TextAlignment; + fontSize?: number; + font: PDFFont; + bounds: LayoutBounds; +} +export interface MultilineTextLayout { + bounds: LayoutBounds; + lines: TextPosition[]; + fontSize: number; + lineHeight: number; +} +export declare const layoutMultilineText: (text: string, { alignment, fontSize, font, bounds }: LayoutTextOptions) => MultilineTextLayout; +export interface LayoutCombedTextOptions { + fontSize?: number; + font: PDFFont; + bounds: LayoutBounds; + cellCount: number; +} +export interface CombedTextLayout { + bounds: LayoutBounds; + cells: TextPosition[]; + fontSize: number; +} +export declare const layoutCombedText: (text: string, { fontSize, font, bounds, cellCount }: LayoutCombedTextOptions) => CombedTextLayout; +export interface LayoutSinglelineTextOptions { + alignment: TextAlignment; + fontSize?: number; + font: PDFFont; + bounds: LayoutBounds; +} +export interface SinglelineTextLayout { + bounds: LayoutBounds; + line: TextPosition; + fontSize: number; +} +export declare const layoutSinglelineText: (text: string, { alignment, fontSize, font, bounds }: LayoutSinglelineTextOptions) => SinglelineTextLayout; +//# sourceMappingURL=layout.d.ts.map \ No newline at end of file diff --git a/cjs/api/text/layout.d.ts.map b/cjs/api/text/layout.d.ts.map new file mode 100644 index 000000000..a4fb65879 --- /dev/null +++ b/cjs/api/text/layout.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/api/text/layout.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,mBAAwB;AAEtC,O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AAa,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,SACzB,MAAM,yCAC2B,2BAA2B,KACjE,oBA0BF,CAAC"} \ No newline at end of file diff --git a/cjs/api/text/layout.js b/cjs/api/text/layout.js new file mode 100644 index 000000000..a0ffd1e5d --- /dev/null +++ b/cjs/api/text/layout.js @@ -0,0 +1,212 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.layoutSinglelineText = exports.layoutCombedText = exports.layoutMultilineText = void 0; +var errors_1 = require("../errors"); +var alignment_1 = require("./alignment"); +var utils_1 = require("../../utils"); +var MIN_FONT_SIZE = 4; +var MAX_FONT_SIZE = 500; +var computeFontSize = function (lines, font, bounds, multiline) { + if (multiline === void 0) { multiline = false; } + var fontSize = MIN_FONT_SIZE; + while (fontSize < MAX_FONT_SIZE) { + var linesUsed = 0; + for (var lineIdx = 0, lineLen = lines.length; lineIdx < lineLen; lineIdx++) { + linesUsed += 1; + var line = lines[lineIdx]; + var words = line.split(' '); + // Layout the words using the current `fontSize`, line wrapping + // whenever we reach the end of the current line. + var spaceInLineRemaining = bounds.width; + for (var idx = 0, len = words.length; idx < len; idx++) { + var isLastWord = idx === len - 1; + var word = isLastWord ? words[idx] : words[idx] + ' '; + var widthOfWord = font.widthOfTextAtSize(word, fontSize); + spaceInLineRemaining -= widthOfWord; + if (spaceInLineRemaining <= 0) { + linesUsed += 1; + spaceInLineRemaining = bounds.width - widthOfWord; + } + } + } + // Return if we exceeded the allowed width + if (!multiline && linesUsed > lines.length) + return fontSize - 1; + var height = font.heightAtSize(fontSize); + var lineHeight = height + height * 0.2; + var totalHeight = lineHeight * linesUsed; + // Return if we exceeded the allowed height + if (totalHeight > Math.abs(bounds.height)) + return fontSize - 1; + fontSize += 1; + } + return fontSize; +}; +var computeCombedFontSize = function (line, font, bounds, cellCount) { + var cellWidth = bounds.width / cellCount; + var cellHeight = bounds.height; + var fontSize = MIN_FONT_SIZE; + var chars = utils_1.charSplit(line); + while (fontSize < MAX_FONT_SIZE) { + for (var idx = 0, len = chars.length; idx < len; idx++) { + var c = chars[idx]; + var tooLong = font.widthOfTextAtSize(c, fontSize) > cellWidth * 0.75; + if (tooLong) + return fontSize - 1; + } + var height = font.heightAtSize(fontSize, { descender: false }); + if (height > cellHeight) + return fontSize - 1; + fontSize += 1; + } + return fontSize; +}; +var lastIndexOfWhitespace = function (line) { + for (var idx = line.length; idx > 0; idx--) { + if (/\s/.test(line[idx])) + return idx; + } + return undefined; +}; +var splitOutLines = function (input, maxWidth, font, fontSize) { + var _a; + var lastWhitespaceIdx = input.length; + while (lastWhitespaceIdx > 0) { + var line = input.substring(0, lastWhitespaceIdx); + var encoded = font.encodeText(line); + var width = font.widthOfTextAtSize(line, fontSize); + if (width < maxWidth) { + var remainder = input.substring(lastWhitespaceIdx) || undefined; + return { line: line, encoded: encoded, width: width, remainder: remainder }; + } + lastWhitespaceIdx = (_a = lastIndexOfWhitespace(line)) !== null && _a !== void 0 ? _a : 0; + } + // We were unable to split the input enough to get a chunk that would fit + // within the specified `maxWidth` so we'll just return everything + return { + line: input, + encoded: font.encodeText(input), + width: font.widthOfTextAtSize(input, fontSize), + remainder: undefined, + }; +}; +exports.layoutMultilineText = function (text, _a) { + var alignment = _a.alignment, fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds; + var lines = utils_1.lineSplit(utils_1.cleanText(text)); + if (fontSize === undefined || fontSize === 0) { + fontSize = computeFontSize(lines, font, bounds, true); + } + var height = font.heightAtSize(fontSize); + var lineHeight = height + height * 0.2; + var textLines = []; + var minX = bounds.x; + var minY = bounds.y; + var maxX = bounds.x + bounds.width; + var maxY = bounds.y + bounds.height; + var y = bounds.y + bounds.height; + for (var idx = 0, len = lines.length; idx < len; idx++) { + var prevRemainder = lines[idx]; + while (prevRemainder !== undefined) { + var _b = splitOutLines(prevRemainder, bounds.width, font, fontSize), line = _b.line, encoded = _b.encoded, width = _b.width, remainder = _b.remainder; + // prettier-ignore + var x = (alignment === alignment_1.TextAlignment.Left ? bounds.x + : alignment === alignment_1.TextAlignment.Center ? bounds.x + (bounds.width / 2) - (width / 2) + : alignment === alignment_1.TextAlignment.Right ? bounds.x + bounds.width - width + : bounds.x); + y -= lineHeight; + if (x < minX) + minX = x; + if (y < minY) + minY = y; + if (x + width > maxX) + maxX = x + width; + if (y + height > maxY) + maxY = y + height; + textLines.push({ text: line, encoded: encoded, width: width, height: height, x: x, y: y }); + // Only trim lines that we had to split ourselves. So we won't trim lines + // that the user provided themselves with whitespace. + prevRemainder = remainder === null || remainder === void 0 ? void 0 : remainder.trim(); + } + } + return { + fontSize: fontSize, + lineHeight: lineHeight, + lines: textLines, + bounds: { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY, + }, + }; +}; +exports.layoutCombedText = function (text, _a) { + var fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds, cellCount = _a.cellCount; + var line = utils_1.mergeLines(utils_1.cleanText(text)); + if (line.length > cellCount) { + throw new errors_1.CombedTextLayoutError(line.length, cellCount); + } + if (fontSize === undefined || fontSize === 0) { + fontSize = computeCombedFontSize(line, font, bounds, cellCount); + } + var cellWidth = bounds.width / cellCount; + var height = font.heightAtSize(fontSize, { descender: false }); + var y = bounds.y + (bounds.height / 2 - height / 2); + var cells = []; + var minX = bounds.x; + var minY = bounds.y; + var maxX = bounds.x + bounds.width; + var maxY = bounds.y + bounds.height; + var cellOffset = 0; + var charOffset = 0; + while (cellOffset < cellCount) { + var _b = utils_1.charAtIndex(line, charOffset), char = _b[0], charLength = _b[1]; + var encoded = font.encodeText(char); + var width = font.widthOfTextAtSize(char, fontSize); + var cellCenter = bounds.x + (cellWidth * cellOffset + cellWidth / 2); + var x = cellCenter - width / 2; + if (x < minX) + minX = x; + if (y < minY) + minY = y; + if (x + width > maxX) + maxX = x + width; + if (y + height > maxY) + maxY = y + height; + cells.push({ text: line, encoded: encoded, width: width, height: height, x: x, y: y }); + cellOffset += 1; + charOffset += charLength; + } + return { + fontSize: fontSize, + cells: cells, + bounds: { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY, + }, + }; +}; +exports.layoutSinglelineText = function (text, _a) { + var alignment = _a.alignment, fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds; + var line = utils_1.mergeLines(utils_1.cleanText(text)); + if (fontSize === undefined || fontSize === 0) { + fontSize = computeFontSize([line], font, bounds); + } + var encoded = font.encodeText(line); + var width = font.widthOfTextAtSize(line, fontSize); + var height = font.heightAtSize(fontSize, { descender: false }); + // prettier-ignore + var x = (alignment === alignment_1.TextAlignment.Left ? bounds.x + : alignment === alignment_1.TextAlignment.Center ? bounds.x + (bounds.width / 2) - (width / 2) + : alignment === alignment_1.TextAlignment.Right ? bounds.x + bounds.width - width + : bounds.x); + var y = bounds.y + (bounds.height / 2 - height / 2); + return { + fontSize: fontSize, + line: { text: line, encoded: encoded, width: width, height: height, x: x, y: y }, + bounds: { x: x, y: y, width: width, height: height }, + }; +}; +//# sourceMappingURL=layout.js.map \ No newline at end of file diff --git a/cjs/api/text/layout.js.map b/cjs/api/text/layout.js.map new file mode 100644 index 000000000..0196c63c0 --- /dev/null +++ b/cjs/api/text/layout.js.map @@ -0,0 +1 @@ +{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/api/text/layout.ts"],"names":[],"mappings":";;;AACA,oCAAuD;AACvD,yCAAuD;AAGvD,qCAMmB;AAkBnB,IAAM,aAAa,GAAG,CAAC,CAAC;AACxB,IAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,IAAM,eAAe,GAAG,UACtB,KAAe,EACf,IAAa,EACb,MAAoB,EACpB,SAA0B;IAA1B,0BAAA,EAAA,iBAA0B;IAE1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E,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE;KAChC,CAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/PDFContext.d.ts b/cjs/core/PDFContext.d.ts new file mode 100644 index 000000000..a2d726ef9 --- /dev/null +++ b/cjs/core/PDFContext.d.ts @@ -0,0 +1,84 @@ +import PDFHeader from "./document/PDFHeader"; +import PDFArray from "./objects/PDFArray"; +import PDFBool from "./objects/PDFBool"; +import PDFDict from "./objects/PDFDict"; +import PDFHexString from "./objects/PDFHexString"; +import PDFName from "./objects/PDFName"; +import PDFNull from "./objects/PDFNull"; +import PDFNumber from "./objects/PDFNumber"; +import PDFObject from "./objects/PDFObject"; +import PDFRawStream from "./objects/PDFRawStream"; +import PDFRef from "./objects/PDFRef"; +import PDFStream from "./objects/PDFStream"; +import PDFString from "./objects/PDFString"; +import PDFOperator from "./operators/PDFOperator"; +import PDFContentStream from "./structures/PDFContentStream"; +import { SimpleRNG } from "../utils/rng"; +declare type LookupKey = PDFRef | PDFObject | undefined; +interface LiteralObject { + [name: string]: Literal | PDFObject; +} +interface LiteralArray { + [index: number]: Literal | PDFObject; +} +declare type Literal = LiteralObject | LiteralArray | string | number | boolean | null | undefined; +declare class PDFContext { + static create: () => PDFContext; + largestObjectNumber: number; + header: PDFHeader; + trailerInfo: { + Root?: PDFObject; + Encrypt?: PDFObject; + Info?: PDFObject; + ID?: PDFObject; + }; + rng: SimpleRNG; + private readonly indirectObjects; + private pushGraphicsStateContentStreamRef?; + private popGraphicsStateContentStreamRef?; + private constructor(); + assign(ref: PDFRef, object: PDFObject): void; + nextRef(): PDFRef; + register(object: PDFObject): PDFRef; + delete(ref: PDFRef): boolean; + lookupMaybe(ref: LookupKey, type: typeof PDFArray): PDFArray | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFBool): PDFBool | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFDict): PDFDict | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFHexString): PDFHexString | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFName): PDFName | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFNull): typeof PDFNull | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFNumber): PDFNumber | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFStream): PDFStream | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFRef): PDFRef | undefined; + lookupMaybe(ref: LookupKey, type: typeof PDFString): PDFString | undefined; + lookupMaybe(ref: LookupKey, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined; + lookup(ref: LookupKey): PDFObject | undefined; + lookup(ref: LookupKey, type: typeof PDFArray): PDFArray; + lookup(ref: LookupKey, type: typeof PDFBool): PDFBool; + lookup(ref: LookupKey, type: typeof PDFDict): PDFDict; + lookup(ref: LookupKey, type: typeof PDFHexString): PDFHexString; + lookup(ref: LookupKey, type: typeof PDFName): PDFName; + lookup(ref: LookupKey, type: typeof PDFNull): typeof PDFNull; + lookup(ref: LookupKey, type: typeof PDFNumber): PDFNumber; + lookup(ref: LookupKey, type: typeof PDFStream): PDFStream; + lookup(ref: LookupKey, type: typeof PDFRef): PDFRef; + lookup(ref: LookupKey, type: typeof PDFString): PDFString; + lookup(ref: LookupKey, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString; + getObjectRef(pdfObject: PDFObject): PDFRef | undefined; + enumerateIndirectObjects(): [PDFRef, PDFObject][]; + obj(literal: null | undefined): typeof PDFNull; + obj(literal: string): PDFName; + obj(literal: number): PDFNumber; + obj(literal: boolean): PDFBool; + obj(literal: LiteralObject): PDFDict; + obj(literal: LiteralArray): PDFArray; + stream(contents: string | Uint8Array, dict?: LiteralObject): PDFRawStream; + flateStream(contents: string | Uint8Array, dict?: LiteralObject): PDFRawStream; + contentStream(operators: PDFOperator[], dict?: LiteralObject): PDFContentStream; + formXObject(operators: PDFOperator[], dict?: LiteralObject): PDFContentStream; + getPushGraphicsStateContentStream(): PDFRef; + getPopGraphicsStateContentStream(): PDFRef; + addRandomSuffix(prefix: string, suffixLength?: number): string; +} +export default PDFContext; +//# sourceMappingURL=PDFContext.d.ts.map \ No newline at end of file diff --git a/cjs/core/PDFContext.d.ts.map b/cjs/core/PDFContext.d.ts.map new file mode 100644 index 000000000..e117b75ee --- /dev/null +++ b/cjs/core/PDFContext.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFContext.d.ts","sourceRoot":"","sources":["../../src/core/PDFContext.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,6BAAoC;AAEpD,OAAO,QAAQ,2BAAkC;AACjD,OAAO,OAAO,0BAAiC;AAC/C,OAAO,OAAO,0BAAiC;AAC/C,OAAO,YAAY,+BAAsC;AACzD,OAAO,OAAO,0BAAiC;AAC/C,OAAO,OAAO,0BAAiC;AAC/C,OAAO,SAAS,4BAAmC;AACnD,OAAO,SAAS,4BAAmC;AACnD,OAAO,YAAY,+BAAsC;AACzD,OAAO,MAAM,yBAAgC;AAC7C,OAAO,SAAS,4BAAmC;AACnD,OAAO,SAAS,4BAAmC;AACnD,OAAO,WAAW,gCAAuC;AAEzD,OAAO,gBAAgB,sCAA6C;AAEpE,OAAO,EAAE,SAAS,EAAE,qBAAsB;AAE1C,aAAK,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD,UAAU,aAAa;IACrB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACrC;AAED,UAAU,YAAY;IACpB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,aAAK,OAAO,GACR,aAAa,GACb,YAAY,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,CAAC;AAOd,cAAM,UAAU;IACd,MAAM,CAAC,MAAM,mBAA0B;IAEvC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,SAAS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G,EAAE,SAAS,EACd,KAAK,EAAE,OAAO,SAAS,EACvB,KAAK,EAAE,OAAO,YAAY,GACzB,SAAS,GAAG,YAAY;IAmB3B,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;IAYtD,wBAAwB,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;IAMjD,GAAG,CAAC,OAAO,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,OAAO;IAC9C,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAC7B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;IAC/B,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAC9B,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;IACpC,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,QAAQ;IA+BpC,MAAM,CACJ,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,IAAI,GAAE,aAAkB,GACvB,YAAY;IAIf,WAAW,CACT,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,IAAI,GAAE,aAAkB,GACvB,YAAY;IAOf,aAAa,CACX,SAAS,EAAE,WAAW,EAAE,EACxB,IAAI,GAAE,aAAkB,GACvB,gBAAgB;IAInB,WAAW,CACT,SAAS,EAAE,WAAW,EAAE,EACxB,IAAI,GAAE,aAAkB,GACvB,gBAAgB;IAgBnB,iCAAiC,IAAI,MAAM;IAiB3C,gCAAgC,IAAI,MAAM;IAW1C,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,SAAI,GAAG,MAAM;CAG1D;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/PDFContext.js b/cjs/core/PDFContext.js new file mode 100644 index 000000000..c9b09da74 --- /dev/null +++ b/cjs/core/PDFContext.js @@ -0,0 +1,201 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var pako_1 = tslib_1.__importDefault(require("pako")); +var PDFHeader_1 = tslib_1.__importDefault(require("./document/PDFHeader")); +var errors_1 = require("./errors"); +var PDFArray_1 = tslib_1.__importDefault(require("./objects/PDFArray")); +var PDFBool_1 = tslib_1.__importDefault(require("./objects/PDFBool")); +var PDFDict_1 = tslib_1.__importDefault(require("./objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("./objects/PDFName")); +var PDFNull_1 = tslib_1.__importDefault(require("./objects/PDFNull")); +var PDFNumber_1 = tslib_1.__importDefault(require("./objects/PDFNumber")); +var PDFObject_1 = tslib_1.__importDefault(require("./objects/PDFObject")); +var PDFRawStream_1 = tslib_1.__importDefault(require("./objects/PDFRawStream")); +var PDFRef_1 = tslib_1.__importDefault(require("./objects/PDFRef")); +var PDFOperator_1 = tslib_1.__importDefault(require("./operators/PDFOperator")); +var PDFOperatorNames_1 = tslib_1.__importDefault(require("./operators/PDFOperatorNames")); +var PDFContentStream_1 = tslib_1.__importDefault(require("./structures/PDFContentStream")); +var utils_1 = require("../utils"); +var rng_1 = require("../utils/rng"); +var byAscendingObjectNumber = function (_a, _b) { + var a = _a[0]; + var b = _b[0]; + return a.objectNumber - b.objectNumber; +}; +var PDFContext = /** @class */ (function () { + function PDFContext() { + this.largestObjectNumber = 0; + this.header = PDFHeader_1.default.forVersion(1, 7); + this.trailerInfo = {}; + this.indirectObjects = new Map(); + this.rng = rng_1.SimpleRNG.withSeed(1); + } + PDFContext.prototype.assign = function (ref, object) { + this.indirectObjects.set(ref, object); + if (ref.objectNumber > this.largestObjectNumber) { + this.largestObjectNumber = ref.objectNumber; + } + }; + PDFContext.prototype.nextRef = function () { + this.largestObjectNumber += 1; + return PDFRef_1.default.of(this.largestObjectNumber); + }; + PDFContext.prototype.register = function (object) { + var ref = this.nextRef(); + this.assign(ref, object); + return ref; + }; + PDFContext.prototype.delete = function (ref) { + return this.indirectObjects.delete(ref); + }; + PDFContext.prototype.lookupMaybe = function (ref) { + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + // TODO: `preservePDFNull` is for backwards compatibility. Should be + // removed in next breaking API change. + var preservePDFNull = types.includes(PDFNull_1.default); + var result = ref instanceof PDFRef_1.default ? this.indirectObjects.get(ref) : ref; + if (!result || (result === PDFNull_1.default && !preservePDFNull)) + return undefined; + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === PDFNull_1.default) { + if (result === PDFNull_1.default) + return result; + } + else { + if (result instanceof type) + return result; + } + } + throw new errors_1.UnexpectedObjectTypeError(types, result); + }; + PDFContext.prototype.lookup = function (ref) { + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + var result = ref instanceof PDFRef_1.default ? this.indirectObjects.get(ref) : ref; + if (types.length === 0) + return result; + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === PDFNull_1.default) { + if (result === PDFNull_1.default) + return result; + } + else { + if (result instanceof type) + return result; + } + } + throw new errors_1.UnexpectedObjectTypeError(types, result); + }; + PDFContext.prototype.getObjectRef = function (pdfObject) { + var entries = Array.from(this.indirectObjects.entries()); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], ref = _a[0], object = _a[1]; + if (object === pdfObject) { + return ref; + } + } + return undefined; + }; + PDFContext.prototype.enumerateIndirectObjects = function () { + return Array.from(this.indirectObjects.entries()).sort(byAscendingObjectNumber); + }; + PDFContext.prototype.obj = function (literal) { + if (literal instanceof PDFObject_1.default) { + return literal; + } + else if (literal === null || literal === undefined) { + return PDFNull_1.default; + } + else if (typeof literal === 'string') { + return PDFName_1.default.of(literal); + } + else if (typeof literal === 'number') { + return PDFNumber_1.default.of(literal); + } + else if (typeof literal === 'boolean') { + return literal ? PDFBool_1.default.True : PDFBool_1.default.False; + } + else if (Array.isArray(literal)) { + var array = PDFArray_1.default.withContext(this); + for (var idx = 0, len = literal.length; idx < len; idx++) { + array.push(this.obj(literal[idx])); + } + return array; + } + else { + var dict = PDFDict_1.default.withContext(this); + var keys = Object.keys(literal); + for (var idx = 0, len = keys.length; idx < len; idx++) { + var key = keys[idx]; + var value = literal[key]; + if (value !== undefined) + dict.set(PDFName_1.default.of(key), this.obj(value)); + } + return dict; + } + }; + PDFContext.prototype.stream = function (contents, dict) { + if (dict === void 0) { dict = {}; } + return PDFRawStream_1.default.of(this.obj(dict), utils_1.typedArrayFor(contents)); + }; + PDFContext.prototype.flateStream = function (contents, dict) { + if (dict === void 0) { dict = {}; } + return this.stream(pako_1.default.deflate(utils_1.typedArrayFor(contents)), tslib_1.__assign(tslib_1.__assign({}, dict), { Filter: 'FlateDecode' })); + }; + PDFContext.prototype.contentStream = function (operators, dict) { + if (dict === void 0) { dict = {}; } + return PDFContentStream_1.default.of(this.obj(dict), operators); + }; + PDFContext.prototype.formXObject = function (operators, dict) { + if (dict === void 0) { dict = {}; } + return this.contentStream(operators, tslib_1.__assign(tslib_1.__assign({ BBox: this.obj([0, 0, 0, 0]), Matrix: this.obj([1, 0, 0, 1, 0, 0]) }, dict), { Type: 'XObject', Subtype: 'Form' })); + }; + /* + * Reference to PDFContentStream that contains a single PDFOperator: `q`. + * Used by [[PDFPageLeaf]] instances to ensure that when content streams are + * added to a modified PDF, they start in the default, unchanged graphics + * state. + */ + PDFContext.prototype.getPushGraphicsStateContentStream = function () { + if (this.pushGraphicsStateContentStreamRef) { + return this.pushGraphicsStateContentStreamRef; + } + var dict = this.obj({}); + var op = PDFOperator_1.default.of(PDFOperatorNames_1.default.PushGraphicsState); + var stream = PDFContentStream_1.default.of(dict, [op]); + this.pushGraphicsStateContentStreamRef = this.register(stream); + return this.pushGraphicsStateContentStreamRef; + }; + /* + * Reference to PDFContentStream that contains a single PDFOperator: `Q`. + * Used by [[PDFPageLeaf]] instances to ensure that when content streams are + * added to a modified PDF, they start in the default, unchanged graphics + * state. + */ + PDFContext.prototype.getPopGraphicsStateContentStream = function () { + if (this.popGraphicsStateContentStreamRef) { + return this.popGraphicsStateContentStreamRef; + } + var dict = this.obj({}); + var op = PDFOperator_1.default.of(PDFOperatorNames_1.default.PopGraphicsState); + var stream = PDFContentStream_1.default.of(dict, [op]); + this.popGraphicsStateContentStreamRef = this.register(stream); + return this.popGraphicsStateContentStreamRef; + }; + PDFContext.prototype.addRandomSuffix = function (prefix, suffixLength) { + if (suffixLength === void 0) { suffixLength = 4; } + return prefix + "-" + Math.floor(this.rng.nextInt() * Math.pow(10, suffixLength)); + }; + PDFContext.create = function () { return new PDFContext(); }; + return PDFContext; +}()); +exports.default = PDFContext; +//# sourceMappingURL=PDFContext.js.map \ No newline at end of file diff --git a/cjs/core/PDFContext.js.map b/cjs/core/PDFContext.js.map new file mode 100644 index 000000000..5bbfff588 --- /dev/null +++ b/cjs/core/PDFContext.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFContext.js","sourceRoot":"","sources":["../../src/core/PDFContext.ts"],"names":[],"mappings":";;;AAAA,sDAAwB;AAExB,2EAAoD;AACpD,mCAA4D;AAC5D,wEAAiD;AACjD,sEAA+C;AAC/C,sEAA+C;AAE/C,sEAA+C;AAC/C,sEAA+C;AAC/C,0EAAmD;AACnD,0EAAmD;AACnD,gFAAyD;AACzD,oEAA6C;AAG7C,gFAAyD;AACzD,0FAAsD;AACtD,2FAAoE;AACpE,kCAA0C;AAC1C,oCAA0C;AAqB1C,IAAM,uBAAuB,GAAG,UAC9B,EAAwB,EACxB,EAAwB;QADvB,CAAC,QAAA;QACD,CAAC,QAAA;IACC,OAAA,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY;AAA/B,CAA+B,CAAC;AAErC;IAkBE;QACE,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,mBAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAA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,IAAM,EAAE,GAAG,qBAAW,CAAC,EAAE,CAAC,0BAAG,CAAC,gBAAgB,CAAC,CAAC;QAChD,IAAM,MAAM,GAAG,0BAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,gCAAgC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,gCAAgC,CAAC;IAC/C,CAAC;IAED,oCAAe,GAAf,UAAgB,MAAc,EAAE,YAAgB;QAAhB,6BAAA,EAAA,gBAAgB;QAC9C,OAAU,MAAM,SAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,SAAA,EAAE,EAAI,YAAY,CAAA,CAAG,CAAC;IAC5E,CAAC;IAxPM,iBAAM,GAAG,cAAM,OAAA,IAAI,UAAU,EAAE,EAAhB,CAAgB,CAAC;IAyPzC,iBAAC;CAAA,AA1PD,IA0PC;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/PDFObjectCopier.d.ts b/cjs/core/PDFObjectCopier.d.ts new file mode 100644 index 000000000..5be8517d5 --- /dev/null +++ b/cjs/core/PDFObjectCopier.d.ts @@ -0,0 +1,38 @@ +import PDFObject from "./objects/PDFObject"; +import PDFContext from "./PDFContext"; +/** + * PDFObjectCopier copies PDFObjects from a src context to a dest context. + * The primary use case for this is to copy pages between PDFs. + * + * _Copying_ an object with a PDFObjectCopier is different from _cloning_ an + * object with its [[PDFObject.clone]] method: + * + * ``` + * const src: PDFContext = ... + * const dest: PDFContext = ... + * const originalObject: PDFObject = ... + * const copiedObject = PDFObjectCopier.for(src, dest).copy(originalObject); + * const clonedObject = originalObject.clone(); + * ``` + * + * Copying an object is equivalent to cloning it and then copying over any other + * objects that it references. Note that only dictionaries, arrays, and streams + * (or structures build from them) can contain indirect references to other + * objects. Copying a PDFObject that is not a dictionary, array, or stream is + * supported, but is equivalent to cloning it. + */ +declare class PDFObjectCopier { + static for: (src: PDFContext, dest: PDFContext) => PDFObjectCopier; + private readonly src; + private readonly dest; + private readonly traversedObjects; + private constructor(); + copy: (object: T) => T; + private copyPDFPage; + private copyPDFDict; + private copyPDFArray; + private copyPDFStream; + private copyPDFIndirectObject; +} +export default PDFObjectCopier; +//# sourceMappingURL=PDFObjectCopier.d.ts.map \ No newline at end of file diff --git a/cjs/core/PDFObjectCopier.d.ts.map b/cjs/core/PDFObjectCopier.d.ts.map new file mode 100644 index 000000000..6803605e5 --- /dev/null +++ b/cjs/core/PDFObjectCopier.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectCopier.d.ts","sourceRoot":"","sources":["../../src/core/PDFObjectCopier.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,4BAAmC;AAGnD,OAAO,UAAU,qBAA4B;AAG7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAM,eAAe;IACnB,MAAM,CAAC,GAAG,QAAS,UAAU,QAAQ,UAAU,qBACd;IAEjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmC;IAEpE,OAAO;IAMP,IAAI,wCAOG;IAEP,OAAO,CAAC,WAAW,CAkBjB;IAEF,OAAO,CAAC,WAAW,CAgBjB;IAEF,OAAO,CAAC,YAAY,CAclB;IAEF,OAAO,CAAC,aAAa,CAenB;IAEF,OAAO,CAAC,qBAAqB,CAe3B;CACH;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/PDFObjectCopier.js b/cjs/core/PDFObjectCopier.js new file mode 100644 index 000000000..1b7b02517 --- /dev/null +++ b/cjs/core/PDFObjectCopier.js @@ -0,0 +1,119 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFArray_1 = tslib_1.__importDefault(require("./objects/PDFArray")); +var PDFDict_1 = tslib_1.__importDefault(require("./objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("./objects/PDFName")); +var PDFRef_1 = tslib_1.__importDefault(require("./objects/PDFRef")); +var PDFStream_1 = tslib_1.__importDefault(require("./objects/PDFStream")); +var PDFPageLeaf_1 = tslib_1.__importDefault(require("./structures/PDFPageLeaf")); +/** + * PDFObjectCopier copies PDFObjects from a src context to a dest context. + * The primary use case for this is to copy pages between PDFs. + * + * _Copying_ an object with a PDFObjectCopier is different from _cloning_ an + * object with its [[PDFObject.clone]] method: + * + * ``` + * const src: PDFContext = ... + * const dest: PDFContext = ... + * const originalObject: PDFObject = ... + * const copiedObject = PDFObjectCopier.for(src, dest).copy(originalObject); + * const clonedObject = originalObject.clone(); + * ``` + * + * Copying an object is equivalent to cloning it and then copying over any other + * objects that it references. Note that only dictionaries, arrays, and streams + * (or structures build from them) can contain indirect references to other + * objects. Copying a PDFObject that is not a dictionary, array, or stream is + * supported, but is equivalent to cloning it. + */ +var PDFObjectCopier = /** @class */ (function () { + function PDFObjectCopier(src, dest) { + var _this = this; + this.traversedObjects = new Map(); + // prettier-ignore + this.copy = function (object) { return (object instanceof PDFPageLeaf_1.default ? _this.copyPDFPage(object) + : object instanceof PDFDict_1.default ? _this.copyPDFDict(object) + : object instanceof PDFArray_1.default ? _this.copyPDFArray(object) + : object instanceof PDFStream_1.default ? _this.copyPDFStream(object) + : object instanceof PDFRef_1.default ? _this.copyPDFIndirectObject(object) + : object.clone()); }; + this.copyPDFPage = function (originalPage) { + var clonedPage = originalPage.clone(); + // Move any entries that the originalPage is inheriting from its parent + // tree nodes directly into originalPage so they are preserved during + // the copy. + var InheritableEntries = PDFPageLeaf_1.default.InheritableEntries; + for (var idx = 0, len = InheritableEntries.length; idx < len; idx++) { + var key = PDFName_1.default.of(InheritableEntries[idx]); + var value = clonedPage.getInheritableAttribute(key); + if (!clonedPage.get(key) && value) + clonedPage.set(key, value); + } + // Remove the parent reference to prevent the whole donor document's page + // tree from being copied when we only need a single page. + clonedPage.delete(PDFName_1.default.of('Parent')); + return _this.copyPDFDict(clonedPage); + }; + this.copyPDFDict = function (originalDict) { + if (_this.traversedObjects.has(originalDict)) { + return _this.traversedObjects.get(originalDict); + } + var clonedDict = originalDict.clone(_this.dest); + _this.traversedObjects.set(originalDict, clonedDict); + var entries = originalDict.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + clonedDict.set(key, _this.copy(value)); + } + return clonedDict; + }; + this.copyPDFArray = function (originalArray) { + if (_this.traversedObjects.has(originalArray)) { + return _this.traversedObjects.get(originalArray); + } + var clonedArray = originalArray.clone(_this.dest); + _this.traversedObjects.set(originalArray, clonedArray); + for (var idx = 0, len = originalArray.size(); idx < len; idx++) { + var value = originalArray.get(idx); + clonedArray.set(idx, _this.copy(value)); + } + return clonedArray; + }; + this.copyPDFStream = function (originalStream) { + if (_this.traversedObjects.has(originalStream)) { + return _this.traversedObjects.get(originalStream); + } + var clonedStream = originalStream.clone(_this.dest); + _this.traversedObjects.set(originalStream, clonedStream); + var entries = originalStream.dict.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + clonedStream.dict.set(key, _this.copy(value)); + } + return clonedStream; + }; + this.copyPDFIndirectObject = function (ref) { + var alreadyMapped = _this.traversedObjects.has(ref); + if (!alreadyMapped) { + var newRef = _this.dest.nextRef(); + _this.traversedObjects.set(ref, newRef); + var dereferencedValue = _this.src.lookup(ref); + if (dereferencedValue) { + var cloned = _this.copy(dereferencedValue); + _this.dest.assign(newRef, cloned); + } + } + return _this.traversedObjects.get(ref); + }; + this.src = src; + this.dest = dest; + } + PDFObjectCopier.for = function (src, dest) { + return new PDFObjectCopier(src, dest); + }; + return PDFObjectCopier; +}()); +exports.default = PDFObjectCopier; +//# sourceMappingURL=PDFObjectCopier.js.map \ No newline at end of file diff --git a/cjs/core/PDFObjectCopier.js.map b/cjs/core/PDFObjectCopier.js.map new file mode 100644 index 000000000..fe8392faf --- /dev/null +++ b/cjs/core/PDFObjectCopier.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectCopier.js","sourceRoot":"","sources":["../../src/core/PDFObjectCopier.ts"],"names":[],"mappings":";;;AAAA,wEAAiD;AACjD,sEAA+C;AAC/C,sEAA+C;AAE/C,oEAA6C;AAC7C,0EAAmD;AAEnD,iFAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAQE,yBAAoB,GAAe,EAAE,IAAgB;QAArD,iBAGC;QALgB,qBAAgB,GAAG,IAAI,GAAG,EAAwB,CAAC;QAOpE,kBAAkB;QAClB,SAAI,GAAG,UAAsB,MAAS,IAAQ,OAAA,CAC1C,MAAM,YAAY,qBAAW,CAAC,CAAC,CAAC,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAC1D,CAAC,CAAC,MAAM,YAAY,iBAAO,CAAK,CAAC,CAAC,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBAC1D,CAAC,CAAC,MAAM,YAAY,kBAAQ,CAAI,CAAC,CAAC,KAAI,CAAC,YAAY,CAAC,MAAM,CAAC;oBAC3D,CAAC,CAAC,MAAM,YAAY,mBAAS,CAAG,CAAC,CAAC,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC;wBAC5D,CAAC,CAAC,MAAM,YAAY,gBAAM,CAAM,CAAC,CAAC,KAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC;4BACpE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CACZ,EAPwC,CAOxC,CAAC;QAEC,gBAAW,GAAG,UAAC,YAAyB;YAC9C,IAAM,UAAU,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;YAExC,uEAAuE;YACvE,qEAAqE;YACrE,YAAY;YACJ,IAAA,kBAAkB,GAAK,qBAAW,mBAAhB,CAAiB;YAC3C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,G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Button.d.ts new file mode 100644 index 000000000..221febf31 --- /dev/null +++ b/cjs/core/acroform/PDFAcroButton.d.ts @@ -0,0 +1,22 @@ +import PDFObject from "../objects/PDFObject"; +import PDFString from "../objects/PDFString"; +import PDFHexString from "../objects/PDFHexString"; +import PDFArray from "../objects/PDFArray"; +import PDFName from "../objects/PDFName"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroTerminal from "./PDFAcroTerminal"; +declare class PDFAcroButton extends PDFAcroTerminal { + Opt(): PDFString | PDFHexString | PDFArray | undefined; + setOpt(opt: PDFObject[]): void; + getExportValues(): (PDFString | PDFHexString)[] | undefined; + removeExportValue(idx: number): void; + normalizeExportValues(): void; + /** + * Reuses existing opt if one exists with the same value (assuming + * `useExistingIdx` is `true`). Returns index of existing (or new) opt. + */ + addOpt(opt: PDFHexString | PDFString, useExistingOptIdx: boolean): number; + addWidgetWithOpt(widget: PDFRef, opt: PDFHexString | PDFString, useExistingOptIdx: boolean): PDFName; +} +export default PDFAcroButton; +//# sourceMappingURL=PDFAcroButton.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroButton.d.ts.map b/cjs/core/acroform/PDFAcroButton.d.ts.map new file mode 100644 index 000000000..5ac94cf95 --- /dev/null +++ b/cjs/core/acroform/PDFAcroButton.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroButton.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroButton.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,YAAY,gCAAsC;AACzD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,eAAe,0BAA0C;AAGhE,cAAM,aAAc,SAAQ,eAAe;IACzC,GAAG,IAAI,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS;IAStD,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE;IAIvB,eAAe,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE,GAAG,SAAS;IAoB3D,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAiB7B,qBAAqB;IAiBrB;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,EAAE,iBAAiB,EAAE,OAAO,GAAG,MAAM;IAoBzE,gBAAgB,CACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,YAAY,GAAG,SAAS,EAC7B,iBAAiB,EAAE,OAAO;CAO7B;AAED,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroButton.js b/cjs/core/acroform/PDFAcroButton.js new file mode 100644 index 000000000..9be9897c3 --- /dev/null +++ b/cjs/core/acroform/PDFAcroButton.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroTerminal_1 = tslib_1.__importDefault(require("./PDFAcroTerminal")); +var errors_1 = require("../errors"); +var PDFAcroButton = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroButton, _super); + function PDFAcroButton() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroButton.prototype.Opt = function () { + return this.dict.lookupMaybe(PDFName_1.default.of('Opt'), PDFString_1.default, PDFHexString_1.default, PDFArray_1.default); + }; + PDFAcroButton.prototype.setOpt = function (opt) { + this.dict.set(PDFName_1.default.of('Opt'), this.dict.context.obj(opt)); + }; + PDFAcroButton.prototype.getExportValues = function () { + var opt = this.Opt(); + if (!opt) + return undefined; + if (opt instanceof PDFString_1.default || opt instanceof PDFHexString_1.default) { + return [opt]; + } + var values = []; + for (var idx = 0, len = opt.size(); idx < len; idx++) { + var value = opt.lookup(idx); + if (value instanceof PDFString_1.default || value instanceof PDFHexString_1.default) { + values.push(value); + } + } + return values; + }; + PDFAcroButton.prototype.removeExportValue = function (idx) { + var opt = this.Opt(); + if (!opt) + return; + if (opt instanceof PDFString_1.default || opt instanceof PDFHexString_1.default) { + if (idx !== 0) + throw new errors_1.IndexOutOfBoundsError(idx, 0, 0); + this.setOpt([]); + } + else { + if (idx < 0 || idx > opt.size()) { + throw new errors_1.IndexOutOfBoundsError(idx, 0, opt.size()); + } + opt.remove(idx); + } + }; + // Enforce use use of /Opt even if it isn't strictly necessary + PDFAcroButton.prototype.normalizeExportValues = function () { + var _a, _b, _c, _d; + var exportValues = (_a = this.getExportValues()) !== null && _a !== void 0 ? _a : []; + var Opt = []; + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var exportVal = (_b = exportValues[idx]) !== null && _b !== void 0 ? _b : PDFHexString_1.default.fromText((_d = (_c = widget.getOnValue()) === null || _c === void 0 ? void 0 : _c.decodeText()) !== null && _d !== void 0 ? _d : ''); + Opt.push(exportVal); + } + this.setOpt(Opt); + }; + /** + * Reuses existing opt if one exists with the same value (assuming + * `useExistingIdx` is `true`). Returns index of existing (or new) opt. + */ + PDFAcroButton.prototype.addOpt = function (opt, useExistingOptIdx) { + var _a; + this.normalizeExportValues(); + var optText = opt.decodeText(); + var existingIdx; + if (useExistingOptIdx) { + var exportValues = (_a = this.getExportValues()) !== null && _a !== void 0 ? _a : []; + for (var idx = 0, len = exportValues.length; idx < len; idx++) { + var exportVal = exportValues[idx]; + if (exportVal.decodeText() === optText) + existingIdx = idx; + } + } + var Opt = this.Opt(); + Opt.push(opt); + return existingIdx !== null && existingIdx !== void 0 ? existingIdx : Opt.size() - 1; + }; + PDFAcroButton.prototype.addWidgetWithOpt = function (widget, opt, useExistingOptIdx) { + var optIdx = this.addOpt(opt, useExistingOptIdx); + var apStateValue = PDFName_1.default.of(String(optIdx)); + this.addWidget(widget); + return apStateValue; + }; + return PDFAcroButton; +}(PDFAcroTerminal_1.default)); +exports.default = PDFAcroButton; +//# sourceMappingURL=PDFAcroButton.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroButton.js.map b/cjs/core/acroform/PDFAcroButton.js.map new file mode 100644 index 000000000..41bf214e1 --- /dev/null +++ b/cjs/core/acroform/PDFAcroButton.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroButton.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroButton.ts"],"names":[],"mappings":";;;AACA,2EAAmD;AACnD,iFAAyD;AACzD,yEAAiD;AACjD,uEAA+C;AAE/C,8EAAgE;AAChE,oCAAwD;AAExD;IAA4B,yCAAe;IAA3C;;IAsGA,CAAC;IArGC,2BAAG,GAAH;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1B,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EACjB,mBAAS,EACT,sBAAY,EACZ,kBAAQ,CACT,CAAC;IACJ,CAAC;IAED,8BAAM,GAAN,UAAO,GAAgB;QACrB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,uCAAe,GAAf;QACE,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,GAAG;YAAE,OAAO,SAAS,CAAC;QAE3B,IAAI,GAAG,YAAY,mBAAS,IAAI,GAAG,YAAY,sBAAY,EAAE;YAC3D,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;QAED,IAAM,MAAM,GAAiC,EAAE,CAAC;QAChD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,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CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,YAAY,CAAC;IACtB,CAAC;IACH,oBAAC;AAAD,CAAC,AAtGD,CAA4B,yBAAe,GAsG1C;AAED,kBAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroCheckBox.d.ts b/cjs/core/acroform/PDFAcroCheckBox.d.ts new file mode 100644 index 000000000..0deea7d27 --- /dev/null +++ b/cjs/core/acroform/PDFAcroCheckBox.d.ts @@ -0,0 +1,14 @@ +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFAcroButton from "./PDFAcroButton"; +declare class PDFAcroCheckBox extends PDFAcroButton { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroCheckBox; + static create: (context: PDFContext) => PDFAcroCheckBox; + setValue(value: PDFName): void; + getValue(): PDFName; + getOnValue(): PDFName | undefined; +} +export default PDFAcroCheckBox; +//# sourceMappingURL=PDFAcroCheckBox.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroCheckBox.d.ts.map b/cjs/core/acroform/PDFAcroCheckBox.d.ts.map new file mode 100644 index 000000000..5a9c584a8 --- /dev/null +++ b/cjs/core/acroform/PDFAcroCheckBox.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroCheckBox.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroCheckBox.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,aAAa,wBAAwC;AAG5D,cAAM,eAAgB,SAAQ,aAAa;IACzC,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,qBACZ;IAEjC,MAAM,CAAC,MAAM,YAAa,UAAU,qBAOlC;IAEF,QAAQ,CAAC,KAAK,EAAE,OAAO;IAgBvB,QAAQ,IAAI,OAAO;IAMnB,UAAU,IAAI,OAAO,GAAG,SAAS;CAIlC;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroCheckBox.js b/cjs/core/acroform/PDFAcroCheckBox.js new file mode 100644 index 000000000..7367ffb67 --- /dev/null +++ b/cjs/core/acroform/PDFAcroCheckBox.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroButton_1 = tslib_1.__importDefault(require("./PDFAcroButton")); +var errors_1 = require("../errors"); +var PDFAcroCheckBox = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroCheckBox, _super); + function PDFAcroCheckBox() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroCheckBox.prototype.setValue = function (value) { + var _a; + var onValue = (_a = this.getOnValue()) !== null && _a !== void 0 ? _a : PDFName_1.default.of('Yes'); + if (value !== onValue && value !== PDFName_1.default.of('Off')) { + throw new errors_1.InvalidAcroFieldValueError(); + } + this.dict.set(PDFName_1.default.of('V'), value); + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state = widget.getOnValue() === value ? value : PDFName_1.default.of('Off'); + widget.setAppearanceState(state); + } + }; + PDFAcroCheckBox.prototype.getValue = function () { + var v = this.V(); + if (v instanceof PDFName_1.default) + return v; + return PDFName_1.default.of('Off'); + }; + PDFAcroCheckBox.prototype.getOnValue = function () { + var widget = this.getWidgets()[0]; + return widget === null || widget === void 0 ? void 0 : widget.getOnValue(); + }; + PDFAcroCheckBox.fromDict = function (dict, ref) { + return new PDFAcroCheckBox(dict, ref); + }; + PDFAcroCheckBox.create = function (context) { + var dict = context.obj({ + FT: 'Btn', + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroCheckBox(dict, ref); + }; + return PDFAcroCheckBox; +}(PDFAcroButton_1.default)); +exports.default = PDFAcroCheckBox; +//# sourceMappingURL=PDFAcroCheckBox.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroCheckBox.js.map b/cjs/core/acroform/PDFAcroCheckBox.js.map new file mode 100644 index 000000000..66f306f60 --- /dev/null +++ b/cjs/core/acroform/PDFAcroCheckBox.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroCheckBox.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroCheckBox.ts"],"names":[],"mappings":";;;AAGA,uEAA+C;AAC/C,0EAA4D;AAC5D,oCAA6D;AAE7D;IAA8B,2CAAa;IAA3C;;IAuCA,CAAC;IA1BC,kCAAQ,GAAR,UAAS,KAAc;;QACrB,IAAM,OAAO,SAAG,IAAI,CAAC,UAAU,EAAE,mCAAI,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;YACpD,MAAM,IAAI,mCAA0B,EAAE,CAAC;SACxC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAEtC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;SAClC;IACH,CAAC;IAED,kCAAQ,GAAR;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,iBAAO;YAAE,OAAO,CAAC,CAAC;QACnC,OAAO,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,oCAAU,GAAV;QACS,IAAA,MAAM,GAAI,IAAI,CAAC,UAAU,EAAE,GAArB,CAAsB;QACnC,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,GAAG;IAC9B,CAAC;IArCM,wBAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;IAA9B,CAA8B,CAAC;IAE1B,sBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC,CAAC;IA4BJ,sBAAC;CAAA,AAvCD,CAA8B,uBAAa,GAuC1C;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroChoice.d.ts b/cjs/core/acroform/PDFAcroChoice.d.ts new file mode 100644 index 000000000..e61e3717f --- /dev/null +++ b/cjs/core/acroform/PDFAcroChoice.d.ts @@ -0,0 +1,21 @@ +import PDFAcroTerminal from "./PDFAcroTerminal"; +import PDFHexString from "../objects/PDFHexString"; +import PDFString from "../objects/PDFString"; +import PDFArray from "../objects/PDFArray"; +declare class PDFAcroChoice extends PDFAcroTerminal { + setValues(values: (PDFString | PDFHexString)[]): void; + valuesAreValid(values: (PDFString | PDFHexString)[]): boolean; + updateSelectedIndices(values: (PDFString | PDFHexString)[]): void; + getValues(): (PDFString | PDFHexString)[]; + Opt(): PDFArray | PDFString | PDFHexString | undefined; + setOptions(options: { + value: PDFString | PDFHexString; + display?: PDFString | PDFHexString; + }[]): void; + getOptions(): { + value: PDFString | PDFHexString; + display: PDFString | PDFHexString; + }[]; +} +export default PDFAcroChoice; +//# sourceMappingURL=PDFAcroChoice.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroChoice.d.ts.map b/cjs/core/acroform/PDFAcroChoice.d.ts.map new file mode 100644 index 000000000..6c26be826 --- /dev/null +++ b/cjs/core/acroform/PDFAcroChoice.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroChoice.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroChoice.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,0BAA0C;AAChE,OAAO,YAAY,gCAAsC;AACzD,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AAQjD,cAAM,aAAc,SAAQ,eAAe;IACzC,SAAS,CAAC,MAAM,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE;IAyB9C,cAAc,CAAC,MAAM,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE,GAAG,OAAO;IAW7D,qBAAqB,CAAC,MAAM,EAAE,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE;IAgB1D,SAAS,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE;IAqBzC,GAAG,IAAI,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS;IAStD,UAAU,CACR,OAAO,EAAE;QACP,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;QAChC,OAAO,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;KACpC,EAAE;IAUL,UAAU,IAAI;QACZ,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;QAChC,OAAO,EAAE,SAAS,GAAG,YAAY,CAAC;KACnC,EAAE;CAuCJ;AAED,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroChoice.js b/cjs/core/acroform/PDFAcroChoice.js new file mode 100644 index 000000000..31477d2bf --- /dev/null +++ b/cjs/core/acroform/PDFAcroChoice.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroTerminal_1 = tslib_1.__importDefault(require("./PDFAcroTerminal")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var flags_1 = require("./flags"); +var errors_1 = require("../errors"); +var PDFAcroChoice = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroChoice, _super); + function PDFAcroChoice() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroChoice.prototype.setValues = function (values) { + if (this.hasFlag(flags_1.AcroChoiceFlags.Combo) && + !this.hasFlag(flags_1.AcroChoiceFlags.Edit) && + !this.valuesAreValid(values)) { + throw new errors_1.InvalidAcroFieldValueError(); + } + if (values.length === 0) { + this.dict.delete(PDFName_1.default.of('V')); + } + if (values.length === 1) { + this.dict.set(PDFName_1.default.of('V'), values[0]); + } + if (values.length > 1) { + if (!this.hasFlag(flags_1.AcroChoiceFlags.MultiSelect)) { + throw new errors_1.MultiSelectValueError(); + } + this.dict.set(PDFName_1.default.of('V'), this.dict.context.obj(values)); + } + this.updateSelectedIndices(values); + }; + PDFAcroChoice.prototype.valuesAreValid = function (values) { + var options = this.getOptions(); + var _loop_1 = function (idx, len) { + var val = values[idx].decodeText(); + if (!options.find(function (o) { return val === (o.display || o.value).decodeText(); })) { + return { value: false }; + } + }; + for (var idx = 0, len = values.length; idx < len; idx++) { + var state_1 = _loop_1(idx, len); + if (typeof state_1 === "object") + return state_1.value; + } + return true; + }; + PDFAcroChoice.prototype.updateSelectedIndices = function (values) { + if (values.length > 1) { + var indices = new Array(values.length); + var options = this.getOptions(); + var _loop_2 = function (idx, len) { + var val = values[idx].decodeText(); + indices[idx] = options.findIndex(function (o) { return val === (o.display || o.value).decodeText(); }); + }; + for (var idx = 0, len = values.length; idx < len; idx++) { + _loop_2(idx, len); + } + this.dict.set(PDFName_1.default.of('I'), this.dict.context.obj(indices.sort())); + } + else { + this.dict.delete(PDFName_1.default.of('I')); + } + }; + PDFAcroChoice.prototype.getValues = function () { + var v = this.V(); + if (v instanceof PDFString_1.default || v instanceof PDFHexString_1.default) + return [v]; + if (v instanceof PDFArray_1.default) { + var values = []; + for (var idx = 0, len = v.size(); idx < len; idx++) { + var value = v.lookup(idx); + if (value instanceof PDFString_1.default || value instanceof PDFHexString_1.default) { + values.push(value); + } + } + return values; + } + return []; + }; + PDFAcroChoice.prototype.Opt = function () { + return this.dict.lookupMaybe(PDFName_1.default.of('Opt'), PDFString_1.default, PDFHexString_1.default, PDFArray_1.default); + }; + PDFAcroChoice.prototype.setOptions = function (options) { + var newOpt = new Array(options.length); + for (var idx = 0, len = options.length; idx < len; idx++) { + var _a = options[idx], value = _a.value, display = _a.display; + newOpt[idx] = this.dict.context.obj([value, display || value]); + } + this.dict.set(PDFName_1.default.of('Opt'), this.dict.context.obj(newOpt)); + }; + PDFAcroChoice.prototype.getOptions = function () { + var Opt = this.Opt(); + // Not supposed to happen - Opt _should_ always be `PDFArray | undefined` + if (Opt instanceof PDFString_1.default || Opt instanceof PDFHexString_1.default) { + return [{ value: Opt, display: Opt }]; + } + if (Opt instanceof PDFArray_1.default) { + var res = []; + for (var idx = 0, len = Opt.size(); idx < len; idx++) { + var item = Opt.lookup(idx); + // If `item` is a string, use that as both the export and text value + if (item instanceof PDFString_1.default || item instanceof PDFHexString_1.default) { + res.push({ value: item, display: item }); + } + // If `item` is an array of one, treat it the same as just a string, + // if it's an array of two then `item[0]` is the export value and + // `item[1]` is the text value + if (item instanceof PDFArray_1.default) { + if (item.size() > 0) { + var first = item.lookup(0, PDFString_1.default, PDFHexString_1.default); + var second = item.lookupMaybe(1, PDFString_1.default, PDFHexString_1.default); + res.push({ value: first, display: second || first }); + } + } + } + return res; + } + return []; + }; + return PDFAcroChoice; +}(PDFAcroTerminal_1.default)); +exports.default = PDFAcroChoice; +//# sourceMappingURL=PDFAcroChoice.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroChoice.js.map b/cjs/core/acroform/PDFAcroChoice.js.map new file mode 100644 index 000000000..948257e2f --- /dev/null +++ b/cjs/core/acroform/PDFAcroChoice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroChoice.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroChoice.ts"],"names":[],"mappings":";;;AAAA,8EAAgE;AAChE,iFAAyD;AACzD,2EAAmD;AACnD,yEAAiD;AACjD,uEAA+C;AAC/C,iCAA0D;AAC1D,oCAGyB;AAEzB;IAA4B,yCAAe;IAA3C;;IA2IA,CAAC;IA1IC,iCAAS,GAAT,UAAU,MAAoC;QAC5C,IACE,IAAI,CAAC,OAAO,CAAC,uBAAe,CAAC,KAAK,CAAC;YACnC,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAe,CAAC,IAAI,CAAC;YACnC,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAC5B;YACA,MAAM,IAAI,mCAA0B,EAAE,CAAC;SACxC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SACnC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3C;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC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,EAAE,GAAG,EAAE,EAAE;gBACpD,IAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAE7B,oEAAoE;gBACpE,IAAI,IAAI,YAAY,mBAAS,IAAI,IAAI,YAAY,sBAAY,EAAE;oBAC7D,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC1C;gBAED,oEAAoE;gBACpE,iEAAiE;gBACjE,8BAA8B;gBAC9B,IAAI,IAAI,YAAY,kBAAQ,EAAE;oBAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;wBACnB,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAS,EAAE,sBAAY,CAAC,CAAC;wBACtD,IAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,mBAAS,EAAE,sBAAY,CAAC,CAAC;wBAC5D,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;qBACtD;iBACF;aACF;YAED,OAAO,GAAG,CAAC;SACZ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,oBAAC;AAAD,CAAC,AA3ID,CAA4B,yBAAe,GA2I1C;AAED,kBAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroComboBox.d.ts b/cjs/core/acroform/PDFAcroComboBox.d.ts new file mode 100644 index 000000000..d97e3c123 --- /dev/null +++ b/cjs/core/acroform/PDFAcroComboBox.d.ts @@ -0,0 +1,10 @@ +import PDFDict from "../objects/PDFDict"; +import PDFAcroChoice from "./PDFAcroChoice"; +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +declare class PDFAcroComboBox extends PDFAcroChoice { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroComboBox; + static create: (context: PDFContext) => PDFAcroComboBox; +} +export default PDFAcroComboBox; +//# sourceMappingURL=PDFAcroComboBox.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroComboBox.d.ts.map b/cjs/core/acroform/PDFAcroComboBox.d.ts.map new file mode 100644 index 000000000..426c45d21 --- /dev/null +++ b/cjs/core/acroform/PDFAcroComboBox.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroComboBox.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroComboBox.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,aAAa,wBAAwC;AAC5D,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAG7C,cAAM,eAAgB,SAAQ,aAAa;IACzC,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,qBACZ;IAEjC,MAAM,CAAC,MAAM,YAAa,UAAU,qBAQlC;CACH;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroComboBox.js b/cjs/core/acroform/PDFAcroComboBox.js new file mode 100644 index 000000000..1e9ed6142 --- /dev/null +++ b/cjs/core/acroform/PDFAcroComboBox.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroChoice_1 = tslib_1.__importDefault(require("./PDFAcroChoice")); +var flags_1 = require("./flags"); +var PDFAcroComboBox = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroComboBox, _super); + function PDFAcroComboBox() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroComboBox.fromDict = function (dict, ref) { + return new PDFAcroComboBox(dict, ref); + }; + PDFAcroComboBox.create = function (context) { + var dict = context.obj({ + FT: 'Ch', + Ff: flags_1.AcroChoiceFlags.Combo, + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroComboBox(dict, ref); + }; + return PDFAcroComboBox; +}(PDFAcroChoice_1.default)); +exports.default = PDFAcroComboBox; +//# sourceMappingURL=PDFAcroComboBox.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroComboBox.js.map b/cjs/core/acroform/PDFAcroComboBox.js.map new file mode 100644 index 000000000..796ce56e0 --- /dev/null +++ b/cjs/core/acroform/PDFAcroComboBox.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroComboBox.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroComboBox.ts"],"names":[],"mappings":";;;AACA,0EAA4D;AAG5D,iCAA0D;AAE1D;IAA8B,2CAAa;IAA3C;;IAaA,CAAC;IAZQ,wBAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;IAA9B,CAA8B,CAAC;IAE1B,sBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,EAAE,EAAE,IAAI;YACR,EAAE,EAAE,uBAAe,CAAC,KAAK;YACzB,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC,CAAC;IACJ,sBAAC;CAAA,AAbD,CAA8B,uBAAa,GAa1C;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroField.d.ts b/cjs/core/acroform/PDFAcroField.d.ts new file mode 100644 index 000000000..c181fa908 --- /dev/null +++ b/cjs/core/acroform/PDFAcroField.d.ts @@ -0,0 +1,37 @@ +import PDFDict from "../objects/PDFDict"; +import PDFString from "../objects/PDFString"; +import PDFHexString from "../objects/PDFHexString"; +import PDFName from "../objects/PDFName"; +import PDFObject from "../objects/PDFObject"; +import PDFNumber from "../objects/PDFNumber"; +import PDFArray from "../objects/PDFArray"; +import PDFRef from "../objects/PDFRef"; +declare class PDFAcroField { + readonly dict: PDFDict; + readonly ref: PDFRef; + protected constructor(dict: PDFDict, ref: PDFRef); + T(): PDFString | PDFHexString | undefined; + Ff(): PDFNumber | undefined; + V(): PDFObject | undefined; + Kids(): PDFArray | undefined; + DA(): PDFString | PDFHexString | undefined; + setKids(kids: PDFObject[]): void; + getParent(): PDFAcroField | undefined; + setParent(parent: PDFRef | undefined): void; + getFullyQualifiedName(): string | undefined; + getPartialName(): string | undefined; + setPartialName(partialName: string | undefined): void; + setDefaultAppearance(appearance: string): void; + getDefaultAppearance(): string | undefined; + setFontSize(fontSize: number): void; + getFlags(): number; + setFlags(flags: number): void; + hasFlag(flag: number): boolean; + setFlag(flag: number): void; + clearFlag(flag: number): void; + setFlagTo(flag: number, enable: boolean): void; + getInheritableAttribute(name: PDFName): PDFObject | undefined; + ascend(visitor: (node: PDFAcroField) => any): void; +} +export default PDFAcroField; +//# sourceMappingURL=PDFAcroField.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroField.d.ts.map b/cjs/core/acroform/PDFAcroField.d.ts.map new file mode 100644 index 000000000..7ab5a7c99 --- /dev/null +++ b/cjs/core/acroform/PDFAcroField.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroField.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroField.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,YAAY,gCAAsC;AACzD,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,MAAM,0BAAgC;AAU7C,cAAM,YAAY;IAChB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,SAAS,aAAa,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM;IAKhD,CAAC,IAAI,SAAS,GAAG,YAAY,GAAG,SAAS;IAIzC,EAAE,IAAI,SAAS,GAAG,SAAS;IAK3B,CAAC,IAAI,SAAS,GAAG,SAAS;IAK1B,IAAI,IAAI,QAAQ,GAAG,SAAS;IAQ5B,EAAE,IAAI,SAAS,GAAG,YAAY,GAAG,SAAS;IAM1C,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE;IAIzB,SAAS,IAAI,YAAY,GAAG,SAAS;IAcrC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAKpC,qBAAqB,IAAI,MAAM,GAAG,SAAS;IAM3C,cAAc,IAAI,MAAM,GAAG,SAAS;IAIpC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAK9C,oBAAoB,CAAC,UAAU,EAAE,MAAM;IAIvC,oBAAoB,IAAI,MAAM,GAAG,SAAS;IAU1C,WAAW,CAAC,QAAQ,EAAE,MAAM;IAiB5B,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK9B,OAAO,CAAC,IAAI,EAAE,MAAM;IAKpB,SAAS,CAAC,IAAI,EAAE,MAAM;IAKtB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAKvC,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS;IAQ7D,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,GAAG,IAAI;CAKnD;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroField.js b/cjs/core/acroform/PDFAcroField.js new file mode 100644 index 000000000..9678fed99 --- /dev/null +++ b/cjs/core/acroform/PDFAcroField.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var utils_1 = require("../../utils"); +var errors_1 = require("../errors"); +// Examples: +// `/Helv 12 Tf` -> ['Helv', '12'] +// `/HeBo 8.00 Tf` -> ['HeBo', '8.00'] +// `/HeBo Tf` -> ['HeBo', undefined] +var tfRegex = /\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/; +var PDFAcroField = /** @class */ (function () { + function PDFAcroField(dict, ref) { + this.dict = dict; + this.ref = ref; + } + PDFAcroField.prototype.T = function () { + return this.dict.lookupMaybe(PDFName_1.default.of('T'), PDFString_1.default, PDFHexString_1.default); + }; + PDFAcroField.prototype.Ff = function () { + var numberOrRef = this.getInheritableAttribute(PDFName_1.default.of('Ff')); + return this.dict.context.lookupMaybe(numberOrRef, PDFNumber_1.default); + }; + PDFAcroField.prototype.V = function () { + var valueOrRef = this.getInheritableAttribute(PDFName_1.default.of('V')); + return this.dict.context.lookup(valueOrRef); + }; + PDFAcroField.prototype.Kids = function () { + return this.dict.lookupMaybe(PDFName_1.default.of('Kids'), PDFArray_1.default); + }; + // Parent(): PDFDict | undefined { + // return this.dict.lookupMaybe(PDFName.of('Parent'), PDFDict); + // } + PDFAcroField.prototype.DA = function () { + var da = this.dict.lookup(PDFName_1.default.of('DA')); + if (da instanceof PDFString_1.default || da instanceof PDFHexString_1.default) + return da; + return undefined; + }; + PDFAcroField.prototype.setKids = function (kids) { + this.dict.set(PDFName_1.default.of('Kids'), this.dict.context.obj(kids)); + }; + PDFAcroField.prototype.getParent = function () { + // const parent = this.Parent(); + // if (!parent) return undefined; + // return new PDFAcroField(parent); + var parentRef = this.dict.get(PDFName_1.default.of('Parent')); + if (parentRef instanceof PDFRef_1.default) { + var parent_1 = this.dict.lookup(PDFName_1.default.of('Parent'), PDFDict_1.default); + return new PDFAcroField(parent_1, parentRef); + } + return undefined; + }; + PDFAcroField.prototype.setParent = function (parent) { + if (!parent) + this.dict.delete(PDFName_1.default.of('Parent')); + else + this.dict.set(PDFName_1.default.of('Parent'), parent); + }; + PDFAcroField.prototype.getFullyQualifiedName = function () { + var parent = this.getParent(); + if (!parent) + return this.getPartialName(); + return parent.getFullyQualifiedName() + "." + this.getPartialName(); + }; + PDFAcroField.prototype.getPartialName = function () { + var _a; + return (_a = this.T()) === null || _a === void 0 ? void 0 : _a.decodeText(); + }; + PDFAcroField.prototype.setPartialName = function (partialName) { + if (!partialName) + this.dict.delete(PDFName_1.default.of('T')); + else + this.dict.set(PDFName_1.default.of('T'), PDFHexString_1.default.fromText(partialName)); + }; + PDFAcroField.prototype.setDefaultAppearance = function (appearance) { + this.dict.set(PDFName_1.default.of('DA'), PDFString_1.default.of(appearance)); + }; + PDFAcroField.prototype.getDefaultAppearance = function () { + var DA = this.DA(); + if (DA instanceof PDFHexString_1.default) { + return DA.decodeText(); + } + return DA === null || DA === void 0 ? void 0 : DA.asString(); + }; + PDFAcroField.prototype.setFontSize = function (fontSize) { + var _a; + var name = (_a = this.getFullyQualifiedName()) !== null && _a !== void 0 ? _a : ''; + var da = this.getDefaultAppearance(); + if (!da) + throw new errors_1.MissingDAEntryError(name); + var daMatch = utils_1.findLastMatch(da, tfRegex); + if (!daMatch.match) + throw new errors_1.MissingTfOperatorError(name); + var daStart = da.slice(0, daMatch.pos - daMatch.match[0].length); + var daEnd = daMatch.pos <= da.length ? da.slice(daMatch.pos) : ''; + var fontName = daMatch.match[1]; + var modifiedDa = daStart + " /" + fontName + " " + fontSize + " Tf " + daEnd; + this.setDefaultAppearance(modifiedDa); + }; + PDFAcroField.prototype.getFlags = function () { + var _a, _b; + return (_b = (_a = this.Ff()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 0; + }; + PDFAcroField.prototype.setFlags = function (flags) { + this.dict.set(PDFName_1.default.of('Ff'), PDFNumber_1.default.of(flags)); + }; + PDFAcroField.prototype.hasFlag = function (flag) { + var flags = this.getFlags(); + return (flags & flag) !== 0; + }; + PDFAcroField.prototype.setFlag = function (flag) { + var flags = this.getFlags(); + this.setFlags(flags | flag); + }; + PDFAcroField.prototype.clearFlag = function (flag) { + var flags = this.getFlags(); + this.setFlags(flags & ~flag); + }; + PDFAcroField.prototype.setFlagTo = function (flag, enable) { + if (enable) + this.setFlag(flag); + else + this.clearFlag(flag); + }; + PDFAcroField.prototype.getInheritableAttribute = function (name) { + var attribute; + this.ascend(function (node) { + if (!attribute) + attribute = node.dict.get(name); + }); + return attribute; + }; + PDFAcroField.prototype.ascend = function (visitor) { + visitor(this); + var parent = this.getParent(); + if (parent) + parent.ascend(visitor); + }; + return PDFAcroField; +}()); +exports.default = PDFAcroField; +//# sourceMappingURL=PDFAcroField.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroField.js.map b/cjs/core/acroform/PDFAcroField.js.map new file mode 100644 index 000000000..e2d6c50f9 --- /dev/null +++ b/cjs/core/acroform/PDFAcroField.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroField.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroField.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,2EAAmD;AACnD,iFAAyD;AACzD,uEAA+C;AAE/C,2EAAmD;AACnD,yEAAiD;AACjD,qEAA6C;AAC7C,qCAA0C;AAC1C,oCAA8E;AAE9E,YAAY;AACZ,oCAAoC;AACpC,wCAAwC;AACxC,sCAAsC;AACtC,IAAM,OAAO,GAAG,qEAAqE,CAAC;AAEtF;IAIE,sBAAsB,IAAa,EAAE,G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QACnC,IAAI,SAAgC,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,UAAC,IAAI;YACf,IAAI,CAAC,SAAS;gBAAE,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,6BAAM,GAAN,UAAO,OAAoC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,IAAI,MAAM;YAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IACH,mBAAC;AAAD,CAAC,AAnJD,IAmJC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroForm.d.ts b/cjs/core/acroform/PDFAcroForm.d.ts new file mode 100644 index 000000000..b80aa9660 --- /dev/null +++ b/cjs/core/acroform/PDFAcroForm.d.ts @@ -0,0 +1,21 @@ +import PDFContext from "../PDFContext"; +import PDFDict from "../objects/PDFDict"; +import PDFArray from "../objects/PDFArray"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroField from "./PDFAcroField"; +declare class PDFAcroForm { + readonly dict: PDFDict; + static fromDict: (dict: PDFDict) => PDFAcroForm; + static create: (context: PDFContext) => PDFAcroForm; + private constructor(); + Fields(): PDFArray | undefined; + getFields(): [PDFAcroField, PDFRef][]; + getAllFields(): [PDFAcroField, PDFRef][]; + addField(field: PDFRef): void; + removeField(field: PDFAcroField): void; + normalizedEntries(): { + Fields: PDFArray; + }; +} +export default PDFAcroForm; +//# sourceMappingURL=PDFAcroForm.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroForm.d.ts.map b/cjs/core/acroform/PDFAcroForm.d.ts.map new file mode 100644 index 000000000..ce5f78e7c --- /dev/null +++ b/cjs/core/acroform/PDFAcroForm.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroForm.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroForm.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,sBAA4B;AAC7C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,QAAQ,4BAAkC;AAEjD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,YAAY,uBAAuC;AAO1D,cAAM,WAAW;IACf,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,iBAA2B;IAE3D,MAAM,CAAC,MAAM,YAAa,UAAU,iBAGlC;IAEF,OAAO;IAIP,MAAM,IAAI,QAAQ,GAAG,SAAS;IAM9B,SAAS,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;IAarC,YAAY,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;IAoBxC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAKtB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAmBtC,iBAAiB;;;CAUlB;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroForm.js b/cjs/core/acroform/PDFAcroForm.js new file mode 100644 index 000000000..c98ea64c7 --- /dev/null +++ b/cjs/core/acroform/PDFAcroForm.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroNonTerminal_1 = tslib_1.__importDefault(require("./PDFAcroNonTerminal")); +var utils_1 = require("./utils"); +var PDFAcroForm = /** @class */ (function () { + function PDFAcroForm(dict) { + this.dict = dict; + } + PDFAcroForm.prototype.Fields = function () { + var fields = this.dict.lookup(PDFName_1.default.of('Fields')); + if (fields instanceof PDFArray_1.default) + return fields; + return undefined; + }; + PDFAcroForm.prototype.getFields = function () { + var Fields = this.normalizedEntries().Fields; + var fields = new Array(Fields.size()); + for (var idx = 0, len = Fields.size(); idx < len; idx++) { + var ref = Fields.get(idx); + var dict = Fields.lookup(idx, PDFDict_1.default); + fields[idx] = [utils_1.createPDFAcroField(dict, ref), ref]; + } + return fields; + }; + PDFAcroForm.prototype.getAllFields = function () { + var allFields = []; + var pushFields = function (fields) { + if (!fields) + return; + for (var idx = 0, len = fields.length; idx < len; idx++) { + var field = fields[idx]; + allFields.push(field); + var fieldModel = field[0]; + if (fieldModel instanceof PDFAcroNonTerminal_1.default) { + pushFields(utils_1.createPDFAcroFields(fieldModel.Kids())); + } + } + }; + pushFields(this.getFields()); + return allFields; + }; + PDFAcroForm.prototype.addField = function (field) { + var Fields = this.normalizedEntries().Fields; + Fields === null || Fields === void 0 ? void 0 : Fields.push(field); + }; + PDFAcroForm.prototype.removeField = function (field) { + var parent = field.getParent(); + var fields = parent === undefined ? this.normalizedEntries().Fields : parent.Kids(); + var index = fields === null || fields === void 0 ? void 0 : fields.indexOf(field.ref); + if (fields === undefined || index === undefined) { + throw new Error("Tried to remove inexistent field " + field.getFullyQualifiedName()); + } + fields.remove(index); + if (parent !== undefined && fields.size() === 0) { + this.removeField(parent); + } + }; + PDFAcroForm.prototype.normalizedEntries = function () { + var Fields = this.Fields(); + if (!Fields) { + Fields = this.dict.context.obj([]); + this.dict.set(PDFName_1.default.of('Fields'), Fields); + } + return { Fields: Fields }; + }; + PDFAcroForm.fromDict = function (dict) { return new PDFAcroForm(dict); }; + PDFAcroForm.create = function (context) { + var dict = context.obj({ Fields: [] }); + return new PDFAcroForm(dict); + }; + return PDFAcroForm; +}()); +exports.default = PDFAcroForm; +//# sourceMappingURL=PDFAcroForm.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroForm.js.map b/cjs/core/acroform/PDFAcroForm.js.map new file mode 100644 index 000000000..7c9fd8f26 --- /dev/null +++ b/cjs/core/acroform/P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AI,EAAE,KAAK,CAAC,EAAE;YAC/C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC1B;IACH,CAAC;IAED,uCAAiB,GAAjB;QACE,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE3B,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;SAC7C;QAED,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;IACpB,CAAC;IAnFM,oBAAQ,GAAG,UAAC,IAAa,IAAK,OAAA,IAAI,WAAW,CAAC,IAAI,CAAC,EAArB,CAAqB,CAAC;IAEpD,kBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC;IA+EJ,kBAAC;CAAA,AAvFD,IAuFC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroListBox.d.ts b/cjs/core/acroform/PDFAcroListBox.d.ts new file mode 100644 index 000000000..461218b2f --- /dev/null +++ b/cjs/core/acroform/PDFAcroListBox.d.ts @@ -0,0 +1,10 @@ +import PDFDict from "../objects/PDFDict"; +import PDFAcroChoice from "./PDFAcroChoice"; +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +declare class PDFAcroListBox extends PDFAcroChoice { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroListBox; + static create: (context: PDFContext) => PDFAcroListBox; +} +export default PDFAcroListBox; +//# sourceMappingURL=PDFAcroListBox.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroListBox.d.ts.map b/cjs/core/acroform/PDFAcroListBox.d.ts.map new file mode 100644 index 000000000..2aa02166f --- /dev/null +++ b/cjs/core/acroform/PDFAcroListBox.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroListBox.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroListBox.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,aAAa,wBAAwC;AAC5D,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAE7C,cAAM,cAAe,SAAQ,aAAa;IACxC,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,oBACb;IAEhC,MAAM,CAAC,MAAM,YAAa,UAAU,oBAOlC;CACH;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroListBox.js b/cjs/core/acroform/PDFAcroListBox.js new file mode 100644 index 000000000..bbcfc7b90 --- /dev/null +++ b/cjs/core/acroform/PDFAcroListBox.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroChoice_1 = tslib_1.__importDefault(require("./PDFAcroChoice")); +var PDFAcroListBox = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroListBox, _super); + function PDFAcroListBox() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroListBox.fromDict = function (dict, ref) { + return new PDFAcroListBox(dict, ref); + }; + PDFAcroListBox.create = function (context) { + var dict = context.obj({ + FT: 'Ch', + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroListBox(dict, ref); + }; + return PDFAcroListBox; +}(PDFAcroChoice_1.default)); +exports.default = PDFAcroListBox; +//# sourceMappingURL=PDFAcroListBox.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroListBox.js.map b/cjs/core/acroform/PDFAcroListBox.js.map new file mode 100644 index 000000000..62681ae80 --- /dev/null +++ b/cjs/core/acroform/PDFAcroListBox.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroListBox.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroListBox.ts"],"names":[],"mappings":";;;AACA,0EAA4D;AAI5D;IAA6B,0CAAa;IAA1C;;IAYA,CAAC;IAXQ,uBAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC;IAA7B,CAA6B,CAAC;IAEzB,qBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC;IACJ,qBAAC;CAAA,AAZD,CAA6B,uBAAa,GAYzC;AAED,kBAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroNonTerminal.d.ts b/cjs/core/acroform/PDFAcroNonTerminal.d.ts new file mode 100644 index 000000000..9ff87dc3d --- /dev/null +++ b/cjs/core/acroform/PDFAcroNonTerminal.d.ts @@ -0,0 +1,14 @@ +import PDFDict from "../objects/PDFDict"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFAcroField from "./PDFAcroField"; +declare class PDFAcroNonTerminal extends PDFAcroField { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroNonTerminal; + static create: (context: PDFContext) => PDFAcroNonTerminal; + addField(field: PDFRef): void; + normalizedEntries(): { + Kids: import("../objects/PDFArray").default; + }; +} +export default PDFAcroNonTerminal; +//# sourceMappingURL=PDFAcroNonTerminal.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map b/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map new file mode 100644 index 000000000..d9207a265 --- /dev/null +++ b/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroNonTerminal.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroNonTerminal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAE7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,YAAY,uBAAuC;AAE1D,cAAM,kBAAmB,SAAQ,YAAY;IAC3C,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,wBACT;IAEpC,MAAM,CAAC,MAAM,YAAa,UAAU,wBAIlC;IAEF,QAAQ,CAAC,KAAK,EAAE,MAAM;IAKtB,iBAAiB;;;CAUlB;AAED,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroNonTerminal.js b/cjs/core/acroform/PDFAcroNonTerminal.js new file mode 100644 index 000000000..94364ea7f --- /dev/null +++ b/cjs/core/acroform/PDFAcroNonTerminal.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroField_1 = tslib_1.__importDefault(require("./PDFAcroField")); +var PDFAcroNonTerminal = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroNonTerminal, _super); + function PDFAcroNonTerminal() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroNonTerminal.prototype.addField = function (field) { + var Kids = this.normalizedEntries().Kids; + Kids === null || Kids === void 0 ? void 0 : Kids.push(field); + }; + PDFAcroNonTerminal.prototype.normalizedEntries = function () { + var Kids = this.Kids(); + if (!Kids) { + Kids = this.dict.context.obj([]); + this.dict.set(PDFName_1.default.of('Kids'), Kids); + } + return { Kids: Kids }; + }; + PDFAcroNonTerminal.fromDict = function (dict, ref) { + return new PDFAcroNonTerminal(dict, ref); + }; + PDFAcroNonTerminal.create = function (context) { + var dict = context.obj({}); + var ref = context.register(dict); + return new PDFAcroNonTerminal(dict, ref); + }; + return PDFAcroNonTerminal; +}(PDFAcroField_1.default)); +exports.default = PDFAcroNonTerminal; +//# sourceMappingURL=PDFAcroNonTerminal.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroNonTerminal.js.map b/cjs/core/acroform/PDFAcroNonTerminal.js.map new file mode 100644 index 000000000..ab29893cb --- /dev/null +++ b/cjs/core/acroform/PDFAcroNonTerminal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroNonTerminal.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroNonTerminal.ts"],"names":[],"mappings":";;;AAEA,uEAA+C;AAE/C,wEAA0D;AAE1D;IAAiC,8CAAY;IAA7C;;IAyBA,CAAC;IAfC,qCAAQ,GAAR,UAAS,KAAa;QACZ,IAAA,IAAI,GAAK,IAAI,CAAC,iBAAiB,EAAE,KAA7B,CAA8B;QAC1C,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,KAAK,EAAE;IACpB,CAAC;IAED,8CAAiB,GAAjB;QACE,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;SACzC;QAED,OAAO,EAAE,IAAI,MAAA,EAAE,CAAC;IAClB,CAAC;IAvBM,2BAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,kBAAkB,CAAC,IAAI,EAAE,GAAG,CAAC;IAAjC,CAAiC,CAAC;IAE7B,yBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;IAiBJ,yBAAC;CAAA,AAzBD,CAAiC,sBAAY,GAyB5C;AAED,kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroPushButton.d.ts b/cjs/core/acroform/PDFAcroPushButton.d.ts new file mode 100644 index 000000000..25bc66eed --- /dev/null +++ b/cjs/core/acroform/PDFAcroPushButton.d.ts @@ -0,0 +1,10 @@ +import PDFDict from "../objects/PDFDict"; +import PDFAcroButton from "./PDFAcroButton"; +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +declare class PDFAcroPushButton extends PDFAcroButton { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroPushButton; + static create: (context: PDFContext) => PDFAcroPushButton; +} +export default PDFAcroPushButton; +//# sourceMappingURL=PDFAcroPushButton.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroPushButton.d.ts.map b/cjs/core/acroform/PDFAcroPushButton.d.ts.map new file mode 100644 index 000000000..3995bac3c --- /dev/null +++ b/cjs/core/acroform/PDFAcroPushButton.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroPushButton.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroPushButton.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,aAAa,wBAAwC;AAC5D,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAG7C,cAAM,iBAAkB,SAAQ,aAAa;IAC3C,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,uBACV;IAEnC,MAAM,CAAC,MAAM,YAAa,UAAU,uBAQlC;CACH;AAED,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroPushButton.js b/cjs/core/acroform/PDFAcroPushButton.js new file mode 100644 index 000000000..b288e9090 --- /dev/null +++ b/cjs/core/acroform/PDFAcroPushButton.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroButton_1 = tslib_1.__importDefault(require("./PDFAcroButton")); +var flags_1 = require("./flags"); +var PDFAcroPushButton = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroPushButton, _super); + function PDFAcroPushButton() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroPushButton.fromDict = function (dict, ref) { + return new PDFAcroPushButton(dict, ref); + }; + PDFAcroPushButton.create = function (context) { + var dict = context.obj({ + FT: 'Btn', + Ff: flags_1.AcroButtonFlags.PushButton, + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroPushButton(dict, ref); + }; + return PDFAcroPushButton; +}(PDFAcroButton_1.default)); +exports.default = PDFAcroPushButton; +//# sourceMappingURL=PDFAcroPushButton.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroPushButton.js.map b/cjs/core/acroform/PDFAcroPushButton.js.map new file mode 100644 index 000000000..3cfafc0d7 --- /dev/null +++ b/cjs/core/acroform/PDFAcroPushButton.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroPushButton.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroPushButton.ts"],"names":[],"mappings":";;;AACA,0EAA4D;AAG5D,iCAA0D;AAE1D;IAAgC,6CAAa;IAA7C;;IAaA,CAAC;IAZQ,0BAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC;IAAhC,CAAgC,CAAC;IAE5B,wBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,uBAAe,CAAC,UAAU;YAC9B,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC,CAAC;IACJ,wBAAC;CAAA,AAbD,CAAgC,uBAAa,GAa5C;AAED,kBAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroRadioButton.d.ts b/cjs/core/acroform/PDFAcroRadioButton.d.ts new file mode 100644 index 000000000..8ceae2e8f --- /dev/null +++ b/cjs/core/acroform/PDFAcroRadioButton.d.ts @@ -0,0 +1,14 @@ +import PDFRef from "../objects/PDFRef"; +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFAcroButton from "./PDFAcroButton"; +import PDFContext from "../PDFContext"; +declare class PDFAcroRadioButton extends PDFAcroButton { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroRadioButton; + static create: (context: PDFContext) => PDFAcroRadioButton; + setValue(value: PDFName): void; + getValue(): PDFName; + getOnValues(): PDFName[]; +} +export default PDFAcroRadioButton; +//# sourceMappingURL=PDFAcroRadioButton.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroRadioButton.d.ts.map b/cjs/core/acroform/PDFAcroRadioButton.d.ts.map new file mode 100644 index 000000000..f59fbdb78 --- /dev/null +++ b/cjs/core/acroform/PDFAcroRadioButton.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroRadioButton.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroRadioButton.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,0BAAgC;AAC7C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,aAAa,wBAAwC;AAC5D,OAAO,UAAU,sBAA4B;AAI7C,cAAM,kBAAmB,SAAQ,aAAa;IAC5C,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,wBACT;IAEpC,MAAM,CAAC,MAAM,YAAa,UAAU,wBAQlC;IAEF,QAAQ,CAAC,KAAK,EAAE,OAAO;IAgBvB,QAAQ,IAAI,OAAO;IAMnB,WAAW,IAAI,OAAO,EAAE;CAWzB;AAED,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroRadioButton.js b/cjs/core/acroform/PDFAcroRadioButton.js new file mode 100644 index 000000000..18b4f5dda --- /dev/null +++ b/cjs/core/acroform/PDFAcroRadioButton.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroButton_1 = tslib_1.__importDefault(require("./PDFAcroButton")); +var flags_1 = require("./flags"); +var errors_1 = require("../errors"); +var PDFAcroRadioButton = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroRadioButton, _super); + function PDFAcroRadioButton() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroRadioButton.prototype.setValue = function (value) { + var onValues = this.getOnValues(); + if (!onValues.includes(value) && value !== PDFName_1.default.of('Off')) { + throw new errors_1.InvalidAcroFieldValueError(); + } + this.dict.set(PDFName_1.default.of('V'), value); + var widgets = this.getWidgets(); + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var widget = widgets[idx]; + var state = widget.getOnValue() === value ? value : PDFName_1.default.of('Off'); + widget.setAppearanceState(state); + } + }; + PDFAcroRadioButton.prototype.getValue = function () { + var v = this.V(); + if (v instanceof PDFName_1.default) + return v; + return PDFName_1.default.of('Off'); + }; + PDFAcroRadioButton.prototype.getOnValues = function () { + var widgets = this.getWidgets(); + var onValues = []; + for (var idx = 0, len = widgets.length; idx < len; idx++) { + var onValue = widgets[idx].getOnValue(); + if (onValue) + onValues.push(onValue); + } + return onValues; + }; + PDFAcroRadioButton.fromDict = function (dict, ref) { + return new PDFAcroRadioButton(dict, ref); + }; + PDFAcroRadioButton.create = function (context) { + var dict = context.obj({ + FT: 'Btn', + Ff: flags_1.AcroButtonFlags.Radio, + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroRadioButton(dict, ref); + }; + return PDFAcroRadioButton; +}(PDFAcroButton_1.default)); +exports.default = PDFAcroRadioButton; +//# sourceMappingURL=PDFAcroRadioButton.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroRadioButton.js.map b/cjs/core/acroform/PDFAcroRadioButton.js.map new file mode 100644 index 000000000..7346f972e --- /dev/null +++ b/cjs/core/acroform/PDFAcroRadioButton.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroRadioButton.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroRadioButton.ts"],"names":[],"mappings":";;;AAEA,uEAA+C;AAC/C,0EAA4D;AAE5D,iCAA0D;AAC1D,oCAA6D;AAE7D;IAAiC,8CAAa;IAA9C;;IA+CA,CAAC;IAjCC,qCAAQ,GAAR,UAAS,KAAc;QACrB,IAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;YAC5D,MAAM,IAAI,mCAA0B,EAAE,CAAC;SACxC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAEtC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,I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CAAC,CAAC;QACnC,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;IAmCJ,yBAAC;CAAA,AA/CD,CAAiC,uBAAa,GA+C7C;AAED,kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroSignature.d.ts b/cjs/core/acroform/PDFAcroSignature.d.ts new file mode 100644 index 000000000..2c7c2228a --- /dev/null +++ b/cjs/core/acroform/PDFAcroSignature.d.ts @@ -0,0 +1,8 @@ +import PDFDict from "../objects/PDFDict"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroTerminal from "./PDFAcroTerminal"; +declare class PDFAcroSignature extends PDFAcroTerminal { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroSignature; +} +export default PDFAcroSignature; +//# sourceMappingURL=PDFAcroSignature.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroSignature.d.ts.map b/cjs/core/acroform/PDFAcroSignature.d.ts.map new file mode 100644 index 000000000..bca4933f8 --- /dev/null +++ b/cjs/core/acroform/PDFAcroSignature.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroSignature.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroSignature.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,eAAe,0BAA0C;AAEhE,cAAM,gBAAiB,SAAQ,eAAe;IAC5C,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,sBACX;CACnC;AAED,eAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroSignature.js b/cjs/core/acroform/PDFAcroSignature.js new file mode 100644 index 000000000..1a40bb88c --- /dev/null +++ b/cjs/core/acroform/PDFAcroSignature.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroTerminal_1 = tslib_1.__importDefault(require("./PDFAcroTerminal")); +var PDFAcroSignature = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroSignature, _super); + function PDFAcroSignature() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroSignature.fromDict = function (dict, ref) { + return new PDFAcroSignature(dict, ref); + }; + return PDFAcroSignature; +}(PDFAcroTerminal_1.default)); +exports.default = PDFAcroSignature; +//# sourceMappingURL=PDFAcroSignature.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroSignature.js.map b/cjs/core/acroform/PDFAcroSignature.js.map new file mode 100644 index 000000000..2ffe8b9c6 --- /dev/null +++ b/cjs/core/acroform/PDFAcroSignature.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroSignature.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroSignature.ts"],"names":[],"mappings":";;;AAEA,8EAAgE;AAEhE;IAA+B,4CAAe;IAA9C;;IAGA,CAAC;IAFQ,yBAAQ,GAAG,UAAC,IAAa,EAAE,GAAW;QAC3C,OAAA,IAAI,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC;IAA/B,CAA+B,CAAC;IACpC,uBAAC;CAAA,AAHD,CAA+B,yBAAe,GAG7C;AAED,kBAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroTerminal.d.ts b/cjs/core/acroform/PDFAcroTerminal.d.ts new file mode 100644 index 000000000..d31c2b66e --- /dev/null +++ b/cjs/core/acroform/PDFAcroTerminal.d.ts @@ -0,0 +1,17 @@ +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroField from "./PDFAcroField"; +import PDFWidgetAnnotation from "../annotation/PDFWidgetAnnotation"; +declare class PDFAcroTerminal extends PDFAcroField { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroTerminal; + FT(): PDFName; + getWidgets(): PDFWidgetAnnotation[]; + addWidget(ref: PDFRef): void; + removeWidget(idx: number): void; + normalizedEntries(): { + Kids: import("../objects/PDFArray").default; + }; +} +export default PDFAcroTerminal; +//# sourceMappingURL=PDFAcroTerminal.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroTerminal.d.ts.map b/cjs/core/acroform/PDFAcroTerminal.d.ts.map new file mode 100644 index 000000000..70c64ca08 --- /dev/null +++ b/cjs/core/acroform/PDFAcroTerminal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroTerminal.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroTerminal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,YAAY,uBAAuC;AAC1D,OAAO,mBAAmB,0CAAgD;AAG1E,cAAM,eAAgB,SAAQ,YAAY;IACxC,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,qBACZ;IAEjC,EAAE,IAAI,OAAO;IAKb,UAAU,IAAI,mBAAmB,EAAE;IAgBnC,SAAS,CAAC,GAAG,EAAE,MAAM;IAKrB,YAAY,CAAC,GAAG,EAAE,MAAM;IAgBxB,iBAAiB;;;CAelB;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroTerminal.js b/cjs/core/acroform/PDFAcroTerminal.js new file mode 100644 index 000000000..14b65883c --- /dev/null +++ b/cjs/core/acroform/PDFAcroTerminal.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroField_1 = tslib_1.__importDefault(require("./PDFAcroField")); +var PDFWidgetAnnotation_1 = tslib_1.__importDefault(require("../annotation/PDFWidgetAnnotation")); +var errors_1 = require("../errors"); +var PDFAcroTerminal = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroTerminal, _super); + function PDFAcroTerminal() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroTerminal.prototype.FT = function () { + var nameOrRef = this.getInheritableAttribute(PDFName_1.default.of('FT')); + return this.dict.context.lookup(nameOrRef, PDFName_1.default); + }; + PDFAcroTerminal.prototype.getWidgets = function () { + var kidDicts = this.Kids(); + // This field is itself a widget + if (!kidDicts) + return [PDFWidgetAnnotation_1.default.fromDict(this.dict)]; + // This field's kids are its widgets + var widgets = new Array(kidDicts.size()); + for (var idx = 0, len = kidDicts.size(); idx < len; idx++) { + var dict = kidDicts.lookup(idx, PDFDict_1.default); + widgets[idx] = PDFWidgetAnnotation_1.default.fromDict(dict); + } + return widgets; + }; + PDFAcroTerminal.prototype.addWidget = function (ref) { + var Kids = this.normalizedEntries().Kids; + Kids.push(ref); + }; + PDFAcroTerminal.prototype.removeWidget = function (idx) { + var kidDicts = this.Kids(); + if (!kidDicts) { + // This field is itself a widget + if (idx !== 0) + throw new errors_1.IndexOutOfBoundsError(idx, 0, 0); + this.setKids([]); + } + else { + // This field's kids are its widgets + if (idx < 0 || idx > kidDicts.size()) { + throw new errors_1.IndexOutOfBoundsError(idx, 0, kidDicts.size()); + } + kidDicts.remove(idx); + } + }; + PDFAcroTerminal.prototype.normalizedEntries = function () { + var Kids = this.Kids(); + // If this field is itself a widget (because it was only rendered once in + // the document, so the field and widget properties were merged) then we + // add itself to the `Kids` array. The alternative would be to try + // splitting apart the widget properties and creating a separate object + // for them. + if (!Kids) { + Kids = this.dict.context.obj([this.ref]); + this.dict.set(PDFName_1.default.of('Kids'), Kids); + } + return { Kids: Kids }; + }; + PDFAcroTerminal.fromDict = function (dict, ref) { + return new PDFAcroTerminal(dict, ref); + }; + return PDFAcroTerminal; +}(PDFAcroField_1.default)); +exports.default = PDFAcroTerminal; +//# sourceMappingURL=PDFAcroTerminal.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroTerminal.js.map b/cjs/core/acroform/PDFAcroTerminal.js.map new file mode 100644 index 000000000..348b9b627 --- /dev/null +++ b/cjs/core/acroform/PDFAcroTerminal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroTerminal.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroTerminal.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,uEAA+C;AAE/C,wEAA0D;AAC1D,kGAA0E;AAC1E,oCAAwD;AAExD;IAA8B,2CAAY;IAA1C;;IA6DA,CAAC;IAzDC,4BAAE,GAAF;QACE,IAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAO,CAAC,CAAC;IACtD,CAAC;IAED,oCAAU,GAAV;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE7B,gCAAgC;QAChC,IAAI,CAAC,QAAQ;YAAE,OAAO,CAAC,6BAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEhE,oCAAoC;QACpC,IAAM,OAAO,GAAG,IAAI,KAAK,CAAsB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACzD,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAO,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,6BAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACnD;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,mCAAS,GAAT,UAAU,GAAW;QACX,IAAA,IAAI,GA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A2DnC,sBAAC;CAAA,AA7DD,CAA8B,sBAAY,GA6DzC;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroText.d.ts b/cjs/core/acroform/PDFAcroText.d.ts new file mode 100644 index 000000000..cfddaf530 --- /dev/null +++ b/cjs/core/acroform/PDFAcroText.d.ts @@ -0,0 +1,23 @@ +import PDFContext from "../PDFContext"; +import PDFDict from "../objects/PDFDict"; +import PDFNumber from "../objects/PDFNumber"; +import PDFString from "../objects/PDFString"; +import PDFHexString from "../objects/PDFHexString"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroTerminal from "./PDFAcroTerminal"; +declare class PDFAcroText extends PDFAcroTerminal { + static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroText; + static create: (context: PDFContext) => PDFAcroText; + MaxLen(): PDFNumber | undefined; + Q(): PDFNumber | undefined; + setMaxLength(maxLength: number): void; + removeMaxLength(): void; + getMaxLength(): number | undefined; + setQuadding(quadding: 0 | 1 | 2): void; + getQuadding(): number | undefined; + setValue(value: PDFHexString | PDFString): void; + removeValue(): void; + getValue(): PDFString | PDFHexString | undefined; +} +export default PDFAcroText; +//# sourceMappingURL=PDFAcroText.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroText.d.ts.map b/cjs/core/acroform/PDFAcroText.d.ts.map new file mode 100644 index 000000000..14ca84993 --- /dev/null +++ b/cjs/core/acroform/PDFAcroText.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroText.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroText.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,sBAA4B;AAC7C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,YAAY,gCAAsC;AAEzD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,eAAe,0BAA0C;AAEhE,cAAM,WAAY,SAAQ,eAAe;IACvC,MAAM,CAAC,QAAQ,SAAU,OAAO,OAAO,MAAM,iBAAgC;IAE7E,MAAM,CAAC,MAAM,YAAa,UAAU,iBAOlC;IAEF,MAAM,IAAI,SAAS,GAAG,SAAS;IAM/B,CAAC,IAAI,SAAS,GAAG,SAAS;IAM1B,YAAY,CAAC,SAAS,EAAE,MAAM;IAI9B,eAAe;IAIf,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC,WAAW,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;IAI/B,WAAW,IAAI,MAAM,GAAG,SAAS;IAIjC,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAWxC,WAAW;IAIX,QAAQ,IAAI,SAAS,GAAG,YAAY,GAAG,SAAS;CAKjD;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroText.js b/cjs/core/acroform/PDFAcroText.js new file mode 100644 index 000000000..2ed195526 --- /dev/null +++ b/cjs/core/acroform/PDFAcroText.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFAcroTerminal_1 = tslib_1.__importDefault(require("./PDFAcroTerminal")); +var PDFAcroText = /** @class */ (function (_super) { + tslib_1.__extends(PDFAcroText, _super); + function PDFAcroText() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFAcroText.prototype.MaxLen = function () { + var maxLen = this.dict.lookup(PDFName_1.default.of('MaxLen')); + if (maxLen instanceof PDFNumber_1.default) + return maxLen; + return undefined; + }; + PDFAcroText.prototype.Q = function () { + var q = this.dict.lookup(PDFName_1.default.of('Q')); + if (q instanceof PDFNumber_1.default) + return q; + return undefined; + }; + PDFAcroText.prototype.setMaxLength = function (maxLength) { + this.dict.set(PDFName_1.default.of('MaxLen'), PDFNumber_1.default.of(maxLength)); + }; + PDFAcroText.prototype.removeMaxLength = function () { + this.dict.delete(PDFName_1.default.of('MaxLen')); + }; + PDFAcroText.prototype.getMaxLength = function () { + var _a; + return (_a = this.MaxLen()) === null || _a === void 0 ? void 0 : _a.asNumber(); + }; + PDFAcroText.prototype.setQuadding = function (quadding) { + this.dict.set(PDFName_1.default.of('Q'), PDFNumber_1.default.of(quadding)); + }; + PDFAcroText.prototype.getQuadding = function () { + var _a; + return (_a = this.Q()) === null || _a === void 0 ? void 0 : _a.asNumber(); + }; + PDFAcroText.prototype.setValue = function (value) { + this.dict.set(PDFName_1.default.of('V'), value); + // const widgets = this.getWidgets(); + // for (let idx = 0, len = widgets.length; idx < len; idx++) { + // const widget = widgets[idx]; + // const state = widget.getOnValue() === value ? value : PDFName.of('Off'); + // widget.setAppearanceState(state); + // } + }; + PDFAcroText.prototype.removeValue = function () { + this.dict.delete(PDFName_1.default.of('V')); + }; + PDFAcroText.prototype.getValue = function () { + var v = this.V(); + if (v instanceof PDFString_1.default || v instanceof PDFHexString_1.default) + return v; + return undefined; + }; + PDFAcroText.fromDict = function (dict, ref) { return new PDFAcroText(dict, ref); }; + PDFAcroText.create = function (context) { + var dict = context.obj({ + FT: 'Tx', + Kids: [], + }); + var ref = context.register(dict); + return new PDFAcroText(dict, ref); + }; + return PDFAcroText; +}(PDFAcroTerminal_1.default)); +exports.default = PDFAcroText; +//# sourceMappingURL=PDFAcroText.js.map \ No newline at end of file diff --git a/cjs/core/acroform/PDFAcroText.js.map b/cjs/core/acroform/PDFAcroText.js.map new file mode 100644 index 000000000..0745e1cd3 --- /dev/null +++ b/cjs/core/acroform/PDFAcroText.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAcroText.js","sourceRoot":"","sources":["../../../src/core/acroform/PDFAcroText.ts"],"names":[],"mappings":";;;AAEA,2EAAmD;AACn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QACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAEtC,qCAAqC;QACrC,8DAA8D;QAC9D,iCAAiC;QACjC,6EAA6E;QAC7E,sCAAsC;QACtC,IAAI;IACN,CAAC;IAED,iCAAW,GAAX;QACE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,8BAAQ,GAAR;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,mBAAS,IAAI,CAAC,YAAY,sBAAY;YAAE,OAAO,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC;IA9DM,oBAAQ,GAAG,UAAC,IAAa,EAAE,GAAW,IAAK,OAAA,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,EAA1B,CAA0B,CAAC;IAEtE,kBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,IAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC,CAAC;IAsDJ,kBAAC;CAAA,AAhED,CAA0B,yBAAe,GAgExC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/flags.d.ts b/cjs/core/acroform/flags.d.ts new file mode 100644 index 000000000..72deabfba --- /dev/null +++ b/cjs/core/acroform/flags.d.ts @@ -0,0 +1,142 @@ +/** From PDF spec table 221 */ +export declare enum AcroFieldFlags { + /** + * If set, the user may not change the value of the field. Any associated + * widget annotations will not interact with the user; that is, they will not + * respond to mouse clicks or change their appearance in response to mouse + * motions. This flag is useful for fields whose values are computed or + * imported from a database. + */ + ReadOnly, + /** + * If set, the field shall have a value at the time it is exported by a + * submit-form action (see 12.7.5.2, "Submit-Form Action"). + */ + Required, + /** + * If set, the field shall not be exported by a submit-form action + * (see 12.7.5.2, "Submit-Form Action"). + */ + NoExport +} +/** From PDF spec table 226 */ +export declare enum AcroButtonFlags { + /** + * (Radio buttons only) If set, exactly one radio button shall be selected at + * all times; selecting the currently selected button has no effect. If clear, + * clicking the selected button deselects it, leaving no button selected. + */ + NoToggleToOff, + /** + * If set, the field is a set of radio buttons; if clear, the field is a check + * box. This flag may be set only if the Pushbutton flag is clear. + */ + Radio, + /** + * If set, the field is a pushbutton that does not retain a permanent value. + */ + PushButton, + /** + * If set, a group of radio buttons within a radio button field that use the + * same value for the on state will turn on and off in unison; that is if one + * is checked, they are all checked. If clear, the buttons are mutually + * exclusive (the same behavior as HTML radio buttons). + */ + RadiosInUnison +} +/** From PDF spec table 228 */ +export declare enum AcroTextFlags { + /** + * If set, the field may contain multiple lines of text; if clear, the field's + * text shall be restricted to a single line. + */ + Multiline, + /** + * If set, the field is intended for entering a secure password that should + * not be echoed visibly to the screen. Characters typed from the keyboard + * shall instead be echoed in some unreadable form, such as asterisks or + * bullet characters. + * > NOTE To protect password confidentiality, readers should never store + * > the value of the text field in the PDF file if this flag is set. + */ + Password, + /** + * If set, the text entered in the field represents the pathname of a file + * whose contents shall be submitted as the value of the field. + */ + FileSelect, + /** + * If set, text entered in the field shall not be spell-checked. + */ + DoNotSpellCheck, + /** + * If set, the field shall not scroll (horizontally for single-line fields, + * vertically for multiple-line fields) to accommodate more text than fits + * within its annotation rectangle. Once the field is full, no further text + * shall be accepted for interactive form filling; for non-interactive form + * filling, the filler should take care not to add more character than will + * visibly fit in the defined area. + */ + DoNotScroll, + /** + * May be set only if the MaxLen entry is present in the text field dictionary + * (see Table 229) and if the Multiline, Password, and FileSelect flags are + * clear. If set, the field shall be automatically divided into as many + * equally spaced positions, or combs, as the value of MaxLen, and the text + * is laid out into those combs. + */ + Comb, + /** + * If set, the value of this field shall be a rich text string + * (see 12.7.3.4, "Rich Text Strings"). If the field has a value, the RV + * entry of the field dictionary (Table 222) shall specify the rich text + * string. + */ + RichText +} +/** From PDF spec table 230 */ +export declare enum AcroChoiceFlags { + /** + * If set, the field is a combo box; if clear, the field is a list box. + */ + Combo, + /** + * If set, the combo box shall include an editable text box as well as a + * drop-down list; if clear, it shall include only a drop-down list. This + * flag shall be used only if the Combo flag is set. + */ + Edit, + /** + * If set, the field's option items shall be sorted alphabetically. This flag + * is intended for use by writers, not by readers. Conforming readers shall + * display the options in the order in which they occur in the Opt array + * (see Table 231). + */ + Sort, + /** + * If set, more than one of the field's option items may be selected + * simultaneously; if clear, at most one item shall be selected. + */ + MultiSelect, + /** + * If set, text entered in the field shall not be spell-checked. This flag + * shall not be used unless the Combo and Edit flags are both set. + */ + DoNotSpellCheck, + /** + * If set, the new value shall be committed as soon as a selection is made + * (commonly with the pointing device). In this case, supplying a value for + * a field involves three actions: selecting the field for fill-in, + * selecting a choice for the fill-in value, and leaving that field, which + * finalizes or "commits" the data choice and triggers any actions associated + * with the entry or changing of this data. If this flag is on, then + * processing does not wait for leaving the field action to occur, but + * immediately proceeds to the third step. + * + * This option enables applications to perform an action once a selection is + * made, without requiring the user to exit the field. If clear, the new + * value is not committed until the user exits the field. + */ + CommitOnSelChange +} +//# sourceMappingURL=flags.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/flags.d.ts.map b/cjs/core/acroform/flags.d.ts.map new file mode 100644 index 000000000..bf0858ba6 --- /dev/null +++ b/cjs/core/acroform/flags.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/flags.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,oBAAY,cAAc;IACxB;;;;;;OAMG;IACH,QAAsB;IAEtB;;;OAGG;IACH,QAAsB;IAEtB;;;OAGG;IACH,QAAsB;CACvB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB;;;;OAIG;IACH,aAA4B;IAE5B;;;OAGG;IACH,KAAoB;IAEpB;;OAEG;IACH,UAAyB;IAEzB;;;;;OAKG;IACH,cAA6B;CAC9B;AAED,8BAA8B;AAC9B,oBAAY,aAAa;IACvB;;;OAGG;IACH,SAAwB;IAExB;;;;;;;OAOG;IACH,QAAuB;IAEvB;;;OAGG;IACH,UAAyB;IAEzB;;OAEG;IACH,eAA8B;IAE9B;;;;;;;OAOG;IACH,WAA0B;IAE1B;;;;;;OAMG;IACH,IAAmB;IAEnB;;;;;OAKG;IACH,QAAuB;CACxB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB;;OAEG;IACH,KAAoB;IAEpB;;;;OAIG;IACH,IAAmB;IAEnB;;;;;OAKG;IACH,IAAmB;IAEnB;;;OAGG;IACH,WAA0B;IAE1B;;;OAGG;IACH,eAA8B;IAE9B;;;;;;;;;;;;;OAaG;IACH,iBAAgC;CACjC"} \ No newline at end of file diff --git a/cjs/core/acroform/flags.js b/cjs/core/acroform/flags.js new file mode 100644 index 000000000..e3bc9e8af --- /dev/null +++ b/cjs/core/acroform/flags.js @@ -0,0 +1,150 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AcroChoiceFlags = exports.AcroTextFlags = exports.AcroButtonFlags = exports.AcroFieldFlags = void 0; +var flag = function (bitIndex) { return 1 << bitIndex; }; +/** From PDF spec table 221 */ +var AcroFieldFlags; +(function (AcroFieldFlags) { + /** + * If set, the user may not change the value of the field. Any associated + * widget annotations will not interact with the user; that is, they will not + * respond to mouse clicks or change their appearance in response to mouse + * motions. This flag is useful for fields whose values are computed or + * imported from a database. + */ + AcroFieldFlags[AcroFieldFlags["ReadOnly"] = flag(1 - 1)] = "ReadOnly"; + /** + * If set, the field shall have a value at the time it is exported by a + * submit-form action (see 12.7.5.2, "Submit-Form Action"). + */ + AcroFieldFlags[AcroFieldFlags["Required"] = flag(2 - 1)] = "Required"; + /** + * If set, the field shall not be exported by a submit-form action + * (see 12.7.5.2, "Submit-Form Action"). + */ + AcroFieldFlags[AcroFieldFlags["NoExport"] = flag(3 - 1)] = "NoExport"; +})(AcroFieldFlags = exports.AcroFieldFlags || (exports.AcroFieldFlags = {})); +/** From PDF spec table 226 */ +var AcroButtonFlags; +(function (AcroButtonFlags) { + /** + * (Radio buttons only) If set, exactly one radio button shall be selected at + * all times; selecting the currently selected button has no effect. If clear, + * clicking the selected button deselects it, leaving no button selected. + */ + AcroButtonFlags[AcroButtonFlags["NoToggleToOff"] = flag(15 - 1)] = "NoToggleToOff"; + /** + * If set, the field is a set of radio buttons; if clear, the field is a check + * box. This flag may be set only if the Pushbutton flag is clear. + */ + AcroButtonFlags[AcroButtonFlags["Radio"] = flag(16 - 1)] = "Radio"; + /** + * If set, the field is a pushbutton that does not retain a permanent value. + */ + AcroButtonFlags[AcroButtonFlags["PushButton"] = flag(17 - 1)] = "PushButton"; + /** + * If set, a group of radio buttons within a radio button field that use the + * same value for the on state will turn on and off in unison; that is if one + * is checked, they are all checked. If clear, the buttons are mutually + * exclusive (the same behavior as HTML radio buttons). + */ + AcroButtonFlags[AcroButtonFlags["RadiosInUnison"] = flag(26 - 1)] = "RadiosInUnison"; +})(AcroButtonFlags = exports.AcroButtonFlags || (exports.AcroButtonFlags = {})); +/** From PDF spec table 228 */ +var AcroTextFlags; +(function (AcroTextFlags) { + /** + * If set, the field may contain multiple lines of text; if clear, the field's + * text shall be restricted to a single line. + */ + AcroTextFlags[AcroTextFlags["Multiline"] = flag(13 - 1)] = "Multiline"; + /** + * If set, the field is intended for entering a secure password that should + * not be echoed visibly to the screen. Characters typed from the keyboard + * shall instead be echoed in some unreadable form, such as asterisks or + * bullet characters. + * > NOTE To protect password confidentiality, readers should never store + * > the value of the text field in the PDF file if this flag is set. + */ + AcroTextFlags[AcroTextFlags["Password"] = flag(14 - 1)] = "Password"; + /** + * If set, the text entered in the field represents the pathname of a file + * whose contents shall be submitted as the value of the field. + */ + AcroTextFlags[AcroTextFlags["FileSelect"] = flag(21 - 1)] = "FileSelect"; + /** + * If set, text entered in the field shall not be spell-checked. + */ + AcroTextFlags[AcroTextFlags["DoNotSpellCheck"] = flag(23 - 1)] = "DoNotSpellCheck"; + /** + * If set, the field shall not scroll (horizontally for single-line fields, + * vertically for multiple-line fields) to accommodate more text than fits + * within its annotation rectangle. Once the field is full, no further text + * shall be accepted for interactive form filling; for non-interactive form + * filling, the filler should take care not to add more character than will + * visibly fit in the defined area. + */ + AcroTextFlags[AcroTextFlags["DoNotScroll"] = flag(24 - 1)] = "DoNotScroll"; + /** + * May be set only if the MaxLen entry is present in the text field dictionary + * (see Table 229) and if the Multiline, Password, and FileSelect flags are + * clear. If set, the field shall be automatically divided into as many + * equally spaced positions, or combs, as the value of MaxLen, and the text + * is laid out into those combs. + */ + AcroTextFlags[AcroTextFlags["Comb"] = flag(25 - 1)] = "Comb"; + /** + * If set, the value of this field shall be a rich text string + * (see 12.7.3.4, "Rich Text Strings"). If the field has a value, the RV + * entry of the field dictionary (Table 222) shall specify the rich text + * string. + */ + AcroTextFlags[AcroTextFlags["RichText"] = flag(26 - 1)] = "RichText"; +})(AcroTextFlags = exports.AcroTextFlags || (exports.AcroTextFlags = {})); +/** From PDF spec table 230 */ +var AcroChoiceFlags; +(function (AcroChoiceFlags) { + /** + * If set, the field is a combo box; if clear, the field is a list box. + */ + AcroChoiceFlags[AcroChoiceFlags["Combo"] = flag(18 - 1)] = "Combo"; + /** + * If set, the combo box shall include an editable text box as well as a + * drop-down list; if clear, it shall include only a drop-down list. This + * flag shall be used only if the Combo flag is set. + */ + AcroChoiceFlags[AcroChoiceFlags["Edit"] = flag(19 - 1)] = "Edit"; + /** + * If set, the field's option items shall be sorted alphabetically. This flag + * is intended for use by writers, not by readers. Conforming readers shall + * display the options in the order in which they occur in the Opt array + * (see Table 231). + */ + AcroChoiceFlags[AcroChoiceFlags["Sort"] = flag(20 - 1)] = "Sort"; + /** + * If set, more than one of the field's option items may be selected + * simultaneously; if clear, at most one item shall be selected. + */ + AcroChoiceFlags[AcroChoiceFlags["MultiSelect"] = flag(22 - 1)] = "MultiSelect"; + /** + * If set, text entered in the field shall not be spell-checked. This flag + * shall not be used unless the Combo and Edit flags are both set. + */ + AcroChoiceFlags[AcroChoiceFlags["DoNotSpellCheck"] = flag(23 - 1)] = "DoNotSpellCheck"; + /** + * If set, the new value shall be committed as soon as a selection is made + * (commonly with the pointing device). In this case, supplying a value for + * a field involves three actions: selecting the field for fill-in, + * selecting a choice for the fill-in value, and leaving that field, which + * finalizes or "commits" the data choice and triggers any actions associated + * with the entry or changing of this data. If this flag is on, then + * processing does not wait for leaving the field action to occur, but + * immediately proceeds to the third step. + * + * This option enables applications to perform an action once a selection is + * made, without requiring the user to exit the field. If clear, the new + * value is not committed until the user exits the field. + */ + AcroChoiceFlags[AcroChoiceFlags["CommitOnSelChange"] = flag(27 - 1)] = "CommitOnSelChange"; +})(AcroChoiceFlags = exports.AcroChoiceFlags || (exports.AcroChoiceFlags = {})); +//# sourceMappingURL=flags.js.map \ No newline at end of file diff --git a/cjs/core/acroform/flags.js.map b/cjs/core/acroform/flags.js.map new file mode 100644 index 000000000..41f62f793 --- /dev/null +++ b/cjs/core/acroform/flags.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/core/acroform/flags.ts"],"names":[],"mappings":";;;AAAA,IAAM,IAAI,GAAG,UAAC,QAAgB,IAAK,OAAA,CAAC,IAAI,QAAQ,EAAb,CAAa,CAAC;AAEjD,8BAA8B;AAC9B,IAAY,cAqBX;AArBD,WAAY,cAAc;IACxB;;;;;;OAMG;IACH,4CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;OAGG;IACH,4CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;OAGG;IACH,4CAAW,IAAI,CAAC,CAAC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zB;;OAEG;IACH,2CAAQ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,WAAA,CAAA;IAEpB;;;;OAIG;IACH,0CAAO,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,UAAA,CAAA;IAEnB;;;;;OAKG;IACH,0CAAO,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,UAAA,CAAA;IAEnB;;;OAGG;IACH,iDAAc,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,iBAAA,CAAA;IAE1B;;;OAGG;IACH,qDAAkB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,qBAAA,CAAA;IAE9B;;;;;;;;;;;;;OAaG;IACH,uDAAoB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,uBAAA,CAAA;AAClC,CAAC,EAhDW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAgD1B"} \ No newline at end of file diff --git a/cjs/core/acroform/index.d.ts b/cjs/core/acroform/index.d.ts new file mode 100644 index 000000000..48d2cff7f --- /dev/null +++ b/cjs/core/acroform/index.d.ts @@ -0,0 +1,16 @@ +export { default as PDFAcroButton } from "./PDFAcroButton"; +export { default as PDFAcroCheckBox } from "./PDFAcroCheckBox"; +export { default as PDFAcroChoice } from "./PDFAcroChoice"; +export { default as PDFAcroComboBox } from "./PDFAcroComboBox"; +export { default as PDFAcroField } from "./PDFAcroField"; +export { default as PDFAcroForm } from "./PDFAcroForm"; +export { default as PDFAcroListBox } from "./PDFAcroListBox"; +export { default as PDFAcroNonTerminal } from "./PDFAcroNonTerminal"; +export { default as PDFAcroPushButton } from "./PDFAcroPushButton"; +export { default as PDFAcroRadioButton } from "./PDFAcroRadioButton"; +export { default as PDFAcroSignature } from "./PDFAcroSignature"; +export { default as PDFAcroTerminal } from "./PDFAcroTerminal"; +export { default as PDFAcroText } from "./PDFAcroText"; +export * from "./flags"; +export * from "./utils"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/index.d.ts.map b/cjs/core/acroform/index.d.ts.map new file mode 100644 index 000000000..01d47bef5 --- /dev/null +++ b/cjs/core/acroform/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAe+N,iBAAiB,CAfxM;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAc8O,mBAAmB,CAdvN;AAC/E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAamQ,iBAAiB,CAb5O;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAYkR,mBAAmB,CAZ3P;AAC/E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAWwS,gBAAgB,CAXjR;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAUyT,eAAe,CAVlS;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MASqU,kBAAkB,CAT9S;AAC7E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAQmV,sBAAsB,CAR5T;AACrF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAO0W,qBAAqB,CAPnV;AACnF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAM8X,sBAAsB,CANvW;AACrF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAKsZ,oBAAoB,CAL/X;AACjF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAI2a,mBAAmB,CAJpZ;AAC/E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAGkc,eAAe,CAH3a;AACvE,cAEkf,SAAS,CAFnd;AACxC,cAC2f,SAAS,CAD5d"} \ No newline at end of file diff --git a/cjs/core/acroform/index.js b/cjs/core/acroform/index.js new file mode 100644 index 000000000..170578111 --- /dev/null +++ b/cjs/core/acroform/index.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAcroButton_1 = require("./PDFAcroButton"); +Object.defineProperty(exports, "PDFAcroButton", { enumerable: true, get: function () { return PDFAcroButton_1.default; } }); +var PDFAcroCheckBox_1 = require("./PDFAcroCheckBox"); +Object.defineProperty(exports, "PDFAcroCheckBox", { enumerable: true, get: function () { return PDFAcroCheckBox_1.default; } }); +var PDFAcroChoice_1 = require("./PDFAcroChoice"); +Object.defineProperty(exports, "PDFAcroChoice", { enumerable: true, get: function () { return PDFAcroChoice_1.default; } }); +var PDFAcroComboBox_1 = require("./PDFAcroComboBox"); +Object.defineProperty(exports, "PDFAcroComboBox", { enumerable: true, get: function () { return PDFAcroComboBox_1.default; } }); +var PDFAcroField_1 = require("./PDFAcroField"); +Object.defineProperty(exports, "PDFAcroField", { enumerable: true, get: function () { return PDFAcroField_1.default; } }); +var PDFAcroForm_1 = require("./PDFAcroForm"); +Object.defineProperty(exports, "PDFAcroForm", { enumerable: true, get: function () { return PDFAcroForm_1.default; } }); +var PDFAcroListBox_1 = require("./PDFAcroListBox"); +Object.defineProperty(exports, "PDFAcroListBox", { enumerable: true, get: function () { return PDFAcroListBox_1.default; } }); +var PDFAcroNonTerminal_1 = require("./PDFAcroNonTerminal"); +Object.defineProperty(exports, "PDFAcroNonTerminal", { enumerable: true, get: function () { return PDFAcroNonTerminal_1.default; } }); +var PDFAcroPushButton_1 = require("./PDFAcroPushButton"); +Object.defineProperty(exports, "PDFAcroPushButton", { enumerable: true, get: function () { return PDFAcroPushButton_1.default; } }); +var PDFAcroRadioButton_1 = require("./PDFAcroRadioButton"); +Object.defineProperty(exports, "PDFAcroRadioButton", { enumerable: true, get: function () { return PDFAcroRadioButton_1.default; } }); +var PDFAcroSignature_1 = require("./PDFAcroSignature"); +Object.defineProperty(exports, "PDFAcroSignature", { enumerable: true, get: function () { return PDFAcroSignature_1.default; } }); +var PDFAcroTerminal_1 = require("./PDFAcroTerminal"); +Object.defineProperty(exports, "PDFAcroTerminal", { enumerable: true, get: function () { return PDFAcroTerminal_1.default; } }); +var PDFAcroText_1 = require("./PDFAcroText"); +Object.defineProperty(exports, "PDFAcroText", { enumerable: true, get: function () { return PDFAcroText_1.default; } }); +tslib_1.__exportStar(require("./flags"), exports); +tslib_1.__exportStar(require("./utils"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/core/acroform/index.js.map b/cjs/core/acroform/index.js.map new file mode 100644 index 000000000..228cf9e20 --- /dev/null +++ b/cjs/core/acroform/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/acroform/index.ts"],"names":[],"mappings":";;;AAAA,iDAA2E;AAAlE,8GAAA,OAAO,OAAiB;AACjC,qDAA+E;AAAtE,kHAAA,OAAO,OAAmB;AACnC,iDAA2E;AAAlE,8GAAA,OAAO,OAAiB;AACjC,qDAA+E;AAAtE,kHAAA,OAAO,OAAmB;AACnC,+CAAyE;AAAhE,4GAAA,OAAO,OAAgB;AAChC,6CAAuE;AAA9D,0GAAA,OAAO,OAAe;AAC/B,mDAA6E;AAApE,gHAAA,OAAO,OAAkB;AAClC,2DAAqF;AAA5E,wHAAA,OAAO,OAAsB;AACtC,yDAAmF;AAA1E,sHAAA,OAAO,OAAqB;AACrC,2DAAqF;AAA5E,wHAAA,OAAO,OAAsB;AACtC,uDAAiF;AAAxE,oHAAA,OAAO,OAAoB;AACpC,qDAA+E;AAAtE,kHAAA,OAAO,OAAmB;AACnC,6CAAuE;AAA9D,0GAAA,OAAO,OAAe;AAC/B,kDAAwC;AACxC,kDAAwC"} \ No newline at end of file diff --git a/cjs/core/acroform/utils.d.ts b/cjs/core/acroform/utils.d.ts new file mode 100644 index 000000000..40e5168c8 --- /dev/null +++ b/cjs/core/acroform/utils.d.ts @@ -0,0 +1,7 @@ +import PDFDict from "../objects/PDFDict"; +import PDFArray from "../objects/PDFArray"; +import PDFRef from "../objects/PDFRef"; +import PDFAcroField from "./PDFAcroField"; +export declare const createPDFAcroFields: (kidDicts?: PDFArray | undefined) => [PDFAcroField, PDFRef][]; +export declare const createPDFAcroField: (dict: PDFDict, ref: PDFRef) => PDFAcroField; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/cjs/core/acroform/utils.d.ts.map b/cjs/core/acroform/utils.d.ts.map new file mode 100644 index 000000000..1679a074d --- /dev/null +++ b/cjs/core/acroform/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/acroform/utils.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,QAAQ,4BAAkC;AACjD,OAAO,MAAM,0BAAgC;AAE7C,OAAO,YAAY,uBAAuC;AAc1D,eAAO,MAAM,mBAAmB,uCAE7B,CAAC,YAAY,EAAE,MAAM,CAAC,EAcxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,SACvB,OAAO,OACR,MAAM,KACV,YAIF,CAAC"} \ No newline at end of file diff --git a/cjs/core/acroform/utils.js b/cjs/core/acroform/utils.js new file mode 100644 index 000000000..1b7c574b7 --- /dev/null +++ b/cjs/core/acroform/utils.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createPDFAcroField = exports.createPDFAcroFields = void 0; +var tslib_1 = require("tslib"); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFAcroTerminal_1 = tslib_1.__importDefault(require("./PDFAcroTerminal")); +var PDFAcroNonTerminal_1 = tslib_1.__importDefault(require("./PDFAcroNonTerminal")); +var PDFAcroSignature_1 = tslib_1.__importDefault(require("./PDFAcroSignature")); +var PDFAcroText_1 = tslib_1.__importDefault(require("./PDFAcroText")); +var PDFAcroPushButton_1 = tslib_1.__importDefault(require("./PDFAcroPushButton")); +var PDFAcroRadioButton_1 = tslib_1.__importDefault(require("./PDFAcroRadioButton")); +var PDFAcroCheckBox_1 = tslib_1.__importDefault(require("./PDFAcroCheckBox")); +var PDFAcroComboBox_1 = tslib_1.__importDefault(require("./PDFAcroComboBox")); +var PDFAcroListBox_1 = tslib_1.__importDefault(require("./PDFAcroListBox")); +var flags_1 = require("./flags"); +exports.createPDFAcroFields = function (kidDicts) { + if (!kidDicts) + return []; + var kids = []; + for (var idx = 0, len = kidDicts.size(); idx < len; idx++) { + var ref = kidDicts.get(idx); + var dict = kidDicts.lookup(idx); + // if (dict instanceof PDFDict) kids.push(PDFAcroField.fromDict(dict)); + if (ref instanceof PDFRef_1.default && dict instanceof PDFDict_1.default) { + kids.push([exports.createPDFAcroField(dict, ref), ref]); + } + } + return kids; +}; +exports.createPDFAcroField = function (dict, ref) { + var isNonTerminal = isNonTerminalAcroField(dict); + if (isNonTerminal) + return PDFAcroNonTerminal_1.default.fromDict(dict, ref); + return createPDFAcroTerminal(dict, ref); +}; +// TODO: Maybe just check if the dict is *not* a widget? That might be better. +// According to the PDF spec: +// +// > A field's children in the hierarchy may also include widget annotations +// > that define its appearance on the page. A field that has children that +// > are fields is called a non-terminal field. A field that does not have +// > children that are fields is called a terminal field. +// +// The spec is not entirely clear about how to determine whether a given +// dictionary represents an acrofield or a widget annotation. So we will assume +// that a dictionary is an acrofield if it is a member of the `/Kids` array +// and it contains a `/T` entry (widgets do not have `/T` entries). This isn't +// a bullet proof solution, because the `/T` entry is technically defined as +// optional for acrofields by the PDF spec. But in practice all acrofields seem +// to have a `/T` entry defined. +var isNonTerminalAcroField = function (dict) { + var kids = dict.lookup(PDFName_1.default.of('Kids')); + if (kids instanceof PDFArray_1.default) { + for (var idx = 0, len = kids.size(); idx < len; idx++) { + var kid = kids.lookup(idx); + var kidIsField = kid instanceof PDFDict_1.default && kid.has(PDFName_1.default.of('T')); + if (kidIsField) + return true; + } + } + return false; +}; +var createPDFAcroTerminal = function (dict, ref) { + var ftNameOrRef = getInheritableAttribute(dict, PDFName_1.default.of('FT')); + var type = dict.context.lookup(ftNameOrRef, PDFName_1.default); + if (type === PDFName_1.default.of('Btn')) + return createPDFAcroButton(dict, ref); + if (type === PDFName_1.default.of('Ch')) + return createPDFAcroChoice(dict, ref); + if (type === PDFName_1.default.of('Tx')) + return PDFAcroText_1.default.fromDict(dict, ref); + if (type === PDFName_1.default.of('Sig')) + return PDFAcroSignature_1.default.fromDict(dict, ref); + // We should never reach this line. But there are a lot of weird PDFs out + // there. So, just to be safe, we'll try to handle things gracefully instead + // of throwing an error. + return PDFAcroTerminal_1.default.fromDict(dict, ref); +}; +var createPDFAcroButton = function (dict, ref) { + var _a; + var ffNumberOrRef = getInheritableAttribute(dict, PDFName_1.default.of('Ff')); + var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber_1.default); + var flags = (_a = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a !== void 0 ? _a : 0; + if (flagIsSet(flags, flags_1.AcroButtonFlags.PushButton)) { + return PDFAcroPushButton_1.default.fromDict(dict, ref); + } + else if (flagIsSet(flags, flags_1.AcroButtonFlags.Radio)) { + return PDFAcroRadioButton_1.default.fromDict(dict, ref); + } + else { + return PDFAcroCheckBox_1.default.fromDict(dict, ref); + } +}; +var createPDFAcroChoice = function (dict, ref) { + var _a; + var ffNumberOrRef = getInheritableAttribute(dict, PDFName_1.default.of('Ff')); + var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber_1.default); + var flags = (_a = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a !== void 0 ? _a : 0; + if (flagIsSet(flags, flags_1.AcroChoiceFlags.Combo)) { + return PDFAcroComboBox_1.default.fromDict(dict, ref); + } + else { + return PDFAcroListBox_1.default.fromDict(dict, ref); + } +}; +var flagIsSet = function (flags, flag) { + return (flags & flag) !== 0; +}; +var getInheritableAttribute = function (startNode, name) { + var attribute; + ascend(startNode, function (node) { + if (!attribute) + attribute = node.get(name); + }); + return attribute; +}; +var ascend = function (startNode, visitor) { + visitor(startNode); + var Parent = startNode.lookupMaybe(PDFName_1.default.of('Parent'), PDFDict_1.default); + if (Parent) + ascend(Parent, visitor); +}; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/cjs/core/acroform/utils.js.map b/cjs/core/acroform/utils.js.map new file mode 100644 index 000000000..cf1320002 --- /dev/null +++ b/cjs/core/acroform/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/acroform/utils.ts"],"names":[],"mappings":";;;;AACA,2EAAmD;AACnD,uEAA+C;AAC/C,uEAA+C;AAC/C,yEAAiD;AACjD,qEAA6C;AAG7C,8EAAgE;AAChE,oFAAsE;AAEtE,gFAAkE;AAElE,sEAAwD;AACxD,kFAAoE;AACpE,oFAAsE;AACtE,8EAAgE;AAChE,8EAAgE;AAChE,4EAA8D;AAC9D,iCAA2E;AAE9D,QAAA,mBAAmB,GAAG,UACjC,QAAmB;IAEnB,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,IAAM,IAAI,GAA6B,EAAE,CAAC;IAC1C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;QACzD,IAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,uEAAuE;QACvE,IAAI,GAAG,YAAY,gBAAM,IAAI,IAAI,YAAY,iBAAO,EAAE;YACpD,IAAI,CAAC,IAAI,CAAC,CAAC,0BAAkB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC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AC;AAEF,IAAM,MAAM,GAAG,UAAC,SAAkB,EAAE,OAA+B;IACjE,OAAO,CAAC,SAAS,CAAC,CAAC;IACnB,IAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,iBAAO,CAAC,CAAC;IACpE,IAAI,MAAM;QAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/AppearanceCharacteristics.d.ts b/cjs/core/annotation/AppearanceCharacteristics.d.ts new file mode 100644 index 000000000..a8ad38121 --- /dev/null +++ b/cjs/core/annotation/AppearanceCharacteristics.d.ts @@ -0,0 +1,34 @@ +import PDFDict from "../objects/PDFDict"; +import PDFNumber from "../objects/PDFNumber"; +import PDFArray from "../objects/PDFArray"; +import PDFHexString from "../objects/PDFHexString"; +import PDFString from "../objects/PDFString"; +declare class AppearanceCharacteristics { + readonly dict: PDFDict; + static fromDict: (dict: PDFDict) => AppearanceCharacteristics; + protected constructor(dict: PDFDict); + R(): PDFNumber | undefined; + BC(): PDFArray | undefined; + BG(): PDFArray | undefined; + CA(): PDFHexString | PDFString | undefined; + RC(): PDFHexString | PDFString | undefined; + AC(): PDFHexString | PDFString | undefined; + getRotation(): number | undefined; + getBorderColor(): number[] | undefined; + getBackgroundColor(): number[] | undefined; + getCaptions(): { + normal?: string; + rollover?: string; + down?: string; + }; + setRotation(rotation: number): void; + setBorderColor(color: number[]): void; + setBackgroundColor(color: number[]): void; + setCaptions(captions: { + normal: string; + rollover?: string; + down?: string; + }): void; +} +export default AppearanceCharacteristics; +//# sourceMappingURL=AppearanceCharacteristics.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/AppearanceCharacteristics.d.ts.map b/cjs/core/annotation/AppearanceCharacteristics.d.ts.map new file mode 100644 index 000000000..984b96660 --- /dev/null +++ b/cjs/core/annotation/AppearanceCharacteristics.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AppearanceCharacteristics.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/AppearanceCharacteristics.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,YAAY,gCAAsC;AACzD,OAAO,SAAS,6BAAmC;AAEnD,cAAM,yBAAyB;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,yBAAyB,CACtB;IAEtC,SAAS,aAAa,IAAI,EAAE,OAAO;IAInC,CAAC,IAAI,SAAS,GAAG,SAAS;IAM1B,EAAE,IAAI,QAAQ,GAAG,SAAS;IAM1B,EAAE,IAAI,QAAQ,GAAG,SAAS;IAM1B,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,WAAW,IAAI,MAAM,GAAG,SAAS;IAIjC,cAAc,IAAI,MAAM,EAAE,GAAG,SAAS;IActC,kBAAkB,IAAI,MAAM,EAAE,GAAG,SAAS;IAc1C,WAAW,IAAI;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAYpE,WAAW,CAAC,QAAQ,EAAE,MAAM;IAK5B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;IAK9B,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE;IAKlC,WAAW,CAAC,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAkB3E;AAED,eAAe,yBAAyB,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/AppearanceCharacteristics.js b/cjs/core/annotation/AppearanceCharacteristics.js new file mode 100644 index 000000000..b368ae0a4 --- /dev/null +++ b/cjs/core/annotation/AppearanceCharacteristics.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var AppearanceCharacteristics = /** @class */ (function () { + function AppearanceCharacteristics(dict) { + this.dict = dict; + } + AppearanceCharacteristics.prototype.R = function () { + var R = this.dict.lookup(PDFName_1.default.of('R')); + if (R instanceof PDFNumber_1.default) + return R; + return undefined; + }; + AppearanceCharacteristics.prototype.BC = function () { + var BC = this.dict.lookup(PDFName_1.default.of('BC')); + if (BC instanceof PDFArray_1.default) + return BC; + return undefined; + }; + AppearanceCharacteristics.prototype.BG = function () { + var BG = this.dict.lookup(PDFName_1.default.of('BG')); + if (BG instanceof PDFArray_1.default) + return BG; + return undefined; + }; + AppearanceCharacteristics.prototype.CA = function () { + var CA = this.dict.lookup(PDFName_1.default.of('CA')); + if (CA instanceof PDFHexString_1.default || CA instanceof PDFString_1.default) + return CA; + return undefined; + }; + AppearanceCharacteristics.prototype.RC = function () { + var RC = this.dict.lookup(PDFName_1.default.of('RC')); + if (RC instanceof PDFHexString_1.default || RC instanceof PDFString_1.default) + return RC; + return undefined; + }; + AppearanceCharacteristics.prototype.AC = function () { + var AC = this.dict.lookup(PDFName_1.default.of('AC')); + if (AC instanceof PDFHexString_1.default || AC instanceof PDFString_1.default) + return AC; + return undefined; + }; + AppearanceCharacteristics.prototype.getRotation = function () { + var _a; + return (_a = this.R()) === null || _a === void 0 ? void 0 : _a.asNumber(); + }; + AppearanceCharacteristics.prototype.getBorderColor = function () { + var BC = this.BC(); + if (!BC) + return undefined; + var components = []; + for (var idx = 0, len = BC === null || BC === void 0 ? void 0 : BC.size(); idx < len; idx++) { + var component = BC.get(idx); + if (component instanceof PDFNumber_1.default) + components.push(component.asNumber()); + } + return components; + }; + AppearanceCharacteristics.prototype.getBackgroundColor = function () { + var BG = this.BG(); + if (!BG) + return undefined; + var components = []; + for (var idx = 0, len = BG === null || BG === void 0 ? void 0 : BG.size(); idx < len; idx++) { + var component = BG.get(idx); + if (component instanceof PDFNumber_1.default) + components.push(component.asNumber()); + } + return components; + }; + AppearanceCharacteristics.prototype.getCaptions = function () { + var CA = this.CA(); + var RC = this.RC(); + var AC = this.AC(); + return { + normal: CA === null || CA === void 0 ? void 0 : CA.decodeText(), + rollover: RC === null || RC === void 0 ? void 0 : RC.decodeText(), + down: AC === null || AC === void 0 ? void 0 : AC.decodeText(), + }; + }; + AppearanceCharacteristics.prototype.setRotation = function (rotation) { + var R = this.dict.context.obj(rotation); + this.dict.set(PDFName_1.default.of('R'), R); + }; + AppearanceCharacteristics.prototype.setBorderColor = function (color) { + var BC = this.dict.context.obj(color); + this.dict.set(PDFName_1.default.of('BC'), BC); + }; + AppearanceCharacteristics.prototype.setBackgroundColor = function (color) { + var BG = this.dict.context.obj(color); + this.dict.set(PDFName_1.default.of('BG'), BG); + }; + AppearanceCharacteristics.prototype.setCaptions = function (captions) { + var CA = PDFHexString_1.default.fromText(captions.normal); + this.dict.set(PDFName_1.default.of('CA'), CA); + if (captions.rollover) { + var RC = PDFHexString_1.default.fromText(captions.rollover); + this.dict.set(PDFName_1.default.of('RC'), RC); + } + else { + this.dict.delete(PDFName_1.default.of('RC')); + } + if (captions.down) { + var AC = PDFHexString_1.default.fromText(captions.down); + this.dict.set(PDFName_1.default.of('AC'), AC); + } + else { + this.dict.delete(PDFName_1.default.of('AC')); + } + }; + AppearanceCharacteristics.fromDict = function (dict) { + return new AppearanceCharacteristics(dict); + }; + return AppearanceCharacteristics; +}()); +exports.default = AppearanceCharacteristics; +//# sourceMappingURL=AppearanceCharacteristics.js.map \ No newline at end of file diff --git a/cjs/core/annotation/AppearanceCharacteristics.js.map b/cjs/core/annotation/AppearanceCharacteristics.js.map new file mode 100644 index 000000000..476af5cc5 --- /dev/null +++ b/cjs/core/annotation/AppearanceCharacteristics.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppearanceCharacteristics.js","sourceRoot":"","sources":["../../../src/core/annotation/AppearanceCharacteristics.ts"],"names":[],"mappings":";;;AACA,uEAA+C;AAC/C,2EAAmD;AACnD,yEAAiD;AACjD,iFAAyD;AACzD,2EAAmD;AAEnD;IAME,mCAAsB,IAAa;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,qCAAC,GAAD;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,mBAAS;YAAE,OAAO,CAAC,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,EAAE,YAAY,kBAAQ;YAAE,OAAO,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,EAAE,YAAY,kBAAQ;YAAE,OAAO,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,i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AM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACpC;IACH,CAAC;IAvHM,kCAAQ,GAAG,UAAC,IAAa;QAC9B,OAAA,IAAI,yBAAyB,CAAC,IAAI,CAAC;IAAnC,CAAmC,CAAC;IAuHxC,gCAAC;CAAA,AA3HD,IA2HC;AAED,kBAAe,yBAAyB,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/BorderStyle.d.ts b/cjs/core/annotation/BorderStyle.d.ts new file mode 100644 index 000000000..dd050c362 --- /dev/null +++ b/cjs/core/annotation/BorderStyle.d.ts @@ -0,0 +1,12 @@ +import PDFDict from "../objects/PDFDict"; +import PDFNumber from "../objects/PDFNumber"; +declare class BorderStyle { + readonly dict: PDFDict; + static fromDict: (dict: PDFDict) => BorderStyle; + protected constructor(dict: PDFDict); + W(): PDFNumber | undefined; + getWidth(): number | undefined; + setWidth(width: number): void; +} +export default BorderStyle; +//# sourceMappingURL=BorderStyle.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/BorderStyle.d.ts.map b/cjs/core/annotation/BorderStyle.d.ts.map new file mode 100644 index 000000000..84e98d96f --- /dev/null +++ b/cjs/core/annotation/BorderStyle.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"BorderStyle.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/BorderStyle.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AAGnD,cAAM,WAAW;IACf,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,WAAW,CAA0B;IAExE,SAAS,aAAa,IAAI,EAAE,OAAO;IAInC,CAAC,IAAI,SAAS,GAAG,SAAS;IAM1B,QAAQ,IAAI,MAAM,GAAG,SAAS;IAI9B,QAAQ,CAAC,KAAK,EAAE,MAAM;CAIvB;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/BorderStyle.js b/cjs/core/annotation/BorderStyle.js new file mode 100644 index 000000000..bdc89df04 --- /dev/null +++ b/cjs/core/annotation/BorderStyle.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +// TODO: Also handle the `/S` and `/D` entries +var BorderStyle = /** @class */ (function () { + function BorderStyle(dict) { + this.dict = dict; + } + BorderStyle.prototype.W = function () { + var W = this.dict.lookup(PDFName_1.default.of('W')); + if (W instanceof PDFNumber_1.default) + return W; + return undefined; + }; + BorderStyle.prototype.getWidth = function () { + var _a, _b; + return (_b = (_a = this.W()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 1; + }; + BorderStyle.prototype.setWidth = function (width) { + var W = this.dict.context.obj(width); + this.dict.set(PDFName_1.default.of('W'), W); + }; + BorderStyle.fromDict = function (dict) { return new BorderStyle(dict); }; + return BorderStyle; +}()); +exports.default = BorderStyle; +//# sourceMappingURL=BorderStyle.js.map \ No newline at end of file diff --git a/cjs/core/annotation/BorderStyle.js.map b/cjs/core/annotation/BorderStyle.js.map new file mode 100644 index 000000000..571665cce --- /dev/null +++ b/cjs/core/annotation/BorderStyle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BorderStyle.js","sourceRoot":"","sources":["../../../src/core/annotation/BorderStyle.ts"],"names":[],"mappings":";;;AACA,uEAA+C;AAC/C,2EAAmD;AAEnD,8CAA8C;AAC9C;IAKE,qBAAsB,IAAa;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,uBAAC,GAAD;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,mBAAS;YAAE,OAAO,CAAC,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,8BAAQ,GAAR;;QACE,mBAAO,IAAI,CAAC,CAAC,EAAE,0CAAE,QAAQ,qCAAM,CAAC,CAAC;IACnC,CAAC;IAED,8BAAQ,GAAR,UAAS,KAAa;QACpB,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAnBM,oBAAQ,GAAG,UAAC,IAAa,IAAkB,OAAA,IAAI,WAAW,CAAC,IAAI,CAAC,EAArB,CAAqB,CAAC;IAoB1E,kBAAC;CAAA,AAvBD,IAuBC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/PDFAnnotation.d.ts b/cjs/core/annotation/PDFAnnotation.d.ts new file mode 100644 index 000000000..b3a44a6bc --- /dev/null +++ b/cjs/core/annotation/PDFAnnotation.d.ts @@ -0,0 +1,52 @@ +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFStream from "../objects/PDFStream"; +import PDFArray from "../objects/PDFArray"; +import PDFRef from "../objects/PDFRef"; +import PDFNumber from "../objects/PDFNumber"; +declare class PDFAnnotation { + readonly dict: PDFDict; + static fromDict: (dict: PDFDict) => PDFAnnotation; + protected constructor(dict: PDFDict); + Rect(): PDFArray | undefined; + AP(): PDFDict | undefined; + F(): PDFNumber | undefined; + getRectangle(): { + x: number; + y: number; + width: number; + height: number; + }; + setRectangle(rect: { + x: number; + y: number; + width: number; + height: number; + }): void; + getAppearanceState(): PDFName | undefined; + setAppearanceState(state: PDFName): void; + setAppearances(appearances: PDFDict): void; + ensureAP(): PDFDict; + getNormalAppearance(): PDFRef | PDFDict; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + setNormalAppearance(appearance: PDFRef | PDFDict): void; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + setRolloverAppearance(appearance: PDFRef | PDFDict): void; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + setDownAppearance(appearance: PDFRef | PDFDict): void; + removeRolloverAppearance(): void; + removeDownAppearance(): void; + getAppearances(): { + normal: PDFStream | PDFDict; + rollover?: PDFStream | PDFDict; + down?: PDFStream | PDFDict; + } | undefined; + getFlags(): number; + setFlags(flags: number): void; + hasFlag(flag: number): boolean; + setFlag(flag: number): void; + clearFlag(flag: number): void; + setFlagTo(flag: number, enable: boolean): void; +} +export default PDFAnnotation; +//# sourceMappingURL=PDFAnnotation.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/PDFAnnotation.d.ts.map b/cjs/core/annotation/PDFAnnotation.d.ts.map new file mode 100644 index 000000000..449cc31cb --- /dev/null +++ b/cjs/core/annotation/PDFAnnotation.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAnnotation.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/PDFAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AAEnD,cAAM,aAAa;IACjB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,aAAa,CAA4B;IAE5E,SAAS,aAAa,IAAI,EAAE,OAAO;IAKnC,IAAI,IAAI,QAAQ,GAAG,SAAS;IAI5B,EAAE,IAAI,OAAO,GAAG,SAAS;IAIzB,CAAC,IAAI,SAAS,GAAG,SAAS;IAK1B,YAAY,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAKvE,YAAY,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAM1E,kBAAkB,IAAI,OAAO,GAAG,SAAS;IAMzC,kBAAkB,CAAC,KAAK,EAAE,OAAO;IAIjC,cAAc,CAAC,WAAW,EAAE,OAAO;IAInC,QAAQ,IAAI,OAAO;IASnB,mBAAmB,IAAI,MAAM,GAAG,OAAO;IAQvC,+DAA+D;IAC/D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAKhD,+DAA+D;IAC/D,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAKlD,+DAA+D;IAC/D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK9C,wBAAwB;IAKxB,oBAAoB;IAKpB,cAAc,IACV;QACE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;QAC5B,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;QAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;KAC5B,GACD,SAAS;IAYb,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK9B,OAAO,CAAC,IAAI,EAAE,MAAM;IAKpB,SAAS,CAAC,IAAI,EAAE,MAAM;IAKtB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;CAIxC;AAED,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/PDFAnnotation.js b/cjs/core/annotation/PDFAnnotation.js new file mode 100644 index 000000000..765505dc9 --- /dev/null +++ b/cjs/core/annotation/PDFAnnotation.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream")); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFAnnotation = /** @class */ (function () { + function PDFAnnotation(dict) { + this.dict = dict; + } + // This is technically required by the PDF spec + PDFAnnotation.prototype.Rect = function () { + return this.dict.lookup(PDFName_1.default.of('Rect'), PDFArray_1.default); + }; + PDFAnnotation.prototype.AP = function () { + return this.dict.lookupMaybe(PDFName_1.default.of('AP'), PDFDict_1.default); + }; + PDFAnnotation.prototype.F = function () { + var numberOrRef = this.dict.lookup(PDFName_1.default.of('F')); + return this.dict.context.lookupMaybe(numberOrRef, PDFNumber_1.default); + }; + PDFAnnotation.prototype.getRectangle = function () { + var _a; + var Rect = this.Rect(); + return (_a = Rect === null || Rect === void 0 ? void 0 : Rect.asRectangle()) !== null && _a !== void 0 ? _a : { x: 0, y: 0, width: 0, height: 0 }; + }; + PDFAnnotation.prototype.setRectangle = function (rect) { + var x = rect.x, y = rect.y, width = rect.width, height = rect.height; + var Rect = this.dict.context.obj([x, y, x + width, y + height]); + this.dict.set(PDFName_1.default.of('Rect'), Rect); + }; + PDFAnnotation.prototype.getAppearanceState = function () { + var AS = this.dict.lookup(PDFName_1.default.of('AS')); + if (AS instanceof PDFName_1.default) + return AS; + return undefined; + }; + PDFAnnotation.prototype.setAppearanceState = function (state) { + this.dict.set(PDFName_1.default.of('AS'), state); + }; + PDFAnnotation.prototype.setAppearances = function (appearances) { + this.dict.set(PDFName_1.default.of('AP'), appearances); + }; + PDFAnnotation.prototype.ensureAP = function () { + var AP = this.AP(); + if (!AP) { + AP = this.dict.context.obj({}); + this.dict.set(PDFName_1.default.of('AP'), AP); + } + return AP; + }; + PDFAnnotation.prototype.getNormalAppearance = function () { + var AP = this.ensureAP(); + var N = AP.get(PDFName_1.default.of('N')); + if (N instanceof PDFRef_1.default || N instanceof PDFDict_1.default) + return N; + throw new Error("Unexpected N type: " + (N === null || N === void 0 ? void 0 : N.constructor.name)); + }; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + PDFAnnotation.prototype.setNormalAppearance = function (appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_1.default.of('N'), appearance); + }; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + PDFAnnotation.prototype.setRolloverAppearance = function (appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_1.default.of('R'), appearance); + }; + /** @param appearance A PDFDict or PDFStream (direct or ref) */ + PDFAnnotation.prototype.setDownAppearance = function (appearance) { + var AP = this.ensureAP(); + AP.set(PDFName_1.default.of('D'), appearance); + }; + PDFAnnotation.prototype.removeRolloverAppearance = function () { + var AP = this.AP(); + AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_1.default.of('R')); + }; + PDFAnnotation.prototype.removeDownAppearance = function () { + var AP = this.AP(); + AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_1.default.of('D')); + }; + PDFAnnotation.prototype.getAppearances = function () { + var AP = this.AP(); + if (!AP) + return undefined; + var N = AP.lookup(PDFName_1.default.of('N'), PDFDict_1.default, PDFStream_1.default); + var R = AP.lookupMaybe(PDFName_1.default.of('R'), PDFDict_1.default, PDFStream_1.default); + var D = AP.lookupMaybe(PDFName_1.default.of('D'), PDFDict_1.default, PDFStream_1.default); + return { normal: N, rollover: R, down: D }; + }; + PDFAnnotation.prototype.getFlags = function () { + var _a, _b; + return (_b = (_a = this.F()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 0; + }; + PDFAnnotation.prototype.setFlags = function (flags) { + this.dict.set(PDFName_1.default.of('F'), PDFNumber_1.default.of(flags)); + }; + PDFAnnotation.prototype.hasFlag = function (flag) { + var flags = this.getFlags(); + return (flags & flag) !== 0; + }; + PDFAnnotation.prototype.setFlag = function (flag) { + var flags = this.getFlags(); + this.setFlags(flags | flag); + }; + PDFAnnotation.prototype.clearFlag = function (flag) { + var flags = this.getFlags(); + this.setFlags(flags & ~flag); + }; + PDFAnnotation.prototype.setFlagTo = function (flag, enable) { + if (enable) + this.setFlag(flag); + else + this.clearFlag(flag); + }; + PDFAnnotation.fromDict = function (dict) { return new PDFAnnotation(dict); }; + return PDFAnnotation; +}()); +exports.default = PDFAnnotation; +//# sourceMappingURL=PDFAnnotation.js.map \ No newline at end of file diff --git a/cjs/core/annotation/PDFAnnotation.js.map b/cjs/core/annotation/PDFAnnotation.js.map new file mode 100644 index 000000000..a535599aa --- /dev/null +++ b/cjs/core/annotation/PDFAnnotation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFAnnotation.js","sourceRoot":"","sources":["../../../src/core/annotation/PDFAnnotation.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,uEAA+C;AAC/C,2EAAmD;AACnD,yEAAiD;AACjD,qEAA6C;AAC7C,2EAAmD;AAEnD;IAKE,uBAAsB,IAAa;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,+CAA+C;IAC/C,4BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,kBAAQ,CAAC,CAAC;IACxD,CAAC;IAED,0BAAE,GAAF;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,iBAAO,CAAC,CAAC;IAC1D,CAAC;IAED,yBAAC,GAAD;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GA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ACE,mBAAO,IAAI,CAAC,CAAC,EAAE,0CAAE,QAAQ,qCAAM,CAAC,CAAC;IACnC,CAAC;IAED,gCAAQ,GAAR,UAAS,KAAa;QACpB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,mBAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,+BAAO,GAAP,UAAQ,IAAY;QAClB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,+BAAO,GAAP,UAAQ,IAAY;QAClB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,iCAAS,GAAT,UAAU,IAAY;QACpB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,iCAAS,GAAT,UAAU,IAAY,EAAE,MAAe;QACrC,IAAI,MAAM;YAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;;YAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAtIM,sBAAQ,GAAG,UAAC,IAAa,IAAoB,OAAA,IAAI,aAAa,CAAC,IAAI,CAAC,EAAvB,CAAuB,CAAC;IAuI9E,oBAAC;CAAA,AA1ID,IA0IC;AAED,kBAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/PDFWidgetAnnotation.d.ts b/cjs/core/annotation/PDFWidgetAnnotation.d.ts new file mode 100644 index 000000000..9756628ca --- /dev/null +++ b/cjs/core/annotation/PDFWidgetAnnotation.d.ts @@ -0,0 +1,27 @@ +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFRef from "../objects/PDFRef"; +import PDFString from "../objects/PDFString"; +import PDFHexString from "../objects/PDFHexString"; +import PDFContext from "../PDFContext"; +import BorderStyle from "./BorderStyle"; +import PDFAnnotation from "./PDFAnnotation"; +import AppearanceCharacteristics from "./AppearanceCharacteristics"; +declare class PDFWidgetAnnotation extends PDFAnnotation { + static fromDict: (dict: PDFDict) => PDFWidgetAnnotation; + static create: (context: PDFContext, parent: PDFRef) => PDFWidgetAnnotation; + MK(): PDFDict | undefined; + BS(): PDFDict | undefined; + DA(): PDFString | PDFHexString | undefined; + P(): PDFRef | undefined; + setP(page: PDFRef): void; + setDefaultAppearance(appearance: string): void; + getDefaultAppearance(): string | undefined; + getAppearanceCharacteristics(): AppearanceCharacteristics | undefined; + getOrCreateAppearanceCharacteristics(): AppearanceCharacteristics; + getBorderStyle(): BorderStyle | undefined; + getOrCreateBorderStyle(): BorderStyle; + getOnValue(): PDFName | undefined; +} +export default PDFWidgetAnnotation; +//# sourceMappingURL=PDFWidgetAnnotation.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map b/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map new file mode 100644 index 000000000..308124d01 --- /dev/null +++ b/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFWidgetAnnotation.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/PDFWidgetAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AACnD,OAAO,YAAY,gCAAsC;AACzD,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAC1D,OAAO,aAAa,wBAA0C;AAC9D,OAAO,yBAAyB,oCAAsD;AAEtF,cAAM,mBAAoB,SAAQ,aAAa;IAC7C,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,mBAAmB,CACtB;IAEhC,MAAM,CAAC,MAAM,YAAa,UAAU,UAAU,MAAM,yBAQlD;IAEF,EAAE,IAAI,OAAO,GAAG,SAAS;IAMzB,EAAE,IAAI,OAAO,GAAG,SAAS;IAMzB,EAAE,IAAI,SAAS,GAAG,YAAY,GAAG,SAAS;IAM1C,CAAC,IAAI,MAAM,GAAG,SAAS;IAMvB,IAAI,CAAC,IAAI,EAAE,MAAM;IAIjB,oBAAoB,CAAC,UAAU,EAAE,MAAM;IAIvC,oBAAoB,IAAI,MAAM,GAAG,SAAS;IAU1C,4BAA4B,IAAI,yBAAyB,GAAG,SAAS;IAMrE,oCAAoC,IAAI,yBAAyB;IASjE,cAAc,IAAI,WAAW,GAAG,SAAS;IAMzC,sBAAsB,IAAI,WAAW;IASrC,UAAU,IAAI,OAAO,GAAG,SAAS;CAalC;AAED,eAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/PDFWidgetAnnotation.js b/cjs/core/annotation/PDFWidgetAnnotation.js new file mode 100644 index 000000000..83021d572 --- /dev/null +++ b/cjs/core/annotation/PDFWidgetAnnotation.js @@ -0,0 +1,110 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var BorderStyle_1 = tslib_1.__importDefault(require("./BorderStyle")); +var PDFAnnotation_1 = tslib_1.__importDefault(require("./PDFAnnotation")); +var AppearanceCharacteristics_1 = tslib_1.__importDefault(require("./AppearanceCharacteristics")); +var PDFWidgetAnnotation = /** @class */ (function (_super) { + tslib_1.__extends(PDFWidgetAnnotation, _super); + function PDFWidgetAnnotation() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFWidgetAnnotation.prototype.MK = function () { + var MK = this.dict.lookup(PDFName_1.default.of('MK')); + if (MK instanceof PDFDict_1.default) + return MK; + return undefined; + }; + PDFWidgetAnnotation.prototype.BS = function () { + var BS = this.dict.lookup(PDFName_1.default.of('BS')); + if (BS instanceof PDFDict_1.default) + return BS; + return undefined; + }; + PDFWidgetAnnotation.prototype.DA = function () { + var da = this.dict.lookup(PDFName_1.default.of('DA')); + if (da instanceof PDFString_1.default || da instanceof PDFHexString_1.default) + return da; + return undefined; + }; + PDFWidgetAnnotation.prototype.P = function () { + var P = this.dict.get(PDFName_1.default.of('P')); + if (P instanceof PDFRef_1.default) + return P; + return undefined; + }; + PDFWidgetAnnotation.prototype.setP = function (page) { + this.dict.set(PDFName_1.default.of('P'), page); + }; + PDFWidgetAnnotation.prototype.setDefaultAppearance = function (appearance) { + this.dict.set(PDFName_1.default.of('DA'), PDFString_1.default.of(appearance)); + }; + PDFWidgetAnnotation.prototype.getDefaultAppearance = function () { + var DA = this.DA(); + if (DA instanceof PDFHexString_1.default) { + return DA.decodeText(); + } + return DA === null || DA === void 0 ? void 0 : DA.asString(); + }; + PDFWidgetAnnotation.prototype.getAppearanceCharacteristics = function () { + var MK = this.MK(); + if (MK) + return AppearanceCharacteristics_1.default.fromDict(MK); + return undefined; + }; + PDFWidgetAnnotation.prototype.getOrCreateAppearanceCharacteristics = function () { + var MK = this.MK(); + if (MK) + return AppearanceCharacteristics_1.default.fromDict(MK); + var ac = AppearanceCharacteristics_1.default.fromDict(this.dict.context.obj({})); + this.dict.set(PDFName_1.default.of('MK'), ac.dict); + return ac; + }; + PDFWidgetAnnotation.prototype.getBorderStyle = function () { + var BS = this.BS(); + if (BS) + return BorderStyle_1.default.fromDict(BS); + return undefined; + }; + PDFWidgetAnnotation.prototype.getOrCreateBorderStyle = function () { + var BS = this.BS(); + if (BS) + return BorderStyle_1.default.fromDict(BS); + var bs = BorderStyle_1.default.fromDict(this.dict.context.obj({})); + this.dict.set(PDFName_1.default.of('BS'), bs.dict); + return bs; + }; + PDFWidgetAnnotation.prototype.getOnValue = function () { + var _a; + var normal = (_a = this.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal; + if (normal instanceof PDFDict_1.default) { + var keys = normal.keys(); + for (var idx = 0, len = keys.length; idx < len; idx++) { + var key = keys[idx]; + if (key !== PDFName_1.default.of('Off')) + return key; + } + } + return undefined; + }; + PDFWidgetAnnotation.fromDict = function (dict) { + return new PDFWidgetAnnotation(dict); + }; + PDFWidgetAnnotation.create = function (context, parent) { + var dict = context.obj({ + Type: 'Annot', + Subtype: 'Widget', + Rect: [0, 0, 0, 0], + Parent: parent, + }); + return new PDFWidgetAnnotation(dict); + }; + return PDFWidgetAnnotation; +}(PDFAnnotation_1.default)); +exports.default = PDFWidgetAnnotation; +//# sourceMappingURL=PDFWidgetAnnotation.js.map \ No newline at end of file diff --git a/cjs/core/annotation/PDFWidgetAnnotation.js.map b/cjs/core/annotation/PDFWidgetAnnotation.js.map new file mode 100644 index 000000000..337911bff --- /dev/null +++ b/cjs/core/annotation/PDFWidgetAnnotation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFWidgetAnnotation.js","sourceRoot":"","sources":["../../../src/core/annotation/PDFWidgetAnnotation.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,uEAA+C;AAC/C,qEAA6C;AAC7C,2EAAmD;AACnD,iFAAyD;AAEzD,sEAA0D;AAC1D,0EAA8D;AAC9D,kGAAsF;AAEtF;IAAkC,+CAAa;IAA/C;;IAmGA,CAAC;IArFC,gCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,EAAE,YAAY,iBAAO;YAAE,OAAO,EAAE,CAAC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AAO,EAAE,CAAC;IACZ,CAAC;IAED,wCAAU,GAAV;;QACE,IAAM,MAAM,SAAG,IAAI,CAAC,cAAc,EAAE,0CAAE,MAAM,CAAC;QAE7C,IAAI,MAAM,YAAY,iBAAO,EAAE;YAC7B,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3B,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBACrD,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBACtB,IAAI,GAAG,KAAK,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC;oBAAE,OAAO,GAAG,CAAC;aAC3C;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAjGM,4BAAQ,GAAG,UAAC,IAAa;QAC9B,OAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC;IAA7B,CAA6B,CAAC;IAEzB,0BAAM,GAAG,UAAC,OAAmB,EAAE,MAAc;QAClD,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAClB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QACH,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC;IAuFJ,0BAAC;CAAA,AAnGD,CAAkC,uBAAa,GAmG9C;AAED,kBAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/cjs/core/annotation/flags.d.ts b/cjs/core/annotation/flags.d.ts new file mode 100644 index 000000000..d64d6b58f --- /dev/null +++ b/cjs/core/annotation/flags.d.ts @@ -0,0 +1,80 @@ +/** From PDF spec table 165 */ +export declare enum AnnotationFlags { + /** + * If set, do not display the annotation if it does not belong to one of the + * standard annotation types and no annotation handler is available. If clear, + * display such an unknown annotation using an appearance stream specified by + * its appearance dictionary, if any. + */ + Invisible, + /** + * If set, do not display or print the annotation or allow it to interact with + * the user, regardless of its annotation type or whether an annotation + * handler is available. + * + * In cases where screen space is limited, the ability to hide and show + * annotations selectively can be used in combination with appearance streams + * to display auxiliary pop-up information similar in function to online help + * systems. + */ + Hidden, + /** + * If set, print the annotation when the page is printed. If clear, never + * print the annotation, regardless of whether it is displayed on the screen. + * + * This can be useful for annotations representing interactive pushbuttons, + * which would serve no meaningful purpose on the printed page. + */ + Print, + /** + * If set, do not scale the annotation’s appearance to match the magnification + * of the page. The location of the annotation on the page (defined by the + * upper-left corner of its annotation rectangle) shall remain fixed, + * regardless of the page magnification. + */ + NoZoom, + /** + * If set, do not rotate the annotation’s appearance to match the rotation of + * the page. The upper-left corner of the annotation rectangle shall remain in + * a fixed location on the page, regardless of the page rotation. + */ + NoRotate, + /** + * If set, do not display the annotation on the screen or allow it to interact + * with the user. The annotation may be printed (depending on the setting of + * the Print flag) but should be considered hidden for purposes of on-screen + * display and user interaction. + */ + NoView, + /** + * If set, do not allow the annotation to interact with the user. The + * annotation may be displayed or printed (depending on the settings of the + * NoView and Print flags) but should not respond to mouse clicks or change + * its appearance in response to mouse motions. + * + * This flag shall be ignored for widget annotations; its function is + * subsumed by the ReadOnly flag of the associated form field. + */ + ReadOnly, + /** + * If set, do not allow the annotation to be deleted or its properties + * (including position and size) to be modified by the user. However, this + * flag does not restrict changes to the annotation’s contents, such as the + * value of a form field. + */ + Locked, + /** + * If set, invert the interpretation of the NoView flag for certain events. + * + * A typical use is to have an annotation that appears only when a mouse + * cursor is held over it. + */ + ToggleNoView, + /** + * If set, do not allow the contents of the annotation to be modified by the + * user. This flag does not restrict deletion of the annotation or changes to + * other annotation properties, such as position and size. + */ + LockedContents +} +//# sourceMappingURL=flags.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/flags.d.ts.map b/cjs/core/annotation/flags.d.ts.map new file mode 100644 index 000000000..efa3ef435 --- /dev/null +++ b/cjs/core/annotation/flags.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/flags.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,oBAAY,eAAe;IACzB;;;;;OAKG;IACH,SAAuB;IAEvB;;;;;;;;;OASG;IACH,MAAoB;IAEpB;;;;;;OAMG;IACH,KAAmB;IAEnB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;OAIG;IACH,QAAsB;IAEtB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;;;;;OAQG;IACH,QAAsB;IAEtB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;;OAKG;IACH,YAA0B;IAE1B;;;;OAIG;IACH,cAA6B;CAC9B"} \ No newline at end of file diff --git a/cjs/core/annotation/flags.js b/cjs/core/annotation/flags.js new file mode 100644 index 000000000..8b4d20d24 --- /dev/null +++ b/cjs/core/annotation/flags.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnnotationFlags = void 0; +var flag = function (bitIndex) { return 1 << bitIndex; }; +/** From PDF spec table 165 */ +var AnnotationFlags; +(function (AnnotationFlags) { + /** + * If set, do not display the annotation if it does not belong to one of the + * standard annotation types and no annotation handler is available. If clear, + * display such an unknown annotation using an appearance stream specified by + * its appearance dictionary, if any. + */ + AnnotationFlags[AnnotationFlags["Invisible"] = flag(1 - 1)] = "Invisible"; + /** + * If set, do not display or print the annotation or allow it to interact with + * the user, regardless of its annotation type or whether an annotation + * handler is available. + * + * In cases where screen space is limited, the ability to hide and show + * annotations selectively can be used in combination with appearance streams + * to display auxiliary pop-up information similar in function to online help + * systems. + */ + AnnotationFlags[AnnotationFlags["Hidden"] = flag(2 - 1)] = "Hidden"; + /** + * If set, print the annotation when the page is printed. If clear, never + * print the annotation, regardless of whether it is displayed on the screen. + * + * This can be useful for annotations representing interactive pushbuttons, + * which would serve no meaningful purpose on the printed page. + */ + AnnotationFlags[AnnotationFlags["Print"] = flag(3 - 1)] = "Print"; + /** + * If set, do not scale the annotation’s appearance to match the magnification + * of the page. The location of the annotation on the page (defined by the + * upper-left corner of its annotation rectangle) shall remain fixed, + * regardless of the page magnification. + */ + AnnotationFlags[AnnotationFlags["NoZoom"] = flag(4 - 1)] = "NoZoom"; + /** + * If set, do not rotate the annotation’s appearance to match the rotation of + * the page. The upper-left corner of the annotation rectangle shall remain in + * a fixed location on the page, regardless of the page rotation. + */ + AnnotationFlags[AnnotationFlags["NoRotate"] = flag(5 - 1)] = "NoRotate"; + /** + * If set, do not display the annotation on the screen or allow it to interact + * with the user. The annotation may be printed (depending on the setting of + * the Print flag) but should be considered hidden for purposes of on-screen + * display and user interaction. + */ + AnnotationFlags[AnnotationFlags["NoView"] = flag(6 - 1)] = "NoView"; + /** + * If set, do not allow the annotation to interact with the user. The + * annotation may be displayed or printed (depending on the settings of the + * NoView and Print flags) but should not respond to mouse clicks or change + * its appearance in response to mouse motions. + * + * This flag shall be ignored for widget annotations; its function is + * subsumed by the ReadOnly flag of the associated form field. + */ + AnnotationFlags[AnnotationFlags["ReadOnly"] = flag(7 - 1)] = "ReadOnly"; + /** + * If set, do not allow the annotation to be deleted or its properties + * (including position and size) to be modified by the user. However, this + * flag does not restrict changes to the annotation’s contents, such as the + * value of a form field. + */ + AnnotationFlags[AnnotationFlags["Locked"] = flag(8 - 1)] = "Locked"; + /** + * If set, invert the interpretation of the NoView flag for certain events. + * + * A typical use is to have an annotation that appears only when a mouse + * cursor is held over it. + */ + AnnotationFlags[AnnotationFlags["ToggleNoView"] = flag(9 - 1)] = "ToggleNoView"; + /** + * If set, do not allow the contents of the annotation to be modified by the + * user. This flag does not restrict deletion of the annotation or changes to + * other annotation properties, such as position and size. + */ + AnnotationFlags[AnnotationFlags["LockedContents"] = flag(10 - 1)] = "LockedContents"; +})(AnnotationFlags = exports.AnnotationFlags || (exports.AnnotationFlags = {})); +//# sourceMappingURL=flags.js.map \ No newline at end of file diff --git a/cjs/core/annotation/flags.js.map b/cjs/core/annotation/flags.js.map new file mode 100644 index 000000000..48759ae61 --- /dev/null +++ b/cjs/core/annotation/flags.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/core/annotation/flags.ts"],"names":[],"mappings":";;;AAAA,IAAM,IAAI,GAAG,UAAC,QAAgB,IAAK,OAAA,CAAC,IAAI,QAAQ,EAAb,CAAa,CAAC;AAEjD,8BAA8B;AAC9B,IAAY,eAsFX;AAtFD,WAAY,eAAe;IACzB;;;;;OAKG;IACH,+CAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,eAAA,CAAA;IAEvB;;;;;;;;;OASG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;;OAMG;IACH,2CAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,WAAA,CAAA;IAEnB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;OAIG;IACH,8CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;;;;OAQG;IACH,8CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;OAKG;IACH,kDAAe,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAA,CAAA;IAE1B;;;;OAIG;IACH,oDAAiB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,oBAAA,CAAA;AAC/B,CAAC,EAtFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAsF1B"} \ No newline at end of file diff --git a/cjs/core/annotation/index.d.ts b/cjs/core/annotation/index.d.ts new file mode 100644 index 000000000..207bcf4a3 --- /dev/null +++ b/cjs/core/annotation/index.d.ts @@ -0,0 +1,5 @@ +export { default as PDFAnnotation } from "./PDFAnnotation"; +export { default as PDFWidgetAnnotation } from "./PDFWidgetAnnotation"; +export { default as AppearanceCharacteristics } from "./AppearanceCharacteristics"; +export * from "./flags"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/core/annotation/index.d.ts.map b/cjs/core/annotation/index.d.ts.map new file mode 100644 index 000000000..a424c60fb --- /dev/null +++ b/cjs/core/annotation/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAI2C,iBAAiB,CAJlB;AAC7E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAGsD,uBAAuB,CAH7B;AACzF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAEuE,6BAA6B,CAF9C;AACrG,cACmJ,SAAS,CADlH"} \ No newline at end of file diff --git a/cjs/core/annotation/index.js b/cjs/core/annotation/index.js new file mode 100644 index 000000000..a75f30eb7 --- /dev/null +++ b/cjs/core/annotation/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFAnnotation_1 = require("./PDFAnnotation"); +Object.defineProperty(exports, "PDFAnnotation", { enumerable: true, get: function () { return PDFAnnotation_1.default; } }); +var PDFWidgetAnnotation_1 = require("./PDFWidgetAnnotation"); +Object.defineProperty(exports, "PDFWidgetAnnotation", { enumerable: true, get: function () { return PDFWidgetAnnotation_1.default; } }); +var AppearanceCharacteristics_1 = require("./AppearanceCharacteristics"); +Object.defineProperty(exports, "AppearanceCharacteristics", { enumerable: true, get: function () { return AppearanceCharacteristics_1.default; } }); +tslib_1.__exportStar(require("./flags"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/core/annotation/index.js.map b/cjs/core/annotation/index.js.map new file mode 100644 index 000000000..e4cf74727 --- /dev/null +++ b/cjs/core/annotation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/annotation/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAApE,8GAAA,OAAO,OAAiB;AACjC,6DAAyF;AAAhF,0HAAA,OAAO,OAAuB;AACvC,yEAAqG;AAA5F,sIAAA,OAAO,OAA6B;AAC7C,kDAA0C"} \ No newline at end of file diff --git a/cjs/core/document/PDFCrossRefSection.d.ts b/cjs/core/document/PDFCrossRefSection.d.ts new file mode 100644 index 000000000..318cbc837 --- /dev/null +++ b/cjs/core/document/PDFCrossRefSection.d.ts @@ -0,0 +1,28 @@ +import PDFRef from "../objects/PDFRef"; +export interface Entry { + ref: PDFRef; + offset: number; + deleted: boolean; +} +/** + * Entries should be added using the [[addEntry]] and [[addDeletedEntry]] + * methods **in order of ascending object number**. + */ +declare class PDFCrossRefSection { + static create: () => PDFCrossRefSection; + static createEmpty: () => PDFCrossRefSection; + private subsections; + private chunkIdx; + private chunkLength; + private constructor(); + addEntry(ref: PDFRef, offset: number): void; + addDeletedEntry(ref: PDFRef, nextFreeObjectNumber: number): void; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; + private copySubsectionsIntoBuffer; + private copyEntriesIntoBuffer; + private append; +} +export default PDFCrossRefSection; +//# sourceMappingURL=PDFCrossRefSection.d.ts.map \ No newline at end of file diff --git a/cjs/core/document/PDFCrossRefSection.d.ts.map b/cjs/core/document/PDFCrossRefSection.d.ts.map new file mode 100644 index 000000000..412aef6e1 --- /dev/null +++ b/cjs/core/document/PDFCrossRefSection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCrossRefSection.d.ts","sourceRoot":"","sources":["../../../src/core/document/PDFCrossRefSection.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,0BAAgC;AAI7C,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,cAAM,kBAAkB;IACtB,MAAM,CAAC,MAAM,2BAKR;IAEL,MAAM,CAAC,WAAW,2BAAkC;IAEpD,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO;IAMP,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI3C,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,GAAG,IAAI;IAIhE,QAAQ,IAAI,MAAM;IA4BlB,WAAW,IAAI,MAAM;IAcrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAczD,OAAO,CAAC,yBAAyB;IAyBjC,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,MAAM;CAoBf;AAED,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFCrossRefSection.js b/cjs/core/document/PDFCrossRefSection.js new file mode 100644 index 000000000..8d1e64457 --- /dev/null +++ b/cjs/core/document/PDFCrossRefSection.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +/** + * Entries should be added using the [[addEntry]] and [[addDeletedEntry]] + * methods **in order of ascending object number**. + */ +var PDFCrossRefSection = /** @class */ (function () { + function PDFCrossRefSection(firstEntry) { + this.subsections = firstEntry ? [[firstEntry]] : []; + this.chunkIdx = 0; + this.chunkLength = firstEntry ? 1 : 0; + } + PDFCrossRefSection.prototype.addEntry = function (ref, offset) { + this.append({ ref: ref, offset: offset, deleted: false }); + }; + PDFCrossRefSection.prototype.addDeletedEntry = function (ref, nextFreeObjectNumber) { + this.append({ ref: ref, offset: nextFreeObjectNumber, deleted: true }); + }; + PDFCrossRefSection.prototype.toString = function () { + var section = "xref\n"; + for (var rangeIdx = 0, rangeLen = this.subsections.length; rangeIdx < rangeLen; rangeIdx++) { + var range = this.subsections[rangeIdx]; + section += range[0].ref.objectNumber + " " + range.length + "\n"; + for (var entryIdx = 0, entryLen = range.length; entryIdx < entryLen; entryIdx++) { + var entry = range[entryIdx]; + section += utils_1.padStart(String(entry.offset), 10, '0'); + section += ' '; + section += utils_1.padStart(String(entry.ref.generationNumber), 5, '0'); + section += ' '; + section += entry.deleted ? 'f' : 'n'; + section += ' \n'; + } + } + return section; + }; + PDFCrossRefSection.prototype.sizeInBytes = function () { + var size = 5; + for (var idx = 0, len = this.subsections.length; idx < len; idx++) { + var subsection = this.subsections[idx]; + var subsectionLength = subsection.length; + var firstEntry = subsection[0]; + size += 2; + size += String(firstEntry.ref.objectNumber).length; + size += String(subsectionLength).length; + size += 20 * subsectionLength; + } + return size; + }; + PDFCrossRefSection.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.x; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.f; + buffer[offset++] = CharCodes_1.default.Newline; + offset += this.copySubsectionsIntoBuffer(this.subsections, buffer, offset); + return offset - initialOffset; + }; + PDFCrossRefSection.prototype.copySubsectionsIntoBuffer = function (subsections, buffer, offset) { + var initialOffset = offset; + var length = subsections.length; + for (var idx = 0; idx < length; idx++) { + var subsection = this.subsections[idx]; + var firstObjectNumber = String(subsection[0].ref.objectNumber); + offset += utils_1.copyStringIntoBuffer(firstObjectNumber, buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + var rangeLength = String(subsection.length); + offset += utils_1.copyStringIntoBuffer(rangeLength, buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + offset += this.copyEntriesIntoBuffer(subsection, buffer, offset); + } + return offset - initialOffset; + }; + PDFCrossRefSection.prototype.copyEntriesIntoBuffer = function (entries, buffer, offset) { + var length = entries.length; + for (var idx = 0; idx < length; idx++) { + var entry = entries[idx]; + var entryOffset = utils_1.padStart(String(entry.offset), 10, '0'); + offset += utils_1.copyStringIntoBuffer(entryOffset, buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + var entryGen = utils_1.padStart(String(entry.ref.generationNumber), 5, '0'); + offset += utils_1.copyStringIntoBuffer(entryGen, buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + buffer[offset++] = entry.deleted ? CharCodes_1.default.f : CharCodes_1.default.n; + buffer[offset++] = CharCodes_1.default.Space; + buffer[offset++] = CharCodes_1.default.Newline; + } + return 20 * length; + }; + PDFCrossRefSection.prototype.append = function (currEntry) { + if (this.chunkLength === 0) { + this.subsections.push([currEntry]); + this.chunkIdx = 0; + this.chunkLength = 1; + return; + } + var chunk = this.subsections[this.chunkIdx]; + var prevEntry = chunk[this.chunkLength - 1]; + if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) { + this.subsections.push([currEntry]); + this.chunkIdx += 1; + this.chunkLength = 1; + } + else { + chunk.push(currEntry); + this.chunkLength += 1; + } + }; + PDFCrossRefSection.create = function () { + return new PDFCrossRefSection({ + ref: PDFRef_1.default.of(0, 65535), + offset: 0, + deleted: true, + }); + }; + PDFCrossRefSection.createEmpty = function () { return new PDFCrossRefSection(); }; + return PDFCrossRefSection; +}()); +exports.default = PDFCrossRefSection; +//# sourceMappingURL=PDFCrossRefSection.js.map \ No newline at end of file diff --git a/cjs/core/document/PDFCrossRefSection.js.map b/cjs/core/document/PDFCrossRefSection.js.map new file mode 100644 index 000000000..549aff581 --- /dev/null +++ b/cjs/core/document/PDFCrossRefSection.js.map @@ -0,0 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9f74 --- /dev/null +++ b/cjs/core/document/PDFHeader.d.ts @@ -0,0 +1,11 @@ +declare class PDFHeader { + static forVersion: (major: number, minor: number) => PDFHeader; + private readonly major; + private readonly minor; + private constructor(); + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFHeader; +//# sourceMappingURL=PDFHeader.d.ts.map \ No newline at end of file diff --git a/cjs/core/document/PDFHeader.d.ts.map b/cjs/core/document/PDFHeader.d.ts.map new file mode 100644 index 000000000..8856c63e5 --- /dev/null +++ b/cjs/core/document/PDFHeader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFHeader.d.ts","sourceRoot":"","sources":["../../../src/core/document/PDFHeader.ts"],"names":[],"mappings":"AAGA,cAAM,SAAS;IACb,MAAM,CAAC,UAAU,UAAW,MAAM,SAAS,MAAM,eACnB;IAE9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B,OAAO;IAKP,QAAQ,IAAI,MAAM;IAKlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAsB1D;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFHeader.js b/cjs/core/document/PDFHeader.js new file mode 100644 index 000000000..1aeeb56d0 --- /dev/null +++ b/cjs/core/document/PDFHeader.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var PDFHeader = /** @class */ (function () { + function PDFHeader(major, minor) { + this.major = String(major); + this.minor = String(minor); + } + PDFHeader.prototype.toString = function () { + var bc = utils_1.charFromCode(129); + return "%PDF-" + this.major + "." + this.minor + "\n%" + bc + bc + bc + bc; + }; + PDFHeader.prototype.sizeInBytes = function () { + return 12 + this.major.length + this.minor.length; + }; + PDFHeader.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.Percent; + buffer[offset++] = CharCodes_1.default.P; + buffer[offset++] = CharCodes_1.default.D; + buffer[offset++] = CharCodes_1.default.F; + buffer[offset++] = CharCodes_1.default.Dash; + offset += utils_1.copyStringIntoBuffer(this.major, buffer, offset); + buffer[offset++] = CharCodes_1.default.Period; + offset += utils_1.copyStringIntoBuffer(this.minor, buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.Percent; + buffer[offset++] = 129; + buffer[offset++] = 129; + buffer[offset++] = 129; + buffer[offset++] = 129; + return offset - initialOffset; + }; + PDFHeader.forVersion = function (major, minor) { + return new PDFHeader(major, minor); + }; + return PDFHeader; +}()); +exports.default = PDFHeader; +//# sourceMappingURL=PDFHeader.js.map \ No newline at end of file diff --git a/cjs/core/document/PDFHeader.js.map b/cjs/core/document/PDFHeader.js.map new file mode 100644 index 000000000..697a656c6 --- /dev/null +++ b/cjs/core/document/PDFHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFHeader.js","sourceRoot":"","sources":["../../../src/core/document/PDFHeader.ts"],"names":[],"mappings":";;;AAAA,0EAAkD;AAClD,qCAA+D;AAE/D;IAOE,mBAAoB,KAAa,EAAE,KAAa;QAC9C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,4BAAQ,GAAR;QACE,IAAM,EAAE,GAAG,oBAAY,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,UAAQ,IAAI,CAAC,KAAK,SAAI,IAAI,CAAC,KAAK,WAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAI,CAAC;IACnE,CAAC;IAED,+BAAW,GAAX;QACE,OAAO,EA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AC,KAAK,EAAE,KAAK,CAAC;IAA3B,CAA2B,CAAC;IAyChC,gBAAC;CAAA,AA3CD,IA2CC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFTrailer.d.ts b/cjs/core/document/PDFTrailer.d.ts new file mode 100644 index 000000000..e8abf7a69 --- /dev/null +++ b/cjs/core/document/PDFTrailer.d.ts @@ -0,0 +1,10 @@ +declare class PDFTrailer { + static forLastCrossRefSectionOffset: (offset: number) => PDFTrailer; + private readonly lastXRefOffset; + private constructor(); + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFTrailer; +//# sourceMappingURL=PDFTrailer.d.ts.map \ No newline at end of file diff --git a/cjs/core/document/PDFTrailer.d.ts.map b/cjs/core/document/PDFTrailer.d.ts.map new file mode 100644 index 000000000..7d9a753c6 --- /dev/null +++ b/cjs/core/document/PDFTrailer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTrailer.d.ts","sourceRoot":"","sources":["../../../src/core/document/PDFTrailer.ts"],"names":[],"mappings":"AAGA,cAAM,UAAU;IACd,MAAM,CAAC,4BAA4B,WAAY,MAAM,gBAC5B;IAEzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IAExC,OAAO;IAIP,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAyB1D;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFTrailer.js b/cjs/core/document/PDFTrailer.js new file mode 100644 index 000000000..5d012e284 --- /dev/null +++ b/cjs/core/document/PDFTrailer.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var PDFTrailer = /** @class */ (function () { + function PDFTrailer(lastXRefOffset) { + this.lastXRefOffset = String(lastXRefOffset); + } + PDFTrailer.prototype.toString = function () { + return "startxref\n" + this.lastXRefOffset + "\n%%EOF"; + }; + PDFTrailer.prototype.sizeInBytes = function () { + return 16 + this.lastXRefOffset.length; + }; + PDFTrailer.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.s; + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.a; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.x; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.f; + buffer[offset++] = CharCodes_1.default.Newline; + offset += utils_1.copyStringIntoBuffer(this.lastXRefOffset, buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.Percent; + buffer[offset++] = CharCodes_1.default.Percent; + buffer[offset++] = CharCodes_1.default.E; + buffer[offset++] = CharCodes_1.default.O; + buffer[offset++] = CharCodes_1.default.F; + return offset - initialOffset; + }; + PDFTrailer.forLastCrossRefSectionOffset = function (offset) { + return new PDFTrailer(offset); + }; + return PDFTrailer; +}()); +exports.default = PDFTrailer; +//# sourceMappingURL=PDFTrailer.js.map \ No newline at end of file diff --git a/cjs/core/document/PDFTrailer.js.map b/cjs/core/document/PDFTrailer.js.map new file mode 100644 index 000000000..4c6d1f65d --- /dev/null +++ b/cjs/core/document/PDFTrailer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTrailer.js","sourceRoot":"","sources":["../../../src/core/document/PDFTrailer.ts"],"names":[],"mappings":";;;AAAA,0EAAkD;AAClD,qCAAiD;AAEjD;IAME,oBAAoB,cAAsB;QACxC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,6BAAQ,GAAR;QACE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CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAE/B,OAAO,MAAM,GAAG,aAAa,CAAC;IAChC,CAAC;IAzCM,uCAA4B,GAAG,UAAC,MAAc;QACnD,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC;IAAtB,CAAsB,CAAC;IAyC3B,iBAAC;CAAA,AA3CD,IA2CC;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFTrailerDict.d.ts b/cjs/core/document/PDFTrailerDict.d.ts new file mode 100644 index 000000000..0011e8063 --- /dev/null +++ b/cjs/core/document/PDFTrailerDict.d.ts @@ -0,0 +1,11 @@ +import PDFDict from "../objects/PDFDict"; +declare class PDFTrailerDict { + static of: (dict: PDFDict) => PDFTrailerDict; + readonly dict: PDFDict; + private constructor(); + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFTrailerDict; +//# sourceMappingURL=PDFTrailerDict.d.ts.map \ No newline at end of file diff --git a/cjs/core/document/PDFTrailerDict.d.ts.map b/cjs/core/document/PDFTrailerDict.d.ts.map new file mode 100644 index 000000000..dff53c41a --- /dev/null +++ b/cjs/core/document/PDFTrailerDict.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTrailerDict.d.ts","sourceRoot":"","sources":["../../../src/core/document/PDFTrailerDict.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAG/C,cAAM,cAAc;IAClB,MAAM,CAAC,EAAE,SAAU,OAAO,oBAA8B;IAExD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,OAAO;IAIP,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAgB1D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/document/PDFTrailerDict.js b/cjs/core/document/PDFTrailerDict.js new file mode 100644 index 000000000..8c9955514 --- /dev/null +++ b/cjs/core/document/PDFTrailerDict.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var PDFTrailerDict = /** @class */ (function () { + function PDFTrailerDict(dict) { + this.dict = dict; + } + PDFTrailerDict.prototype.toString = function () { + return "trailer\n" + this.dict.toString(); + }; + PDFTrailerDict.prototype.sizeInBytes = function () { + return 8 + this.dict.sizeInBytes(); + }; + PDFTrailerDict.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.a; + buffer[offset++] = CharCodes_1.default.i; + buffer[offset++] = CharCodes_1.default.l; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.Newline; + offset += this.dict.copyBytesInto(buffer, offset); + return offset - initialOffset; + }; + PDFTrailerDict.of = function (dict) { return new PDFTrailerDict(dict); }; + return PDFTrailerDict; +}()); +exports.default = PDFTrailerDict; +//# sourceMappingURL=PDFTrailerDict.js.map \ No newline at end of file diff --git a/cjs/core/document/PDFTrailerDict.js.map b/cjs/core/document/PDFTrailerDict.js.map new file mode 100644 index 000000000..9de23ae60 --- /dev/null +++ b/cjs/core/document/PDFTrailerDict.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFTrailerDict.js","sourceRoot":"","sources":["../../../src/core/document/PDFTrailerDict.ts"],"names":[],"mappings":";;;AACA,0EAAkD;AAElD;IAKE,wBAAoB,IAAa;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACn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Map.d.ts @@ -0,0 +1,4 @@ +import { Glyph } from "../../types/fontkit"; +/** `glyphs` should be an array of unique glyphs */ +export declare const createCmap: (glyphs: Glyph[], glyphId: (g?: Glyph | undefined) => number) => string; +//# sourceMappingURL=CMap.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/CMap.d.ts.map b/cjs/core/embedders/CMap.d.ts.map new file mode 100644 index 000000000..f7d0b99cd --- /dev/null +++ b/cjs/core/embedders/CMap.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CMap.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/CMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,4BAA0B;AAa1C,mDAAmD;AACnD,eAAO,MAAM,UAAU,WAAY,KAAK,EAAE,sCAA0B,MAAM,WAUzE,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/CMap.js b/cjs/core/embedders/CMap.js new file mode 100644 index 000000000..a343bbfb7 --- /dev/null +++ b/cjs/core/embedders/CMap.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCmap = void 0; +var utils_1 = require("../../utils"); +var unicode_1 = require("../../utils/unicode"); +/** `glyphs` should be an array of unique glyphs */ +exports.createCmap = function (glyphs, glyphId) { + var bfChars = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var glyph = glyphs[idx]; + var id = cmapHexFormat(cmapHexString(glyphId(glyph))); + var unicode = cmapHexFormat.apply(void 0, glyph.codePoints.map(cmapCodePointFormat)); + bfChars[idx] = [id, unicode]; + } + return fillCmapTemplate(bfChars); +}; +/* =============================== Templates ================================ */ +var fillCmapTemplate = function (bfChars) { return "/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000>\nendcodespacerange\n" + bfChars.length + " beginbfchar\n" + bfChars.map(function (_a) { + var glyphId = _a[0], codePoint = _a[1]; + return glyphId + " " + codePoint; +}).join('\n') + "\nendbfchar\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend"; }; +/* =============================== Utilities ================================ */ +var cmapHexFormat = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return "<" + values.join('') + ">"; +}; +var cmapHexString = function (value) { return utils_1.toHexStringOfMinLength(value, 4); }; +var cmapCodePointFormat = function (codePoint) { + if (unicode_1.isWithinBMP(codePoint)) + return cmapHexString(codePoint); + if (unicode_1.hasSurrogates(codePoint)) { + var hs = unicode_1.highSurrogate(codePoint); + var ls = unicode_1.lowSurrogate(codePoint); + return "" + cmapHexString(hs) + cmapHexString(ls); + } + var hex = utils_1.toHexString(codePoint); + var msg = "0x" + hex + " is not a valid UTF-8 or UTF-16 codepoint."; + throw new Error(msg); +}; +//# sourceMappingURL=CMap.js.map \ No newline at end of file diff --git a/cjs/core/embedders/CMap.js.map b/cjs/core/embedders/CMap.js.map new file mode 100644 index 000000000..bba976fd2 --- /dev/null +++ b/cjs/core/embedders/CMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CMap.js","sourceRoot":"","sources":["../../../src/core/embedders/CMap.ts"],"names":[],"mappings":";;;AAEA,qCAAgE;AAChE,+CAK2B;AAK3B,mDAAmD;AACtC,QAAA,UAAU,GAAG,UAAC,MAAe,EAAE,OAA8B;IACxE,IAAM,OAAO,GAAa,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;QACvD,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAM,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAA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AG,mBAAW,CAAC,SAAS,CAAC,CAAC;IACnC,IAAM,GAAG,GAAG,OAAK,GAAG,+CAA4C,CAAC;IACjE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontEmbedder.d.ts b/cjs/core/embedders/CustomFontEmbedder.d.ts new file mode 100644 index 000000000..aed4d1045 --- /dev/null +++ b/cjs/core/embedders/CustomFontEmbedder.d.ts @@ -0,0 +1,45 @@ +import { Font, Fontkit, Glyph, TypeFeatures } from "../../types/fontkit"; +import PDFHexString from "../objects/PDFHexString"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import { Cache } from "../../utils"; +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee + */ +declare class CustomFontEmbedder { + static for(fontkit: Fontkit, fontData: Uint8Array, customName?: string, fontFeatures?: TypeFeatures): Promise; + readonly font: Font; + readonly scale: number; + readonly fontData: Uint8Array; + readonly fontName: string; + readonly customName: string | undefined; + readonly fontFeatures: TypeFeatures | undefined; + protected baseFontName: string; + protected glyphCache: Cache; + protected constructor(font: Font, fontData: Uint8Array, customName?: string, fontFeatures?: TypeFeatures); + /** + * Encode the JavaScript string into this font. (JavaScript encodes strings in + * Unicode, but embedded fonts use their own custom encodings) + */ + encodeText(text: string): PDFHexString; + widthOfTextAtSize(text: string, size: number): number; + heightOfFontAtSize(size: number, options?: { + descender?: boolean; + }): number; + sizeOfFontAtHeight(height: number): number; + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; + protected embedFontDict(context: PDFContext, ref?: PDFRef): Promise; + protected isCFF(): boolean; + protected embedCIDFontDict(context: PDFContext): Promise; + protected embedFontDescriptor(context: PDFContext): Promise; + protected serializeFont(): Promise; + protected embedFontStream(context: PDFContext): Promise; + protected embedUnicodeCmap(context: PDFContext): PDFRef; + protected glyphId(glyph?: Glyph): number; + protected computeWidths(): (number | number[])[]; + private allGlyphsInFontSortedById; +} +export default CustomFontEmbedder; +//# sourceMappingURL=CustomFontEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontEmbedder.d.ts.map b/cjs/core/embedders/CustomFontEmbedder.d.ts.map new file mode 100644 index 000000000..af2185bf8 --- /dev/null +++ b/cjs/core/embedders/CustomFontEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomFontEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/CustomFontEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,4BAA0B;AAIvE,OAAO,YAAY,gCAAsC;AACzD,OAAO,MAAM,0BAAgC;AAE7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,EAEL,KAAK,EAGN,oBAAkB;AAEnB;;;;GAIG;AACH,cAAM,kBAAkB;WACT,GAAG,CACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,YAAY;IAM7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;IAEhD,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAErC,SAAS,aACP,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,UAAU,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,YAAY;IAa7B;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAWtC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAUrD,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GACpC,MAAM;IAaT,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAO1C,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAMpD,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC;IAqBlB,SAAS,CAAC,KAAK,IAAI,OAAO;cAIV,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;cAoBtD,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;cA4BzD,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;cAIpC,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrE,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM;IAMvD,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM;IAIxC,SAAS,CAAC,aAAa,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE;IA6BhD,OAAO,CAAC,yBAAyB,CAO/B;CACH;AAED,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontEmbedder.js b/cjs/core/embedders/CustomFontEmbedder.js new file mode 100644 index 000000000..8103fe284 --- /dev/null +++ b/cjs/core/embedders/CustomFontEmbedder.js @@ -0,0 +1,240 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var CMap_1 = require("./CMap"); +var FontFlags_1 = require("./FontFlags"); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var utils_1 = require("../../utils"); +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee + */ +var CustomFontEmbedder = /** @class */ (function () { + function CustomFontEmbedder(font, fontData, customName, fontFeatures) { + var _this = this; + this.allGlyphsInFontSortedById = function () { + var glyphs = new Array(_this.font.characterSet.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var codePoint = _this.font.characterSet[idx]; + glyphs[idx] = _this.font.glyphForCodePoint(codePoint); + } + return utils_1.sortedUniq(glyphs.sort(utils_1.byAscendingId), function (g) { return g.id; }); + }; + this.font = font; + this.scale = 1000 / this.font.unitsPerEm; + this.fontData = fontData; + this.fontName = this.font.postscriptName || 'Font'; + this.customName = customName; + this.fontFeatures = fontFeatures; + this.baseFontName = ''; + this.glyphCache = utils_1.Cache.populatedBy(this.allGlyphsInFontSortedById); + } + CustomFontEmbedder.for = function (fontkit, fontData, customName, fontFeatures) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var font; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, fontkit.create(fontData)]; + case 1: + font = _a.sent(); + return [2 /*return*/, new CustomFontEmbedder(font, fontData, customName, fontFeatures)]; + } + }); + }); + }; + /** + * Encode the JavaScript string into this font. (JavaScript encodes strings in + * Unicode, but embedded fonts use their own custom encodings) + */ + CustomFontEmbedder.prototype.encodeText = function (text) { + var glyphs = this.font.layout(text, this.fontFeatures).glyphs; + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + hexCodes[idx] = utils_1.toHexStringOfMinLength(glyphs[idx].id, 4); + } + return PDFHexString_1.default.of(hexCodes.join('')); + }; + // The advanceWidth takes into account kerning automatically, so we don't + // have to do that manually like we do for the standard fonts. + CustomFontEmbedder.prototype.widthOfTextAtSize = function (text, size) { + var glyphs = this.font.layout(text, this.fontFeatures).glyphs; + var totalWidth = 0; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + totalWidth += glyphs[idx].advanceWidth * this.scale; + } + var scale = size / 1000; + return totalWidth * scale; + }; + CustomFontEmbedder.prototype.heightOfFontAtSize = function (size, options) { + if (options === void 0) { options = {}; } + var _a = options.descender, descender = _a === void 0 ? true : _a; + var _b = this.font, ascent = _b.ascent, descent = _b.descent, bbox = _b.bbox; + var yTop = (ascent || bbox.maxY) * this.scale; + var yBottom = (descent || bbox.minY) * this.scale; + var height = yTop - yBottom; + if (!descender) + height -= Math.abs(descent) || 0; + return (height / 1000) * size; + }; + CustomFontEmbedder.prototype.sizeOfFontAtHeight = function (height) { + var _a = this.font, ascent = _a.ascent, descent = _a.descent, bbox = _a.bbox; + var yTop = (ascent || bbox.maxY) * this.scale; + var yBottom = (descent || bbox.minY) * this.scale; + return (1000 * height) / (yTop - yBottom); + }; + CustomFontEmbedder.prototype.embedIntoContext = function (context, ref) { + this.baseFontName = + this.customName || context.addRandomSuffix(this.fontName); + return this.embedFontDict(context, ref); + }; + CustomFontEmbedder.prototype.embedFontDict = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var cidFontDictRef, unicodeCMapRef, fontDict; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.embedCIDFontDict(context)]; + case 1: + cidFontDictRef = _a.sent(); + unicodeCMapRef = this.embedUnicodeCmap(context); + fontDict = context.obj({ + Type: 'Font', + Subtype: 'Type0', + BaseFont: this.baseFontName, + Encoding: 'Identity-H', + DescendantFonts: [cidFontDictRef], + ToUnicode: unicodeCMapRef, + }); + if (ref) { + context.assign(ref, fontDict); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(fontDict)]; + } + return [2 /*return*/]; + } + }); + }); + }; + CustomFontEmbedder.prototype.isCFF = function () { + return this.font.cff; + }; + CustomFontEmbedder.prototype.embedCIDFontDict = function (context) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var fontDescriptorRef, cidFontDict; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.embedFontDescriptor(context)]; + case 1: + fontDescriptorRef = _a.sent(); + cidFontDict = context.obj({ + Type: 'Font', + Subtype: this.isCFF() ? 'CIDFontType0' : 'CIDFontType2', + CIDToGIDMap: 'Identity', + BaseFont: this.baseFontName, + CIDSystemInfo: { + Registry: PDFString_1.default.of('Adobe'), + Ordering: PDFString_1.default.of('Identity'), + Supplement: 0, + }, + FontDescriptor: fontDescriptorRef, + W: this.computeWidths(), + }); + return [2 /*return*/, context.register(cidFontDict)]; + } + }); + }); + }; + CustomFontEmbedder.prototype.embedFontDescriptor = function (context) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var fontStreamRef, scale, _a, italicAngle, ascent, descent, capHeight, xHeight, _b, minX, minY, maxX, maxY, fontDescriptor; + var _c; + return tslib_1.__generator(this, function (_d) { + switch (_d.label) { + case 0: return [4 /*yield*/, this.embedFontStream(context)]; + case 1: + fontStreamRef = _d.sent(); + scale = this.scale; + _a = this.font, italicAngle = _a.italicAngle, ascent = _a.ascent, descent = _a.descent, capHeight = _a.capHeight, xHeight = _a.xHeight; + _b = this.font.bbox, minX = _b.minX, minY = _b.minY, maxX = _b.maxX, maxY = _b.maxY; + fontDescriptor = context.obj((_c = { + Type: 'FontDescriptor', + FontName: this.baseFontName, + Flags: FontFlags_1.deriveFontFlags(this.font), + FontBBox: [minX * scale, minY * scale, maxX * scale, maxY * scale], + ItalicAngle: italicAngle, + Ascent: ascent * scale, + Descent: descent * scale, + CapHeight: (capHeight || ascent) * scale, + XHeight: (xHeight || 0) * scale, + // Not sure how to compute/find this, nor is anybody else really: + // https://stackoverflow.com/questions/35485179/stemv-value-of-the-truetype-font + StemV: 0 + }, + _c[this.isCFF() ? 'FontFile3' : 'FontFile2'] = fontStreamRef, + _c)); + return [2 /*return*/, context.register(fontDescriptor)]; + } + }); + }); + }; + CustomFontEmbedder.prototype.serializeFont = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + return [2 /*return*/, this.fontData]; + }); + }); + }; + CustomFontEmbedder.prototype.embedFontStream = function (context) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var fontStream, _a, _b; + return tslib_1.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = (_a = context).flateStream; + return [4 /*yield*/, this.serializeFont()]; + case 1: + fontStream = _b.apply(_a, [_c.sent(), { + Subtype: this.isCFF() ? 'CIDFontType0C' : undefined, + }]); + return [2 /*return*/, context.register(fontStream)]; + } + }); + }); + }; + CustomFontEmbedder.prototype.embedUnicodeCmap = function (context) { + var cmap = CMap_1.createCmap(this.glyphCache.access(), this.glyphId.bind(this)); + var cmapStream = context.flateStream(cmap); + return context.register(cmapStream); + }; + CustomFontEmbedder.prototype.glyphId = function (glyph) { + return glyph ? glyph.id : -1; + }; + CustomFontEmbedder.prototype.computeWidths = function () { + var glyphs = this.glyphCache.access(); + var widths = []; + var currSection = []; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var currGlyph = glyphs[idx]; + var prevGlyph = glyphs[idx - 1]; + var currGlyphId = this.glyphId(currGlyph); + var prevGlyphId = this.glyphId(prevGlyph); + if (idx === 0) { + widths.push(currGlyphId); + } + else if (currGlyphId - prevGlyphId !== 1) { + widths.push(currSection); + widths.push(currGlyphId); + currSection = []; + } + currSection.push(currGlyph.advanceWidth * this.scale); + } + widths.push(currSection); + return widths; + }; + return CustomFontEmbedder; +}()); +exports.default = CustomFontEmbedder; +//# sourceMappingURL=CustomFontEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontEmbedder.js.map b/cjs/core/embedders/CustomFontEmbedder.js.map new file mode 100644 index 000000000..adeebc96c --- /dev/null +++ b/cjs/core/embedders/CustomFontEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomFontEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/CustomFontEmbedder.ts"],"names":[],"mappings":";;;AAEA,+BAAqD;AACrD,yCAA+D;AAC/D,iFAAyD;AAEzD,2EAAmD;AAEnD,qCAKmB;AAEnB;;;;GAIG;AACH;IAqBE,4BACE,IAAU,EACV,QAAoB,EACpB,UAAmB,EACnB,YAA2B;QAJ7B,iBAeC;QAsLO,8BAAyB,GAAG;YAClC,IAAM,MAAM,GAAY,IAAI,KAAK,CAAC,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACjE,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBACvD,IAAM,SAAS,GAAG,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,KAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;aACtD;YACD,OAAO,kBAAU,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAa,CAAC,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,EAAJ,CAAI,CAAC,CAAC;QAC7D,CAAC,CAAC;QAtMA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,MAAM,CAA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BAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts b/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts new file mode 100644 index 000000000..bd82c7baa --- /dev/null +++ b/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts @@ -0,0 +1,21 @@ +import { Fontkit, Glyph, TypeFeatures } from "../../types/fontkit"; +import CustomFontEmbedder from "./CustomFontEmbedder"; +import PDFHexString from "../objects/PDFHexString"; +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee + */ +declare class CustomFontSubsetEmbedder extends CustomFontEmbedder { + static for(fontkit: Fontkit, fontData: Uint8Array, customFontName?: string, fontFeatures?: TypeFeatures): Promise; + private readonly subset; + private readonly glyphs; + private readonly glyphIdMap; + private constructor(); + encodeText(text: string): PDFHexString; + protected isCFF(): boolean; + protected glyphId(glyph?: Glyph): number; + protected serializeFont(): Promise; +} +export default CustomFontSubsetEmbedder; +//# sourceMappingURL=CustomFontSubsetEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map b/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map new file mode 100644 index 000000000..fac514ef0 --- /dev/null +++ b/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomFontSubsetEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/CustomFontSubsetEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,KAAK,EAAU,YAAY,EAAE,4BAA0B;AAE/E,OAAO,kBAAkB,6BAA8C;AACvE,OAAO,YAAY,gCAAsC;AAGzD;;;;GAIG;AACH,cAAM,wBAAyB,SAAQ,kBAAkB;WAC1C,GAAG,CACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,cAAc,CAAC,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,YAAY;IAW7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO;IAcP,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAkBtC,SAAS,CAAC,KAAK,IAAI,OAAO;IAI1B,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM;IAIxC,SAAS,CAAC,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;CAU/C;AAED,eAAe,wBAAwB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontSubsetEmbedder.js b/cjs/core/embedders/CustomFontSubsetEmbedder.js new file mode 100644 index 000000000..262e834f0 --- /dev/null +++ b/cjs/core/embedders/CustomFontSubsetEmbedder.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var CustomFontEmbedder_1 = tslib_1.__importDefault(require("./CustomFontEmbedder")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var utils_1 = require("../../utils"); +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee + */ +var CustomFontSubsetEmbedder = /** @class */ (function (_super) { + tslib_1.__extends(CustomFontSubsetEmbedder, _super); + function CustomFontSubsetEmbedder(font, fontData, customFontName, fontFeatures) { + var _this = _super.call(this, font, fontData, customFontName, fontFeatures) || this; + _this.subset = _this.font.createSubset(); + _this.glyphs = []; + _this.glyphCache = utils_1.Cache.populatedBy(function () { return _this.glyphs; }); + _this.glyphIdMap = new Map(); + return _this; + } + CustomFontSubsetEmbedder.for = function (fontkit, fontData, customFontName, fontFeatures) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var font; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, fontkit.create(fontData)]; + case 1: + font = _a.sent(); + return [2 /*return*/, new CustomFontSubsetEmbedder(font, fontData, customFontName, fontFeatures)]; + } + }); + }); + }; + CustomFontSubsetEmbedder.prototype.encodeText = function (text) { + var glyphs = this.font.layout(text, this.fontFeatures).glyphs; + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var glyph = glyphs[idx]; + var subsetGlyphId = this.subset.includeGlyph(glyph); + this.glyphs[subsetGlyphId - 1] = glyph; + this.glyphIdMap.set(glyph.id, subsetGlyphId); + hexCodes[idx] = utils_1.toHexStringOfMinLength(subsetGlyphId, 4); + } + this.glyphCache.invalidate(); + return PDFHexString_1.default.of(hexCodes.join('')); + }; + CustomFontSubsetEmbedder.prototype.isCFF = function () { + return this.subset.cff; + }; + CustomFontSubsetEmbedder.prototype.glyphId = function (glyph) { + return glyph ? this.glyphIdMap.get(glyph.id) : -1; + }; + CustomFontSubsetEmbedder.prototype.serializeFont = function () { + var _this = this; + return new Promise(function (resolve, reject) { + var parts = []; + _this.subset + .encodeStream() + .on('data', function (bytes) { return parts.push(bytes); }) + .on('end', function () { return resolve(utils_1.mergeUint8Arrays(parts)); }) + .on('error', function (err) { return reject(err); }); + }); + }; + return CustomFontSubsetEmbedder; +}(CustomFontEmbedder_1.default)); +exports.default = CustomFontSubsetEmbedder; +//# sourceMappingURL=CustomFontSubsetEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/CustomFontSubsetEmbedder.js.map b/cjs/core/embedders/CustomFontSubsetEmbedder.js.map new file mode 100644 index 000000000..ed92b848f --- /dev/null +++ b/cjs/core/embedders/CustomFontSubsetEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomFontSubsetEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/C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AAAD,CAAC,AAtED,CAAuC,4BAAkB,GAsExD;AAED,kBAAe,wBAAwB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/FileEmbedder.d.ts b/cjs/core/embedders/FileEmbedder.d.ts new file mode 100644 index 000000000..8129665b3 --- /dev/null +++ b/cjs/core/embedders/FileEmbedder.d.ts @@ -0,0 +1,34 @@ +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +/** + * From the PDF-A3 specification, section **3.1. Requirements - General**. + * See: + * * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf + */ +export declare enum AFRelationship { + Source = "Source", + Data = "Data", + Alternative = "Alternative", + Supplement = "Supplement", + EncryptedPayload = "EncryptedPayload", + FormData = "EncryptedPayload", + Schema = "Schema", + Unspecified = "Unspecified" +} +export interface EmbeddedFileOptions { + mimeType?: string; + description?: string; + creationDate?: Date; + modificationDate?: Date; + afRelationship?: AFRelationship; +} +declare class FileEmbedder { + static for(bytes: Uint8Array, fileName: string, options?: EmbeddedFileOptions): FileEmbedder; + private readonly fileData; + readonly fileName: string; + readonly options: EmbeddedFileOptions; + private constructor(); + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; +} +export default FileEmbedder; +//# sourceMappingURL=FileEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/FileEmbedder.d.ts.map b/cjs/core/embedders/FileEmbedder.d.ts.map new file mode 100644 index 000000000..0b711d738 --- /dev/null +++ b/cjs/core/embedders/FileEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FileEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/FileEmbedder.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAE7C;;;;GAIG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,gBAAgB,qBAAqB;IACrC,QAAQ,qBAAqB;IAC7B,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,cAAM,YAAY;IAChB,MAAM,CAAC,GAAG,CACR,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,mBAAwB;IAKnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAEtC,OAAO;IAUD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAwC3E;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/FileEmbedder.js b/cjs/core/embedders/FileEmbedder.js new file mode 100644 index 000000000..ce3bc9502 --- /dev/null +++ b/cjs/core/embedders/FileEmbedder.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AFRelationship = void 0; +var tslib_1 = require("tslib"); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +/** + * From the PDF-A3 specification, section **3.1. Requirements - General**. + * See: + * * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf + */ +var AFRelationship; +(function (AFRelationship) { + AFRelationship["Source"] = "Source"; + AFRelationship["Data"] = "Data"; + AFRelationship["Alternative"] = "Alternative"; + AFRelationship["Supplement"] = "Supplement"; + AFRelationship["EncryptedPayload"] = "EncryptedPayload"; + AFRelationship["FormData"] = "EncryptedPayload"; + AFRelationship["Schema"] = "Schema"; + AFRelationship["Unspecified"] = "Unspecified"; +})(AFRelationship = exports.AFRelationship || (exports.AFRelationship = {})); +var FileEmbedder = /** @class */ (function () { + function FileEmbedder(fileData, fileName, options) { + if (options === void 0) { options = {}; } + this.fileData = fileData; + this.fileName = fileName; + this.options = options; + } + FileEmbedder.for = function (bytes, fileName, options) { + if (options === void 0) { options = {}; } + return new FileEmbedder(bytes, fileName, options); + }; + FileEmbedder.prototype.embedIntoContext = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, mimeType, description, creationDate, modificationDate, afRelationship, embeddedFileStream, embeddedFileStreamRef, fileSpecDict; + return tslib_1.__generator(this, function (_b) { + _a = this.options, mimeType = _a.mimeType, description = _a.description, creationDate = _a.creationDate, modificationDate = _a.modificationDate, afRelationship = _a.afRelationship; + embeddedFileStream = context.flateStream(this.fileData, { + Type: 'EmbeddedFile', + Subtype: mimeType !== null && mimeType !== void 0 ? mimeType : undefined, + Params: { + Size: this.fileData.length, + CreationDate: creationDate + ? PDFString_1.default.fromDate(creationDate) + : undefined, + ModDate: modificationDate + ? PDFString_1.default.fromDate(modificationDate) + : undefined, + }, + }); + embeddedFileStreamRef = context.register(embeddedFileStream); + fileSpecDict = context.obj({ + Type: 'Filespec', + F: PDFString_1.default.of(this.fileName), + UF: PDFHexString_1.default.fromText(this.fileName), + EF: { F: embeddedFileStreamRef }, + Desc: description ? PDFHexString_1.default.fromText(description) : undefined, + AFRelationship: afRelationship !== null && afRelationship !== void 0 ? afRelationship : undefined, + }); + if (ref) { + context.assign(ref, fileSpecDict); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(fileSpecDict)]; + } + return [2 /*return*/]; + }); + }); + }; + return FileEmbedder; +}()); +exports.default = FileEmbedder; +//# sourceMappingURL=FileEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/FileEmbedder.js.map b/cjs/core/embedders/FileEmbedder.js.map new file mode 100644 index 000000000..9d6aa941d --- /dev/null +++ b/cjs/core/embedders/FileEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FileEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/FileEmbedder.ts"],"names":[],"mappings":";;;;AAAA,2EAAmD;AACnD,iFAAyD;AAIzD;;;;GAIG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;IACb,6CAA2B,CAAA;IAC3B,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;IACrC,+CAA6B,CAAA;IAC7B,mCAAiB,CAAA;IACjB,6CAA2B,CAAA;AAC7B,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB;AAUD;IAaE,sBACE,QAAoB,EACpB,QAAgB,EAChB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QAEjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IApBM,gBAAG,GAAV,UACE,KAAiB,EACjB,QAAgB,EAChB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QAEjC,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAgBK,uCAAgB,GAAtB,UAAuB,OAAmB,EAAE,GAAY;;;;gBAChD,KAMF,IAAI,CAAC,OAAO,EALd,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,YAAY,kBAAA,EACZ,gBAAgB,sBAAA,EAChB,cAAc,oBAAA,CACC;gBAEX,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE;oBAC5D,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,SAAS;oBAC9B,MAAM,EAAE;wBACN,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;wBAC1B,YAAY,EAAE,YAAY;4BACxB,CAAC,CAAC,mBAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;4BAClC,CAAC,CAAC,SAAS;wBACb,OAAO,EAAE,gBAAgB;4BACvB,CAAC,CAAC,mBAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC;4BACtC,CAAC,CAAC,SAAS;qBACd;iBACF,CAAC,CAAC;gBACG,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;gBAE7D,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;oBAC/B,IAAI,EAAE,UAAU;oBAChB,CAAC,EAAE,mBAAS,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;oBAC9B,EAAE,EAAE,sBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;oBACxC,EAAE,EAAE,EAAE,CAAC,EAAE,qBAAqB,EAAE;oBAChC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,sBAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;oBAClE,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,SAAS;iBAC5C,CAAC,CAAC;gBAEH,IAAI,GAAG,EAAE;oBACP,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;oBAClC,sBAAO,GAAG,EAAC;iBACZ;qBAAM;oBACL,sBAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAC;iBACvC;;;;KACF;IACH,mBAAC;AAAD,CAAC,AA/DD,IA+DC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/FontFlags.d.ts b/cjs/core/embedders/FontFlags.d.ts new file mode 100644 index 000000000..c00509252 --- /dev/null +++ b/cjs/core/embedders/FontFlags.d.ts @@ -0,0 +1,14 @@ +import { Font } from "../../types/fontkit"; +export interface FontFlagOptions { + fixedPitch?: boolean; + serif?: boolean; + symbolic?: boolean; + script?: boolean; + nonsymbolic?: boolean; + italic?: boolean; + allCap?: boolean; + smallCap?: boolean; + forceBold?: boolean; +} +export declare const deriveFontFlags: (font: Font) => number; +//# sourceMappingURL=FontFlags.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/FontFlags.d.ts.map b/cjs/core/embedders/FontFlags.d.ts.map new file mode 100644 index 000000000..6428bfddc --- /dev/null +++ b/cjs/core/embedders/FontFlags.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FontFlags.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/FontFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,4BAA0B;AAEzC,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAsBD,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,MAU5C,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/FontFlags.js b/cjs/core/embedders/FontFlags.js new file mode 100644 index 000000000..a4a4191b6 --- /dev/null +++ b/cjs/core/embedders/FontFlags.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.deriveFontFlags = void 0; +// prettier-ignore +var makeFontFlags = function (options) { + var flags = 0; + var flipBit = function (bit) { flags |= (1 << (bit - 1)); }; + if (options.fixedPitch) + flipBit(1); + if (options.serif) + flipBit(2); + if (options.symbolic) + flipBit(3); + if (options.script) + flipBit(4); + if (options.nonsymbolic) + flipBit(6); + if (options.italic) + flipBit(7); + if (options.allCap) + flipBit(17); + if (options.smallCap) + flipBit(18); + if (options.forceBold) + flipBit(19); + return flags; +}; +// From: https://github.com/foliojs/pdfkit/blob/83f5f7243172a017adcf6a7faa5547c55982c57b/lib/font/embedded.js#L123-L129 +exports.deriveFontFlags = function (font) { + var familyClass = font['OS/2'] ? font['OS/2'].sFamilyClass : 0; + var flags = makeFontFlags({ + fixedPitch: font.post.isFixedPitch, + serif: 1 <= familyClass && familyClass <= 7, + symbolic: true, + script: familyClass === 10, + italic: font.head.macStyle.italic, + }); + return flags; +}; +//# sourceMappingURL=FontFlags.js.map \ No newline at end of file diff --git a/cjs/core/embedders/FontFlags.js.map b/cjs/core/embedders/FontFlags.js.map new file mode 100644 index 000000000..40a65d521 --- /dev/null +++ b/cjs/core/embedders/FontFlags.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FontFlags.js","sourceRoot":"","sources":["../../../src/core/embedders/FontFlags.ts"],"names":[],"mappings":";;;AAcA,kBAAkB;AAClB,IAAM,aAAa,GAAG,UAAC,OAAwB;IAC7C,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,IAAM,OAAO,GAAG,UAAC,GAAW,IAAO,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,IAAI,OAAO,CAAC,UAAU;QAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,KAAK;QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,QAAQ;QAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,MAAM;QAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,WAAW;QAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,MAAM;QAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO,CAAC,MAAM;QAAO,OAAO,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,OAAO,CAAC,QAAQ;QAAK,OAAO,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,OAAO,CAAC,SAAS;QAAI,OAAO,CAAC,EAAE,CAAC,CAAC;IAErC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,uHAAuH;AAC1G,QAAA,eAAe,GAAG,UAAC,IAAU;IACxC,IAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,IAAM,KAAK,GAAG,aAAa,CAAC;QAC1B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;QAClC,KAAK,EAAE,CAAC,IAAI,WAAW,IAAI,WAAW,IAAI,CAAC;QAC3C,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,WAAW,KAAK,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM;KAClC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/JavaScriptEmbedder.d.ts b/cjs/core/embedders/JavaScriptEmbedder.d.ts new file mode 100644 index 000000000..d3ed1bc0c --- /dev/null +++ b/cjs/core/embedders/JavaScriptEmbedder.d.ts @@ -0,0 +1,11 @@ +import PDFContext from "../PDFContext"; +import PDFRef from "../objects/PDFRef"; +declare class JavaScriptEmbedder { + static for(script: string, scriptName: string): JavaScriptEmbedder; + private readonly script; + readonly scriptName: string; + private constructor(); + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; +} +export default JavaScriptEmbedder; +//# sourceMappingURL=JavaScriptEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/JavaScriptEmbedder.d.ts.map b/cjs/core/embedders/JavaScriptEmbedder.d.ts.map new file mode 100644 index 000000000..c8e33d15c --- /dev/null +++ b/cjs/core/embedders/JavaScriptEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"JavaScriptEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/JavaScriptEmbedder.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,sBAA4B;AAC7C,OAAO,MAAM,0BAAgC;AAE7C,cAAM,kBAAkB;IACtB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAI7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,OAAO;IAKD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAc3E;AAED,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/JavaScriptEmbedder.js b/cjs/core/embedders/JavaScriptEmbedder.js new file mode 100644 index 000000000..1ad1e8090 --- /dev/null +++ b/cjs/core/embedders/JavaScriptEmbedder.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var JavaScriptEmbedder = /** @class */ (function () { + function JavaScriptEmbedder(script, scriptName) { + this.script = script; + this.scriptName = scriptName; + } + JavaScriptEmbedder.for = function (script, scriptName) { + return new JavaScriptEmbedder(script, scriptName); + }; + JavaScriptEmbedder.prototype.embedIntoContext = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var jsActionDict; + return tslib_1.__generator(this, function (_a) { + jsActionDict = context.obj({ + Type: 'Action', + S: 'JavaScript', + JS: PDFHexString_1.default.fromText(this.script), + }); + if (ref) { + context.assign(ref, jsActionDict); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(jsActionDict)]; + } + return [2 /*return*/]; + }); + }); + }; + return JavaScriptEmbedder; +}()); +exports.default = JavaScriptEmbedder; +//# sourceMappingURL=JavaScriptEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/JavaScriptEmbedder.js.map b/cjs/core/embedders/JavaScriptEmbedder.js.map new file mode 100644 index 000000000..67246bf22 --- /dev/null +++ b/cjs/core/embedders/JavaScriptEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"JavaScriptEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/JavaScriptEmbedder.ts"],"names":[],"mappings":";;;AAAA,iFAAyD;AAIzD;IAQE,4BAAoB,MAAc,EAAE,UAAkB;QACpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAVM,sBAAG,GAAV,UAAW,MAAc,EAAE,UAAkB;QAC3C,OAAO,IAAI,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAUK,6CAAgB,GAAtB,UAAuB,OAAmB,EAAE,GAAY;;;;gBAChD,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;oBAC/B,IAAI,EAAE,QAAQ;oBACd,CAAC,EAAE,YAAY;oBACf,EAAE,EAAE,sBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;iBACvC,CAAC,CAAC;gBAEH,IAAI,GAAG,EAAE;oBACP,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;oBAClC,sBAAO,GAAG,EAAC;iBACZ;qBAAM;oBACL,sBAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAC;iBACvC;;;;KACF;IACH,yBAAC;AAAD,CAAC,AA3BD,IA2BC;AAED,kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/JpegEmbedder.d.ts b/cjs/core/embedders/JpegEmbedder.d.ts new file mode 100644 index 000000000..f86509e5a --- /dev/null +++ b/cjs/core/embedders/JpegEmbedder.d.ts @@ -0,0 +1,24 @@ +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +declare enum ColorSpace { + DeviceGray = "DeviceGray", + DeviceRGB = "DeviceRGB", + DeviceCMYK = "DeviceCMYK" +} +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/foliojs/pdfkit/blob/a6af76467ce06bd6a2af4aa7271ccac9ff152a7d/lib/image/jpeg.js + */ +declare class JpegEmbedder { + static for(imageData: Uint8Array): Promise; + readonly bitsPerComponent: number; + readonly height: number; + readonly width: number; + readonly colorSpace: ColorSpace; + private readonly imageData; + private constructor(); + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; +} +export default JpegEmbedder; +//# sourceMappingURL=JpegEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/JpegEmbedder.d.ts.map b/cjs/core/embedders/JpegEmbedder.d.ts.map new file mode 100644 index 000000000..7ee8415c4 --- /dev/null +++ b/cjs/core/embedders/JpegEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"JpegEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/JpegEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAW7C,aAAK,UAAU;IACb,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B;AAQD;;;;GAIG;AACH,cAAM,YAAY;WACH,GAAG,CAAC,SAAS,EAAE,UAAU;IA0CtC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IAEvC,OAAO;IAcD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA+B3E;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/JpegEmbedder.js b/cjs/core/embedders/JpegEmbedder.js new file mode 100644 index 000000000..56ea0a920 --- /dev/null +++ b/cjs/core/embedders/JpegEmbedder.js @@ -0,0 +1,107 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +// prettier-ignore +var MARKERS = [ + 0xffc0, 0xffc1, 0xffc2, + 0xffc3, 0xffc5, 0xffc6, + 0xffc7, 0xffc8, 0xffc9, + 0xffca, 0xffcb, 0xffcc, + 0xffcd, 0xffce, 0xffcf, +]; +var ColorSpace; +(function (ColorSpace) { + ColorSpace["DeviceGray"] = "DeviceGray"; + ColorSpace["DeviceRGB"] = "DeviceRGB"; + ColorSpace["DeviceCMYK"] = "DeviceCMYK"; +})(ColorSpace || (ColorSpace = {})); +var ChannelToColorSpace = { + 1: ColorSpace.DeviceGray, + 3: ColorSpace.DeviceRGB, + 4: ColorSpace.DeviceCMYK, +}; +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/foliojs/pdfkit/blob/a6af76467ce06bd6a2af4aa7271ccac9ff152a7d/lib/image/jpeg.js + */ +var JpegEmbedder = /** @class */ (function () { + function JpegEmbedder(imageData, bitsPerComponent, width, height, colorSpace) { + this.imageData = imageData; + this.bitsPerComponent = bitsPerComponent; + this.width = width; + this.height = height; + this.colorSpace = colorSpace; + } + JpegEmbedder.for = function (imageData) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var dataView, soi, pos, marker, bitsPerComponent, height, width, channelByte, channelName, colorSpace; + return tslib_1.__generator(this, function (_a) { + dataView = new DataView(imageData.buffer); + soi = dataView.getUint16(0); + if (soi !== 0xffd8) + throw new Error('SOI not found in JPEG'); + pos = 2; + while (pos < dataView.byteLength) { + marker = dataView.getUint16(pos); + pos += 2; + if (MARKERS.includes(marker)) + break; + pos += dataView.getUint16(pos); + } + if (!MARKERS.includes(marker)) + throw new Error('Invalid JPEG'); + pos += 2; + bitsPerComponent = dataView.getUint8(pos++); + height = dataView.getUint16(pos); + pos += 2; + width = dataView.getUint16(pos); + pos += 2; + channelByte = dataView.getUint8(pos++); + channelName = ChannelToColorSpace[channelByte]; + if (!channelName) + throw new Error('Unknown JPEG channel.'); + colorSpace = channelName; + return [2 /*return*/, new JpegEmbedder(imageData, bitsPerComponent, width, height, colorSpace)]; + }); + }); + }; + JpegEmbedder.prototype.embedIntoContext = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var xObject; + return tslib_1.__generator(this, function (_a) { + xObject = context.stream(this.imageData, { + Type: 'XObject', + Subtype: 'Image', + BitsPerComponent: this.bitsPerComponent, + Width: this.width, + Height: this.height, + ColorSpace: this.colorSpace, + Filter: 'DCTDecode', + // CMYK JPEG streams in PDF are typically stored complemented, + // with 1 as 'off' and 0 as 'on' (PDF 32000-1:2008, 8.6.4.4). + // + // Standalone CMYK JPEG (usually exported by Photoshop) are + // stored inverse, with 0 as 'off' and 1 as 'on', like RGB. + // + // Applying a swap here as a hedge that most bytes passing + // through this method will benefit from it. + Decode: this.colorSpace === ColorSpace.DeviceCMYK + ? [1, 0, 1, 0, 1, 0, 1, 0] + : undefined, + }); + if (ref) { + context.assign(ref, xObject); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(xObject)]; + } + return [2 /*return*/]; + }); + }); + }; + return JpegEmbedder; +}()); +exports.default = JpegEmbedder; +//# sourceMappingURL=JpegEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/JpegEmbedder.js.map b/cjs/core/embedders/JpegEmbedder.js.map new file mode 100644 index 000000000..cfc8e8fff --- /dev/null +++ b/cjs/core/embedders/Jpeg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oBACvC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,MAAM,EAAE,WAAW;oBAEnB,8DAA8D;oBAC9D,6DAA6D;oBAC7D,EAAE;oBACF,2DAA2D;oBAC3D,2DAA2D;oBAC3D,EAAE;oBACF,0DAA0D;oBAC1D,4CAA4C;oBAC5C,MAAM,EACJ,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,UAAU;wBACvC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;wBAC1B,CAAC,CAAC,SAAS;iBAChB,CAAC,CAAC;gBAEH,IAAI,GAAG,EAAE;oBACP,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;oBAC7B,sBAAO,GAAG,EAAC;iBACZ;qBAAM;oBACL,sBAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAC;iBAClC;;;;KACF;IACH,mBAAC;AAAD,CAAC,AA/FD,IA+FC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/PDFPageEmbedder.d.ts b/cjs/core/embedders/PDFPageEmbedder.d.ts new file mode 100644 index 000000000..c65a6a79e --- /dev/null +++ b/cjs/core/embedders/PDFPageEmbedder.d.ts @@ -0,0 +1,38 @@ +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFPageLeaf from "../structures/PDFPageLeaf"; +import { TransformationMatrix } from "../../types/matrix"; +/** + * Represents a page bounding box. + * Usually `left` and `bottom` are 0 and right, top are equal + * to width, height if you want to clip to the whole page. + * + * y + * ^ + * | +--------+ (width,height) + * | | | + * | | Page | + * | | | + * | | | + * (0,0) | +--------+ + * +----------> x + */ +export interface PageBoundingBox { + left: number /** The left of the bounding box */; + bottom: number /** The bottom of the bounding box */; + right: number /** The right of the bounding box */; + top: number /** The top of the bounding box */; +} +declare class PDFPageEmbedder { + static for(page: PDFPageLeaf, boundingBox?: PageBoundingBox, transformationMatrix?: TransformationMatrix): Promise; + readonly width: number; + readonly height: number; + readonly boundingBox: PageBoundingBox; + readonly transformationMatrix: TransformationMatrix; + private readonly page; + private constructor(); + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; + private decodeContents; +} +export default PDFPageEmbedder; +//# sourceMappingURL=PDFPageEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/PDFPageEmbedder.d.ts.map b/cjs/core/embedders/PDFPageEmbedder.d.ts.map new file mode 100644 index 000000000..6954faf4f --- /dev/null +++ b/cjs/core/embedders/PDFPageEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/PDFPageEmbedder.ts"],"names":[],"mappings":"AAOA,OAAO,MAAM,0BAAgC;AAE7C,OAAO,UAAU,sBAA4B;AAG7C,OAAO,WAAW,kCAAwC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,2BAAyB;AAGxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC,mCAAmC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC,qCAAqC,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC,oCAAoC,CAAC;IACnD,GAAG,EAAE,MAAM,CAAC,kCAAkC,CAAC;CAChD;AAsBD,cAAM,eAAe;WACN,GAAG,CACd,IAAI,EAAE,WAAW,EACjB,WAAW,CAAC,EAAE,eAAe,EAC7B,oBAAoB,CAAC,EAAE,oBAAoB;IAK7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAEpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IAEnC,OAAO;IAgBD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B1E,OAAO,CAAC,cAAc;CAqBvB;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/PDFPageEmbedder.js b/cjs/core/embedders/PDFPageEmbedder.js new file mode 100644 index 000000000..cc9344355 --- /dev/null +++ b/cjs/core/embedders/PDFPageEmbedder.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFRawStream_1 = tslib_1.__importDefault(require("../objects/PDFRawStream")); +var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream")); +var decode_1 = require("../streams/decode"); +var PDFContentStream_1 = tslib_1.__importDefault(require("../structures/PDFContentStream")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var fullPageBoundingBox = function (page) { + var mediaBox = page.MediaBox(); + var width = mediaBox.lookup(2, PDFNumber_1.default).asNumber() - + mediaBox.lookup(0, PDFNumber_1.default).asNumber(); + var height = mediaBox.lookup(3, PDFNumber_1.default).asNumber() - + mediaBox.lookup(1, PDFNumber_1.default).asNumber(); + return { left: 0, bottom: 0, right: width, top: height }; +}; +// Returns the identity matrix, modified to position the content of the given +// bounding box at (0, 0). +var boundingBoxAdjustedMatrix = function (bb) { return [1, 0, 0, 1, -bb.left, -bb.bottom]; }; +var PDFPageEmbedder = /** @class */ (function () { + function PDFPageEmbedder(page, boundingBox, transformationMatrix) { + this.page = page; + var bb = boundingBox !== null && boundingBox !== void 0 ? boundingBox : fullPageBoundingBox(page); + this.width = bb.right - bb.left; + this.height = bb.top - bb.bottom; + this.boundingBox = bb; + this.transformationMatrix = transformationMatrix !== null && transformationMatrix !== void 0 ? transformationMatrix : boundingBoxAdjustedMatrix(bb); + } + PDFPageEmbedder.for = function (page, boundingBox, transformationMatrix) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + return [2 /*return*/, new PDFPageEmbedder(page, boundingBox, transformationMatrix)]; + }); + }); + }; + PDFPageEmbedder.prototype.embedIntoContext = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, Contents, Resources, decodedContents, _b, left, bottom, right, top, xObject; + return tslib_1.__generator(this, function (_c) { + _a = this.page.normalizedEntries(), Contents = _a.Contents, Resources = _a.Resources; + if (!Contents) + throw new errors_1.MissingPageContentsEmbeddingError(); + decodedContents = this.decodeContents(Contents); + _b = this.boundingBox, left = _b.left, bottom = _b.bottom, right = _b.right, top = _b.top; + xObject = context.flateStream(decodedContents, { + Type: 'XObject', + Subtype: 'Form', + FormType: 1, + BBox: [left, bottom, right, top], + Matrix: this.transformationMatrix, + Resources: Resources, + }); + if (ref) { + context.assign(ref, xObject); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(xObject)]; + } + return [2 /*return*/]; + }); + }); + }; + // `contents` is an array of streams which are merged to include them in the XObject. + // This methods extracts each stream and joins them with a newline character. + PDFPageEmbedder.prototype.decodeContents = function (contents) { + var newline = Uint8Array.of(CharCodes_1.default.Newline); + var decodedContents = []; + for (var idx = 0, len = contents.size(); idx < len; idx++) { + var stream = contents.lookup(idx, PDFStream_1.default); + var content = void 0; + if (stream instanceof PDFRawStream_1.default) { + content = decode_1.decodePDFRawStream(stream).decode(); + } + else if (stream instanceof PDFContentStream_1.default) { + content = stream.getUnencodedContents(); + } + else { + throw new errors_1.UnrecognizedStreamTypeError(stream); + } + decodedContents.push(content, newline); + } + return utils_1.mergeIntoTypedArray.apply(void 0, decodedContents); + }; + return PDFPageEmbedder; +}()); +exports.default = PDFPageEmbedder; +//# sourceMappingURL=PDFPageEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/PDFPageEmbedder.js.map b/cjs/core/embedders/PDFPageEmbedder.js.map new file mode 100644 index 000000000..f61c6622c --- /dev/null +++ b/cjs/core/embedders/PDFPageEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/PDFPageEmbedder.ts"],"names":[],"mappings":";;;AAAA,oCAGyB;AAEzB,2EAAmD;AACnD,iFAAyD;AAEzD,2EAAmD;AAEnD,4CAA6D;AAC7D,4FAAoE;AAEpE,0EAAkD;AAElD,qCAAgD;AAwBhD,IAAM,mBAAmB,GAAG,UAAC,IAAiB;IAC5C,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAEjC,IAAM,KAAK,GACT,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,QAAQ,EAAE;QACxC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE3C,IAAM,MAAM,GACV,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,QAAQ,EAAE;QACxC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE3C,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAC3D,CAAC,CAAC;AAEF,6EAA6E;AAC7E,0BAA0B;AAC1B,IAAM,yBAAyB,GAAG,UAChC,EAAmB,IACM,OAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAlC,CAAkC,CAAC;AAE9D;IAgBE,yBACE,IAAiB,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mode 100644 index 000000000..e292964d6 --- /dev/null +++ b/cjs/core/embedders/PngEmbedder.d.ts @@ -0,0 +1,20 @@ +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/png.coffee + */ +declare class PngEmbedder { + static for(imageData: Uint8Array): Promise; + readonly bitsPerComponent: number; + readonly height: number; + readonly width: number; + readonly colorSpace: 'DeviceRGB'; + private readonly image; + private constructor(); + embedIntoContext(context: PDFContext, ref?: PDFRef): Promise; + private embedAlphaChannel; +} +export default PngEmbedder; +//# sourceMappingURL=PngEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/PngEmbedder.d.ts.map b/cjs/core/embedders/PngEmbedder.d.ts.map new file mode 100644 index 000000000..25e5d8547 --- /dev/null +++ b/cjs/core/embedders/PngEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PngEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/PngEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAG7C;;;;GAIG;AACH,cAAM,WAAW;WACF,GAAG,CAAC,SAAS,EAAE,UAAU;IAKtC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAM;IAE5B,OAAO;IAQD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB1E,OAAO,CAAC,iBAAiB;CAe1B;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/PngEmbedder.js b/cjs/core/embedders/PngEmbedder.js new file mode 100644 index 000000000..8db386b96 --- /dev/null +++ b/cjs/core/embedders/PngEmbedder.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var png_1 = require("../../utils/png"); +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/png.coffee + */ +var PngEmbedder = /** @class */ (function () { + function PngEmbedder(png) { + this.image = png; + this.bitsPerComponent = png.bitsPerComponent; + this.width = png.width; + this.height = png.height; + this.colorSpace = 'DeviceRGB'; + } + PngEmbedder.for = function (imageData) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var png; + return tslib_1.__generator(this, function (_a) { + png = png_1.PNG.load(imageData); + return [2 /*return*/, new PngEmbedder(png)]; + }); + }); + }; + PngEmbedder.prototype.embedIntoContext = function (context, ref) { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var SMask, xObject; + return tslib_1.__generator(this, function (_a) { + SMask = this.embedAlphaChannel(context); + xObject = context.flateStream(this.image.rgbChannel, { + Type: 'XObject', + Subtype: 'Image', + BitsPerComponent: this.image.bitsPerComponent, + Width: this.image.width, + Height: this.image.height, + ColorSpace: this.colorSpace, + SMask: SMask, + }); + if (ref) { + context.assign(ref, xObject); + return [2 /*return*/, ref]; + } + else { + return [2 /*return*/, context.register(xObject)]; + } + return [2 /*return*/]; + }); + }); + }; + PngEmbedder.prototype.embedAlphaChannel = function (context) { + if (!this.image.alphaChannel) + return undefined; + var xObject = context.flateStream(this.image.alphaChannel, { + Type: 'XObject', + Subtype: 'Image', + Height: this.image.height, + Width: this.image.width, + BitsPerComponent: this.image.bitsPerComponent, + ColorSpace: 'DeviceGray', + Decode: [0, 1], + }); + return context.register(xObject); + }; + return PngEmbedder; +}()); +exports.default = PngEmbedder; +//# sourceMappingURL=PngEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/PngEmbedder.js.map b/cjs/core/embedders/PngEmbedder.js.map new file mode 100644 index 000000000..eb2dcd362 --- /dev/null +++ b/cjs/core/embedders/PngEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PngEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/PngEmbedder.ts"],"names":[],"mappings":";;;AAEA,uCAAoC;AAEpC;;;;GAIG;AACH;IAaE,qBAAoB,GAAQ;QAC1B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;IAChC,CAAC;IAlBY,eAAG,GAAhB,UAAiB,SAAqB;;;;gBAC9B,GAAG,GAAG,SAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAChC,sBAAO,IAAI,WAAW,CAAC,GAAG,CAAC,EAAC;;;KAC7B;IAiBK,sCAAgB,GAAtB,UAAuB,OAAmB,EAAE,GAAY;;;;gBAChD,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAExC,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;oBACzD,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,OAAO;oBAChB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB;oBAC7C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;oBACvB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;oBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,KAAK,OAAA;iBACN,CAAC,CAAC;gBAEH,IAAI,GAAG,EAAE;oBACP,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;oBAC7B,sBAAO,GAAG,EAAC;iBACZ;qBAAM;oBACL,sBAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAC;iBAClC;;;;KACF;IAEO,uCAAiB,GAAzB,UAA0B,OAAmB;QAC3C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY;YAAE,OAAO,SAAS,CAAC;QAE/C,IAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;YAC3D,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YACvB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAC7C,UAAU,EAAE,YAAY;YACxB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SACf,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IACH,kBAAC;AAAD,CAAC,AAzDD,IAyDC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/StandardFontEmbedder.d.ts b/cjs/core/embedders/StandardFontEmbedder.d.ts new file mode 100644 index 000000000..9a0aff348 --- /dev/null +++ b/cjs/core/embedders/StandardFontEmbedder.d.ts @@ -0,0 +1,37 @@ +import { Font, FontNames, EncodingType } from '@pdf-lib/standard-fonts'; +import PDFHexString from "../objects/PDFHexString"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +export interface Glyph { + code: number; + name: string; +} +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/foliojs/pdfkit/blob/f91bdd61c164a72ea06be1a43dc0a412afc3925f/lib/font/afm.coffee + */ +declare class StandardFontEmbedder { + static for: (fontName: FontNames, customName?: string | undefined) => StandardFontEmbedder; + readonly font: Font; + readonly encoding: EncodingType; + readonly fontName: string; + readonly customName: string | undefined; + private constructor(); + /** + * Encode the JavaScript string into this font. (JavaScript encodes strings in + * Unicode, but standard fonts use either WinAnsi, ZapfDingbats, or Symbol + * encodings) + */ + encodeText(text: string): PDFHexString; + widthOfTextAtSize(text: string, size: number): number; + heightOfFontAtSize(size: number, options?: { + descender?: boolean; + }): number; + sizeOfFontAtHeight(height: number): number; + embedIntoContext(context: PDFContext, ref?: PDFRef): PDFRef; + private widthOfGlyph; + private encodeTextAsGlyphs; +} +export default StandardFontEmbedder; +//# sourceMappingURL=StandardFontEmbedder.d.ts.map \ No newline at end of file diff --git a/cjs/core/embedders/StandardFontEmbedder.d.ts.map b/cjs/core/embedders/StandardFontEmbedder.d.ts.map new file mode 100644 index 000000000..f9a884dc7 --- /dev/null +++ b/cjs/core/embedders/StandardFontEmbedder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"StandardFontEmbedder.d.ts","sourceRoot":"","sources":["../../../src/core/embedders/StandardFontEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EACJ,SAAS,EACT,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,YAAY,gCAAsC;AACzD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAG7C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,cAAM,oBAAoB;IACxB,MAAM,CAAC,GAAG,aAAc,SAAS,2DACgB;IAEjD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC,OAAO;IAYP;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAStC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAerD,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GACpC,MAAM;IAaT,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAO1C,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IAkB3D,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,kBAAkB;CAS3B;AAED,eAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/cjs/core/embedders/StandardFontEmbedder.js b/cjs/core/embedders/StandardFontEmbedder.js new file mode 100644 index 000000000..0cdb4a179 --- /dev/null +++ b/cjs/core/embedders/StandardFontEmbedder.js @@ -0,0 +1,98 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var standard_fonts_1 = require("@pdf-lib/standard-fonts"); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var utils_1 = require("../../utils"); +/** + * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as + * this class borrows from: + * https://github.com/foliojs/pdfkit/blob/f91bdd61c164a72ea06be1a43dc0a412afc3925f/lib/font/afm.coffee + */ +var StandardFontEmbedder = /** @class */ (function () { + function StandardFontEmbedder(fontName, customName) { + // prettier-ignore + this.encoding = (fontName === standard_fonts_1.FontNames.ZapfDingbats ? standard_fonts_1.Encodings.ZapfDingbats + : fontName === standard_fonts_1.FontNames.Symbol ? standard_fonts_1.Encodings.Symbol + : standard_fonts_1.Encodings.WinAnsi); + this.font = standard_fonts_1.Font.load(fontName); + this.fontName = this.font.FontName; + this.customName = customName; + } + /** + * Encode the JavaScript string into this font. (JavaScript encodes strings in + * Unicode, but standard fonts use either WinAnsi, ZapfDingbats, or Symbol + * encodings) + */ + StandardFontEmbedder.prototype.encodeText = function (text) { + var glyphs = this.encodeTextAsGlyphs(text); + var hexCodes = new Array(glyphs.length); + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + hexCodes[idx] = utils_1.toHexString(glyphs[idx].code); + } + return PDFHexString_1.default.of(hexCodes.join('')); + }; + StandardFontEmbedder.prototype.widthOfTextAtSize = function (text, size) { + var glyphs = this.encodeTextAsGlyphs(text); + var totalWidth = 0; + for (var idx = 0, len = glyphs.length; idx < len; idx++) { + var left = glyphs[idx].name; + var right = (glyphs[idx + 1] || {}).name; + var kernAmount = this.font.getXAxisKerningForPair(left, right) || 0; + totalWidth += this.widthOfGlyph(left) + kernAmount; + } + var scale = size / 1000; + return totalWidth * scale; + }; + StandardFontEmbedder.prototype.heightOfFontAtSize = function (size, options) { + if (options === void 0) { options = {}; } + var _a = options.descender, descender = _a === void 0 ? true : _a; + var _b = this.font, Ascender = _b.Ascender, Descender = _b.Descender, FontBBox = _b.FontBBox; + var yTop = Ascender || FontBBox[3]; + var yBottom = Descender || FontBBox[1]; + var height = yTop - yBottom; + if (!descender) + height += Descender || 0; + return (height / 1000) * size; + }; + StandardFontEmbedder.prototype.sizeOfFontAtHeight = function (height) { + var _a = this.font, Ascender = _a.Ascender, Descender = _a.Descender, FontBBox = _a.FontBBox; + var yTop = Ascender || FontBBox[3]; + var yBottom = Descender || FontBBox[1]; + return (1000 * height) / (yTop - yBottom); + }; + StandardFontEmbedder.prototype.embedIntoContext = function (context, ref) { + var fontDict = context.obj({ + Type: 'Font', + Subtype: 'Type1', + BaseFont: this.customName || this.fontName, + Encoding: this.encoding === standard_fonts_1.Encodings.WinAnsi ? 'WinAnsiEncoding' : undefined, + }); + if (ref) { + context.assign(ref, fontDict); + return ref; + } + else { + return context.register(fontDict); + } + }; + StandardFontEmbedder.prototype.widthOfGlyph = function (glyphName) { + // Default to 250 if font doesn't specify a width + return this.font.getWidthOfGlyph(glyphName) || 250; + }; + StandardFontEmbedder.prototype.encodeTextAsGlyphs = function (text) { + var codePoints = Array.from(text); + var glyphs = new Array(codePoints.length); + for (var idx = 0, len = codePoints.length; idx < len; idx++) { + var codePoint = utils_1.toCodePoint(codePoints[idx]); + glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint); + } + return glyphs; + }; + StandardFontEmbedder.for = function (fontName, customName) { + return new StandardFontEmbedder(fontName, customName); + }; + return StandardFontEmbedder; +}()); +exports.default = StandardFontEmbedder; +//# sourceMappingURL=StandardFontEmbedder.js.map \ No newline at end of file diff --git a/cjs/core/embedders/StandardFontEmbedder.js.map b/cjs/core/embedders/StandardFontEmbedder.js.map new file mode 100644 index 000000000..2079dbb33 --- /dev/null +++ b/cjs/core/embedders/StandardFontEmbedder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StandardFontEmbedder.js","sourceRoot":"","sources":["../../../src/core/embedders/StandardFontEmbedder.ts"],"names":[],"mappings":";;;AAAA,0DAKiC;AAEjC,iFAAyD;AAGzD,qCAAqD;AAOrD;;;;GAIG;AACH;IASE,8BAAoB,QAAmB,EAAE,UAAmB;QAC1D,kBAAkB;QAClB,IAAI,CAAC,QAAQ,GAAG,CACZ,QAAQ,KAAK,0BAAS,CAAC,YAAY,CAAC,CAAC,CAAC,0BAAS,CAAC,YAAY;YAC9D,CAAC,CAAC,QAAQ,KAAK,0BAAS,CAAC,MAAM,CAAO,CAAC,CAAC,0BAAS,CAAC,MAAM;gBACxD,CAAC,CAAC,0BAAS,CAAC,OAAO,CACpB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,yCAAU,GAAV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SAAS;SACtE,CAAC,CAAC;QAEH,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC9B,OAAO,GAAG,CAAC;SACZ;aAAM;YACL,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACnC;IACH,CAAC;IAEO,2CAAY,GAApB,UAAqB,SAAiB;QACpC,iDAAiD;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC;IACrD,CAAC;IAEO,iDAAkB,GAA1B,UAA2B,IAAY;QACrC,IAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,IAAM,MAAM,GAAY,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACrD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3D,IAAM,SAAS,GAAG,mBAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAE,CAAC;YAChD,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;SAC/D;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAvGM,wBAAG,GAAG,UAAC,QAAmB,EAAE,UAAmB;QACpD,OAAA,IAAI,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC;IAA9C,CAA8C,CAAC;IAuGnD,2BAAC;CAAA,AAzGD,IAyGC;AAED,kBAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/cjs/core/errors.d.ts b/cjs/core/errors.d.ts new file mode 100644 index 000000000..1ac2e48a1 --- /dev/null +++ b/cjs/core/errors.d.ts @@ -0,0 +1,92 @@ +import PDFObject from "./objects/PDFObject"; +export declare class MethodNotImplementedError extends Error { + constructor(className: string, methodName: string); +} +export declare class PrivateConstructorError extends Error { + constructor(className: string); +} +export declare class UnexpectedObjectTypeError extends Error { + constructor(expected: any | any[], actual: any); +} +export declare class UnsupportedEncodingError extends Error { + constructor(encoding: string); +} +export declare class ReparseError extends Error { + constructor(className: string, methodName: string); +} +export declare class MissingCatalogError extends Error { + constructor(ref?: PDFObject); +} +export declare class MissingPageContentsEmbeddingError extends Error { + constructor(); +} +export declare class UnrecognizedStreamTypeError extends Error { + constructor(stream: any); +} +export declare class PageEmbeddingMismatchedContextError extends Error { + constructor(); +} +export declare class PDFArrayIsNotRectangleError extends Error { + constructor(size: number); +} +export declare class InvalidPDFDateStringError extends Error { + constructor(value: string); +} +export declare class InvalidTargetIndexError extends Error { + constructor(targetIndex: number, Count: number); +} +export declare class CorruptPageTreeError extends Error { + constructor(targetIndex: number, operation: string); +} +export declare class IndexOutOfBoundsError extends Error { + constructor(index: number, min: number, max: number); +} +export declare class InvalidAcroFieldValueError extends Error { + constructor(); +} +export declare class MultiSelectValueError extends Error { + constructor(); +} +export declare class MissingDAEntryError extends Error { + constructor(fieldName: string); +} +export declare class MissingTfOperatorError extends Error { + constructor(fieldName: string); +} +/***** Parser Errors ******/ +export interface Position { + line: number; + column: number; + offset: number; +} +export declare class NumberParsingError extends Error { + constructor(pos: Position, value: string); +} +export declare class PDFParsingError extends Error { + constructor(pos: Position, details: string); +} +export declare class NextByteAssertionError extends PDFParsingError { + constructor(pos: Position, expectedByte: number, actualByte: number); +} +export declare class PDFObjectParsingError extends PDFParsingError { + constructor(pos: Position, byte: number); +} +export declare class PDFInvalidObjectParsingError extends PDFParsingError { + constructor(pos: Position); +} +export declare class PDFStreamParsingError extends PDFParsingError { + constructor(pos: Position); +} +export declare class UnbalancedParenthesisError extends PDFParsingError { + constructor(pos: Position); +} +export declare class StalledParserError extends PDFParsingError { + constructor(pos: Position); +} +export declare class MissingPDFHeaderError extends PDFParsingError { + constructor(pos: Position); +} +export declare class MissingKeywordError extends PDFParsingError { + constructor(pos: Position, keyword: number[]); +} +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/cjs/core/errors.d.ts.map b/cjs/core/errors.d.ts.map new file mode 100644 index 000000000..2b33740fc --- /dev/null +++ b/cjs/core/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,4BAAmC;AAGnD,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAIlD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,SAAS,EAAE,MAAM;CAI9B;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG;CAa/C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,QAAQ,EAAE,MAAM;CAI7B;AAED,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAIlD;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,GAAG,CAAC,EAAE,SAAS;CAI5B;AAED,qBAAa,iCAAkC,SAAQ,KAAK;;CAK3D;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,MAAM,EAAE,GAAG;CAKxB;AAED,qBAAa,mCAAoC,SAAQ,KAAK;;CAK7D;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,KAAK,EAAE,MAAM;CAI1B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAInD;AA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C1C,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE;CAI7C"} \ No newline at end of file diff --git a/cjs/core/errors.js b/cjs/core/errors.js new file mode 100644 index 000000000..725b8e5ad --- /dev/null +++ b/cjs/core/errors.js @@ -0,0 +1,323 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingKeywordError = exports.MissingPDFHeaderError = exports.StalledParserError = exports.UnbalancedParenthesisError = exports.PDFStreamParsingError = exports.PDFInvalidObjectParsingError = exports.PDFObjectParsingError = exports.NextByteAssertionError = exports.PDFParsingError = exports.NumberParsingError = exports.MissingTfOperatorError = exports.MissingDAEntryError = exports.MultiSelectValueError = exports.InvalidAcroFieldValueError = exports.IndexOutOfBoundsError = exports.CorruptPageTreeError = exports.InvalidTargetIndexError = exports.InvalidPDFDateStringError = exports.PDFArrayIsNotRectangleError = exports.PageEmbeddingMismatchedContextError = exports.UnrecognizedStreamTypeError = exports.MissingPageContentsEmbeddingError = exports.MissingCatalogError = exports.ReparseError = exports.UnsupportedEncodingError = exports.UnexpectedObjectTypeError = exports.PrivateConstructorError = exports.MethodNotImplementedError = void 0; +var tslib_1 = require("tslib"); +var utils_1 = require("../utils"); +var MethodNotImplementedError = /** @class */ (function (_super) { + tslib_1.__extends(MethodNotImplementedError, _super); + function MethodNotImplementedError(className, methodName) { + var _this = this; + var msg = "Method " + className + "." + methodName + "() not implemented"; + _this = _super.call(this, msg) || this; + return _this; + } + return MethodNotImplementedError; +}(Error)); +exports.MethodNotImplementedError = MethodNotImplementedError; +var PrivateConstructorError = /** @class */ (function (_super) { + tslib_1.__extends(PrivateConstructorError, _super); + function PrivateConstructorError(className) { + var _this = this; + var msg = "Cannot construct " + className + " - it has a private constructor"; + _this = _super.call(this, msg) || this; + return _this; + } + return PrivateConstructorError; +}(Error)); +exports.PrivateConstructorError = PrivateConstructorError; +var UnexpectedObjectTypeError = /** @class */ (function (_super) { + tslib_1.__extends(UnexpectedObjectTypeError, _super); + function UnexpectedObjectTypeError(expected, actual) { + var _this = this; + var name = function (t) { var _a, _b; return (_a = t === null || t === void 0 ? void 0 : t.name) !== null && _a !== void 0 ? _a : (_b = t === null || t === void 0 ? void 0 : t.constructor) === null || _b === void 0 ? void 0 : _b.name; }; + var expectedTypes = Array.isArray(expected) + ? expected.map(name) + : [name(expected)]; + var msg = "Expected instance of " + expectedTypes.join(' or ') + ", " + + ("but got instance of " + (actual ? name(actual) : actual)); + _this = _super.call(this, msg) || this; + return _this; + } + return UnexpectedObjectTypeError; +}(Error)); +exports.UnexpectedObjectTypeError = UnexpectedObjectTypeError; +var UnsupportedEncodingError = /** @class */ (function (_super) { + tslib_1.__extends(UnsupportedEncodingError, _super); + function UnsupportedEncodingError(encoding) { + var _this = this; + var msg = encoding + " stream encoding not supported"; + _this = _super.call(this, msg) || this; + return _this; + } + return UnsupportedEncodingError; +}(Error)); +exports.UnsupportedEncodingError = UnsupportedEncodingError; +var ReparseError = /** @class */ (function (_super) { + tslib_1.__extends(ReparseError, _super); + function ReparseError(className, methodName) { + var _this = this; + var msg = "Cannot call " + className + "." + methodName + "() more than once"; + _this = _super.call(this, msg) || this; + return _this; + } + return ReparseError; +}(Error)); +exports.ReparseError = ReparseError; +var MissingCatalogError = /** @class */ (function (_super) { + tslib_1.__extends(MissingCatalogError, _super); + function MissingCatalogError(ref) { + var _this = this; + var msg = "Missing catalog (ref=" + ref + ")"; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingCatalogError; +}(Error)); +exports.MissingCatalogError = MissingCatalogError; +var MissingPageContentsEmbeddingError = /** @class */ (function (_super) { + tslib_1.__extends(MissingPageContentsEmbeddingError, _super); + function MissingPageContentsEmbeddingError() { + var _this = this; + var msg = "Can't embed page with missing Contents"; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingPageContentsEmbeddingError; +}(Error)); +exports.MissingPageContentsEmbeddingError = MissingPageContentsEmbeddingError; +var UnrecognizedStreamTypeError = /** @class */ (function (_super) { + tslib_1.__extends(UnrecognizedStreamTypeError, _super); + function UnrecognizedStreamTypeError(stream) { + var _a, _b, _c; + var _this = this; + var streamType = (_c = (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.contructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.name) !== null && _c !== void 0 ? _c : stream; + var msg = "Unrecognized stream type: " + streamType; + _this = _super.call(this, msg) || this; + return _this; + } + return UnrecognizedStreamTypeError; +}(Error)); +exports.UnrecognizedStreamTypeError = UnrecognizedStreamTypeError; +var PageEmbeddingMismatchedContextError = /** @class */ (function (_super) { + tslib_1.__extends(PageEmbeddingMismatchedContextError, _super); + function PageEmbeddingMismatchedContextError() { + var _this = this; + var msg = "Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document."; + _this = _super.call(this, msg) || this; + return _this; + } + return PageEmbeddingMismatchedContextError; +}(Error)); +exports.PageEmbeddingMismatchedContextError = PageEmbeddingMismatchedContextError; +var PDFArrayIsNotRectangleError = /** @class */ (function (_super) { + tslib_1.__extends(PDFArrayIsNotRectangleError, _super); + function PDFArrayIsNotRectangleError(size) { + var _this = this; + var msg = "Attempted to convert PDFArray with " + size + " elements to rectangle, but must have exactly 4 elements."; + _this = _super.call(this, msg) || this; + return _this; + } + return PDFArrayIsNotRectangleError; +}(Error)); +exports.PDFArrayIsNotRectangleError = PDFArrayIsNotRectangleError; +var InvalidPDFDateStringError = /** @class */ (function (_super) { + tslib_1.__extends(InvalidPDFDateStringError, _super); + function InvalidPDFDateStringError(value) { + var _this = this; + var msg = "Attempted to convert \"" + value + "\" to a date, but it does not match the PDF date string format."; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidPDFDateStringError; +}(Error)); +exports.InvalidPDFDateStringError = InvalidPDFDateStringError; +var InvalidTargetIndexError = /** @class */ (function (_super) { + tslib_1.__extends(InvalidTargetIndexError, _super); + function InvalidTargetIndexError(targetIndex, Count) { + var _this = this; + var msg = "Invalid targetIndex specified: targetIndex=" + targetIndex + " must be less than Count=" + Count; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidTargetIndexError; +}(Error)); +exports.InvalidTargetIndexError = InvalidTargetIndexError; +var CorruptPageTreeError = /** @class */ (function (_super) { + tslib_1.__extends(CorruptPageTreeError, _super); + function CorruptPageTreeError(targetIndex, operation) { + var _this = this; + var msg = "Failed to " + operation + " at targetIndex=" + targetIndex + " due to corrupt page tree: It is likely that one or more 'Count' entries are invalid"; + _this = _super.call(this, msg) || this; + return _this; + } + return CorruptPageTreeError; +}(Error)); +exports.CorruptPageTreeError = CorruptPageTreeError; +var IndexOutOfBoundsError = /** @class */ (function (_super) { + tslib_1.__extends(IndexOutOfBoundsError, _super); + function IndexOutOfBoundsError(index, min, max) { + var _this = this; + var msg = "index should be at least " + min + " and at most " + max + ", but was actually " + index; + _this = _super.call(this, msg) || this; + return _this; + } + return IndexOutOfBoundsError; +}(Error)); +exports.IndexOutOfBoundsError = IndexOutOfBoundsError; +var InvalidAcroFieldValueError = /** @class */ (function (_super) { + tslib_1.__extends(InvalidAcroFieldValueError, _super); + function InvalidAcroFieldValueError() { + var _this = this; + var msg = "Attempted to set invalid field value"; + _this = _super.call(this, msg) || this; + return _this; + } + return InvalidAcroFieldValueError; +}(Error)); +exports.InvalidAcroFieldValueError = InvalidAcroFieldValueError; +var MultiSelectValueError = /** @class */ (function (_super) { + tslib_1.__extends(MultiSelectValueError, _super); + function MultiSelectValueError() { + var _this = this; + var msg = "Attempted to select multiple values for single-select field"; + _this = _super.call(this, msg) || this; + return _this; + } + return MultiSelectValueError; +}(Error)); +exports.MultiSelectValueError = MultiSelectValueError; +var MissingDAEntryError = /** @class */ (function (_super) { + tslib_1.__extends(MissingDAEntryError, _super); + function MissingDAEntryError(fieldName) { + var _this = this; + var msg = "No /DA (default appearance) entry found for field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingDAEntryError; +}(Error)); +exports.MissingDAEntryError = MissingDAEntryError; +var MissingTfOperatorError = /** @class */ (function (_super) { + tslib_1.__extends(MissingTfOperatorError, _super); + function MissingTfOperatorError(fieldName) { + var _this = this; + var msg = "No Tf operator found for DA of field: " + fieldName; + _this = _super.call(this, msg) || this; + return _this; + } + return MissingTfOperatorError; +}(Error)); +exports.MissingTfOperatorError = MissingTfOperatorError; +var NumberParsingError = /** @class */ (function (_super) { + tslib_1.__extends(NumberParsingError, _super); + function NumberParsingError(pos, value) { + var _this = this; + var msg = "Failed to parse number " + + ("(line:" + pos.line + " col:" + pos.column + " offset=" + pos.offset + "): \"" + value + "\""); + _this = _super.call(this, msg) || this; + return _this; + } + return NumberParsingError; +}(Error)); +exports.NumberParsingError = NumberParsingError; +var PDFParsingError = /** @class */ (function (_super) { + tslib_1.__extends(PDFParsingError, _super); + function PDFParsingError(pos, details) { + var _this = this; + var msg = "Failed to parse PDF document " + + ("(line:" + pos.line + " col:" + pos.column + " offset=" + pos.offset + "): " + details); + _this = _super.call(this, msg) || this; + return _this; + } + return PDFParsingError; +}(Error)); +exports.PDFParsingError = PDFParsingError; +var NextByteAssertionError = /** @class */ (function (_super) { + tslib_1.__extends(NextByteAssertionError, _super); + function NextByteAssertionError(pos, expectedByte, actualByte) { + var _this = this; + var msg = "Expected next byte to be " + expectedByte + " but it was actually " + actualByte; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return NextByteAssertionError; +}(PDFParsingError)); +exports.NextByteAssertionError = NextByteAssertionError; +var PDFObjectParsingError = /** @class */ (function (_super) { + tslib_1.__extends(PDFObjectParsingError, _super); + function PDFObjectParsingError(pos, byte) { + var _this = this; + var msg = "Failed to parse PDF object starting with the following byte: " + byte; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFObjectParsingError; +}(PDFParsingError)); +exports.PDFObjectParsingError = PDFObjectParsingError; +var PDFInvalidObjectParsingError = /** @class */ (function (_super) { + tslib_1.__extends(PDFInvalidObjectParsingError, _super); + function PDFInvalidObjectParsingError(pos) { + var _this = this; + var msg = "Failed to parse invalid PDF object"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFInvalidObjectParsingError; +}(PDFParsingError)); +exports.PDFInvalidObjectParsingError = PDFInvalidObjectParsingError; +var PDFStreamParsingError = /** @class */ (function (_super) { + tslib_1.__extends(PDFStreamParsingError, _super); + function PDFStreamParsingError(pos) { + var _this = this; + var msg = "Failed to parse PDF stream"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return PDFStreamParsingError; +}(PDFParsingError)); +exports.PDFStreamParsingError = PDFStreamParsingError; +var UnbalancedParenthesisError = /** @class */ (function (_super) { + tslib_1.__extends(UnbalancedParenthesisError, _super); + function UnbalancedParenthesisError(pos) { + var _this = this; + var msg = "Failed to parse PDF literal string due to unbalanced parenthesis"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return UnbalancedParenthesisError; +}(PDFParsingError)); +exports.UnbalancedParenthesisError = UnbalancedParenthesisError; +var StalledParserError = /** @class */ (function (_super) { + tslib_1.__extends(StalledParserError, _super); + function StalledParserError(pos) { + var _this = this; + var msg = "Parser stalled"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return StalledParserError; +}(PDFParsingError)); +exports.StalledParserError = StalledParserError; +var MissingPDFHeaderError = /** @class */ (function (_super) { + tslib_1.__extends(MissingPDFHeaderError, _super); + function MissingPDFHeaderError(pos) { + var _this = this; + var msg = "No PDF header found"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return MissingPDFHeaderError; +}(PDFParsingError)); +exports.MissingPDFHeaderError = MissingPDFHeaderError; +var MissingKeywordError = /** @class */ (function (_super) { + tslib_1.__extends(MissingKeywordError, _super); + function MissingKeywordError(pos, keyword) { + var _this = this; + var msg = "Did not find expected keyword '" + utils_1.arrayAsString(keyword) + "'"; + _this = _super.call(this, pos, msg) || this; + return _this; + } + return MissingKeywordError; +}(PDFParsingError)); +exports.MissingKeywordError = MissingKeywordError; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/cjs/core/errors.js.map b/cjs/core/errors.js.map new file mode 100644 index 000000000..6866ccd67 --- /dev/null +++ b/cjs/core/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":";;;;AAEA,kCAA0C;AAE1C;IAA+C,qDAAK;IAClD,mCAAY,SAAiB,EAAE,UAAkB;QAAjD,iBAGC;QAFC,IAAM,GAAG,GAAG,YAAU,SAAS,SAAI,UAAU,uBAAoB,CAAC;QAClE,QAAA,kBAAM,GAAG,CAAC,SAAC;;IACb,CAAC;IACH,gCAAC;AAAD,CAAC,AALD,CAA+C,KAAK,GAKnD;AALY,8DAAyB;AAOtC;IAA6C,mDAAK;IAChD,iCAAY,SAAiB;QAA7B,iBAGC;QAFC,IAAM,GAAG,GAAG,sBAAoB,SAAS,oCAAiC,CAAC;QAC3E,QAAA,kBAAM,GAAG,CAAC,SAAC;;IACb,CAAC;IACH,8BAAC;AAAD,CAAC,AALD,CAA6C,KAAK,GAKjD;AALY,0DAAuB;AAOpC;IAA+C,qDAAK;IAClD,mCAAY,QAAqB,EAAE,MAAW;QAA9C,iBAYC;QAXC,IAAM,IAAI,GAAG,UAAC,CAAM,6BAAK,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,yCAAI,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,WAAW,0CAAE,IAAI,GAAA,CAAC;QAEzD,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC3C,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;YACpB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAErB,IAAM,GAAG,GACP,0BAAwB,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAI;aACtD,0BAAuB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAE,CAAA,CAAC;QAE1D,QAAA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iDAAe;IACxD,+BAAY,GAAa;QAAzB,iBAGC;QAFC,IAAM,GAAG,GAAG,4BAA4B,CAAC;QACzC,QAAA,kBAAM,GAAG,EAAE,GAAG,CAAC,SAAC;;IAClB,CAAC;IACH,4BAAC;AAAD,CAAC,AALD,CAA2C,eAAe,GAKzD;AALY,sDAAqB;AAOlC;IAAgD,sDAAe;IAC7D,oCAAY,GAAa;QAAzB,iBAGC;QAFC,IAAM,GAAG,GAAG,kEAAkE,CAAC;QAC/E,QAAA,kBAAM,GAAG,EAAE,GAAG,CAAC,SAAC;;IAClB,CAAC;IACH,iCAAC;AAAD,CAAC,AALD,CAAgD,eAAe,GAK9D;AALY,gEAA0B;AAOvC;IAAwC,8CAAe;IACrD,4BAAY,GAAa;QAAzB,iBAGC;QAFC,IAAM,GAAG,GAAG,gBAAgB,CAAC;QAC7B,QAAA,kBAAM,GAAG,EAAE,GAAG,CAAC,SAAC;;IAClB,CAAC;IACH,yBAAC;AAAD,CAAC,AALD,CAAwC,eAAe,GAKtD;AALY,gDAAkB;AAO/B;IAA2C,iDAAe;IACxD,+BAAY,GAAa;QAAzB,iBAGC;QAFC,IAAM,GAAG,GAAG,qBAAqB,CAAC;QAClC,QAAA,kBAAM,GAAG,EAAE,GAAG,CAAC,SAAC;;IAClB,CAAC;IACH,4BAAC;AAAD,CAAC,AALD,CAA2C,eAAe,GAKzD;AALY,sDAAqB;AAOlC;IAAyC,+CAAe;IACtD,6BAAY,GAAa,EAAE,OAAiB;QAA5C,iBAGC;QAFC,IAAM,GAAG,GAAG,oCAAkC,qBAAa,CAAC,OAAO,CAAC,MAAG,CAAC;QACxE,QAAA,kBAAM,GAAG,EAAE,GAAG,CAAC,SAAC;;IAClB,CAAC;IACH,0BAAC;AAAD,CAAC,AALD,CAAyC,eAAe,GAKvD;AALY,kDAAmB"} \ No newline at end of file diff --git a/cjs/core/index.d.ts b/cjs/core/index.d.ts new file mode 100644 index 000000000..74d2a8f62 --- /dev/null +++ b/cjs/core/index.d.ts @@ -0,0 +1,48 @@ +export * from "./errors"; +export { default as CharCodes } from "./syntax/CharCodes"; +export { default as PDFContext } from "./PDFContext"; +export { default as PDFObjectCopier } from "./PDFObjectCopier"; +export { default as PDFWriter } from "./writers/PDFWriter"; +export { default as PDFStreamWriter } from "./writers/PDFStreamWriter"; +export { default as PDFHeader } from "./document/PDFHeader"; +export { default as PDFTrailer } from "./document/PDFTrailer"; +export { default as PDFTrailerDict } from "./document/PDFTrailerDict"; +export { default as PDFCrossRefSection } from "./document/PDFCrossRefSection"; +export { default as StandardFontEmbedder } from "./embedders/StandardFontEmbedder"; +export { default as CustomFontEmbedder } from "./embedders/CustomFontEmbedder"; +export { default as CustomFontSubsetEmbedder } from "./embedders/CustomFontSubsetEmbedder"; +export { default as FileEmbedder, AFRelationship, } from "./embedders/FileEmbedder"; +export { default as JpegEmbedder } from "./embedders/JpegEmbedder"; +export { default as PngEmbedder } from "./embedders/PngEmbedder"; +export { default as PDFPageEmbedder, PageBoundingBox, } from "./embedders/PDFPageEmbedder"; +export { default as ViewerPreferences, NonFullScreenPageMode, ReadingDirection, PrintScaling, Duplex, } from "./interactive/ViewerPreferences"; +export { default as PDFObject } from "./objects/PDFObject"; +export { default as PDFBool } from "./objects/PDFBool"; +export { default as PDFNumber } from "./objects/PDFNumber"; +export { default as PDFString } from "./objects/PDFString"; +export { default as PDFHexString } from "./objects/PDFHexString"; +export { default as PDFName } from "./objects/PDFName"; +export { default as PDFNull } from "./objects/PDFNull"; +export { default as PDFArray } from "./objects/PDFArray"; +export { default as PDFDict } from "./objects/PDFDict"; +export { default as PDFRef } from "./objects/PDFRef"; +export { default as PDFInvalidObject } from "./objects/PDFInvalidObject"; +export { default as PDFStream } from "./objects/PDFStream"; +export { default as PDFRawStream } from "./objects/PDFRawStream"; +export { default as PDFCatalog } from "./structures/PDFCatalog"; +export { default as PDFContentStream } from "./structures/PDFContentStream"; +export { default as PDFCrossRefStream } from "./structures/PDFCrossRefStream"; +export { default as PDFObjectStream } from "./structures/PDFObjectStream"; +export { default as PDFPageTree } from "./structures/PDFPageTree"; +export { default as PDFPageLeaf } from "./structures/PDFPageLeaf"; +export { default as PDFFlateStream } from "./structures/PDFFlateStream"; +export { default as PDFOperator } from "./operators/PDFOperator"; +export { default as PDFOperatorNames } from "./operators/PDFOperatorNames"; +export { default as PDFObjectParser } from "./parser/PDFObjectParser"; +export { default as PDFObjectStreamParser } from "./parser/PDFObjectStreamParser"; +export { default as PDFParser } from "./parser/PDFParser"; +export { default as PDFXRefStreamParser } from "./parser/PDFXRefStreamParser"; +export { decodePDFRawStream } from "./streams/decode"; +export * from "./annotation"; +export * from "./acroform"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/core/index.d.ts.map b/cjs/core/index.d.ts.map new file mode 100644 index 000000000..cfa2e7904 --- /dev/null +++ b/cjs/core/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAqEinC,UAAU,CArE3lC;AAChC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAoE4lC,oBAAoB,CApE9kC;AAEjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAkE+mC,cAAc,CAlEjmC;AAC5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAiEwnC,mBAAmB,CAjE1mC;AACtE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAgEipC,qBAAqB,CAhEnoC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MA+DgqC,2BAA2B,CA/DlpC;AAE9E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MA6DisC,sBAAsB,CA7DnrC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MA4DstC,uBAAuB,CA5DxsC;AACrE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MA2DyuC,2BAA2B,CA3D3tC;AAC7E,OAAO,EAAE,OAAO,IA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EAAE,MAM+mE,8BAA8B,CANjmE;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAIypE,kBAAkB,CAJ3oE;AAE7D,cAEwsE,cAAc,CAFlrE;AACpC,cACstE,YAAY,CADhsE"} \ No newline at end of file diff --git a/cjs/core/index.js b/cjs/core/index.js new file mode 100644 index 000000000..ce599f153 --- /dev/null +++ b/cjs/core/index.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./errors"), exports); +var CharCodes_1 = require("./syntax/CharCodes"); +Object.defineProperty(exports, "CharCodes", { enumerable: true, get: function () { return CharCodes_1.default; } }); +var PDFContext_1 = require("./PDFContext"); +Object.defineProperty(exports, "PDFContext", { enumerable: true, get: function () { return PDFContext_1.default; } }); +var PDFObjectCopier_1 = require("./PDFObjectCopier"); +Object.defineProperty(exports, "PDFObjectCopier", { enumerable: true, get: function () { return PDFObjectCopier_1.default; } }); +var PDFWriter_1 = require("./writers/PDFWriter"); +Object.defineProperty(exports, "PDFWriter", { enumerable: true, get: function () { return PDFWriter_1.default; } }); +var PDFStreamWriter_1 = require("./writers/PDFStreamWriter"); +Object.defineProperty(exports, "PDFStreamWriter", { enumerable: true, get: function () { return PDFStreamWriter_1.default; } }); +var PDFHeader_1 = require("./document/PDFHeader"); +Object.defineProperty(exports, "PDFHeader", { enumerable: true, get: function () { return PDFHeader_1.default; } }); +var PDFTrailer_1 = require("./document/PDFTrailer"); +Object.defineProperty(exports, "PDFTrailer", { enumerable: true, get: function () { return PDFTrailer_1.default; } }); +var PDFTrailerDict_1 = require("./document/PDFTrailerDict"); +Object.defineProperty(exports, "PDFTrailerDict", { enumerable: true, get: function () { return PDFTrailerDict_1.default; } }); +var PDFCrossRefSection_1 = require("./document/PDFCrossRefSection"); +Object.defineProperty(exports, "PDFCrossRefSection", { enumerable: true, get: function () { return PDFCrossRefSection_1.default; } }); +var StandardFontEmbedder_1 = require("./embedders/StandardFontEmbedder"); +Object.defineProperty(exports, "StandardFontEmbedder", { enumerable: true, get: function () { return StandardFontEmbedder_1.default; } }); +var CustomFontEmbedder_1 = require("./embedders/CustomFontEmbedder"); +Object.defineProperty(exports, "CustomFontEmbedder", { enumerable: true, get: function () { return CustomFontEmbedder_1.default; } }); +var CustomFontSubsetEmbedder_1 = require("./embedders/CustomFontSubsetEmbedder"); +Object.defineProperty(exports, "CustomFontSubsetEmbedder", { enumerable: true, get: function () { return CustomFontSubsetEmbedder_1.default; } }); +var FileEmbedder_1 = require("./embedders/FileEmbedder"); +Object.defineProperty(exports, "FileEmbedder", { enumerable: true, get: function () { return FileEmbedder_1.default; } }); +Object.defineProperty(exports, "AFRelationship", { enumerable: true, get: function () { return FileEmbedder_1.AFRelationship; } }); +var JpegEmbedder_1 = require("./embedders/JpegEmbedder"); +Object.defineProperty(exports, "JpegEmbedder", { enumerable: true, get: function () { return JpegEmbedder_1.default; } }); +var PngEmbedder_1 = require("./embedders/PngEmbedder"); +Object.defineProperty(exports, "PngEmbedder", { enumerable: true, get: function () { return PngEmbedder_1.default; } }); +var PDFPageEmbedder_1 = require("./embedders/PDFPageEmbedder"); +Object.defineProperty(exports, "PDFPageEmbedder", { enumerable: true, get: function () { return PDFPageEmbedder_1.default; } }); +var ViewerPreferences_1 = require("./interactive/ViewerPreferences"); +Object.defineProperty(exports, "ViewerPreferences", { enumerable: true, get: function () { return ViewerPreferences_1.default; } }); +Object.defineProperty(exports, "NonFullScreenPageMode", { enumerable: true, get: function () { return ViewerPreferences_1.NonFullScreenPageMode; } }); +Object.defineProperty(exports, "ReadingDirection", { enumerable: true, get: function () { return ViewerPreferences_1.ReadingDirection; } }); +Object.defineProperty(exports, "PrintScaling", { enumerable: true, get: function () { return ViewerPreferences_1.PrintScaling; } }); +Object.defineProperty(exports, "Duplex", { enumerable: true, get: function () { return ViewerPreferences_1.Duplex; } }); +var PDFObject_1 = require("./objects/PDFObject"); +Object.defineProperty(exports, "PDFObject", { enumerable: true, get: function () { return PDFObject_1.default; } }); +var PDFBool_1 = require("./objects/PDFBool"); +Object.defineProperty(exports, "PDFBool", { enumerable: true, get: function () { return PDFBool_1.default; } }); +var PDFNumber_1 = require("./objects/PDFNumber"); +Object.defineProperty(exports, "PDFNumber", { enumerable: true, get: function () { return PDFNumber_1.default; } }); +var PDFString_1 = require("./objects/PDFString"); +Object.defineProperty(exports, "PDFString", { enumerable: true, get: function () { return PDFString_1.default; } }); +var PDFHexString_1 = require("./objects/PDFHexString"); +Object.defineProperty(exports, "PDFHexString", { enumerable: true, get: function () { return PDFHexString_1.default; } }); +var PDFName_1 = require("./objects/PDFName"); +Object.defineProperty(exports, "PDFName", { enumerable: true, get: function () { return PDFName_1.default; } }); +var PDFNull_1 = require("./objects/PDFNull"); +Object.defineProperty(exports, "PDFNull", { enumerable: true, get: function () { return PDFNull_1.default; } }); +var PDFArray_1 = require("./objects/PDFArray"); +Object.defineProperty(exports, "PDFArray", { enumerable: true, get: function () { return PDFArray_1.default; } }); +var PDFDict_1 = require("./objects/PDFDict"); +Object.defineProperty(exports, "PDFDict", { enumerable: true, get: function () { return PDFDict_1.default; } }); +var PDFRef_1 = require("./objects/PDFRef"); +Object.defineProperty(exports, "PDFRef", { enumerable: true, get: function () { return PDFRef_1.default; } }); +var PDFInvalidObject_1 = require("./objects/PDFInvalidObject"); +Object.defineProperty(exports, "PDFInvalidObject", { enumerable: true, get: function () { return PDFInvalidObject_1.default; } }); +var PDFStream_1 = require("./objects/PDFStream"); +Object.defineProperty(exports, "PDFStream", { enumerable: true, get: function () { return PDFStream_1.default; } }); +var PDFRawStream_1 = require("./objects/PDFRawStream"); +Object.defineProperty(exports, "PDFRawStream", { enumerable: true, get: function () { return PDFRawStream_1.default; } }); +var PDFCatalog_1 = require("./structures/PDFCatalog"); +Object.defineProperty(exports, "PDFCatalog", { enumerable: true, get: function () { return PDFCatalog_1.default; } }); +var PDFContentStream_1 = require("./structures/PDFContentStream"); +Object.defineProperty(exports, "PDFContentStream", { enumerable: true, get: function () { return PDFContentStream_1.default; } }); +var PDFCrossRefStream_1 = require("./structures/PDFCrossRefStream"); +Object.defineProperty(exports, "PDFCrossRefStream", { enumerable: true, get: function () { return PDFCrossRefStream_1.default; } }); +var PDFObjectStream_1 = require("./structures/PDFObjectStream"); +Object.defineProperty(exports, "PDFObjectStream", { enumerable: true, get: function () { return PDFObjectStream_1.default; } }); +var PDFPageTree_1 = require("./structures/PDFPageTree"); +Object.defineProperty(exports, "PDFPageTree", { enumerable: true, get: function () { return PDFPageTree_1.default; } }); +var PDFPageLeaf_1 = require("./structures/PDFPageLeaf"); +Object.defineProperty(exports, "PDFPageLeaf", { enumerable: true, get: function () { return PDFPageLeaf_1.default; } }); +var PDFFlateStream_1 = require("./structures/PDFFlateStream"); +Object.defineProperty(exports, "PDFFlateStream", { enumerable: true, get: function () { return PDFFlateStream_1.default; } }); +var PDFOperator_1 = require("./operators/PDFOperator"); +Object.defineProperty(exports, "PDFOperator", { enumerable: true, get: function () { return PDFOperator_1.default; } }); +var PDFOperatorNames_1 = require("./operators/PDFOperatorNames"); +Object.defineProperty(exports, "PDFOperatorNames", { enumerable: true, get: function () { return PDFOperatorNames_1.default; } }); +var PDFObjectParser_1 = require("./parser/PDFObjectParser"); +Object.defineProperty(exports, "PDFObjectParser", { enumerable: true, get: function () { return PDFObjectParser_1.default; } }); +var PDFObjectStreamParser_1 = require("./parser/PDFObjectStreamParser"); +Object.defineProperty(exports, "PDFObjectStreamParser", { enumerable: true, get: function () { return PDFObjectStreamParser_1.default; } }); +var PDFParser_1 = require("./parser/PDFParser"); +Object.defineProperty(exports, "PDFParser", { enumerable: true, get: function () { return PDFParser_1.default; } }); +var PDFXRefStreamParser_1 = require("./parser/PDFXRefStreamParser"); +Object.defineProperty(exports, "PDFXRefStreamParser", { enumerable: true, get: function () { return PDFXRefStreamParser_1.default; } }); +var decode_1 = require("./streams/decode"); +Object.defineProperty(exports, "decodePDFRawStream", { enumerable: true, get: function () { return decode_1.decodePDFRawStream; } }); +tslib_1.__exportStar(require("./annotation"), exports); +tslib_1.__exportStar(require("./acroform"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/core/index.js.map b/cjs/core/index.js.map new file mode 100644 index 000000000..2bd4203da --- /dev/null +++ b/cjs/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgC;AAChC,gDAAiE;AAAxD,sGAAA,OAAO,OAAa;AAE7B,2CAA4D;AAAnD,wGAAA,OAAO,OAAc;AAC9B,qDAAsE;AAA7D,kHAAA,OAAO,OAAmB;AACnC,iDAAkE;AAAzD,sGAAA,OAAO,OAAa;AAC7B,6DAA8E;AAArE,kHAAA,OAAO,OAAmB;AAEnC,kDAAmE;AAA1D,sGAAA,OAAO,OAAa;AAC7B,oDAAqE;AAA5D,wGAAA,OAAO,OAAc;AAC9B,4DAA6E;AAApE,gHAAA,OAAO,OAAkB;AAClC,oEAAqF;AAA5E,wHAAA,OAAO,OAAsB;AAEtC,yEAA0F;AAAjF,4HAAA,OAAO,OAAwB;AACxC,qEAAsF;AAA7E,wHAAA,OAAO,OAAsB;AACtC,iFAAkG;AAAzF,oIAAA,OAAO,OAA4B;AAC5C,yDAGyC;AAFvC,4GAAA,OAAO,OAAgB;AACvB,8GAAA,cAAc,OAAA;AAEhB,yDAA0E;AAAjE,4GAAA,OAAO,OAAgB;AAChC,uDAAwE;AAA/D,0GAAA,OAAO,OAAe;AAC/B,+DAG4C;AAF1C,kHAAA,OAAO,OAAmB;AAI5B,qEAMgD;AAL9C,sHAAA,OAAO,OAAqB;AAC5B,0HAAA,qBAAqB,OAAA;AACrB,qHAAA,gBAAgB,OAAA;AAChB,iHAAA,YAAY,OAAA;AACZ,2GAAA,MAAM,OAAA;AAGR,iDAAkE;AAAzD,sGAAA,OAAO,OAAa;AAC7B,6CAA8D;AAArD,kGAAA,OAAO,OAAW;AAC3B,iDAAkE;AAAzD,sGAAA,OAAO,OAAa;AAC7B,iDAAkE;AAAzD,sGAAA,OAAO,OAAa;AAC7B,uDAAwE;AAA/D,4GAAA,OAAO,OAAgB;AAChC,6CAA8D;AAArD,kGAAA,OAAO,OAAW;AAC3B,6CAA8D;AAArD,kGAAA,OAAO,OAAW;AAC3B,+CAAgE;AAAvD,oGAAA,OAAO,OAAY;AAC5B,6CAA8D;AAArD,kGAAA,OAAO,OAAW;AAC3B,2CAA4D;AAAnD,gGAAA,OAAO,OAAU;AAC1B,+DAAgF;AAAvE,oHAAA,OAAO,OAAoB;AACpC,iDAAkE;AAAzD,sGAAA,OAAO,OAAa;AAC7B,uDAAwE;AAA/D,4GAAA,OAAO,OAAgB;AAEhC,sDAAuE;AAA9D,wGAAA,OAAO,OAAc;AAC9B,kEAAmF;AAA1E,oHAAA,OAAO,OAAoB;AACpC,oEAAqF;AAA5E,sHAAA,OAAO,OAAqB;AACrC,gEAAiF;AAAxE,kHAAA,OAAO,OAAmB;AACnC,wDAAyE;AAAhE,0GAAA,OAAO,OAAe;AAC/B,wDAAyE;AAAhE,0GAAA,OAAO,OAAe;AAC/B,8DAA+E;AAAtE,gHAAA,OAAO,OAAkB;AAElC,uDAAwE;AAA/D,0GAAA,OAAO,OAAe;AAC/B,iEAAkF;AAAzE,oHAAA,OAAO,OAAoB;AAEpC,4DAA6E;AAApE,kHAAA,OAAO,OAAmB;AACnC,wEAAyF;AAAhF,8HAAA,OAAO,OAAyB;AACzC,gDAAiE;AAAxD,sGAAA,OAAO,OAAa;AAC7B,oEAAqF;AAA5E,0HAAA,OAAO,OAAuB;AAEvC,2CAA6D;AAApD,4GAAA,kBAAkB,OAAA;AAE3B,uDAAoC;AACpC,qDAAkC"} \ No newline at end of file diff --git a/cjs/core/interactive/ViewerPreferences.d.ts b/cjs/core/interactive/ViewerPreferences.d.ts new file mode 100644 index 000000000..eb5e7214c --- /dev/null +++ b/cjs/core/interactive/ViewerPreferences.d.ts @@ -0,0 +1,348 @@ +import PDFArray from "../objects/PDFArray"; +import PDFBool from "../objects/PDFBool"; +import PDFDict from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFNumber from "../objects/PDFNumber"; +import PDFContext from "../PDFContext"; +export declare enum NonFullScreenPageMode { + /** + * After exiting FullScreen mode, neither the document outline nor thumbnail + * images should be visible. + */ + UseNone = "UseNone", + /** After exiting FullScreen mode, the document outline should be visible. */ + UseOutlines = "UseOutlines", + /** After exiting FullScreen mode, thumbnail images should be visible. */ + UseThumbs = "UseThumbs", + /** + * After exiting FullScreen mode, the optional content group panel should be + * visible. + */ + UseOC = "UseOC" +} +export declare enum ReadingDirection { + /** The predominant reading order is Left to Right. */ + L2R = "L2R", + /** + * The predominant reading order is Right to left (including vertical writing + * systems, such as Chinese, Japanese and Korean). + */ + R2L = "R2L" +} +export declare enum PrintScaling { + /** No page scaling. */ + None = "None", + AppDefault = "AppDefault" +} +export declare enum Duplex { + /** The PDF reader should print single-sided. */ + Simplex = "Simplex", + /** + * The PDF reader should print double sided and flip on the short edge of the + * sheet. + */ + DuplexFlipShortEdge = "DuplexFlipShortEdge", + /** + * The PDF reader should print double sided and flip on the long edge of the + * sheet. + */ + DuplexFlipLongEdge = "DuplexFlipLongEdge" +} +declare type BoolViewerPrefKey = 'HideToolbar' | 'HideMenubar' | 'HideWindowUI' | 'FitWindow' | 'CenterWindow' | 'DisplayDocTitle' | 'PickTrayByPDFSize'; +declare type NameViewerPrefKey = 'NonFullScreenPageMode' | 'Direction' | 'PrintScaling' | 'Duplex'; +interface PageRange { + start: number; + end: number; +} +declare class ViewerPreferences { + /** @ignore */ + readonly dict: PDFDict; + /** @ignore */ + static fromDict: (dict: PDFDict) => ViewerPreferences; + /** @ignore */ + static create: (context: PDFContext) => ViewerPreferences; + /** @ignore */ + protected constructor(dict: PDFDict); + protected lookupBool(key: BoolViewerPrefKey): PDFBool | undefined; + protected lookupName(key: NameViewerPrefKey): PDFName | undefined; + /** @ignore */ + HideToolbar(): PDFBool | undefined; + /** @ignore */ + HideMenubar(): PDFBool | undefined; + /** @ignore */ + HideWindowUI(): PDFBool | undefined; + /** @ignore */ + FitWindow(): PDFBool | undefined; + /** @ignore */ + CenterWindow(): PDFBool | undefined; + /** @ignore */ + DisplayDocTitle(): PDFBool | undefined; + /** @ignore */ + NonFullScreenPageMode(): PDFName | undefined; + /** @ignore */ + Direction(): PDFName | undefined; + /** @ignore */ + PrintScaling(): PDFName | undefined; + /** @ignore */ + Duplex(): PDFName | undefined; + /** @ignore */ + PickTrayByPDFSize(): PDFBool | undefined; + /** @ignore */ + PrintPageRange(): PDFArray | undefined; + /** @ignore */ + NumCopies(): PDFNumber | undefined; + /** + * Returns `true` if PDF readers should hide the toolbar menus when displaying + * this document. + * @returns Whether or not toolbars should be hidden. + */ + getHideToolbar(): boolean; + /** + * Returns `true` if PDF readers should hide the menu bar when displaying this + * document. + * @returns Whether or not the menu bar should be hidden. + */ + getHideMenubar(): boolean; + /** + * Returns `true` if PDF readers should hide the user interface elements in + * the document's window (such as scroll bars and navigation controls), + * leaving only the document's contents displayed. + * @returns Whether or not user interface elements should be hidden. + */ + getHideWindowUI(): boolean; + /** + * Returns `true` if PDF readers should resize the document's window to fit + * the size of the first displayed page. + * @returns Whether or not the window should be resized to fit. + */ + getFitWindow(): boolean; + /** + * Returns `true` if PDF readers should position the document's window in the + * center of the screen. + * @returns Whether or not to center the document window. + */ + getCenterWindow(): boolean; + /** + * Returns `true` if the window's title bar should display the document + * `Title`, taken from the document metadata (see [[PDFDocument.getTitle]]). + * Returns `false` if the title bar should instead display the filename of the + * PDF file. + * @returns Whether to display the document title. + */ + getDisplayDocTitle(): boolean; + /** + * Returns the page mode, which tells the PDF reader how to display the + * document after exiting full-screen mode. + * @returns The page mode after exiting full-screen mode. + */ + getNonFullScreenPageMode(): NonFullScreenPageMode; + /** + * Returns the predominant reading order for text. + * @returns The text reading order. + */ + getReadingDirection(): ReadingDirection; + /** + * Returns the page scaling option that the PDF reader should select when the + * print dialog is displayed. + * @returns The page scaling option. + */ + getPrintScaling(): PrintScaling; + /** + * Returns the paper handling option that should be used when printing the + * file from the print dialog. + * @returns The paper handling option. + */ + getDuplex(): Duplex | undefined; + /** + * Returns `true` if the PDF page size should be used to select the input + * paper tray. + * @returns Whether or not the PDF page size should be used to select the + * input paper tray. + */ + getPickTrayByPDFSize(): boolean | undefined; + /** + * Returns an array of page number ranges, which are the values used to + * initialize the print dialog box when the file is printed. Each range + * specifies the first (`start`) and last (`end`) pages in a sub-range of + * pages to be printed. The first page of the PDF file is denoted by 0. + * For example: + * ```js + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * const includesPage3 = viewerPrefs + * .getPrintRanges() + * .some(pr => pr.start =< 2 && pr.end >= 2) + * if (includesPage3) console.log('printRange includes page 3') + * ``` + * @returns An array of objects, each with the properties `start` and `end`, + * denoting page indices. If not, specified an empty array is + * returned. + */ + getPrintPageRange(): PageRange[]; + /** + * Returns the number of copies to be printed when the print dialog is opened + * for this document. + * @returns The default number of copies to be printed. + */ + getNumCopies(): number; + /** + * Choose whether the PDF reader's toolbars should be hidden while the + * document is active. + * @param hideToolbar `true` if the toolbar should be hidden. + */ + setHideToolbar(hideToolbar: boolean): void; + /** + * Choose whether the PDF reader's menu bar should be hidden while the + * document is active. + * @param hideMenubar `true` if the menu bar should be hidden. + */ + setHideMenubar(hideMenubar: boolean): void; + /** + * Choose whether the PDF reader should hide user interface elements in the + * document's window (such as scroll bars and navigation controls), leaving + * only the document's contents displayed. + * @param hideWindowUI `true` if the user interface elements should be hidden. + */ + setHideWindowUI(hideWindowUI: boolean): void; + /** + * Choose whether the PDF reader should resize the document's window to fit + * the size of the first displayed page. + * @param fitWindow `true` if the window should be resized. + */ + setFitWindow(fitWindow: boolean): void; + /** + * Choose whether the PDF reader should position the document's window in the + * center of the screen. + * @param centerWindow `true` if the window should be centered. + */ + setCenterWindow(centerWindow: boolean): void; + /** + * Choose whether the window's title bar should display the document `Title` + * taken from the document metadata (see [[PDFDocument.setTitle]]). If + * `false`, the title bar should instead display the PDF filename. + * @param displayTitle `true` if the document title should be displayed. + */ + setDisplayDocTitle(displayTitle: boolean): void; + /** + * Choose how the PDF reader should display the document upon exiting + * full-screen mode. This entry is meaningful only if the value of the + * `PageMode` entry in the document's [[PDFCatalog]] is `FullScreen`. + * + * For example: + * ```js + * import { PDFDocument, NonFullScreenPageMode, PDFName } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * + * // Set the PageMode + * pdfDoc.catalog.set(PDFName.of('PageMode'),PDFName.of('FullScreen')) + * + * // Set what happens when full-screen is closed + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines) + * ``` + * + * @param nonFullScreenPageMode How the document should be displayed upon + * exiting full screen mode. + */ + setNonFullScreenPageMode(nonFullScreenPageMode: NonFullScreenPageMode): void; + /** + * Choose the predominant reading order for text. + * + * This entry has no direct effect on the document's contents or page + * numbering, but may be used to determine the relative positioning of pages + * when displayed side by side or printed n-up. + * + * For example: + * ```js + * import { PDFDocument, ReadingDirection } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setReadingDirection(ReadingDirection.R2L) + * ``` + * + * @param readingDirection The reading order for text. + */ + setReadingDirection(readingDirection: ReadingDirection): void; + /** + * Choose the page scaling option that should be selected when a print dialog + * is displayed for this document. + * + * For example: + * ```js + * import { PDFDocument, PrintScaling } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setPrintScaling(PrintScaling.None) + * ``` + * + * @param printScaling The print scaling option. + */ + setPrintScaling(printScaling: PrintScaling): void; + /** + * Choose the paper handling option that should be selected by default in the + * print dialog. + * + * For example: + * ```js + * import { PDFDocument, Duplex } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setDuplex(Duplex.DuplexFlipShortEdge) + * ``` + * + * @param duplex The double or single sided printing option. + */ + setDuplex(duplex: Duplex): void; + /** + * Choose whether the PDF document's page size should be used to select the + * input paper tray when printing. This setting influences only the preset + * values used to populate the print dialog presented by a PDF reader. + * + * If PickTrayByPDFSize is true, the check box in the print dialog associated + * with input paper tray should be checked. This setting has no effect on + * operating systems that do not provide the ability to pick the input tray + * by size. + * + * @param pickTrayByPDFSize `true` if the document's page size should be used + * to select the input paper tray. + */ + setPickTrayByPDFSize(pickTrayByPDFSize: boolean): void; + /** + * Choose the page numbers used to initialize the print dialog box when the + * file is printed. The first page of the PDF file is denoted by 0. + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * + * // We can set the default print range to only the first page + * viewerPrefs.setPrintPageRange({ start: 0, end: 0 }) + * + * // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7) + * viewerPrefs.setPrintPageRange([ + * { start: 0, end: 0 }, + * { start: 2, end: 2 }, + * { start: 4, end: 6 }, + * ]) + * ``` + * + * @param printPageRange An object or array of objects, each with the + * properties `start` and `end`, denoting a range of + * page indices. + */ + setPrintPageRange(printPageRange: PageRange[] | PageRange): void; + /** + * Choose the default number of copies to be printed when the print dialog is + * opened for this file. + * @param numCopies The default number of copies. + */ + setNumCopies(numCopies: number): void; +} +export default ViewerPreferences; +//# sourceMappingURL=ViewerPreferences.d.ts.map \ No newline at end of file diff --git a/cjs/core/interactive/ViewerPreferences.d.ts.map b/cjs/core/interactive/ViewerPreferences.d.ts.map new file mode 100644 index 000000000..0726065a2 --- /dev/null +++ b/cjs/core/interactive/ViewerPreferences.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ViewerPreferences.d.ts","sourceRoot":"","sources":["../../../src/core/interactive/ViewerPreferences.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AAI,SAAS,EAAE;IAkBhC;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO;IAKnC;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO;IAKnC;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,OAAO;IAKrC;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,OAAO;IAK/B;;;;OAIG;IACH,eAAe,CAAC,YAAY,EAAE,OAAO;IAKrC;;;;;OAKG;IACH,kBAAkB,CAAC,YAAY,EAAE,OAAO;IAKxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,wBAAwB,CAAC,qBAAqB,EAAE,qBAAqB;IAUrE;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,gBAAgB;IAMtD;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,YAAY,EAAE,YAAY;IAM1C;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM;IAMxB;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,iBAAiB,EAAE,OAAO;IAK/C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,iBAAiB,CAAC,cAAc,EAAE,SAAS,EAAE,GAAG,SAAS;IAezD;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM;CAM/B;AAED,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/interactive/ViewerPreferences.js b/cjs/core/interactive/ViewerPreferences.js new file mode 100644 index 000000000..60fc6d602 --- /dev/null +++ b/cjs/core/interactive/ViewerPreferences.js @@ -0,0 +1,511 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Duplex = exports.PrintScaling = exports.ReadingDirection = exports.NonFullScreenPageMode = void 0; +var tslib_1 = require("tslib"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFBool_1 = tslib_1.__importDefault(require("../objects/PDFBool")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var utils_1 = require("../../utils"); +var asEnum = function (rawValue, enumType) { + if (rawValue === undefined) + return undefined; + return enumType[rawValue]; +}; +var NonFullScreenPageMode; +(function (NonFullScreenPageMode) { + /** + * After exiting FullScreen mode, neither the document outline nor thumbnail + * images should be visible. + */ + NonFullScreenPageMode["UseNone"] = "UseNone"; + /** After exiting FullScreen mode, the document outline should be visible. */ + NonFullScreenPageMode["UseOutlines"] = "UseOutlines"; + /** After exiting FullScreen mode, thumbnail images should be visible. */ + NonFullScreenPageMode["UseThumbs"] = "UseThumbs"; + /** + * After exiting FullScreen mode, the optional content group panel should be + * visible. + */ + NonFullScreenPageMode["UseOC"] = "UseOC"; +})(NonFullScreenPageMode = exports.NonFullScreenPageMode || (exports.NonFullScreenPageMode = {})); +var ReadingDirection; +(function (ReadingDirection) { + /** The predominant reading order is Left to Right. */ + ReadingDirection["L2R"] = "L2R"; + /** + * The predominant reading order is Right to left (including vertical writing + * systems, such as Chinese, Japanese and Korean). + */ + ReadingDirection["R2L"] = "R2L"; +})(ReadingDirection = exports.ReadingDirection || (exports.ReadingDirection = {})); +var PrintScaling; +(function (PrintScaling) { + /** No page scaling. */ + PrintScaling["None"] = "None"; + /* Use the PDF reader's default print scaling. */ + PrintScaling["AppDefault"] = "AppDefault"; +})(PrintScaling = exports.PrintScaling || (exports.PrintScaling = {})); +var Duplex; +(function (Duplex) { + /** The PDF reader should print single-sided. */ + Duplex["Simplex"] = "Simplex"; + /** + * The PDF reader should print double sided and flip on the short edge of the + * sheet. + */ + Duplex["DuplexFlipShortEdge"] = "DuplexFlipShortEdge"; + /** + * The PDF reader should print double sided and flip on the long edge of the + * sheet. + */ + Duplex["DuplexFlipLongEdge"] = "DuplexFlipLongEdge"; +})(Duplex = exports.Duplex || (exports.Duplex = {})); +var ViewerPreferences = /** @class */ (function () { + /** @ignore */ + function ViewerPreferences(dict) { + this.dict = dict; + } + ViewerPreferences.prototype.lookupBool = function (key) { + var returnObj = this.dict.lookup(PDFName_1.default.of(key)); + if (returnObj instanceof PDFBool_1.default) + return returnObj; + return undefined; + }; + ViewerPreferences.prototype.lookupName = function (key) { + var returnObj = this.dict.lookup(PDFName_1.default.of(key)); + if (returnObj instanceof PDFName_1.default) + return returnObj; + return undefined; + }; + /** @ignore */ + ViewerPreferences.prototype.HideToolbar = function () { + return this.lookupBool('HideToolbar'); + }; + /** @ignore */ + ViewerPreferences.prototype.HideMenubar = function () { + return this.lookupBool('HideMenubar'); + }; + /** @ignore */ + ViewerPreferences.prototype.HideWindowUI = function () { + return this.lookupBool('HideWindowUI'); + }; + /** @ignore */ + ViewerPreferences.prototype.FitWindow = function () { + return this.lookupBool('FitWindow'); + }; + /** @ignore */ + ViewerPreferences.prototype.CenterWindow = function () { + return this.lookupBool('CenterWindow'); + }; + /** @ignore */ + ViewerPreferences.prototype.DisplayDocTitle = function () { + return this.lookupBool('DisplayDocTitle'); + }; + /** @ignore */ + ViewerPreferences.prototype.NonFullScreenPageMode = function () { + return this.lookupName('NonFullScreenPageMode'); + }; + /** @ignore */ + ViewerPreferences.prototype.Direction = function () { + return this.lookupName('Direction'); + }; + /** @ignore */ + ViewerPreferences.prototype.PrintScaling = function () { + return this.lookupName('PrintScaling'); + }; + /** @ignore */ + ViewerPreferences.prototype.Duplex = function () { + return this.lookupName('Duplex'); + }; + /** @ignore */ + ViewerPreferences.prototype.PickTrayByPDFSize = function () { + return this.lookupBool('PickTrayByPDFSize'); + }; + /** @ignore */ + ViewerPreferences.prototype.PrintPageRange = function () { + var PrintPageRange = this.dict.lookup(PDFName_1.default.of('PrintPageRange')); + if (PrintPageRange instanceof PDFArray_1.default) + return PrintPageRange; + return undefined; + }; + /** @ignore */ + ViewerPreferences.prototype.NumCopies = function () { + var NumCopies = this.dict.lookup(PDFName_1.default.of('NumCopies')); + if (NumCopies instanceof PDFNumber_1.default) + return NumCopies; + return undefined; + }; + /** + * Returns `true` if PDF readers should hide the toolbar menus when displaying + * this document. + * @returns Whether or not toolbars should be hidden. + */ + ViewerPreferences.prototype.getHideToolbar = function () { + var _a, _b; + return (_b = (_a = this.HideToolbar()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns `true` if PDF readers should hide the menu bar when displaying this + * document. + * @returns Whether or not the menu bar should be hidden. + */ + ViewerPreferences.prototype.getHideMenubar = function () { + var _a, _b; + return (_b = (_a = this.HideMenubar()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns `true` if PDF readers should hide the user interface elements in + * the document's window (such as scroll bars and navigation controls), + * leaving only the document's contents displayed. + * @returns Whether or not user interface elements should be hidden. + */ + ViewerPreferences.prototype.getHideWindowUI = function () { + var _a, _b; + return (_b = (_a = this.HideWindowUI()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns `true` if PDF readers should resize the document's window to fit + * the size of the first displayed page. + * @returns Whether or not the window should be resized to fit. + */ + ViewerPreferences.prototype.getFitWindow = function () { + var _a, _b; + return (_b = (_a = this.FitWindow()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns `true` if PDF readers should position the document's window in the + * center of the screen. + * @returns Whether or not to center the document window. + */ + ViewerPreferences.prototype.getCenterWindow = function () { + var _a, _b; + return (_b = (_a = this.CenterWindow()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns `true` if the window's title bar should display the document + * `Title`, taken from the document metadata (see [[PDFDocument.getTitle]]). + * Returns `false` if the title bar should instead display the filename of the + * PDF file. + * @returns Whether to display the document title. + */ + ViewerPreferences.prototype.getDisplayDocTitle = function () { + var _a, _b; + return (_b = (_a = this.DisplayDocTitle()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false; + }; + /** + * Returns the page mode, which tells the PDF reader how to display the + * document after exiting full-screen mode. + * @returns The page mode after exiting full-screen mode. + */ + ViewerPreferences.prototype.getNonFullScreenPageMode = function () { + var _a, _b; + var mode = (_a = this.NonFullScreenPageMode()) === null || _a === void 0 ? void 0 : _a.decodeText(); + return (_b = asEnum(mode, NonFullScreenPageMode)) !== null && _b !== void 0 ? _b : NonFullScreenPageMode.UseNone; + }; + /** + * Returns the predominant reading order for text. + * @returns The text reading order. + */ + ViewerPreferences.prototype.getReadingDirection = function () { + var _a, _b; + var direction = (_a = this.Direction()) === null || _a === void 0 ? void 0 : _a.decodeText(); + return (_b = asEnum(direction, ReadingDirection)) !== null && _b !== void 0 ? _b : ReadingDirection.L2R; + }; + /** + * Returns the page scaling option that the PDF reader should select when the + * print dialog is displayed. + * @returns The page scaling option. + */ + ViewerPreferences.prototype.getPrintScaling = function () { + var _a, _b; + var scaling = (_a = this.PrintScaling()) === null || _a === void 0 ? void 0 : _a.decodeText(); + return (_b = asEnum(scaling, PrintScaling)) !== null && _b !== void 0 ? _b : PrintScaling.AppDefault; + }; + /** + * Returns the paper handling option that should be used when printing the + * file from the print dialog. + * @returns The paper handling option. + */ + ViewerPreferences.prototype.getDuplex = function () { + var _a; + var duplex = (_a = this.Duplex()) === null || _a === void 0 ? void 0 : _a.decodeText(); + return asEnum(duplex, Duplex); + }; + /** + * Returns `true` if the PDF page size should be used to select the input + * paper tray. + * @returns Whether or not the PDF page size should be used to select the + * input paper tray. + */ + ViewerPreferences.prototype.getPickTrayByPDFSize = function () { + var _a; + return (_a = this.PickTrayByPDFSize()) === null || _a === void 0 ? void 0 : _a.asBoolean(); + }; + /** + * Returns an array of page number ranges, which are the values used to + * initialize the print dialog box when the file is printed. Each range + * specifies the first (`start`) and last (`end`) pages in a sub-range of + * pages to be printed. The first page of the PDF file is denoted by 0. + * For example: + * ```js + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * const includesPage3 = viewerPrefs + * .getPrintRanges() + * .some(pr => pr.start =< 2 && pr.end >= 2) + * if (includesPage3) console.log('printRange includes page 3') + * ``` + * @returns An array of objects, each with the properties `start` and `end`, + * denoting page indices. If not, specified an empty array is + * returned. + */ + ViewerPreferences.prototype.getPrintPageRange = function () { + var rng = this.PrintPageRange(); + if (!rng) + return []; + var pageRanges = []; + for (var i = 0; i < rng.size(); i += 2) { + // Despite the spec clearly stating that "The first page of the PDF file + // shall be donoted by 1", several test PDFs (spec 1.7) created in + // Acrobat XI 11.0 and also read with Reader DC 2020.013 indicate this is + // actually a 0 based index. + var start = rng.lookup(i, PDFNumber_1.default).asNumber(); + var end = rng.lookup(i + 1, PDFNumber_1.default).asNumber(); + pageRanges.push({ start: start, end: end }); + } + return pageRanges; + }; + /** + * Returns the number of copies to be printed when the print dialog is opened + * for this document. + * @returns The default number of copies to be printed. + */ + ViewerPreferences.prototype.getNumCopies = function () { + var _a, _b; + return (_b = (_a = this.NumCopies()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 1; + }; + /** + * Choose whether the PDF reader's toolbars should be hidden while the + * document is active. + * @param hideToolbar `true` if the toolbar should be hidden. + */ + ViewerPreferences.prototype.setHideToolbar = function (hideToolbar) { + var HideToolbar = this.dict.context.obj(hideToolbar); + this.dict.set(PDFName_1.default.of('HideToolbar'), HideToolbar); + }; + /** + * Choose whether the PDF reader's menu bar should be hidden while the + * document is active. + * @param hideMenubar `true` if the menu bar should be hidden. + */ + ViewerPreferences.prototype.setHideMenubar = function (hideMenubar) { + var HideMenubar = this.dict.context.obj(hideMenubar); + this.dict.set(PDFName_1.default.of('HideMenubar'), HideMenubar); + }; + /** + * Choose whether the PDF reader should hide user interface elements in the + * document's window (such as scroll bars and navigation controls), leaving + * only the document's contents displayed. + * @param hideWindowUI `true` if the user interface elements should be hidden. + */ + ViewerPreferences.prototype.setHideWindowUI = function (hideWindowUI) { + var HideWindowUI = this.dict.context.obj(hideWindowUI); + this.dict.set(PDFName_1.default.of('HideWindowUI'), HideWindowUI); + }; + /** + * Choose whether the PDF reader should resize the document's window to fit + * the size of the first displayed page. + * @param fitWindow `true` if the window should be resized. + */ + ViewerPreferences.prototype.setFitWindow = function (fitWindow) { + var FitWindow = this.dict.context.obj(fitWindow); + this.dict.set(PDFName_1.default.of('FitWindow'), FitWindow); + }; + /** + * Choose whether the PDF reader should position the document's window in the + * center of the screen. + * @param centerWindow `true` if the window should be centered. + */ + ViewerPreferences.prototype.setCenterWindow = function (centerWindow) { + var CenterWindow = this.dict.context.obj(centerWindow); + this.dict.set(PDFName_1.default.of('CenterWindow'), CenterWindow); + }; + /** + * Choose whether the window's title bar should display the document `Title` + * taken from the document metadata (see [[PDFDocument.setTitle]]). If + * `false`, the title bar should instead display the PDF filename. + * @param displayTitle `true` if the document title should be displayed. + */ + ViewerPreferences.prototype.setDisplayDocTitle = function (displayTitle) { + var DisplayDocTitle = this.dict.context.obj(displayTitle); + this.dict.set(PDFName_1.default.of('DisplayDocTitle'), DisplayDocTitle); + }; + /** + * Choose how the PDF reader should display the document upon exiting + * full-screen mode. This entry is meaningful only if the value of the + * `PageMode` entry in the document's [[PDFCatalog]] is `FullScreen`. + * + * For example: + * ```js + * import { PDFDocument, NonFullScreenPageMode, PDFName } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * + * // Set the PageMode + * pdfDoc.catalog.set(PDFName.of('PageMode'),PDFName.of('FullScreen')) + * + * // Set what happens when full-screen is closed + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines) + * ``` + * + * @param nonFullScreenPageMode How the document should be displayed upon + * exiting full screen mode. + */ + ViewerPreferences.prototype.setNonFullScreenPageMode = function (nonFullScreenPageMode) { + utils_1.assertIsOneOf(nonFullScreenPageMode, 'nonFullScreenPageMode', NonFullScreenPageMode); + var mode = PDFName_1.default.of(nonFullScreenPageMode); + this.dict.set(PDFName_1.default.of('NonFullScreenPageMode'), mode); + }; + /** + * Choose the predominant reading order for text. + * + * This entry has no direct effect on the document's contents or page + * numbering, but may be used to determine the relative positioning of pages + * when displayed side by side or printed n-up. + * + * For example: + * ```js + * import { PDFDocument, ReadingDirection } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setReadingDirection(ReadingDirection.R2L) + * ``` + * + * @param readingDirection The reading order for text. + */ + ViewerPreferences.prototype.setReadingDirection = function (readingDirection) { + utils_1.assertIsOneOf(readingDirection, 'readingDirection', ReadingDirection); + var direction = PDFName_1.default.of(readingDirection); + this.dict.set(PDFName_1.default.of('Direction'), direction); + }; + /** + * Choose the page scaling option that should be selected when a print dialog + * is displayed for this document. + * + * For example: + * ```js + * import { PDFDocument, PrintScaling } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setPrintScaling(PrintScaling.None) + * ``` + * + * @param printScaling The print scaling option. + */ + ViewerPreferences.prototype.setPrintScaling = function (printScaling) { + utils_1.assertIsOneOf(printScaling, 'printScaling', PrintScaling); + var scaling = PDFName_1.default.of(printScaling); + this.dict.set(PDFName_1.default.of('PrintScaling'), scaling); + }; + /** + * Choose the paper handling option that should be selected by default in the + * print dialog. + * + * For example: + * ```js + * import { PDFDocument, Duplex } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * viewerPrefs.setDuplex(Duplex.DuplexFlipShortEdge) + * ``` + * + * @param duplex The double or single sided printing option. + */ + ViewerPreferences.prototype.setDuplex = function (duplex) { + utils_1.assertIsOneOf(duplex, 'duplex', Duplex); + var dup = PDFName_1.default.of(duplex); + this.dict.set(PDFName_1.default.of('Duplex'), dup); + }; + /** + * Choose whether the PDF document's page size should be used to select the + * input paper tray when printing. This setting influences only the preset + * values used to populate the print dialog presented by a PDF reader. + * + * If PickTrayByPDFSize is true, the check box in the print dialog associated + * with input paper tray should be checked. This setting has no effect on + * operating systems that do not provide the ability to pick the input tray + * by size. + * + * @param pickTrayByPDFSize `true` if the document's page size should be used + * to select the input paper tray. + */ + ViewerPreferences.prototype.setPickTrayByPDFSize = function (pickTrayByPDFSize) { + var PickTrayByPDFSize = this.dict.context.obj(pickTrayByPDFSize); + this.dict.set(PDFName_1.default.of('PickTrayByPDFSize'), PickTrayByPDFSize); + }; + /** + * Choose the page numbers used to initialize the print dialog box when the + * file is printed. The first page of the PDF file is denoted by 0. + * + * For example: + * ```js + * import { PDFDocument } from 'pdf-lib' + * + * const pdfDoc = await PDFDocument.create() + * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences() + * + * // We can set the default print range to only the first page + * viewerPrefs.setPrintPageRange({ start: 0, end: 0 }) + * + * // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7) + * viewerPrefs.setPrintPageRange([ + * { start: 0, end: 0 }, + * { start: 2, end: 2 }, + * { start: 4, end: 6 }, + * ]) + * ``` + * + * @param printPageRange An object or array of objects, each with the + * properties `start` and `end`, denoting a range of + * page indices. + */ + ViewerPreferences.prototype.setPrintPageRange = function (printPageRange) { + if (!Array.isArray(printPageRange)) + printPageRange = [printPageRange]; + var flatRange = []; + for (var idx = 0, len = printPageRange.length; idx < len; idx++) { + flatRange.push(printPageRange[idx].start); + flatRange.push(printPageRange[idx].end); + } + utils_1.assertEachIs(flatRange, 'printPageRange', ['number']); + var pageRanges = this.dict.context.obj(flatRange); + this.dict.set(PDFName_1.default.of('PrintPageRange'), pageRanges); + }; + /** + * Choose the default number of copies to be printed when the print dialog is + * opened for this file. + * @param numCopies The default number of copies. + */ + ViewerPreferences.prototype.setNumCopies = function (numCopies) { + utils_1.assertRange(numCopies, 'numCopies', 1, Number.MAX_VALUE); + utils_1.assertInteger(numCopies, 'numCopies'); + var NumCopies = this.dict.context.obj(numCopies); + this.dict.set(PDFName_1.default.of('NumCopies'), NumCopies); + }; + /** @ignore */ + ViewerPreferences.fromDict = function (dict) { + return new ViewerPreferences(dict); + }; + /** @ignore */ + ViewerPreferences.create = function (context) { + var dict = context.obj({}); + return new ViewerPreferences(dict); + }; + return ViewerPreferences; +}()); +exports.default = ViewerPreferences; +//# sourceMappingURL=ViewerPreferences.js.map \ No newline at end of file diff --git a/cjs/core/interactive/ViewerPreferences.js.map b/cjs/core/interactive/ViewerPreferences.js.map new file mode 100644 index 000000000..e743129ac --- /dev/null +++ b/cjs/core/interactive/ViewerPreferences.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ViewerPreferences.js","sourceRoot":"","sources":["../../../src/core/interactive/ViewerPreferences.ts"],"names":[],"mappings":";;;;AAAA,yEAAiD;AACjD,uEAA+C;AAE/C,uEAA+C;AAC/C,2EAAmD;AAEnD,qCAKmB;AAEnB,IAAM,MAAM,GAAG,UACb,QAAuB,EACvB,QAAW;IAEX,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,IAAY,qBAkBX;AAlBD,WAAY,qBAAqB;IAC/B;;;OAGG;IACH,4CAAmB,CAAA;IAEnB,6EAA6E;IAC7E,oDAA2B,CAAA;IAE3B,yEAAyE;IACzE,gDAAuB,CAAA;IAEvB;;;OAGG;IACH,wCAAe,CAAA;AACjB,CAAC,EAlBW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAkBhC;AAED,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,sDAAsD;IACtD,+BAAW,CAAA;IAEX;;;OAGG;IACH,+BAAW,CAAA;AACb,CAAC,EATW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAS3B;AAED,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,uBAAuB;IACvB,6BAAa,CAAA;IAEb,iDAAiD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SAAiB;QAC5B,mBAAW,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QACzD,qBAAa,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACtC,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IA3dD,cAAc;IACP,0BAAQ,GAAG,UAAC,IAAa;QAC9B,OAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC;IAA3B,CAA2B,CAAC;IAE9B,cAAc;IACP,wBAAM,GAAG,UAAC,OAAmB;QAClC,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IAodJ,wBAAC;CAAA,AAheD,IAgeC;AAED,kBAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFArray.d.ts b/cjs/core/objects/PDFArray.d.ts new file mode 100644 index 000000000..42df07a17 --- /dev/null +++ b/cjs/core/objects/PDFArray.d.ts @@ -0,0 +1,64 @@ +import PDFBool from "./PDFBool"; +import PDFDict from "./PDFDict"; +import PDFHexString from "./PDFHexString"; +import PDFName from "./PDFName"; +import PDFNull from "./PDFNull"; +import PDFNumber from "./PDFNumber"; +import PDFObject from "./PDFObject"; +import PDFRef from "./PDFRef"; +import PDFStream from "./PDFStream"; +import PDFString from "./PDFString"; +import PDFContext from "../PDFContext"; +import PDFRawStream from "./PDFRawStream"; +declare class PDFArray extends PDFObject { + static withContext: (context: PDFContext) => PDFArray; + private readonly array; + private readonly context; + private constructor(); + size(): number; + push(object: PDFObject): void; + insert(index: number, object: PDFObject): void; + indexOf(object: PDFObject): number | undefined; + remove(index: number): void; + set(idx: number, object: PDFObject): void; + get(index: number): PDFObject; + lookupMaybe(index: number, type: typeof PDFArray): PDFArray | undefined; + lookupMaybe(index: number, type: typeof PDFBool): PDFBool | undefined; + lookupMaybe(index: number, type: typeof PDFDict): PDFDict | undefined; + lookupMaybe(index: number, type: typeof PDFHexString): PDFHexString | undefined; + lookupMaybe(index: number, type: typeof PDFName): PDFName | undefined; + lookupMaybe(index: number, type: typeof PDFNull): typeof PDFNull | undefined; + lookupMaybe(index: number, type: typeof PDFNumber): PDFNumber | undefined; + lookupMaybe(index: number, type: typeof PDFStream): PDFStream | undefined; + lookupMaybe(index: number, type: typeof PDFRawStream): PDFRawStream | undefined; + lookupMaybe(index: number, type: typeof PDFRef): PDFRef | undefined; + lookupMaybe(index: number, type: typeof PDFString): PDFString | undefined; + lookupMaybe(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined; + lookup(index: number): PDFObject | undefined; + lookup(index: number, type: typeof PDFArray): PDFArray; + lookup(index: number, type: typeof PDFBool): PDFBool; + lookup(index: number, type: typeof PDFDict): PDFDict; + lookup(index: number, type: typeof PDFHexString): PDFHexString; + lookup(index: number, type: typeof PDFName): PDFName; + lookup(index: number, type: typeof PDFNull): typeof PDFNull; + lookup(index: number, type: typeof PDFNumber): PDFNumber; + lookup(index: number, type: typeof PDFStream): PDFStream; + lookup(index: number, type: typeof PDFRawStream): PDFRawStream; + lookup(index: number, type: typeof PDFRef): PDFRef; + lookup(index: number, type: typeof PDFString): PDFString; + lookup(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString; + asRectangle(): { + x: number; + y: number; + width: number; + height: number; + }; + asArray(): PDFObject[]; + clone(context?: PDFContext): PDFArray; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; + scalePDFNumbers(x: number, y: number): void; +} +export default PDFArray; +//# sourceMappingURL=PDFArray.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFArray.d.ts.map b/cjs/core/objects/PDFArray.d.ts.map new file mode 100644 index 000000000..178fabb07 --- /dev/null +++ b/cjs/core/objects/PDFArray.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFArray.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFArray.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,kBAAiC;AAC/C,OAAO,OAAO,kBAAiC;AAC/C,OAAO,YAAY,uBAAsC;AACzD,OAAO,OAAO,kBAAiC;AAC/C,OAAO,OAAO,kBAAiC;AAC/C,OAAO,SAAS,oBAAmC;AACnD,OAAO,SAAS,oBAAmC;AACnD,OAAO,MAAM,iBAAgC;AAC7C,OAAO,SAAS,oBAAmC;AACnD,OAAO,SAAS,oBAAmC;AACnD,OAAO,UAAU,sBAA4B;AAG7C,OAAO,YAAY,uBAAsC;AAEzD,cAAM,QAAS,SAAQ,SAAS;IAC9B,MAAM,CAAC,WAAW,YAAa,UAAU,cAA2B;IAEpE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IAErC,OAAO;IAMP,IAAI,IAAI,MAAM;IAId,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAI7B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;IAI9C,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;IAK9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAI7B,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,QAAQ,GAAG,QAAQ,GAAG,SAAS;IACvE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EA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,IAAI;CAS5C;AAED,eAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFArray.js b/cjs/core/objects/PDFArray.js new file mode 100644 index 000000000..edcbfd812 --- /dev/null +++ b/cjs/core/objects/PDFArray.js @@ -0,0 +1,117 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFNumber_1 = tslib_1.__importDefault(require("./PDFNumber")); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var errors_1 = require("../errors"); +var PDFArray = /** @class */ (function (_super) { + tslib_1.__extends(PDFArray, _super); + function PDFArray(context) { + var _this = _super.call(this) || this; + _this.array = []; + _this.context = context; + return _this; + } + PDFArray.prototype.size = function () { + return this.array.length; + }; + PDFArray.prototype.push = function (object) { + this.array.push(object); + }; + PDFArray.prototype.insert = function (index, object) { + this.array.splice(index, 0, object); + }; + PDFArray.prototype.indexOf = function (object) { + var index = this.array.indexOf(object); + return index === -1 ? undefined : index; + }; + PDFArray.prototype.remove = function (index) { + this.array.splice(index, 1); + }; + PDFArray.prototype.set = function (idx, object) { + this.array[idx] = object; + }; + PDFArray.prototype.get = function (index) { + return this.array[index]; + }; + PDFArray.prototype.lookupMaybe = function (index) { + var _a; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + return (_a = this.context).lookupMaybe.apply(_a, tslib_1.__spreadArrays([this.get(index)], types)); + }; + PDFArray.prototype.lookup = function (index) { + var _a; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + return (_a = this.context).lookup.apply(_a, tslib_1.__spreadArrays([this.get(index)], types)); + }; + PDFArray.prototype.asRectangle = function () { + if (this.size() !== 4) + throw new errors_1.PDFArrayIsNotRectangleError(this.size()); + var lowerLeftX = this.lookup(0, PDFNumber_1.default).asNumber(); + var lowerLeftY = this.lookup(1, PDFNumber_1.default).asNumber(); + var upperRightX = this.lookup(2, PDFNumber_1.default).asNumber(); + var upperRightY = this.lookup(3, PDFNumber_1.default).asNumber(); + var x = lowerLeftX; + var y = lowerLeftY; + var width = upperRightX - lowerLeftX; + var height = upperRightY - lowerLeftY; + return { x: x, y: y, width: width, height: height }; + }; + PDFArray.prototype.asArray = function () { + return this.array.slice(); + }; + PDFArray.prototype.clone = function (context) { + var clone = PDFArray.withContext(context || this.context); + for (var idx = 0, len = this.size(); idx < len; idx++) { + clone.push(this.array[idx]); + } + return clone; + }; + PDFArray.prototype.toString = function () { + var arrayString = '[ '; + for (var idx = 0, len = this.size(); idx < len; idx++) { + arrayString += this.get(idx).toString(); + arrayString += ' '; + } + arrayString += ']'; + return arrayString; + }; + PDFArray.prototype.sizeInBytes = function () { + var size = 3; + for (var idx = 0, len = this.size(); idx < len; idx++) { + size += this.get(idx).sizeInBytes() + 1; + } + return size; + }; + PDFArray.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.LeftSquareBracket; + buffer[offset++] = CharCodes_1.default.Space; + for (var idx = 0, len = this.size(); idx < len; idx++) { + offset += this.get(idx).copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + } + buffer[offset++] = CharCodes_1.default.RightSquareBracket; + return offset - initialOffset; + }; + PDFArray.prototype.scalePDFNumbers = function (x, y) { + for (var idx = 0, len = this.size(); idx < len; idx++) { + var el = this.lookup(idx); + if (el instanceof PDFNumber_1.default) { + var factor = idx % 2 === 0 ? x : y; + this.set(idx, PDFNumber_1.default.of(el.asNumber() * factor)); + } + } + }; + PDFArray.withContext = function (context) { return new PDFArray(context); }; + return PDFArray; +}(PDFObject_1.default)); +exports.default = PDFArray; +//# sourceMappingURL=PDFArray.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFArray.js.map b/cjs/core/objects/PDFArray.js.map new file mode 100644 index 000000000..79ea4d910 --- /dev/null +++ b/cjs/core/objects/PDFArray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Q,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFBool.d.ts b/cjs/core/objects/PDFBool.d.ts new file mode 100644 index 000000000..7e7be75e7 --- /dev/null +++ b/cjs/core/objects/PDFBool.d.ts @@ -0,0 +1,14 @@ +import PDFObject from "./PDFObject"; +declare class PDFBool extends PDFObject { + static readonly True: PDFBool; + static readonly False: PDFBool; + private readonly value; + private constructor(); + asBoolean(): boolean; + clone(): PDFBool; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFBool; +//# sourceMappingURL=PDFBool.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFBool.d.ts.map b/cjs/core/objects/PDFBool.d.ts.map new file mode 100644 index 000000000..60458ceb4 --- /dev/null +++ b/cjs/core/objects/PDFBool.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFBool.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFBool.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,oBAAmC;AAKnD,cAAM,OAAQ,SAAQ,SAAS;IAC7B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAA+B;IACnD,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAgC;IAErD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAEhC,OAAO;IAMP,SAAS,IAAI,OAAO;IAIpB,KAAK,IAAI,OAAO;IAIhB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAgB1D;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFBool.js b/cjs/core/objects/PDFBool.js new file mode 100644 index 000000000..983cd369b --- /dev/null +++ b/cjs/core/objects/PDFBool.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var ENFORCER = {}; +var PDFBool = /** @class */ (function (_super) { + tslib_1.__extends(PDFBool, _super); + function PDFBool(enforcer, value) { + var _this = this; + if (enforcer !== ENFORCER) + throw new errors_1.PrivateConstructorError('PDFBool'); + _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFBool.prototype.asBoolean = function () { + return this.value; + }; + PDFBool.prototype.clone = function () { + return this; + }; + PDFBool.prototype.toString = function () { + return String(this.value); + }; + PDFBool.prototype.sizeInBytes = function () { + return this.value ? 4 : 5; + }; + PDFBool.prototype.copyBytesInto = function (buffer, offset) { + if (this.value) { + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.u; + buffer[offset++] = CharCodes_1.default.e; + return 4; + } + else { + buffer[offset++] = CharCodes_1.default.f; + buffer[offset++] = CharCodes_1.default.a; + buffer[offset++] = CharCodes_1.default.l; + buffer[offset++] = CharCodes_1.default.s; + buffer[offset++] = CharCodes_1.default.e; + return 5; + } + }; + PDFBool.True = new PDFBool(ENFORCER, true); + PDFBool.False = new PDFBool(ENFORCER, false); + return PDFBool; +}(PDFObject_1.default)); +exports.default = PDFBool; +//# sourceMappingURL=PDFBool.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFBool.js.map b/cjs/core/objects/PDFBool.js.map new file mode 100644 index 000000000..e5d1c913b --- /dev/null +++ b/cjs/core/objects/PDFBool.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFBool.js","sourceRoot":"","sources":["../../../src/core/objects/PDFBool.ts"],"names":[],"mappings":";;;AAAA,oCAA0D;AAC1D,kEAAmD;AACnD,0EAAkD;AAElD,IAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;IAAsB,mCAAS;IAM7B,iBAAoB,QAAa,EAAE,KAAc;QAAjD,iBAIC;QAHC,IAAI,QAAQ,KAAK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,YAAI,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACnC,aAAK,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IA0CvD,cAAC;CAAA,AA5CD,CAAsB,mBAAS,GA4C9B;AAED,kBAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFDict.d.ts b/cjs/core/objects/PDFDict.d.ts new file mode 100644 index 000000000..7e9af4b42 --- /dev/null +++ b/cjs/core/objects/PDFDict.d.ts @@ -0,0 +1,62 @@ +import PDFArray from "./PDFArray"; +import PDFBool from "./PDFBool"; +import PDFHexString from "./PDFHexString"; +import PDFName from "./PDFName"; +import PDFNull from "./PDFNull"; +import PDFNumber from "./PDFNumber"; +import PDFObject from "./PDFObject"; +import PDFRef from "./PDFRef"; +import PDFStream from "./PDFStream"; +import PDFString from "./PDFString"; +import PDFContext from "../PDFContext"; +export declare type DictMap = Map; +declare class PDFDict extends PDFObject { + static withContext: (context: PDFContext) => PDFDict; + static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFDict; + readonly context: PDFContext; + private readonly dict; + protected constructor(map: DictMap, context: PDFContext); + keys(): PDFName[]; + values(): PDFObject[]; + entries(): [PDFName, PDFObject][]; + set(key: PDFName, value: PDFObject): void; + get(key: PDFName, preservePDFNull?: boolean): PDFObject | undefined; + has(key: PDFName): boolean; + lookupMaybe(key: PDFName, type: typeof PDFArray): PDFArray | undefined; + lookupMaybe(key: PDFName, type: typeof PDFBool): PDFBool | undefined; + lookupMaybe(key: PDFName, type: typeof PDFDict): PDFDict | undefined; + lookupMaybe(key: PDFName, type: typeof PDFHexString): PDFHexString | undefined; + lookupMaybe(key: PDFName, type: typeof PDFName): PDFName | undefined; + lookupMaybe(key: PDFName, type: typeof PDFNull): typeof PDFNull | undefined; + lookupMaybe(key: PDFName, type: typeof PDFNumber): PDFNumber | undefined; + lookupMaybe(key: PDFName, type: typeof PDFStream): PDFStream | undefined; + lookupMaybe(key: PDFName, type: typeof PDFRef): PDFRef | undefined; + lookupMaybe(key: PDFName, type: typeof PDFString): PDFString | undefined; + lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined; + lookupMaybe(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream | undefined; + lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray | undefined; + lookup(key: PDFName): PDFObject | undefined; + lookup(key: PDFName, type: typeof PDFArray): PDFArray; + lookup(key: PDFName, type: typeof PDFBool): PDFBool; + lookup(key: PDFName, type: typeof PDFDict): PDFDict; + lookup(key: PDFName, type: typeof PDFHexString): PDFHexString; + lookup(key: PDFName, type: typeof PDFName): PDFName; + lookup(key: PDFName, type: typeof PDFNull): typeof PDFNull; + lookup(key: PDFName, type: typeof PDFNumber): PDFNumber; + lookup(key: PDFName, type: typeof PDFStream): PDFStream; + lookup(key: PDFName, type: typeof PDFRef): PDFRef; + lookup(key: PDFName, type: typeof PDFString): PDFString; + lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString; + lookup(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream; + lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray; + delete(key: PDFName): boolean; + asMap(): Map; + /** Generate a random key that doesn't exist in current key set */ + uniqueKey(tag?: string): PDFName; + clone(context?: PDFContext): PDFDict; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFDict; +//# sourceMappingURL=PDFDict.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFDict.d.ts.map b/cjs/core/objects/PDFDict.d.ts.map new file mode 100644 index 000000000..ea242042f --- /dev/null +++ b/cjs/core/objects/PDFDict.d.ts.map @@ -0,0 +1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,OAAO,GAAG,OAAO;IAI7B,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC;IAIhC,kEAAkE;IAClE,SAAS,CAAC,GAAG,SAAK,GAAG,OAAO;IAS5B,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO;IAUpC,QAAQ,IAAI,MAAM;IAWlB,WAAW,IAAI,MAAM;IAUrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAqB1D;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFDict.js b/cjs/core/objects/PDFDict.js new file mode 100644 index 000000000..a1f580442 --- /dev/null +++ b/cjs/core/objects/PDFDict.js @@ -0,0 +1,138 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("./PDFName")); +var PDFNull_1 = tslib_1.__importDefault(require("./PDFNull")); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var PDFDict = /** @class */ (function (_super) { + tslib_1.__extends(PDFDict, _super); + function PDFDict(map, context) { + var _this = _super.call(this) || this; + _this.dict = map; + _this.context = context; + return _this; + } + PDFDict.prototype.keys = function () { + return Array.from(this.dict.keys()); + }; + PDFDict.prototype.values = function () { + return Array.from(this.dict.values()); + }; + PDFDict.prototype.entries = function () { + return Array.from(this.dict.entries()); + }; + PDFDict.prototype.set = function (key, value) { + this.dict.set(key, value); + }; + PDFDict.prototype.get = function (key, + // TODO: `preservePDFNull` is for backwards compatibility. Should be + // removed in next breaking API change. + preservePDFNull) { + if (preservePDFNull === void 0) { preservePDFNull = false; } + var value = this.dict.get(key); + if (value === PDFNull_1.default && !preservePDFNull) + return undefined; + return value; + }; + PDFDict.prototype.has = function (key) { + var value = this.dict.get(key); + return value !== undefined && value !== PDFNull_1.default; + }; + PDFDict.prototype.lookupMaybe = function (key) { + var _a; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + // TODO: `preservePDFNull` is for backwards compatibility. Should be + // removed in next breaking API change. + var preservePDFNull = types.includes(PDFNull_1.default); + var value = (_a = this.context).lookupMaybe.apply(_a, tslib_1.__spreadArrays([this.get(key, preservePDFNull)], types)); + if (value === PDFNull_1.default && !preservePDFNull) + return undefined; + return value; + }; + PDFDict.prototype.lookup = function (key) { + var _a; + var types = []; + for (var _i = 1; _i < arguments.length; _i++) { + types[_i - 1] = arguments[_i]; + } + // TODO: `preservePDFNull` is for backwards compatibility. Should be + // removed in next breaking API change. + var preservePDFNull = types.includes(PDFNull_1.default); + var value = (_a = this.context).lookup.apply(_a, tslib_1.__spreadArrays([this.get(key, preservePDFNull)], types)); + if (value === PDFNull_1.default && !preservePDFNull) + return undefined; + return value; + }; + PDFDict.prototype.delete = function (key) { + return this.dict.delete(key); + }; + PDFDict.prototype.asMap = function () { + return new Map(this.dict); + }; + /** Generate a random key that doesn't exist in current key set */ + PDFDict.prototype.uniqueKey = function (tag) { + if (tag === void 0) { tag = ''; } + var existingKeys = this.keys(); + var key = PDFName_1.default.of(this.context.addRandomSuffix(tag, 10)); + while (existingKeys.includes(key)) { + key = PDFName_1.default.of(this.context.addRandomSuffix(tag, 10)); + } + return key; + }; + PDFDict.prototype.clone = function (context) { + var clone = PDFDict.withContext(context || this.context); + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + clone.set(key, value); + } + return clone; + }; + PDFDict.prototype.toString = function () { + var dictString = '<<\n'; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + dictString += key.toString() + ' ' + value.toString() + '\n'; + } + dictString += '>>'; + return dictString; + }; + PDFDict.prototype.sizeInBytes = function () { + var size = 5; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + size += key.sizeInBytes() + value.sizeInBytes() + 2; + } + return size; + }; + PDFDict.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + buffer[offset++] = CharCodes_1.default.LessThan; + buffer[offset++] = CharCodes_1.default.LessThan; + buffer[offset++] = CharCodes_1.default.Newline; + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + offset += key.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + offset += value.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + } + buffer[offset++] = CharCodes_1.default.GreaterThan; + buffer[offset++] = CharCodes_1.default.GreaterThan; + return offset - initialOffset; + }; + PDFDict.withContext = function (context) { return new PDFDict(new Map(), context); }; + PDFDict.fromMapWithContext = function (map, context) { + return new PDFDict(map, context); + }; + return PDFDict; +}(PDFObject_1.default)); +exports.default = PDFDict; +//# sourceMappingURL=PDFDict.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFDict.js.map b/cjs/core/objects/PDFDict.js.map new file mode 100644 index 000000000..8fc5bed6e --- /dev/null +++ b/cjs/core/objects/PDFDict.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFDict.js","sourceRoot":"","sources":["../../../src/core/objects/PDFDict.ts"],"names":[],"mappings":";;;AAGA,8DAA+C;AAC/C,8DAA+C;AAE/C,kEAAmD;AAKnD,0EAAkD;AAIlD;IAAsB,mCAAS;IAU7B,iBAAsB,GAAY,EAAE,OAAmB;QAAvD,YACE,iBAAO,SAGR;QAFC,KAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IACzB,CAAC;IAED,sBAAI,GAAJ;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,wBAAM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AA/B,CAA+B,CAAC;IAEvE,0BAAkB,GAAG,UAAC,GAAY,EAAE,OAAmB;QAC5D,OAAA,IAAI,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC;IAAzB,CAAyB,CAAC;IA4M9B,cAAC;CAAA,AAhND,CAAsB,mBAAS,GAgN9B;AAED,kBAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFHexString.d.ts b/cjs/core/objects/PDFHexString.d.ts new file mode 100644 index 000000000..c40d1e232 --- /dev/null +++ b/cjs/core/objects/PDFHexString.d.ts @@ -0,0 +1,17 @@ +import PDFObject from "./PDFObject"; +declare class PDFHexString extends PDFObject { + static of: (value: string) => PDFHexString; + static fromText: (value: string) => PDFHexString; + private readonly value; + constructor(value: string); + asBytes(): Uint8Array; + decodeText(): string; + decodeDate(): Date; + asString(): string; + clone(): PDFHexString; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFHexString; +//# sourceMappingURL=PDFHexString.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFHexString.d.ts.map b/cjs/core/objects/PDFHexString.d.ts.map new file mode 100644 index 000000000..4987a20d8 --- /dev/null +++ b/cjs/core/objects/PDFHexString.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFHexString.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFHexString.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,oBAAmC;AAanD,cAAM,YAAa,SAAQ,SAAS;IAClC,MAAM,CAAC,EAAE,UAAW,MAAM,kBAA6B;IAEvD,MAAM,CAAC,QAAQ,UAAW,MAAM,kBAS9B;IAEF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,KAAK,EAAE,MAAM;IAKzB,OAAO,IAAI,UAAU;IAsBrB,UAAU,IAAI,MAAM;IAMpB,UAAU,IAAI,IAAI;IAOlB,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,YAAY;IAIrB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAM1D;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFHexString.js b/cjs/core/objects/PDFHexString.js new file mode 100644 index 000000000..32c946d92 --- /dev/null +++ b/cjs/core/objects/PDFHexString.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var errors_1 = require("../errors"); +var PDFHexString = /** @class */ (function (_super) { + tslib_1.__extends(PDFHexString, _super); + function PDFHexString(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFHexString.prototype.asBytes = function () { + // Append a zero if the number of digits is odd. See PDF spec 7.3.4.3 + var hex = this.value + (this.value.length % 2 === 1 ? '0' : ''); + var hexLength = hex.length; + var bytes = new Uint8Array(hex.length / 2); + var hexOffset = 0; + var bytesOffset = 0; + // Interpret each pair of hex digits as a single byte + while (hexOffset < hexLength) { + var byte = parseInt(hex.substring(hexOffset, hexOffset + 2), 16); + bytes[bytesOffset] = byte; + hexOffset += 2; + bytesOffset += 1; + } + return bytes; + }; + PDFHexString.prototype.decodeText = function () { + var bytes = this.asBytes(); + if (utils_1.hasUtf16BOM(bytes)) + return utils_1.utf16Decode(bytes); + return utils_1.pdfDocEncodingDecode(bytes); + }; + PDFHexString.prototype.decodeDate = function () { + var text = this.decodeText(); + var date = utils_1.parseDate(text); + if (!date) + throw new errors_1.InvalidPDFDateStringError(text); + return date; + }; + PDFHexString.prototype.asString = function () { + return this.value; + }; + PDFHexString.prototype.clone = function () { + return PDFHexString.of(this.value); + }; + PDFHexString.prototype.toString = function () { + return "<" + this.value + ">"; + }; + PDFHexString.prototype.sizeInBytes = function () { + return this.value.length + 2; + }; + PDFHexString.prototype.copyBytesInto = function (buffer, offset) { + buffer[offset++] = CharCodes_1.default.LessThan; + offset += utils_1.copyStringIntoBuffer(this.value, buffer, offset); + buffer[offset++] = CharCodes_1.default.GreaterThan; + return this.value.length + 2; + }; + PDFHexString.of = function (value) { return new PDFHexString(value); }; + PDFHexString.fromText = function (value) { + var encoded = utils_1.utf16Encode(value); + var hex = ''; + for (var idx = 0, len = encoded.length; idx < len; idx++) { + hex += utils_1.toHexStringOfMinLength(encoded[idx], 4); + } + return new PDFHexString(hex); + }; + return PDFHexString; +}(PDFObject_1.default)); +exports.default = PDFHexString; +//# sourceMappingURL=PDFHexString.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFHexString.js.map b/cjs/core/objects/PDFHexString.js.map new file mode 100644 index 000000000..d5f550cc5 --- /dev/null +++ b/cjs/core/objects/PDFHexString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFHexString.js","sourceRoot":"","sources":["../../../src/core/objects/PDFHexString.ts"],"names":[],"mappings":";;;AAAA,kEAAmD;AACnD,0EAAkD;AAClD,qCAQmB;AACnB,oCAA4D;AAE5D;IAA2B,wCAAS;IAgBlC,sBAAY,KAAa;QAAzB,YACE,iBAAO,SAER;QADC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACrB,CAAC;IAED,8BAAO,GAAP;QACE,qEAAqE;QACrE,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClE,IAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;QAE7B,IAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE7C,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,WAAW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;QACtC,MAAM,IAAI,4BAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3D,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,WAAW,CAAC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,CAAC;IA5EM,eAAE,GAAG,UAAC,KAAa,IAAK,OAAA,IAAI,YAAY,CAAC,KAAK,CAAC,EAAvB,CAAuB,CAAC;IAEhD,qBAAQ,GAAG,UAAC,KAAa;QAC9B,IAAM,OAAO,GAAG,mBAAW,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACxD,GAAG,IAAI,8BAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;SAChD;QAED,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC;IAkEJ,mBAAC;CAAA,AA9ED,CAA2B,mBAAS,GA8EnC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFInvalidObject.d.ts b/cjs/core/objects/PDFInvalidObject.d.ts new file mode 100644 index 000000000..1da7620aa --- /dev/null +++ b/cjs/core/objects/PDFInvalidObject.d.ts @@ -0,0 +1,12 @@ +import PDFObject from "./PDFObject"; +declare class PDFInvalidObject extends PDFObject { + static of: (data: Uint8Array) => PDFInvalidObject; + private readonly data; + private constructor(); + clone(): PDFInvalidObject; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFInvalidObject; +//# sourceMappingURL=PDFInvalidObject.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFInvalidObject.d.ts.map b/cjs/core/objects/PDFInvalidObject.d.ts.map new file mode 100644 index 000000000..e171abef0 --- /dev/null +++ b/cjs/core/objects/PDFInvalidObject.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFInvalidObject.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFInvalidObject.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,oBAAmC;AAEnD,cAAM,gBAAiB,SAAQ,SAAS;IACtC,MAAM,CAAC,EAAE,SAAU,UAAU,sBAAgC;IAE7D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAElC,OAAO;IAKP,KAAK,IAAI,gBAAgB;IAIzB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAO1D;AAED,eAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFInvalidObject.js b/cjs/core/objects/PDFInvalidObject.js new file mode 100644 index 000000000..66ebc8728 --- /dev/null +++ b/cjs/core/objects/PDFInvalidObject.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var PDFInvalidObject = /** @class */ (function (_super) { + tslib_1.__extends(PDFInvalidObject, _super); + function PDFInvalidObject(data) { + var _this = _super.call(this) || this; + _this.data = data; + return _this; + } + PDFInvalidObject.prototype.clone = function () { + return PDFInvalidObject.of(this.data.slice()); + }; + PDFInvalidObject.prototype.toString = function () { + return "PDFInvalidObject(" + this.data.length + " bytes)"; + }; + PDFInvalidObject.prototype.sizeInBytes = function () { + return this.data.length; + }; + PDFInvalidObject.prototype.copyBytesInto = function (buffer, offset) { + var length = this.data.length; + for (var idx = 0; idx < length; idx++) { + buffer[offset++] = this.data[idx]; + } + return length; + }; + PDFInvalidObject.of = function (data) { return new PDFInvalidObject(data); }; + return PDFInvalidObject; +}(PDFObject_1.default)); +exports.default = PDFInvalidObject; +//# sourceMappingURL=PDFInvalidObject.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFInvalidObject.js.map b/cjs/core/objects/PDFInvalidObject.js.map new file mode 100644 index 000000000..b2b5e22ab --- /dev/null +++ b/cjs/core/objects/PDFInvalidObject.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFInvalidObject.js","sourceRoot":"","sources":["../../../src/core/objects/PDFInvalidObject.ts"],"names":[],"mappings":";;;AAAA,kEAAmD;AAEnD;IAA+B,4CAAS;IAKtC,0BAAoB,IAAgB;QAApC,YACE,iBAAO,SAER;QADC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IAED,gCAAK,GAAL;QACE,OAAO,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,mCAAQ,GAAR;QACE,OAAO,sBAAoB,IAAI,CAAC,IAAI,CAAC,MAAM,YAAS,CAAC;IACvD,CAAC;IAED,sCAAW,GAAX;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,wCAAa,GAAb,UAAc,MAAkB,EAAE,MAAc;QAC9C,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE;YACrC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IA3BM,mBAAE,GAAG,UAAC,IAAgB,IAAK,OAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAA1B,CAA0B,CAAC;IA4B/D,uBAAC;CAAA,AA7BD,CAA+B,mBAAS,GA6BvC;AAED,kBAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFName.d.ts b/cjs/core/objects/PDFName.d.ts new file mode 100644 index 000000000..2f7276b0e --- /dev/null +++ b/cjs/core/objects/PDFName.d.ts @@ -0,0 +1,42 @@ +import PDFObject from "./PDFObject"; +declare class PDFName extends PDFObject { + static of: (name: string) => PDFName; + static readonly Length: PDFName; + static readonly FlateDecode: PDFName; + static readonly Resources: PDFName; + static readonly Font: PDFName; + static readonly XObject: PDFName; + static readonly ExtGState: PDFName; + static readonly Contents: PDFName; + static readonly Type: PDFName; + static readonly Parent: PDFName; + static readonly MediaBox: PDFName; + static readonly Page: PDFName; + static readonly Annots: PDFName; + static readonly TrimBox: PDFName; + static readonly ArtBox: PDFName; + static readonly BleedBox: PDFName; + static readonly CropBox: PDFName; + static readonly Rotate: PDFName; + static readonly Title: PDFName; + static readonly Author: PDFName; + static readonly Subject: PDFName; + static readonly Creator: PDFName; + static readonly Keywords: PDFName; + static readonly Producer: PDFName; + static readonly CreationDate: PDFName; + static readonly ModDate: PDFName; + private readonly encodedName; + private constructor(); + asBytes(): Uint8Array; + decodeText(): string; + asString(): string; + /** @deprecated in favor of [[PDFName.asString]] */ + value(): string; + clone(): PDFName; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFName; +//# sourceMappingURL=PDFName.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFName.d.ts.map b/cjs/core/objects/PDFName.d.ts.map new file mode 100644 index 000000000..1ea059842 --- /dev/null +++ b/cjs/core/objects/PDFName.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFName.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFName.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,oBAAmC;AAqBnD,cAAM,OAAQ,SAAQ,SAAS;IAC7B,MAAM,CAAC,EAAE,SAAU,MAAM,KAAG,OAAO,CAUjC;IAGF,MAAM,CAAC,QAAQ,CAAC,MAAM,UAAwB;IAC9C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ACnD,KAAK,IAAI,MAAM;IAIf,KAAK,IAAI,OAAO;IAIhB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAI1D;AAED,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFName.js b/cjs/core/objects/PDFName.js new file mode 100644 index 000000000..ed8d717aa --- /dev/null +++ b/cjs/core/objects/PDFName.js @@ -0,0 +1,138 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var Irregular_1 = require("../syntax/Irregular"); +var utils_1 = require("../../utils"); +var decodeName = function (name) { + return name.replace(/#([\dABCDEF]{2})/g, function (_, hex) { return utils_1.charFromHexCode(hex); }); +}; +var isRegularChar = function (charCode) { + return charCode >= CharCodes_1.default.ExclamationPoint && + charCode <= CharCodes_1.default.Tilde && + !Irregular_1.IsIrregular[charCode]; +}; +var ENFORCER = {}; +var pool = new Map(); +var PDFName = /** @class */ (function (_super) { + tslib_1.__extends(PDFName, _super); + function PDFName(enforcer, name) { + var _this = this; + if (enforcer !== ENFORCER) + throw new errors_1.PrivateConstructorError('PDFName'); + _this = _super.call(this) || this; + var encodedName = '/'; + for (var idx = 0, len = name.length; idx < len; idx++) { + var character = name[idx]; + var code = utils_1.toCharCode(character); + encodedName += isRegularChar(code) ? character : "#" + utils_1.toHexString(code); + } + _this.encodedName = encodedName; + return _this; + } + PDFName.prototype.asBytes = function () { + var bytes = []; + var hex = ''; + var escaped = false; + var pushByte = function (byte) { + if (byte !== undefined) + bytes.push(byte); + escaped = false; + }; + for (var idx = 1, len = this.encodedName.length; idx < len; idx++) { + var char = this.encodedName[idx]; + var byte = utils_1.toCharCode(char); + var nextChar = this.encodedName[idx + 1]; + if (!escaped) { + if (byte === CharCodes_1.default.Hash) + escaped = true; + else + pushByte(byte); + } + else { + if ((byte >= CharCodes_1.default.Zero && byte <= CharCodes_1.default.Nine) || + (byte >= CharCodes_1.default.a && byte <= CharCodes_1.default.f) || + (byte >= CharCodes_1.default.A && byte <= CharCodes_1.default.F)) { + hex += char; + if (hex.length === 2 || + !((nextChar >= '0' && nextChar <= '9') || + (nextChar >= 'a' && nextChar <= 'f') || + (nextChar >= 'A' && nextChar <= 'F'))) { + pushByte(parseInt(hex, 16)); + hex = ''; + } + } + else { + pushByte(byte); + } + } + } + return new Uint8Array(bytes); + }; + // TODO: This should probably use `utf8Decode()` + // TODO: Polyfill Array.from? + PDFName.prototype.decodeText = function () { + var bytes = this.asBytes(); + return String.fromCharCode.apply(String, Array.from(bytes)); + }; + PDFName.prototype.asString = function () { + return this.encodedName; + }; + /** @deprecated in favor of [[PDFName.asString]] */ + PDFName.prototype.value = function () { + return this.encodedName; + }; + PDFName.prototype.clone = function () { + return this; + }; + PDFName.prototype.toString = function () { + return this.encodedName; + }; + PDFName.prototype.sizeInBytes = function () { + return this.encodedName.length; + }; + PDFName.prototype.copyBytesInto = function (buffer, offset) { + offset += utils_1.copyStringIntoBuffer(this.encodedName, buffer, offset); + return this.encodedName.length; + }; + PDFName.of = function (name) { + var decodedValue = decodeName(name); + var instance = pool.get(decodedValue); + if (!instance) { + instance = new PDFName(ENFORCER, decodedValue); + pool.set(decodedValue, instance); + } + return instance; + }; + /* tslint:disable member-ordering */ + PDFName.Length = PDFName.of('Length'); + PDFName.FlateDecode = PDFName.of('FlateDecode'); + PDFName.Resources = PDFName.of('Resources'); + PDFName.Font = PDFName.of('Font'); + PDFName.XObject = PDFName.of('XObject'); + PDFName.ExtGState = PDFName.of('ExtGState'); + PDFName.Contents = PDFName.of('Contents'); + PDFName.Type = PDFName.of('Type'); + PDFName.Parent = PDFName.of('Parent'); + PDFName.MediaBox = PDFName.of('MediaBox'); + PDFName.Page = PDFName.of('Page'); + PDFName.Annots = PDFName.of('Annots'); + PDFName.TrimBox = PDFName.of('TrimBox'); + PDFName.ArtBox = PDFName.of('ArtBox'); + PDFName.BleedBox = PDFName.of('BleedBox'); + PDFName.CropBox = PDFName.of('CropBox'); + PDFName.Rotate = PDFName.of('Rotate'); + PDFName.Title = PDFName.of('Title'); + PDFName.Author = PDFName.of('Author'); + PDFName.Subject = PDFName.of('Subject'); + PDFName.Creator = PDFName.of('Creator'); + PDFName.Keywords = PDFName.of('Keywords'); + PDFName.Producer = PDFName.of('Producer'); + PDFName.CreationDate = PDFName.of('CreationDate'); + PDFName.ModDate = PDFName.of('ModDate'); + return PDFName; +}(PDFObject_1.default)); +exports.default = PDFName; +//# sourceMappingURL=PDFName.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFName.js.map b/cjs/core/objects/PDFName.js.map new file mode 100644 index 000000000..f1a12f069 --- /dev/null +++ b/cjs/core/objects/PDFName.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFName.js","sourceRoot":"","sources":["../../../src/core/objects/PDFName.ts"],"names":[],"mappings":";;;AAAA,oCAA0D;AAC1D,kEAAmD;AACnD,0EAAkD;AAClD,iDAAwD;AACxD,qCAKmB;AAEnB,IAAM,UAAU,GAAG,UAAC,IAAY;IAC9B,OAAA,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAC,CAAC,EAAE,GAAG,IAAK,OAAA,uBAAe,CAAC,GAAG,CAAC,EAApB,CAAoB,CAAC;AAAnE,CAAmE,CAAC;AAEtE,IAAM,aAAa,GAAG,UAAC,QAAgB;IACrC,OAAA,QAAQ,IAAI,mBAAS,CAAC,gBAAgB;QACtC,QAAQ,IAAI,mBAAS,CAAC,KAAK;QAC3B,CAAC,uBAAW,CAAC,QAAQ,CAAC;AAFtB,CAEsB,CAAC;AAEzB,IAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAM,IAAI,GAAG,IAAI,GAAG,EAAmB,CAAC;AAExC;IAAsB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C"} \ No newline at end of file diff --git a/cjs/core/objects/PDFNull.d.ts b/cjs/core/objects/PDFNull.d.ts new file mode 100644 index 000000000..bab5df30d --- /dev/null +++ b/cjs/core/objects/PDFNull.d.ts @@ -0,0 +1,11 @@ +import PDFObject from "./PDFObject"; +declare class PDFNull extends PDFObject { + asNull(): null; + clone(): PDFNull; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +declare const _default: PDFNull; +export default _default; +//# sourceMappingURL=PDFNull.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFNull.d.ts.map b/cjs/core/objects/PDFNull.d.ts.map new file mode 100644 index 000000000..da03e28c9 --- /dev/null +++ b/cjs/core/objects/PDFNull.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFNull.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFNull.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,oBAAmC;AAGnD,cAAM,OAAQ,SAAQ,SAAS;IAC7B,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,OAAO;IAIhB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAO1D;;AAED,wBAA6B"} \ No newline at end of file diff --git a/cjs/core/objects/PDFNull.js b/cjs/core/objects/PDFNull.js new file mode 100644 index 000000000..4f4351bf9 --- /dev/null +++ b/cjs/core/objects/PDFNull.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var PDFNull = /** @class */ (function (_super) { + tslib_1.__extends(PDFNull, _super); + function PDFNull() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFNull.prototype.asNull = function () { + return null; + }; + PDFNull.prototype.clone = function () { + return this; + }; + PDFNull.prototype.toString = function () { + return 'null'; + }; + PDFNull.prototype.sizeInBytes = function () { + return 4; + }; + PDFNull.prototype.copyBytesInto = function (buffer, offset) { + buffer[offset++] = CharCodes_1.default.n; + buffer[offset++] = CharCodes_1.default.u; + buffer[offset++] = CharCodes_1.default.l; + buffer[offset++] = CharCodes_1.default.l; + return 4; + }; + return PDFNull; +}(PDFObject_1.default)); +exports.default = new PDFNull(); +//# sourceMappingURL=PDFNull.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFNull.js.map b/cjs/core/objects/PDFNull.js.map new file mode 100644 index 000000000..f15bba243 --- /dev/null +++ b/cjs/core/objects/PDFNull.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFNull.js","sourceRoot":"","sources":["../../../src/core/objects/PDFNull.ts"],"names":[],"mappings":";;;AAAA,kEAAmD;AACnD,0EAAkD;AAElD;IAAsB,mCAAS;IAA/B;;IAwBA,CAAC;IAvBC,wBAAM,GAAN;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uBAAK,GAAL;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAAQ,GAAR;QACE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,6BAAW,GAAX;QACE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,+BAAa,GAAb,UAAc,MAAkB,EAAE,MAAc;QAC9C,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,OAAO,CAAC,CAAC;IACX,CAAC;IACH,cAAC;AAAD,CAAC,AAxBD,CAAsB,mBAAS,GAwB9B;AAED,kBAAe,IAAI,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFNumber.d.ts b/cjs/core/objects/PDFNumber.d.ts new file mode 100644 index 000000000..de4318af0 --- /dev/null +++ b/cjs/core/objects/PDFNumber.d.ts @@ -0,0 +1,16 @@ +import PDFObject from "./PDFObject"; +declare class PDFNumber extends PDFObject { + static of: (value: number) => PDFNumber; + private readonly numberValue; + private readonly stringValue; + private constructor(); + asNumber(): number; + /** @deprecated in favor of [[PDFNumber.asNumber]] */ + value(): number; + clone(): PDFNumber; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFNumber; +//# sourceMappingURL=PDFNumber.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFNumber.d.ts.map b/cjs/core/objects/PDFNumber.d.ts.map new file mode 100644 index 000000000..5fe9f172c --- /dev/null +++ b/cjs/core/objects/PDFNumber.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFNumber.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFNumber.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,oBAAmC;AAEnD,cAAM,SAAU,SAAQ,SAAS;IAC/B,MAAM,CAAC,EAAE,UAAW,MAAM,eAA0B;IAEpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,OAAO;IAMP,QAAQ,IAAI,MAAM;IAIlB,qDAAqD;IACrD,KAAK,IAAI,MAAM;IAIf,KAAK,IAAI,SAAS;IAIlB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAI1D;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFNumber.js b/cjs/core/objects/PDFNumber.js new file mode 100644 index 000000000..c73fa0866 --- /dev/null +++ b/cjs/core/objects/PDFNumber.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var index_1 = require("../../utils/index"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var PDFNumber = /** @class */ (function (_super) { + tslib_1.__extends(PDFNumber, _super); + function PDFNumber(value) { + var _this = _super.call(this) || this; + _this.numberValue = value; + _this.stringValue = index_1.numberToString(value); + return _this; + } + PDFNumber.prototype.asNumber = function () { + return this.numberValue; + }; + /** @deprecated in favor of [[PDFNumber.asNumber]] */ + PDFNumber.prototype.value = function () { + return this.numberValue; + }; + PDFNumber.prototype.clone = function () { + return PDFNumber.of(this.numberValue); + }; + PDFNumber.prototype.toString = function () { + return this.stringValue; + }; + PDFNumber.prototype.sizeInBytes = function () { + return this.stringValue.length; + }; + PDFNumber.prototype.copyBytesInto = function (buffer, offset) { + offset += index_1.copyStringIntoBuffer(this.stringValue, buffer, offset); + return this.stringValue.length; + }; + PDFNumber.of = function (value) { return new PDFNumber(value); }; + return PDFNumber; +}(PDFObject_1.default)); +exports.default = PDFNumber; +//# sourceMappingURL=PDFNumber.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFNumber.js.map b/cjs/core/objects/PDFNumber.js.map new file mode 100644 index 000000000..4e1ba7bbf --- /dev/null +++ b/cjs/core/objects/PDFNumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFNumber.js","sourceRoot":"","sources":["../../../src/core/objects/PDFNumber.ts"],"names":[],"mappings":";;;AAAA,2CAAuE;AAEvE,kEAAmD;AAEnD;IAAwB,qCAAS;IAM/B,mBAAoB,KAAa;QAAjC,YACE,iBAAO,SAGR;QAFC,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,KAAI,CAAC,WAAW,GAAG,sBAAc,CAAC,KAAK,CAAC,CAAC;;IAC3C,CAAC;IAED,4BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,qDAAqD;IACrD,yBAAK,GAAL;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,yBAAK,GAAL;QACE,OAAO,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED,4BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,+BAAW,GAAX;QACE,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IACjC,CAAC;IAED,iCAAa,GAAb,UAAc,MAAkB,EAAE,MAAc;QAC9C,MAAM,IAAI,4BAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IACjC,CAAC;IAnCM,YAAE,GAAG,UAAC,KAAa,IAAK,OAAA,IAAI,SAAS,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC;IAoCtD,gBAAC;CAAA,AArCD,CAAwB,mBAAS,GAqChC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFObject.d.ts b/cjs/core/objects/PDFObject.d.ts new file mode 100644 index 000000000..1567f2c69 --- /dev/null +++ b/cjs/core/objects/PDFObject.d.ts @@ -0,0 +1,9 @@ +import PDFContext from "../PDFContext"; +declare class PDFObject { + clone(_context?: PDFContext): PDFObject; + toString(): string; + sizeInBytes(): number; + copyBytesInto(_buffer: Uint8Array, _offset: number): number; +} +export default PDFObject; +//# sourceMappingURL=PDFObject.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFObject.d.ts.map b/cjs/core/objects/PDFObject.d.ts.map new file mode 100644 index 000000000..959bfc6d9 --- /dev/null +++ b/cjs/core/objects/PDFObject.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObject.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFObject.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,sBAA4B;AAE7C,cAAM,SAAS;IACb,KAAK,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS;IAIvC,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAG5D;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFObject.js b/cjs/core/objects/PDFObject.js new file mode 100644 index 000000000..c1ae73413 --- /dev/null +++ b/cjs/core/objects/PDFObject.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var errors_1 = require("../errors"); +var PDFObject = /** @class */ (function () { + function PDFObject() { + } + PDFObject.prototype.clone = function (_context) { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'clone'); + }; + PDFObject.prototype.toString = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'toString'); + }; + PDFObject.prototype.sizeInBytes = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'sizeInBytes'); + }; + PDFObject.prototype.copyBytesInto = function (_buffer, _offset) { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'copyBytesInto'); + }; + return PDFObject; +}()); +exports.default = PDFObject; +//# sourceMappingURL=PDFObject.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFObject.js.map b/cjs/core/objects/PDFObject.js.map new file mode 100644 index 000000000..f6bf6fa0e --- /dev/null +++ b/cjs/core/objects/PDFObject.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObject.js","sourceRoot":"","sources":["../../../src/core/objects/PDFObject.ts"],"names":[],"mappings":";;AAAA,oCAA4D;AAG5D;IAAA;IAgBA,CAAC;IAfC,yBAAK,GAAL,UAAM,QAAqB;QACzB,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,4BAAQ,GAAR;QACE,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;IAED,+BAAW,GAAX;QACE,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC5E,CAAC;IAED,iCAAa,GAAb,UAAc,OAAmB,EAAE,OAAe;QAChD,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC9E,CAAC;IACH,gBAAC;AAAD,CAAC,AAhBD,IAgBC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFRawStream.d.ts b/cjs/core/objects/PDFRawStream.d.ts new file mode 100644 index 000000000..55800812e --- /dev/null +++ b/cjs/core/objects/PDFRawStream.d.ts @@ -0,0 +1,15 @@ +import PDFDict from "./PDFDict"; +import PDFStream from "./PDFStream"; +import PDFContext from "../PDFContext"; +declare class PDFRawStream extends PDFStream { + static of: (dict: PDFDict, contents: Uint8Array) => PDFRawStream; + readonly contents: Uint8Array; + private constructor(); + asUint8Array(): Uint8Array; + clone(context?: PDFContext): PDFRawStream; + getContentsString(): string; + getContents(): Uint8Array; + getContentsSize(): number; +} +export default PDFRawStream; +//# sourceMappingURL=PDFRawStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFRawStream.d.ts.map b/cjs/core/objects/PDFRawStream.d.ts.map new file mode 100644 index 000000000..ee9104a97 --- /dev/null +++ b/cjs/core/objects/PDFRawStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRawStream.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFRawStream.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,kBAAiC;AAC/C,OAAO,SAAS,oBAAmC;AACnD,OAAO,UAAU,sBAA4B;AAG7C,cAAM,YAAa,SAAQ,SAAS;IAClC,MAAM,CAAC,EAAE,SAAU,OAAO,YAAY,UAAU,kBACb;IAEnC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAE9B,OAAO;IAKP,YAAY,IAAI,UAAU;IAI1B,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,YAAY;IAIzC,iBAAiB,IAAI,MAAM;IAI3B,WAAW,IAAI,UAAU;IAIzB,eAAe,IAAI,MAAM;CAG1B;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFRawStream.js b/cjs/core/objects/PDFRawStream.js new file mode 100644 index 000000000..59730d9d7 --- /dev/null +++ b/cjs/core/objects/PDFRawStream.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFStream_1 = tslib_1.__importDefault(require("./PDFStream")); +var utils_1 = require("../../utils"); +var PDFRawStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFRawStream, _super); + function PDFRawStream(dict, contents) { + var _this = _super.call(this, dict) || this; + _this.contents = contents; + return _this; + } + PDFRawStream.prototype.asUint8Array = function () { + return this.contents.slice(); + }; + PDFRawStream.prototype.clone = function (context) { + return PDFRawStream.of(this.dict.clone(context), this.contents.slice()); + }; + PDFRawStream.prototype.getContentsString = function () { + return utils_1.arrayAsString(this.contents); + }; + PDFRawStream.prototype.getContents = function () { + return this.contents; + }; + PDFRawStream.prototype.getContentsSize = function () { + return this.contents.length; + }; + PDFRawStream.of = function (dict, contents) { + return new PDFRawStream(dict, contents); + }; + return PDFRawStream; +}(PDFStream_1.default)); +exports.default = PDFRawStream; +//# sourceMappingURL=PDFRawStream.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFRawStream.js.map b/cjs/core/objects/PDFRawStream.js.map new file mode 100644 index 000000000..1f006bae8 --- /dev/null +++ b/cjs/core/objects/PDFRawStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRawStream.js","sourceRoot":"","sources":["../../../src/core/objects/PDFRawStream.ts"],"names":[],"mappings":";;;AACA,kEAAmD;AAEnD,qCAA0C;AAE1C;IAA2B,wCAAS;IAMlC,sBAAoB,IAAa,EAAE,QAAoB;QAAvD,YACE,kBAAM,IAAI,CAAC,SAEZ;QADC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC3B,CAAC;IAED,mCAAY,GAAZ;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,4BAAK,GAAL,UAAM,OAAoB;QACxB,OAAO,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,wCAAiB,GAAjB;QACE,OAAO,qBAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,kCAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,sCAAe,GAAf;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IA5BM,eAAE,GAAG,UAAC,IAAa,EAAE,QAAoB;QAC9C,OAAA,IAAI,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAhC,CAAgC,CAAC;IA4BrC,mBAAC;CAAA,AA9BD,CAA2B,mBAAS,GA8BnC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFRef.d.ts b/cjs/core/objects/PDFRef.d.ts new file mode 100644 index 000000000..b4cf0186b --- /dev/null +++ b/cjs/core/objects/PDFRef.d.ts @@ -0,0 +1,14 @@ +import PDFObject from "./PDFObject"; +declare class PDFRef extends PDFObject { + static of: (objectNumber: number, generationNumber?: number) => PDFRef; + readonly objectNumber: number; + readonly generationNumber: number; + readonly tag: string; + private constructor(); + clone(): PDFRef; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFRef; +//# sourceMappingURL=PDFRef.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFRef.d.ts.map b/cjs/core/objects/PDFRef.d.ts.map new file mode 100644 index 000000000..d589c9f50 --- /dev/null +++ b/cjs/core/objects/PDFRef.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRef.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFRef.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,oBAAmC;AAMnD,cAAM,MAAO,SAAQ,SAAS;IAC5B,MAAM,CAAC,EAAE,iBAAkB,MAAM,uCAU/B;IAEF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,OAAO;IAYP,KAAK,IAAI,MAAM;IAIf,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAI1D;AAED,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFRef.js b/cjs/core/objects/PDFRef.js new file mode 100644 index 000000000..3e567c536 --- /dev/null +++ b/cjs/core/objects/PDFRef.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var utils_1 = require("../../utils"); +var ENFORCER = {}; +var pool = new Map(); +var PDFRef = /** @class */ (function (_super) { + tslib_1.__extends(PDFRef, _super); + function PDFRef(enforcer, objectNumber, generationNumber) { + var _this = this; + if (enforcer !== ENFORCER) + throw new errors_1.PrivateConstructorError('PDFRef'); + _this = _super.call(this) || this; + _this.objectNumber = objectNumber; + _this.generationNumber = generationNumber; + _this.tag = objectNumber + " " + generationNumber + " R"; + return _this; + } + PDFRef.prototype.clone = function () { + return this; + }; + PDFRef.prototype.toString = function () { + return this.tag; + }; + PDFRef.prototype.sizeInBytes = function () { + return this.tag.length; + }; + PDFRef.prototype.copyBytesInto = function (buffer, offset) { + offset += utils_1.copyStringIntoBuffer(this.tag, buffer, offset); + return this.tag.length; + }; + PDFRef.of = function (objectNumber, generationNumber) { + if (generationNumber === void 0) { generationNumber = 0; } + var tag = objectNumber + " " + generationNumber + " R"; + var instance = pool.get(tag); + if (!instance) { + instance = new PDFRef(ENFORCER, objectNumber, generationNumber); + pool.set(tag, instance); + } + return instance; + }; + return PDFRef; +}(PDFObject_1.default)); +exports.default = PDFRef; +//# sourceMappingURL=PDFRef.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFRef.js.map b/cjs/core/objects/PDFRef.js.map new file mode 100644 index 000000000..19d037509 --- /dev/null +++ b/cjs/core/objects/PDFRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFRef.js","sourceRoot":"","sources":["../../../src/core/objects/PDFRef.ts"],"names":[],"mappings":";;;AAAA,oCAA0D;AAC1D,kEAAmD;AACnD,qCAAiD;AAEjD,IAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEvC;IAAqB,kCAAS;IAiB5B,gBACE,QAAa,EACb,YAAoB,EACpB,gBAAwB;QAH1B,iBAUC;QALC,IAAI,QAAQ,KAAK,QAAQ;YAAE,MAAM,IAAI,gCAAuB,CAAC,QAAQ,CAAC,CAAC;QACvE,QAAA,iBAAO,SAAC;QACR,KAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,KAAI,CAAC,GAAG,GAAM,YAAY,SAAI,gBAAgB,OAAI,CAAC;;IACrD,CAAC;IAED,sBAAK,GAAL;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,4BAAW,GAAX;QACE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,8BAAa,GAAb,UAAc,MAAkB,EAAE,MAAc;QAC9C,MAAM,IAAI,4BAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;IACzB,CAAC;IA3CM,SAAE,GAAG,UAAC,YAAoB,EAAE,gBAAoB;QAApB,iCAAA,EAAA,oBAAoB;QACrD,IAAM,GAAG,GAAM,YAAY,SAAI,gBAAgB,OAAI,CAAC;QAEpD,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;YAChE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;SACzB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAkCJ,aAAC;CAAA,AA7CD,CAAqB,mBAAS,GA6C7B;AAED,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFStream.d.ts b/cjs/core/objects/PDFStream.d.ts new file mode 100644 index 000000000..95ed44a15 --- /dev/null +++ b/cjs/core/objects/PDFStream.d.ts @@ -0,0 +1,17 @@ +import PDFDict from "./PDFDict"; +import PDFObject from "./PDFObject"; +import PDFContext from "../PDFContext"; +declare class PDFStream extends PDFObject { + readonly dict: PDFDict; + constructor(dict: PDFDict); + clone(_context?: PDFContext): PDFStream; + getContentsString(): string; + getContents(): Uint8Array; + getContentsSize(): number; + updateDict(): void; + sizeInBytes(): number; + toString(): string; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFStream; +//# sourceMappingURL=PDFStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFStream.d.ts.map b/cjs/core/objects/PDFStream.d.ts.map new file mode 100644 index 000000000..dc27c091f --- /dev/null +++ b/cjs/core/objects/PDFStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFStream.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFStream.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,kBAAiC;AAG/C,OAAO,SAAS,oBAAmC;AACnD,OAAO,UAAU,sBAA4B;AAG7C,cAAM,SAAU,SAAQ,SAAS;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,IAAI,EAAE,OAAO;IAKzB,KAAK,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS;IAIvC,iBAAiB,IAAI,MAAM;IAO3B,WAAW,IAAI,UAAU;IAIzB,eAAe,IAAI,MAAM;IAOzB,UAAU,IAAI,IAAI;IAKlB,WAAW,IAAI,MAAM;IAKrB,QAAQ,IAAI,MAAM;IASlB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAiC1D;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFStream.js b/cjs/core/objects/PDFStream.js new file mode 100644 index 000000000..ad8680990 --- /dev/null +++ b/cjs/core/objects/PDFStream.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFName_1 = tslib_1.__importDefault(require("./PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("./PDFNumber")); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var PDFStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFStream, _super); + function PDFStream(dict) { + var _this = _super.call(this) || this; + _this.dict = dict; + return _this; + } + PDFStream.prototype.clone = function (_context) { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'clone'); + }; + PDFStream.prototype.getContentsString = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'getContentsString'); + }; + PDFStream.prototype.getContents = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'getContents'); + }; + PDFStream.prototype.getContentsSize = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'getContentsSize'); + }; + PDFStream.prototype.updateDict = function () { + var contentsSize = this.getContentsSize(); + this.dict.set(PDFName_1.default.Length, PDFNumber_1.default.of(contentsSize)); + }; + PDFStream.prototype.sizeInBytes = function () { + this.updateDict(); + return this.dict.sizeInBytes() + this.getContentsSize() + 18; + }; + PDFStream.prototype.toString = function () { + this.updateDict(); + var streamString = this.dict.toString(); + streamString += '\nstream\n'; + streamString += this.getContentsString(); + streamString += '\nendstream'; + return streamString; + }; + PDFStream.prototype.copyBytesInto = function (buffer, offset) { + this.updateDict(); + var initialOffset = offset; + offset += this.dict.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.s; + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.a; + buffer[offset++] = CharCodes_1.default.m; + buffer[offset++] = CharCodes_1.default.Newline; + var contents = this.getContents(); + for (var idx = 0, len = contents.length; idx < len; idx++) { + buffer[offset++] = contents[idx]; + } + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.n; + buffer[offset++] = CharCodes_1.default.d; + buffer[offset++] = CharCodes_1.default.s; + buffer[offset++] = CharCodes_1.default.t; + buffer[offset++] = CharCodes_1.default.r; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.a; + buffer[offset++] = CharCodes_1.default.m; + return offset - initialOffset; + }; + return PDFStream; +}(PDFObject_1.default)); +exports.default = PDFStream; +//# sourceMappingURL=PDFStream.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFStream.js.map b/cjs/core/objects/PDFStream.js.map new file mode 100644 index 000000000..c817e1a88 --- /dev/null +++ b/cjs/core/objects/PDFStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFStream.js","sourceRoot":"","sources":["../../../src/core/objects/PDFStream.ts"],"names":[],"mappings":";;;AAAA,oCAA4D;AAE5D,8DAA+C;AAC/C,kEAAmD;AACnD,kEAAmD;AAEnD,0EAAkD;AAElD;IAAwB,qCAAS;IAG/B,mBAAY,IAAa;QAAzB,YACE,iBAAO,SAER;QADC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IAED,yBAAK,GAAL,UAAM,QAAqB;QACzB,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED,qCAAiB,GAAjB;QACE,MAAM,IAAI,kCAAyB,CACjC,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,mBAAmB,CACpB,CAAC;IACJ,CAAC;IAED,+BAAW,GAAX;QACE,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC5E,CAAC;IAED,mCAAe,GAAf;QACE,MAAM,IAAI,kCAAyB,CACjC,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,8BAAU,GAAV;QACE,IAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,MAAM,EAAE,mBAAS,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,+BAAW,GAAX;QACE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,G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EAAE,GAAG,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;SAClC;QAED,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,OAAO,CAAC;QACrC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,CAAC,CAAC;QAE/B,OAAO,MAAM,GAAG,aAAa,CAAC;IAChC,CAAC;IACH,gBAAC;AAAD,CAAC,AAlFD,CAAwB,mBAAS,GAkFhC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFString.d.ts b/cjs/core/objects/PDFString.d.ts new file mode 100644 index 000000000..802242061 --- /dev/null +++ b/cjs/core/objects/PDFString.d.ts @@ -0,0 +1,17 @@ +import PDFObject from "./PDFObject"; +declare class PDFString extends PDFObject { + static of: (value: string) => PDFString; + static fromDate: (date: Date) => PDFString; + private readonly value; + private constructor(); + asBytes(): Uint8Array; + decodeText(): string; + decodeDate(): Date; + asString(): string; + clone(): PDFString; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFString; +//# sourceMappingURL=PDFString.d.ts.map \ No newline at end of file diff --git a/cjs/core/objects/PDFString.d.ts.map b/cjs/core/objects/PDFString.d.ts.map new file mode 100644 index 000000000..a88345591 --- /dev/null +++ b/cjs/core/objects/PDFString.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFString.d.ts","sourceRoot":"","sources":["../../../src/core/objects/PDFString.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,oBAAmC;AAanD,cAAM,SAAU,SAAQ,SAAS;IAI/B,MAAM,CAAC,EAAE,UAAW,MAAM,eAA0B;IAEpD,MAAM,CAAC,QAAQ,SAAU,IAAI,eAQ3B;IAEF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B,OAAO;IAKP,OAAO,IAAI,UAAU;IA4CrB,UAAU,IAAI,MAAM;IAMpB,UAAU,IAAI,IAAI;IAOlB,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,SAAS;IAIlB,QAAQ,IAAI,MAAM;IAIlB,WAAW,IAAI,MAAM;IAIrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAM1D;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/objects/PDFString.js b/cjs/core/objects/PDFString.js new file mode 100644 index 000000000..e94e252eb --- /dev/null +++ b/cjs/core/objects/PDFString.js @@ -0,0 +1,116 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFObject_1 = tslib_1.__importDefault(require("./PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var errors_1 = require("../errors"); +var PDFString = /** @class */ (function (_super) { + tslib_1.__extends(PDFString, _super); + function PDFString(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + PDFString.prototype.asBytes = function () { + var bytes = []; + var octal = ''; + var escaped = false; + var pushByte = function (byte) { + if (byte !== undefined) + bytes.push(byte); + escaped = false; + }; + for (var idx = 0, len = this.value.length; idx < len; idx++) { + var char = this.value[idx]; + var byte = utils_1.toCharCode(char); + var nextChar = this.value[idx + 1]; + if (!escaped) { + if (byte === CharCodes_1.default.BackSlash) + escaped = true; + else + pushByte(byte); + } + else { + if (byte === CharCodes_1.default.Newline) + pushByte(); + else if (byte === CharCodes_1.default.CarriageReturn) + pushByte(); + else if (byte === CharCodes_1.default.n) + pushByte(CharCodes_1.default.Newline); + else if (byte === CharCodes_1.default.r) + pushByte(CharCodes_1.default.CarriageReturn); + else if (byte === CharCodes_1.default.t) + pushByte(CharCodes_1.default.Tab); + else if (byte === CharCodes_1.default.b) + pushByte(CharCodes_1.default.Backspace); + else if (byte === CharCodes_1.default.f) + pushByte(CharCodes_1.default.FormFeed); + else if (byte === CharCodes_1.default.LeftParen) + pushByte(CharCodes_1.default.LeftParen); + else if (byte === CharCodes_1.default.RightParen) + pushByte(CharCodes_1.default.RightParen); + else if (byte === CharCodes_1.default.Backspace) + pushByte(CharCodes_1.default.BackSlash); + else if (byte >= CharCodes_1.default.Zero && byte <= CharCodes_1.default.Seven) { + octal += char; + if (octal.length === 3 || !(nextChar >= '0' && nextChar <= '7')) { + pushByte(parseInt(octal, 8)); + octal = ''; + } + } + else { + pushByte(byte); + } + } + } + return new Uint8Array(bytes); + }; + PDFString.prototype.decodeText = function () { + var bytes = this.asBytes(); + if (utils_1.hasUtf16BOM(bytes)) + return utils_1.utf16Decode(bytes); + return utils_1.pdfDocEncodingDecode(bytes); + }; + PDFString.prototype.decodeDate = function () { + var text = this.decodeText(); + var date = utils_1.parseDate(text); + if (!date) + throw new errors_1.InvalidPDFDateStringError(text); + return date; + }; + PDFString.prototype.asString = function () { + return this.value; + }; + PDFString.prototype.clone = function () { + return PDFString.of(this.value); + }; + PDFString.prototype.toString = function () { + return "(" + this.value + ")"; + }; + PDFString.prototype.sizeInBytes = function () { + return this.value.length + 2; + }; + PDFString.prototype.copyBytesInto = function (buffer, offset) { + buffer[offset++] = CharCodes_1.default.LeftParen; + offset += utils_1.copyStringIntoBuffer(this.value, buffer, offset); + buffer[offset++] = CharCodes_1.default.RightParen; + return this.value.length + 2; + }; + // The PDF spec allows newlines and parens to appear directly within a literal + // string. These character _may_ be escaped. But they do not _have_ to be. So + // for simplicity, we will not bother escaping them. + PDFString.of = function (value) { return new PDFString(value); }; + PDFString.fromDate = function (date) { + var year = utils_1.padStart(String(date.getUTCFullYear()), 4, '0'); + var month = utils_1.padStart(String(date.getUTCMonth() + 1), 2, '0'); + var day = utils_1.padStart(String(date.getUTCDate()), 2, '0'); + var hours = utils_1.padStart(String(date.getUTCHours()), 2, '0'); + var mins = utils_1.padStart(String(date.getUTCMinutes()), 2, '0'); + var secs = utils_1.padStart(String(date.getUTCSeconds()), 2, '0'); + return new PDFString("D:" + year + month + day + hours + mins + secs + "Z"); + }; + return PDFString; +}(PDFObject_1.default)); +exports.default = PDFString; +//# sourceMappingURL=PDFString.js.map \ No newline at end of file diff --git a/cjs/core/objects/PDFString.js.map b/cjs/core/objects/PDFString.js.map new file mode 100644 index 000000000..cf298e9b8 --- /dev/null +++ b/cjs/core/objects/PDFString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFString.js","sourceRoot":"","sources":["../../../src/core/objects/PDFString.ts"],"names":[],"mappings":";;;AAAA,kEAAmD;AACnD,0EAAkD;AAClD,qCAQmB;AACnB,oCAA4D;AAE5D;IAAwB,qCAAS;IAkB/B,mBAAoB,KAAa;QAAjC,YACE,iBAAO,SAER;QADC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACrB,CAAC;IAED,2BAAO,GAAP;QACE,IAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,IAAM,QAAQ,GAAG,UAAC,IAAa;YAC7B,IAAI,IAAI,KAAK,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IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QAC3D,IAAM,IAAI,GAAG,gBAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAM,IAAI,GAAG,gBAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,OAAO,IAAI,SAAS,CAAC,OAAK,IAAI,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,MAAG,CAAC,CAAC;IACzE,CAAC,CAAC;IAwFJ,gBAAC;CAAA,AAtGD,CAAwB,mBAAS,GAsGhC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/operators/PDFOperator.d.ts b/cjs/core/operators/PDFOperator.d.ts new file mode 100644 index 000000000..a6759421e --- /dev/null +++ b/cjs/core/operators/PDFOperator.d.ts @@ -0,0 +1,20 @@ +import PDFArray from "../objects/PDFArray"; +import PDFHexString from "../objects/PDFHexString"; +import PDFName from "../objects/PDFName"; +import PDFNumber from "../objects/PDFNumber"; +import PDFString from "../objects/PDFString"; +import PDFOperatorNames from "./PDFOperatorNames"; +import PDFContext from "../PDFContext"; +export declare type PDFOperatorArg = string | PDFName | PDFArray | PDFNumber | PDFString | PDFHexString; +declare class PDFOperator { + static of: (name: PDFOperatorNames, args?: PDFOperatorArg[] | undefined) => PDFOperator; + private readonly name; + private readonly args; + private constructor(); + clone(context?: PDFContext): PDFOperator; + toString(): string; + sizeInBytes(): number; + copyBytesInto(buffer: Uint8Array, offset: number): number; +} +export default PDFOperator; +//# sourceMappingURL=PDFOperator.d.ts.map \ No newline at end of file diff --git a/cjs/core/operators/PDFOperator.d.ts.map b/cjs/core/operators/PDFOperator.d.ts.map new file mode 100644 index 000000000..6eef05008 --- /dev/null +++ b/cjs/core/operators/PDFOperator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOperator.d.ts","sourceRoot":"","sources":["../../../src/core/operators/PDFOperator.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4BAAkC;AACjD,OAAO,YAAY,gCAAsC;AACzD,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AAEnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,gBAAgB,2BAA4C;AACnE,OAAO,UAAU,sBAA4B;AAI7C,oBAAY,cAAc,GACtB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,SAAS,GACT,YAAY,CAAC;AAEjB,cAAM,WAAW;IACf,MAAM,CAAC,EAAE,SAAU,gBAAgB,sDACL;IAE9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IACxC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC,OAAO;IAKP,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,WAAW;IASxC,QAAQ,IAAI,MAAM;IASlB,WAAW,IAAI,MAAM;IAUrB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAiB1D;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/operators/PDFOperator.js b/cjs/core/operators/PDFOperator.js new file mode 100644 index 000000000..41e2bd441 --- /dev/null +++ b/cjs/core/operators/PDFOperator.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFObject_1 = tslib_1.__importDefault(require("../objects/PDFObject")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var PDFOperator = /** @class */ (function () { + function PDFOperator(name, args) { + this.name = name; + this.args = args || []; + } + PDFOperator.prototype.clone = function (context) { + var args = new Array(this.args.length); + for (var idx = 0, len = args.length; idx < len; idx++) { + var arg = this.args[idx]; + args[idx] = arg instanceof PDFObject_1.default ? arg.clone(context) : arg; + } + return PDFOperator.of(this.name, args); + }; + PDFOperator.prototype.toString = function () { + var value = ''; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + value += String(this.args[idx]) + ' '; + } + value += this.name; + return value; + }; + PDFOperator.prototype.sizeInBytes = function () { + var size = 0; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + var arg = this.args[idx]; + size += (arg instanceof PDFObject_1.default ? arg.sizeInBytes() : arg.length) + 1; + } + size += this.name.length; + return size; + }; + PDFOperator.prototype.copyBytesInto = function (buffer, offset) { + var initialOffset = offset; + for (var idx = 0, len = this.args.length; idx < len; idx++) { + var arg = this.args[idx]; + if (arg instanceof PDFObject_1.default) { + offset += arg.copyBytesInto(buffer, offset); + } + else { + offset += utils_1.copyStringIntoBuffer(arg, buffer, offset); + } + buffer[offset++] = CharCodes_1.default.Space; + } + offset += utils_1.copyStringIntoBuffer(this.name, buffer, offset); + return offset - initialOffset; + }; + PDFOperator.of = function (name, args) { + return new PDFOperator(name, args); + }; + return PDFOperator; +}()); +exports.default = PDFOperator; +//# sourceMappingURL=PDFOperator.js.map \ No newline at end of file diff --git a/cjs/core/operators/PDFOperator.js.map b/cjs/core/operators/PDFOperator.js.map new file mode 100644 index 000000000..657c1ff0a --- /dev/null +++ b/cjs/core/operators/PDFOperator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOperator.js","sourceRoot":"","sources":["../../../src/core/operators/PDFOperator.ts"],"names":[],"mappings":";;;AAIA,2EAAmD;AAInD,0EAAkD;AAClD,qCAAiD;AAUjD;IAOE,qBAAoB,IAAsB,EAAE,IAAuB;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,2BAAK,GAAL,UAAM,OAAoB;QACxB,IAAM,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,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CAAC,MAAM,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mCAAa,GAAb,UAAc,MAAkB,EAAE,MAAc;QAC9C,IAAM,aAAa,GAAG,MAAM,CAAC;QAE7B,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC1D,IAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,GAAG,YAAY,mBAAS,EAAE;gBAC5B,MAAM,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aAC7C;iBAAM;gBACL,MAAM,IAAI,4BAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;aACrD;YACD,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,KAAK,CAAC;SACpC;QAED,MAAM,IAAI,4BAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE1D,OAAO,MAAM,GAAG,aAAa,CAAC;IAChC,CAAC;IAvDM,cAAE,GAAG,UAAC,IAAsB,EAAE,IAAuB;QAC1D,OAAA,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;IAA3B,CAA2B,CAAC;IAuDhC,kBAAC;CAAA,AAzDD,IAyDC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/operators/PDFOperatorNames.d.ts b/cjs/core/operators/PDFOperatorNames.d.ts new file mode 100644 index 000000000..f1f48ef54 --- /dev/null +++ b/cjs/core/operators/PDFOperatorNames.d.ts @@ -0,0 +1,77 @@ +declare enum PDFOperatorNames { + NonStrokingColor = "sc", + NonStrokingColorN = "scn", + NonStrokingColorRgb = "rg", + NonStrokingColorGray = "g", + NonStrokingColorCmyk = "k", + NonStrokingColorspace = "cs", + StrokingColor = "SC", + StrokingColorN = "SCN", + StrokingColorRgb = "RG", + StrokingColorGray = "G", + StrokingColorCmyk = "K", + StrokingColorspace = "CS", + BeginMarkedContentSequence = "BDC", + BeginMarkedContent = "BMC", + EndMarkedContent = "EMC", + MarkedContentPointWithProps = "DP", + MarkedContentPoint = "MP", + DrawObject = "Do", + ConcatTransformationMatrix = "cm", + PopGraphicsState = "Q", + PushGraphicsState = "q", + SetFlatness = "i", + SetGraphicsStateParams = "gs", + SetLineCapStyle = "J", + SetLineDashPattern = "d", + SetLineJoinStyle = "j", + SetLineMiterLimit = "M", + SetLineWidth = "w", + SetTextMatrix = "Tm", + SetRenderingIntent = "ri", + AppendRectangle = "re", + BeginInlineImage = "BI", + BeginInlineImageData = "ID", + EndInlineImage = "EI", + ClipEvenOdd = "W*", + ClipNonZero = "W", + CloseAndStroke = "s", + CloseFillEvenOddAndStroke = "b*", + CloseFillNonZeroAndStroke = "b", + ClosePath = "h", + AppendBezierCurve = "c", + CurveToReplicateFinalPoint = "y", + CurveToReplicateInitialPoint = "v", + EndPath = "n", + FillEvenOddAndStroke = "B*", + FillEvenOdd = "f*", + FillNonZeroAndStroke = "B", + FillNonZero = "f", + LegacyFillNonZero = "F", + LineTo = "l", + MoveTo = "m", + ShadingFill = "sh", + StrokePath = "S", + BeginText = "BT", + EndText = "ET", + MoveText = "Td", + MoveTextSetLeading = "TD", + NextLine = "T*", + SetCharacterSpacing = "Tc", + SetFontAndSize = "Tf", + SetTextHorizontalScaling = "Tz", + SetTextLineHeight = "TL", + SetTextRenderingMode = "Tr", + SetTextRise = "Ts", + SetWordSpacing = "Tw", + ShowText = "Tj", + ShowTextAdjusted = "TJ", + ShowTextLine = "'", + ShowTextLineAndSpace = "\"", + Type3D0 = "d0", + Type3D1 = "d1", + BeginCompatibilitySection = "BX", + EndCompatibilitySection = "EX" +} +export default PDFOperatorNames; +//# sourceMappingURL=PDFOperatorNames.d.ts.map \ No newline at end of file diff --git a/cjs/core/operators/PDFOperatorNames.d.ts.map b/cjs/core/operators/PDFOperatorNames.d.ts.map new file mode 100644 index 000000000..e18ebdcff --- /dev/null +++ b/cjs/core/operators/PDFOperatorNames.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOperatorNames.d.ts","sourceRoot":"","sources":["../../../src/core/operators/PDFOperatorNames.ts"],"names":[],"mappings":"AAAA,aAAK,gBAAgB;IAEnB,gBAAgB,OAAO;IACvB,iBAAiB,QAAQ;IACzB,mBAAmB,OAAO;IAC1B,oBAAoB,MAAM;IAC1B,oBAAoB,MAAM;IAC1B,qBAAqB,OAAO;IAG5B,aAAa,OAAO;IACpB,cAAc,QAAQ;IACtB,gBAAgB,OAAO;IACvB,iBAAiB,MAAM;IACvB,iBAAiB,MAAM;IACvB,kBAAkB,OAAO;IAGzB,0BAA0B,QAAQ;IAClC,kBAAkB,QAAQ;IAC1B,gBAAgB,QAAQ;IACxB,2BAA2B,OAAO;IAClC,kBAAkB,OAAO;IACzB,UAAU,OAAO;IAGjB,0BAA0B,OAAO;IACjC,gBAAgB,MAAM;IACtB,iBAAiB,MAAM;IACvB,WAAW,MAAM;IACjB,sBAAsB,OAAO;IAC7B,eAAe,MAAM;IACrB,kBAAkB,MAAM;IACxB,gBAAgB,MAAM;IACtB,iBAAiB,MAAM;IACvB,YAAY,MAAM;IAClB,aAAa,OAAO;IACpB,kBAAkB,OAAO;IAGzB,eAAe,OAAO;IACtB,gBAAgB,OAAO;IACvB,oBAAoB,OAAO;IAC3B,cAAc,OAAO;IACrB,WAAW,OAAO;IAClB,WAAW,MAAM;IACjB,cAAc,MAAM;IACpB,yBAAyB,OAAO;IAChC,yBAAyB,MAAM;IAC/B,SAAS,MAAM;IACf,iBAAiB,MAAM;IACvB,0BAA0B,MAAM;IAChC,4BAA4B,MAAM;IAClC,OAAO,MAAM;IACb,oBAAoB,OAAO;IAC3B,WAAW,OAAO;IAClB,oBAAoB,MAAM;IAC1B,WAAW,MAAM;IACjB,iBAAiB,MAAM;IACvB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,WAAW,OAAO;IAClB,UAAU,MAAM;IAGhB,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,kBAAkB,OAAO;IACzB,QAAQ,OAAO;IACf,mBAAmB,OAAO;IAC1B,cAAc,OAAO;IACrB,wBAAwB,OAAO;IAC/B,iBAAiB,OAAO;IACxB,oBAAoB,OAAO;IAC3B,WAAW,OAAO;IAClB,cAAc,OAAO;IACrB,QAAQ,OAAO;IACf,gBAAgB,OAAO;IACvB,YAAY,MAAM;IAClB,oBAAoB,OAAM;IAG1B,OAAO,OAAO;IACd,OAAO,OAAO;IAGd,yBAAyB,OAAO;IAChC,uBAAuB,OAAO;CAC/B;AAED,eAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/operators/PDFOperatorNames.js b/cjs/core/operators/PDFOperatorNames.js new file mode 100644 index 000000000..9ae0cb404 --- /dev/null +++ b/cjs/core/operators/PDFOperatorNames.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var PDFOperatorNames; +(function (PDFOperatorNames) { + // Non Stroking Color Operators + PDFOperatorNames["NonStrokingColor"] = "sc"; + PDFOperatorNames["NonStrokingColorN"] = "scn"; + PDFOperatorNames["NonStrokingColorRgb"] = "rg"; + PDFOperatorNames["NonStrokingColorGray"] = "g"; + PDFOperatorNames["NonStrokingColorCmyk"] = "k"; + PDFOperatorNames["NonStrokingColorspace"] = "cs"; + // Stroking Color Operators + PDFOperatorNames["StrokingColor"] = "SC"; + PDFOperatorNames["StrokingColorN"] = "SCN"; + PDFOperatorNames["StrokingColorRgb"] = "RG"; + PDFOperatorNames["StrokingColorGray"] = "G"; + PDFOperatorNames["StrokingColorCmyk"] = "K"; + PDFOperatorNames["StrokingColorspace"] = "CS"; + // Marked Content Operators + PDFOperatorNames["BeginMarkedContentSequence"] = "BDC"; + PDFOperatorNames["BeginMarkedContent"] = "BMC"; + PDFOperatorNames["EndMarkedContent"] = "EMC"; + PDFOperatorNames["MarkedContentPointWithProps"] = "DP"; + PDFOperatorNames["MarkedContentPoint"] = "MP"; + PDFOperatorNames["DrawObject"] = "Do"; + // Graphics State Operators + PDFOperatorNames["ConcatTransformationMatrix"] = "cm"; + PDFOperatorNames["PopGraphicsState"] = "Q"; + PDFOperatorNames["PushGraphicsState"] = "q"; + PDFOperatorNames["SetFlatness"] = "i"; + PDFOperatorNames["SetGraphicsStateParams"] = "gs"; + PDFOperatorNames["SetLineCapStyle"] = "J"; + PDFOperatorNames["SetLineDashPattern"] = "d"; + PDFOperatorNames["SetLineJoinStyle"] = "j"; + PDFOperatorNames["SetLineMiterLimit"] = "M"; + PDFOperatorNames["SetLineWidth"] = "w"; + PDFOperatorNames["SetTextMatrix"] = "Tm"; + PDFOperatorNames["SetRenderingIntent"] = "ri"; + // Graphics Operators + PDFOperatorNames["AppendRectangle"] = "re"; + PDFOperatorNames["BeginInlineImage"] = "BI"; + PDFOperatorNames["BeginInlineImageData"] = "ID"; + PDFOperatorNames["EndInlineImage"] = "EI"; + PDFOperatorNames["ClipEvenOdd"] = "W*"; + PDFOperatorNames["ClipNonZero"] = "W"; + PDFOperatorNames["CloseAndStroke"] = "s"; + PDFOperatorNames["CloseFillEvenOddAndStroke"] = "b*"; + PDFOperatorNames["CloseFillNonZeroAndStroke"] = "b"; + PDFOperatorNames["ClosePath"] = "h"; + PDFOperatorNames["AppendBezierCurve"] = "c"; + PDFOperatorNames["CurveToReplicateFinalPoint"] = "y"; + PDFOperatorNames["CurveToReplicateInitialPoint"] = "v"; + PDFOperatorNames["EndPath"] = "n"; + PDFOperatorNames["FillEvenOddAndStroke"] = "B*"; + PDFOperatorNames["FillEvenOdd"] = "f*"; + PDFOperatorNames["FillNonZeroAndStroke"] = "B"; + PDFOperatorNames["FillNonZero"] = "f"; + PDFOperatorNames["LegacyFillNonZero"] = "F"; + PDFOperatorNames["LineTo"] = "l"; + PDFOperatorNames["MoveTo"] = "m"; + PDFOperatorNames["ShadingFill"] = "sh"; + PDFOperatorNames["StrokePath"] = "S"; + // Text Operators + PDFOperatorNames["BeginText"] = "BT"; + PDFOperatorNames["EndText"] = "ET"; + PDFOperatorNames["MoveText"] = "Td"; + PDFOperatorNames["MoveTextSetLeading"] = "TD"; + PDFOperatorNames["NextLine"] = "T*"; + PDFOperatorNames["SetCharacterSpacing"] = "Tc"; + PDFOperatorNames["SetFontAndSize"] = "Tf"; + PDFOperatorNames["SetTextHorizontalScaling"] = "Tz"; + PDFOperatorNames["SetTextLineHeight"] = "TL"; + PDFOperatorNames["SetTextRenderingMode"] = "Tr"; + PDFOperatorNames["SetTextRise"] = "Ts"; + PDFOperatorNames["SetWordSpacing"] = "Tw"; + PDFOperatorNames["ShowText"] = "Tj"; + PDFOperatorNames["ShowTextAdjusted"] = "TJ"; + PDFOperatorNames["ShowTextLine"] = "'"; + PDFOperatorNames["ShowTextLineAndSpace"] = "\""; + // Type3 Font Operators + PDFOperatorNames["Type3D0"] = "d0"; + PDFOperatorNames["Type3D1"] = "d1"; + // Compatibility Section Operators + PDFOperatorNames["BeginCompatibilitySection"] = "BX"; + PDFOperatorNames["EndCompatibilitySection"] = "EX"; +})(PDFOperatorNames || (PDFOperatorNames = {})); +exports.default = PDFOperatorNames; +//# sourceMappingURL=PDFOperatorNames.js.map \ No newline at end of file diff --git a/cjs/core/operators/PDFOperatorNames.js.map b/cjs/core/operators/PDFOperatorNames.js.map new file mode 100644 index 000000000..ac45e1c4f --- /dev/null +++ b/cjs/core/operators/PDFOperatorNames.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFOperatorNames.js","sourceRoot":"","sources":["../../../src/core/operators/PDFOperatorNames.ts"],"names":[],"mappings":";;AAAA,IAAK,gBAyFJ;AAzFD,WAAK,gBAAgB;IACnB,+BAA+B;IAC/B,2CAAuB,CAAA;IACvB,6CAAyB,CAAA;IACzB,8CAA0B,CAAA;IAC1B,8CAA0B,CAAA;IAC1B,8CAA0B,CAAA;IA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wB,CAAA;IACxB,+CAA2B,CAAA;IAC3B,sCAAkB,CAAA;IAClB,yCAAqB,CAAA;IACrB,mCAAe,CAAA;IACf,2CAAuB,CAAA;IACvB,sCAAkB,CAAA;IAClB,+CAA0B,CAAA;IAE1B,uBAAuB;IACvB,kCAAc,CAAA;IACd,kCAAc,CAAA;IAEd,kCAAkC;IAClC,oDAAgC,CAAA;IAChC,kDAA8B,CAAA;AAChC,CAAC,EAzFI,gBAAgB,KAAhB,gBAAgB,QAyFpB;AAED,kBAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/BaseParser.d.ts b/cjs/core/parser/BaseParser.d.ts new file mode 100644 index 000000000..5f7c40702 --- /dev/null +++ b/cjs/core/parser/BaseParser.d.ts @@ -0,0 +1,15 @@ +import ByteStream from "./ByteStream"; +declare class BaseParser { + protected readonly bytes: ByteStream; + protected readonly capNumbers: boolean; + constructor(bytes: ByteStream, capNumbers?: boolean); + protected parseRawInt(): number; + protected parseRawNumber(): number; + protected skipWhitespace(): void; + protected skipLine(): void; + protected skipComment(): boolean; + protected skipWhitespaceAndComments(): void; + protected matchKeyword(keyword: number[]): boolean; +} +export default BaseParser; +//# sourceMappingURL=BaseParser.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/BaseParser.d.ts.map b/cjs/core/parser/BaseParser.d.ts.map new file mode 100644 index 000000000..7d8e2674a --- /dev/null +++ b/cjs/core/parser/BaseParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"BaseParser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/BaseParser.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,qBAAmC;AASpD,cAAM,UAAU;IACd,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IACrC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;gBAE3B,KAAK,EAAE,UAAU,EAAE,UAAU,UAAQ;IAKjD,SAAS,CAAC,WAAW,IAAI,MAAM;IAoB/B,SAAS,CAAC,cAAc,IAAI,MAAM;IAsClC,SAAS,CAAC,cAAc,IAAI,IAAI;IAMhC,SAAS,CAAC,QAAQ,IAAI,IAAI;IAQ1B,SAAS,CAAC,WAAW,IAAI,OAAO;IAUhC,SAAS,CAAC,yBAAyB,IAAI,IAAI;IAK3C,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO;CAUnD;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/BaseParser.js b/cjs/core/parser/BaseParser.js new file mode 100644 index 000000000..1e5b078fa --- /dev/null +++ b/cjs/core/parser/BaseParser.js @@ -0,0 +1,110 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var Numeric_1 = require("../syntax/Numeric"); +var Whitespace_1 = require("../syntax/Whitespace"); +var utils_1 = require("../../utils"); +var Newline = CharCodes_1.default.Newline, CarriageReturn = CharCodes_1.default.CarriageReturn; +// TODO: Throw error if eof is reached before finishing object parse... +var BaseParser = /** @class */ (function () { + function BaseParser(bytes, capNumbers) { + if (capNumbers === void 0) { capNumbers = false; } + this.bytes = bytes; + this.capNumbers = capNumbers; + } + BaseParser.prototype.parseRawInt = function () { + var value = ''; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!Numeric_1.IsDigit[byte]) + break; + value += utils_1.charFromCode(this.bytes.next()); + } + var numberValue = Number(value); + if (!value || !isFinite(numberValue)) { + throw new errors_1.NumberParsingError(this.bytes.position(), value); + } + return numberValue; + }; + // TODO: Maybe handle exponential format? + // TODO: Compare performance of string concatenation to charFromCode(...bytes) + BaseParser.prototype.parseRawNumber = function () { + var value = ''; + // Parse integer-part, the leading (+ | - | . | 0-9) + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!Numeric_1.IsNumeric[byte]) + break; + value += utils_1.charFromCode(this.bytes.next()); + if (byte === CharCodes_1.default.Period) + break; + } + // Parse decimal-part, the trailing (0-9) + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (!Numeric_1.IsDigit[byte]) + break; + value += utils_1.charFromCode(this.bytes.next()); + } + var numberValue = Number(value); + if (!value || !isFinite(numberValue)) { + throw new errors_1.NumberParsingError(this.bytes.position(), value); + } + if (numberValue > Number.MAX_SAFE_INTEGER) { + if (this.capNumbers) { + var msg = "Parsed number that is too large for some PDF readers: " + value + ", using Number.MAX_SAFE_INTEGER instead."; + console.warn(msg); + return Number.MAX_SAFE_INTEGER; + } + else { + var msg = "Parsed number that is too large for some PDF readers: " + value + ", not capping."; + console.warn(msg); + } + } + return numberValue; + }; + BaseParser.prototype.skipWhitespace = function () { + while (!this.bytes.done() && Whitespace_1.IsWhitespace[this.bytes.peek()]) { + this.bytes.next(); + } + }; + BaseParser.prototype.skipLine = function () { + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (byte === Newline || byte === CarriageReturn) + return; + this.bytes.next(); + } + }; + BaseParser.prototype.skipComment = function () { + if (this.bytes.peek() !== CharCodes_1.default.Percent) + return false; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (byte === Newline || byte === CarriageReturn) + return true; + this.bytes.next(); + } + return true; + }; + BaseParser.prototype.skipWhitespaceAndComments = function () { + this.skipWhitespace(); + while (this.skipComment()) + this.skipWhitespace(); + }; + BaseParser.prototype.matchKeyword = function (keyword) { + var initialOffset = this.bytes.offset(); + for (var idx = 0, len = keyword.length; idx < len; idx++) { + if (this.bytes.done() || this.bytes.next() !== keyword[idx]) { + this.bytes.moveTo(initialOffset); + return false; + } + } + return true; + }; + return BaseParser; +}()); +exports.default = BaseParser; +//# sourceMappingURL=BaseParser.js.map \ No newline at end of file diff --git a/cjs/core/parser/BaseParser.js.map b/cjs/core/parser/BaseParser.js.map new file mode 100644 index 000000000..d63a0f9e8 --- /dev/null +++ b/cjs/core/parser/BaseParser.js.map @@ -0,0 +1 @@ +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AE;gBAC3D,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACjC,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACH,iBAAC;AAAD,CAAC,AA1GD,IA0GC;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/ByteStream.d.ts b/cjs/core/parser/ByteStream.d.ts new file mode 100644 index 000000000..ccc70fa34 --- /dev/null +++ b/cjs/core/parser/ByteStream.d.ts @@ -0,0 +1,27 @@ +import PDFRawStream from "../objects/PDFRawStream"; +declare class ByteStream { + static of: (bytes: Uint8Array) => ByteStream; + static fromPDFRawStream: (rawStream: PDFRawStream) => ByteStream; + private readonly bytes; + private readonly length; + private idx; + private line; + private column; + constructor(bytes: Uint8Array); + moveTo(offset: number): void; + next(): number; + assertNext(expected: number): number; + peek(): number; + peekAhead(steps: number): number; + peekAt(offset: number): number; + done(): boolean; + offset(): number; + slice(start: number, end: number): Uint8Array; + position(): { + line: number; + column: number; + offset: number; + }; +} +export default ByteStream; +//# sourceMappingURL=ByteStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/ByteStream.d.ts.map b/cjs/core/parser/ByteStream.d.ts.map new file mode 100644 index 000000000..f5229efd1 --- /dev/null +++ b/cjs/core/parser/ByteStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ByteStream.d.ts","sourceRoot":"","sources":["../../../src/core/parser/ByteStream.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,gCAAsC;AAKzD,cAAM,UAAU;IACd,MAAM,CAAC,EAAE,UAAW,UAAU,gBAA2B;IAEzD,MAAM,CAAC,gBAAgB,cAAe,YAAY,gBACM;IAExD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,MAAM,CAAK;gBAEP,KAAK,EAAE,UAAU;IAK7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,IAAI,MAAM;IAWd,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAOpC,IAAI,IAAI,MAAM;IAId,SAAS,CAAC,KAAK,EAAE,MAAM;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM;IAIrB,IAAI,IAAI,OAAO;IAIf,MAAM,IAAI,MAAM;IAIhB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU;IAI7C,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAG7D;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/ByteStream.js b/cjs/core/parser/ByteStream.js new file mode 100644 index 000000000..e2d90b0a8 --- /dev/null +++ b/cjs/core/parser/ByteStream.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var decode_1 = require("../streams/decode"); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +// TODO: See how line/col tracking affects performance +var ByteStream = /** @class */ (function () { + function ByteStream(bytes) { + this.idx = 0; + this.line = 0; + this.column = 0; + this.bytes = bytes; + this.length = this.bytes.length; + } + ByteStream.prototype.moveTo = function (offset) { + this.idx = offset; + }; + ByteStream.prototype.next = function () { + var byte = this.bytes[this.idx++]; + if (byte === CharCodes_1.default.Newline) { + this.line += 1; + this.column = 0; + } + else { + this.column += 1; + } + return byte; + }; + ByteStream.prototype.assertNext = function (expected) { + if (this.peek() !== expected) { + throw new errors_1.NextByteAssertionError(this.position(), expected, this.peek()); + } + return this.next(); + }; + ByteStream.prototype.peek = function () { + return this.bytes[this.idx]; + }; + ByteStream.prototype.peekAhead = function (steps) { + return this.bytes[this.idx + steps]; + }; + ByteStream.prototype.peekAt = function (offset) { + return this.bytes[offset]; + }; + ByteStream.prototype.done = function () { + return this.idx >= this.length; + }; + ByteStream.prototype.offset = function () { + return this.idx; + }; + ByteStream.prototype.slice = function (start, end) { + return this.bytes.slice(start, end); + }; + ByteStream.prototype.position = function () { + return { line: this.line, column: this.column, offset: this.idx }; + }; + ByteStream.of = function (bytes) { return new ByteStream(bytes); }; + ByteStream.fromPDFRawStream = function (rawStream) { + return ByteStream.of(decode_1.decodePDFRawStream(rawStream).decode()); + }; + return ByteStream; +}()); +exports.default = ByteStream; +//# sourceMappingURL=ByteStream.js.map \ No newline at end of file diff --git a/cjs/core/parser/ByteStream.js.map b/cjs/core/parser/ByteStream.js.map new file mode 100644 index 000000000..bf1d64e77 --- /dev/null +++ b/cjs/core/parser/ByteStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ByteStream.js","sourceRoot":"","sources":["../../../src/core/parser/ByteStream.ts"],"names":[],"mappings":";;;AAAA,oCAAyD;AAEzD,4CAA6D;AAC7D,0EAAkD;AAElD,sDAAsD;AACtD;IAaE,oBAAY,KAAiB;QAJrB,QAAG,GAAG,CAAC,CAAC;QACR,SAAI,GAAG,CAAC,CAAC;QACT,WAAM,GAAG,CAAC,CAAC;QAGjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAClC,CAAC;IAED,2BAAM,GAAN,UAAO,MAAc;QACnB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;IACpB,CAAC;IAED,yBAAI,GAAJ;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACpC,IAAI,IAAI,KAAK,mBAAS,CAAC,OAAO,EAAE;YAC9B,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;YACf,IAAI,C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AqB,CAAC;IAElD,2BAAgB,GAAG,UAAC,SAAuB;QAChD,OAAA,UAAU,CAAC,EAAE,CAAC,2BAAkB,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;IAArD,CAAqD,CAAC;IA+D1D,iBAAC;CAAA,AAnED,IAmEC;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectParser.d.ts b/cjs/core/parser/PDFObjectParser.d.ts new file mode 100644 index 000000000..1dfea6497 --- /dev/null +++ b/cjs/core/parser/PDFObjectParser.d.ts @@ -0,0 +1,30 @@ +import { Position } from "../errors"; +import PDFArray from "../objects/PDFArray"; +import PDFDict from "../objects/PDFDict"; +import PDFHexString from "../objects/PDFHexString"; +import PDFName from "../objects/PDFName"; +import PDFNumber from "../objects/PDFNumber"; +import PDFObject from "../objects/PDFObject"; +import PDFRef from "../objects/PDFRef"; +import PDFStream from "../objects/PDFStream"; +import PDFString from "../objects/PDFString"; +import BaseParser from "./BaseParser"; +import ByteStream from "./ByteStream"; +import PDFContext from "../PDFContext"; +declare class PDFObjectParser extends BaseParser { + static forBytes: (bytes: Uint8Array, context: PDFContext, capNumbers?: boolean | undefined) => PDFObjectParser; + static forByteStream: (byteStream: ByteStream, context: PDFContext, capNumbers?: boolean) => PDFObjectParser; + protected readonly context: PDFContext; + constructor(byteStream: ByteStream, context: PDFContext, capNumbers?: boolean); + parseObject(): PDFObject; + protected parseNumberOrRef(): PDFNumber | PDFRef; + protected parseHexString(): PDFHexString; + protected parseString(): PDFString; + protected parseName(): PDFName; + protected parseArray(): PDFArray; + protected parseDict(): PDFDict; + protected parseDictOrStream(): PDFDict | PDFStream; + protected findEndOfStreamFallback(startPos: Position): number; +} +export default PDFObjectParser; +//# sourceMappingURL=PDFObjectParser.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectParser.d.ts.map b/cjs/core/parser/PDFObjectParser.d.ts.map new file mode 100644 index 000000000..257648c03 --- /dev/null +++ b/cjs/core/parser/PDFObjectParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectParser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/PDFObjectParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EAET,kBAAwB;AACzB,OAAO,QAAQ,4BAAkC;AAEjD,OAAO,OAAoB,2BAAiC;AAC5D,OAAO,YAAY,gCAAsC;AACzD,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AAEnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,UAAU,qBAAmC;AACpD,OAAO,UAAU,qBAAmC;AACpD,OAAO,UAAU,sBAA4B;AAY7C,cAAM,eAAgB,SAAQ,UAAU;IACtC,MAAM,CAAC,QAAQ,UACN,UAAU,WACR,UAAU,uDAE+C;IAEpE,MAAM,CAAC,aAAa,eACN,UAAU,WACb,UAAU,2CAEqC;IAE1D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;gBAE3B,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,UAAQ;IAM3E,WAAW,IAAI,SAAS;IAwBxB,SAAS,CAAC,gBAAgB,IAAI,SAAS,GAAG,MAAM;IAmBhD,SAAS,CAAC,cAAc,IAAI,YAAY;IAYxC,SAAS,CAAC,WAAW,IAAI,SAAS;IAkClC,SAAS,CAAC,SAAS,IAAI,OAAO;IAc9B,SAAS,CAAC,UAAU,IAAI,QAAQ;IAchC,SAAS,CAAC,SAAS,IAAI,OAAO;IAmC9B,SAAS,CAAC,iBAAiB,IAAI,OAAO,GAAG,SAAS;IAsClD,SAAS,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ;CA4BrD;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectParser.js b/cjs/core/parser/PDFObjectParser.js new file mode 100644 index 000000000..303abb97a --- /dev/null +++ b/cjs/core/parser/PDFObjectParser.js @@ -0,0 +1,233 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFBool_1 = tslib_1.__importDefault(require("../objects/PDFBool")); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNull_1 = tslib_1.__importDefault(require("../objects/PDFNull")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFRawStream_1 = tslib_1.__importDefault(require("../objects/PDFRawStream")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString")); +var BaseParser_1 = tslib_1.__importDefault(require("./BaseParser")); +var ByteStream_1 = tslib_1.__importDefault(require("./ByteStream")); +var PDFCatalog_1 = tslib_1.__importDefault(require("../structures/PDFCatalog")); +var PDFPageLeaf_1 = tslib_1.__importDefault(require("../structures/PDFPageLeaf")); +var PDFPageTree_1 = tslib_1.__importDefault(require("../structures/PDFPageTree")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var Delimiters_1 = require("../syntax/Delimiters"); +var Keywords_1 = require("../syntax/Keywords"); +var Numeric_1 = require("../syntax/Numeric"); +var Whitespace_1 = require("../syntax/Whitespace"); +var utils_1 = require("../../utils"); +// TODO: Throw error if eof is reached before finishing object parse... +var PDFObjectParser = /** @class */ (function (_super) { + tslib_1.__extends(PDFObjectParser, _super); + function PDFObjectParser(byteStream, context, capNumbers) { + if (capNumbers === void 0) { capNumbers = false; } + var _this = _super.call(this, byteStream, capNumbers) || this; + _this.context = context; + return _this; + } + // TODO: Is it possible to reduce duplicate parsing for ref lookaheads? + PDFObjectParser.prototype.parseObject = function () { + this.skipWhitespaceAndComments(); + if (this.matchKeyword(Keywords_1.Keywords.true)) + return PDFBool_1.default.True; + if (this.matchKeyword(Keywords_1.Keywords.false)) + return PDFBool_1.default.False; + if (this.matchKeyword(Keywords_1.Keywords.null)) + return PDFNull_1.default; + var byte = this.bytes.peek(); + if (byte === CharCodes_1.default.LessThan && + this.bytes.peekAhead(1) === CharCodes_1.default.LessThan) { + return this.parseDictOrStream(); + } + if (byte === CharCodes_1.default.LessThan) + return this.parseHexString(); + if (byte === CharCodes_1.default.LeftParen) + return this.parseString(); + if (byte === CharCodes_1.default.ForwardSlash) + return this.parseName(); + if (byte === CharCodes_1.default.LeftSquareBracket) + return this.parseArray(); + if (Numeric_1.IsNumeric[byte]) + return this.parseNumberOrRef(); + throw new errors_1.PDFObjectParsingError(this.bytes.position(), byte); + }; + PDFObjectParser.prototype.parseNumberOrRef = function () { + var firstNum = this.parseRawNumber(); + this.skipWhitespaceAndComments(); + var lookaheadStart = this.bytes.offset(); + if (Numeric_1.IsDigit[this.bytes.peek()]) { + var secondNum = this.parseRawNumber(); + this.skipWhitespaceAndComments(); + if (this.bytes.peek() === CharCodes_1.default.R) { + this.bytes.assertNext(CharCodes_1.default.R); + return PDFRef_1.default.of(firstNum, secondNum); + } + } + this.bytes.moveTo(lookaheadStart); + return PDFNumber_1.default.of(firstNum); + }; + // TODO: Maybe update PDFHexString.of() logic to remove whitespace and validate input? + PDFObjectParser.prototype.parseHexString = function () { + var value = ''; + this.bytes.assertNext(CharCodes_1.default.LessThan); + while (!this.bytes.done() && this.bytes.peek() !== CharCodes_1.default.GreaterThan) { + value += utils_1.charFromCode(this.bytes.next()); + } + this.bytes.assertNext(CharCodes_1.default.GreaterThan); + return PDFHexString_1.default.of(value); + }; + PDFObjectParser.prototype.parseString = function () { + var nestingLvl = 0; + var isEscaped = false; + var value = ''; + while (!this.bytes.done()) { + var byte = this.bytes.next(); + value += utils_1.charFromCode(byte); + // Check for unescaped parenthesis + if (!isEscaped) { + if (byte === CharCodes_1.default.LeftParen) + nestingLvl += 1; + if (byte === CharCodes_1.default.RightParen) + nestingLvl -= 1; + } + // Track whether current character is being escaped or not + if (byte === CharCodes_1.default.BackSlash) { + isEscaped = !isEscaped; + } + else if (isEscaped) { + isEscaped = false; + } + // Once (if) the unescaped parenthesis balance out, return their contents + if (nestingLvl === 0) { + // Remove the outer parens so they aren't part of the contents + return PDFString_1.default.of(value.substring(1, value.length - 1)); + } + } + throw new errors_1.UnbalancedParenthesisError(this.bytes.position()); + }; + // TODO: Compare performance of string concatenation to charFromCode(...bytes) + // TODO: Maybe preallocate small Uint8Array if can use charFromCode? + PDFObjectParser.prototype.parseName = function () { + this.bytes.assertNext(CharCodes_1.default.ForwardSlash); + var name = ''; + while (!this.bytes.done()) { + var byte = this.bytes.peek(); + if (Whitespace_1.IsWhitespace[byte] || Delimiters_1.IsDelimiter[byte]) + break; + name += utils_1.charFromCode(byte); + this.bytes.next(); + } + return PDFName_1.default.of(name); + }; + PDFObjectParser.prototype.parseArray = function () { + this.bytes.assertNext(CharCodes_1.default.LeftSquareBracket); + this.skipWhitespaceAndComments(); + var pdfArray = PDFArray_1.default.withContext(this.context); + while (this.bytes.peek() !== CharCodes_1.default.RightSquareBracket) { + var element = this.parseObject(); + pdfArray.push(element); + this.skipWhitespaceAndComments(); + } + this.bytes.assertNext(CharCodes_1.default.RightSquareBracket); + return pdfArray; + }; + PDFObjectParser.prototype.parseDict = function () { + this.bytes.assertNext(CharCodes_1.default.LessThan); + this.bytes.assertNext(CharCodes_1.default.LessThan); + this.skipWhitespaceAndComments(); + var dict = new Map(); + while (!this.bytes.done() && + this.bytes.peek() !== CharCodes_1.default.GreaterThan && + this.bytes.peekAhead(1) !== CharCodes_1.default.GreaterThan) { + var key = this.parseName(); + var value = this.parseObject(); + dict.set(key, value); + this.skipWhitespaceAndComments(); + } + this.skipWhitespaceAndComments(); + this.bytes.assertNext(CharCodes_1.default.GreaterThan); + this.bytes.assertNext(CharCodes_1.default.GreaterThan); + var Type = dict.get(PDFName_1.default.of('Type')); + if (Type === PDFName_1.default.of('Catalog')) { + return PDFCatalog_1.default.fromMapWithContext(dict, this.context); + } + else if (Type === PDFName_1.default.of('Pages')) { + return PDFPageTree_1.default.fromMapWithContext(dict, this.context); + } + else if (Type === PDFName_1.default.of('Page')) { + return PDFPageLeaf_1.default.fromMapWithContext(dict, this.context); + } + else { + return PDFDict_1.default.fromMapWithContext(dict, this.context); + } + }; + PDFObjectParser.prototype.parseDictOrStream = function () { + var startPos = this.bytes.position(); + var dict = this.parseDict(); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.streamEOF1) && + !this.matchKeyword(Keywords_1.Keywords.streamEOF2) && + !this.matchKeyword(Keywords_1.Keywords.streamEOF3) && + !this.matchKeyword(Keywords_1.Keywords.streamEOF4) && + !this.matchKeyword(Keywords_1.Keywords.stream)) { + return dict; + } + var start = this.bytes.offset(); + var end; + var Length = dict.get(PDFName_1.default.of('Length')); + if (Length instanceof PDFNumber_1.default) { + end = start + Length.asNumber(); + this.bytes.moveTo(end); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.endstream)) { + this.bytes.moveTo(start); + end = this.findEndOfStreamFallback(startPos); + } + } + else { + end = this.findEndOfStreamFallback(startPos); + } + var contents = this.bytes.slice(start, end); + return PDFRawStream_1.default.of(dict, contents); + }; + PDFObjectParser.prototype.findEndOfStreamFallback = function (startPos) { + // Move to end of stream, while handling nested streams + var nestingLvl = 1; + var end = this.bytes.offset(); + while (!this.bytes.done()) { + end = this.bytes.offset(); + if (this.matchKeyword(Keywords_1.Keywords.stream)) { + nestingLvl += 1; + } + else if (this.matchKeyword(Keywords_1.Keywords.EOF1endstream) || + this.matchKeyword(Keywords_1.Keywords.EOF2endstream) || + this.matchKeyword(Keywords_1.Keywords.EOF3endstream) || + this.matchKeyword(Keywords_1.Keywords.endstream)) { + nestingLvl -= 1; + } + else { + this.bytes.next(); + } + if (nestingLvl === 0) + break; + } + if (nestingLvl !== 0) + throw new errors_1.PDFStreamParsingError(startPos); + return end; + }; + PDFObjectParser.forBytes = function (bytes, context, capNumbers) { return new PDFObjectParser(ByteStream_1.default.of(bytes), context, capNumbers); }; + PDFObjectParser.forByteStream = function (byteStream, context, capNumbers) { + if (capNumbers === void 0) { capNumbers = false; } + return new PDFObjectParser(byteStream, context, capNumbers); + }; + return PDFObjectParser; +}(BaseParser_1.default)); +exports.default = PDFObjectParser; +//# sourceMappingURL=PDFObjectParser.js.map \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectParser.js.map b/cjs/core/parser/PDFObjectParser.js.map new file mode 100644 index 000000000..a714a4a10 --- /dev/null +++ b/cjs/core/parser/PDFObjectParser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectParser.js","sourceRoot":"","sources":["../../../src/core/parser/PDFObjectParser.ts"],"names":[],"mappings":";;;AAAA,oCAKyB;AACzB,yEAAiD;AACjD,uEAA+C;AAC/C,uEAA4D;AAC5D,iFAAyD;AACzD,uEAA+C;AAC/C,uEAA+C;AAC/C,2EAAmD;AAEnD,iFAAyD;AACzD,qEAA6C;AAE7C,2EAAmD;AACnD,oEAAoD;AACpD,oEAAoD;AAEpD,gFAAwD;AACxD,kFAA0D;AAC1D,kFAA0D;AAC1D,0EAAkD;AAClD,mDAAyD;AACzD,+CAAoD;AACpD,6CAA6D;AAC7D,mDAA0D;AAC1D,qCAAyC;AAEzC,uEAAuE;AACvE;IAA8B,2CAAU;IAetC,yBAAY,UAAsB,EAAE,OAAmB,EAAE,UAAkB;QAAlB,2BAAA,EAAA,kBAAkB;QAA3E,YACE,kBAAM,UAAU,EAAE,UAAU,CAAC,SAE9B;QADC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IACzB,CAAC;IAED,uEAAuE;IACvE,qCAAW,GAAX;QACE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAEjC,IAAI,IAAI,CAAC,YAAY,CAA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ectStreamParser.d.ts new file mode 100644 index 000000000..7c93fa1c3 --- /dev/null +++ b/cjs/core/parser/PDFObjectStreamParser.d.ts @@ -0,0 +1,14 @@ +import PDFRawStream from "../objects/PDFRawStream"; +import PDFObjectParser from "./PDFObjectParser"; +declare class PDFObjectStreamParser extends PDFObjectParser { + static forStream: (rawStream: PDFRawStream, shouldWaitForTick?: (() => boolean) | undefined) => PDFObjectStreamParser; + private alreadyParsed; + private readonly shouldWaitForTick; + private readonly firstOffset; + private readonly objectCount; + constructor(rawStream: PDFRawStream, shouldWaitForTick?: () => boolean); + parseIntoContext(): Promise; + private parseOffsetsAndObjectNumbers; +} +export default PDFObjectStreamParser; +//# sourceMappingURL=PDFObjectStreamParser.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectStreamParser.d.ts.map b/cjs/core/parser/PDFObjectStreamParser.d.ts.map new file mode 100644 index 000000000..ec1c12a15 --- /dev/null +++ b/cjs/core/parser/PDFObjectStreamParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectStreamParser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/PDFObjectStreamParser.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,gCAAsC;AAGzD,OAAO,eAAe,0BAAwC;AAG9D,cAAM,qBAAsB,SAAQ,eAAe;IACjD,MAAM,CAAC,SAAS,cACH,YAAY,6BACG,OAAO,wCAC0B;IAE7D,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgB;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,SAAS,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,MAAM,OAAO;IAWhE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBvC,OAAO,CAAC,4BAA4B;CAgBrC;AAED,eAAe,qBAAqB,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectStreamParser.js b/cjs/core/parser/PDFObjectStreamParser.js new file mode 100644 index 000000000..a6b823c64 --- /dev/null +++ b/cjs/core/parser/PDFObjectStreamParser.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var ByteStream_1 = tslib_1.__importDefault(require("./ByteStream")); +var PDFObjectParser_1 = tslib_1.__importDefault(require("./PDFObjectParser")); +var utils_1 = require("../../utils"); +var PDFObjectStreamParser = /** @class */ (function (_super) { + tslib_1.__extends(PDFObjectStreamParser, _super); + function PDFObjectStreamParser(rawStream, shouldWaitForTick) { + var _this = _super.call(this, ByteStream_1.default.fromPDFRawStream(rawStream), rawStream.dict.context) || this; + var dict = rawStream.dict; + _this.alreadyParsed = false; + _this.shouldWaitForTick = shouldWaitForTick || (function () { return false; }); + _this.firstOffset = dict.lookup(PDFName_1.default.of('First'), PDFNumber_1.default).asNumber(); + _this.objectCount = dict.lookup(PDFName_1.default.of('N'), PDFNumber_1.default).asNumber(); + return _this; + } + PDFObjectStreamParser.prototype.parseIntoContext = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var offsetsAndObjectNumbers, idx, len, _a, objectNumber, offset, object, ref; + return tslib_1.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (this.alreadyParsed) { + throw new errors_1.ReparseError('PDFObjectStreamParser', 'parseIntoContext'); + } + this.alreadyParsed = true; + offsetsAndObjectNumbers = this.parseOffsetsAndObjectNumbers(); + idx = 0, len = offsetsAndObjectNumbers.length; + _b.label = 1; + case 1: + if (!(idx < len)) return [3 /*break*/, 4]; + _a = offsetsAndObjectNumbers[idx], objectNumber = _a.objectNumber, offset = _a.offset; + this.bytes.moveTo(this.firstOffset + offset); + object = this.parseObject(); + ref = PDFRef_1.default.of(objectNumber, 0); + this.context.assign(ref, object); + if (!this.shouldWaitForTick()) return [3 /*break*/, 3]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 2: + _b.sent(); + _b.label = 3; + case 3: + idx++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + }); + }; + PDFObjectStreamParser.prototype.parseOffsetsAndObjectNumbers = function () { + var offsetsAndObjectNumbers = []; + for (var idx = 0, len = this.objectCount; idx < len; idx++) { + this.skipWhitespaceAndComments(); + var objectNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var offset = this.parseRawInt(); + offsetsAndObjectNumbers.push({ objectNumber: objectNumber, offset: offset }); + } + return offsetsAndObjectNumbers; + }; + PDFObjectStreamParser.forStream = function (rawStream, shouldWaitForTick) { return new PDFObjectStreamParser(rawStream, shouldWaitForTick); }; + return PDFObjectStreamParser; +}(PDFObjectParser_1.default)); +exports.default = PDFObjectStreamParser; +//# sourceMappingURL=PDFObjectStreamParser.js.map \ No newline at end of file diff --git a/cjs/core/parser/PDFObjectStreamParser.js.map b/cjs/core/parser/PDFObjectStreamParser.js.map new file mode 100644 index 000000000..ffed6a9d4 --- /dev/null +++ b/cjs/core/parser/PDFObjectStreamParser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectStreamParser.js","sourceRoot":"","sources":["../../../src/core/parser/PDFObjectStreamParser.ts"],"names":[],"mappings":";;;AAAA,oCAA+C;AAC/C,uEAA+C;AAC/C,2EAAmD;AAEnD,qEAA6C;AAC7C,oEAAoD;AACpD,8EAA8D;AAC9D,qCAAwC;AAExC;IAAoC,iDAAe;IAWjD,+BAAY,SAAuB,EAAE,iBAAiC;QAAtE,YACE,kBAAM,oBAAU,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAQtE;QANS,IAAA,IAAI,GAAK,SAAS,KAAd,CAAe;QAE3B,KAAI,CAAC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ANe,GAAG,EAAE,CAAA;;;;;;KAQzE;IAEO,4DAA4B,GAApC;QAIE,IAAM,uBAAuB,GAAG,EAAE,CAAC;QACnC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC1D,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAExC,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAElC,uBAAuB,CAAC,IAAI,CAAC,EAAE,YAAY,cAAA,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;SACxD;QACD,OAAO,uBAAuB,CAAC;IACjC,CAAC;IArDM,+BAAS,GAAG,UACjB,SAAuB,EACvB,iBAAiC,IAC9B,OAAA,IAAI,qBAAqB,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAvD,CAAuD,CAAC;IAmD/D,4BAAC;CAAA,AAvDD,CAAoC,yBAAe,GAuDlD;AAED,kBAAe,qBAAqB,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFParser.d.ts b/cjs/core/parser/PDFParser.d.ts new file mode 100644 index 000000000..1f50a0aa5 --- /dev/null +++ b/cjs/core/parser/PDFParser.d.ts @@ -0,0 +1,46 @@ +import PDFObjectParser from "./PDFObjectParser"; +import PDFContext from "../PDFContext"; +declare class PDFParser extends PDFObjectParser { + static forBytesWithOptions: (pdfBytes: Uint8Array, objectsPerTick?: number | undefined, throwOnInvalidObject?: boolean | undefined, capNumbers?: boolean | undefined) => PDFParser; + private readonly objectsPerTick; + private readonly throwOnInvalidObject; + private alreadyParsed; + private parsedObjects; + constructor(pdfBytes: Uint8Array, objectsPerTick?: number, throwOnInvalidObject?: boolean, capNumbers?: boolean); + parseDocument(): Promise; + private maybeRecoverRoot; + private parseHeader; + private parseIndirectObjectHeader; + private matchIndirectObjectHeader; + private shouldWaitForTick; + private parseIndirectObject; + private tryToParseInvalidIndirectObject; + private parseIndirectObjects; + private maybeParseCrossRefSection; + private maybeParseTrailerDict; + private maybeParseTrailer; + private parseDocumentSection; + /** + * This operation is not necessary for valid PDF files. But some invalid PDFs + * contain jibberish in between indirect objects. This method is designed to + * skip past that jibberish, should it exist, until it reaches the next + * indirect object header, an xref table section, or the file trailer. + */ + private skipJibberish; + /** + * Skips the binary comment following a PDF header. The specification + * defines this binary comment (section 7.5.2 File Header) as a sequence of 4 + * or more bytes that are 128 or greater, and which are preceded by a "%". + * + * This would imply that to strip out this binary comment, we could check for + * a sequence of bytes starting with "%", and remove all subsequent bytes that + * are 128 or greater. This works for many documents that properly comply with + * the spec. But in the wild, there are PDFs that omit the leading "%", and + * include bytes that are less than 128 (e.g. 0 or 1). So in order to parse + * these headers correctly, we just throw out all bytes leading up to the + * first indirect object header. + */ + private skipBinaryHeaderComment; +} +export default PDFParser; +//# sourceMappingURL=PDFParser.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/PDFParser.d.ts.map b/cjs/core/parser/PDFParser.d.ts.map new file mode 100644 index 000000000..505d8d4af --- /dev/null +++ b/cjs/core/parser/PDFParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFParser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/PDFParser.ts"],"names":[],"mappings":"AAiBA,OAAO,eAAe,0BAAwC;AAG9D,OAAO,UAAU,sBAA4B;AAM7C,cAAM,SAAU,SAAQ,eAAe;IACrC,MAAM,CAAC,mBAAmB,aACd,UAAU,kIAKsD;IAE5E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAU;IAC/C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAK;gBAGxB,QAAQ,EAAE,UAAU,EACpB,cAAc,SAAW,EACzB,oBAAoB,UAAQ,EAC5B,UAAU,UAAQ;IAOd,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IA4B1C,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,iBAAiB,CAGvB;YAEY,mBAAmB;IAmCjC,OAAO,CAAC,+BAA+B;YAiCzB,oBAAoB;IAsBlC,OAAO,CAAC,yBAAyB;IAkCjC,OAAO,CAAC,qBAAqB;IAgB7B,OAAO,CAAC,iBAAiB;YAgBX,oBAAoB;IAUlC;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,uBAAuB;CAWhC;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFParser.js b/cjs/core/parser/PDFParser.js new file mode 100644 index 000000000..46f01e42a --- /dev/null +++ b/cjs/core/parser/PDFParser.js @@ -0,0 +1,356 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFCrossRefSection_1 = tslib_1.__importDefault(require("../document/PDFCrossRefSection")); +var PDFHeader_1 = tslib_1.__importDefault(require("../document/PDFHeader")); +var PDFTrailer_1 = tslib_1.__importDefault(require("../document/PDFTrailer")); +var errors_1 = require("../errors"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFInvalidObject_1 = tslib_1.__importDefault(require("../objects/PDFInvalidObject")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFRawStream_1 = tslib_1.__importDefault(require("../objects/PDFRawStream")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var ByteStream_1 = tslib_1.__importDefault(require("./ByteStream")); +var PDFObjectParser_1 = tslib_1.__importDefault(require("./PDFObjectParser")); +var PDFObjectStreamParser_1 = tslib_1.__importDefault(require("./PDFObjectStreamParser")); +var PDFXRefStreamParser_1 = tslib_1.__importDefault(require("./PDFXRefStreamParser")); +var PDFContext_1 = tslib_1.__importDefault(require("../PDFContext")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var Keywords_1 = require("../syntax/Keywords"); +var Numeric_1 = require("../syntax/Numeric"); +var utils_1 = require("../../utils"); +var PDFParser = /** @class */ (function (_super) { + tslib_1.__extends(PDFParser, _super); + function PDFParser(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) { + if (objectsPerTick === void 0) { objectsPerTick = Infinity; } + if (throwOnInvalidObject === void 0) { throwOnInvalidObject = false; } + if (capNumbers === void 0) { capNumbers = false; } + var _this = _super.call(this, ByteStream_1.default.of(pdfBytes), PDFContext_1.default.create(), capNumbers) || this; + _this.alreadyParsed = false; + _this.parsedObjects = 0; + _this.shouldWaitForTick = function () { + _this.parsedObjects += 1; + return _this.parsedObjects % _this.objectsPerTick === 0; + }; + _this.objectsPerTick = objectsPerTick; + _this.throwOnInvalidObject = throwOnInvalidObject; + return _this; + } + PDFParser.prototype.parseDocument = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var prevOffset, offset; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (this.alreadyParsed) { + throw new errors_1.ReparseError('PDFParser', 'parseDocument'); + } + this.alreadyParsed = true; + this.context.header = this.parseHeader(); + _a.label = 1; + case 1: + if (!!this.bytes.done()) return [3 /*break*/, 3]; + return [4 /*yield*/, this.parseDocumentSection()]; + case 2: + _a.sent(); + offset = this.bytes.offset(); + if (offset === prevOffset) { + throw new errors_1.StalledParserError(this.bytes.position()); + } + prevOffset = offset; + return [3 /*break*/, 1]; + case 3: + this.maybeRecoverRoot(); + if (this.context.lookup(PDFRef_1.default.of(0))) { + console.warn('Removing parsed object: 0 0 R'); + this.context.delete(PDFRef_1.default.of(0)); + } + return [2 /*return*/, this.context]; + } + }); + }); + }; + PDFParser.prototype.maybeRecoverRoot = function () { + var isValidCatalog = function (obj) { + return obj instanceof PDFDict_1.default && + obj.lookup(PDFName_1.default.of('Type')) === PDFName_1.default.of('Catalog'); + }; + var catalog = this.context.lookup(this.context.trailerInfo.Root); + if (!isValidCatalog(catalog)) { + var indirectObjects = this.context.enumerateIndirectObjects(); + for (var idx = 0, len = indirectObjects.length; idx < len; idx++) { + var _a = indirectObjects[idx], ref = _a[0], object = _a[1]; + if (isValidCatalog(object)) { + this.context.trailerInfo.Root = ref; + } + } + } + }; + PDFParser.prototype.parseHeader = function () { + while (!this.bytes.done()) { + if (this.matchKeyword(Keywords_1.Keywords.header)) { + var major = this.parseRawInt(); + this.bytes.assertNext(CharCodes_1.default.Period); + var minor = this.parseRawInt(); + var header = PDFHeader_1.default.forVersion(major, minor); + this.skipBinaryHeaderComment(); + return header; + } + this.bytes.next(); + } + throw new errors_1.MissingPDFHeaderError(this.bytes.position()); + }; + PDFParser.prototype.parseIndirectObjectHeader = function () { + this.skipWhitespaceAndComments(); + var objectNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var generationNumber = this.parseRawInt(); + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.obj)) { + throw new errors_1.MissingKeywordError(this.bytes.position(), Keywords_1.Keywords.obj); + } + return PDFRef_1.default.of(objectNumber, generationNumber); + }; + PDFParser.prototype.matchIndirectObjectHeader = function () { + var initialOffset = this.bytes.offset(); + try { + this.parseIndirectObjectHeader(); + return true; + } + catch (e) { + this.bytes.moveTo(initialOffset); + return false; + } + }; + PDFParser.prototype.parseIndirectObject = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var ref, object; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + ref = this.parseIndirectObjectHeader(); + this.skipWhitespaceAndComments(); + object = this.parseObject(); + this.skipWhitespaceAndComments(); + // if (!this.matchKeyword(Keywords.endobj)) { + // throw new MissingKeywordError(this.bytes.position(), Keywords.endobj); + // } + // TODO: Log a warning if this fails... + this.matchKeyword(Keywords_1.Keywords.endobj); + if (!(object instanceof PDFRawStream_1.default && + object.dict.lookup(PDFName_1.default.of('Type')) === PDFName_1.default.of('ObjStm'))) return [3 /*break*/, 2]; + return [4 /*yield*/, PDFObjectStreamParser_1.default.forStream(object, this.shouldWaitForTick).parseIntoContext()]; + case 1: + _a.sent(); + return [3 /*break*/, 3]; + case 2: + if (object instanceof PDFRawStream_1.default && + object.dict.lookup(PDFName_1.default.of('Type')) === PDFName_1.default.of('XRef')) { + PDFXRefStreamParser_1.default.forStream(object).parseIntoContext(); + } + else { + this.context.assign(ref, object); + } + _a.label = 3; + case 3: return [2 /*return*/, ref]; + } + }); + }); + }; + // TODO: Improve and clean this up + PDFParser.prototype.tryToParseInvalidIndirectObject = function () { + var startPos = this.bytes.position(); + var msg = "Trying to parse invalid object: " + JSON.stringify(startPos) + ")"; + if (this.throwOnInvalidObject) + throw new Error(msg); + console.warn(msg); + var ref = this.parseIndirectObjectHeader(); + console.warn("Invalid object ref: " + ref); + this.skipWhitespaceAndComments(); + var start = this.bytes.offset(); + var failed = true; + while (!this.bytes.done()) { + if (this.matchKeyword(Keywords_1.Keywords.endobj)) { + failed = false; + } + if (!failed) + break; + this.bytes.next(); + } + if (failed) + throw new errors_1.PDFInvalidObjectParsingError(startPos); + var end = this.bytes.offset() - Keywords_1.Keywords.endobj.length; + var object = PDFInvalidObject_1.default.of(this.bytes.slice(start, end)); + this.context.assign(ref, object); + return ref; + }; + PDFParser.prototype.parseIndirectObjects = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var initialOffset, e_1; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + this.skipWhitespaceAndComments(); + _a.label = 1; + case 1: + if (!(!this.bytes.done() && Numeric_1.IsDigit[this.bytes.peek()])) return [3 /*break*/, 8]; + initialOffset = this.bytes.offset(); + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [4 /*yield*/, this.parseIndirectObject()]; + case 3: + _a.sent(); + return [3 /*break*/, 5]; + case 4: + e_1 = _a.sent(); + // TODO: Add tracing/logging mechanism to track when this happens! + this.bytes.moveTo(initialOffset); + this.tryToParseInvalidIndirectObject(); + return [3 /*break*/, 5]; + case 5: + this.skipWhitespaceAndComments(); + // TODO: Can this be done only when needed, to avoid harming performance? + this.skipJibberish(); + if (!this.shouldWaitForTick()) return [3 /*break*/, 7]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 6: + _a.sent(); + _a.label = 7; + case 7: return [3 /*break*/, 1]; + case 8: return [2 /*return*/]; + } + }); + }); + }; + PDFParser.prototype.maybeParseCrossRefSection = function () { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.xref)) + return; + this.skipWhitespaceAndComments(); + var objectNumber = -1; + var xref = PDFCrossRefSection_1.default.createEmpty(); + while (!this.bytes.done() && Numeric_1.IsDigit[this.bytes.peek()]) { + var firstInt = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var secondInt = this.parseRawInt(); + this.skipWhitespaceAndComments(); + var byte = this.bytes.peek(); + if (byte === CharCodes_1.default.n || byte === CharCodes_1.default.f) { + var ref = PDFRef_1.default.of(objectNumber, secondInt); + if (this.bytes.next() === CharCodes_1.default.n) { + xref.addEntry(ref, firstInt); + } + else { + // this.context.delete(ref); + xref.addDeletedEntry(ref, firstInt); + } + objectNumber += 1; + } + else { + objectNumber = firstInt; + } + this.skipWhitespaceAndComments(); + } + return xref; + }; + PDFParser.prototype.maybeParseTrailerDict = function () { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.trailer)) + return; + this.skipWhitespaceAndComments(); + var dict = this.parseDict(); + var context = this.context; + context.trailerInfo = { + Root: dict.get(PDFName_1.default.of('Root')) || context.trailerInfo.Root, + Encrypt: dict.get(PDFName_1.default.of('Encrypt')) || context.trailerInfo.Encrypt, + Info: dict.get(PDFName_1.default.of('Info')) || context.trailerInfo.Info, + ID: dict.get(PDFName_1.default.of('ID')) || context.trailerInfo.ID, + }; + }; + PDFParser.prototype.maybeParseTrailer = function () { + this.skipWhitespaceAndComments(); + if (!this.matchKeyword(Keywords_1.Keywords.startxref)) + return; + this.skipWhitespaceAndComments(); + var offset = this.parseRawInt(); + this.skipWhitespace(); + this.matchKeyword(Keywords_1.Keywords.eof); + this.skipWhitespaceAndComments(); + this.matchKeyword(Keywords_1.Keywords.eof); + this.skipWhitespaceAndComments(); + return PDFTrailer_1.default.forLastCrossRefSectionOffset(offset); + }; + PDFParser.prototype.parseDocumentSection = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.parseIndirectObjects()]; + case 1: + _a.sent(); + this.maybeParseCrossRefSection(); + this.maybeParseTrailerDict(); + this.maybeParseTrailer(); + // TODO: Can this be done only when needed, to avoid harming performance? + this.skipJibberish(); + return [2 /*return*/]; + } + }); + }); + }; + /** + * This operation is not necessary for valid PDF files. But some invalid PDFs + * contain jibberish in between indirect objects. This method is designed to + * skip past that jibberish, should it exist, until it reaches the next + * indirect object header, an xref table section, or the file trailer. + */ + PDFParser.prototype.skipJibberish = function () { + this.skipWhitespaceAndComments(); + while (!this.bytes.done()) { + var initialOffset = this.bytes.offset(); + var byte = this.bytes.peek(); + var isAlphaNumeric = byte >= CharCodes_1.default.Space && byte <= CharCodes_1.default.Tilde; + if (isAlphaNumeric) { + if (this.matchKeyword(Keywords_1.Keywords.xref) || + this.matchKeyword(Keywords_1.Keywords.trailer) || + this.matchKeyword(Keywords_1.Keywords.startxref) || + this.matchIndirectObjectHeader()) { + this.bytes.moveTo(initialOffset); + break; + } + } + this.bytes.next(); + } + }; + /** + * Skips the binary comment following a PDF header. The specification + * defines this binary comment (section 7.5.2 File Header) as a sequence of 4 + * or more bytes that are 128 or greater, and which are preceded by a "%". + * + * This would imply that to strip out this binary comment, we could check for + * a sequence of bytes starting with "%", and remove all subsequent bytes that + * are 128 or greater. This works for many documents that properly comply with + * the spec. But in the wild, there are PDFs that omit the leading "%", and + * include bytes that are less than 128 (e.g. 0 or 1). So in order to parse + * these headers correctly, we just throw out all bytes leading up to the + * first indirect object header. + */ + PDFParser.prototype.skipBinaryHeaderComment = function () { + this.skipWhitespaceAndComments(); + try { + var initialOffset = this.bytes.offset(); + this.parseIndirectObjectHeader(); + this.bytes.moveTo(initialOffset); + } + catch (e) { + this.bytes.next(); + this.skipWhitespaceAndComments(); + } + }; + PDFParser.forBytesWithOptions = function (pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) { + return new PDFParser(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers); + }; + return PDFParser; +}(PDFObjectParser_1.default)); +exports.default = PDFParser; +//# sourceMappingURL=PDFParser.js.map \ No newline at end of file diff --git a/cjs/core/parser/PDFParser.js.map b/cjs/core/parser/PDFParser.js.map new file mode 100644 index 000000000..3b61028d4 --- /dev/null +++ b/cjs/core/parser/PDFParser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFParser.js","sourceRoot":"","sources":["../../../src/core/parser/PDFParser.ts"],"names":[],"mappings":";;;AAAA,8FAAsE;AACtE,4EAAoD;AACpD,8EAAsD;AACtD,oCAMyB;AACzB,uEAA+C;AAC/C,yFAAiE;AACjE,uEAA+C;AAE/C,iFAAyD;AACzD,qEAA6C;AAC7C,oEAAoD;AACpD,8EAA8D;AAC9D,0FAA0E;AAC1E,sFAAsE;AACtE,qEAA6C;AAC7C,0EAAkD;AAClD,+CAAoD;AACpD,6CAAkD;AAClD,qCAAwC;AAExC;IAAwB,qCAAe;IAcrC,mBACE,QAAoB,EACpB,cAAyB,EACzB,oBAA4B,EAC5B,UAAkB;QAFlB,+BAAA,EAAA,yBAAyB;QACzB,qCAAA,EAAA,4BAA4B;QAC5B,2BAAA,EAAA,kBAAkB;QAJpB,YAME,kBAAM,oBAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,oBAAU,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,SAGhE;QAZO,mBAAa,GAAG,KAAK,CAAC;QACtB,m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AAyB,EAAE,EAChC;oBACA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACjC,MAAM;iBACP;aACF;YACD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SACnB;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,2CAAuB,GAA/B;QACE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI;YACF,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1C,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;SAClC;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,CAAC,yBAAyB,EAAE,CAAC;SAClC;IACH,CAAC;IA7UM,6BAAmB,GAAG,UAC3B,QAAoB,EACpB,cAAuB,EACvB,oBAA8B,EAC9B,UAAoB;QAEpB,OAAA,IAAI,SAAS,CAAC,QAAQ,EAAE,cAAc,EAAE,oBAAoB,EAAE,UAAU,CAAC;IAAzE,CAAyE,CAAC;IAwU9E,gBAAC;CAAA,AA/UD,CAAwB,yBAAe,GA+UtC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFXRefStreamParser.d.ts b/cjs/core/parser/PDFXRefStreamParser.d.ts new file mode 100644 index 000000000..adbeeff83 --- /dev/null +++ b/cjs/core/parser/PDFXRefStreamParser.d.ts @@ -0,0 +1,22 @@ +import PDFRawStream from "../objects/PDFRawStream"; +import PDFRef from "../objects/PDFRef"; +export interface Entry { + ref: PDFRef; + offset: number; + deleted: boolean; + inObjectStream: boolean; +} +declare class PDFXRefStreamParser { + static forStream: (rawStream: PDFRawStream) => PDFXRefStreamParser; + private alreadyParsed; + private readonly dict; + private readonly context; + private readonly bytes; + private readonly subsections; + private readonly byteWidths; + constructor(rawStream: PDFRawStream); + parseIntoContext(): Entry[]; + private parseEntries; +} +export default PDFXRefStreamParser; +//# sourceMappingURL=PDFXRefStreamParser.d.ts.map \ No newline at end of file diff --git a/cjs/core/parser/PDFXRefStreamParser.d.ts.map b/cjs/core/parser/PDFXRefStreamParser.d.ts.map new file mode 100644 index 000000000..a2201bf33 --- /dev/null +++ b/cjs/core/parser/PDFXRefStreamParser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFXRefStreamParser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/PDFXRefStreamParser.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,gCAAsC;AACzD,OAAO,MAAM,0BAAgC;AAI7C,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,cAAM,mBAAmB;IACvB,MAAM,CAAC,SAAS,cAAe,YAAY,yBACN;IAErC,OAAO,CAAC,aAAa,CAAU;IAE/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAGxB;IACJ,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2B;gBAE1C,SAAS,EAAE,YAAY;IA4BnC,gBAAgB,IAAI,KAAK,EAAE;IAuB3B,OAAO,CAAC,YAAY;CA4CrB;AAED,eAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/cjs/core/parser/PDFXRefStreamParser.js b/cjs/core/parser/PDFXRefStreamParser.js new file mode 100644 index 000000000..5af363d86 --- /dev/null +++ b/cjs/core/parser/PDFXRefStreamParser.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var ByteStream_1 = tslib_1.__importDefault(require("./ByteStream")); +var PDFXRefStreamParser = /** @class */ (function () { + function PDFXRefStreamParser(rawStream) { + this.alreadyParsed = false; + this.dict = rawStream.dict; + this.bytes = ByteStream_1.default.fromPDFRawStream(rawStream); + this.context = this.dict.context; + var Size = this.dict.lookup(PDFName_1.default.of('Size'), PDFNumber_1.default); + var Index = this.dict.lookup(PDFName_1.default.of('Index')); + if (Index instanceof PDFArray_1.default) { + this.subsections = []; + for (var idx = 0, len = Index.size(); idx < len; idx += 2) { + var firstObjectNumber = Index.lookup(idx + 0, PDFNumber_1.default).asNumber(); + var length_1 = Index.lookup(idx + 1, PDFNumber_1.default).asNumber(); + this.subsections.push({ firstObjectNumber: firstObjectNumber, length: length_1 }); + } + } + else { + this.subsections = [{ firstObjectNumber: 0, length: Size.asNumber() }]; + } + var W = this.dict.lookup(PDFName_1.default.of('W'), PDFArray_1.default); + this.byteWidths = [-1, -1, -1]; + for (var idx = 0, len = W.size(); idx < len; idx++) { + this.byteWidths[idx] = W.lookup(idx, PDFNumber_1.default).asNumber(); + } + } + PDFXRefStreamParser.prototype.parseIntoContext = function () { + if (this.alreadyParsed) { + throw new errors_1.ReparseError('PDFXRefStreamParser', 'parseIntoContext'); + } + this.alreadyParsed = true; + this.context.trailerInfo = { + Root: this.dict.get(PDFName_1.default.of('Root')), + Encrypt: this.dict.get(PDFName_1.default.of('Encrypt')), + Info: this.dict.get(PDFName_1.default.of('Info')), + ID: this.dict.get(PDFName_1.default.of('ID')), + }; + var entries = this.parseEntries(); + // for (let idx = 0, len = entries.length; idx < len; idx++) { + // const entry = entries[idx]; + // if (entry.deleted) this.context.delete(entry.ref); + // } + return entries; + }; + PDFXRefStreamParser.prototype.parseEntries = function () { + var entries = []; + var _a = this.byteWidths, typeFieldWidth = _a[0], offsetFieldWidth = _a[1], genFieldWidth = _a[2]; + for (var subsectionIdx = 0, subsectionLen = this.subsections.length; subsectionIdx < subsectionLen; subsectionIdx++) { + var _b = this.subsections[subsectionIdx], firstObjectNumber = _b.firstObjectNumber, length_2 = _b.length; + for (var objIdx = 0; objIdx < length_2; objIdx++) { + var type = 0; + for (var idx = 0, len = typeFieldWidth; idx < len; idx++) { + type = (type << 8) | this.bytes.next(); + } + var offset = 0; + for (var idx = 0, len = offsetFieldWidth; idx < len; idx++) { + offset = (offset << 8) | this.bytes.next(); + } + var generationNumber = 0; + for (var idx = 0, len = genFieldWidth; idx < len; idx++) { + generationNumber = (generationNumber << 8) | this.bytes.next(); + } + // When the `type` field is absent, it defaults to 1 + if (typeFieldWidth === 0) + type = 1; + var objectNumber = firstObjectNumber + objIdx; + var entry = { + ref: PDFRef_1.default.of(objectNumber, generationNumber), + offset: offset, + deleted: type === 0, + inObjectStream: type === 2, + }; + entries.push(entry); + } + } + return entries; + }; + PDFXRefStreamParser.forStream = function (rawStream) { + return new PDFXRefStreamParser(rawStream); + }; + return PDFXRefStreamParser; +}()); +exports.default = PDFXRefStreamParser; +//# sourceMappingURL=PDFXRefStreamParser.js.map \ No newline at end of file diff --git a/cjs/core/parser/PDFXRefStreamParser.js.map b/cjs/core/parser/PDFXRefStreamParser.js.map new file mode 100644 index 000000000..3fd715b95 --- /dev/null +++ b/cjs/core/parser/PDFXRefStreamParser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFXRefStreamParser.js","sourceRoot":"","sources":["../../../src/core/parser/PDFXRefStreamParser.ts"],"names":[],"mappings":";;;AAAA,oCAA+C;AAC/C,yEAAiD;AAEjD,uEAA+C;AAC/C,2EAAmD;AAEnD,qEAA6C;AAC7C,oEAAoD;AAUpD;IAeE,6BAAY,SAAuB;QACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAE3B,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,YAAY,GAAG,iBAAiB,GAAG,MAAM,CAAC;gBAChD,IAAM,KAAK,GAAG;oBACZ,GAAG,EAAE,gBAAM,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;oBAC9C,MAAM,QAAA;oBACN,OAAO,EAAE,IAAI,KAAK,CAAC;oBACnB,cAAc,EAAE,IAAI,KAAK,CAAC;iBAC3B,CAAC;gBAEF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrB;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IA5GM,6BAAS,GAAG,UAAC,SAAuB;QACzC,OAAA,IAAI,mBAAmB,CAAC,SAAS,CAAC;IAAlC,CAAkC,CAAC;IA4GvC,0BAAC;CAAA,AA9GD,IA8GC;AAED,kBAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/Ascii85Stream.d.ts b/cjs/core/streams/Ascii85Stream.d.ts new file mode 100644 index 000000000..ebb3af399 --- /dev/null +++ b/cjs/core/streams/Ascii85Stream.d.ts @@ -0,0 +1,10 @@ +import DecodeStream from "./DecodeStream"; +import { StreamType } from "./Stream"; +declare class Ascii85Stream extends DecodeStream { + private stream; + private input; + constructor(stream: StreamType, maybeLength?: number); + protected readBlock(): void; +} +export default Ascii85Stream; +//# sourceMappingURL=Ascii85Stream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/Ascii85Stream.d.ts.map b/cjs/core/streams/Ascii85Stream.d.ts.map new file mode 100644 index 000000000..f2b1e56b7 --- /dev/null +++ b/cjs/core/streams/Ascii85Stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Ascii85Stream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/Ascii85Stream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAKrD,cAAM,aAAc,SAAQ,YAAY;IACtC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAa;gBAEd,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAapD,SAAS,CAAC,SAAS;CAgEpB;AAED,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/Ascii85Stream.js b/cjs/core/streams/Ascii85Stream.js new file mode 100644 index 000000000..d952e58d6 --- /dev/null +++ b/cjs/core/streams/Ascii85Stream.js @@ -0,0 +1,87 @@ +"use strict"; +/* + * Copyright 2012 Mozilla Foundation + * + * The Ascii85Stream class contained in this file is a TypeScript port of the + * JavaScript Ascii85Stream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream")); +var isSpace = function (ch) { + return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; +}; +var Ascii85Stream = /** @class */ (function (_super) { + tslib_1.__extends(Ascii85Stream, _super); + function Ascii85Stream(stream, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream; + _this.input = new Uint8Array(5); + // Most streams increase in size when decoded, but Ascii85 streams + // typically shrink by ~20%. + if (maybeLength) { + maybeLength = 0.8 * maybeLength; + } + return _this; + } + Ascii85Stream.prototype.readBlock = function () { + var TILDA_CHAR = 0x7e; // '~' + var Z_LOWER_CHAR = 0x7a; // 'z' + var EOF = -1; + var stream = this.stream; + var c = stream.getByte(); + while (isSpace(c)) { + c = stream.getByte(); + } + if (c === EOF || c === TILDA_CHAR) { + this.eof = true; + return; + } + var bufferLength = this.bufferLength; + var buffer; + var i; + // special code for z + if (c === Z_LOWER_CHAR) { + buffer = this.ensureBuffer(bufferLength + 4); + for (i = 0; i < 4; ++i) { + buffer[bufferLength + i] = 0; + } + this.bufferLength += 4; + } + else { + var input = this.input; + input[0] = c; + for (i = 1; i < 5; ++i) { + c = stream.getByte(); + while (isSpace(c)) { + c = stream.getByte(); + } + input[i] = c; + if (c === EOF || c === TILDA_CHAR) { + break; + } + } + buffer = this.ensureBuffer(bufferLength + i - 1); + this.bufferLength += i - 1; + // partial ending; + if (i < 5) { + for (; i < 5; ++i) { + input[i] = 0x21 + 84; + } + this.eof = true; + } + var t = 0; + for (i = 0; i < 5; ++i) { + t = t * 85 + (input[i] - 0x21); + } + for (i = 3; i >= 0; --i) { + buffer[bufferLength + i] = t & 0xff; + t >>= 8; + } + } + }; + return Ascii85Stream; +}(DecodeStream_1.default)); +exports.default = Ascii85Stream; +//# sourceMappingURL=Ascii85Stream.js.map \ No newline at end of file diff --git a/cjs/core/streams/Ascii85Stream.js.map b/cjs/core/streams/Ascii85Stream.js.map new file mode 100644 index 000000000..8433c9038 --- /dev/null +++ b/cjs/core/streams/Ascii85Stream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Ascii85Stream.js","sourceRoot":"","sources":["../../../src/core/streams/Ascii85Stream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD,IAAM,OAAO,GAAG,UAAC,EAAU;IACzB,OAAA,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI;AAAxD,CAAwD,CAAC;AAE3D;IAA4B,yCAAY;IAItC,uBAAY,MAAkB,EAAE,WAAoB;QAApD,YACE,kBAAM,WAAW,CAAC,SAUnB;QARC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAE/B,kEAAkE;QAClE,4BAA4B;QAC5B,IAAI,WAAW,EAAE;YACf,WAAW,GAAG,GAAG,GAAG,WAAW,CAAC;SACjC;;IACH,CAAC;IAES,iCAAS,GAAnB;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,CAAC,MAAM;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,CAAC,MAAM;QACjC,IAAM,GAAG,GAAG,CAA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,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,CAAC;YAE3B,kBAAkB;YAClB,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;oBACjB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;iBACtB;gBACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;aACjB;YACD,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;gBACtB,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aAChC;YAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;gBACvB,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACpC,CAAC,KAAK,CAAC,CAAC;aACT;SACF;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAjFD,CAA4B,sBAAY,GAiFvC;AAED,kBAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/AsciiHexStream.d.ts b/cjs/core/streams/AsciiHexStream.d.ts new file mode 100644 index 000000000..a4fd73edf --- /dev/null +++ b/cjs/core/streams/AsciiHexStream.d.ts @@ -0,0 +1,10 @@ +import DecodeStream from "./DecodeStream"; +import { StreamType } from "./Stream"; +declare class AsciiHexStream extends DecodeStream { + private stream; + private firstDigit; + constructor(stream: StreamType, maybeLength?: number); + protected readBlock(): void; +} +export default AsciiHexStream; +//# sourceMappingURL=AsciiHexStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/AsciiHexStream.d.ts.map b/cjs/core/streams/AsciiHexStream.d.ts.map new file mode 100644 index 000000000..c3d17ee7d --- /dev/null +++ b/cjs/core/streams/AsciiHexStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AsciiHexStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/AsciiHexStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,cAAe,SAAQ,YAAY;IACvC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAcpD,SAAS,CAAC,SAAS;CA6CpB;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/AsciiHexStream.js b/cjs/core/streams/AsciiHexStream.js new file mode 100644 index 000000000..794da1b13 --- /dev/null +++ b/cjs/core/streams/AsciiHexStream.js @@ -0,0 +1,75 @@ +"use strict"; +/* + * Copyright 2012 Mozilla Foundation + * + * The AsciiHexStream class contained in this file is a TypeScript port of the + * JavaScript AsciiHexStream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream")); +var AsciiHexStream = /** @class */ (function (_super) { + tslib_1.__extends(AsciiHexStream, _super); + function AsciiHexStream(stream, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream; + _this.firstDigit = -1; + // Most streams increase in size when decoded, but AsciiHex streams shrink + // by 50%. + if (maybeLength) { + maybeLength = 0.5 * maybeLength; + } + return _this; + } + AsciiHexStream.prototype.readBlock = function () { + var UPSTREAM_BLOCK_SIZE = 8000; + var bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE); + if (!bytes.length) { + this.eof = true; + return; + } + var maxDecodeLength = (bytes.length + 1) >> 1; + var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); + var bufferLength = this.bufferLength; + var firstDigit = this.firstDigit; + for (var i = 0, ii = bytes.length; i < ii; i++) { + var ch = bytes[i]; + var digit = void 0; + if (ch >= 0x30 && ch <= 0x39) { + // '0'-'9' + digit = ch & 0x0f; + } + else if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) { + // 'A'-'Z', 'a'-'z' + digit = (ch & 0x0f) + 9; + } + else if (ch === 0x3e) { + // '>' + this.eof = true; + break; + } + else { + // probably whitespace + continue; // ignoring + } + if (firstDigit < 0) { + firstDigit = digit; + } + else { + buffer[bufferLength++] = (firstDigit << 4) | digit; + firstDigit = -1; + } + } + if (firstDigit >= 0 && this.eof) { + // incomplete byte + buffer[bufferLength++] = firstDigit << 4; + firstDigit = -1; + } + this.firstDigit = firstDigit; + this.bufferLength = bufferLength; + }; + return AsciiHexStream; +}(DecodeStream_1.default)); +exports.default = AsciiHexStream; +//# sourceMappingURL=AsciiHexStream.js.map \ No newline at end of file diff --git a/cjs/core/streams/AsciiHexStream.js.map b/cjs/core/streams/AsciiHexStream.js.map new file mode 100644 index 000000000..6fa4e5e04 --- /dev/null +++ b/cjs/core/streams/AsciiHexStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AsciiHexStream.js","sourceRoot":"","sources":["../../../src/core/streams/AsciiHexStream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD;IAA6B,0CAAY;IAIvC,wBAAY,MAAkB,EAAE,WAAoB;QAApD,YACE,kBAAM,WAAW,CAAC,SAWnB;QATC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,KAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAErB,0EAA0E;QAC1E,UAAU;QACV,IAAI,WAAW,EAAE;YACf,WAAW,GAAG,GAAG,GAAG,WAAW,CAAC;SACjC;;IACH,CAAC;IAES,kCAAS,GAAnB;QACE,IAAM,mBAAmB,GAAG,IAAI,CAAC;QACjC,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iBAAM;gBACL,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;gBACnD,UAAU,GAAG,CAAC,CAAC,CAAC;aACjB;SACF;QACD,IAAI,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE;YAC/B,kBAAkB;YAClB,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;YACzC,UAAU,GAAG,CAAC,CAAC,CAAC;SACjB;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IACH,qBAAC;AAAD,CAAC,AA/DD,CAA6B,sBAAY,GA+DxC;AAED,kBAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/DecodeStream.d.ts b/cjs/core/streams/DecodeStream.d.ts new file mode 100644 index 000000000..86cebc68b --- /dev/null +++ b/cjs/core/streams/DecodeStream.d.ts @@ -0,0 +1,27 @@ +import Stream, { StreamType } from "./Stream"; +/** + * Super class for the decoding streams + */ +declare class DecodeStream implements StreamType { + protected bufferLength: number; + protected buffer: Uint8Array; + protected eof: boolean; + private pos; + private minBufferLength; + constructor(maybeMinBufferLength?: number); + get isEmpty(): boolean; + getByte(): number; + getUint16(): number; + getInt32(): number; + getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + peekByte(): number; + peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + skip(n: number): void; + reset(): void; + makeSubStream(start: number, length: number): Stream; + decode(): Uint8Array; + protected readBlock(): void; + protected ensureBuffer(requested: number): Uint8Array; +} +export default DecodeStream; +//# sourceMappingURL=DecodeStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/DecodeStream.d.ts.map b/cjs/core/streams/DecodeStream.d.ts.map new file mode 100644 index 000000000..4d4e11c9c --- /dev/null +++ b/cjs/core/streams/DecodeStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"DecodeStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/DecodeStream.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,iBAAgC;AAgB7D;;GAEG;AACH,cAAM,YAAa,YAAW,UAAU;IACtC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,eAAe,CAAS;gBAEpB,oBAAoB,CAAC,EAAE,MAAM;IAczC,IAAI,OAAO,YAKV;IAED,OAAO;IAWP,SAAS;IAST,QAAQ;IAQR,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IA8B7C,QAAQ;IAMR,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAM9C,IAAI,CAAC,CAAC,EAAE,MAAM;IAOd,KAAK;IAIL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAQ3C,MAAM,IAAI,UAAU;IAKpB,SAAS,CAAC,SAAS,IAAI,IAAI;IAI3B,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;CAoBzC;AAED,eAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/DecodeStream.js b/cjs/core/streams/DecodeStream.js new file mode 100644 index 000000000..b5472a747 --- /dev/null +++ b/cjs/core/streams/DecodeStream.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var Stream_1 = tslib_1.__importDefault(require("./Stream")); +/* + * Copyright 2012 Mozilla Foundation + * + * The DecodeStream class contained in this file is a TypeScript port of the + * JavaScript DecodeStream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +// Lots of DecodeStreams are created whose buffers are never used. For these +// we share a single empty buffer. This is (a) space-efficient and (b) avoids +// having special cases that would be required if we used |null| for an empty +// buffer. +var emptyBuffer = new Uint8Array(0); +/** + * Super class for the decoding streams + */ +var DecodeStream = /** @class */ (function () { + function DecodeStream(maybeMinBufferLength) { + this.pos = 0; + this.bufferLength = 0; + this.eof = false; + this.buffer = emptyBuffer; + this.minBufferLength = 512; + if (maybeMinBufferLength) { + // Compute the first power of two that is as big as maybeMinBufferLength. + while (this.minBufferLength < maybeMinBufferLength) { + this.minBufferLength *= 2; + } + } + } + Object.defineProperty(DecodeStream.prototype, "isEmpty", { + get: function () { + while (!this.eof && this.bufferLength === 0) { + this.readBlock(); + } + return this.bufferLength === 0; + }, + enumerable: false, + configurable: true + }); + DecodeStream.prototype.getByte = function () { + var pos = this.pos; + while (this.bufferLength <= pos) { + if (this.eof) { + return -1; + } + this.readBlock(); + } + return this.buffer[this.pos++]; + }; + DecodeStream.prototype.getUint16 = function () { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }; + DecodeStream.prototype.getInt32 = function () { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }; + DecodeStream.prototype.getBytes = function (length, forceClamped) { + if (forceClamped === void 0) { forceClamped = false; } + var end; + var pos = this.pos; + if (length) { + this.ensureBuffer(pos + length); + end = pos + length; + while (!this.eof && this.bufferLength < end) { + this.readBlock(); + } + var bufEnd = this.bufferLength; + if (end > bufEnd) { + end = bufEnd; + } + } + else { + while (!this.eof) { + this.readBlock(); + } + end = this.bufferLength; + } + this.pos = end; + var subarray = this.buffer.subarray(pos, end); + // `this.buffer` is either a `Uint8Array` or `Uint8ClampedArray` here. + return forceClamped && !(subarray instanceof Uint8ClampedArray) + ? new Uint8ClampedArray(subarray) + : subarray; + }; + DecodeStream.prototype.peekByte = function () { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }; + DecodeStream.prototype.peekBytes = function (length, forceClamped) { + if (forceClamped === void 0) { forceClamped = false; } + var bytes = this.getBytes(length, forceClamped); + this.pos -= bytes.length; + return bytes; + }; + DecodeStream.prototype.skip = function (n) { + if (!n) { + n = 1; + } + this.pos += n; + }; + DecodeStream.prototype.reset = function () { + this.pos = 0; + }; + DecodeStream.prototype.makeSubStream = function (start, length /* dict */) { + var end = start + length; + while (this.bufferLength <= end && !this.eof) { + this.readBlock(); + } + return new Stream_1.default(this.buffer, start, length /* dict */); + }; + DecodeStream.prototype.decode = function () { + while (!this.eof) + this.readBlock(); + return this.buffer.subarray(0, this.bufferLength); + }; + DecodeStream.prototype.readBlock = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'readBlock'); + }; + DecodeStream.prototype.ensureBuffer = function (requested) { + var buffer = this.buffer; + if (requested <= buffer.byteLength) { + return buffer; + } + var size = this.minBufferLength; + while (size < requested) { + size *= 2; + } + var buffer2 = new Uint8Array(size); + buffer2.set(buffer); + return (this.buffer = buffer2); + }; + return DecodeStream; +}()); +exports.default = DecodeStream; +//# sourceMappingURL=DecodeStream.js.map \ No newline at end of file diff --git a/cjs/core/streams/DecodeStream.js.map b/cjs/core/streams/DecodeStream.js.map new file mode 100644 index 000000000..7fafdb842 --- /dev/null +++ b/cjs/core/streams/DecodeStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DecodeStream.js","sourceRoot":"","sources":["../../../src/core/streams/DecodeStream.ts"],"names":[],"mappings":";;;AAAA,oCAA4D;AAC5D,4DAA6D;AAE7D;;;;;;GAMG;AAEH,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,UAAU;AACV,IAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH;IAQE,sBAAY,oBAA6B;QACvC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb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CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAES,mCAAY,GAAtB,UAAuB,SAAiB;QACtC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE;YAClC,OAAO,MAAM,CAAC;SACf;QACD,IAAI,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC;QAChC,OAAO,IAAI,GAAG,SAAS,EAAE;YACvB,IAAI,IAAI,CAAC,CAAC;SACX;QACD,IAAM,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IACjC,CAAC;IAQH,mBAAC;AAAD,CAAC,AAnJD,IAmJC;AAED,kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/FlateStream.d.ts b/cjs/core/streams/FlateStream.d.ts new file mode 100644 index 000000000..119cf5b31 --- /dev/null +++ b/cjs/core/streams/FlateStream.d.ts @@ -0,0 +1,14 @@ +import DecodeStream from "./DecodeStream"; +import { StreamType } from "./Stream"; +declare class FlateStream extends DecodeStream { + private stream; + private codeSize; + private codeBuf; + constructor(stream: StreamType, maybeLength?: number); + protected readBlock(): void; + private getBits; + private getCode; + private generateHuffmanTable; +} +export default FlateStream; +//# sourceMappingURL=FlateStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/FlateStream.d.ts.map b/cjs/core/streams/FlateStream.d.ts.map new file mode 100644 index 000000000..b468d4b2d --- /dev/null +++ b/cjs/core/streams/FlateStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FlateStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/FlateStream.ts"],"names":[],"mappings":"AAiBA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAmGrD,cAAM,WAAY,SAAQ,YAAY;IACpC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IA0BpD,SAAS,CAAC,SAAS;IAoKnB,OAAO,CAAC,OAAO;IAoBf,OAAO,CAAC,OAAO;IA+Bf,OAAO,CAAC,oBAAoB;CAyC7B;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/FlateStream.js b/cjs/core/streams/FlateStream.js new file mode 100644 index 000000000..1625eadf6 --- /dev/null +++ b/cjs/core/streams/FlateStream.js @@ -0,0 +1,371 @@ +"use strict"; +/* + * Copyright 1996-2003 Glyph & Cog, LLC + * + * The flate stream implementation contained in this file is a JavaScript port + * of XPDF's implementation, made available under the Apache 2.0 open source + * license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +/* + * Copyright 2012 Mozilla Foundation + * + * The FlateStream class contained in this file is a TypeScript port of the + * JavaScript FlateStream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +/* tslint:disable no-conditional-assignment */ +var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream")); +// prettier-ignore +var codeLenCodeMap = new Int32Array([ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 +]); +// prettier-ignore +var lengthDecode = new Int32Array([ + 0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, + 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, + 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, + 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102 +]); +// prettier-ignore +var distDecode = new Int32Array([ + 0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, + 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, + 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, + 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001 +]); +// prettier-ignore +var fixedLitCodeTab = [new Int32Array([ + 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, + 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, + 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, + 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, + 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, + 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, + 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, + 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, + 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, + 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, + 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, + 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, + 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, + 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, + 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, + 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, + 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, + 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, + 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, + 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, + 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, + 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, + 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, + 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, + 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, + 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, + 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, + 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, + 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, + 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, + 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, + 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, + 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, + 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, + 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, + 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, + 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, + 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, + 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, + 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, + 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, + 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, + 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, + 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, + 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, + 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, + 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, + 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, + 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, + 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, + 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, + 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, + 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, + 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, + 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, + 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, + 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, + 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, + 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, + 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, + 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, + 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, + 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, + 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff + ]), 9]; +// prettier-ignore +var fixedDistCodeTab = [new Int32Array([ + 0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, + 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, + 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, + 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000 + ]), 5]; +var FlateStream = /** @class */ (function (_super) { + tslib_1.__extends(FlateStream, _super); + function FlateStream(stream, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream; + var cmf = stream.getByte(); + var flg = stream.getByte(); + if (cmf === -1 || flg === -1) { + throw new Error("Invalid header in flate stream: " + cmf + ", " + flg); + } + if ((cmf & 0x0f) !== 0x08) { + throw new Error("Unknown compression method in flate stream: " + cmf + ", " + flg); + } + if (((cmf << 8) + flg) % 31 !== 0) { + throw new Error("Bad FCHECK in flate stream: " + cmf + ", " + flg); + } + if (flg & 0x20) { + throw new Error("FDICT bit set in flate stream: " + cmf + ", " + flg); + } + _this.codeSize = 0; + _this.codeBuf = 0; + return _this; + } + FlateStream.prototype.readBlock = function () { + var buffer; + var len; + var str = this.stream; + // read block header + var hdr = this.getBits(3); + if (hdr & 1) { + this.eof = true; + } + hdr >>= 1; + if (hdr === 0) { + // uncompressed block + var b = void 0; + if ((b = str.getByte()) === -1) { + throw new Error('Bad block header in flate stream'); + } + var blockLen = b; + if ((b = str.getByte()) === -1) { + throw new Error('Bad block header in flate stream'); + } + blockLen |= b << 8; + if ((b = str.getByte()) === -1) { + throw new Error('Bad block header in flate stream'); + } + var check = b; + if ((b = str.getByte()) === -1) { + throw new Error('Bad block header in flate stream'); + } + check |= b << 8; + if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { + // Ignoring error for bad "empty" block (see issue 1277) + throw new Error('Bad uncompressed block length in flate stream'); + } + this.codeBuf = 0; + this.codeSize = 0; + var bufferLength = this.bufferLength; + buffer = this.ensureBuffer(bufferLength + blockLen); + var end = bufferLength + blockLen; + this.bufferLength = end; + if (blockLen === 0) { + if (str.peekByte() === -1) { + this.eof = true; + } + } + else { + for (var n = bufferLength; n < end; ++n) { + if ((b = str.getByte()) === -1) { + this.eof = true; + break; + } + buffer[n] = b; + } + } + return; + } + var litCodeTable; + var distCodeTable; + if (hdr === 1) { + // compressed block, fixed codes + litCodeTable = fixedLitCodeTab; + distCodeTable = fixedDistCodeTab; + } + else if (hdr === 2) { + // compressed block, dynamic codes + var numLitCodes = this.getBits(5) + 257; + var numDistCodes = this.getBits(5) + 1; + var numCodeLenCodes = this.getBits(4) + 4; + // build the code lengths code table + var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); + var i = void 0; + for (i = 0; i < numCodeLenCodes; ++i) { + codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); + } + var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); + // build the literal and distance code tables + len = 0; + i = 0; + var codes = numLitCodes + numDistCodes; + var codeLengths = new Uint8Array(codes); + var bitsLength = void 0; + var bitsOffset = void 0; + var what = void 0; + while (i < codes) { + var code = this.getCode(codeLenCodeTab); + if (code === 16) { + bitsLength = 2; + bitsOffset = 3; + what = len; + } + else if (code === 17) { + bitsLength = 3; + bitsOffset = 3; + what = len = 0; + } + else if (code === 18) { + bitsLength = 7; + bitsOffset = 11; + what = len = 0; + } + else { + codeLengths[i++] = len = code; + continue; + } + var repeatLength = this.getBits(bitsLength) + bitsOffset; + while (repeatLength-- > 0) { + codeLengths[i++] = what; + } + } + litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); + distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); + } + else { + throw new Error('Unknown block type in flate stream'); + } + buffer = this.buffer; + var limit = buffer ? buffer.length : 0; + var pos = this.bufferLength; + while (true) { + var code1 = this.getCode(litCodeTable); + if (code1 < 256) { + if (pos + 1 >= limit) { + buffer = this.ensureBuffer(pos + 1); + limit = buffer.length; + } + buffer[pos++] = code1; + continue; + } + if (code1 === 256) { + this.bufferLength = pos; + return; + } + code1 -= 257; + code1 = lengthDecode[code1]; + var code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + len = (code1 & 0xffff) + code2; + code1 = this.getCode(distCodeTable); + code1 = distDecode[code1]; + code2 = code1 >> 16; + if (code2 > 0) { + code2 = this.getBits(code2); + } + var dist = (code1 & 0xffff) + code2; + if (pos + len >= limit) { + buffer = this.ensureBuffer(pos + len); + limit = buffer.length; + } + for (var k = 0; k < len; ++k, ++pos) { + buffer[pos] = buffer[pos - dist]; + } + } + }; + FlateStream.prototype.getBits = function (bits) { + var str = this.stream; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + var b; + while (codeSize < bits) { + if ((b = str.getByte()) === -1) { + throw new Error('Bad encoding in flate stream'); + } + codeBuf |= b << codeSize; + codeSize += 8; + } + b = codeBuf & ((1 << bits) - 1); + this.codeBuf = codeBuf >> bits; + this.codeSize = codeSize -= bits; + return b; + }; + FlateStream.prototype.getCode = function (table) { + var str = this.stream; + var codes = table[0]; + var maxLen = table[1]; + var codeSize = this.codeSize; + var codeBuf = this.codeBuf; + var b; + while (codeSize < maxLen) { + if ((b = str.getByte()) === -1) { + // premature end of stream. code might however still be valid. + // codeSize < codeLen check below guards against incomplete codeVal. + break; + } + codeBuf |= b << codeSize; + codeSize += 8; + } + var code = codes[codeBuf & ((1 << maxLen) - 1)]; + if (typeof codes === 'number') { + console.log('FLATE:', code); + } + var codeLen = code >> 16; + var codeVal = code & 0xffff; + if (codeLen < 1 || codeSize < codeLen) { + throw new Error('Bad encoding in flate stream'); + } + this.codeBuf = codeBuf >> codeLen; + this.codeSize = codeSize - codeLen; + return codeVal; + }; + FlateStream.prototype.generateHuffmanTable = function (lengths) { + var n = lengths.length; + // find max code length + var maxLen = 0; + var i; + for (i = 0; i < n; ++i) { + if (lengths[i] > maxLen) { + maxLen = lengths[i]; + } + } + // build the table + var size = 1 << maxLen; + var codes = new Int32Array(size); + for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { + for (var val = 0; val < n; ++val) { + if (lengths[val] === len) { + // bit-reverse the code + var code2 = 0; + var t = code; + for (i = 0; i < len; ++i) { + code2 = (code2 << 1) | (t & 1); + t >>= 1; + } + // fill the table entries + for (i = code2; i < size; i += skip) { + codes[i] = (len << 16) | val; + } + ++code; + } + } + } + return [codes, maxLen]; + }; + return FlateStream; +}(DecodeStream_1.default)); +exports.default = FlateStream; +//# sourceMappingURL=FlateStream.js.map \ No newline at end of file diff --git a/cjs/core/streams/FlateStream.js.map b/cjs/core/streams/FlateStream.js.map new file mode 100644 index 000000000..05c328eeb --- /dev/null +++ b/cjs/core/streams/FlateStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FlateStream.js","sourceRoot":"","sources":["../../../src/core/streams/FlateStream.ts"],"names":[],"mappings":";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G,IAAI,MAAM,EACb,EAAE,GAAG,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,EAC7B;YACA,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE;gBAChC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;oBACxB,uBAAuB;oBACvB,IAAI,KAAK,GAAG,CAAC,CAAC;oBACd,IAAI,CAAC,GAAG,IAAI,CAAC;oBACb,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE;wBACxB,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;wBAC/B,CAAC,KAAK,CAAC,CAAC;qBACT;oBAED,yBAAyB;oBACzB,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE;wBACnC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC;qBAC9B;oBACD,EAAE,IAAI,CAAC;iBACR;aACF;SACF;QAED,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IACH,kBAAC;AAAD,CAAC,AA/RD,CAA0B,sBAAY,GA+RrC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/LZWStream.d.ts b/cjs/core/streams/LZWStream.d.ts new file mode 100644 index 000000000..b73ad2e26 --- /dev/null +++ b/cjs/core/streams/LZWStream.d.ts @@ -0,0 +1,13 @@ +import DecodeStream from "./DecodeStream"; +import { StreamType } from "./Stream"; +declare class LZWStream extends DecodeStream { + private stream; + private cachedData; + private bitsCached; + private lzwState; + constructor(stream: StreamType, maybeLength: number | undefined, earlyChange: 0 | 1); + protected readBlock(): void; + private readBits; +} +export default LZWStream; +//# sourceMappingURL=LZWStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/LZWStream.d.ts.map b/cjs/core/streams/LZWStream.d.ts.map new file mode 100644 index 000000000..ccae158fe --- /dev/null +++ b/cjs/core/streams/LZWStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"LZWStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/LZWStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,SAAU,SAAQ,YAAY;IAClC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAUd;gBAGA,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,WAAW,EAAE,CAAC,GAAG,CAAC;IA0BpB,SAAS,CAAC,SAAS;IAyFnB,OAAO,CAAC,QAAQ;CAgBjB;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/LZWStream.js b/cjs/core/streams/LZWStream.js new file mode 100644 index 000000000..1525d2c3f --- /dev/null +++ b/cjs/core/streams/LZWStream.js @@ -0,0 +1,137 @@ +"use strict"; +/* + * Copyright 2012 Mozilla Foundation + * + * The LZWStream class contained in this file is a TypeScript port of the + * JavaScript LZWStream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream")); +var LZWStream = /** @class */ (function (_super) { + tslib_1.__extends(LZWStream, _super); + function LZWStream(stream, maybeLength, earlyChange) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream; + _this.cachedData = 0; + _this.bitsCached = 0; + var maxLzwDictionarySize = 4096; + var lzwState = { + earlyChange: earlyChange, + codeLength: 9, + nextCode: 258, + dictionaryValues: new Uint8Array(maxLzwDictionarySize), + dictionaryLengths: new Uint16Array(maxLzwDictionarySize), + dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), + currentSequence: new Uint8Array(maxLzwDictionarySize), + currentSequenceLength: 0, + }; + for (var i = 0; i < 256; ++i) { + lzwState.dictionaryValues[i] = i; + lzwState.dictionaryLengths[i] = 1; + } + _this.lzwState = lzwState; + return _this; + } + LZWStream.prototype.readBlock = function () { + var blockSize = 512; + var estimatedDecodedSize = blockSize * 2; + var decodedSizeDelta = blockSize; + var i; + var j; + var q; + var lzwState = this.lzwState; + if (!lzwState) { + return; // eof was found + } + var earlyChange = lzwState.earlyChange; + var nextCode = lzwState.nextCode; + var dictionaryValues = lzwState.dictionaryValues; + var dictionaryLengths = lzwState.dictionaryLengths; + var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; + var codeLength = lzwState.codeLength; + var prevCode = lzwState.prevCode; + var currentSequence = lzwState.currentSequence; + var currentSequenceLength = lzwState.currentSequenceLength; + var decodedLength = 0; + var currentBufferLength = this.bufferLength; + var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + for (i = 0; i < blockSize; i++) { + var code = this.readBits(codeLength); + var hasPrev = currentSequenceLength > 0; + if (!code || code < 256) { + currentSequence[0] = code; + currentSequenceLength = 1; + } + else if (code >= 258) { + if (code < nextCode) { + currentSequenceLength = dictionaryLengths[code]; + for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { + currentSequence[j] = dictionaryValues[q]; + q = dictionaryPrevCodes[q]; + } + } + else { + currentSequence[currentSequenceLength++] = currentSequence[0]; + } + } + else if (code === 256) { + codeLength = 9; + nextCode = 258; + currentSequenceLength = 0; + continue; + } + else { + this.eof = true; + delete this.lzwState; + break; + } + if (hasPrev) { + dictionaryPrevCodes[nextCode] = prevCode; + dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; + dictionaryValues[nextCode] = currentSequence[0]; + nextCode++; + codeLength = + (nextCode + earlyChange) & (nextCode + earlyChange - 1) + ? codeLength + : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; + } + prevCode = code; + decodedLength += currentSequenceLength; + if (estimatedDecodedSize < decodedLength) { + do { + estimatedDecodedSize += decodedSizeDelta; + } while (estimatedDecodedSize < decodedLength); + buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); + } + for (j = 0; j < currentSequenceLength; j++) { + buffer[currentBufferLength++] = currentSequence[j]; + } + } + lzwState.nextCode = nextCode; + lzwState.codeLength = codeLength; + lzwState.prevCode = prevCode; + lzwState.currentSequenceLength = currentSequenceLength; + this.bufferLength = currentBufferLength; + }; + LZWStream.prototype.readBits = function (n) { + var bitsCached = this.bitsCached; + var cachedData = this.cachedData; + while (bitsCached < n) { + var c = this.stream.getByte(); + if (c === -1) { + this.eof = true; + return null; + } + cachedData = (cachedData << 8) | c; + bitsCached += 8; + } + this.bitsCached = bitsCached -= n; + this.cachedData = cachedData; + return (cachedData >>> bitsCached) & ((1 << n) - 1); + }; + return LZWStream; +}(DecodeStream_1.default)); +exports.default = LZWStream; +//# sourceMappingURL=LZWStream.js.map \ No newline at end of file diff --git a/cjs/core/streams/LZWStream.js.map b/cjs/core/streams/LZWStream.js.map new file mode 100644 index 000000000..2f54707e7 --- /dev/null +++ b/cjs/core/streams/LZWStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LZWStream.js","sourceRoot":"","sources":["../../../src/core/streams/LZWStream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD;IAAwB,qCAAY;IAgBlC,mBACE,MAAkB,EAClB,WAA+B,EAC/B,WAAkB;QAHpB,YAKE,kBAAM,WAAW,CAAC,SAsBnB;QApBC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,KAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAM,oBAAoB,GAAG,IAAI,CAAC;QAClC,IA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CAAC;QAC7B,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;QACjC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,QAAQ,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QAEvD,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC;IAC1C,CAAC;IAEO,4BAAQ,GAAhB,UAAiB,CAAS;QACxB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,OAAO,UAAU,GAAG,CAAC,EAAE;YACrB,IAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBACZ,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;gBAChB,OAAO,IAAI,CAAC;aACb;YACD,UAAU,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,UAAU,IAAI,CAAC,CAAC;SACjB;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IACH,gBAAC;AAAD,CAAC,AAtJD,CAAwB,sBAAY,GAsJnC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/RunLengthStream.d.ts b/cjs/core/streams/RunLengthStream.d.ts new file mode 100644 index 000000000..30afa5760 --- /dev/null +++ b/cjs/core/streams/RunLengthStream.d.ts @@ -0,0 +1,9 @@ +import DecodeStream from "./DecodeStream"; +import { StreamType } from "./Stream"; +declare class RunLengthStream extends DecodeStream { + private stream; + constructor(stream: StreamType, maybeLength?: number); + protected readBlock(): void; +} +export default RunLengthStream; +//# sourceMappingURL=RunLengthStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/RunLengthStream.d.ts.map b/cjs/core/streams/RunLengthStream.d.ts.map new file mode 100644 index 000000000..851a370d6 --- /dev/null +++ b/cjs/core/streams/RunLengthStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RunLengthStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/RunLengthStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,eAAgB,SAAQ,YAAY;IACxC,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAKpD,SAAS,CAAC,SAAS;CAiCpB;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/RunLengthStream.js b/cjs/core/streams/RunLengthStream.js new file mode 100644 index 000000000..f8c373879 --- /dev/null +++ b/cjs/core/streams/RunLengthStream.js @@ -0,0 +1,55 @@ +"use strict"; +/* + * Copyright 2012 Mozilla Foundation + * + * The RunLengthStream class contained in this file is a TypeScript port of the + * JavaScript RunLengthStream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream")); +var RunLengthStream = /** @class */ (function (_super) { + tslib_1.__extends(RunLengthStream, _super); + function RunLengthStream(stream, maybeLength) { + var _this = _super.call(this, maybeLength) || this; + _this.stream = stream; + return _this; + } + RunLengthStream.prototype.readBlock = function () { + // The repeatHeader has following format. The first byte defines type of run + // and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes + // (in addition to the second byte from the header), n = 129 through 255 - + // duplicate the second byte from the header (257 - n) times, n = 128 - end. + var repeatHeader = this.stream.getBytes(2); + if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { + this.eof = true; + return; + } + var buffer; + var bufferLength = this.bufferLength; + var n = repeatHeader[0]; + if (n < 128) { + // copy n bytes + buffer = this.ensureBuffer(bufferLength + n + 1); + buffer[bufferLength++] = repeatHeader[1]; + if (n > 0) { + var source = this.stream.getBytes(n); + buffer.set(source, bufferLength); + bufferLength += n; + } + } + else { + n = 257 - n; + var b = repeatHeader[1]; + buffer = this.ensureBuffer(bufferLength + n + 1); + for (var i = 0; i < n; i++) { + buffer[bufferLength++] = b; + } + } + this.bufferLength = bufferLength; + }; + return RunLengthStream; +}(DecodeStream_1.default)); +exports.default = RunLengthStream; +//# sourceMappingURL=RunLengthStream.js.map \ No newline at end of file diff --git a/cjs/core/streams/RunLengthStream.js.map b/cjs/core/streams/RunLengthStream.js.map new file mode 100644 index 000000000..6736684fe --- /dev/null +++ b/cjs/core/streams/RunLengthStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RunLengthStream.js","sourceRoot":"","sources":["../../../src/core/streams/RunLengthStream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD;IAA8B,2CAAY;IAGxC,yBAAY,MAAkB,EAAE,WAAoB;QAApD,YACE,kBAAM,WAAW,CAAC,SAEnB;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IAES,mCAAS,GAAnB;QACE,4EAA4E;QAC5E,4EAA4E;QAC5E,0EAA0E;QAC1E,4EAA4E;QAC5E,IAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACvE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAChB,OAAO;SACR;QAED,IAAI,MAAM,CAAC;QACX,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,EAAE;YACX,eAAe;YACf,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACvC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBACjC,YAAY,IAAI,CAAC,CAAC;aACnB;SACF;aAAM;YACL,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,IAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;aAC5B;SACF;QACD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IACH,sBAAC;AAAD,CAAC,AAzCD,CAA8B,sBAAY,GAyCzC;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/Stream.d.ts b/cjs/core/streams/Stream.d.ts new file mode 100644 index 000000000..7f6aa056c --- /dev/null +++ b/cjs/core/streams/Stream.d.ts @@ -0,0 +1,35 @@ +export interface StreamType { + isEmpty: boolean; + getByte(): number; + getUint16(): number; + getInt32(): number; + getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + peekByte(): number; + peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + skip(n: number): void; + reset(): void; + makeSubStream(start: number, length: number): StreamType; + decode(): Uint8Array; +} +declare class Stream implements StreamType { + private bytes; + private start; + private pos; + private end; + constructor(buffer: Uint8Array, start?: number, length?: number); + get length(): number; + get isEmpty(): boolean; + getByte(): number; + getUint16(): number; + getInt32(): number; + getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + peekByte(): number; + peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray; + skip(n: number): void; + reset(): void; + moveStart(): void; + makeSubStream(start: number, length: number): Stream; + decode(): Uint8Array; +} +export default Stream; +//# sourceMappingURL=Stream.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/Stream.d.ts.map b/cjs/core/streams/Stream.d.ts.map new file mode 100644 index 000000000..a4734d084 --- /dev/null +++ b/cjs/core/streams/Stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Stream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/Stream.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,MAAM,CAAC;IAClB,SAAS,IAAI,MAAM,CAAC;IACpB,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,UAAU,GAAG,iBAAiB,CAAC;IAClC,QAAQ,IAAI,MAAM,CAAC;IACnB,SAAS,CACP,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,UAAU,GAAG,iBAAiB,CAAC;IAClC,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IACzD,MAAM,IAAI,UAAU,CAAC;CACtB;AAED,cAAM,MAAO,YAAW,UAAU;IAChC,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,GAAG,CAAS;gBAER,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAO/D,IAAI,MAAM,WAET;IAED,IAAI,OAAO,YAEV;IAED,OAAO;IAOP,SAAS;IAST,QAAQ;IASR,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAqB7C,QAAQ;IAMR,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAM9C,IAAI,CAAC,CAAC,EAAE,MAAM;IAOd,KAAK;IAIL,SAAS;IAIT,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAI3C,MAAM,IAAI,UAAU;CAGrB;AAED,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/Stream.js b/cjs/core/streams/Stream.js new file mode 100644 index 000000000..460dbcb6a --- /dev/null +++ b/cjs/core/streams/Stream.js @@ -0,0 +1,106 @@ +"use strict"; +/* + * Copyright 2012 Mozilla Foundation + * + * The Stream class contained in this file is a TypeScript port of the + * JavaScript Stream class in Mozilla's pdf.js project, made available + * under the Apache 2.0 open source license. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var Stream = /** @class */ (function () { + function Stream(buffer, start, length) { + this.bytes = buffer; + this.start = start || 0; + this.pos = this.start; + this.end = !!start && !!length ? start + length : this.bytes.length; + } + Object.defineProperty(Stream.prototype, "length", { + get: function () { + return this.end - this.start; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Stream.prototype, "isEmpty", { + get: function () { + return this.length === 0; + }, + enumerable: false, + configurable: true + }); + Stream.prototype.getByte = function () { + if (this.pos >= this.end) { + return -1; + } + return this.bytes[this.pos++]; + }; + Stream.prototype.getUint16 = function () { + var b0 = this.getByte(); + var b1 = this.getByte(); + if (b0 === -1 || b1 === -1) { + return -1; + } + return (b0 << 8) + b1; + }; + Stream.prototype.getInt32 = function () { + var b0 = this.getByte(); + var b1 = this.getByte(); + var b2 = this.getByte(); + var b3 = this.getByte(); + return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; + }; + // Returns subarray of original buffer, should only be read. + Stream.prototype.getBytes = function (length, forceClamped) { + if (forceClamped === void 0) { forceClamped = false; } + var bytes = this.bytes; + var pos = this.pos; + var strEnd = this.end; + if (!length) { + var subarray = bytes.subarray(pos, strEnd); + // `this.bytes` is always a `Uint8Array` here. + return forceClamped ? new Uint8ClampedArray(subarray) : subarray; + } + else { + var end = pos + length; + if (end > strEnd) { + end = strEnd; + } + this.pos = end; + var subarray = bytes.subarray(pos, end); + // `this.bytes` is always a `Uint8Array` here. + return forceClamped ? new Uint8ClampedArray(subarray) : subarray; + } + }; + Stream.prototype.peekByte = function () { + var peekedByte = this.getByte(); + this.pos--; + return peekedByte; + }; + Stream.prototype.peekBytes = function (length, forceClamped) { + if (forceClamped === void 0) { forceClamped = false; } + var bytes = this.getBytes(length, forceClamped); + this.pos -= bytes.length; + return bytes; + }; + Stream.prototype.skip = function (n) { + if (!n) { + n = 1; + } + this.pos += n; + }; + Stream.prototype.reset = function () { + this.pos = this.start; + }; + Stream.prototype.moveStart = function () { + this.start = this.pos; + }; + Stream.prototype.makeSubStream = function (start, length) { + return new Stream(this.bytes, start, length); + }; + Stream.prototype.decode = function () { + return this.bytes; + }; + return Stream; +}()); +exports.default = Stream; +//# sourceMappingURL=Stream.js.map \ No newline at end of file diff --git a/cjs/core/streams/Stream.js.map b/cjs/core/streams/Stream.js.map new file mode 100644 index 000000000..a7bf69986 --- /dev/null +++ b/cjs/core/streams/Stream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Stream.js","sourceRoot":"","sources":["../../../src/core/streams/Stream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAsBH;IAME,gBAAY,MAAkB,EAAE,KAAc,EAAE,MAAe;QAC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AoB;QAC5C,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qBAAI,GAAJ,UAAK,CAAS;QACZ,IAAI,CAAC,CAAC,EAAE;YACN,CAAC,GAAG,CAAC,CAAC;SACP;QACD,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,sBAAK,GAAL;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;IACxB,CAAC;IAED,0BAAS,GAAT;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;IACxB,CAAC;IAED,8BAAa,GAAb,UAAc,KAAa,EAAE,MAAc;QACzC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,uBAAM,GAAN;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACH,aAAC;AAAD,CAAC,AArGD,IAqGC;AAED,kBAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/decode.d.ts b/cjs/core/streams/decode.d.ts new file mode 100644 index 000000000..b68a3488d --- /dev/null +++ b/cjs/core/streams/decode.d.ts @@ -0,0 +1,4 @@ +import PDFRawStream from "../objects/PDFRawStream"; +import { StreamType } from "./Stream"; +export declare const decodePDFRawStream: ({ dict, contents }: PDFRawStream) => StreamType; +//# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/cjs/core/streams/decode.d.ts.map b/cjs/core/streams/decode.d.ts.map new file mode 100644 index 000000000..30c72a282 --- /dev/null +++ b/cjs/core/streams/decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/core/streams/decode.ts"],"names":[],"mappings":"AASA,OAAO,YAAY,gCAAsC;AAMzD,OAAe,EAAE,UAAU,EAAE,iBAAgC;AAgC7D,eAAO,MAAM,kBAAkB,uBAAwB,YAAY,eAyBlE,CAAC"} \ No newline at end of file diff --git a/cjs/core/streams/decode.js b/cjs/core/streams/decode.js new file mode 100644 index 000000000..65ff45736 --- /dev/null +++ b/cjs/core/streams/decode.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodePDFRawStream = void 0; +var tslib_1 = require("tslib"); +var errors_1 = require("../errors"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var Ascii85Stream_1 = tslib_1.__importDefault(require("./Ascii85Stream")); +var AsciiHexStream_1 = tslib_1.__importDefault(require("./AsciiHexStream")); +var FlateStream_1 = tslib_1.__importDefault(require("./FlateStream")); +var LZWStream_1 = tslib_1.__importDefault(require("./LZWStream")); +var RunLengthStream_1 = tslib_1.__importDefault(require("./RunLengthStream")); +var Stream_1 = tslib_1.__importDefault(require("./Stream")); +var decodeStream = function (stream, encoding, params) { + if (encoding === PDFName_1.default.of('FlateDecode')) { + return new FlateStream_1.default(stream); + } + if (encoding === PDFName_1.default.of('LZWDecode')) { + var earlyChange = 1; + if (params instanceof PDFDict_1.default) { + var EarlyChange = params.lookup(PDFName_1.default.of('EarlyChange')); + if (EarlyChange instanceof PDFNumber_1.default) { + earlyChange = EarlyChange.asNumber(); + } + } + return new LZWStream_1.default(stream, undefined, earlyChange); + } + if (encoding === PDFName_1.default.of('ASCII85Decode')) { + return new Ascii85Stream_1.default(stream); + } + if (encoding === PDFName_1.default.of('ASCIIHexDecode')) { + return new AsciiHexStream_1.default(stream); + } + if (encoding === PDFName_1.default.of('RunLengthDecode')) { + return new RunLengthStream_1.default(stream); + } + throw new errors_1.UnsupportedEncodingError(encoding.asString()); +}; +exports.decodePDFRawStream = function (_a) { + var dict = _a.dict, contents = _a.contents; + var stream = new Stream_1.default(contents); + var Filter = dict.lookup(PDFName_1.default.of('Filter')); + var DecodeParms = dict.lookup(PDFName_1.default.of('DecodeParms')); + if (Filter instanceof PDFName_1.default) { + stream = decodeStream(stream, Filter, DecodeParms); + } + else if (Filter instanceof PDFArray_1.default) { + for (var idx = 0, len = Filter.size(); idx < len; idx++) { + stream = decodeStream(stream, Filter.lookup(idx, PDFName_1.default), DecodeParms && DecodeParms.lookupMaybe(idx, PDFDict_1.default)); + } + } + else if (!!Filter) { + throw new errors_1.UnexpectedObjectTypeError([PDFName_1.default, PDFArray_1.default], Filter); + } + return stream; +}; +//# sourceMappingURL=decode.js.map \ No newline at end of file diff --git a/cjs/core/streams/decode.js.map b/cjs/core/streams/decode.js.map new file mode 100644 index 000000000..600c54141 --- /dev/null +++ b/cjs/core/streams/decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../../src/core/streams/decode.ts"],"names":[],"mappings":";;;;AAAA,oCAGyB;AACzB,yEAAiD;AACjD,uEAA+C;AAC/C,uEAA+C;AAE/C,2EAAmD;AAEnD,0EAA2D;AAC3D,4EAA6D;AAC7D,sEAAuD;AACvD,kEAAmD;AACnD,8EAA+D;AAC/D,4DAA6D;AAE7D,IAAM,YAAY,GAAG,UACnB,MAAkB,EAClB,QAAiB,EACjB,MAA4C;IAE5C,IAAI,QAAQ,KAAK,iBAAO,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE;QAC1C,OAAO,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,KAAK,iBAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE;QACxC,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,MAAM,YAAY,iBAAO,EAAE;YAC7B,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC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AAG,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YACvD,MAAM,GAAG,YAAY,CACnB,MAAM,EACN,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAO,CAAC,EAC3B,WAAW,IAAK,WAAwB,CAAC,WAAW,CAAC,GAAG,EAAE,iBAAO,CAAC,CACnE,CAAC;SACH;KACF;SAAM,IAAI,CAAC,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,kCAAyB,CAAC,CAAC,iBAAO,EAAE,kBAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;KAClE;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFCatalog.d.ts b/cjs/core/structures/PDFCatalog.d.ts new file mode 100644 index 000000000..8f7d17c28 --- /dev/null +++ b/cjs/core/structures/PDFCatalog.d.ts @@ -0,0 +1,28 @@ +import PDFDict, { DictMap } from "../objects/PDFDict"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFPageTree from "./PDFPageTree"; +import { PDFAcroForm } from "../acroform"; +import ViewerPreferences from '../interactive/ViewerPreferences'; +declare class PDFCatalog extends PDFDict { + static withContextAndPages: (context: PDFContext, pages: PDFPageTree | PDFRef) => PDFCatalog; + static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFCatalog; + Pages(): PDFPageTree; + AcroForm(): PDFDict | undefined; + getAcroForm(): PDFAcroForm | undefined; + getOrCreateAcroForm(): PDFAcroForm; + ViewerPreferences(): PDFDict | undefined; + getViewerPreferences(): ViewerPreferences | undefined; + getOrCreateViewerPreferences(): ViewerPreferences; + /** + * Inserts the given ref as a leaf node of this catalog's page tree at the + * specified index (zero-based). Also increments the `Count` of each node in + * the page tree hierarchy to accomodate the new page. + * + * Returns the ref of the PDFPageTree node into which `leafRef` was inserted. + */ + insertLeafNode(leafRef: PDFRef, index: number): PDFRef; + removeLeafNode(index: number): void; +} +export default PDFCatalog; +//# sourceMappingURL=PDFCatalog.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFCatalog.d.ts.map b/cjs/core/structures/PDFCatalog.d.ts.map new file mode 100644 index 000000000..b9857313b --- /dev/null +++ b/cjs/core/structures/PDFCatalog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCatalog.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAE5D,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAC1D,OAAO,EAAE,WAAW,EAAE,oBAA0B;AAChD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAEjE,cAAM,UAAW,SAAQ,OAAO;IAC9B,MAAM,CAAC,mBAAmB,YACf,UAAU,SACZ,WAAW,GAAG,MAAM,gBAM3B;IAEF,MAAM,CAAC,kBAAkB,0BAA2B,UAAU,gBAC/B;IAE/B,KAAK,IAAI,WAAW;IAIpB,QAAQ,IAAI,OAAO,GAAG,SAAS;IAI/B,WAAW,IAAI,WAAW,GAAG,SAAS;IAMtC,mBAAmB,IAAI,WAAW;IAUlC,iBAAiB,IAAI,OAAO,GAAG,SAAS;IAIxC,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAMrD,4BAA4B,IAAI,iBAAiB;IAUjD;;;;;;OAMG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMtD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGpC;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFCatalog.js b/cjs/core/structures/PDFCatalog.js new file mode 100644 index 000000000..a380ac200 --- /dev/null +++ b/cjs/core/structures/PDFCatalog.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var acroform_1 = require("../acroform"); +var ViewerPreferences_1 = tslib_1.__importDefault(require("../interactive/ViewerPreferences")); +var PDFCatalog = /** @class */ (function (_super) { + tslib_1.__extends(PDFCatalog, _super); + function PDFCatalog() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFCatalog.prototype.Pages = function () { + return this.lookup(PDFName_1.default.of('Pages'), PDFDict_1.default); + }; + PDFCatalog.prototype.AcroForm = function () { + return this.lookupMaybe(PDFName_1.default.of('AcroForm'), PDFDict_1.default); + }; + PDFCatalog.prototype.getAcroForm = function () { + var dict = this.AcroForm(); + if (!dict) + return undefined; + return acroform_1.PDFAcroForm.fromDict(dict); + }; + PDFCatalog.prototype.getOrCreateAcroForm = function () { + var acroForm = this.getAcroForm(); + if (!acroForm) { + acroForm = acroform_1.PDFAcroForm.create(this.context); + var acroFormRef = this.context.register(acroForm.dict); + this.set(PDFName_1.default.of('AcroForm'), acroFormRef); + } + return acroForm; + }; + PDFCatalog.prototype.ViewerPreferences = function () { + return this.lookupMaybe(PDFName_1.default.of('ViewerPreferences'), PDFDict_1.default); + }; + PDFCatalog.prototype.getViewerPreferences = function () { + var dict = this.ViewerPreferences(); + if (!dict) + return undefined; + return ViewerPreferences_1.default.fromDict(dict); + }; + PDFCatalog.prototype.getOrCreateViewerPreferences = function () { + var viewerPrefs = this.getViewerPreferences(); + if (!viewerPrefs) { + viewerPrefs = ViewerPreferences_1.default.create(this.context); + var viewerPrefsRef = this.context.register(viewerPrefs.dict); + this.set(PDFName_1.default.of('ViewerPreferences'), viewerPrefsRef); + } + return viewerPrefs; + }; + /** + * Inserts the given ref as a leaf node of this catalog's page tree at the + * specified index (zero-based). Also increments the `Count` of each node in + * the page tree hierarchy to accomodate the new page. + * + * Returns the ref of the PDFPageTree node into which `leafRef` was inserted. + */ + PDFCatalog.prototype.insertLeafNode = function (leafRef, index) { + var pagesRef = this.get(PDFName_1.default.of('Pages')); + var maybeParentRef = this.Pages().insertLeafNode(leafRef, index); + return maybeParentRef || pagesRef; + }; + PDFCatalog.prototype.removeLeafNode = function (index) { + this.Pages().removeLeafNode(index); + }; + PDFCatalog.withContextAndPages = function (context, pages) { + var dict = new Map(); + dict.set(PDFName_1.default.of('Type'), PDFName_1.default.of('Catalog')); + dict.set(PDFName_1.default.of('Pages'), pages); + return new PDFCatalog(dict, context); + }; + PDFCatalog.fromMapWithContext = function (map, context) { + return new PDFCatalog(map, context); + }; + return PDFCatalog; +}(PDFDict_1.default)); +exports.default = PDFCatalog; +//# sourceMappingURL=PDFCatalog.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFCatalog.js.map b/cjs/core/structures/PDFCatalog.js.map new file mode 100644 index 000000000..cd5068758 --- /dev/null +++ b/cjs/core/structures/PDFCatalog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCatalog.js","sourceRoot":"","sources":["../../../src/core/structures/PDFCatalog.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAC5D,uEAA+C;AAI/C,wCAAgD;AAChD,+FAAiE;AAEjE;IAAyB,sCAAO;IAAhC;;IA0EA,CAAC;IA5DC,0BAAK,GAAL;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAO,CAAgB,CAAC;IAClE,CAAC;IAED,6BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAO,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,iBAAO,CAAC,CAAC;IAC3D,CAAC;IAED,gCAAW,GAAX;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,OAAO,sBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;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AQ,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAW,CAAC;QACzD,IAAM,cAAc,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,cAAc,IAAI,QAAQ,CAAC;IACpC,CAAC;IAED,mCAAc,GAAd,UAAe,KAAa;QAC1B,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAxEM,8BAAmB,GAAG,UAC3B,OAAmB,EACnB,KAA2B;QAE3B,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAO,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC;IAEK,6BAAkB,GAAG,UAAC,GAAY,EAAE,OAAmB;QAC5D,OAAA,IAAI,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;IAA5B,CAA4B,CAAC;IA8DjC,iBAAC;CAAA,AA1ED,CAAyB,iBAAO,GA0E/B;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFContentStream.d.ts b/cjs/core/structures/PDFContentStream.d.ts new file mode 100644 index 000000000..e6e5d26fc --- /dev/null +++ b/cjs/core/structures/PDFContentStream.d.ts @@ -0,0 +1,16 @@ +import PDFDict from "../objects/PDFDict"; +import PDFOperator from "../operators/PDFOperator"; +import PDFContext from "../PDFContext"; +import PDFFlateStream from "./PDFFlateStream"; +declare class PDFContentStream extends PDFFlateStream { + static of: (dict: PDFDict, operators: PDFOperator[], encode?: boolean) => PDFContentStream; + private readonly operators; + private constructor(); + push(...operators: PDFOperator[]): void; + clone(context?: PDFContext): PDFContentStream; + getContentsString(): string; + getUnencodedContents(): Uint8Array; + getUnencodedContentsSize(): number; +} +export default PDFContentStream; +//# sourceMappingURL=PDFContentStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFContentStream.d.ts.map b/cjs/core/structures/PDFContentStream.d.ts.map new file mode 100644 index 000000000..7f2fd3cd7 --- /dev/null +++ b/cjs/core/structures/PDFContentStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFContentStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFContentStream.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,WAAW,iCAAuC;AACzD,OAAO,UAAU,sBAA4B;AAC7C,OAAO,cAAc,yBAA2C;AAGhE,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,MAAM,CAAC,EAAE,SAAU,OAAO,aAAa,WAAW,EAAE,wCACJ;IAEhD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAE1C,OAAO;IAKP,IAAI,CAAC,GAAG,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI;IAIvC,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,gBAAgB;IAS7C,iBAAiB,IAAI,MAAM;IAQ3B,oBAAoB,IAAI,UAAU;IAUlC,wBAAwB,IAAI,MAAM;CAOnC;AAED,eAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFContentStream.js b/cjs/core/structures/PDFContentStream.js new file mode 100644 index 000000000..b78732348 --- /dev/null +++ b/cjs/core/structures/PDFContentStream.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFFlateStream_1 = tslib_1.__importDefault(require("./PDFFlateStream")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var PDFContentStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFContentStream, _super); + function PDFContentStream(dict, operators, encode) { + if (encode === void 0) { encode = true; } + var _this = _super.call(this, dict, encode) || this; + _this.operators = operators; + return _this; + } + PDFContentStream.prototype.push = function () { + var _a; + var operators = []; + for (var _i = 0; _i < arguments.length; _i++) { + operators[_i] = arguments[_i]; + } + (_a = this.operators).push.apply(_a, operators); + }; + PDFContentStream.prototype.clone = function (context) { + var operators = new Array(this.operators.length); + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + operators[idx] = this.operators[idx].clone(context); + } + var _a = this, dict = _a.dict, encode = _a.encode; + return PDFContentStream.of(dict.clone(context), operators, encode); + }; + PDFContentStream.prototype.getContentsString = function () { + var value = ''; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + value += this.operators[idx] + "\n"; + } + return value; + }; + PDFContentStream.prototype.getUnencodedContents = function () { + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = 0; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + offset += this.operators[idx].copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + } + return buffer; + }; + PDFContentStream.prototype.getUnencodedContentsSize = function () { + var size = 0; + for (var idx = 0, len = this.operators.length; idx < len; idx++) { + size += this.operators[idx].sizeInBytes() + 1; + } + return size; + }; + PDFContentStream.of = function (dict, operators, encode) { + if (encode === void 0) { encode = true; } + return new PDFContentStream(dict, operators, encode); + }; + return PDFContentStream; +}(PDFFlateStream_1.default)); +exports.default = PDFContentStream; +//# sourceMappingURL=PDFContentStream.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFContentStream.js.map b/cjs/core/structures/PDFContentStream.js.map new file mode 100644 index 000000000..51f49855f --- /dev/null +++ b/cjs/core/structures/PDFContentStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFContentStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFContentStream.ts"],"names":[],"mappings":";;;AAGA,4EAAgE;A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f,CAAC;IAED,+CAAoB,GAApB;QACE,IAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;QAC/D,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC/D,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC5D,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,OAAO,CAAC;SACtC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mDAAwB,GAAxB;QACE,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC/D,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;SAC/C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IA/CM,mBAAE,GAAG,UAAC,IAAa,EAAE,SAAwB,EAAE,MAAa;QAAb,uBAAA,EAAA,aAAa;QACjE,OAAA,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC;IAA7C,CAA6C,CAAC;IA+ClD,uBAAC;CAAA,AAjDD,CAA+B,wBAAc,GAiD5C;AAED,kBAAe,gBAAgB,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFCrossRefStream.d.ts b/cjs/core/structures/PDFCrossRefStream.d.ts new file mode 100644 index 000000000..bb26834a0 --- /dev/null +++ b/cjs/core/structures/PDFCrossRefStream.d.ts @@ -0,0 +1,54 @@ +import PDFDict from "../objects/PDFDict"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFFlateStream from "./PDFFlateStream"; +export declare enum EntryType { + Deleted = 0, + Uncompressed = 1, + Compressed = 2 +} +export interface DeletedEntry { + type: EntryType.Deleted; + ref: PDFRef; + nextFreeObjectNumber: number; +} +export interface UncompressedEntry { + type: EntryType.Uncompressed; + ref: PDFRef; + offset: number; +} +export interface CompressedEntry { + type: EntryType.Compressed; + ref: PDFRef; + objectStreamRef: PDFRef; + index: number; +} +export declare type Entry = DeletedEntry | UncompressedEntry | CompressedEntry; +export declare type EntryTuple = [number, number, number]; +/** + * Entries should be added using the [[addDeletedEntry]], + * [[addUncompressedEntry]], and [[addCompressedEntry]] methods + * **in order of ascending object number**. + */ +declare class PDFCrossRefStream extends PDFFlateStream { + static create: (dict: PDFDict, encode?: boolean) => PDFCrossRefStream; + static of: (dict: PDFDict, entries: Entry[], encode?: boolean) => PDFCrossRefStream; + private readonly entries; + private readonly entryTuplesCache; + private readonly maxByteWidthsCache; + private readonly indexCache; + private constructor(); + addDeletedEntry(ref: PDFRef, nextFreeObjectNumber: number): void; + addUncompressedEntry(ref: PDFRef, offset: number): void; + addCompressedEntry(ref: PDFRef, objectStreamRef: PDFRef, index: number): void; + clone(context?: PDFContext): PDFCrossRefStream; + getContentsString(): string; + getUnencodedContents(): Uint8Array; + getUnencodedContentsSize(): number; + updateDict(): void; + private computeIndex; + private computeEntryTuples; + private computeMaxEntryByteWidths; +} +export default PDFCrossRefStream; +//# sourceMappingURL=PDFCrossRefStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFCrossRefStream.d.ts.map b/cjs/core/structures/PDFCrossRefStream.d.ts.map new file mode 100644 index 000000000..c785292c4 --- /dev/null +++ b/cjs/core/structures/PDFCrossRefStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCrossRefStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFCrossRefStream.ts"],"names":[],"mapp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AAM;IAShD,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAStE,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,iBAAiB;IAK9C,iBAAiB,IAAI,MAAM;IA8B3B,oBAAoB,IAAI,UAAU;IA+BlC,wBAAwB,IAAI,MAAM;IAMlC,UAAU,IAAI,IAAI;IAclB,OAAO,CAAC,YAAY,CAqBlB;IAEF,OAAO,CAAC,kBAAkB,CAoBxB;IAEF,OAAO,CAAC,yBAAyB,CAiB/B;CACH;AAED,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFCrossRefStream.js b/cjs/core/structures/PDFCrossRefStream.js new file mode 100644 index 000000000..85f5bf4fc --- /dev/null +++ b/cjs/core/structures/PDFCrossRefStream.js @@ -0,0 +1,187 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EntryType = void 0; +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFFlateStream_1 = tslib_1.__importDefault(require("./PDFFlateStream")); +var utils_1 = require("../../utils"); +var EntryType; +(function (EntryType) { + EntryType[EntryType["Deleted"] = 0] = "Deleted"; + EntryType[EntryType["Uncompressed"] = 1] = "Uncompressed"; + EntryType[EntryType["Compressed"] = 2] = "Compressed"; +})(EntryType = exports.EntryType || (exports.EntryType = {})); +/** + * Entries should be added using the [[addDeletedEntry]], + * [[addUncompressedEntry]], and [[addCompressedEntry]] methods + * **in order of ascending object number**. + */ +var PDFCrossRefStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFCrossRefStream, _super); + function PDFCrossRefStream(dict, entries, encode) { + if (encode === void 0) { encode = true; } + var _this = _super.call(this, dict, encode) || this; + // Returns an array of integer pairs for each subsection of the cross ref + // section, where each integer pair represents: + // firstObjectNumber(OfSection), length(OfSection) + _this.computeIndex = function () { + var subsections = []; + var subsectionLength = 0; + for (var idx = 0, len = _this.entries.length; idx < len; idx++) { + var currEntry = _this.entries[idx]; + var prevEntry = _this.entries[idx - 1]; + if (idx === 0) { + subsections.push(currEntry.ref.objectNumber); + } + else if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) { + subsections.push(subsectionLength); + subsections.push(currEntry.ref.objectNumber); + subsectionLength = 0; + } + subsectionLength += 1; + } + subsections.push(subsectionLength); + return subsections; + }; + _this.computeEntryTuples = function () { + var entryTuples = new Array(_this.entries.length); + for (var idx = 0, len = _this.entries.length; idx < len; idx++) { + var entry = _this.entries[idx]; + if (entry.type === EntryType.Deleted) { + var type = entry.type, nextFreeObjectNumber = entry.nextFreeObjectNumber, ref = entry.ref; + entryTuples[idx] = [type, nextFreeObjectNumber, ref.generationNumber]; + } + if (entry.type === EntryType.Uncompressed) { + var type = entry.type, offset = entry.offset, ref = entry.ref; + entryTuples[idx] = [type, offset, ref.generationNumber]; + } + if (entry.type === EntryType.Compressed) { + var type = entry.type, objectStreamRef = entry.objectStreamRef, index = entry.index; + entryTuples[idx] = [type, objectStreamRef.objectNumber, index]; + } + } + return entryTuples; + }; + _this.computeMaxEntryByteWidths = function () { + var entryTuples = _this.entryTuplesCache.access(); + var widths = [0, 0, 0]; + for (var idx = 0, len = entryTuples.length; idx < len; idx++) { + var _a = entryTuples[idx], first = _a[0], second = _a[1], third = _a[2]; + var firstSize = utils_1.sizeInBytes(first); + var secondSize = utils_1.sizeInBytes(second); + var thirdSize = utils_1.sizeInBytes(third); + if (firstSize > widths[0]) + widths[0] = firstSize; + if (secondSize > widths[1]) + widths[1] = secondSize; + if (thirdSize > widths[2]) + widths[2] = thirdSize; + } + return widths; + }; + _this.entries = entries || []; + _this.entryTuplesCache = utils_1.Cache.populatedBy(_this.computeEntryTuples); + _this.maxByteWidthsCache = utils_1.Cache.populatedBy(_this.computeMaxEntryByteWidths); + _this.indexCache = utils_1.Cache.populatedBy(_this.computeIndex); + dict.set(PDFName_1.default.of('Type'), PDFName_1.default.of('XRef')); + return _this; + } + PDFCrossRefStream.prototype.addDeletedEntry = function (ref, nextFreeObjectNumber) { + var type = EntryType.Deleted; + this.entries.push({ type: type, ref: ref, nextFreeObjectNumber: nextFreeObjectNumber }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream.prototype.addUncompressedEntry = function (ref, offset) { + var type = EntryType.Uncompressed; + this.entries.push({ type: type, ref: ref, offset: offset }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream.prototype.addCompressedEntry = function (ref, objectStreamRef, index) { + var type = EntryType.Compressed; + this.entries.push({ type: type, ref: ref, objectStreamRef: objectStreamRef, index: index }); + this.entryTuplesCache.invalidate(); + this.maxByteWidthsCache.invalidate(); + this.indexCache.invalidate(); + this.contentsCache.invalidate(); + }; + PDFCrossRefStream.prototype.clone = function (context) { + var _a = this, dict = _a.dict, entries = _a.entries, encode = _a.encode; + return PDFCrossRefStream.of(dict.clone(context), entries.slice(), encode); + }; + PDFCrossRefStream.prototype.getContentsString = function () { + var entryTuples = this.entryTuplesCache.access(); + var byteWidths = this.maxByteWidthsCache.access(); + var value = ''; + for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) { + var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2]; + var firstBytes = utils_1.reverseArray(utils_1.bytesFor(first)); + var secondBytes = utils_1.reverseArray(utils_1.bytesFor(second)); + var thirdBytes = utils_1.reverseArray(utils_1.bytesFor(third)); + for (var idx = byteWidths[0] - 1; idx >= 0; idx--) { + value += (firstBytes[idx] || 0).toString(2); + } + for (var idx = byteWidths[1] - 1; idx >= 0; idx--) { + value += (secondBytes[idx] || 0).toString(2); + } + for (var idx = byteWidths[2] - 1; idx >= 0; idx--) { + value += (thirdBytes[idx] || 0).toString(2); + } + } + return value; + }; + PDFCrossRefStream.prototype.getUnencodedContents = function () { + var entryTuples = this.entryTuplesCache.access(); + var byteWidths = this.maxByteWidthsCache.access(); + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = 0; + for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) { + var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2]; + var firstBytes = utils_1.reverseArray(utils_1.bytesFor(first)); + var secondBytes = utils_1.reverseArray(utils_1.bytesFor(second)); + var thirdBytes = utils_1.reverseArray(utils_1.bytesFor(third)); + for (var idx = byteWidths[0] - 1; idx >= 0; idx--) { + buffer[offset++] = firstBytes[idx] || 0; + } + for (var idx = byteWidths[1] - 1; idx >= 0; idx--) { + buffer[offset++] = secondBytes[idx] || 0; + } + for (var idx = byteWidths[2] - 1; idx >= 0; idx--) { + buffer[offset++] = thirdBytes[idx] || 0; + } + } + return buffer; + }; + PDFCrossRefStream.prototype.getUnencodedContentsSize = function () { + var byteWidths = this.maxByteWidthsCache.access(); + var entryWidth = utils_1.sum(byteWidths); + return entryWidth * this.entries.length; + }; + PDFCrossRefStream.prototype.updateDict = function () { + _super.prototype.updateDict.call(this); + var byteWidths = this.maxByteWidthsCache.access(); + var index = this.indexCache.access(); + var context = this.dict.context; + this.dict.set(PDFName_1.default.of('W'), context.obj(byteWidths)); + this.dict.set(PDFName_1.default.of('Index'), context.obj(index)); + }; + PDFCrossRefStream.create = function (dict, encode) { + if (encode === void 0) { encode = true; } + var stream = new PDFCrossRefStream(dict, [], encode); + stream.addDeletedEntry(PDFRef_1.default.of(0, 65535), 0); + return stream; + }; + PDFCrossRefStream.of = function (dict, entries, encode) { + if (encode === void 0) { encode = true; } + return new PDFCrossRefStream(dict, entries, encode); + }; + return PDFCrossRefStream; +}(PDFFlateStream_1.default)); +exports.default = PDFCrossRefStream; +//# sourceMappingURL=PDFCrossRefStream.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFCrossRefStream.js.map b/cjs/core/structures/PDFCrossRefStream.js.map new file mode 100644 index 000000000..8016a7bd9 --- /dev/null +++ b/cjs/core/structures/PDFCrossRefStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFCrossRefStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFCrossRefStream.ts"],"names":[],"mappings":";;;;AACA,uEAA+C;AAC/C,qEAA6C;AAE7C,4EAAgE;AAChE,qCAA4E;AAE5E,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,+CAAW,CAAA;IACX,yDAAgB,CAAA;IAChB,qDAAc,CAAA;AAChB,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB;AAyBD;;;;GAIG;AACH;IAAgC,6CAAc;IAe5C,2BAAoB,IAAa,EAAE,OAAiB,EAAE,MAAa;QAAb,uBAAA,EAAA,aAAa;QAAnE,YACE,kBAAM,IAAI,EAAE,MAAM,CAAC,SAQpB;QAgHD,yEAAyE;QACzE,+CAA+C;QAC/C,oDAAoD;QAC5C,kBAAY,GAAG;YACrB,IAAM,WAAW,GAAa,EAAE,CAAC;YAEjC,IAAI,gBAAgB,GAAG,CAAC,CAAC;YACzB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBAC7D,IAAM,SAAS,GAAG,KAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAM,SAAS,GAAG,KAAI,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBAExC,IAAI,GAAG,KAAK,CAAC,EAAE;oBACb,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;iBAC9C;qBAAM,IAAI,SAAS,CAAC,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,YAA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GAAV;QACE,iBAAM,UAAU,WAAE,CAAC;QAEnB,IAAM,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACpD,IAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAE/B,IAAA,OAAO,GAAK,IAAI,CAAC,IAAI,QAAd,CAAe;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACzD,CAAC;IArIM,wBAAM,GAAG,UAAC,IAAa,EAAE,MAAa;QAAb,uBAAA,EAAA,aAAa;QAC3C,IAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QACvD,MAAM,CAAC,eAAe,CAAC,gBAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEK,oBAAE,GAAG,UAAC,IAAa,EAAE,OAAgB,EAAE,MAAa;QAAb,uBAAA,EAAA,aAAa;QACzD,OAAA,IAAI,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;IAA5C,CAA4C,CAAC;IAkMjD,wBAAC;CAAA,AA1MD,CAAgC,wBAAc,GA0M7C;AAED,kBAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFFlateStream.d.ts b/cjs/core/structures/PDFFlateStream.d.ts new file mode 100644 index 000000000..2180a6946 --- /dev/null +++ b/cjs/core/structures/PDFFlateStream.d.ts @@ -0,0 +1,14 @@ +import PDFDict from "../objects/PDFDict"; +import PDFStream from "../objects/PDFStream"; +import { Cache } from "../../utils"; +declare class PDFFlateStream extends PDFStream { + protected readonly contentsCache: Cache; + protected readonly encode: boolean; + constructor(dict: PDFDict, encode: boolean); + computeContents: () => Uint8Array; + getContents(): Uint8Array; + getContentsSize(): number; + getUnencodedContents(): Uint8Array; +} +export default PDFFlateStream; +//# sourceMappingURL=PDFFlateStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFFlateStream.d.ts.map b/cjs/core/structures/PDFFlateStream.d.ts.map new file mode 100644 index 000000000..6d69ceab2 --- /dev/null +++ b/cjs/core/structures/PDFFlateStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFFlateStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFFlateStream.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,EAAE,KAAK,EAAE,oBAAkB;AAElC,cAAM,cAAe,SAAQ,SAAS;IACpC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEvB,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAS1C,eAAe,QAAO,UAAU,CAG9B;IAEF,WAAW,IAAI,UAAU;IAIzB,eAAe,IAAI,MAAM;IAIzB,oBAAoB,IAAI,UAAU;CAMnC;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFFlateStream.js b/cjs/core/structures/PDFFlateStream.js new file mode 100644 index 000000000..d22dc37fa --- /dev/null +++ b/cjs/core/structures/PDFFlateStream.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var pako_1 = tslib_1.__importDefault(require("pako")); +var errors_1 = require("../errors"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream")); +var utils_1 = require("../../utils"); +var PDFFlateStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFFlateStream, _super); + function PDFFlateStream(dict, encode) { + var _this = _super.call(this, dict) || this; + _this.computeContents = function () { + var unencodedContents = _this.getUnencodedContents(); + return _this.encode ? pako_1.default.deflate(unencodedContents) : unencodedContents; + }; + _this.encode = encode; + if (encode) + dict.set(PDFName_1.default.of('Filter'), PDFName_1.default.of('FlateDecode')); + _this.contentsCache = utils_1.Cache.populatedBy(_this.computeContents); + return _this; + } + PDFFlateStream.prototype.getContents = function () { + return this.contentsCache.access(); + }; + PDFFlateStream.prototype.getContentsSize = function () { + return this.contentsCache.access().length; + }; + PDFFlateStream.prototype.getUnencodedContents = function () { + throw new errors_1.MethodNotImplementedError(this.constructor.name, 'getUnencodedContents'); + }; + return PDFFlateStream; +}(PDFStream_1.default)); +exports.default = PDFFlateStream; +//# sourceMappingURL=PDFFlateStream.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFFlateStream.js.map b/cjs/core/structures/PDFFlateStream.js.map new file mode 100644 index 000000000..a728bf5a0 --- /dev/null +++ b/cjs/core/structures/PDFFlateStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFFlateStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFFlateStream.ts"],"names":[],"mappings":";;;AAAA,sDAAwB;AAExB,oCAA4D;AAE5D,uEAA+C;AAC/C,2EAAmD;AACnD,qCAAkC;AAElC;IAA6B,0CAAS;IAIpC,wBAAY,IAAa,EAAE,MAAe;QAA1C,YACE,kBAAM,IAAI,CAAC,SAMZ;QAED,qBAAe,GAAG;YAChB,IAAM,iBAAiB,GAAG,KAAI,CAAC,oBAAoB,EAAE,CAAC;YACtD,OAAO,KAAI,CAAC,MAAM,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAC3E,CAAC,CAAC;QATA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,iBAAO,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QACtE,KAAI,CAAC,aAAa,GAAG,aAAK,CAAC,WAAW,CAAC,KAAI,CAAC,eAAe,CAAC,CAAC;;IAC/D,CAAC;IAOD,oCAAW,GAAX;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAED,wCAAe,GAAf;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC;IAC5C,CAAC;IAED,6CAAoB,GAApB;QACE,MAAM,IAAI,kCAAyB,CACjC,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,sBAAsB,CACvB,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AAhCD,CAA6B,mBAAS,GAgCrC;AAED,kBAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFObjectStream.d.ts b/cjs/core/structures/PDFObjectStream.d.ts new file mode 100644 index 000000000..18ad9dc35 --- /dev/null +++ b/cjs/core/structures/PDFObjectStream.d.ts @@ -0,0 +1,21 @@ +import PDFObject from "../objects/PDFObject"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFFlateStream from "./PDFFlateStream"; +export declare type IndirectObject = [PDFRef, PDFObject]; +declare class PDFObjectStream extends PDFFlateStream { + static withContextAndObjects: (context: PDFContext, objects: IndirectObject[], encode?: boolean) => PDFObjectStream; + private readonly objects; + private readonly offsets; + private readonly offsetsString; + private constructor(); + getObjectsCount(): number; + clone(context?: PDFContext): PDFObjectStream; + getContentsString(): string; + getUnencodedContents(): Uint8Array; + getUnencodedContentsSize(): number; + private computeOffsetsString; + private computeObjectOffsets; +} +export default PDFObjectStream; +//# sourceMappingURL=PDFObjectStream.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFObjectStream.d.ts.map b/cjs/core/structures/PDFObjectStream.d.ts.map new file mode 100644 index 000000000..964c9c544 --- /dev/null +++ b/cjs/core/structures/PDFObjectStream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFObjectStream.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,cAAc,yBAA2C;AAIhE,oBAAY,cAAc,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEjD,cAAM,eAAgB,SAAQ,cAAc;IAC1C,MAAM,CAAC,qBAAqB,YACjB,UAAU,WACV,cAAc,EAAE,uCAEwB;IAEnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IAEvC,OAAO;IAgBP,eAAe,IAAI,MAAM;IAIzB,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,eAAe;IAQ5C,iBAAiB,IAAI,MAAM;IAS3B,oBAAoB,IAAI,UAAU;IAWlC,wBAAwB,IAAI,MAAM;IASlC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,oBAAoB;CAU7B;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFObjectStream.js b/cjs/core/structures/PDFObjectStream.js new file mode 100644 index 000000000..272bf499b --- /dev/null +++ b/cjs/core/structures/PDFObjectStream.js @@ -0,0 +1,77 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFFlateStream_1 = tslib_1.__importDefault(require("./PDFFlateStream")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var PDFObjectStream = /** @class */ (function (_super) { + tslib_1.__extends(PDFObjectStream, _super); + function PDFObjectStream(context, objects, encode) { + if (encode === void 0) { encode = true; } + var _this = _super.call(this, context.obj({}), encode) || this; + _this.objects = objects; + _this.offsets = _this.computeObjectOffsets(); + _this.offsetsString = _this.computeOffsetsString(); + _this.dict.set(PDFName_1.default.of('Type'), PDFName_1.default.of('ObjStm')); + _this.dict.set(PDFName_1.default.of('N'), PDFNumber_1.default.of(_this.objects.length)); + _this.dict.set(PDFName_1.default.of('First'), PDFNumber_1.default.of(_this.offsetsString.length)); + return _this; + } + PDFObjectStream.prototype.getObjectsCount = function () { + return this.objects.length; + }; + PDFObjectStream.prototype.clone = function (context) { + return PDFObjectStream.withContextAndObjects(context || this.dict.context, this.objects.slice(), this.encode); + }; + PDFObjectStream.prototype.getContentsString = function () { + var value = this.offsetsString; + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a = this.objects[idx], object = _a[1]; + value += object + "\n"; + } + return value; + }; + PDFObjectStream.prototype.getUnencodedContents = function () { + var buffer = new Uint8Array(this.getUnencodedContentsSize()); + var offset = utils_1.copyStringIntoBuffer(this.offsetsString, buffer, 0); + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a = this.objects[idx], object = _a[1]; + offset += object.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + } + return buffer; + }; + PDFObjectStream.prototype.getUnencodedContentsSize = function () { + return (this.offsetsString.length + + utils_1.last(this.offsets)[1] + + utils_1.last(this.objects)[1].sizeInBytes() + + 1); + }; + PDFObjectStream.prototype.computeOffsetsString = function () { + var offsetsString = ''; + for (var idx = 0, len = this.offsets.length; idx < len; idx++) { + var _a = this.offsets[idx], objectNumber = _a[0], offset = _a[1]; + offsetsString += objectNumber + " " + offset + " "; + } + return offsetsString; + }; + PDFObjectStream.prototype.computeObjectOffsets = function () { + var offset = 0; + var offsets = new Array(this.objects.length); + for (var idx = 0, len = this.objects.length; idx < len; idx++) { + var _a = this.objects[idx], ref = _a[0], object = _a[1]; + offsets[idx] = [ref.objectNumber, offset]; + offset += object.sizeInBytes() + 1; // '\n' + } + return offsets; + }; + PDFObjectStream.withContextAndObjects = function (context, objects, encode) { + if (encode === void 0) { encode = true; } + return new PDFObjectStream(context, objects, encode); + }; + return PDFObjectStream; +}(PDFFlateStream_1.default)); +exports.default = PDFObjectStream; +//# sourceMappingURL=PDFObjectStream.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFObjectStream.js.map b/cjs/core/structures/PDFObjectStream.js.map new file mode 100644 index 000000000..8217bfd5f --- /dev/null +++ b/cjs/core/structures/PDFObjectStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFObjectStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFObjectStream.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,2EAAmD;AAInD,4EAAgE;AAChE,0EAAkD;AAClD,qCAAuD;AAIvD;IAA8B,2CAAc;IAW1C,yBACE,OAAmB,EACnB,OAAyB,EACzB,MAAa;QAAb,uBAAA,EAAA,aAAa;QAHf,YAKE,kBAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,SAS/B;QAPC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,oBAAoB,EAAE,CAAC;QAC3C,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,oBAAoB,EAAE,CAAC;QAEjD,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,C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AAG,QAAA,EAAE,MAAM,QAAqB,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO;SAC5C;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IArFM,qCAAqB,GAAG,UAC7B,OAAmB,EACnB,OAAyB,EACzB,MAAa;QAAb,uBAAA,EAAA,aAAa;QACV,OAAA,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;IAA7C,CAA6C,CAAC;IAkFrD,sBAAC;CAAA,AAvFD,CAA8B,wBAAc,GAuF3C;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFPageLeaf.d.ts b/cjs/core/structures/PDFPageLeaf.d.ts new file mode 100644 index 000000000..bbb83706b --- /dev/null +++ b/cjs/core/structures/PDFPageLeaf.d.ts @@ -0,0 +1,55 @@ +import PDFArray from "../objects/PDFArray"; +import PDFDict, { DictMap } from "../objects/PDFDict"; +import PDFName from "../objects/PDFName"; +import PDFNumber from "../objects/PDFNumber"; +import PDFObject from "../objects/PDFObject"; +import PDFRef from "../objects/PDFRef"; +import PDFStream from "../objects/PDFStream"; +import PDFContext from "../PDFContext"; +import PDFPageTree from "./PDFPageTree"; +declare class PDFPageLeaf extends PDFDict { + static readonly InheritableEntries: string[]; + static withContextAndParent: (context: PDFContext, parent: PDFRef) => PDFPageLeaf; + static fromMapWithContext: (map: DictMap, context: PDFContext, autoNormalizeCTM?: boolean) => PDFPageLeaf; + private normalized; + private readonly autoNormalizeCTM; + private constructor(); + clone(context?: PDFContext): PDFPageLeaf; + Parent(): PDFPageTree | undefined; + Contents(): PDFStream | PDFArray | undefined; + Annots(): PDFArray | undefined; + BleedBox(): PDFArray | undefined; + TrimBox(): PDFArray | undefined; + ArtBox(): PDFArray | undefined; + Resources(): PDFDict | undefined; + MediaBox(): PDFArray; + CropBox(): PDFArray | undefined; + Rotate(): PDFNumber | undefined; + getInheritableAttribute(name: PDFName): PDFObject | undefined; + setParent(parentRef: PDFRef): void; + addContentStream(contentStreamRef: PDFRef): void; + wrapContentStreams(startStream: PDFRef, endStream: PDFRef): boolean; + addAnnot(annotRef: PDFRef): void; + removeAnnot(annotRef: PDFRef): void; + setFontDictionary(name: PDFName, fontDictRef: PDFRef): void; + newFontDictionaryKey(tag: string): PDFName; + newFontDictionary(tag: string, fontDictRef: PDFRef): PDFName; + setXObject(name: PDFName, xObjectRef: PDFRef): void; + newXObjectKey(tag: string): PDFName; + newXObject(tag: string, xObjectRef: PDFRef): PDFName; + setExtGState(name: PDFName, extGStateRef: PDFRef | PDFDict): void; + newExtGStateKey(tag: string): PDFName; + newExtGState(tag: string, extGStateRef: PDFRef | PDFDict): PDFName; + ascend(visitor: (node: PDFPageTree | PDFPageLeaf) => any): void; + normalize(): void; + normalizedEntries(): { + Annots: PDFArray; + Resources: PDFDict; + Contents: PDFArray | undefined; + Font: PDFDict; + XObject: PDFDict; + ExtGState: PDFDict; + }; +} +export default PDFPageLeaf; +//# sourceMappingURL=PDFPageLeaf.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFPageLeaf.d.ts.map b/cjs/core/structures/PDFPageLeaf.d.ts.map new file mode 100644 index 000000000..50c4a3a2b --- /dev/null +++ b/cjs/core/structures/PDFPageLeaf.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageLeaf.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFPageLeaf.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4BAAkC;AACjD,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAC5D,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AACnD,OAAO,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AiB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAM5D,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAKnD,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKnC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAMpD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAKjE,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKrC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAMlE,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,KAAK,GAAG,GAAG,IAAI;IAM/D,SAAS;IA6CT,iBAAiB;;;;;;;;CAclB;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFPageLeaf.js b/cjs/core/structures/PDFPageLeaf.js new file mode 100644 index 000000000..ac488e632 --- /dev/null +++ b/cjs/core/structures/PDFPageLeaf.js @@ -0,0 +1,206 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream")); +var PDFPageLeaf = /** @class */ (function (_super) { + tslib_1.__extends(PDFPageLeaf, _super); + function PDFPageLeaf(map, context, autoNormalizeCTM) { + if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; } + var _this = _super.call(this, map, context) || this; + _this.normalized = false; + _this.autoNormalizeCTM = autoNormalizeCTM; + return _this; + } + PDFPageLeaf.prototype.clone = function (context) { + var clone = PDFPageLeaf.fromMapWithContext(new Map(), context || this.context, this.autoNormalizeCTM); + var entries = this.entries(); + for (var idx = 0, len = entries.length; idx < len; idx++) { + var _a = entries[idx], key = _a[0], value = _a[1]; + clone.set(key, value); + } + return clone; + }; + PDFPageLeaf.prototype.Parent = function () { + return this.lookupMaybe(PDFName_1.default.Parent, PDFDict_1.default); + }; + PDFPageLeaf.prototype.Contents = function () { + return this.lookup(PDFName_1.default.of('Contents')); + }; + PDFPageLeaf.prototype.Annots = function () { + return this.lookupMaybe(PDFName_1.default.Annots, PDFArray_1.default); + }; + PDFPageLeaf.prototype.BleedBox = function () { + return this.lookupMaybe(PDFName_1.default.BleedBox, PDFArray_1.default); + }; + PDFPageLeaf.prototype.TrimBox = function () { + return this.lookupMaybe(PDFName_1.default.TrimBox, PDFArray_1.default); + }; + PDFPageLeaf.prototype.ArtBox = function () { + return this.lookupMaybe(PDFName_1.default.ArtBox, PDFArray_1.default); + }; + PDFPageLeaf.prototype.Resources = function () { + var dictOrRef = this.getInheritableAttribute(PDFName_1.default.Resources); + return this.context.lookupMaybe(dictOrRef, PDFDict_1.default); + }; + PDFPageLeaf.prototype.MediaBox = function () { + var arrayOrRef = this.getInheritableAttribute(PDFName_1.default.MediaBox); + return this.context.lookup(arrayOrRef, PDFArray_1.default); + }; + PDFPageLeaf.prototype.CropBox = function () { + var arrayOrRef = this.getInheritableAttribute(PDFName_1.default.CropBox); + return this.context.lookupMaybe(arrayOrRef, PDFArray_1.default); + }; + PDFPageLeaf.prototype.Rotate = function () { + var numberOrRef = this.getInheritableAttribute(PDFName_1.default.Rotate); + return this.context.lookupMaybe(numberOrRef, PDFNumber_1.default); + }; + PDFPageLeaf.prototype.getInheritableAttribute = function (name) { + var attribute; + this.ascend(function (node) { + if (!attribute) + attribute = node.get(name); + }); + return attribute; + }; + PDFPageLeaf.prototype.setParent = function (parentRef) { + this.set(PDFName_1.default.Parent, parentRef); + }; + PDFPageLeaf.prototype.addContentStream = function (contentStreamRef) { + var Contents = this.normalizedEntries().Contents || this.context.obj([]); + this.set(PDFName_1.default.Contents, Contents); + Contents.push(contentStreamRef); + }; + PDFPageLeaf.prototype.wrapContentStreams = function (startStream, endStream) { + var Contents = this.Contents(); + if (Contents instanceof PDFArray_1.default) { + Contents.insert(0, startStream); + Contents.push(endStream); + return true; + } + return false; + }; + PDFPageLeaf.prototype.addAnnot = function (annotRef) { + var Annots = this.normalizedEntries().Annots; + Annots.push(annotRef); + }; + PDFPageLeaf.prototype.removeAnnot = function (annotRef) { + var Annots = this.normalizedEntries().Annots; + var index = Annots.indexOf(annotRef); + if (index !== undefined) { + Annots.remove(index); + } + }; + PDFPageLeaf.prototype.setFontDictionary = function (name, fontDictRef) { + var Font = this.normalizedEntries().Font; + Font.set(name, fontDictRef); + }; + PDFPageLeaf.prototype.newFontDictionaryKey = function (tag) { + var Font = this.normalizedEntries().Font; + return Font.uniqueKey(tag); + }; + PDFPageLeaf.prototype.newFontDictionary = function (tag, fontDictRef) { + var key = this.newFontDictionaryKey(tag); + this.setFontDictionary(key, fontDictRef); + return key; + }; + PDFPageLeaf.prototype.setXObject = function (name, xObjectRef) { + var XObject = this.normalizedEntries().XObject; + XObject.set(name, xObjectRef); + }; + PDFPageLeaf.prototype.newXObjectKey = function (tag) { + var XObject = this.normalizedEntries().XObject; + return XObject.uniqueKey(tag); + }; + PDFPageLeaf.prototype.newXObject = function (tag, xObjectRef) { + var key = this.newXObjectKey(tag); + this.setXObject(key, xObjectRef); + return key; + }; + PDFPageLeaf.prototype.setExtGState = function (name, extGStateRef) { + var ExtGState = this.normalizedEntries().ExtGState; + ExtGState.set(name, extGStateRef); + }; + PDFPageLeaf.prototype.newExtGStateKey = function (tag) { + var ExtGState = this.normalizedEntries().ExtGState; + return ExtGState.uniqueKey(tag); + }; + PDFPageLeaf.prototype.newExtGState = function (tag, extGStateRef) { + var key = this.newExtGStateKey(tag); + this.setExtGState(key, extGStateRef); + return key; + }; + PDFPageLeaf.prototype.ascend = function (visitor) { + visitor(this); + var Parent = this.Parent(); + if (Parent) + Parent.ascend(visitor); + }; + PDFPageLeaf.prototype.normalize = function () { + if (this.normalized) + return; + var context = this.context; + var contentsRef = this.get(PDFName_1.default.Contents); + var contents = this.context.lookup(contentsRef); + if (contents instanceof PDFStream_1.default) { + this.set(PDFName_1.default.Contents, context.obj([contentsRef])); + } + if (this.autoNormalizeCTM) { + this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(), this.context.getPopGraphicsStateContentStream()); + } + // TODO: Clone `Resources` if it is inherited + var dictOrRef = this.getInheritableAttribute(PDFName_1.default.Resources); + var Resources = context.lookupMaybe(dictOrRef, PDFDict_1.default) || context.obj({}); + this.set(PDFName_1.default.Resources, Resources); + // TODO: Clone `Font` if it is inherited + var Font = Resources.lookupMaybe(PDFName_1.default.Font, PDFDict_1.default) || context.obj({}); + Resources.set(PDFName_1.default.Font, Font); + // TODO: Clone `XObject` if it is inherited + var XObject = Resources.lookupMaybe(PDFName_1.default.XObject, PDFDict_1.default) || context.obj({}); + Resources.set(PDFName_1.default.XObject, XObject); + // TODO: Clone `ExtGState` if it is inherited + var ExtGState = Resources.lookupMaybe(PDFName_1.default.ExtGState, PDFDict_1.default) || context.obj({}); + Resources.set(PDFName_1.default.ExtGState, ExtGState); + var Annots = this.Annots() || context.obj([]); + this.set(PDFName_1.default.Annots, Annots); + this.normalized = true; + }; + PDFPageLeaf.prototype.normalizedEntries = function () { + this.normalize(); + var Annots = this.Annots(); + var Resources = this.Resources(); + var Contents = this.Contents(); + return { + Annots: Annots, + Resources: Resources, + Contents: Contents, + Font: Resources.lookup(PDFName_1.default.Font, PDFDict_1.default), + XObject: Resources.lookup(PDFName_1.default.XObject, PDFDict_1.default), + ExtGState: Resources.lookup(PDFName_1.default.ExtGState, PDFDict_1.default), + }; + }; + PDFPageLeaf.InheritableEntries = [ + 'Resources', + 'MediaBox', + 'CropBox', + 'Rotate', + ]; + PDFPageLeaf.withContextAndParent = function (context, parent) { + var dict = new Map(); + dict.set(PDFName_1.default.Type, PDFName_1.default.Page); + dict.set(PDFName_1.default.Parent, parent); + dict.set(PDFName_1.default.Resources, context.obj({})); + dict.set(PDFName_1.default.MediaBox, context.obj([0, 0, 612, 792])); + return new PDFPageLeaf(dict, context, false); + }; + PDFPageLeaf.fromMapWithContext = function (map, context, autoNormalizeCTM) { + if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; } + return new PDFPageLeaf(map, context, autoNormalizeCTM); + }; + return PDFPageLeaf; +}(PDFDict_1.default)); +exports.default = PDFPageLeaf; +//# sourceMappingURL=PDFPageLeaf.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFPageLeaf.js.map b/cjs/core/structures/PDFPageLeaf.js.map new file mode 100644 index 000000000..518a762b6 --- /dev/null +++ b/cjs/core/structures/PDFPageLeaf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageLeaf.js","sourceRoot":"","sources":["../../../src/core/structures/PDFPageLeaf.ts"],"names":[],"mappings":";;;AAAA,yEAAiD;AACjD,uEAA4D;AAC5D,uEAA+C;AAC/C,2EAAmD;AAGnD,2EAAmD;AAInD;IAA0B,uCAAO;IA0B/B,qBACE,GAAY,EACZ,OAAmB,EACnB,gBAAuB;QAAvB,iCAAA,EAAA,uBAAuB;QAHzB,YAKE,kBAAM,GAAG,EAAE,OAAO,CAAC,SAEpB;QAVO,gBAAU,GAAG,KAAK,CAAC;QASzB,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;;IAC3C,CAAC;IAED,2BAAK,GAAL,UAAM,OAAoB;QACxB,IAAM,KAAK,GAAG,WAAW,CAAC,kBAAkB,CAC1C,IAAI,GAAG,EAAE,EACT,OAAO,IAAI,IAAI,CAAC,OAAO,EACvB,IAAI,CAAC,gBAAgB,CACtB,CAAC;QACF,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,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QACV,SAAS;QACT,QAAQ;KACT,CAAC;IAEK,gCAAoB,GAAG,UAAC,OAAmB,EAAE,MAAc;QAChE,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,iBAAO,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1D,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEK,8BAAkB,GAAG,UAC1B,GAAY,EACZ,OAAmB,EACnB,gBAAuB;QAAvB,iCAAA,EAAA,uBAAuB;QACpB,OAAA,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,CAAC;IAA/C,CAA+C,CAAC;IAqOvD,kBAAC;CAAA,AA1PD,CAA0B,iBAAO,GA0PhC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFPageTree.d.ts b/cjs/core/structures/PDFPageTree.d.ts new file mode 100644 index 000000000..e7525de8d --- /dev/null +++ b/cjs/core/structures/PDFPageTree.d.ts @@ -0,0 +1,42 @@ +import PDFArray from "../objects/PDFArray"; +import PDFDict, { DictMap } from "../objects/PDFDict"; +import PDFNumber from "../objects/PDFNumber"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFPageLeaf from "./PDFPageLeaf"; +export declare type TreeNode = PDFPageTree | PDFPageLeaf; +declare class PDFPageTree extends PDFDict { + static withContext: (context: PDFContext, parent?: PDFRef | undefined) => PDFPageTree; + static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFPageTree; + Parent(): PDFPageTree | undefined; + Kids(): PDFArray; + Count(): PDFNumber; + pushTreeNode(treeRef: PDFRef): void; + pushLeafNode(leafRef: PDFRef): void; + /** + * Inserts the given ref as a leaf node of this page tree at the specified + * index (zero-based). Also increments the `Count` of each page tree in the + * hierarchy to accomodate the new page. + * + * Returns the ref of the PDFPageTree node into which `leafRef` was inserted, + * or `undefined` if it was inserted into the root node (the PDFPageTree upon + * which the method was first called). + */ + insertLeafNode(leafRef: PDFRef, targetIndex: number): PDFRef | undefined; + /** + * Removes the leaf node at the specified index (zero-based) from this page + * tree. Also decrements the `Count` of each page tree in the hierarchy to + * account for the removed page. + * + * If `prune` is true, then intermediate tree nodes will be removed from the + * tree if they contain 0 children after the leaf node is removed. + */ + removeLeafNode(targetIndex: number, prune?: boolean): void; + ascend(visitor: (node: PDFPageTree) => any): void; + /** Performs a Post-Order traversal of this page tree */ + traverse(visitor: (node: TreeNode, ref: PDFRef) => any): void; + private insertLeafKid; + private removeKid; +} +export default PDFPageTree; +//# sourceMappingURL=PDFPageTree.d.ts.map \ No newline at end of file diff --git a/cjs/core/structures/PDFPageTree.d.ts.map b/cjs/core/structures/PDFPageTree.d.ts.map new file mode 100644 index 000000000..92b831bc6 --- /dev/null +++ b/cjs/core/structures/PDFPageTree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageTree.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFPageTree.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4BAAkC;AACjD,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAE5D,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAG1D,oBAAY,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;AAEjD,cAAM,WAAY,SAAQ,OAAO;IAC/B,MAAM,CAAC,WAAW,YAAa,UAAU,8CAOvC;IAEF,MAAM,CAAC,kBAAkB,0BAA2B,UAAU,iBAC9B;IAEhC,MAAM,IAAI,WAAW,GAAG,SAAS;IAIjC,IAAI,IAAI,QAAQ;IAIhB,KAAK,IAAI,SAAS;IAIlB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC;;;;;;;;OAQG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IA+CxE;;;;;;;OAOG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,UAAO,GAAG,IAAI;IAyCvD,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,GAAG,GAAG,IAAI;IAMjD,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI;IAU7D,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,SAAS;CAalB;AAED,eAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/structures/PDFPageTree.js b/cjs/core/structures/PDFPageTree.js new file mode 100644 index 000000000..28aade96f --- /dev/null +++ b/cjs/core/structures/PDFPageTree.js @@ -0,0 +1,177 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray")); +var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFPageLeaf_1 = tslib_1.__importDefault(require("./PDFPageLeaf")); +var errors_1 = require("../errors"); +var PDFPageTree = /** @class */ (function (_super) { + tslib_1.__extends(PDFPageTree, _super); + function PDFPageTree() { + return _super !== null && _super.apply(this, arguments) || this; + } + PDFPageTree.prototype.Parent = function () { + return this.lookup(PDFName_1.default.of('Parent')); + }; + PDFPageTree.prototype.Kids = function () { + return this.lookup(PDFName_1.default.of('Kids'), PDFArray_1.default); + }; + PDFPageTree.prototype.Count = function () { + return this.lookup(PDFName_1.default.of('Count'), PDFNumber_1.default); + }; + PDFPageTree.prototype.pushTreeNode = function (treeRef) { + var Kids = this.Kids(); + Kids.push(treeRef); + }; + PDFPageTree.prototype.pushLeafNode = function (leafRef) { + var Kids = this.Kids(); + this.insertLeafKid(Kids.size(), leafRef); + }; + /** + * Inserts the given ref as a leaf node of this page tree at the specified + * index (zero-based). Also increments the `Count` of each page tree in the + * hierarchy to accomodate the new page. + * + * Returns the ref of the PDFPageTree node into which `leafRef` was inserted, + * or `undefined` if it was inserted into the root node (the PDFPageTree upon + * which the method was first called). + */ + PDFPageTree.prototype.insertLeafNode = function (leafRef, targetIndex) { + var Kids = this.Kids(); + var Count = this.Count().asNumber(); + if (targetIndex > Count) { + throw new errors_1.InvalidTargetIndexError(targetIndex, Count); + } + var leafsRemainingUntilTarget = targetIndex; + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + if (leafsRemainingUntilTarget === 0) { + // Insert page and return + this.insertLeafKid(idx, leafRef); + return undefined; + } + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree) { + if (kid.Count().asNumber() > leafsRemainingUntilTarget) { + // Dig in + return (kid.insertLeafNode(leafRef, leafsRemainingUntilTarget) || kidRef); + } + else { + // Move on + leafsRemainingUntilTarget -= kid.Count().asNumber(); + } + } + if (kid instanceof PDFPageLeaf_1.default) { + // Move on + leafsRemainingUntilTarget -= 1; + } + } + if (leafsRemainingUntilTarget === 0) { + // Insert page at the end and return + this.insertLeafKid(Kids.size(), leafRef); + return undefined; + } + // Should never get here if `targetIndex` is valid + throw new errors_1.CorruptPageTreeError(targetIndex, 'insertLeafNode'); + }; + /** + * Removes the leaf node at the specified index (zero-based) from this page + * tree. Also decrements the `Count` of each page tree in the hierarchy to + * account for the removed page. + * + * If `prune` is true, then intermediate tree nodes will be removed from the + * tree if they contain 0 children after the leaf node is removed. + */ + PDFPageTree.prototype.removeLeafNode = function (targetIndex, prune) { + if (prune === void 0) { prune = true; } + var Kids = this.Kids(); + var Count = this.Count().asNumber(); + if (targetIndex >= Count) { + throw new errors_1.InvalidTargetIndexError(targetIndex, Count); + } + var leafsRemainingUntilTarget = targetIndex; + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree) { + if (kid.Count().asNumber() > leafsRemainingUntilTarget) { + // Dig in + kid.removeLeafNode(leafsRemainingUntilTarget, prune); + if (prune && kid.Kids().size() === 0) + Kids.remove(idx); + return; + } + else { + // Move on + leafsRemainingUntilTarget -= kid.Count().asNumber(); + } + } + if (kid instanceof PDFPageLeaf_1.default) { + if (leafsRemainingUntilTarget === 0) { + // Remove page and return + this.removeKid(idx); + return; + } + else { + // Move on + leafsRemainingUntilTarget -= 1; + } + } + } + // Should never get here if `targetIndex` is valid + throw new errors_1.CorruptPageTreeError(targetIndex, 'removeLeafNode'); + }; + PDFPageTree.prototype.ascend = function (visitor) { + visitor(this); + var Parent = this.Parent(); + if (Parent) + Parent.ascend(visitor); + }; + /** Performs a Post-Order traversal of this page tree */ + PDFPageTree.prototype.traverse = function (visitor) { + var Kids = this.Kids(); + for (var idx = 0, len = Kids.size(); idx < len; idx++) { + var kidRef = Kids.get(idx); + var kid = this.context.lookup(kidRef); + if (kid instanceof PDFPageTree) + kid.traverse(visitor); + visitor(kid, kidRef); + } + }; + PDFPageTree.prototype.insertLeafKid = function (kidIdx, leafRef) { + var Kids = this.Kids(); + this.ascend(function (node) { + var newCount = node.Count().asNumber() + 1; + node.set(PDFName_1.default.of('Count'), PDFNumber_1.default.of(newCount)); + }); + Kids.insert(kidIdx, leafRef); + }; + PDFPageTree.prototype.removeKid = function (kidIdx) { + var Kids = this.Kids(); + var kid = Kids.lookup(kidIdx); + if (kid instanceof PDFPageLeaf_1.default) { + this.ascend(function (node) { + var newCount = node.Count().asNumber() - 1; + node.set(PDFName_1.default.of('Count'), PDFNumber_1.default.of(newCount)); + }); + } + Kids.remove(kidIdx); + }; + PDFPageTree.withContext = function (context, parent) { + var dict = new Map(); + dict.set(PDFName_1.default.of('Type'), PDFName_1.default.of('Pages')); + dict.set(PDFName_1.default.of('Kids'), context.obj([])); + dict.set(PDFName_1.default.of('Count'), context.obj(0)); + if (parent) + dict.set(PDFName_1.default.of('Parent'), parent); + return new PDFPageTree(dict, context); + }; + PDFPageTree.fromMapWithContext = function (map, context) { + return new PDFPageTree(map, context); + }; + return PDFPageTree; +}(PDFDict_1.default)); +exports.default = PDFPageTree; +//# sourceMappingURL=PDFPageTree.js.map \ No newline at end of file diff --git a/cjs/core/structures/PDFPageTree.js.map b/cjs/core/structures/PDFPageTree.js.map new file mode 100644 index 000000000..24dd43d78 --- /dev/null +++ b/cjs/core/structures/PDFPageTree.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFPageTree.js","sourceRoot":"","sources":["../../../src/core/structures/PDFPageTree.ts"],"names":[],"mappings":";;;AAAA,yEAAiD;AACjD,uEAA4D;AAC5D,uEAA+C;AAC/C,2EAAmD;AAGnD,sEAA0D;AAC1D,oCAAgF;AAIhF;IAA0B,uCAAO;IAAjC;;IAqLA,CAAC;IAxKC,4BAAM,GAAN;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAA4B,CAAC;IACtE,CAAC;IAED,0BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,kBAAQ,CAAC,CAAC;IACn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I,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAnLM,uBAAW,GAAG,UAAC,OAAmB,EAAE,MAAe;QACxD,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAI,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QACnD,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC;IAEK,8BAAkB,GAAG,UAAC,GAAY,EAAE,OAAmB;QAC5D,OAAA,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC;IAA7B,CAA6B,CAAC;IA0KlC,kBAAC;CAAA,AArLD,CAA0B,iBAAO,GAqLhC;AAED,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/CharCodes.d.ts b/cjs/core/syntax/CharCodes.d.ts new file mode 100644 index 000000000..5b3b968df --- /dev/null +++ b/cjs/core/syntax/CharCodes.d.ts @@ -0,0 +1,62 @@ +declare enum CharCodes { + Null = 0, + Backspace = 8, + Tab = 9, + Newline = 10, + FormFeed = 12, + CarriageReturn = 13, + Space = 32, + ExclamationPoint = 33, + Hash = 35, + Percent = 37, + LeftParen = 40, + RightParen = 41, + Plus = 43, + Minus = 45, + Dash = 45, + Period = 46, + ForwardSlash = 47, + Zero = 48, + One = 49, + Two = 50, + Three = 51, + Four = 52, + Five = 53, + Six = 54, + Seven = 55, + Eight = 56, + Nine = 57, + LessThan = 60, + GreaterThan = 62, + A = 65, + D = 68, + E = 69, + F = 70, + O = 79, + P = 80, + R = 82, + LeftSquareBracket = 91, + BackSlash = 92, + RightSquareBracket = 93, + a = 97, + b = 98, + d = 100, + e = 101, + f = 102, + i = 105, + j = 106, + l = 108, + m = 109, + n = 110, + o = 111, + r = 114, + s = 115, + t = 116, + u = 117, + x = 120, + LeftCurly = 123, + RightCurly = 125, + Tilde = 126 +} +export default CharCodes; +//# sourceMappingURL=CharCodes.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/CharCodes.d.ts.map b/cjs/core/syntax/CharCodes.d.ts.map new file mode 100644 index 000000000..9048a4494 --- /dev/null +++ b/cjs/core/syntax/CharCodes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"CharCodes.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/CharCodes.ts"],"names":[],"mappings":"AAAA,aAAK,SAAS;IACZ,IAAI,IAAI;IACR,SAAS,IAAI;IACb,GAAG,IAAI;IACP,OAAO,KAAK;IACZ,QAAQ,KAAK;IACb,cAAc,KAAK;IACnB,KAAK,KAAK;IACV,gBAAgB,KAAK;IACrB,IAAI,KAAK;IACT,OAAO,KAAK;IACZ,SAAS,KAAK;IACd,UAAU,KAAK;IACf,IAAI,KAAK;IACT,KAAK,KAAK;IACV,IAAI,KAAK;IACT,MAAM,KAAK;IACX,YAAY,KAAK;IACjB,IAAI,KAAK;IACT,GAAG,KAAK;IACR,GAAG,KAAK;IACR,KAAK,KAAK;IACV,IAAI,KAAK;IACT,IAAI,KAAK;IACT,GAAG,KAAK;IACR,KAAK,KAAK;IACV,KAAK,KAAK;IACV,IAAI,KAAK;IACT,QAAQ,KAAK;IACb,WAAW,KAAK;IAChB,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,iBAAiB,KAAK;IACtB,SAAS,KAAK;IACd,kBAAkB,KAAK;IACvB,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,SAAS,MAAM;IACf,UAAU,MAAM;IAChB,KAAK,MAAM;CACZ;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/CharCodes.js b/cjs/core/syntax/CharCodes.js new file mode 100644 index 000000000..d38263387 --- /dev/null +++ b/cjs/core/syntax/CharCodes.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var CharCodes; +(function (CharCodes) { + CharCodes[CharCodes["Null"] = 0] = "Null"; + CharCodes[CharCodes["Backspace"] = 8] = "Backspace"; + CharCodes[CharCodes["Tab"] = 9] = "Tab"; + CharCodes[CharCodes["Newline"] = 10] = "Newline"; + CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed"; + CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn"; + CharCodes[CharCodes["Space"] = 32] = "Space"; + CharCodes[CharCodes["ExclamationPoint"] = 33] = "ExclamationPoint"; + CharCodes[CharCodes["Hash"] = 35] = "Hash"; + CharCodes[CharCodes["Percent"] = 37] = "Percent"; + CharCodes[CharCodes["LeftParen"] = 40] = "LeftParen"; + CharCodes[CharCodes["RightParen"] = 41] = "RightParen"; + CharCodes[CharCodes["Plus"] = 43] = "Plus"; + CharCodes[CharCodes["Minus"] = 45] = "Minus"; + CharCodes[CharCodes["Dash"] = 45] = "Dash"; + CharCodes[CharCodes["Period"] = 46] = "Period"; + CharCodes[CharCodes["ForwardSlash"] = 47] = "ForwardSlash"; + CharCodes[CharCodes["Zero"] = 48] = "Zero"; + CharCodes[CharCodes["One"] = 49] = "One"; + CharCodes[CharCodes["Two"] = 50] = "Two"; + CharCodes[CharCodes["Three"] = 51] = "Three"; + CharCodes[CharCodes["Four"] = 52] = "Four"; + CharCodes[CharCodes["Five"] = 53] = "Five"; + CharCodes[CharCodes["Six"] = 54] = "Six"; + CharCodes[CharCodes["Seven"] = 55] = "Seven"; + CharCodes[CharCodes["Eight"] = 56] = "Eight"; + CharCodes[CharCodes["Nine"] = 57] = "Nine"; + CharCodes[CharCodes["LessThan"] = 60] = "LessThan"; + CharCodes[CharCodes["GreaterThan"] = 62] = "GreaterThan"; + CharCodes[CharCodes["A"] = 65] = "A"; + CharCodes[CharCodes["D"] = 68] = "D"; + CharCodes[CharCodes["E"] = 69] = "E"; + CharCodes[CharCodes["F"] = 70] = "F"; + CharCodes[CharCodes["O"] = 79] = "O"; + CharCodes[CharCodes["P"] = 80] = "P"; + CharCodes[CharCodes["R"] = 82] = "R"; + CharCodes[CharCodes["LeftSquareBracket"] = 91] = "LeftSquareBracket"; + CharCodes[CharCodes["BackSlash"] = 92] = "BackSlash"; + CharCodes[CharCodes["RightSquareBracket"] = 93] = "RightSquareBracket"; + CharCodes[CharCodes["a"] = 97] = "a"; + CharCodes[CharCodes["b"] = 98] = "b"; + CharCodes[CharCodes["d"] = 100] = "d"; + CharCodes[CharCodes["e"] = 101] = "e"; + CharCodes[CharCodes["f"] = 102] = "f"; + CharCodes[CharCodes["i"] = 105] = "i"; + CharCodes[CharCodes["j"] = 106] = "j"; + CharCodes[CharCodes["l"] = 108] = "l"; + CharCodes[CharCodes["m"] = 109] = "m"; + CharCodes[CharCodes["n"] = 110] = "n"; + CharCodes[CharCodes["o"] = 111] = "o"; + CharCodes[CharCodes["r"] = 114] = "r"; + CharCodes[CharCodes["s"] = 115] = "s"; + CharCodes[CharCodes["t"] = 116] = "t"; + CharCodes[CharCodes["u"] = 117] = "u"; + CharCodes[CharCodes["x"] = 120] = "x"; + CharCodes[CharCodes["LeftCurly"] = 123] = "LeftCurly"; + CharCodes[CharCodes["RightCurly"] = 125] = "RightCurly"; + CharCodes[CharCodes["Tilde"] = 126] = "Tilde"; +})(CharCodes || (CharCodes = {})); +exports.default = CharCodes; +//# sourceMappingURL=CharCodes.js.map \ No newline at end of file diff --git a/cjs/core/syntax/CharCodes.js.map b/cjs/core/syntax/CharCodes.js.map new file mode 100644 index 000000000..cc437e3a6 --- /dev/null +++ b/cjs/core/syntax/CharCodes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CharCodes.js","sourceRoot":"","sources":["../../../src/core/syntax/CharCodes.ts"],"names":[],"mappings":";;AAAA,IAAK,SA2DJ;AA3DD,WAAK,SAAS;IACZ,yCAAQ,CAAA;IACR,mDAAa,CAAA;IACb,uCAAO,CAAA;IACP,gDAAY,CAAA;IACZ,kDAAa,CAAA;IACb,8DAAmB,CAAA;IACnB,4CAAU,CAAA;IACV,kEAAqB,CAAA;IACrB,0CAAS,CAAA;IACT,gDAAY,CAAA;IACZ,oDAAc,CAAA;IACd,sDAAe,CAAA;IACf,0CAAS,CAAA;IACT,4CAAU,CAAA;IACV,0CAAS,CAAA;IACT,8CAAW,CAAA;IACX,0DAAiB,CAAA;IACjB,0CAAS,CAAA;IACT,wCAAQ,CAAA;IACR,wCAAQ,CAAA;IACR,4CAAU,CAAA;IACV,0CAAS,CAAA;IACT,0CAAS,CAAA;IACT,wCAAQ,CAAA;IACR,4CAAU,CAAA;IACV,4CAAU,CAAA;IACV,0CAAS,CAAA;IACT,kDAAa,CAAA;IACb,wDAAgB,CAAA;IAChB,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,oEAAsB,CAAA;IACtB,oDAAc,CAAA;IACd,sEAAuB,CAAA;IACvB,oCAAM,CAAA;IACN,oCAAM,CAAA;IACN,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qCAAO,CAAA;IACP,qDAAe,CAAA;IACf,uDAAgB,CAAA;IAChB,6CAAW,CAAA;AACb,CAAC,EA3DI,SAAS,KAAT,SAAS,QA2Db;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Delimiters.d.ts b/cjs/core/syntax/Delimiters.d.ts new file mode 100644 index 000000000..5f7dac327 --- /dev/null +++ b/cjs/core/syntax/Delimiters.d.ts @@ -0,0 +1,2 @@ +export declare const IsDelimiter: Uint8Array; +//# sourceMappingURL=Delimiters.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/Delimiters.d.ts.map b/cjs/core/syntax/Delimiters.d.ts.map new file mode 100644 index 000000000..467b6a7fe --- /dev/null +++ b/cjs/core/syntax/Delimiters.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Delimiters.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/Delimiters.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,YAAsB,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Delimiters.js b/cjs/core/syntax/Delimiters.js new file mode 100644 index 000000000..fa5fffa95 --- /dev/null +++ b/cjs/core/syntax/Delimiters.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsDelimiter = void 0; +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("./CharCodes")); +exports.IsDelimiter = new Uint8Array(256); +exports.IsDelimiter[CharCodes_1.default.LeftParen] = 1; +exports.IsDelimiter[CharCodes_1.default.RightParen] = 1; +exports.IsDelimiter[CharCodes_1.default.LessThan] = 1; +exports.IsDelimiter[CharCodes_1.default.GreaterThan] = 1; +exports.IsDelimiter[CharCodes_1.default.LeftSquareBracket] = 1; +exports.IsDelimiter[CharCodes_1.default.RightSquareBracket] = 1; +exports.IsDelimiter[CharCodes_1.default.LeftCurly] = 1; +exports.IsDelimiter[CharCodes_1.default.RightCurly] = 1; +exports.IsDelimiter[CharCodes_1.default.ForwardSlash] = 1; +exports.IsDelimiter[CharCodes_1.default.Percent] = 1; +//# sourceMappingURL=Delimiters.js.map \ No newline at end of file diff --git a/cjs/core/syntax/Delimiters.js.map b/cjs/core/syntax/Delimiters.js.map new file mode 100644 index 000000000..c533d5c98 --- /dev/null +++ b/cjs/core/syntax/Delimiters.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Delimiters.js","sourceRoot":"","sources":["../../../src/core/syntax/Delimiters.ts"],"names":[],"mappings":";;;;AAAA,kEAAkD;AAErC,QAAA,WAAW,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAE/C,mBAAW,CAAC,mBAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AACrC,mBAAW,CAAC,mBAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACtC,mBAAW,CAAC,mBAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACpC,mBAAW,CAAC,mBAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AACvC,mBAAW,CAAC,mBAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAC7C,mBAAW,CAAC,mBAAS,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAC9C,mBAAW,CAAC,mBAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AACrC,mBAAW,CAAC,mBAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACtC,mBAAW,CAAC,mBAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACxC,mBAAW,CAAC,mBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Irregular.d.ts b/cjs/core/syntax/Irregular.d.ts new file mode 100644 index 000000000..2be059f2f --- /dev/null +++ b/cjs/core/syntax/Irregular.d.ts @@ -0,0 +1,2 @@ +export declare const IsIrregular: Uint8Array; +//# sourceMappingURL=Irregular.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/Irregular.d.ts.map b/cjs/core/syntax/Irregular.d.ts.map new file mode 100644 index 000000000..850858123 --- /dev/null +++ b/cjs/core/syntax/Irregular.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Irregular.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/Irregular.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,YAAsB,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Irregular.js b/cjs/core/syntax/Irregular.js new file mode 100644 index 000000000..743c34caf --- /dev/null +++ b/cjs/core/syntax/Irregular.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsIrregular = void 0; +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("./CharCodes")); +var Delimiters_1 = require("./Delimiters"); +var Whitespace_1 = require("./Whitespace"); +exports.IsIrregular = new Uint8Array(256); +for (var idx = 0, len = 256; idx < len; idx++) { + exports.IsIrregular[idx] = Whitespace_1.IsWhitespace[idx] || Delimiters_1.IsDelimiter[idx] ? 1 : 0; +} +exports.IsIrregular[CharCodes_1.default.Hash] = 1; +//# sourceMappingURL=Irregular.js.map \ No newline at end of file diff --git a/cjs/core/syntax/Irregular.js.map b/cjs/core/syntax/Irregular.js.map new file mode 100644 index 000000000..d10c7c32d --- /dev/null +++ b/cjs/core/syntax/Irregular.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Irregular.js","sourceRoot":"","sources":["../../../src/core/syntax/Irregular.ts"],"names":[],"mappings":";;;;AAAA,kEAAkD;AAClD,2CAAyD;AACzD,2CAA0D;AAE7C,QAAA,WAAW,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAE/C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;IAC7C,mBAAW,CAAC,GAAG,CAAC,GAAG,yBAAY,CAAC,GAAG,CAAC,IAAI,wBAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClE;AACD,mBAAW,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Keywords.d.ts b/cjs/core/syntax/Keywords.d.ts new file mode 100644 index 000000000..8ad0a70ac --- /dev/null +++ b/cjs/core/syntax/Keywords.d.ts @@ -0,0 +1,23 @@ +import CharCodes from "./CharCodes"; +export declare const Keywords: { + header: CharCodes[]; + eof: CharCodes[]; + obj: CharCodes[]; + endobj: CharCodes[]; + xref: CharCodes[]; + trailer: CharCodes[]; + startxref: CharCodes[]; + true: CharCodes[]; + false: CharCodes[]; + null: CharCodes[]; + stream: CharCodes[]; + streamEOF1: CharCodes[]; + streamEOF2: CharCodes[]; + streamEOF3: CharCodes[]; + streamEOF4: CharCodes[]; + endstream: CharCodes[]; + EOF1endstream: CharCodes[]; + EOF2endstream: CharCodes[]; + EOF3endstream: CharCodes[]; +}; +//# sourceMappingURL=Keywords.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/Keywords.d.ts.map b/cjs/core/syntax/Keywords.d.ts.map new file mode 100644 index 000000000..1a9691307 --- /dev/null +++ b/cjs/core/syntax/Keywords.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Keywords.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/Keywords.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,oBAAkC;AAyBlD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;CAyDpB,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Keywords.js b/cjs/core/syntax/Keywords.js new file mode 100644 index 000000000..985d6b88b --- /dev/null +++ b/cjs/core/syntax/Keywords.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Keywords = void 0; +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("./CharCodes")); +var Space = CharCodes_1.default.Space, CarriageReturn = CharCodes_1.default.CarriageReturn, Newline = CharCodes_1.default.Newline; +var stream = [ + CharCodes_1.default.s, + CharCodes_1.default.t, + CharCodes_1.default.r, + CharCodes_1.default.e, + CharCodes_1.default.a, + CharCodes_1.default.m, +]; +var endstream = [ + CharCodes_1.default.e, + CharCodes_1.default.n, + CharCodes_1.default.d, + CharCodes_1.default.s, + CharCodes_1.default.t, + CharCodes_1.default.r, + CharCodes_1.default.e, + CharCodes_1.default.a, + CharCodes_1.default.m, +]; +exports.Keywords = { + header: [ + CharCodes_1.default.Percent, + CharCodes_1.default.P, + CharCodes_1.default.D, + CharCodes_1.default.F, + CharCodes_1.default.Dash, + ], + eof: [ + CharCodes_1.default.Percent, + CharCodes_1.default.Percent, + CharCodes_1.default.E, + CharCodes_1.default.O, + CharCodes_1.default.F, + ], + obj: [CharCodes_1.default.o, CharCodes_1.default.b, CharCodes_1.default.j], + endobj: [ + CharCodes_1.default.e, + CharCodes_1.default.n, + CharCodes_1.default.d, + CharCodes_1.default.o, + CharCodes_1.default.b, + CharCodes_1.default.j, + ], + xref: [CharCodes_1.default.x, CharCodes_1.default.r, CharCodes_1.default.e, CharCodes_1.default.f], + trailer: [ + CharCodes_1.default.t, + CharCodes_1.default.r, + CharCodes_1.default.a, + CharCodes_1.default.i, + CharCodes_1.default.l, + CharCodes_1.default.e, + CharCodes_1.default.r, + ], + startxref: [ + CharCodes_1.default.s, + CharCodes_1.default.t, + CharCodes_1.default.a, + CharCodes_1.default.r, + CharCodes_1.default.t, + CharCodes_1.default.x, + CharCodes_1.default.r, + CharCodes_1.default.e, + CharCodes_1.default.f, + ], + true: [CharCodes_1.default.t, CharCodes_1.default.r, CharCodes_1.default.u, CharCodes_1.default.e], + false: [CharCodes_1.default.f, CharCodes_1.default.a, CharCodes_1.default.l, CharCodes_1.default.s, CharCodes_1.default.e], + null: [CharCodes_1.default.n, CharCodes_1.default.u, CharCodes_1.default.l, CharCodes_1.default.l], + stream: stream, + streamEOF1: tslib_1.__spreadArrays(stream, [Space, CarriageReturn, Newline]), + streamEOF2: tslib_1.__spreadArrays(stream, [CarriageReturn, Newline]), + streamEOF3: tslib_1.__spreadArrays(stream, [CarriageReturn]), + streamEOF4: tslib_1.__spreadArrays(stream, [Newline]), + endstream: endstream, + EOF1endstream: tslib_1.__spreadArrays([CarriageReturn, Newline], endstream), + EOF2endstream: tslib_1.__spreadArrays([CarriageReturn], endstream), + EOF3endstream: tslib_1.__spreadArrays([Newline], endstream), +}; +//# sourceMappingURL=Keywords.js.map \ No newline at end of file diff --git a/cjs/core/syntax/Keywords.js.map b/cjs/core/syntax/Keywords.js.map new file mode 100644 index 000000000..2a99f5e27 --- /dev/null +++ b/cjs/core/syntax/Keywords.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Keywords.js","sourceRoot":"","sources":["../../../src/core/syntax/Keywords.ts"],"names":[],"mappings":";;;;AAAA,kEAAkD;AAE1C,IAAA,KAAK,GAA8B,mBAAS,MAAvC,EAAE,cAAc,GAAc,mBAAS,eAAvB,EAAE,OAAO,GAAK,mBAAS,QAAd,CAAe;AAErD,IAAM,MAAM,GAAG;IACb,mBAAS,CAAC,CAAC;IACX,mBAAS,CAAC,CAAC;IACX,mBAAS,CAAC,CAAC;IACX,mBAAS,CAAC,CAAC;IACX,mBAAS,CAAC,CAAC;IACX,mBAAS,CAAC,CAAC;CACZ,CAAC;AAEF,IAAM,SAAS,GAAG;IAChB,mBA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C;QACX,mBAAS,CAAC,CAAC;QACX,mBAAS,CAAC,CAAC;QACX,mBAAS,CAAC,CAAC;QACX,mBAAS,CAAC,CAAC;QACX,mBAAS,CAAC,CAAC;KACZ;IACD,IAAI,EAAE,CAAC,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,CAAC,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,CAAC;IACxE,IAAI,EAAE,CAAC,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,EAAE,mBAAS,CAAC,CAAC,CAAC;IAC1D,MAAM,QAAA;IACN,UAAU,yBAAM,MAAM,GAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAC;IACvD,UAAU,yBAAM,MAAM,GAAE,cAAc,EAAE,OAAO,EAAC;IAChD,UAAU,yBAAM,MAAM,GAAE,cAAc,EAAC;IACvC,UAAU,yBAAM,MAAM,GAAE,OAAO,EAAC;IAChC,SAAS,WAAA;IACT,aAAa,0BAAG,cAAc,EAAE,OAAO,GAAK,SAAS,CAAC;IACtD,aAAa,0BAAG,cAAc,GAAK,SAAS,CAAC;IAC7C,aAAa,0BAAG,OAAO,GAAK,SAAS,CAAC;CACvC,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Numeric.d.ts b/cjs/core/syntax/Numeric.d.ts new file mode 100644 index 000000000..f443e1d19 --- /dev/null +++ b/cjs/core/syntax/Numeric.d.ts @@ -0,0 +1,4 @@ +export declare const IsDigit: Uint8Array; +export declare const IsNumericPrefix: Uint8Array; +export declare const IsNumeric: Uint8Array; +//# sourceMappingURL=Numeric.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/Numeric.d.ts.map b/cjs/core/syntax/Numeric.d.ts.map new file mode 100644 index 000000000..f0b1f950f --- /dev/null +++ b/cjs/core/syntax/Numeric.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Numeric.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/Numeric.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,YAAsB,CAAC;AAa3C,eAAO,MAAM,eAAe,YAAsB,CAAC;AAMnD,eAAO,MAAM,SAAS,YAAsB,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Numeric.js b/cjs/core/syntax/Numeric.js new file mode 100644 index 000000000..b32f586dd --- /dev/null +++ b/cjs/core/syntax/Numeric.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsNumeric = exports.IsNumericPrefix = exports.IsDigit = void 0; +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("./CharCodes")); +exports.IsDigit = new Uint8Array(256); +exports.IsDigit[CharCodes_1.default.Zero] = 1; +exports.IsDigit[CharCodes_1.default.One] = 1; +exports.IsDigit[CharCodes_1.default.Two] = 1; +exports.IsDigit[CharCodes_1.default.Three] = 1; +exports.IsDigit[CharCodes_1.default.Four] = 1; +exports.IsDigit[CharCodes_1.default.Five] = 1; +exports.IsDigit[CharCodes_1.default.Six] = 1; +exports.IsDigit[CharCodes_1.default.Seven] = 1; +exports.IsDigit[CharCodes_1.default.Eight] = 1; +exports.IsDigit[CharCodes_1.default.Nine] = 1; +exports.IsNumericPrefix = new Uint8Array(256); +exports.IsNumericPrefix[CharCodes_1.default.Period] = 1; +exports.IsNumericPrefix[CharCodes_1.default.Plus] = 1; +exports.IsNumericPrefix[CharCodes_1.default.Minus] = 1; +exports.IsNumeric = new Uint8Array(256); +for (var idx = 0, len = 256; idx < len; idx++) { + exports.IsNumeric[idx] = exports.IsDigit[idx] || exports.IsNumericPrefix[idx] ? 1 : 0; +} +//# sourceMappingURL=Numeric.js.map \ No newline at end of file diff --git a/cjs/core/syntax/Numeric.js.map b/cjs/core/syntax/Numeric.js.map new file mode 100644 index 000000000..d033eec59 --- /dev/null +++ b/cjs/core/syntax/Numeric.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Numeric.js","sourceRoot":"","sources":["../../../src/core/syntax/Numeric.ts"],"names":[],"mappings":";;;;AAAA,kEAAkD;AAErC,QAAA,OAAO,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAE3C,eAAO,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,eAAO,CAAC,mBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3B,eAAO,CAAC,mBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3B,eAAO,CAAC,mBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,eAAO,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,eAAO,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,eAAO,CAAC,mBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3B,eAAO,CAAC,mBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,eAAO,CAAC,mBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,eAAO,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEf,QAAA,eAAe,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAEnD,uBAAe,CAAC,mBAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACtC,uBAAe,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC,uBAAe,CAAC,mBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAExB,QAAA,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAE7C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;IAC7C,iBAAS,CAAC,GAAG,CAAC,GAAG,eAAO,CAAC,GAAG,CAAC,IAAI,uBAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D"} \ No newline at end of file diff --git a/cjs/core/syntax/Whitespace.d.ts b/cjs/core/syntax/Whitespace.d.ts new file mode 100644 index 000000000..5391d5d5c --- /dev/null +++ b/cjs/core/syntax/Whitespace.d.ts @@ -0,0 +1,2 @@ +export declare const IsWhitespace: Uint8Array; +//# sourceMappingURL=Whitespace.d.ts.map \ No newline at end of file diff --git a/cjs/core/syntax/Whitespace.d.ts.map b/cjs/core/syntax/Whitespace.d.ts.map new file mode 100644 index 000000000..c3b242d50 --- /dev/null +++ b/cjs/core/syntax/Whitespace.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Whitespace.d.ts","sourceRoot":"","sources":["../../../src/core/syntax/Whitespace.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,YAAsB,CAAC"} \ No newline at end of file diff --git a/cjs/core/syntax/Whitespace.js b/cjs/core/syntax/Whitespace.js new file mode 100644 index 000000000..cdace73d4 --- /dev/null +++ b/cjs/core/syntax/Whitespace.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsWhitespace = void 0; +var tslib_1 = require("tslib"); +var CharCodes_1 = tslib_1.__importDefault(require("./CharCodes")); +exports.IsWhitespace = new Uint8Array(256); +exports.IsWhitespace[CharCodes_1.default.Null] = 1; +exports.IsWhitespace[CharCodes_1.default.Tab] = 1; +exports.IsWhitespace[CharCodes_1.default.Newline] = 1; +exports.IsWhitespace[CharCodes_1.default.FormFeed] = 1; +exports.IsWhitespace[CharCodes_1.default.CarriageReturn] = 1; +exports.IsWhitespace[CharCodes_1.default.Space] = 1; +//# sourceMappingURL=Whitespace.js.map \ No newline at end of file diff --git a/cjs/core/syntax/Whitespace.js.map b/cjs/core/syntax/Whitespace.js.map new file mode 100644 index 000000000..45b575516 --- /dev/null +++ b/cjs/core/syntax/Whitespace.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Whitespace.js","sourceRoot":"","sources":["../../../src/core/syntax/Whitespace.ts"],"names":[],"mappings":";;;;AAAA,kEAAkD;AAErC,QAAA,YAAY,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAEhD,oBAAY,CAAC,mBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,oBAAY,CAAC,mBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChC,oBAAY,CAAC,mBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACpC,oBAAY,CAAC,mBAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrC,oBAAY,CAAC,mBAAS,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AAC3C,oBAAY,CAAC,mBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/core/writers/PDFStreamWriter.d.ts b/cjs/core/writers/PDFStreamWriter.d.ts new file mode 100644 index 000000000..f65e04e47 --- /dev/null +++ b/cjs/core/writers/PDFStreamWriter.d.ts @@ -0,0 +1,20 @@ +import PDFHeader from "../document/PDFHeader"; +import PDFTrailer from "../document/PDFTrailer"; +import PDFObject from "../objects/PDFObject"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +import PDFWriter from "./PDFWriter"; +declare class PDFStreamWriter extends PDFWriter { + static forContext: (context: PDFContext, objectsPerTick: number, encodeStreams?: boolean, objectsPerStream?: number) => PDFStreamWriter; + private readonly encodeStreams; + private readonly objectsPerStream; + private constructor(); + protected computeBufferSize(): Promise<{ + size: number; + header: PDFHeader; + indirectObjects: [PDFRef, PDFObject][]; + trailer: PDFTrailer; + }>; +} +export default PDFStreamWriter; +//# sourceMappingURL=PDFStreamWriter.d.ts.map \ No newline at end of file diff --git a/cjs/core/writers/PDFStreamWriter.d.ts.map b/cjs/core/writers/PDFStreamWriter.d.ts.map new file mode 100644 index 000000000..40ed18302 --- /dev/null +++ b/cjs/core/writers/PDFStreamWriter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFStreamWriter.d.ts","sourceRoot":"","sources":["../../../src/core/writers/PDFStreamWriter.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,8BAAoC;AACpD,OAAO,UAAU,+BAAqC;AAItD,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAE7C,OAAO,UAAU,sBAA4B;AAG7C,OAAO,SAAS,oBAAmC;AAGnD,cAAM,eAAgB,SAAQ,SAAS;IACrC,MAAM,CAAC,UAAU,YACN,UAAU,kBACH,MAAM,yEASpB;IAEJ,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAE1C,OAAO;cAYS,iBAAiB;;;;;;CA6ElC;AAED,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/writers/PDFStreamWriter.js b/cjs/core/writers/PDFStreamWriter.js new file mode 100644 index 000000000..c9a737f69 --- /dev/null +++ b/cjs/core/writers/PDFStreamWriter.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFHeader_1 = tslib_1.__importDefault(require("../document/PDFHeader")); +var PDFTrailer_1 = tslib_1.__importDefault(require("../document/PDFTrailer")); +var PDFInvalidObject_1 = tslib_1.__importDefault(require("../objects/PDFInvalidObject")); +var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName")); +var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber")); +var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef")); +var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream")); +var PDFCrossRefStream_1 = tslib_1.__importDefault(require("../structures/PDFCrossRefStream")); +var PDFObjectStream_1 = tslib_1.__importDefault(require("../structures/PDFObjectStream")); +var PDFWriter_1 = tslib_1.__importDefault(require("./PDFWriter")); +var utils_1 = require("../../utils"); +var PDFStreamWriter = /** @class */ (function (_super) { + tslib_1.__extends(PDFStreamWriter, _super); + function PDFStreamWriter(context, objectsPerTick, encodeStreams, objectsPerStream) { + var _this = _super.call(this, context, objectsPerTick) || this; + _this.encodeStreams = encodeStreams; + _this.objectsPerStream = objectsPerStream; + return _this; + } + PDFStreamWriter.prototype.computeBufferSize = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var objectNumber, header, size, xrefStream, uncompressedObjects, compressedObjects, objectStreamRefs, indirectObjects, idx, len, indirectObject, ref, object, shouldNotCompress, chunk, objectStreamRef, idx, len, chunk, ref, objectStream, xrefStreamRef, xrefOffset, trailer; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + objectNumber = this.context.largestObjectNumber + 1; + header = PDFHeader_1.default.forVersion(1, 7); + size = header.sizeInBytes() + 2; + xrefStream = PDFCrossRefStream_1.default.create(this.createTrailerDict(), this.encodeStreams); + uncompressedObjects = []; + compressedObjects = []; + objectStreamRefs = []; + indirectObjects = this.context.enumerateIndirectObjects(); + idx = 0, len = indirectObjects.length; + _a.label = 1; + case 1: + if (!(idx < len)) return [3 /*break*/, 6]; + indirectObject = indirectObjects[idx]; + ref = indirectObject[0], object = indirectObject[1]; + shouldNotCompress = ref === this.context.trailerInfo.Encrypt || + object instanceof PDFStream_1.default || + object instanceof PDFInvalidObject_1.default || + ref.generationNumber !== 0; + if (!shouldNotCompress) return [3 /*break*/, 4]; + uncompressedObjects.push(indirectObject); + xrefStream.addUncompressedEntry(ref, size); + size += this.computeIndirectObjectSize(indirectObject); + if (!this.shouldWaitForTick(1)) return [3 /*break*/, 3]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 2: + _a.sent(); + _a.label = 3; + case 3: return [3 /*break*/, 5]; + case 4: + chunk = utils_1.last(compressedObjects); + objectStreamRef = utils_1.last(objectStreamRefs); + if (!chunk || chunk.length % this.objectsPerStream === 0) { + chunk = []; + compressedObjects.push(chunk); + objectStreamRef = PDFRef_1.default.of(objectNumber++); + objectStreamRefs.push(objectStreamRef); + } + xrefStream.addCompressedEntry(ref, objectStreamRef, chunk.length); + chunk.push(indirectObject); + _a.label = 5; + case 5: + idx++; + return [3 /*break*/, 1]; + case 6: + idx = 0, len = compressedObjects.length; + _a.label = 7; + case 7: + if (!(idx < len)) return [3 /*break*/, 10]; + chunk = compressedObjects[idx]; + ref = objectStreamRefs[idx]; + objectStream = PDFObjectStream_1.default.withContextAndObjects(this.context, chunk, this.encodeStreams); + xrefStream.addUncompressedEntry(ref, size); + size += this.computeIndirectObjectSize([ref, objectStream]); + uncompressedObjects.push([ref, objectStream]); + if (!this.shouldWaitForTick(chunk.length)) return [3 /*break*/, 9]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 8: + _a.sent(); + _a.label = 9; + case 9: + idx++; + return [3 /*break*/, 7]; + case 10: + xrefStreamRef = PDFRef_1.default.of(objectNumber++); + xrefStream.dict.set(PDFName_1.default.of('Size'), PDFNumber_1.default.of(objectNumber)); + xrefStream.addUncompressedEntry(xrefStreamRef, size); + xrefOffset = size; + size += this.computeIndirectObjectSize([xrefStreamRef, xrefStream]); + uncompressedObjects.push([xrefStreamRef, xrefStream]); + trailer = PDFTrailer_1.default.forLastCrossRefSectionOffset(xrefOffset); + size += trailer.sizeInBytes(); + return [2 /*return*/, { size: size, header: header, indirectObjects: uncompressedObjects, trailer: trailer }]; + } + }); + }); + }; + PDFStreamWriter.forContext = function (context, objectsPerTick, encodeStreams, objectsPerStream) { + if (encodeStreams === void 0) { encodeStreams = true; } + if (objectsPerStream === void 0) { objectsPerStream = 50; } + return new PDFStreamWriter(context, objectsPerTick, encodeStreams, objectsPerStream); + }; + return PDFStreamWriter; +}(PDFWriter_1.default)); +exports.default = PDFStreamWriter; +//# sourceMappingURL=PDFStreamWriter.js.map \ No newline at end of file diff --git a/cjs/core/writers/PDFStreamWriter.js.map b/cjs/core/writers/PDFStreamWriter.js.map new file mode 100644 index 000000000..08ccfb6df --- /dev/null +++ b/cjs/core/writers/PDFStreamWriter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFStreamWriter.js","sourceRoot":"","sources":["../../../src/core/writers/PDFStreamWriter.ts"],"names":[],"mappings":";;;AAAA,4EAAoD;AACpD,8EAAsD;AACtD,yFAAiE;AACjE,uEAA+C;AAC/C,2EAAmD;AAEnD,qEAA6C;AAC7C,2EAAmD;AAEnD,8FAAsE;AACtE,0FAAkE;AAClE,kEAAmD;AACnD,qCAA8C;AAE9C;IAA8B,2CAAS;IAiBrC,yBACE,OAAmB,EACnB,cAAsB,EACtB,aAAsB,EACtB,gBAAwB;QAJ1B,YAME,kBAAM,OAAO,EAAE,cAAc,CAAC,SAI/B;QAFC,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;;IAC3C,CAAC;IAEe,2CAAiB,GAAjC;;;;;;wBACM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,GAAG,CAAC,CAAC;wBAElD,MAAM,GAAG,mBAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;wBAEtC,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;wBAE9B,UAAU,GAAG,2BAAiB,CAAC,MAAM,CACzC,IAAI,CAAC,iBAAiB,EAAE,EACxB,IAAI,CAAC,aAAa,CACnB,CAAC;wBAEI,mBAAmB,GAA0B,EAAE,CAAC;wBAChD,iBAAiB,GAA4B,EAAE,CAAC;wBAChD,gBAAgB,GAAa,EAAE,CAAC;wBAEhC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;wBACvD,GAAG,GAAG,CAAC,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CAAC;wBAEhD,OAAO,GAAG,oBAAU,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;wBACpE,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;wBAE9B,sBAAO,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,eAAe,EAAE,mBAAmB,EAAE,OAAO,SAAA,EAAE,EAAC;;;;KACxE;IAxGM,0BAAU,GAAG,UAClB,OAAmB,EACnB,cAAsB,EACtB,aAAoB,EACpB,gBAAqB;QADrB,8BAAA,EAAA,oBAAoB;QACpB,iCAAA,EAAA,qBAAqB;QAErB,OAAA,IAAI,eAAe,CACjB,OAAO,EACP,cAAc,EACd,aAAa,EACb,gBAAgB,CACjB;IALD,CAKC,CAAC;IA8FN,sBAAC;CAAA,AA1GD,CAA8B,mBAAS,GA0GtC;AAED,kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/cjs/core/writers/PDFWriter.d.ts b/cjs/core/writers/PDFWriter.d.ts new file mode 100644 index 000000000..b9dad4a36 --- /dev/null +++ b/cjs/core/writers/PDFWriter.d.ts @@ -0,0 +1,30 @@ +import PDFCrossRefSection from "../document/PDFCrossRefSection"; +import PDFHeader from "../document/PDFHeader"; +import PDFTrailer from "../document/PDFTrailer"; +import PDFTrailerDict from "../document/PDFTrailerDict"; +import PDFDict from "../objects/PDFDict"; +import PDFObject from "../objects/PDFObject"; +import PDFRef from "../objects/PDFRef"; +import PDFContext from "../PDFContext"; +export interface SerializationInfo { + size: number; + header: PDFHeader; + indirectObjects: [PDFRef, PDFObject][]; + xref?: PDFCrossRefSection; + trailerDict?: PDFTrailerDict; + trailer: PDFTrailer; +} +declare class PDFWriter { + static forContext: (context: PDFContext, objectsPerTick: number) => PDFWriter; + protected readonly context: PDFContext; + protected readonly objectsPerTick: number; + private parsedObjects; + protected constructor(context: PDFContext, objectsPerTick: number); + serializeToBuffer(): Promise; + protected computeIndirectObjectSize([ref, object]: [PDFRef, PDFObject]): number; + protected createTrailerDict(): PDFDict; + protected computeBufferSize(): Promise; + protected shouldWaitForTick: (n: number) => boolean; +} +export default PDFWriter; +//# sourceMappingURL=PDFWriter.d.ts.map \ No newline at end of file diff --git a/cjs/core/writers/PDFWriter.d.ts.map b/cjs/core/writers/PDFWriter.d.ts.map new file mode 100644 index 000000000..36b08a9a1 --- /dev/null +++ b/cjs/core/writers/PDFWriter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFWriter.d.ts","sourceRoot":"","sources":["../../../src/core/writers/PDFWriter.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,uCAA6C;AACtE,OAAO,SAAS,8BAAoC;AACpD,OAAO,UAAU,+BAAqC;AACtD,OAAO,cAAc,mCAAyC;AAC9D,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAK7C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IACvC,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,cAAM,SAAS;IACb,MAAM,CAAC,UAAU,YAAa,UAAU,kBAAkB,MAAM,eACvB;IAEzC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAEvC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAC1C,OAAO,CAAC,aAAa,CAAK;IAE1B,SAAS,aAAa,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM;IAK3D,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC;IAkE9C,SAAS,CAAC,yBAAyB,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CACjD,MAAM,EACN,SAAS,CACV,GAAG,MAAM;IAMV,SAAS,CAAC,iBAAiB,IAAI,OAAO;cAUtB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IA6B/D,SAAS,CAAC,iBAAiB,MAAO,MAAM,aAGtC;CACH;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/core/writers/PDFWriter.js b/cjs/core/writers/PDFWriter.js new file mode 100644 index 000000000..3d6b6566e --- /dev/null +++ b/cjs/core/writers/PDFWriter.js @@ -0,0 +1,144 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var PDFCrossRefSection_1 = tslib_1.__importDefault(require("../document/PDFCrossRefSection")); +var PDFHeader_1 = tslib_1.__importDefault(require("../document/PDFHeader")); +var PDFTrailer_1 = tslib_1.__importDefault(require("../document/PDFTrailer")); +var PDFTrailerDict_1 = tslib_1.__importDefault(require("../document/PDFTrailerDict")); +var PDFObjectStream_1 = tslib_1.__importDefault(require("../structures/PDFObjectStream")); +var CharCodes_1 = tslib_1.__importDefault(require("../syntax/CharCodes")); +var utils_1 = require("../../utils"); +var PDFWriter = /** @class */ (function () { + function PDFWriter(context, objectsPerTick) { + var _this = this; + this.parsedObjects = 0; + this.shouldWaitForTick = function (n) { + _this.parsedObjects += n; + return _this.parsedObjects % _this.objectsPerTick === 0; + }; + this.context = context; + this.objectsPerTick = objectsPerTick; + } + PDFWriter.prototype.serializeToBuffer = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var _a, size, header, indirectObjects, xref, trailerDict, trailer, offset, buffer, idx, len, _b, ref, object, objectNumber, generationNumber, n; + return tslib_1.__generator(this, function (_c) { + switch (_c.label) { + case 0: return [4 /*yield*/, this.computeBufferSize()]; + case 1: + _a = _c.sent(), size = _a.size, header = _a.header, indirectObjects = _a.indirectObjects, xref = _a.xref, trailerDict = _a.trailerDict, trailer = _a.trailer; + offset = 0; + buffer = new Uint8Array(size); + offset += header.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.Newline; + idx = 0, len = indirectObjects.length; + _c.label = 2; + case 2: + if (!(idx < len)) return [3 /*break*/, 5]; + _b = indirectObjects[idx], ref = _b[0], object = _b[1]; + objectNumber = String(ref.objectNumber); + offset += utils_1.copyStringIntoBuffer(objectNumber, buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + generationNumber = String(ref.generationNumber); + offset += utils_1.copyStringIntoBuffer(generationNumber, buffer, offset); + buffer[offset++] = CharCodes_1.default.Space; + buffer[offset++] = CharCodes_1.default.o; + buffer[offset++] = CharCodes_1.default.b; + buffer[offset++] = CharCodes_1.default.j; + buffer[offset++] = CharCodes_1.default.Newline; + offset += object.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.e; + buffer[offset++] = CharCodes_1.default.n; + buffer[offset++] = CharCodes_1.default.d; + buffer[offset++] = CharCodes_1.default.o; + buffer[offset++] = CharCodes_1.default.b; + buffer[offset++] = CharCodes_1.default.j; + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.Newline; + n = object instanceof PDFObjectStream_1.default ? object.getObjectsCount() : 1; + if (!this.shouldWaitForTick(n)) return [3 /*break*/, 4]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 3: + _c.sent(); + _c.label = 4; + case 4: + idx++; + return [3 /*break*/, 2]; + case 5: + if (xref) { + offset += xref.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + } + if (trailerDict) { + offset += trailerDict.copyBytesInto(buffer, offset); + buffer[offset++] = CharCodes_1.default.Newline; + buffer[offset++] = CharCodes_1.default.Newline; + } + offset += trailer.copyBytesInto(buffer, offset); + return [2 /*return*/, buffer]; + } + }); + }); + }; + PDFWriter.prototype.computeIndirectObjectSize = function (_a) { + var ref = _a[0], object = _a[1]; + var refSize = ref.sizeInBytes() + 3; // 'R' -> 'obj\n' + var objectSize = object.sizeInBytes() + 9; // '\nendobj\n\n' + return refSize + objectSize; + }; + PDFWriter.prototype.createTrailerDict = function () { + return this.context.obj({ + Size: this.context.largestObjectNumber + 1, + Root: this.context.trailerInfo.Root, + Encrypt: this.context.trailerInfo.Encrypt, + Info: this.context.trailerInfo.Info, + ID: this.context.trailerInfo.ID, + }); + }; + PDFWriter.prototype.computeBufferSize = function () { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var header, size, xref, indirectObjects, idx, len, indirectObject, ref, xrefOffset, trailerDict, trailer; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + header = PDFHeader_1.default.forVersion(1, 7); + size = header.sizeInBytes() + 2; + xref = PDFCrossRefSection_1.default.create(); + indirectObjects = this.context.enumerateIndirectObjects(); + idx = 0, len = indirectObjects.length; + _a.label = 1; + case 1: + if (!(idx < len)) return [3 /*break*/, 4]; + indirectObject = indirectObjects[idx]; + ref = indirectObject[0]; + xref.addEntry(ref, size); + size += this.computeIndirectObjectSize(indirectObject); + if (!this.shouldWaitForTick(1)) return [3 /*break*/, 3]; + return [4 /*yield*/, utils_1.waitForTick()]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + idx++; + return [3 /*break*/, 1]; + case 4: + xrefOffset = size; + size += xref.sizeInBytes() + 1; // '\n' + trailerDict = PDFTrailerDict_1.default.of(this.createTrailerDict()); + size += trailerDict.sizeInBytes() + 2; // '\n\n' + trailer = PDFTrailer_1.default.forLastCrossRefSectionOffset(xrefOffset); + size += trailer.sizeInBytes(); + return [2 /*return*/, { size: size, header: header, indirectObjects: indirectObjects, xref: xref, trailerDict: trailerDict, trailer: trailer }]; + } + }); + }); + }; + PDFWriter.forContext = function (context, objectsPerTick) { + return new PDFWriter(context, objectsPerTick); + }; + return PDFWriter; +}()); +exports.default = PDFWriter; +//# sourceMappingURL=PDFWriter.js.map \ No newline at end of file diff --git a/cjs/core/writers/PDFWriter.js.map b/cjs/core/writers/PDFWriter.js.map new file mode 100644 index 000000000..579cc13c5 --- /dev/null +++ b/cjs/core/writers/PDFWriter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PDFWriter.js","sourceRoot":"","sources":["../../../src/core/writers/PDFWriter.ts"],"names":[],"mappings":";;;AAAA,8FAAsE;AACtE,4EAAoD;AACpD,8EAAsD;AACtD,sFAA8D;AAK9D,0FAAkE;AAClE,0EAAkD;AAClD,qCAA8D;AAW9D;IASE,mBAAsB,OAAmB,EAAE,cAAsB;QAAjE,iBAGC;QALO,kBAAa,GAAG,CAAC,CAAC;QAyHhB,sBAAiB,GAAG,UAAC,CAAS;YACtC,KAAI,CAAC,aAAa,IAAI,CAAC,CAAC;YACxB,OAAO,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,cAAc,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAzHA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAEK,qCAAiB,GAAvB;;;;;4BAQM,qBAAM,IAAI,CAAC,iBAAiB,EAAE,EAAA;;wBAP5B,KAOF,SAA8B,EANhC,IAAI,UAAA,EACJ,MAAM,YAAA,EACN,eAAe,qBAAA,EACf,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,OAAO,aAAA;wBAGL,MAAM,GAAG,CAAC,CAAC;wBACT,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;wBAEpC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;wBAC/C,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,OAAO,CAAC;wBACrC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAS,CAAC,OAAO,CAAC;wBAE5B,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,eAAe,CAAC,MAAM;;;6BAAE,CAAA,GAAG,GAAG,GAAG,CAAA;wBACjD,KAAgB,eAAe,CAAC,GAAG,CAAC,EAA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BACxB,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO;wBAEjC,WAAW,GAAG,wBAAc,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;wBAChE,IAAI,IAAI,WAAW,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS;wBAE1C,OAAO,GAAG,oBAAU,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;wBACpE,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;wBAE9B,sBAAO,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,eAAe,iBAAA,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,OAAO,SAAA,EAAE,EAAC;;;;KACtE;IA7HM,oBAAU,GAAG,UAAC,OAAmB,EAAE,cAAsB;QAC9D,OAAA,IAAI,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC;IAAtC,CAAsC,CAAC;IAkI3C,gBAAC;CAAA,AApID,IAoIC;AAED,kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/cjs/index.d.ts b/cjs/index.d.ts new file mode 100644 index 000000000..d284f56da --- /dev/null +++ b/cjs/index.d.ts @@ -0,0 +1,5 @@ +export * from "./api/index"; +export * from "./core/index"; +export * from "./types/index"; +export * from "./utils/index"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/index.d.ts.map b/cjs/index.d.ts.map new file mode 100644 index 000000000..779bf0732 --- /dev/null +++ b/cjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAIyD,aAAa,CAJxC;AAC9B,cAGsE,cAAc,CAHrD;AAC/B,cAEoF,eAAe,CAFnE;AAChC,cACmG,eAAe,CADlF"} \ No newline at end of file diff --git a/cjs/index.js b/cjs/index.js new file mode 100644 index 000000000..43dfe31cb --- /dev/null +++ b/cjs/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./api/index"), exports); +tslib_1.__exportStar(require("./core/index"), exports); +tslib_1.__exportStar(require("./types/index"), exports); +tslib_1.__exportStar(require("./utils/index"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/index.js.map b/cjs/index.js.map new file mode 100644 index 000000000..f2a981741 --- /dev/null +++ b/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA8B;AAC9B,uDAA+B;AAC/B,wDAAgC;AAChC,wDAAgC"} \ No newline at end of file diff --git a/cjs/types/fontkit.d.ts b/cjs/types/fontkit.d.ts new file mode 100644 index 000000000..420cbce8b --- /dev/null +++ b/cjs/types/fontkit.d.ts @@ -0,0 +1,582 @@ +/** + * Represents a glyph bounding box + */ +export interface BoundingBox { + minX: number /** The minimum X position in the bounding box */; + minY: number /** The minimum Y position in the bounding box */; + maxX: number /** The maxmimum X position in the bounding box */; + maxY: number /** The maxmimum Y position in the bounding box */; + width: number /** The width of the bounding box */; + height: number /** The height of the bounding box */; +} +/** + * Path objects are returned by glyphs and represent the actual vector outlines + * for each glyph in the font. Paths can be converted to SVG path data strings, + * or to functions that can be applied to render the path to a graphics context. + */ +export interface Path { + /** + * This property represents the path’s bounding box, i.e. the smallest + * rectangle that contains the entire path shape. This is the exact + * bounding box, taking into account control points that may be outside the + * visible shape. + */ + bbox: BoundingBox; + /** + * This property represents the path’s control box. It is like the + * bounding box, but it includes all points of the path, including control + * points of bezier segments. It is much faster to compute than the real + * bounding box, but less accurate if there are control points outside of the + * visible shape. + */ + cbox: BoundingBox; + /** + * Moves the virtual pen to the given x, y coordinates. + */ + moveTo(x: number, y: number): void; + /** + * Adds a line to the path from the current point to the + * given x, y coordinates. + */ + lineTo(x: number, y: number): void; + /** + * Adds a quadratic curve to the path from the current point to the + * given x, y coordinates using cpx, cpy as a control point. + */ + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + /** + * Adds a bezier curve to the path from the current point to the + * given x, y coordinates using cp1x, cp1y and cp2x, cp2y as control points. + */ + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + /** + * Closes the current sub-path by drawing a straight line back to the + * starting point. + */ + closePath(): void; + /** + * Compiles the path to a JavaScript function that can be applied with a + * graphics context in order to render the path. + */ + toFunction(): Function; + /** + * Converts the path to an SVG path data string. + */ + toSVG(): string; +} +/** + * Glyph objects represent a glyph in the font. They have various properties for + * accessing metrics and the actual vector path the glyph represents, and + * methods for rendering the glyph to a graphics context. + * + * You do not create glyph objects directly. They are created by various methods + * on the Font object. There are several subclasses of the base Glyph class + * internally that may be returned depending on the font format, but they all + * include the following API. + */ +export interface Glyph { + id: number /** The glyph's id in the font */; + /** + * An array of unicode code points that are represented by this glyph. There + * can be multiple code points in the case of ligatures and other glyphs that + * represent multiple visual characters. + */ + codePoints: number[]; + path: Path /** Vector Path object representing the glyph */; + /** + * The Glyph’s bounding box, i.e. the rectangle that encloses the glyph + * outline as tightly as possible. + */ + bbox: BoundingBox; + /** + * The Glyph’s control box. This is often the same as the bounding box, but is + * faster to compute. Because of the way bezier curves are defined, some of + * the control points can be outside of the bounding box. Where bbox takes + * this into account, cbox does not. Thus, cbox is less accurate, but faster + * to compute. + */ + cbox: BoundingBox; + advanceWidth: number /** The Glyph's advance width */; + /** + * For COLR glyphs, which are vector based, this returns an array of objects + * representing the glyphs and colors for each layer in render order. + */ + layers: any[]; + /** + * Renders the glyph to the given graphics context, at the specified + * font size. + */ + render(context: any, size: number): void; + /** + * For SBIX glyphs, which are bitmap based, this returns an object containing + * some properties about the image, along with the image data itself + * (usually PNG). + */ + getImageForSize(size: number): Uint8Array; +} +/** + * Represents positioning information for a glyph in a GlyphRun. + */ +export interface GlyphPosition { + /** + * The amount to move the virtual pen in the X direction after rendering + * this glyph. + */ + xAdvance: number; + /** + * The amount to move the virtual pen in the Y direction after rendering + * this glyph. + */ + yAdvance: number; + /** + * The offset from the pen position in the X direction at which to render + * this glyph. + */ + xOffset: number; + /** + * The offset from the pen position in the Y direction at which to render + * this glyph. + */ + yOffset: number; +} +/** + * Represents a run of Glyph and GlyphPosition objects. + * Returned by the Font.layout method. + */ +export interface GlyphRun { + /** + * An array of Glyph objects in the run + */ + glyphs: Glyph[]; + /** + * An array of GlyphPosition objects for each glyph in the run + */ + positions: GlyphPosition[]; + /** + * The script that was requested for shaping. This was either passed in or detected automatically. + */ + script: string; + /** + * The language requested for shaping, as passed in. If `null`, the default language for the + * script was used. + */ + language: string | null; + /** + * The direction requested for shaping, as passed in (either ltr or rtl). + * If `null`, the default direction of the script is used. + */ + direction: 'ltr' | 'rtl' | null; + /** + * The features requested during shaping. This is a combination of user + * specified features and features chosen by the shaper. + */ + features: object; + /** + * The total advance width of the run. + */ + advanceWidth: number; + /** + * The total advance height of the run. + */ + advanceHeight: number; + /** + * The bounding box containing all glyphs in the run. + */ + bbox: BoundingBox; +} +export interface SubsetStream { + on: (eventType: 'data' | 'end', callback: (data: Uint8Array) => any) => SubsetStream; +} +export interface Subset { + /** + * Includes the given glyph object or glyph ID in the subset. + * Returns the glyph's new ID in the subset. + */ + includeGlyph(glyph: number | Glyph): number; + /** + * Returns a stream containing the encoded font file that can be piped to a + * destination, such as a file. + */ + encodeStream(): SubsetStream; +} +/** + * A map of OpenType features as described in OpenType's spec: + * https://docs.microsoft.com/en-gb/typography/opentype/spec/featurelist. + */ +export interface OpenTypeFeatures { + aalt?: boolean; + abvf?: boolean; + abvm?: boolean; + abvs?: boolean; + afrc?: boolean; + akhn?: boolean; + blwf?: boolean; + blwm?: boolean; + blws?: boolean; + calt?: boolean; + case?: boolean; + ccmp?: boolean; + cfar?: boolean; + cjct?: boolean; + clig?: boolean; + cpct?: boolean; + cpsp?: boolean; + cswh?: boolean; + curs?: boolean; + cv01?: boolean; + cv02?: boolean; + cv03?: boolean; + cv04?: boolean; + cv05?: boolean; + cv06?: boolean; + cv07?: boolean; + cv08?: boolean; + cv09?: boolean; + cv10?: boolean; + cv11?: boolean; + cv22?: boolean; + cv23?: boolean; + cv24?: boolean; + cv25?: boolean; + cv26?: boolean; + cv27?: boolean; + cv28?: boolean; + cv29?: boolean; + cv30?: boolean; + cv31?: boolean; + cv32?: boolean; + cv33?: boolean; + cv34?: boolean; + cv35?: boolean; + cv36?: boolean; + cv37?: boolean; + cv38?: boolean; + cv39?: boolean; + cv40?: boolean; + cv41?: boolean; + cv42?: boolean; + cv43?: boolean; + cv44?: boolean; + cv45?: boolean; + cv46?: boolean; + cv47?: boolean; + cv48?: boolean; + cv49?: boolean; + cv50?: boolean; + cv51?: boolean; + cv52?: boolean; + cv53?: boolean; + cv54?: boolean; + cv55?: boolean; + cv56?: boolean; + cv57?: boolean; + cv58?: boolean; + cv59?: boolean; + cv60?: boolean; + cv61?: boolean; + cv62?: boolean; + cv63?: boolean; + cv64?: boolean; + cv65?: boolean; + cv66?: boolean; + cv67?: boolean; + cv68?: boolean; + cv69?: boolean; + cv70?: boolean; + cv71?: boolean; + cv72?: boolean; + cv73?: boolean; + cv74?: boolean; + cv75?: boolean; + cv76?: boolean; + cv77?: boolean; + cv78?: boolean; + cv79?: boolean; + cv80?: boolean; + cv81?: boolean; + cv82?: boolean; + cv83?: boolean; + cv84?: boolean; + cv85?: boolean; + cv86?: boolean; + cv87?: boolean; + cv88?: boolean; + cv89?: boolean; + cv90?: boolean; + cv91?: boolean; + cv92?: boolean; + cv93?: boolean; + cv94?: boolean; + cv95?: boolean; + cv96?: boolean; + cv97?: boolean; + cv98?: boolean; + cv99?: boolean; + c2pc?: boolean; + c2sc?: boolean; + dist?: boolean; + dlig?: boolean; + dnom?: boolean; + dtls?: boolean; + expt?: boolean; + falt?: boolean; + fin2?: boolean; + fin3?: boolean; + fina?: boolean; + flac?: boolean; + frac?: boolean; + fwid?: boolean; + half?: boolean; + haln?: boolean; + halt?: boolean; + hist?: boolean; + hkna?: boolean; + hlig?: boolean; + hngl?: boolean; + hojo?: boolean; + hwid?: boolean; + init?: boolean; + isol?: boolean; + ital?: boolean; + jalt?: boolean; + jp78?: boolean; + jp83?: boolean; + jp90?: boolean; + jp04?: boolean; + kern?: boolean; + lfbd?: boolean; + liga?: boolean; + ljmo?: boolean; + lnum?: boolean; + locl?: boolean; + ltra?: boolean; + ltrm?: boolean; + mark?: boolean; + med2?: boolean; + medi?: boolean; + mgrk?: boolean; + mkmk?: boolean; + mset?: boolean; + nalt?: boolean; + nlck?: boolean; + nukt?: boolean; + numr?: boolean; + onum?: boolean; + opbd?: boolean; + ordn?: boolean; + ornm?: boolean; + palt?: boolean; + pcap?: boolean; + pkna?: boolean; + pnum?: boolean; + pref?: boolean; + pres?: boolean; + pstf?: boolean; + psts?: boolean; + pwid?: boolean; + qwid?: boolean; + rand?: boolean; + rclt?: boolean; + rkrf?: boolean; + rlig?: boolean; + rphf?: boolean; + rtbd?: boolean; + rtla?: boolean; + rtlm?: boolean; + ruby?: boolean; + rvrn?: boolean; + salt?: boolean; + sinf?: boolean; + size?: boolean; + smcp?: boolean; + smpl?: boolean; + ss01?: boolean; + ss02?: boolean; + ss03?: boolean; + ss04?: boolean; + ss05?: boolean; + ss06?: boolean; + ss07?: boolean; + ss08?: boolean; + ss09?: boolean; + ss10?: boolean; + ss11?: boolean; + ss12?: boolean; + ss13?: boolean; + ss14?: boolean; + ss15?: boolean; + ss16?: boolean; + ss17?: boolean; + ss18?: boolean; + ss19?: boolean; + ss20?: boolean; + ssty?: boolean; + stch?: boolean; + subs?: boolean; + sups?: boolean; + swsh?: boolean; + titl?: boolean; + tjmo?: boolean; + tnam?: boolean; + tnum?: boolean; + trad?: boolean; + twid?: boolean; + unic?: boolean; + valt?: boolean; + vatu?: boolean; + vert?: boolean; + vhal?: boolean; + vjmo?: boolean; + vkna?: boolean; + vkrn?: boolean; + vpal?: boolean; + vrt2?: boolean; + vrtr?: boolean; + zero?: boolean; +} +/** + * A map of Apple Advanced Typography (AAT) as decribed by Apple’s TrueType + * Reference manual: + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6AATIntro.html + */ +export interface AATFeatures { + acnt?: boolean; + ankr?: boolean; + avar?: boolean; + bdat?: boolean; + bhed?: boolean; + bloc?: boolean; + bsln?: boolean; + cmap?: boolean; + cvar?: boolean; + cvt?: boolean; + EBSC?: boolean; + fdsc?: boolean; + feat?: boolean; + fmtx?: boolean; + fond?: boolean; + fpgm?: boolean; + fvar?: boolean; + gasp?: boolean; + gcid?: boolean; + glyf?: boolean; + gvar?: boolean; + hdmx?: boolean; + head?: boolean; + hhea?: boolean; + hmtx?: boolean; + just?: boolean; + kern?: boolean; + kerx?: boolean; + lcar?: boolean; + loca?: boolean; + ltag?: boolean; + maxp?: boolean; + meta?: boolean; + mort?: boolean; + morx?: boolean; + name?: boolean; + opbd?: boolean; + 'OS/2'?: boolean; + post?: boolean; + prep?: boolean; + prop?: boolean; + sbix?: boolean; + trak?: boolean; + vhea?: boolean; + vmtx?: boolean; + xref?: boolean; + Zapf?: boolean; +} +/** + * The features is an object mapping OpenType features to a boolean + * enabling or disabling each. If this is an AAT font, + * the OpenType feature tags are mapped to AAT features. + */ +export interface TypeFeatures extends OpenTypeFeatures, AATFeatures { + [key: string]: boolean | undefined; +} +/** + * There are several different types of font objects that are returned by + * fontkit depending on the font format. They all inherit from the TTFFont class + * and have the same public API. + */ +export interface Font { + postscriptName: string | null; + fullName: string | null; + familyName: string | null; + subfamilyName: string | null; + copyright: string | null; + version: string | null; + unitsPerEm: number /** Size of the font’s internal coordinate grid */; + ascent: number /** The font’s ascender */; + descent: number /** The font’s descender */; + lineGap: number /** Amount of space that should be included between lines */; + underlinePosition: number /** Offset from the normal underline position that should be used */; + underlineThickness: number /** Weight of the underline that should be used */; + italicAngle: number /** If this is an italic font, the angle the cursor should be drawn at to match the font design */; + capHeight: number /** Height of capital letters above the baseline. */; + xHeight: number /** Height of lower case letters. */; + bbox: BoundingBox /** Font’s bounding box, i.e. the box that encloses all glyphs in the font */; + numGlyphs: number /** Number of glyphs in the font */; + characterSet: number[] /** Array of all of the unicode code points supported by the font */; + availableFeatures: (keyof TypeFeatures)[] /** Array of all OpenType feature tags (or mapped AAT tags) supported by the font */; + cff: any; + 'OS/2': { + sFamilyClass: number; + }; + head: { + macStyle: { + italic: boolean; + }; + }; + post: { + isFixedPitch: boolean; + }; + /** + * Maps a single unicode code point (number) to a Glyph object. + * Does not perform any advanced substitutions (there is no context to do so). + */ + glyphForCodePoint(codePoint: number): Glyph; + /** + * Returns whether there is glyph in the font for the given + * unicode code point. + */ + hasGlyphForCodePoint(codePoint: number): boolean; + /** + * This method returns an array of Glyph objects for the given string. + * This is only a one-to-one mapping from characters to glyphs. For most uses, + * you should use Font.layout, which provides a much more advanced mapping + * supporting AAT and OpenType shaping. + */ + glyphsForString(str: string): Glyph[]; + /** + * Returns the advance width (described above) for a single glyph id. + */ + widthOfGlyph(glyphId: number): number; + /** + * This method returns a GlyphRun object, which includes an array of Glyphs + * and GlyphPositions for the given string. Glyph objects are described below. + * GlyphPosition objects include 4 properties: xAdvance, yAdvance, xOffset, + * and yOffset. + * + * The features parameter is an array of OpenType feature tags to be applied + * in addition to the default set. If this is an AAT font, the OpenType + * feature tags are mapped to AAT features. + */ + layout(str: string, features?: TypeFeatures | (keyof TypeFeatures)[]): GlyphRun; + /** + * Returns a glyph object for the given glyph id. You can pass the array of + * code points this glyph represents for your use later, and it will be + * stored in the glyph object. + */ + getGlyph(glyphId: number, codePoints?: number[]): Glyph; + /** + * Returns a Subset object for this font. + */ + createSubset(): Subset; +} +export interface Fontkit { + create(buffer: Uint8Array, postscriptName?: string): Font; +} +//# sourceMappingURL=fontkit.d.ts.map \ No newline at end of file diff --git a/cjs/types/fontkit.d.ts.map b/cjs/types/fontkit.d.ts.map new file mode 100644 index 000000000..bac85520a --- /dev/null +++ b/cjs/types/fontkit.d.ts.map @@ -0,0 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,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,IAAI,EAAE;QAAE,QAAQ,EAAE;YAAE,MAAM,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;IACxC,IAAI,EAAE;QAAE,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAIhC;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IAE5C;;;OAGG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAEjD;;;;;OAKG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,CAAC;IAItC;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtC;;;;;;;;;OASG;IACH,MAAM,CACJ,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,EAAE,GAC/C,QAAQ,CAAC;IAIZ;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAExD;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D"} \ No newline at end of file diff --git a/cjs/types/fontkit.js b/cjs/types/fontkit.js new file mode 100644 index 000000000..749d09dc7 --- /dev/null +++ b/cjs/types/fontkit.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=fontkit.js.map \ No newline at end of file diff --git a/cjs/types/fontkit.js.map b/cjs/types/fontkit.js.map new file mode 100644 index 000000000..d5cb645a3 --- /dev/null +++ b/cjs/types/fontkit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fontkit.js","sourceRoot":"","sources":["../../src/types/fontkit.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/cjs/types/index.d.ts b/cjs/types/index.d.ts new file mode 100644 index 000000000..676888732 --- /dev/null +++ b/cjs/types/index.d.ts @@ -0,0 +1,2 @@ +export { TransformationMatrix } from "./matrix"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/types/index.d.ts.map b/cjs/types/index.d.ts.map new file mode 100644 index 000000000..9bfedfaf4 --- /dev/null +++ b/cjs/types/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MACrB,UAAU,CADoC"} \ No newline at end of file diff --git a/cjs/types/index.js b/cjs/types/index.js new file mode 100644 index 000000000..aa219d8f2 --- /dev/null +++ b/cjs/types/index.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/types/index.js.map b/cjs/types/index.js.map new file mode 100644 index 000000000..37b1eead9 --- /dev/null +++ b/cjs/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/cjs/types/matrix.d.ts b/cjs/types/matrix.d.ts new file mode 100644 index 000000000..5ba7cd8ea --- /dev/null +++ b/cjs/types/matrix.d.ts @@ -0,0 +1,22 @@ +/** + * A transformation matrix according to section `8.3.3 Common Transformations` + * of the PDF specification (page 117). + * + * To cite from the spec: + * + * * Translations shall be specified as `[1 0 0 1 tx ty]`, where `tx` and + * `ty` shall be the distances to translate the origin of the coordinate + * system in the horizontal and vertical dimensions, respectively. + * * Scaling shall be obtained by `[sx 0 0 sy 0 0]`. This scales the + * coordinates so that 1 unit in the horizontal and vertical dimensions of + * the new coordinate system is the same size as `sx` and `sy` units, + * respectively, in the previous coordinate system. + * * Rotations shall be produced by `[cos(q) sin(q) -sin(q) cos(q) 0 0]`, + * which has the effect of rotating the coordinate system axes by an angle + * `q` counter clockwise. + * * Skew shall be specified by `[1 tan(a) tan(b) 1 0 0]`, which skews the + * x-axis by an angle `a` and the y axis by an angle `b`. + */ +export declare type TransformationMatrix = [number, number, number, number, number, number]; +export declare const identityMatrix: TransformationMatrix; +//# sourceMappingURL=matrix.d.ts.map \ No newline at end of file diff --git a/cjs/types/matrix.d.ts.map b/cjs/types/matrix.d.ts.map new file mode 100644 index 000000000..ccbc9da72 --- /dev/null +++ b/cjs/types/matrix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../src/types/matrix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,oBAAoB,GAAG,CACjC,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,CACP,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,oBAAyC,CAAC"} \ No newline at end of file diff --git a/cjs/types/matrix.js b/cjs/types/matrix.js new file mode 100644 index 000000000..00b8d7e88 --- /dev/null +++ b/cjs/types/matrix.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.identityMatrix = void 0; +exports.identityMatrix = [1, 0, 0, 1, 0, 0]; +//# sourceMappingURL=matrix.js.map \ No newline at end of file diff --git a/cjs/types/matrix.js.map b/cjs/types/matrix.js.map new file mode 100644 index 000000000..f6b1c3e61 --- /dev/null +++ b/cjs/types/matrix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/types/matrix.ts"],"names":[],"mappings":";;;AA4Ba,QAAA,cAAc,GAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/Cache.d.ts b/cjs/utils/Cache.d.ts new file mode 100644 index 000000000..77733416b --- /dev/null +++ b/cjs/utils/Cache.d.ts @@ -0,0 +1,11 @@ +declare class Cache { + static readonly populatedBy: (populate: () => T_1) => Cache; + private readonly populate; + private value; + private constructor(); + getValue(): T | undefined; + access(): T; + invalidate(): void; +} +export default Cache; +//# sourceMappingURL=Cache.d.ts.map \ No newline at end of file diff --git a/cjs/utils/Cache.d.ts.map b/cjs/utils/Cache.d.ts.map new file mode 100644 index 000000000..133d85eb1 --- /dev/null +++ b/cjs/utils/Cache.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/utils/Cache.ts"],"names":[],"mappings":"AAAA,cAAM,KAAK,CAAC,CAAC;IACX,MAAM,CAAC,QAAQ,CAAC,WAAW,2CAAiD;IAE5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO;IAKP,QAAQ,IAAI,CAAC,GAAG,SAAS;IAIzB,MAAM,IAAI,CAAC;IAKX,UAAU,IAAI,IAAI;CAGnB;AAED,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/cjs/utils/Cache.js b/cjs/utils/Cache.js new file mode 100644 index 000000000..f7d5320e0 --- /dev/null +++ b/cjs/utils/Cache.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var Cache = /** @class */ (function () { + function Cache(populate) { + this.populate = populate; + this.value = undefined; + } + Cache.prototype.getValue = function () { + return this.value; + }; + Cache.prototype.access = function () { + if (!this.value) + this.value = this.populate(); + return this.value; + }; + Cache.prototype.invalidate = function () { + this.value = undefined; + }; + Cache.populatedBy = function (populate) { return new Cache(populate); }; + return Cache; +}()); +exports.default = Cache; +//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/cjs/utils/Cache.js.map b/cjs/utils/Cache.js.map new file mode 100644 index 000000000..6bde8fa9f --- /dev/null +++ b/cjs/utils/Cache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/utils/Cache.ts"],"names":[],"mappings":";;AAAA;IAME,eAAoB,QAAiB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,wBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,sBAAM,GAAN;QACE,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,0BAAU,GAAV;QACE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IArBe,iBAAW,GAAG,UAAI,QAAiB,IAAK,OAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAnB,CAAmB,CAAC;IAsB9E,YAAC;CAAA,AAvBD,IAuBC;AAED,kBAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/cjs/utils/arrays.d.ts b/cjs/utils/arrays.d.ts new file mode 100644 index 000000000..50901fa90 --- /dev/null +++ b/cjs/utils/arrays.d.ts @@ -0,0 +1,16 @@ +export declare const last: (array: T[]) => T; +export declare const typedArrayFor: (value: string | Uint8Array) => Uint8Array; +export declare const mergeIntoTypedArray: (...arrays: (string | Uint8Array)[]) => Uint8Array; +export declare const mergeUint8Arrays: (arrays: Uint8Array[]) => Uint8Array; +export declare const arrayAsString: (array: Uint8Array | number[]) => string; +export declare const byAscendingId: (a: T, b: T) => number; +export declare const sortedUniq: (array: T[], indexer: (elem: T) => any) => T[]; +export declare const reverseArray: (array: Uint8Array) => Uint8Array; +export declare const sum: (array: number[] | Uint8Array) => number; +export declare const range: (start: number, end: number) => number[]; +export declare const pluckIndices: (arr: T[], indices: number[]) => T[]; +export declare const canBeConvertedToUint8Array: (input: any) => input is string | Uint8Array | ArrayBuffer; +export declare const toUint8Array: (input: string | ArrayBuffer | Uint8Array) => Uint8Array; +//# sourceMappingURL=arrays.d.ts.map \ No newline at end of file diff --git a/cjs/utils/arrays.d.ts.map b/cjs/utils/arrays.d.ts.map new file mode 100644 index 000000000..c8ec7da60 --- /dev/null +++ b/cjs/utils/arrays.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,sBAAgD,CAAC;AAKlE,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAAG,UAQ1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAe,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,eAyBrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,UAAU,EAAE,KAAG,UAevD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,UAAU,GAAG,MAAM,EAAE,KAAG,MAM5D,CAAC;AAEF,eAAO,MAAM,aAAa;QAAoB,GAAG;wBAA8B,CAAC;AAEhF,eAAO,MAAM,UAAU,wCAAyC,GAAG,QAYlE,CAAC;AAKF,eAAO,MAAM,YAAY,UAAW,UAAU,eAW7C,CAAC;AAEF,eAAO,MAAM,GAAG,UAAW,MAAM,EAAE,GAAG,UAAU,KAAG,MAMlD,CAAC;AAEF,eAAO,MAAM,KAAK,UAAW,MAAM,OAAO,MAAM,KAAG,MAAM,EAMxD,CAAC;AAEF,eAAO,MAAM,YAAY,yBAA0B,MAAM,EAAE,QAM1D,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC9B,GAAG,+CAIe,CAAC;AAE5B,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,WAAW,GAAG,UAAU,eAYpE,CAAC"} \ No newline at end of file diff --git a/cjs/utils/arrays.js b/cjs/utils/arrays.js new file mode 100644 index 000000000..681479983 --- /dev/null +++ b/cjs/utils/arrays.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUint8Array = exports.canBeConvertedToUint8Array = exports.pluckIndices = exports.range = exports.sum = exports.reverseArray = exports.sortedUniq = exports.byAscendingId = exports.arrayAsString = exports.mergeUint8Arrays = exports.mergeIntoTypedArray = exports.typedArrayFor = exports.last = void 0; +var base64_1 = require("./base64"); +var strings_1 = require("./strings"); +exports.last = function (array) { return array[array.length - 1]; }; +// export const dropLast = (array: T[]): T[] => +// array.slice(0, array.length - 1); +exports.typedArrayFor = function (value) { + if (value instanceof Uint8Array) + return value; + var length = value.length; + var typedArray = new Uint8Array(length); + for (var idx = 0; idx < length; idx++) { + typedArray[idx] = value.charCodeAt(idx); + } + return typedArray; +}; +exports.mergeIntoTypedArray = function () { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + var arrayCount = arrays.length; + var typedArrays = []; + for (var idx = 0; idx < arrayCount; idx++) { + var element = arrays[idx]; + typedArrays[idx] = + element instanceof Uint8Array ? element : exports.typedArrayFor(element); + } + var totalSize = 0; + for (var idx = 0; idx < arrayCount; idx++) { + totalSize += arrays[idx].length; + } + var merged = new Uint8Array(totalSize); + var offset = 0; + for (var arrIdx = 0; arrIdx < arrayCount; arrIdx++) { + var arr = typedArrays[arrIdx]; + for (var byteIdx = 0, arrLen = arr.length; byteIdx < arrLen; byteIdx++) { + merged[offset++] = arr[byteIdx]; + } + } + return merged; +}; +exports.mergeUint8Arrays = function (arrays) { + var totalSize = 0; + for (var idx = 0, len = arrays.length; idx < len; idx++) { + totalSize += arrays[idx].length; + } + var mergedBuffer = new Uint8Array(totalSize); + var offset = 0; + for (var idx = 0, len = arrays.length; idx < len; idx++) { + var array = arrays[idx]; + mergedBuffer.set(array, offset); + offset += array.length; + } + return mergedBuffer; +}; +exports.arrayAsString = function (array) { + var str = ''; + for (var idx = 0, len = array.length; idx < len; idx++) { + str += strings_1.charFromCode(array[idx]); + } + return str; +}; +exports.byAscendingId = function (a, b) { return a.id - b.id; }; +exports.sortedUniq = function (array, indexer) { + var uniq = []; + for (var idx = 0, len = array.length; idx < len; idx++) { + var curr = array[idx]; + var prev = array[idx - 1]; + if (idx === 0 || indexer(curr) !== indexer(prev)) { + uniq.push(curr); + } + } + return uniq; +}; +// Arrays and TypedArrays in JS both have .reverse() methods, which would seem +// to negate the need for this function. However, not all runtimes support this +// method (e.g. React Native). This function compensates for that fact. +exports.reverseArray = function (array) { + var arrayLen = array.length; + for (var idx = 0, len = Math.floor(arrayLen / 2); idx < len; idx++) { + var leftIdx = idx; + var rightIdx = arrayLen - idx - 1; + var temp = array[idx]; + array[leftIdx] = array[rightIdx]; + array[rightIdx] = temp; + } + return array; +}; +exports.sum = function (array) { + var total = 0; + for (var idx = 0, len = array.length; idx < len; idx++) { + total += array[idx]; + } + return total; +}; +exports.range = function (start, end) { + var arr = new Array(end - start); + for (var idx = 0, len = arr.length; idx < len; idx++) { + arr[idx] = start + idx; + } + return arr; +}; +exports.pluckIndices = function (arr, indices) { + var plucked = new Array(indices.length); + for (var idx = 0, len = indices.length; idx < len; idx++) { + plucked[idx] = arr[indices[idx]]; + } + return plucked; +}; +exports.canBeConvertedToUint8Array = function (input) { + return input instanceof Uint8Array || + input instanceof ArrayBuffer || + typeof input === 'string'; +}; +exports.toUint8Array = function (input) { + if (typeof input === 'string') { + return base64_1.decodeFromBase64DataUri(input); + } + else if (input instanceof ArrayBuffer) { + return new Uint8Array(input); + } + else if (input instanceof Uint8Array) { + return input; + } + else { + throw new TypeError('`input` must be one of `string | ArrayBuffer | Uint8Array`'); + } +}; +//# sourceMappingURL=arrays.js.map \ No newline at end of file diff --git a/cjs/utils/arrays.js.map b/cjs/utils/arrays.js.map new file mode 100644 index 000000000..12577ecab --- /dev/null +++ b/cjs/utils/arrays.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../src/utils/arrays.ts"],"names":[],"mappings":";;;AAAA,mCAA2D;AAC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jB,CAAC,CAAC;AAEW,QAAA,0BAA0B,GAAG,UACxC,KAAU;IAEV,OAAA,KAAK,YAAY,UAAU;QAC3B,KAAK,YAAY,WAAW;QAC5B,OAAO,KAAK,KAAK,QAAQ;AAFzB,CAEyB,CAAC;AAEf,QAAA,YAAY,GAAG,UAAC,KAAwC;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,gCAAuB,CAAC,KAAK,CAAC,CAAC;KACvC;SAAM,IAAI,KAAK,YAAY,WAAW,EAAE;QACvC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;KAC9B;SAAM,IAAI,KAAK,YAAY,UAAU,EAAE;QACtC,OAAO,KAAK,CAAC;KACd;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,4DAA4D,CAC7D,CAAC;KACH;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/async.d.ts b/cjs/utils/async.d.ts new file mode 100644 index 000000000..9ced4b078 --- /dev/null +++ b/cjs/utils/async.d.ts @@ -0,0 +1,6 @@ +/** + * Returns a Promise that resolves after at least one tick of the + * Macro Task Queue occurs. + */ +export declare const waitForTick: () => Promise; +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/cjs/utils/async.d.ts.map b/cjs/utils/async.d.ts.map new file mode 100644 index 000000000..70df49db7 --- /dev/null +++ b/cjs/utils/async.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/utils/async.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,IAAI,CAGvC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/async.js b/cjs/utils/async.js new file mode 100644 index 000000000..c0e696fd4 --- /dev/null +++ b/cjs/utils/async.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.waitForTick = void 0; +/** + * Returns a Promise that resolves after at least one tick of the + * Macro Task Queue occurs. + */ +exports.waitForTick = function () { + return new Promise(function (resolve) { + setTimeout(function () { return resolve(); }, 0); + }); +}; +//# sourceMappingURL=async.js.map \ No newline at end of file diff --git a/cjs/utils/async.js.map b/cjs/utils/async.js.map new file mode 100644 index 000000000..2edc17a76 --- /dev/null +++ b/cjs/utils/async.js.map @@ -0,0 +1 @@ +{"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/utils/async.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,OAAA,IAAI,OAAO,CAAC,UAAC,OAAO;QAClB,UAAU,CAAC,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,EAAE,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC;AAFF,CAEE,CAAC"} \ No newline at end of file diff --git a/cjs/utils/base64.d.ts b/cjs/utils/base64.d.ts new file mode 100644 index 000000000..31d7d21bf --- /dev/null +++ b/cjs/utils/base64.d.ts @@ -0,0 +1,11 @@ +export declare const encodeToBase64: (bytes: Uint8Array) => string; +export declare const decodeFromBase64: (base64: string) => Uint8Array; +/** + * If the `dataUri` input is a data URI, then the data URI prefix must not be + * longer than 100 characters, or this function will fail to decode it. + * + * @param dataUri a base64 data URI or plain base64 string + * @returns a Uint8Array containing the decoded input + */ +export declare const decodeFromBase64DataUri: (dataUri: string) => Uint8Array; +//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/cjs/utils/base64.d.ts.map b/cjs/utils/base64.d.ts.map new file mode 100644 index 000000000..6a718607c --- /dev/null +++ b/cjs/utils/base64.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,cAAc,UAAW,UAAU,KAAG,MAiBlD,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,UA+BjD,CAAC;AAMF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,YAAa,MAAM,KAAG,UAczD,CAAC"} \ No newline at end of file diff --git a/cjs/utils/base64.js b/cjs/utils/base64.js new file mode 100644 index 000000000..c82a13d94 --- /dev/null +++ b/cjs/utils/base64.js @@ -0,0 +1,87 @@ +"use strict"; +/* + * The `chars`, `lookup`, `encode`, and `decode` members of this file are + * licensed under the following: + * + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + * + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeFromBase64DataUri = exports.decodeFromBase64 = exports.encodeToBase64 = void 0; +var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +// Use a lookup table to find the index. +var lookup = new Uint8Array(256); +for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; +} +exports.encodeToBase64 = function (bytes) { + var base64 = ''; + var len = bytes.length; + for (var i = 0; i < len; i += 3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + if (len % 3 === 2) { + base64 = base64.substring(0, base64.length - 1) + '='; + } + else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + '=='; + } + return base64; +}; +exports.decodeFromBase64 = function (base64) { + var bufferLength = base64.length * 0.75; + var len = base64.length; + var i; + var p = 0; + var encoded1; + var encoded2; + var encoded3; + var encoded4; + if (base64[base64.length - 1] === '=') { + bufferLength--; + if (base64[base64.length - 2] === '=') { + bufferLength--; + } + } + var bytes = new Uint8Array(bufferLength); + for (i = 0; i < len; i += 4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i + 1)]; + encoded3 = lookup[base64.charCodeAt(i + 2)]; + encoded4 = lookup[base64.charCodeAt(i + 3)]; + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + return bytes; +}; +// This regex is designed to be as flexible as possible. It will parse certain +// invalid data URIs. +var DATA_URI_PREFIX_REGEX = /^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i; +/** + * If the `dataUri` input is a data URI, then the data URI prefix must not be + * longer than 100 characters, or this function will fail to decode it. + * + * @param dataUri a base64 data URI or plain base64 string + * @returns a Uint8Array containing the decoded input + */ +exports.decodeFromBase64DataUri = function (dataUri) { + var trimmedUri = dataUri.trim(); + var prefix = trimmedUri.substring(0, 100); + var res = prefix.match(DATA_URI_PREFIX_REGEX); + // Assume it's not a data URI - just a plain base64 string + if (!res) + return exports.decodeFromBase64(trimmedUri); + // Remove the data URI prefix and parse the remainder as a base64 string + var fullMatch = res[0]; + var data = trimmedUri.substring(fullMatch.length); + return exports.decodeFromBase64(data); +}; +//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/cjs/utils/base64.js.map b/cjs/utils/base64.js.map new file mode 100644 index 000000000..41a16d817 --- /dev/null +++ b/cjs/utils/base64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,IAAM,KAAK,GACT,kEAAkE,CAAC;AAErE,wCAAwC;AACxC,IAAM,MAAM,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACjC;AAEY,QAAA,cAAc,GAAG,UAAC,KAAiB;IAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,I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AC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,8EAA8E;AAC9E,qBAAqB;AACrB,IAAM,qBAAqB,GAAG,sDAAsD,CAAC;AAErF;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,UAAC,OAAe;IACrD,IAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAElC,IAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5C,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEhD,0DAA0D;IAC1D,IAAI,CAAC,GAAG;QAAE,OAAO,wBAAgB,CAAC,UAAU,CAAC,CAAC;IAE9C,wEAAwE;IACjE,IAAA,SAAS,GAAI,GAAG,GAAP,CAAQ;IACxB,IAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEpD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/errors.d.ts b/cjs/utils/errors.d.ts new file mode 100644 index 000000000..1a13ecafd --- /dev/null +++ b/cjs/utils/errors.d.ts @@ -0,0 +1,2 @@ +export declare const error: (msg: string) => never; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/cjs/utils/errors.d.ts.map b/cjs/utils/errors.d.ts.map new file mode 100644 index 000000000..328a8df35 --- /dev/null +++ b/cjs/utils/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAAS,MAAM,UAEhC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/errors.js b/cjs/utils/errors.js new file mode 100644 index 000000000..b1d13a83b --- /dev/null +++ b/cjs/utils/errors.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.error = void 0; +exports.error = function (msg) { + throw new Error(msg); +}; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/cjs/utils/errors.js.map b/cjs/utils/errors.js.map new file mode 100644 index 000000000..0dbf64782 --- /dev/null +++ b/cjs/utils/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,UAAC,GAAW;IAC/B,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/index.d.ts b/cjs/utils/index.d.ts new file mode 100644 index 000000000..6172c2be7 --- /dev/null +++ b/cjs/utils/index.d.ts @@ -0,0 +1,12 @@ +export * from "./arrays"; +export * from "./async"; +export * from "./strings"; +export * from "./unicode"; +export * from "./numbers"; +export * from "./errors"; +export * from "./base64"; +export * from "./objects"; +export * from "./validators"; +export * from "./pdfDocEncoding"; +export { default as Cache } from "./Cache"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/cjs/utils/index.d.ts.map b/cjs/utils/index.d.ts.map new file mode 100644 index 000000000..b124975de --- /dev/null +++ b/cjs/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAW4H,UAAU,CAXrG;AACjC,cAUsI,SAAS,CAV/G;AAChC,cAS+I,WAAW,CATxH;AAClC,cAQ0J,WAAW,CARnI;AAClC,cAOqK,WAAW,CAP9I;AAClC,cAMgL,UAAU,CANzJ;AACjC,cAK0L,UAAU,CALnK;AACjC,cAIoM,WAAW,CAJ7K;AAClC,cAG+M,cAAc,CAHxL;AACrC,cAE6N,kBAAkB,CAFtM;AACzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MACoN,SAAS,CADrM"} \ No newline at end of file diff --git a/cjs/utils/index.js b/cjs/utils/index.js new file mode 100644 index 000000000..1bb4e147d --- /dev/null +++ b/cjs/utils/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./arrays"), exports); +tslib_1.__exportStar(require("./async"), exports); +tslib_1.__exportStar(require("./strings"), exports); +tslib_1.__exportStar(require("./unicode"), exports); +tslib_1.__exportStar(require("./numbers"), exports); +tslib_1.__exportStar(require("./errors"), exports); +tslib_1.__exportStar(require("./base64"), exports); +tslib_1.__exportStar(require("./objects"), exports); +tslib_1.__exportStar(require("./validators"), exports); +tslib_1.__exportStar(require("./pdfDocEncoding"), exports); +var Cache_1 = require("./Cache"); +Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.default; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cjs/utils/index.js.map b/cjs/utils/index.js.map new file mode 100644 index 000000000..69bb2d0cc --- /dev/null +++ b/cjs/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,2DAAyC;AACzC,iCAAmD;AAA1C,8FAAA,OAAO,OAAS"} \ No newline at end of file diff --git a/cjs/utils/numbers.d.ts b/cjs/utils/numbers.d.ts new file mode 100644 index 000000000..19ee8829b --- /dev/null +++ b/cjs/utils/numbers.d.ts @@ -0,0 +1,24 @@ +/** + * Converts a number to its string representation in decimal. This function + * differs from simply converting a number to a string with `.toString()` + * because this function's output string will **not** contain exponential + * notation. + * + * Credit: https://stackoverflow.com/a/46545519 + */ +export declare const numberToString: (num: number) => string; +export declare const sizeInBytes: (n: number) => number; +/** + * Converts a number into its constituent bytes and returns them as + * a number[]. + * + * Returns most significant byte as first element in array. It may be necessary + * to call .reverse() to get the bits in the desired order. + * + * Example: + * bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ] + * + * Credit for algorithm: https://stackoverflow.com/a/1936865 + */ +export declare const bytesFor: (n: number) => Uint8Array; +//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/cjs/utils/numbers.d.ts.map b/cjs/utils/numbers.d.ts.map new file mode 100644 index 000000000..a84ff6199 --- /dev/null +++ b/cjs/utils/numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAS,MAAM,WAsBzC,CAAC;AAEF,eAAO,MAAM,WAAW,MAAO,MAAM,WAAwC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,MAAO,MAAM,eAMjC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/numbers.js b/cjs/utils/numbers.js new file mode 100644 index 000000000..1bf6e2fe2 --- /dev/null +++ b/cjs/utils/numbers.js @@ -0,0 +1,57 @@ +"use strict"; +// tslint:disable radix +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bytesFor = exports.sizeInBytes = exports.numberToString = void 0; +/** + * Converts a number to its string representation in decimal. This function + * differs from simply converting a number to a string with `.toString()` + * because this function's output string will **not** contain exponential + * notation. + * + * Credit: https://stackoverflow.com/a/46545519 + */ +exports.numberToString = function (num) { + var numStr = String(num); + if (Math.abs(num) < 1.0) { + var e = parseInt(num.toString().split('e-')[1]); + if (e) { + var negative = num < 0; + if (negative) + num *= -1; + num *= Math.pow(10, e - 1); + numStr = '0.' + new Array(e).join('0') + num.toString().substring(2); + if (negative) + numStr = '-' + numStr; + } + } + else { + var e = parseInt(num.toString().split('+')[1]); + if (e > 20) { + e -= 20; + num /= Math.pow(10, e); + numStr = num.toString() + new Array(e + 1).join('0'); + } + } + return numStr; +}; +exports.sizeInBytes = function (n) { return Math.ceil(n.toString(2).length / 8); }; +/** + * Converts a number into its constituent bytes and returns them as + * a number[]. + * + * Returns most significant byte as first element in array. It may be necessary + * to call .reverse() to get the bits in the desired order. + * + * Example: + * bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ] + * + * Credit for algorithm: https://stackoverflow.com/a/1936865 + */ +exports.bytesFor = function (n) { + var bytes = new Uint8Array(exports.sizeInBytes(n)); + for (var i = 1; i <= bytes.length; i++) { + bytes[i - 1] = n >> ((bytes.length - i) * 8); + } + return bytes; +}; +//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/cjs/utils/numbers.js.map b/cjs/utils/numbers.js.map new file mode 100644 index 000000000..10cee3264 --- /dev/null +++ b/cjs/utils/numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":";AAAA,uBAAuB;;;AAEvB;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG,UAAC,GAAW;IACxC,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE;QACvB,IAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,EAAE;YACL,IAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;YACzB,IAAI,QAAQ;gBAAE,GAAG,IAAI,CAAC,CAAC,CAAC;YACxB,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,MAAM,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,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.d.ts @@ -0,0 +1,16 @@ +import { FontNames } from '@pdf-lib/standard-fonts'; +export declare const values: (obj: any) => any[]; +export declare const StandardFontValues: any[]; +export declare const isStandardFont: (input: any) => input is FontNames; +export declare const rectanglesAreEqual: (a: { + x: number; + y: number; + width: number; + height: number; +}, b: { + x: number; + y: number; + width: number; + height: number; +}) => boolean; +//# sourceMappingURL=objects.d.ts.map \ No newline at end of file diff --git a/cjs/utils/objects.d.ts.map b/cjs/utils/objects.d.ts.map new file mode 100644 index 000000000..da3662258 --- /dev/null +++ b/cjs/utils/objects.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,eAAO,MAAM,MAAM,QAAS,GAAG,UAAwC,CAAC;AAExE,eAAO,MAAM,kBAAkB,OAAoB,CAAC;AAEpD,eAAO,MAAM,cAAc,UAAW,GAAG,uBACL,CAAC;AAErC,eAAO,MAAM,kBAAkB,MAC1B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,KACvD;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,YACmB,CAAC"} \ No newline at end of file diff --git a/cjs/utils/objects.js b/cjs/utils/objects.js new file mode 100644 index 000000000..f3532fdf5 --- /dev/null +++ b/cjs/utils/objects.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.rectanglesAreEqual = exports.isStandardFont = exports.StandardFontValues = exports.values = void 0; +var standard_fonts_1 = require("@pdf-lib/standard-fonts"); +exports.values = function (obj) { return Object.keys(obj).map(function (k) { return obj[k]; }); }; +exports.StandardFontValues = exports.values(standard_fonts_1.FontNames); +exports.isStandardFont = function (input) { + return exports.StandardFontValues.includes(input); +}; +exports.rectanglesAreEqual = function (a, b) { return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; }; +//# sourceMappingURL=objects.js.map \ No newline at end of file diff --git a/cjs/utils/objects.js.map b/cjs/utils/objects.js.map new file mode 100644 index 000000000..e1ff22558 --- /dev/null +++ b/cjs/utils/objects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":";;;AAAA,0DAAoD;AAEvC,QAAA,MAAM,GAAG,UAAC,GAAQ,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,GAAG,CAAC,CAAC,CAAC,EAAN,CAAM,CAAC,EAAnC,CAAmC,CAAC;AAE3D,QAAA,kBAAkB,GAAG,cAAM,CAAC,0BAAS,CAAC,CAAC;AAEvC,QAAA,cAAc,GAAG,UAAC,KAAU;IACvC,OAAA,0BAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAlC,CAAkC,CAAC;AAExB,QAAA,kBAAkB,GAAG,UAChC,CAA0D,EAC1D,CAA0D,IACvD,OAAA,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAA1E,CAA0E,CAAC"} \ No newline at end of file diff --git a/cjs/utils/pdfDocEncoding.d.ts b/cjs/utils/pdfDocEncoding.d.ts new file mode 100644 index 000000000..5fbc5f22f --- /dev/null +++ b/cjs/utils/pdfDocEncoding.d.ts @@ -0,0 +1,8 @@ +/** + * Decode a byte array into a string using PDFDocEncoding. + * + * @param bytes a byte array (decimal representation) containing a string + * encoded with PDFDocEncoding. + */ +export declare const pdfDocEncodingDecode: (bytes: Uint8Array) => string; +//# sourceMappingURL=pdfDocEncoding.d.ts.map \ No newline at end of file diff --git a/cjs/utils/pdfDocEncoding.d.ts.map b/cjs/utils/pdfDocEncoding.d.ts.map new file mode 100644 index 000000000..294da04e5 --- /dev/null +++ b/cjs/utils/pdfDocEncoding.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pdfDocEncoding.d.ts","sourceRoot":"","sources":["../../src/utils/pdfDocEncoding.ts"],"names":[],"mappings":"AAwDA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UAAW,UAAU,KAAG,MAMxD,CAAC"} \ No newline at end of file diff --git a/cjs/utils/pdfDocEncoding.js b/cjs/utils/pdfDocEncoding.js new file mode 100644 index 000000000..4f278d049 --- /dev/null +++ b/cjs/utils/pdfDocEncoding.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pdfDocEncodingDecode = void 0; +var strings_1 = require("./strings"); +// Mapping from PDFDocEncoding to Unicode code point +var pdfDocEncodingToUnicode = new Uint16Array(256); +// Initialize the code points which are the same +for (var idx = 0; idx < 256; idx++) { + pdfDocEncodingToUnicode[idx] = idx; +} +// Set differences (see "Table D.2 – PDFDocEncoding Character Set" of the PDF spec) +pdfDocEncodingToUnicode[0x16] = strings_1.toCharCode('\u0017'); // SYNCRONOUS IDLE +pdfDocEncodingToUnicode[0x18] = strings_1.toCharCode('\u02D8'); // BREVE +pdfDocEncodingToUnicode[0x19] = strings_1.toCharCode('\u02C7'); // CARON +pdfDocEncodingToUnicode[0x1a] = strings_1.toCharCode('\u02C6'); // MODIFIER LETTER CIRCUMFLEX ACCENT +pdfDocEncodingToUnicode[0x1b] = strings_1.toCharCode('\u02D9'); // DOT ABOVE +pdfDocEncodingToUnicode[0x1c] = strings_1.toCharCode('\u02DD'); // DOUBLE ACUTE ACCENT +pdfDocEncodingToUnicode[0x1d] = strings_1.toCharCode('\u02DB'); // OGONEK +pdfDocEncodingToUnicode[0x1e] = strings_1.toCharCode('\u02DA'); // RING ABOVE +pdfDocEncodingToUnicode[0x1f] = strings_1.toCharCode('\u02DC'); // SMALL TILDE +pdfDocEncodingToUnicode[0x7f] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark) +pdfDocEncodingToUnicode[0x80] = strings_1.toCharCode('\u2022'); // BULLET +pdfDocEncodingToUnicode[0x81] = strings_1.toCharCode('\u2020'); // DAGGER +pdfDocEncodingToUnicode[0x82] = strings_1.toCharCode('\u2021'); // DOUBLE DAGGER +pdfDocEncodingToUnicode[0x83] = strings_1.toCharCode('\u2026'); // HORIZONTAL ELLIPSIS +pdfDocEncodingToUnicode[0x84] = strings_1.toCharCode('\u2014'); // EM DASH +pdfDocEncodingToUnicode[0x85] = strings_1.toCharCode('\u2013'); // EN DASH +pdfDocEncodingToUnicode[0x86] = strings_1.toCharCode('\u0192'); // LATIN SMALL LETTER SCRIPT F +pdfDocEncodingToUnicode[0x87] = strings_1.toCharCode('\u2044'); // FRACTION SLASH (solidus) +pdfDocEncodingToUnicode[0x88] = strings_1.toCharCode('\u2039'); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK +pdfDocEncodingToUnicode[0x89] = strings_1.toCharCode('\u203A'); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +pdfDocEncodingToUnicode[0x8a] = strings_1.toCharCode('\u2212'); // MINUS SIGN +pdfDocEncodingToUnicode[0x8b] = strings_1.toCharCode('\u2030'); // PER MILLE SIGN +pdfDocEncodingToUnicode[0x8c] = strings_1.toCharCode('\u201E'); // DOUBLE LOW-9 QUOTATION MARK (quotedblbase) +pdfDocEncodingToUnicode[0x8d] = strings_1.toCharCode('\u201C'); // LEFT DOUBLE QUOTATION MARK (quotedblleft) +pdfDocEncodingToUnicode[0x8e] = strings_1.toCharCode('\u201D'); // RIGHT DOUBLE QUOTATION MARK (quotedblright) +pdfDocEncodingToUnicode[0x8f] = strings_1.toCharCode('\u2018'); // LEFT SINGLE QUOTATION MARK (quoteleft) +pdfDocEncodingToUnicode[0x90] = strings_1.toCharCode('\u2019'); // RIGHT SINGLE QUOTATION MARK (quoteright) +pdfDocEncodingToUnicode[0x91] = strings_1.toCharCode('\u201A'); // SINGLE LOW-9 QUOTATION MARK (quotesinglbase) +pdfDocEncodingToUnicode[0x92] = strings_1.toCharCode('\u2122'); // TRADE MARK SIGN +pdfDocEncodingToUnicode[0x93] = strings_1.toCharCode('\uFB01'); // LATIN SMALL LIGATURE FI +pdfDocEncodingToUnicode[0x94] = strings_1.toCharCode('\uFB02'); // LATIN SMALL LIGATURE FL +pdfDocEncodingToUnicode[0x95] = strings_1.toCharCode('\u0141'); // LATIN CAPITAL LETTER L WITH STROKE +pdfDocEncodingToUnicode[0x96] = strings_1.toCharCode('\u0152'); // LATIN CAPITAL LIGATURE OE +pdfDocEncodingToUnicode[0x97] = strings_1.toCharCode('\u0160'); // LATIN CAPITAL LETTER S WITH CARON +pdfDocEncodingToUnicode[0x98] = strings_1.toCharCode('\u0178'); // LATIN CAPITAL LETTER Y WITH DIAERESIS +pdfDocEncodingToUnicode[0x99] = strings_1.toCharCode('\u017D'); // LATIN CAPITAL LETTER Z WITH CARON +pdfDocEncodingToUnicode[0x9a] = strings_1.toCharCode('\u0131'); // LATIN SMALL LETTER DOTLESS I +pdfDocEncodingToUnicode[0x9b] = strings_1.toCharCode('\u0142'); // LATIN SMALL LETTER L WITH STROKE +pdfDocEncodingToUnicode[0x9c] = strings_1.toCharCode('\u0153'); // LATIN SMALL LIGATURE OE +pdfDocEncodingToUnicode[0x9d] = strings_1.toCharCode('\u0161'); // LATIN SMALL LETTER S WITH CARON +pdfDocEncodingToUnicode[0x9e] = strings_1.toCharCode('\u017E'); // LATIN SMALL LETTER Z WITH CARON +pdfDocEncodingToUnicode[0x9f] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark) +pdfDocEncodingToUnicode[0xa0] = strings_1.toCharCode('\u20AC'); // EURO SIGN +pdfDocEncodingToUnicode[0xad] = strings_1.toCharCode('\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark) +/** + * Decode a byte array into a string using PDFDocEncoding. + * + * @param bytes a byte array (decimal representation) containing a string + * encoded with PDFDocEncoding. + */ +exports.pdfDocEncodingDecode = function (bytes) { + var codePoints = new Array(bytes.length); + for (var idx = 0, len = bytes.length; idx < len; idx++) { + codePoints[idx] = pdfDocEncodingToUnicode[bytes[idx]]; + } + return String.fromCodePoint.apply(String, codePoints); +}; +//# sourceMappingURL=pdfDocEncoding.js.map \ No newline at end of file diff --git a/cjs/utils/pdfDocEncoding.js.map b/cjs/utils/pdfDocEncoding.js.map new file mode 100644 index 000000000..921433fb1 --- /dev/null +++ b/cjs/utils/pdfDocEncoding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pdfDocEncoding.js","sourceRoot":"","sources":["../../src/utils/pdfDocEncoding.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAE/C,oDAAoD;AACpD,IAAM,uBAAuB,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;AAErD,gDAAgD;AAChD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;IAClC,uBAAuB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;CACpC;AAED,mFAAmF;AACnF,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB;AACxE,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;AAC9D,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;AAC9D,uBAAuB,CAAC,IAAI,CAAC,GAAG,oBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,oCAAoC;AAC1F,uBAAuB,CAAC,IA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AAG,CAAC,CAAC,CAAC;KACvD;IACD,OAAO,MAAM,CAAC,aAAa,OAApB,MAAM,EAAkB,UAAU,EAAE;AAC7C,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/png.d.ts b/cjs/utils/png.d.ts new file mode 100644 index 000000000..d7cb6b62a --- /dev/null +++ b/cjs/utils/png.d.ts @@ -0,0 +1,18 @@ +export declare enum PngType { + Greyscale = "Greyscale", + Truecolour = "Truecolour", + IndexedColour = "IndexedColour", + GreyscaleWithAlpha = "GreyscaleWithAlpha", + TruecolourWithAlpha = "TruecolourWithAlpha" +} +export declare class PNG { + static load: (pngData: Uint8Array) => PNG; + readonly rgbChannel: Uint8Array; + readonly alphaChannel?: Uint8Array; + readonly type: PngType; + readonly width: number; + readonly height: number; + readonly bitsPerComponent: number; + private constructor(); +} +//# sourceMappingURL=png.d.ts.map \ No newline at end of file diff --git a/cjs/utils/png.d.ts.map b/cjs/utils/png.d.ts.map new file mode 100644 index 000000000..369763434 --- /dev/null +++ b/cjs/utils/png.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/utils/png.ts"],"names":[],"mappings":"AA+BA,oBAAY,OAAO;IACjB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC5C;AAED,qBAAa,GAAG;IACd,MAAM,CAAC,IAAI,YAAa,UAAU,SAAsB;IAExD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC,OAAO;CAoBR"} \ No newline at end of file diff --git a/cjs/utils/png.js b/cjs/utils/png.js new file mode 100644 index 000000000..e2819b063 --- /dev/null +++ b/cjs/utils/png.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PNG = exports.PngType = void 0; +var tslib_1 = require("tslib"); +var upng_1 = tslib_1.__importDefault(require("@pdf-lib/upng")); +var getImageType = function (ctype) { + if (ctype === 0) + return PngType.Greyscale; + if (ctype === 2) + return PngType.Truecolour; + if (ctype === 3) + return PngType.IndexedColour; + if (ctype === 4) + return PngType.GreyscaleWithAlpha; + if (ctype === 6) + return PngType.TruecolourWithAlpha; + throw new Error("Unknown color type: " + ctype); +}; +var splitAlphaChannel = function (rgbaChannel) { + var pixelCount = Math.floor(rgbaChannel.length / 4); + var rgbChannel = new Uint8Array(pixelCount * 3); + var alphaChannel = new Uint8Array(pixelCount * 1); + var rgbaOffset = 0; + var rgbOffset = 0; + var alphaOffset = 0; + while (rgbaOffset < rgbaChannel.length) { + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++]; + alphaChannel[alphaOffset++] = rgbaChannel[rgbaOffset++]; + } + return { rgbChannel: rgbChannel, alphaChannel: alphaChannel }; +}; +var PngType; +(function (PngType) { + PngType["Greyscale"] = "Greyscale"; + PngType["Truecolour"] = "Truecolour"; + PngType["IndexedColour"] = "IndexedColour"; + PngType["GreyscaleWithAlpha"] = "GreyscaleWithAlpha"; + PngType["TruecolourWithAlpha"] = "TruecolourWithAlpha"; +})(PngType = exports.PngType || (exports.PngType = {})); +var PNG = /** @class */ (function () { + function PNG(pngData) { + var upng = upng_1.default.decode(pngData); + var frames = upng_1.default.toRGBA8(upng); + if (frames.length > 1) + throw new Error("Animated PNGs are not supported"); + var frame = new Uint8Array(frames[0]); + var _a = splitAlphaChannel(frame), rgbChannel = _a.rgbChannel, alphaChannel = _a.alphaChannel; + this.rgbChannel = rgbChannel; + var hasAlphaValues = alphaChannel.some(function (a) { return a < 255; }); + if (hasAlphaValues) + this.alphaChannel = alphaChannel; + this.type = getImageType(upng.ctype); + this.width = upng.width; + this.height = upng.height; + this.bitsPerComponent = 8; + } + PNG.load = function (pngData) { return new PNG(pngData); }; + return PNG; +}()); +exports.PNG = PNG; +//# sourceMappingURL=png.js.map \ No newline at end of file diff --git a/cjs/utils/png.js.map b/cjs/utils/png.js.map new file mode 100644 index 000000000..eb4928c2b --- /dev/null +++ b/cjs/utils/png.js.map @@ -0,0 +1 @@ +{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/utils/png.ts"],"names":[],"mappings":";;;;AAAA,+DAAiC;AAEjC,IAAM,YAAY,GAAG,UAAC,KAAa;IACjC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,SAAS,CAAC;IAC1C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,UAAU,CAAC;IAC3C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,aAAa,CAAC;IAC9C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,kBAAkB,CAAC;IACnD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,mBAAmB,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,yBAAuB,KAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,IAAM,iBAAiB,GAAG,UAAC,WAAuB;IAChD,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEtD,IAAM,UAAU,GAAG,IAAI,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAClD,IAAM,YAAY,GAAG,IAAI,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAEpD,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,GAAG,CAAC,CAAC;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AAP,CAAO,CAAC,CAAC;QACzD,IAAI,cAAc;YAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;IA5BM,QAAI,GAAG,UAAC,OAAmB,IAAK,OAAA,IAAI,GAAG,CAAC,OAAO,CAAC,EAAhB,CAAgB,CAAC;IA6B1D,UAAC;CAAA,AA9BD,IA8BC;AA9BY,kBAAG"} \ No newline at end of file diff --git a/cjs/utils/rng.d.ts b/cjs/utils/rng.d.ts new file mode 100644 index 000000000..095ca0b00 --- /dev/null +++ b/cjs/utils/rng.d.ts @@ -0,0 +1,14 @@ +/** + * Generates a pseudo random number. Although it is not cryptographically secure + * and uniformly distributed, it is not a concern for the intended use-case, + * which is to generate distinct numbers. + * + * Credit: https://stackoverflow.com/a/19303725/10254049 + */ +export declare class SimpleRNG { + static withSeed: (seed: number) => SimpleRNG; + private seed; + private constructor(); + nextInt(): number; +} +//# sourceMappingURL=rng.d.ts.map \ No newline at end of file diff --git a/cjs/utils/rng.d.ts.map b/cjs/utils/rng.d.ts.map new file mode 100644 index 000000000..f55d8e0bd --- /dev/null +++ b/cjs/utils/rng.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/utils/rng.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,SAAU,MAAM,eAAyB;IAExD,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAIP,OAAO,IAAI,MAAM;CAIlB"} \ No newline at end of file diff --git a/cjs/utils/rng.js b/cjs/utils/rng.js new file mode 100644 index 000000000..af1fcb653 --- /dev/null +++ b/cjs/utils/rng.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SimpleRNG = void 0; +/** + * Generates a pseudo random number. Although it is not cryptographically secure + * and uniformly distributed, it is not a concern for the intended use-case, + * which is to generate distinct numbers. + * + * Credit: https://stackoverflow.com/a/19303725/10254049 + */ +var SimpleRNG = /** @class */ (function () { + function SimpleRNG(seed) { + this.seed = seed; + } + SimpleRNG.prototype.nextInt = function () { + var x = Math.sin(this.seed++) * 10000; + return x - Math.floor(x); + }; + SimpleRNG.withSeed = function (seed) { return new SimpleRNG(seed); }; + return SimpleRNG; +}()); +exports.SimpleRNG = SimpleRNG; +//# sourceMappingURL=rng.js.map \ No newline at end of file diff --git a/cjs/utils/rng.js.map b/cjs/utils/rng.js.map new file mode 100644 index 000000000..8010e349b --- /dev/null +++ b/cjs/utils/rng.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rng.js","sourceRoot":"","sources":["../../src/utils/rng.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH;IAKE,mBAAoB,IAAY;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,2BAAO,GAAP;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAXM,kBAAQ,GAAG,UAAC,IAAY,IAAK,OAAA,IAAI,SAAS,CAAC,IAAI,CAAC,EAAnB,CAAmB,CAAC;IAY1D,gBAAC;CAAA,AAbD,IAaC;AAbY,8BAAS"} \ No newline at end of file diff --git a/cjs/utils/strings.d.ts b/cjs/utils/strings.d.ts new file mode 100644 index 000000000..2e5722f91 --- /dev/null +++ b/cjs/utils/strings.d.ts @@ -0,0 +1,25 @@ +export declare const toCharCode: (character: string) => number; +export declare const toCodePoint: (character: string) => number | undefined; +export declare const toHexStringOfMinLength: (num: number, minLength: number) => string; +export declare const toHexString: (num: number) => string; +export declare const charFromCode: (code: number) => string; +export declare const charFromHexCode: (hex: string) => string; +export declare const padStart: (value: string, length: number, padChar: string) => string; +export declare const copyStringIntoBuffer: (str: string, buffer: Uint8Array, offset: number) => number; +export declare const addRandomSuffix: (prefix: string, suffixLength?: number) => string; +export declare const escapeRegExp: (str: string) => string; +export declare const cleanText: (text: string) => string; +export declare const escapedNewlineChars: string[]; +export declare const newlineChars: string[]; +export declare const isNewlineChar: (text: string) => boolean; +export declare const lineSplit: (text: string) => string[]; +export declare const mergeLines: (text: string) => string; +export declare const charAtIndex: (text: string, index: number) => [string, number]; +export declare const charSplit: (text: string) => string[]; +export declare const breakTextIntoLines: (text: string, wordBreaks: string[], maxWidth: number, computeWidthOfText: (t: string) => number) => string[]; +export declare const parseDate: (dateStr: string) => Date | undefined; +export declare const findLastMatch: (value: string, regex: RegExp) => { + match: RegExpMatchArray | undefined; + pos: number; +}; +//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/cjs/utils/strings.d.ts.map b/cjs/utils/strings.d.ts.map new file mode 100644 index 000000000..c83bd3dd4 --- /dev/null +++ b/cjs/utils/strings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,cAAe,MAAM,WAA4B,CAAC;AAEzE,eAAO,MAAM,WAAW,cAAe,MAAM,uBAA6B,CAAC;AAE3E,eAAO,MAAM,sBAAsB,QAAS,MAAM,aAAa,MAAM,WACX,CAAC;AAE3D,eAAO,MAAM,WAAW,QAAS,MAAM,WAAmC,CAAC;AAE3E,eAAO,MAAM,YAAY,SAAU,MAAM,WAA8B,CAAC;AAExE,eAAO,MAAM,eAAe,QAAS,MAAM,WAAoC,CAAC;AAEhF,eAAO,MAAM,QAAQ,UAAW,MAAM,UAAU,MAAM,WAAW,MAAM,WAMtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAC1B,MAAM,UACH,UAAU,UACV,MAAM,KACb,MAMF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,kCACiB,CAAC;AAEhE,eAAO,MAAM,YAAY,QAAS,MAAM,WACI,CAAC;AAE7C,eAAO,MAAM,SAAS,SAAU,MAAM,WACmC,CAAC;AAE1E,eAAO,MAAM,mBAAmB,UAAmC,CAAC;AAEpE,eAAO,MAAM,YAAY,UAA+B,CAAC;AAEzD,eAAO,MAAM,aAAa,SAAU,MAAM,YAAkC,CAAC;AAE7E,eAAO,MAAM,SAAS,SAAU,MAAM,aAAiC,CAAC;AAExE,eAAO,MAAM,UAAU,SAAU,MAAM,WACD,CAAC;AAOvC,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,CAgBxE,CAAC;AAEF,eAAO,MAAM,SAAS,SAAU,MAAM,aAUrC,CAAC;AAkBF,eAAO,MAAM,kBAAkB,SACvB,MAAM,cACA,MAAM,EAAE,YACV,MAAM,0BACQ,MAAM,KAAK,MAAM,KACxC,MAAM,EA6BR,CAAC;AAKF,eAAO,MAAM,SAAS,YAAa,MAAM,KAAG,IAAI,GAAG,SA0BlD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,MAAM,SAAS,MAAM;;;CAUzD,CAAC"} \ No newline at end of file diff --git a/cjs/utils/strings.js b/cjs/utils/strings.js new file mode 100644 index 000000000..bba80b687 --- /dev/null +++ b/cjs/utils/strings.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.findLastMatch = exports.parseDate = exports.breakTextIntoLines = exports.charSplit = exports.charAtIndex = exports.mergeLines = exports.lineSplit = exports.isNewlineChar = exports.newlineChars = exports.escapedNewlineChars = exports.cleanText = exports.escapeRegExp = exports.addRandomSuffix = exports.copyStringIntoBuffer = exports.padStart = exports.charFromHexCode = exports.charFromCode = exports.toHexString = exports.toHexStringOfMinLength = exports.toCodePoint = exports.toCharCode = void 0; +exports.toCharCode = function (character) { return character.charCodeAt(0); }; +exports.toCodePoint = function (character) { return character.codePointAt(0); }; +exports.toHexStringOfMinLength = function (num, minLength) { + return exports.padStart(num.toString(16), minLength, '0').toUpperCase(); +}; +exports.toHexString = function (num) { return exports.toHexStringOfMinLength(num, 2); }; +exports.charFromCode = function (code) { return String.fromCharCode(code); }; +exports.charFromHexCode = function (hex) { return exports.charFromCode(parseInt(hex, 16)); }; +exports.padStart = function (value, length, padChar) { + var padding = ''; + for (var idx = 0, len = length - value.length; idx < len; idx++) { + padding += padChar; + } + return padding + value; +}; +exports.copyStringIntoBuffer = function (str, buffer, offset) { + var length = str.length; + for (var idx = 0; idx < length; idx++) { + buffer[offset++] = str.charCodeAt(idx); + } + return length; +}; +exports.addRandomSuffix = function (prefix, suffixLength) { + if (suffixLength === void 0) { suffixLength = 4; } + return prefix + "-" + Math.floor(Math.random() * Math.pow(10, suffixLength)); +}; +exports.escapeRegExp = function (str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +}; +exports.cleanText = function (text) { + return text.replace(/\t|\u0085|\u2028|\u2029/g, ' ').replace(/[\b\v]/g, ''); +}; +exports.escapedNewlineChars = ['\\n', '\\f', '\\r', '\\u000B']; +exports.newlineChars = ['\n', '\f', '\r', '\u000B']; +exports.isNewlineChar = function (text) { return /^[\n\f\r\u000B]$/.test(text); }; +exports.lineSplit = function (text) { return text.split(/[\n\f\r\u000B]/); }; +exports.mergeLines = function (text) { + return text.replace(/[\n\f\r\u000B]/g, ' '); +}; +// JavaScript's String.charAt() method doesn work on strings containing UTF-16 +// characters (with high and low surrogate pairs), such as 💩 (poo emoji). This +// `charAtIndex()` function does. +// +// Credit: https://github.com/mathiasbynens/String.prototype.at/blob/master/at.js#L14-L48 +exports.charAtIndex = function (text, index) { + // Get the first code unit and code unit value + var cuFirst = text.charCodeAt(index); + var cuSecond; + var nextIndex = index + 1; + var length = 1; + if ( + // Check if it's the start of a surrogate pair. + cuFirst >= 0xd800 && + cuFirst <= 0xdbff && // high surrogate + text.length > nextIndex // there is a next code unit + ) { + cuSecond = text.charCodeAt(nextIndex); + if (cuSecond >= 0xdc00 && cuSecond <= 0xdfff) + length = 2; // low surrogate + } + return [text.slice(index, index + length), length]; +}; +exports.charSplit = function (text) { + var chars = []; + for (var idx = 0, len = text.length; idx < len;) { + var _a = exports.charAtIndex(text, idx), c = _a[0], cLen = _a[1]; + chars.push(c); + idx += cLen; + } + return chars; +}; +var buildWordBreakRegex = function (wordBreaks) { + var newlineCharUnion = exports.escapedNewlineChars.join('|'); + var escapedRules = ['$']; + for (var idx = 0, len = wordBreaks.length; idx < len; idx++) { + var wordBreak = wordBreaks[idx]; + if (exports.isNewlineChar(wordBreak)) { + throw new TypeError("`wordBreak` must not include " + newlineCharUnion); + } + escapedRules.push(wordBreak === '' ? '.' : exports.escapeRegExp(wordBreak)); + } + var breakRules = escapedRules.join('|'); + return new RegExp("(" + newlineCharUnion + ")|((.*?)(" + breakRules + "))", 'gm'); +}; +exports.breakTextIntoLines = function (text, wordBreaks, maxWidth, computeWidthOfText) { + var regex = buildWordBreakRegex(wordBreaks); + var words = exports.cleanText(text).match(regex); + var currLine = ''; + var currWidth = 0; + var lines = []; + var pushCurrLine = function () { + if (currLine !== '') + lines.push(currLine); + currLine = ''; + currWidth = 0; + }; + for (var idx = 0, len = words.length; idx < len; idx++) { + var word = words[idx]; + if (exports.isNewlineChar(word)) { + pushCurrLine(); + } + else { + var width = computeWidthOfText(word); + if (currWidth + width > maxWidth) + pushCurrLine(); + currLine += word; + currWidth += width; + } + } + pushCurrLine(); + return lines; +}; +// See section "7.9.4 Dates" of the PDF specification +var dateRegex = /^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/; +exports.parseDate = function (dateStr) { + var match = dateStr.match(dateRegex); + if (!match) + return undefined; + var year = match[1], _a = match[2], month = _a === void 0 ? '01' : _a, _b = match[3], day = _b === void 0 ? '01' : _b, _c = match[4], hours = _c === void 0 ? '00' : _c, _d = match[5], mins = _d === void 0 ? '00' : _d, _e = match[6], secs = _e === void 0 ? '00' : _e, _f = match[7], offsetSign = _f === void 0 ? 'Z' : _f, _g = match[8], offsetHours = _g === void 0 ? '00' : _g, _h = match[9], offsetMins = _h === void 0 ? '00' : _h; + // http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 + var tzOffset = offsetSign === 'Z' ? 'Z' : "" + offsetSign + offsetHours + ":" + offsetMins; + var date = new Date(year + "-" + month + "-" + day + "T" + hours + ":" + mins + ":" + secs + tzOffset); + return date; +}; +exports.findLastMatch = function (value, regex) { + var _a; + var position = 0; + var lastMatch; + while (position < value.length) { + var match = value.substring(position).match(regex); + if (!match) + return { match: lastMatch, pos: position }; + lastMatch = match; + position += ((_a = match.index) !== null && _a !== void 0 ? _a : 0) + match[0].length; + } + return { match: lastMatch, pos: position }; +}; +//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/cjs/utils/strings.js.map b/cjs/utils/strings.js.map new file mode 100644 index 000000000..f683c7293 --- /dev/null +++ b/cjs/utils/strings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,UAAC,SAAiB,IAAK,OAAA,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAvB,CAAuB,CAAC;AAE5D,QAAA,WAAW,GAAG,UAAC,SAAiB,IAAK,OAAA,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAxB,CAAwB,CAAC;AAE9D,QAAA,sBAAsB,GAAG,UAAC,GAAW,EAAE,SAAiB;IACnE,OAAA,gBAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,CAA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,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;QACvD,SAAS,GAAG,KAAK,CAAC;QAClB,QAAQ,IAAI,OAAC,KAAK,CAAC,KAAK,mCAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAClD;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC,CAAC"} \ No newline at end of file diff --git a/cjs/utils/unicode.d.ts b/cjs/utils/unicode.d.ts new file mode 100644 index 000000000..e8a6049b9 --- /dev/null +++ b/cjs/utils/unicode.d.ts @@ -0,0 +1,187 @@ +/** + * Encodes a string to UTF-8. + * + * @param input The string to be encoded. + * @param byteOrderMark Whether or not a byte order marker (BOM) should be added + * to the start of the encoding. (default `true`) + * @returns A Uint8Array containing the UTF-8 encoding of the input string. + * + * ----------------------------------------------------------------------------- + * + * JavaScript strings are composed of Unicode code points. Code points are + * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string, + * it must be encoded as a sequence of words. A word is typically 8, 16, or 32 + * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16, + * and UTF-32. These encoding forms are described in the Unicode standard [1]. + * This function implements the UTF-8 encoding form. + * + * ----------------------------------------------------------------------------- + * + * In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes. + * Note that the logic which defines this mapping is slightly convoluted, and + * not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8 + * mapping logic is as follows [2]: + * + * • If a code point is in the range U+0000..U+007F, then view it as a 7-bit + * integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order + * bit set to 0: + * + * b1=0b0xxxxxxx + * + * • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit + * integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits + * of the code point stored in the first byte, and the last 6 bits stored in + * the second byte: + * + * b1=0b110yyyyy b2=0b10xxxxxx + * + * • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit + * integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first + * 4 bits stored in the first byte, the next 6 bits stored in the second byte, + * and the last 6 bits in the third byte: + * + * b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx + * + * • If a code point is in the range U+10000...U+10FFFF, then view it as a + * 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with + * the first 3 bits stored in the first byte, the next 6 bits stored in the + * second byte, the next 6 bits stored in the third byte, and the last 6 bits + * stored in the fourth byte: + * + * b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx + * + * ----------------------------------------------------------------------------- + * + * It is important to note, when iterating through the code points of a string + * in JavaScript, that if a character is encoded as a surrogate pair it will + * increase the string's length by 2 instead of 1 [4]. For example: + * + * ``` + * > 'a'.length + * 1 + * > '💩'.length + * 2 + * > '語'.length + * 1 + * > 'a💩語'.length + * 4 + * ``` + * + * The results of the above example are explained by the fact that the + * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is. + * + * Because of this idiosyncrasy in JavaScript's string implementation and APIs, + * we must "jump" an extra index after encoding a character as a surrogate + * pair. In practice, this means we must increment the index of our for loop by + * 2 if we encode a surrogate pair, and 1 in all other cases. + * + * ----------------------------------------------------------------------------- + * + * References: + * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf + * 3.9 Unicode Encoding Forms - UTF-8 + * - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html + * - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html + * - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description + * + */ +export declare const utf8Encode: (input: string, byteOrderMark?: boolean) => Uint8Array; +/** + * Encodes a string to UTF-16. + * + * @param input The string to be encoded. + * @param byteOrderMark Whether or not a byte order marker (BOM) should be added + * to the start of the encoding. (default `true`) + * @returns A Uint16Array containing the UTF-16 encoding of the input string. + * + * ----------------------------------------------------------------------------- + * + * JavaScript strings are composed of Unicode code points. Code points are + * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string, + * it must be encoded as a sequence of words. A word is typically 8, 16, or 32 + * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16, + * and UTF-32. These encoding forms are described in the Unicode standard [1]. + * This function implements the UTF-16 encoding form. + * + * ----------------------------------------------------------------------------- + * + * In UTF-16, each code point is mapped to one or two 16-bit integers. The + * UTF-16 mapping logic is as follows [2]: + * + * • If a code point is in the range U+0000..U+FFFF, then map the code point to + * a 16-bit integer with the most significant byte first. + * + * • If a code point is in the range U+10000..U+10000, then map the code point + * to two 16-bit integers. The first integer should contain the high surrogate + * and the second integer should contain the low surrogate. Both surrogates + * should be written with the most significant byte first. + * + * ----------------------------------------------------------------------------- + * + * It is important to note, when iterating through the code points of a string + * in JavaScript, that if a character is encoded as a surrogate pair it will + * increase the string's length by 2 instead of 1 [4]. For example: + * + * ``` + * > 'a'.length + * 1 + * > '💩'.length + * 2 + * > '語'.length + * 1 + * > 'a💩語'.length + * 4 + * ``` + * + * The results of the above example are explained by the fact that the + * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is. + * + * Because of this idiosyncrasy in JavaScript's string implementation and APIs, + * we must "jump" an extra index after encoding a character as a surrogate + * pair. In practice, this means we must increment the index of our for loop by + * 2 if we encode a surrogate pair, and 1 in all other cases. + * + * ----------------------------------------------------------------------------- + * + * References: + * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf + * 3.9 Unicode Encoding Forms - UTF-8 + * - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html + * - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description + * + */ +export declare const utf16Encode: (input: string, byteOrderMark?: boolean) => Uint16Array; +/** + * Returns `true` if the `codePoint` is within the + * Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded + * with surrogate pairs. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +export declare const isWithinBMP: (codePoint: number) => boolean; +/** + * Returns `true` if the given `codePoint` is valid and must be represented + * with a surrogate pair when encoded. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +export declare const hasSurrogates: (codePoint: number) => boolean; +export declare const highSurrogate: (codePoint: number) => number; +export declare const lowSurrogate: (codePoint: number) => number; +/** + * Decodes a Uint8Array of data to a string using UTF-16. + * + * Note that this function attempts to recover from erronous input by + * inserting the replacement character (�) to mark invalid code points + * and surrogate pairs. + * + * @param input A Uint8Array containing UTF-16 encoded data + * @param byteOrderMark Whether or not a byte order marker (BOM) should be read + * at the start of the encoding. (default `true`) + * @returns The decoded string. + */ +export declare const utf16Decode: (input: Uint8Array, byteOrderMark?: boolean) => string; +export declare const hasUtf16BOM: (bytes: Uint8Array) => boolean; +//# sourceMappingURL=unicode.d.ts.map \ No newline at end of file diff --git a/cjs/utils/unicode.d.ts.map b/cjs/utils/unicode.d.ts.map new file mode 100644 index 000000000..cf060fdc3 --- /dev/null +++ b/cjs/utils/unicode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"unicode.d.ts","sourceRoot":"","sources":["../../src/utils/unicode.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,UAAU,UAAW,MAAM,8BAAyB,UA+ChE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,WAAW,UACf,MAAM,8BAEZ,WAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,cAAe,MAAM,YACN,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,cAAe,MAAM,YACC,CAAC;AAIjD,eAAO,MAAM,aAAa,cAAe,MAAM,WACK,CAAC;AAIrD,eAAO,MAAM,YAAY,cAAe,MAAM,WACJ,CAAC;AAS3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,UACf,UAAU,8BAEhB,MAyCF,CAAC;AA0DF,eAAO,MAAM,WAAW,UAAW,UAAU,YACkB,CAAC"} \ No newline at end of file diff --git a/cjs/utils/unicode.js b/cjs/utils/unicode.js new file mode 100644 index 000000000..3dffb6128 --- /dev/null +++ b/cjs/utils/unicode.js @@ -0,0 +1,370 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hasUtf16BOM = exports.utf16Decode = exports.lowSurrogate = exports.highSurrogate = exports.hasSurrogates = exports.isWithinBMP = exports.utf16Encode = exports.utf8Encode = void 0; +var strings_1 = require("./strings"); +/** + * Encodes a string to UTF-8. + * + * @param input The string to be encoded. + * @param byteOrderMark Whether or not a byte order marker (BOM) should be added + * to the start of the encoding. (default `true`) + * @returns A Uint8Array containing the UTF-8 encoding of the input string. + * + * ----------------------------------------------------------------------------- + * + * JavaScript strings are composed of Unicode code points. Code points are + * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string, + * it must be encoded as a sequence of words. A word is typically 8, 16, or 32 + * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16, + * and UTF-32. These encoding forms are described in the Unicode standard [1]. + * This function implements the UTF-8 encoding form. + * + * ----------------------------------------------------------------------------- + * + * In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes. + * Note that the logic which defines this mapping is slightly convoluted, and + * not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8 + * mapping logic is as follows [2]: + * + * • If a code point is in the range U+0000..U+007F, then view it as a 7-bit + * integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order + * bit set to 0: + * + * b1=0b0xxxxxxx + * + * • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit + * integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits + * of the code point stored in the first byte, and the last 6 bits stored in + * the second byte: + * + * b1=0b110yyyyy b2=0b10xxxxxx + * + * • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit + * integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first + * 4 bits stored in the first byte, the next 6 bits stored in the second byte, + * and the last 6 bits in the third byte: + * + * b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx + * + * • If a code point is in the range U+10000...U+10FFFF, then view it as a + * 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with + * the first 3 bits stored in the first byte, the next 6 bits stored in the + * second byte, the next 6 bits stored in the third byte, and the last 6 bits + * stored in the fourth byte: + * + * b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx + * + * ----------------------------------------------------------------------------- + * + * It is important to note, when iterating through the code points of a string + * in JavaScript, that if a character is encoded as a surrogate pair it will + * increase the string's length by 2 instead of 1 [4]. For example: + * + * ``` + * > 'a'.length + * 1 + * > '💩'.length + * 2 + * > '語'.length + * 1 + * > 'a💩語'.length + * 4 + * ``` + * + * The results of the above example are explained by the fact that the + * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is. + * + * Because of this idiosyncrasy in JavaScript's string implementation and APIs, + * we must "jump" an extra index after encoding a character as a surrogate + * pair. In practice, this means we must increment the index of our for loop by + * 2 if we encode a surrogate pair, and 1 in all other cases. + * + * ----------------------------------------------------------------------------- + * + * References: + * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf + * 3.9 Unicode Encoding Forms - UTF-8 + * - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html + * - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html + * - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description + * + */ +exports.utf8Encode = function (input, byteOrderMark) { + if (byteOrderMark === void 0) { byteOrderMark = true; } + var encoded = []; + if (byteOrderMark) + encoded.push(0xef, 0xbb, 0xbf); + for (var idx = 0, len = input.length; idx < len;) { + var codePoint = input.codePointAt(idx); + // One byte encoding + if (codePoint < 0x80) { + var byte1 = codePoint & 0x7f; + encoded.push(byte1); + idx += 1; + } + // Two byte encoding + else if (codePoint < 0x0800) { + var byte1 = ((codePoint >> 6) & 0x1f) | 0xc0; + var byte2 = (codePoint & 0x3f) | 0x80; + encoded.push(byte1, byte2); + idx += 1; + } + // Three byte encoding + else if (codePoint < 0x010000) { + var byte1 = ((codePoint >> 12) & 0x0f) | 0xe0; + var byte2 = ((codePoint >> 6) & 0x3f) | 0x80; + var byte3 = (codePoint & 0x3f) | 0x80; + encoded.push(byte1, byte2, byte3); + idx += 1; + } + // Four byte encoding (surrogate pair) + else if (codePoint < 0x110000) { + var byte1 = ((codePoint >> 18) & 0x07) | 0xf0; + var byte2 = ((codePoint >> 12) & 0x3f) | 0x80; + var byte3 = ((codePoint >> 6) & 0x3f) | 0x80; + var byte4 = ((codePoint >> 0) & 0x3f) | 0x80; + encoded.push(byte1, byte2, byte3, byte4); + idx += 2; + } + // Should never reach this case + else + throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint)); + } + return new Uint8Array(encoded); +}; +/** + * Encodes a string to UTF-16. + * + * @param input The string to be encoded. + * @param byteOrderMark Whether or not a byte order marker (BOM) should be added + * to the start of the encoding. (default `true`) + * @returns A Uint16Array containing the UTF-16 encoding of the input string. + * + * ----------------------------------------------------------------------------- + * + * JavaScript strings are composed of Unicode code points. Code points are + * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string, + * it must be encoded as a sequence of words. A word is typically 8, 16, or 32 + * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16, + * and UTF-32. These encoding forms are described in the Unicode standard [1]. + * This function implements the UTF-16 encoding form. + * + * ----------------------------------------------------------------------------- + * + * In UTF-16, each code point is mapped to one or two 16-bit integers. The + * UTF-16 mapping logic is as follows [2]: + * + * • If a code point is in the range U+0000..U+FFFF, then map the code point to + * a 16-bit integer with the most significant byte first. + * + * • If a code point is in the range U+10000..U+10000, then map the code point + * to two 16-bit integers. The first integer should contain the high surrogate + * and the second integer should contain the low surrogate. Both surrogates + * should be written with the most significant byte first. + * + * ----------------------------------------------------------------------------- + * + * It is important to note, when iterating through the code points of a string + * in JavaScript, that if a character is encoded as a surrogate pair it will + * increase the string's length by 2 instead of 1 [4]. For example: + * + * ``` + * > 'a'.length + * 1 + * > '💩'.length + * 2 + * > '語'.length + * 1 + * > 'a💩語'.length + * 4 + * ``` + * + * The results of the above example are explained by the fact that the + * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is. + * + * Because of this idiosyncrasy in JavaScript's string implementation and APIs, + * we must "jump" an extra index after encoding a character as a surrogate + * pair. In practice, this means we must increment the index of our for loop by + * 2 if we encode a surrogate pair, and 1 in all other cases. + * + * ----------------------------------------------------------------------------- + * + * References: + * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf + * 3.9 Unicode Encoding Forms - UTF-8 + * - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html + * - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description + * + */ +exports.utf16Encode = function (input, byteOrderMark) { + if (byteOrderMark === void 0) { byteOrderMark = true; } + var encoded = []; + if (byteOrderMark) + encoded.push(0xfeff); + for (var idx = 0, len = input.length; idx < len;) { + var codePoint = input.codePointAt(idx); + // Two byte encoding + if (codePoint < 0x010000) { + encoded.push(codePoint); + idx += 1; + } + // Four byte encoding (surrogate pair) + else if (codePoint < 0x110000) { + encoded.push(exports.highSurrogate(codePoint), exports.lowSurrogate(codePoint)); + idx += 2; + } + // Should never reach this case + else + throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint)); + } + return new Uint16Array(encoded); +}; +/** + * Returns `true` if the `codePoint` is within the + * Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded + * with surrogate pairs. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +exports.isWithinBMP = function (codePoint) { + return codePoint >= 0 && codePoint <= 0xffff; +}; +/** + * Returns `true` if the given `codePoint` is valid and must be represented + * with a surrogate pair when encoded. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +exports.hasSurrogates = function (codePoint) { + return codePoint >= 0x010000 && codePoint <= 0x10ffff; +}; +// From Unicode 3.0 spec, section 3.7: +// http://unicode.org/versions/Unicode3.0.0/ch03.pdf +exports.highSurrogate = function (codePoint) { + return Math.floor((codePoint - 0x10000) / 0x400) + 0xd800; +}; +// From Unicode 3.0 spec, section 3.7: +// http://unicode.org/versions/Unicode3.0.0/ch03.pdf +exports.lowSurrogate = function (codePoint) { + return ((codePoint - 0x10000) % 0x400) + 0xdc00; +}; +var ByteOrder; +(function (ByteOrder) { + ByteOrder["BigEndian"] = "BigEndian"; + ByteOrder["LittleEndian"] = "LittleEndian"; +})(ByteOrder || (ByteOrder = {})); +var REPLACEMENT = '�'.codePointAt(0); +/** + * Decodes a Uint8Array of data to a string using UTF-16. + * + * Note that this function attempts to recover from erronous input by + * inserting the replacement character (�) to mark invalid code points + * and surrogate pairs. + * + * @param input A Uint8Array containing UTF-16 encoded data + * @param byteOrderMark Whether or not a byte order marker (BOM) should be read + * at the start of the encoding. (default `true`) + * @returns The decoded string. + */ +exports.utf16Decode = function (input, byteOrderMark) { + if (byteOrderMark === void 0) { byteOrderMark = true; } + // Need at least 2 bytes of data in UTF-16 encodings + if (input.length <= 1) + return String.fromCodePoint(REPLACEMENT); + var byteOrder = byteOrderMark ? readBOM(input) : ByteOrder.BigEndian; + // Skip byte order mark if needed + var idx = byteOrderMark ? 2 : 0; + var codePoints = []; + while (input.length - idx >= 2) { + var first = decodeValues(input[idx++], input[idx++], byteOrder); + if (isHighSurrogate(first)) { + if (input.length - idx < 2) { + // Need at least 2 bytes left for the low surrogate that is required + codePoints.push(REPLACEMENT); + } + else { + var second = decodeValues(input[idx++], input[idx++], byteOrder); + if (isLowSurrogate(second)) { + codePoints.push(first, second); + } + else { + // Low surrogates should always follow high surrogates + codePoints.push(REPLACEMENT); + } + } + } + else if (isLowSurrogate(first)) { + // High surrogates should always come first since `decodeValues()` + // accounts for the byte ordering + idx += 2; + codePoints.push(REPLACEMENT); + } + else { + codePoints.push(first); + } + } + // There shouldn't be extra byte(s) left over + if (idx < input.length) + codePoints.push(REPLACEMENT); + return String.fromCodePoint.apply(String, codePoints); +}; +/** + * Returns `true` if the given `codePoint` is a high surrogate. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +var isHighSurrogate = function (codePoint) { + return codePoint >= 0xd800 && codePoint <= 0xdbff; +}; +/** + * Returns `true` if the given `codePoint` is a low surrogate. + * @param codePoint The code point to be evaluated. + * + * Reference: https://en.wikipedia.org/wiki/UTF-16#Description + */ +var isLowSurrogate = function (codePoint) { + return codePoint >= 0xdc00 && codePoint <= 0xdfff; +}; +/** + * Decodes the given utf-16 values first and second using the specified + * byte order. + * @param first The first byte of the encoding. + * @param second The second byte of the encoding. + * @param byteOrder The byte order of the encoding. + * Reference: https://en.wikipedia.org/wiki/UTF-16#Examples + */ +var decodeValues = function (first, second, byteOrder) { + // Append the binary representation of the preceding byte by shifting the + // first one 8 to the left and than applying a bitwise or-operator to append + // the second one. + if (byteOrder === ByteOrder.LittleEndian) + return (second << 8) | first; + if (byteOrder === ByteOrder.BigEndian) + return (first << 8) | second; + throw new Error("Invalid byteOrder: " + byteOrder); +}; +/** + * Returns whether the given array contains a byte order mark for the + * UTF-16BE or UTF-16LE encoding. If it has neither, BigEndian is assumed. + * + * Reference: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-16 + * + * @param bytes The byte array to be evaluated. + */ +// prettier-ignore +var readBOM = function (bytes) { return (hasUtf16BigEndianBOM(bytes) ? ByteOrder.BigEndian + : hasUtf16LittleEndianBOM(bytes) ? ByteOrder.LittleEndian + : ByteOrder.BigEndian); }; +var hasUtf16BigEndianBOM = function (bytes) { + return bytes[0] === 0xfe && bytes[1] === 0xff; +}; +var hasUtf16LittleEndianBOM = function (bytes) { + return bytes[0] === 0xff && bytes[1] === 0xfe; +}; +exports.hasUtf16BOM = function (bytes) { + return hasUtf16BigEndianBOM(bytes) || hasUtf16LittleEndianBOM(bytes); +}; +//# sourceMappingURL=unicode.js.map \ No newline at end of file diff --git a/cjs/utils/unicode.js.map b/cjs/utils/unicode.js.map new file mode 100644 index 000000000..4158767cf --- /dev/null +++ b/cjs/utils/unicode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unicode.js","sourceRoot":"","sources":["../../src/utils/unicode.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACU,QAAA,UAAU,GAAG,UAAC,KAAa,EAAE,aAAoB;IAApB,8BAAA,EAAA,oBAAoB;IAC5D,IAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,IAAI,aAAa;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAElD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAI;QACjD,IAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAE,CAAC;QAE1C,oBAAoB;QACpB,IAAI,SAAS,GAAG,IAAI,EAAE;YACpB,IAAM,KAAK,GAAG,SAAS,G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AAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,uBAAuB,CAAC,KAAK,CAAC;AAA7D,CAA6D,CAAC"} \ No newline at end of file diff --git a/cjs/utils/validators.d.ts b/cjs/utils/validators.d.ts new file mode 100644 index 000000000..0e01fc331 --- /dev/null +++ b/cjs/utils/validators.d.ts @@ -0,0 +1,27 @@ +export declare const backtick: (val: any) => string; +export declare const singleQuote: (val: any) => string; +declare type Primitive = string | number | boolean | undefined | null; +export declare const createValueErrorMsg: (value: any, valueName: string, values: Primitive[]) => string; +export declare const assertIsOneOf: (value: any, valueName: string, allowedValues: Primitive[] | { + [key: string]: Primitive; +}) => void; +export declare const assertIsOneOfOrUndefined: (value: any, valueName: string, allowedValues: Primitive[] | { + [key: string]: Primitive; +}) => void; +export declare const assertIsSubset: (values: any[], valueName: string, allowedValues: Primitive[] | { + [key: string]: Primitive; +}) => void; +export declare const getType: (val: any) => any; +export declare type TypeDescriptor = 'null' | 'undefined' | 'string' | 'number' | 'boolean' | 'symbol' | 'bigint' | DateConstructor | ArrayConstructor | Uint8ArrayConstructor | ArrayBufferConstructor | FunctionConstructor | [Function, string]; +export declare const isType: (value: any, type: TypeDescriptor) => boolean; +export declare const createTypeErrorMsg: (value: any, valueName: string, types: TypeDescriptor[]) => string; +export declare const assertIs: (value: any, valueName: string, types: TypeDescriptor[]) => void; +export declare const assertOrUndefined: (value: any, valueName: string, types: TypeDescriptor[]) => void; +export declare const assertEachIs: (values: any[], valueName: string, types: TypeDescriptor[]) => void; +export declare const assertRange: (value: any, valueName: string, min: number, max: number) => void; +export declare const assertRangeOrUndefined: (value: any, valueName: string, min: number, max: number) => void; +export declare const assertMultiple: (value: any, valueName: string, multiplier: number) => void; +export declare const assertInteger: (value: any, valueName: string) => void; +export declare const assertPositive: (value: number, valueName: string) => void; +export {}; +//# sourceMappingURL=validators.d.ts.map \ No newline at end of file diff --git a/cjs/utils/validators.d.ts.map b/cjs/utils/validators.d.ts.map new file mode 100644 index 000000000..3badd5d14 --- /dev/null +++ b/cjs/utils/validators.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,QAAS,GAAG,WAAiB,CAAC;AACnD,eAAO,MAAM,WAAW,QAAS,GAAG,WAAe,CAAC;AAEpD,aAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;AAU9D,eAAO,MAAM,mBAAmB,UACvB,GAAG,aACC,MAAM,UACT,SAAS,EAAE,WAapB,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,GAAG,aACC,MAAM;;UAUlB,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAC5B,GAAG,aACC,MAAM;;UAOlB,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,GAAG,EAAE,aACF,MAAM;;UASlB,CAAC;AAEF,eAAO,MAAM,OAAO,QAAS,GAAG,QAa/B,CAAC;AAEF,oBAAY,cAAc,GACtB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEvB,eAAO,MAAM,MAAM,UAAW,GAAG,QAAQ,cAAc,YActD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACtB,GAAG,aACC,MAAM,SACV,cAAc,EAAE,WAuBxB,CAAC;AAEF,eAAO,MAAM,QAAQ,UACZ,GAAG,aACC,MAAM,SACV,cAAc,EAAE,SAMxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UACrB,GAAG,aACC,MAAM,SACV,cAAc,EAAE,SAGxB,CAAC;AAEF,eAAO,MAAM,YAAY,WACf,GAAG,EAAE,aACF,MAAM,SACV,cAAc,EAAE,SAKxB,CAAC;AAEF,eAAO,MAAM,WAAW,UACf,GAAG,aACC,MAAM,OACZ,MAAM,OACN,MAAM,SAUZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAC1B,GAAG,aACC,MAAM,OACZ,MAAM,OACN,MAAM,SAIZ,CAAC;AAEF,eAAO,MAAM,cAAc,UAClB,GAAG,aACC,MAAM,cACL,MAAM,SAOnB,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,GAAG,aAAa,MAAM,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,MAAM,aAAa,MAAM,SAK9D,CAAC"} \ No newline at end of file diff --git a/cjs/utils/validators.js b/cjs/utils/validators.js new file mode 100644 index 000000000..d2b52604b --- /dev/null +++ b/cjs/utils/validators.js @@ -0,0 +1,183 @@ +"use strict"; +/* tslint:disable:ban-types */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertPositive = exports.assertInteger = exports.assertMultiple = exports.assertRangeOrUndefined = exports.assertRange = exports.assertEachIs = exports.assertOrUndefined = exports.assertIs = exports.createTypeErrorMsg = exports.isType = exports.getType = exports.assertIsSubset = exports.assertIsOneOfOrUndefined = exports.assertIsOneOf = exports.createValueErrorMsg = exports.singleQuote = exports.backtick = void 0; +var objects_1 = require("./objects"); +exports.backtick = function (val) { return "`" + val + "`"; }; +exports.singleQuote = function (val) { return "'" + val + "'"; }; +// prettier-ignore +var formatValue = function (value) { + var type = typeof value; + if (type === 'string') + return exports.singleQuote(value); + else if (type === 'undefined') + return exports.backtick(value); + else + return value; +}; +exports.createValueErrorMsg = function (value, valueName, values) { + var allowedValues = new Array(values.length); + for (var idx = 0, len = values.length; idx < len; idx++) { + var v = values[idx]; + allowedValues[idx] = formatValue(v); + } + var joinedValues = allowedValues.join(' or '); + // prettier-ignore + return exports.backtick(valueName) + " must be one of " + joinedValues + ", but was actually " + formatValue(value); +}; +exports.assertIsOneOf = function (value, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = objects_1.values(allowedValues); + } + for (var idx = 0, len = allowedValues.length; idx < len; idx++) { + if (value === allowedValues[idx]) + return; + } + throw new TypeError(exports.createValueErrorMsg(value, valueName, allowedValues)); +}; +exports.assertIsOneOfOrUndefined = function (value, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = objects_1.values(allowedValues); + } + exports.assertIsOneOf(value, valueName, allowedValues.concat(undefined)); +}; +exports.assertIsSubset = function (values, valueName, allowedValues) { + if (!Array.isArray(allowedValues)) { + allowedValues = objects_1.values(allowedValues); + } + for (var idx = 0, len = values.length; idx < len; idx++) { + exports.assertIsOneOf(values[idx], valueName, allowedValues); + } +}; +exports.getType = function (val) { + if (val === null) + return 'null'; + if (val === undefined) + return 'undefined'; + if (typeof val === 'string') + return 'string'; + if (isNaN(val)) + return 'NaN'; + if (typeof val === 'number') + return 'number'; + if (typeof val === 'boolean') + return 'boolean'; + if (typeof val === 'symbol') + return 'symbol'; + if (typeof val === 'bigint') + return 'bigint'; + if (val.constructor && val.constructor.name) + return val.constructor.name; + if (val.name) + return val.name; + if (val.constructor) + return String(val.constructor); + return String(val); +}; +exports.isType = function (value, type) { + if (type === 'null') + return value === null; + if (type === 'undefined') + return value === undefined; + if (type === 'string') + return typeof value === 'string'; + if (type === 'number') + return typeof value === 'number' && !isNaN(value); + if (type === 'boolean') + return typeof value === 'boolean'; + if (type === 'symbol') + return typeof value === 'symbol'; + if (type === 'bigint') + return typeof value === 'bigint'; + if (type === Date) + return value instanceof Date; + if (type === Array) + return value instanceof Array; + if (type === Uint8Array) + return value instanceof Uint8Array; + if (type === ArrayBuffer) + return value instanceof ArrayBuffer; + if (type === Function) + return value instanceof Function; + return value instanceof type[0]; +}; +exports.createTypeErrorMsg = function (value, valueName, types) { + var allowedTypes = new Array(types.length); + for (var idx = 0, len = types.length; idx < len; idx++) { + var type = types[idx]; + if (type === 'null') + allowedTypes[idx] = exports.backtick('null'); + if (type === 'undefined') + allowedTypes[idx] = exports.backtick('undefined'); + if (type === 'string') + allowedTypes[idx] = exports.backtick('string'); + else if (type === 'number') + allowedTypes[idx] = exports.backtick('number'); + else if (type === 'boolean') + allowedTypes[idx] = exports.backtick('boolean'); + else if (type === 'symbol') + allowedTypes[idx] = exports.backtick('symbol'); + else if (type === 'bigint') + allowedTypes[idx] = exports.backtick('bigint'); + else if (type === Array) + allowedTypes[idx] = exports.backtick('Array'); + else if (type === Uint8Array) + allowedTypes[idx] = exports.backtick('Uint8Array'); + else if (type === ArrayBuffer) + allowedTypes[idx] = exports.backtick('ArrayBuffer'); + else + allowedTypes[idx] = exports.backtick(type[1]); + } + var joinedTypes = allowedTypes.join(' or '); + // prettier-ignore + return exports.backtick(valueName) + " must be of type " + joinedTypes + ", but was actually of type " + exports.backtick(exports.getType(value)); +}; +exports.assertIs = function (value, valueName, types) { + for (var idx = 0, len = types.length; idx < len; idx++) { + if (exports.isType(value, types[idx])) + return; + } + throw new TypeError(exports.createTypeErrorMsg(value, valueName, types)); +}; +exports.assertOrUndefined = function (value, valueName, types) { + exports.assertIs(value, valueName, types.concat('undefined')); +}; +exports.assertEachIs = function (values, valueName, types) { + for (var idx = 0, len = values.length; idx < len; idx++) { + exports.assertIs(values[idx], valueName, types); + } +}; +exports.assertRange = function (value, valueName, min, max) { + exports.assertIs(value, valueName, ['number']); + exports.assertIs(min, 'min', ['number']); + exports.assertIs(max, 'max', ['number']); + max = Math.max(min, max); + if (value < min || value > max) { + // prettier-ignore + throw new Error(exports.backtick(valueName) + " must be at least " + min + " and at most " + max + ", but was actually " + value); + } +}; +exports.assertRangeOrUndefined = function (value, valueName, min, max) { + exports.assertIs(value, valueName, ['number', 'undefined']); + if (typeof value === 'number') + exports.assertRange(value, valueName, min, max); +}; +exports.assertMultiple = function (value, valueName, multiplier) { + exports.assertIs(value, valueName, ['number']); + if (value % multiplier !== 0) { + // prettier-ignore + throw new Error(exports.backtick(valueName) + " must be a multiple of " + multiplier + ", but was actually " + value); + } +}; +exports.assertInteger = function (value, valueName) { + if (!Number.isInteger(value)) { + throw new Error(exports.backtick(valueName) + " must be an integer, but was actually " + value); + } +}; +exports.assertPositive = function (value, valueName) { + if (![1, 0].includes(Math.sign(value))) { + // prettier-ignore + throw new Error(exports.backtick(valueName) + " must be a positive number or 0, but was actually " + value); + } +}; +//# sourceMappingURL=validators.js.map \ No newline at end of file diff --git a/cjs/utils/validators.js.map b/cjs/utils/validators.js.map new file mode 100644 index 000000000..77fb969f3 --- /dev/null +++ b/cjs/utils/validators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;AAE9B,qCAA2D;AAE9C,QAAA,QAAQ,GAAG,UAAC,GAAQ,IAAK,OAAA,MAAK,GAAG,MAAI,EAAZ,CAAY,CAAC;AACtC,QAAA,WAAW,GAAG,UAAC,GAAQ,IAAK,OAAA,MAAI,GAAG,MAAG,EAAV,CAAU,CAAC;AAIpD,kBAAkB;AAClB,IAAM,WAAW,GAAG,UAAC,KAAU;IAC7B,IAAM,IAAI,GAAG,OAAO,KAAK,CAAC;IAC1B,IAAI,IAAI,KAAI,QAAQ;QAAE,OAAO,mBAAW,CAAC,KAAK,CAAC,CAAC;SAC3C,IAAI,IAAI,KAAI,WAAW;QAAE,OAAO,gBAAQ,CAAC,KAAK,CAAC,CAAC;;QAChD,OAAO,KAAK,CAAC;AACpB,CAAC,CAAC;AAEW,QAAA,mBAAmB,GAAG,UACjC,KAAU,EACV,SAAiB,EACjB,MAAmB;IAEnB,IAAM,aAAa,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/C,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;QACvD,IAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACtB,aAAa,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;KACrC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/src/api/form/PDFForm.ts b/src/api/form/PDFForm.ts index e92c833fc..36529cbb9 100644 --- a/src/api/form/PDFForm.ts +++ b/src/api/form/PDFForm.ts @@ -45,6 +45,7 @@ import { assertIs, Cache, assertOrUndefined } from 'src/utils'; export interface FlattenOptions { updateFieldAppearances: boolean; + removeField?: boolean; } /** @@ -534,7 +535,12 @@ export default class PDFForm { * form.flatten(); * ``` */ - flatten(options: FlattenOptions = { updateFieldAppearances: true }) { + flatten( + options: FlattenOptions = { + updateFieldAppearances: true, + removeField: true, + }, + ) { if (options.updateFieldAppearances) { this.updateFieldAppearances(); } @@ -564,8 +570,41 @@ export default class PDFForm { page.pushOperators(...operators); } - this.removeField(field); + if (options.removeField !== false) { + this.removeField(field); + } else { + this.hideField(field); + } + } + } + + /** + * Hide a field by removing its reference on pages, + * this is useful during the flattening process particularly + * if we only want to hide the field but preverse the accessibility tag reference to a form field object + * + * For example: + * ```js + * const form = pdfDoc.getForm(); + * const ageField = form.getFields().find(x => x.getName() === 'Age'); + * form.hideField(ageField); + * ``` + */ + hideField(field: PDFField) { + const widgets = field.acroField.getWidgets(); + const pages: Set = new Set(); + + for (let i = 0, len = widgets.length; i < len; i++) { + const widget = widgets[i]; + const widgetRef = this.findWidgetAppearanceRef(field, widget); + + const page = this.findWidgetPage(widget); + pages.add(page); + + page.node.removeAnnot(widgetRef); } + + pages.forEach((page) => page.node.removeAnnot(field.ref)); } /** From 09d5a5a27f6397eb197a4a98c4ed97cbf52ba680 Mon Sep 17 00:00:00 2001 From: Andrei Nakagawa Date: Mon, 16 May 2022 21:22:34 +1200 Subject: [PATCH 02/17] feat: adding github actions to backup repository to s3 --- .github/workflows/github_backup.yaml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/github_backup.yaml diff --git a/.github/workflows/github_backup.yaml b/.github/workflows/github_backup.yaml new file mode 100644 index 000000000..0ef29abd0 --- /dev/null +++ b/.github/workflows/github_backup.yaml @@ -0,0 +1,33 @@ +name: Mirror repository to S3 +on: + push: + branches: + - master +jobs: + BackupRepoToS3: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure aws credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-region: ap-southeast-2 + role-to-assume: arn:aws:iam::817632051851:role/oidc-github-actions-mattrglobal-global + role-duration-seconds: 900 + role-session-name: GithubActions + + - name: Backing up this repo to AWS S3 + uses: peter-evans/s3-backup@v1 + env: + AWS_REGION: ${{ env.AWS_REGION }} + ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + MIRROR_TARGET: mattrglobal-github-backup/pdf-lib + SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} + with: + args: --overwrite --remove \ No newline at end of file From 69ba76649cd89879d23fba957b5af02fddb4a577 Mon Sep 17 00:00:00 2001 From: Kirill Ivanov <143980666+kirill-ivanov-mattr@users.noreply.github.com> Date: Wed, 3 Sep 2025 10:01:42 +1200 Subject: [PATCH 03/17] Ki/add assurance workflow (#3) * chore: adding workflow to mirror repo to mattrassurance org * chore: adding workflow to mirror repo to mattrassurance org --- .github/workflows/github_clone_assurance.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/github_clone_assurance.yaml diff --git a/.github/workflows/github_clone_assurance.yaml b/.github/workflows/github_clone_assurance.yaml new file mode 100644 index 000000000..67c656510 --- /dev/null +++ b/.github/workflows/github_clone_assurance.yaml @@ -0,0 +1,29 @@ +name: Mirror repository to mattrassurance org +on: + workflow_dispatch: + push: + branches: + - master + - main + +jobs: + MirrorRepoToMATTRAssurance: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: mirror repo + run: | + rm -r .git + rm -r .github + git init --initial-branch=${{ github.ref_name }} + git config --local user.name ${{ secrets.MATTRASSURANCE_GIT_USER_NAME }} + git config --local user.email ${{ secrets.MATTRASSURANCE_GIT_USER_EMAIL }} + git add . + git commit -m "Backing up ${{ github.repository }} to mattrassurance org" + git remote add origin https://${{ secrets.MATTRASSURANCE_GIT_USER_NAME }}:${{ secrets.MATTRASSURANCE_GIT_USER_PAT }}@github.com/mattrassurance/${{ github.event.repository.name }}.git + git push origin ${{ github.ref_name }} --force From 9686d5c8867539c20919a08dac9a41a1db4e4d79 Mon Sep 17 00:00:00 2001 From: Pablo De Nadai Date: Wed, 24 Sep 2025 13:59:54 +1200 Subject: [PATCH 04/17] chore: remove sample apps for deno, web and rn (#4) --- apps/deno/dummy.d.ts | 20 - apps/deno/index.ts | 188 - apps/deno/tests/test1.ts | 664 -- apps/deno/tests/test10.ts | 299 - apps/deno/tests/test11.ts | 136 - apps/deno/tests/test12.ts | 285 - apps/deno/tests/test13.ts | 89 - apps/deno/tests/test14.ts | 141 - apps/deno/tests/test15.ts | 150 - apps/deno/tests/test16.ts | 500 -- apps/deno/tests/test17.ts | 200 - apps/deno/tests/test18.ts | 254 - apps/deno/tests/test2.ts | 122 - apps/deno/tests/test3.ts | 131 - apps/deno/tests/test4.ts | 86 - apps/deno/tests/test5.ts | 61 - apps/deno/tests/test6.ts | 135 - apps/deno/tests/test7.ts | 71 - apps/deno/tests/test8.ts | 45 - apps/deno/tests/test9.ts | 69 - apps/rn/.buckconfig | 6 - apps/rn/.flowconfig | 69 - apps/rn/.gitattributes | 1 - apps/rn/.gitignore | 56 - apps/rn/.watchmanconfig | 1 - apps/rn/__tests__/App-test.js | 14 - apps/rn/android/app/BUCK | 55 - apps/rn/android/app/build.gradle | 177 - apps/rn/android/app/build_defs.bzl | 19 - apps/rn/android/app/proguard-rules.pro | 17 - .../android/app/src/debug/AndroidManifest.xml | 8 - .../android/app/src/main/AndroidManifest.xml | 26 - .../java/com/pdflibtester/MainActivity.java | 15 - .../com/pdflibtester/MainApplication.java | 49 - .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2096 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 2858 -> 0 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4569 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7098 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 6464 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 10676 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 9250 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 15523 -> 0 bytes .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 8 - apps/rn/android/build.gradle | 33 - apps/rn/android/gradle.properties | 18 - .../android/gradle/wrapper/gradle-wrapper.jar | Bin 55616 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 - apps/rn/android/gradlew | 188 - apps/rn/android/gradlew.bat | 100 - apps/rn/android/keystores/BUCK | 8 - .../keystores/debug.keystore.properties | 4 - apps/rn/android/settings.gradle | 7 - apps/rn/app.json | 4 - apps/rn/babel.config.js | 3 - apps/rn/index.js | 9 - apps/rn/ios/PdfLibTester-tvOS/Info.plist | 54 - apps/rn/ios/PdfLibTester-tvOSTests/Info.plist | 24 - .../PdfLibTester.xcodeproj/project.pbxproj | 1639 ---- .../xcschemes/PdfLibTester-tvOS.xcscheme | 129 - .../xcschemes/PdfLibTester.xcscheme | 129 - apps/rn/ios/PdfLibTester/AppDelegate.h | 15 - apps/rn/ios/PdfLibTester/AppDelegate.m | 42 - .../PdfLibTester/Base.lproj/LaunchScreen.xib | 42 - .../AppIcon.appiconset/Contents.json | 38 - .../Images.xcassets/Contents.json | 6 - apps/rn/ios/PdfLibTester/Info.plist | 60 - apps/rn/ios/PdfLibTester/main.m | 16 - apps/rn/ios/PdfLibTesterTests/Info.plist | 24 - .../ios/PdfLibTesterTests/PdfLibTesterTests.m | 68 - apps/rn/metro.config.js | 16 - apps/rn/package.json | 30 - apps/rn/src/components/App.js | 99 - apps/rn/src/components/ErrorDisplay.js | 50 - apps/rn/src/components/TestLauncher.js | 100 - apps/rn/src/components/TestResultDisplay.js | 76 - apps/rn/src/components/TestRunningSpinner.js | 35 - apps/rn/src/tests/assets.js | 66 - apps/rn/src/tests/test1.js | 698 -- apps/rn/src/tests/test10.js | 291 - apps/rn/src/tests/test11.js | 129 - apps/rn/src/tests/test12.js | 290 - apps/rn/src/tests/test13.js | 91 - apps/rn/src/tests/test14.js | 138 - apps/rn/src/tests/test15.js | 151 - apps/rn/src/tests/test16.js | 502 -- apps/rn/src/tests/test17.js | 204 - apps/rn/src/tests/test18.js | 299 - apps/rn/src/tests/test2.js | 128 - apps/rn/src/tests/test3.js | 141 - apps/rn/src/tests/test4.js | 86 - apps/rn/src/tests/test5.js | 60 - apps/rn/src/tests/test6.js | 143 - apps/rn/src/tests/test7.js | 74 - apps/rn/src/tests/test8.js | 44 - apps/rn/src/tests/test9.js | 70 - apps/rn/yarn.lock | 6574 ----------------- apps/web/index.css | 33 - apps/web/test1.html | 780 -- apps/web/test10.html | 343 - apps/web/test11.html | 178 - apps/web/test12.html | 341 - apps/web/test13.html | 139 - apps/web/test14.html | 185 - apps/web/test15.html | 203 - apps/web/test16.html | 576 -- apps/web/test17.html | 261 - apps/web/test18.html | 352 - apps/web/test2.html | 174 - apps/web/test3.html | 181 - apps/web/test4.html | 129 - apps/web/test5.html | 102 - apps/web/test6.html | 191 - apps/web/test7.html | 130 - apps/web/test8.html | 88 - apps/web/test9.html | 115 - apps/web/utils.js | 33 - 119 files changed, 21954 deletions(-) delete mode 100644 apps/deno/dummy.d.ts delete mode 100644 apps/deno/index.ts delete mode 100644 apps/deno/tests/test1.ts delete mode 100644 apps/deno/tests/test10.ts delete mode 100644 apps/deno/tests/test11.ts delete mode 100644 apps/deno/tests/test12.ts delete mode 100644 apps/deno/tests/test13.ts delete mode 100644 apps/deno/tests/test14.ts delete mode 100644 apps/deno/tests/test15.ts delete mode 100644 apps/deno/tests/test16.ts delete mode 100644 apps/deno/tests/test17.ts delete mode 100644 apps/deno/tests/test18.ts delete mode 100644 apps/deno/tests/test2.ts delete mode 100644 apps/deno/tests/test3.ts delete mode 100644 apps/deno/tests/test4.ts delete mode 100644 apps/deno/tests/test5.ts delete mode 100644 apps/deno/tests/test6.ts delete mode 100644 apps/deno/tests/test7.ts delete mode 100644 apps/deno/tests/test8.ts delete mode 100644 apps/deno/tests/test9.ts delete mode 100644 apps/rn/.buckconfig delete mode 100644 apps/rn/.flowconfig delete mode 100644 apps/rn/.gitattributes delete mode 100644 apps/rn/.gitignore delete mode 100644 apps/rn/.watchmanconfig delete mode 100644 apps/rn/__tests__/App-test.js delete mode 100644 apps/rn/android/app/BUCK delete mode 100644 apps/rn/android/app/build.gradle delete mode 100644 apps/rn/android/app/build_defs.bzl delete mode 100644 apps/rn/android/app/proguard-rules.pro delete mode 100644 apps/rn/android/app/src/debug/AndroidManifest.xml delete mode 100644 apps/rn/android/app/src/main/AndroidManifest.xml delete mode 100644 apps/rn/android/app/src/main/java/com/pdflibtester/MainActivity.java delete mode 100644 apps/rn/android/app/src/main/java/com/pdflibtester/MainApplication.java delete mode 100644 apps/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 apps/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png delete mode 100644 apps/rn/android/app/src/main/res/values/strings.xml delete mode 100644 apps/rn/android/app/src/main/res/values/styles.xml delete mode 100644 apps/rn/android/build.gradle delete mode 100644 apps/rn/android/gradle.properties delete mode 100644 apps/rn/android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 apps/rn/android/gradle/wrapper/gradle-wrapper.properties delete mode 100755 apps/rn/android/gradlew delete mode 100644 apps/rn/android/gradlew.bat delete mode 100644 apps/rn/android/keystores/BUCK delete mode 100644 apps/rn/android/keystores/debug.keystore.properties delete mode 100644 apps/rn/android/settings.gradle delete mode 100644 apps/rn/app.json delete mode 100644 apps/rn/babel.config.js delete mode 100644 apps/rn/index.js delete mode 100644 apps/rn/ios/PdfLibTester-tvOS/Info.plist delete mode 100644 apps/rn/ios/PdfLibTester-tvOSTests/Info.plist delete mode 100644 apps/rn/ios/PdfLibTester.xcodeproj/project.pbxproj delete mode 100644 apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester-tvOS.xcscheme delete mode 100644 apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester.xcscheme delete mode 100644 apps/rn/ios/PdfLibTester/AppDelegate.h delete mode 100644 apps/rn/ios/PdfLibTester/AppDelegate.m delete mode 100644 apps/rn/ios/PdfLibTester/Base.lproj/LaunchScreen.xib delete mode 100644 apps/rn/ios/PdfLibTester/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 apps/rn/ios/PdfLibTester/Images.xcassets/Contents.json delete mode 100644 apps/rn/ios/PdfLibTester/Info.plist delete mode 100644 apps/rn/ios/PdfLibTester/main.m delete mode 100644 apps/rn/ios/PdfLibTesterTests/Info.plist delete mode 100644 apps/rn/ios/PdfLibTesterTests/PdfLibTesterTests.m delete mode 100644 apps/rn/metro.config.js delete mode 100644 apps/rn/package.json delete mode 100644 apps/rn/src/components/App.js delete mode 100644 apps/rn/src/components/ErrorDisplay.js delete mode 100644 apps/rn/src/components/TestLauncher.js delete mode 100644 apps/rn/src/components/TestResultDisplay.js delete mode 100644 apps/rn/src/components/TestRunningSpinner.js delete mode 100644 apps/rn/src/tests/assets.js delete mode 100644 apps/rn/src/tests/test1.js delete mode 100644 apps/rn/src/tests/test10.js delete mode 100644 apps/rn/src/tests/test11.js delete mode 100644 apps/rn/src/tests/test12.js delete mode 100644 apps/rn/src/tests/test13.js delete mode 100644 apps/rn/src/tests/test14.js delete mode 100644 apps/rn/src/tests/test15.js delete mode 100644 apps/rn/src/tests/test16.js delete mode 100644 apps/rn/src/tests/test17.js delete mode 100644 apps/rn/src/tests/test18.js delete mode 100644 apps/rn/src/tests/test2.js delete mode 100644 apps/rn/src/tests/test3.js delete mode 100644 apps/rn/src/tests/test4.js delete mode 100644 apps/rn/src/tests/test5.js delete mode 100644 apps/rn/src/tests/test6.js delete mode 100644 apps/rn/src/tests/test7.js delete mode 100644 apps/rn/src/tests/test8.js delete mode 100644 apps/rn/src/tests/test9.js delete mode 100644 apps/rn/yarn.lock delete mode 100644 apps/web/index.css delete mode 100644 apps/web/test1.html delete mode 100644 apps/web/test10.html delete mode 100644 apps/web/test11.html delete mode 100644 apps/web/test12.html delete mode 100644 apps/web/test13.html delete mode 100644 apps/web/test14.html delete mode 100644 apps/web/test15.html delete mode 100644 apps/web/test16.html delete mode 100644 apps/web/test17.html delete mode 100644 apps/web/test18.html delete mode 100644 apps/web/test2.html delete mode 100644 apps/web/test3.html delete mode 100644 apps/web/test4.html delete mode 100644 apps/web/test5.html delete mode 100644 apps/web/test6.html delete mode 100644 apps/web/test7.html delete mode 100644 apps/web/test8.html delete mode 100644 apps/web/test9.html delete mode 100644 apps/web/utils.js diff --git a/apps/deno/dummy.d.ts b/apps/deno/dummy.d.ts deleted file mode 100644 index f857371db..000000000 --- a/apps/deno/dummy.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare const ParseSpeeds: any; -declare const PDFPage: any; -declare const clip: any; -declare const clipEvenOdd: any; -declare const closePath: any; -declare const cmyk: any; -declare const degrees: any; -declare const drawRectangle: any; -declare const endPath: any; -declare const grayscale: any; -declare const LineCapStyle: any; -declare const LineJoinStyle: any; -declare const typedArrayFor: any; -declare const lineTo: any; -declare const PDFDocument: any; -declare const popGraphicsState: any; -declare const pushGraphicsState: any; -declare const rgb: any; -declare const setLineJoin: any; -declare const StandardFonts: any; diff --git a/apps/deno/index.ts b/apps/deno/index.ts deleted file mode 100644 index 7c14a367c..000000000 --- a/apps/deno/index.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { readLines } from 'https://deno.land/std@0.67.0/io/bufio.ts'; -import { SEP, dirname } from 'https://deno.land/std@0.67.0/path/mod.ts'; - -import { default as test1 } from './tests/test1.ts'; -import { default as test2 } from './tests/test2.ts'; -import { default as test3 } from './tests/test3.ts'; -import { default as test4 } from './tests/test4.ts'; -import { default as test5 } from './tests/test5.ts'; -import { default as test6 } from './tests/test6.ts'; -import { default as test7 } from './tests/test7.ts'; -import { default as test8 } from './tests/test8.ts'; -import { default as test9 } from './tests/test9.ts'; -import { default as test10 } from './tests/test10.ts'; -import { default as test11 } from './tests/test11.ts'; -import { default as test12 } from './tests/test12.ts'; -import { default as test13 } from './tests/test13.ts'; -import { default as test14 } from './tests/test14.ts'; -import { default as test15 } from './tests/test15.ts'; -import { default as test16 } from './tests/test16.ts'; -import { default as test17 } from './tests/test17.ts'; -import { default as test18 } from './tests/test18.ts'; - -const promptToContinue = () => { - const prompt = 'Press to run the next test...'; - Deno.stdout.write(new TextEncoder().encode(prompt)); - return readLines(Deno.stdin).next(); -}; - -// This needs to be more sophisticated to work on Linux as well. -const openPdf = (path: string, reader: string = '') => { - if (Deno.build.os === 'darwin') { - Deno.run({ cmd: ['open', '-a', reader || 'Preview', path] }); - // Deno.run({ cmd: ['open', '-a', 'Preview', path] }); - // Deno.run({ cmd: ['open', '-a', 'Adobe Acrobat', path] }); - // Deno.run({ cmd: ['open', '-a', 'Foxit Reader', path] }); - // Deno.run({ cmd: ['open', '-a', 'Google Chrome', path] }); - // Deno.run({ cmd: ['open', '-a', 'Firefox', path] }); - } else if (Deno.build.os === 'windows') { - // Opens with the default PDF Reader, has room for improvment - Deno.run({ cmd: ['cmd', '/c', 'start', path] }); - } else { - const msg1 = `Note: Automatically opening PDFs currently only works on Macs and Windows. If you're using a Linux machine, please consider contributing to expand support for this feature`; - const msg2 = `(https://github.com/Hopding/pdf-lib/blob/master/apps/node/index.ts#L8-L17)\n`; - console.warn(msg1); - console.warn(msg2); - } -}; - -const tempDir = () => dirname(Deno.makeTempDirSync()); - -const writePdfToTmp = (pdf: Uint8Array) => { - const path = `${tempDir()}${SEP}${Date.now()}.pdf`; - Deno.writeFileSync(path, pdf); - return path; -}; - -const readFont = (font: string) => Deno.readFileSync(`assets/fonts/${font}`); - -const readImage = (image: string) => - Deno.readFileSync(`assets/images/${image}`); - -const readPdf = (pdf: string) => Deno.readFileSync(`assets/pdfs/${pdf}`); - -const decoder = new TextDecoder('utf-8'); -const readBase64Font = (font: string) => decoder.decode(readFont(font)); -const readBase64Image = (image: string) => decoder.decode(readImage(image)); -const readBase64Pdf = (pdf: string) => decoder.decode(readPdf(pdf)); - -const assets = { - fonts: { - ttf: { - ubuntu_r: readFont('ubuntu/Ubuntu-R.ttf'), - ubuntu_r_base64: readBase64Font('ubuntu/Ubuntu-R.ttf.base64'), - bio_rhyme_r: readFont('bio_rhyme/BioRhymeExpanded-Regular.ttf'), - press_start_2p_r: readFont('press_start_2p/PressStart2P-Regular.ttf'), - indie_flower_r: readFont('indie_flower/IndieFlower.ttf'), - great_vibes_r: readFont('great_vibes/GreatVibes-Regular.ttf'), - nunito: readFont('nunito/Nunito-Regular.ttf'), - }, - otf: { - fantasque_sans_mono_bi: readFont( - 'fantasque/OTF/FantasqueSansMono-BoldItalic.otf', - ), - apple_storm_r: readFont('apple_storm/AppleStormCBo.otf'), - hussar_3d_r: readFont('hussar_3d/Hussar3DFour.otf'), - source_hans_jp: readFont('source_hans_jp/SourceHanSerifJP-Regular.otf'), - }, - }, - images: { - jpg: { - cat_riding_unicorn: readImage('cat_riding_unicorn.jpg'), - cat_riding_unicorn_base64: readBase64Image( - 'cat_riding_unicorn.jpg.base64', - ), - minions_laughing: readImage('minions_laughing.jpg'), - cmyk_colorspace: readImage('cmyk_colorspace.jpg'), - }, - png: { - greyscale_bird: readImage('greyscale_bird.png'), - greyscale_bird_base64_uri: readBase64Image( - 'greyscale_bird.png.base64.uri', - ), - minions_banana_alpha: readImage('minions_banana_alpha.png'), - minions_banana_no_alpha: readImage('minions_banana_no_alpha.png'), - small_mario: readImage('small_mario.png'), - etwe: readImage('etwe.png'), - self_drive: readImage('self_drive.png'), - mario_emblem: readImage('mario_emblem.png'), - }, - }, - pdfs: { - normal: readPdf('normal.pdf'), - normal_base64: readBase64Pdf('normal.pdf.base64'), - with_update_sections: readPdf('with_update_sections.pdf'), - with_update_sections_base64_uri: readBase64Pdf( - 'with_update_sections.pdf.base64.uri', - ), - linearized_with_object_streams: readPdf( - 'linearized_with_object_streams.pdf', - ), - with_large_page_count: readPdf('with_large_page_count.pdf'), - with_missing_endstream_eol_and_polluted_ctm: readPdf( - 'with_missing_endstream_eol_and_polluted_ctm.pdf', - ), - with_newline_whitespace_in_indirect_object_numbers: readPdf( - 'with_newline_whitespace_in_indirect_object_numbers.pdf', - ), - with_comments: readPdf('with_comments.pdf'), - with_cropbox: readPdf('with_cropbox.pdf'), - us_constitution: readPdf('us_constitution.pdf'), - simple_pdf_2_example: readPdf('pdf20examples/Simple PDF 2.0 file.pdf'), - with_combed_fields: readPdf('with_combed_fields.pdf'), - dod_character: readPdf('dod_character.pdf'), - with_xfa_fields: readPdf('with_xfa_fields.pdf'), - fancy_fields: readPdf('fancy_fields.pdf'), - form_to_flatten: readPdf('form_to_flatten.pdf'), - with_annots: readPdf('with_annots.pdf'), - }, -}; - -export type Assets = typeof assets; -// export type Assets = any; - -// This script can be executed with 0, 1, or 2 CLI arguments: -// $ deno index.ts -// $ deno index.ts 3 -// $ deno index.ts 'Adobe Acrobat' -// $ deno index.ts 3 'Adobe Acrobat' -const loadCliArgs = (): { testIdx?: number; reader?: string } => { - const { args } = Deno; - - if (args.length === 0) return {}; - - if (args.length === 1) { - if (isFinite(Number(args[0]))) return { testIdx: Number(args[0]) }; - else return { reader: args[0] }; - } - - return { testIdx: Number(args[0]), reader: args[1] }; -}; - -const main = async () => { - const { testIdx, reader } = loadCliArgs(); - - // prettier-ignore - const allTests = [ - test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, - test11, test12, test13, test14, test15, test16, test17, test18 - ]; - - const tests = testIdx ? [allTests[testIdx - 1]] : allTests; - - let idx = testIdx || 1; - for (const test of tests) { - console.log(`Running test #${idx}`); - const pdfBytes = await test(assets); - const path = writePdfToTmp(pdfBytes); - console.log(`> PDF file written to: ${path}`); - openPdf(path, reader); - idx += 1; - await promptToContinue(); - console.log(); - } - - console.log('Done!'); -}; - -main(); diff --git a/apps/deno/tests/test1.ts b/apps/deno/tests/test1.ts deleted file mode 100644 index fe71ed5c7..000000000 --- a/apps/deno/tests/test1.ts +++ /dev/null @@ -1,664 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - clip, - clipEvenOdd, - closePath, - cmyk, - degrees, - drawRectangle, - endPath, - grayscale, - LineCapStyle, - LineJoinStyle, - typedArrayFor, - lineTo, - moveTo, - PDFDocument, - popGraphicsState, - pushGraphicsState, - rgb, - setLineJoin, - StandardFonts, - AFRelationship, -} from '../../../dist/pdf-lib.esm.js'; - -const ipsumLines = [ - 'Eligendi est pariatur quidem in non excepturi et.', - 'Consectetur non tenetur magnam est corporis tempor.', - 'Labore nisi officiis quia ipsum qui voluptatem omnis.', -]; - -// This test creates a new PDF document and inserts pages to it. -// Each page is testing different features of pdf-lib. -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.create(); - - pdfDoc.setTitle('🥚 The Life of an Egg 🍳', { showInWindowTitleBar: true }); - pdfDoc.setAuthor('Humpty Dumpty'); - pdfDoc.setSubject('📘 An Epic Tale of Woe 📖'); - pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men']); - pdfDoc.setProducer('PDF App 9000 🤖'); - pdfDoc.setCreator('PDF App 9000 🤖'); - pdfDoc.setCreationDate(new Date('2018-06-24T01:58:37.228Z')); - pdfDoc.setModificationDate(new Date('2018-12-21T07:00:11.000Z')); - - pdfDoc.registerFontkit(fontkit); - - await pdfDoc.attach(assets.images.png.greyscale_bird, 'bird.png', { - mimeType: 'image/png', - description: 'A bird in greyscale 🐦', - creationDate: new Date('2006/06/06'), - modificationDate: new Date('2007/07/07'), - afRelationship: AFRelationship.Data, - }); - - const csvString = [ - 'Year,Make,Model', - '1997,Ford,E350', - '2000,Mercury,Cougar', - ].join('\n'); - await pdfDoc.attach(typedArrayFor(csvString), 'cars.csv', { - mimeType: 'text/csv', - description: 'Some car info 🚗', - creationDate: new Date('2000/01/13'), - modificationDate: new Date('2012/12/12'), - afRelationship: AFRelationship.Unspecified, - }); - - const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman); - - const size = 750; - - pdfDoc.addJavaScript( - 'main', - 'console.show(); console.println("Hello World!")', - ); - - /********************** Page 1 **********************/ - - // This page tests different drawing operations as well as adding custom - // operators to the page content. - - const page1 = pdfDoc.addPage([size, size]); - - // Upper-left Quadrant - page1.moveTo(0, size / 2); - page1.drawSquare({ size: size / 2, color: rgb(1, 0, 0) }); - page1.pushOperators( - pushGraphicsState(), - moveTo(0, size / 2), - lineTo(0, size), - lineTo(size / 2, size), - closePath(), - clip(), - endPath(), - ...drawRectangle({ - x: size / 8, - y: size / 2 + size / 8, - width: size / 4, - height: size / 4, - borderWidth: 50, - borderColor: rgb(1, 1, 0), - rotate: degrees(0), - xSkew: degrees(0), - ySkew: degrees(0), - color: undefined, - }), - popGraphicsState(), - ); - - // Upper-right quadrant - page1.pushOperators(pushGraphicsState()); - page1.moveTo(size / 2, size / 2); - page1.drawSquare({ size: size / 2, color: rgb(0, 1, 0) }); - page1.drawEllipse({ - x: size / 2 + size / 4, - y: size / 2 + size / 4, - xScale: 25, - yScale: 150, - color: rgb(255 / 255, 153 / 255, 51 / 255), - borderWidth: 2, - borderColor: rgb(0, 1, 1), - borderDashArray: [10], - }); - page1.drawEllipse({ - x: size / 2 + size / 4, - y: size / 2 + size / 4, - xScale: 75, - yScale: 50, - color: undefined, - }); - page1.drawEllipse({ - x: size / 2 + size / 4, - y: size / 2 + size / 4, - xScale: 150, - yScale: 100, - color: undefined, - }); - page1.pushOperators(clipEvenOdd(), endPath()); - page1.setFont(timesRomanFont); - page1.setFontColor(rgb(1, 0, 1)); - page1.setFontSize(32); - page1.setLineHeight(32); - page1.moveTo(size / 2 + 5, size - 5 - 25); - page1.drawText( - [...ipsumLines, ...ipsumLines, ...ipsumLines, ...ipsumLines].join('\n'), - ); - page1.pushOperators(popGraphicsState()); - - // Lower-left quadrant - page1.moveTo(0, 0); - page1.drawSquare({ size: size / 2, color: cmyk(1, 0, 0, 0) }); - page1.drawCircle({ - x: size / 4, - y: size / 4, - size: 150, - borderWidth: 10, - borderDashArray: [25], - borderDashPhase: 25, - borderColor: cmyk(0, 1, 0, 0), - borderLineCap: LineCapStyle.Round, - }); - - page1.drawLine({ - start: { - x: size / 4, - y: size / 4, - }, - end: { - x: size / 4 + 100, - y: size / 4 + 100, - }, - color: rgb(0, 1, 0), - thickness: 3, - dashArray: [12, 6], - lineCap: LineCapStyle.Round, - }); - - // Lower-right quadrant - page1.moveTo(size / 2, 0); - page1.drawSquare({ size: size / 2, color: grayscale(0.8) }); - page1.pushOperators(pushGraphicsState(), setLineJoin(LineJoinStyle.Round)); - page1.drawSquare({ - x: size / 2 + size / 4, - y: 25, - size: size / 2.25 - 2 * 50, - rotate: degrees(45), - borderColor: grayscale(0.6), - borderWidth: 15, - }); - page1.pushOperators(setLineJoin(LineJoinStyle.Bevel)); - page1.drawSquare({ - x: size / 2 + 54, - y: size / 4 + 1, - size: size / 2.25 - 2 * 100, - rotate: degrees(-45), - xSkew: degrees(45 / 2), - ySkew: degrees(45 / 2), - color: grayscale(1), - borderColor: grayscale(0), - borderWidth: 15, - }); - page1.pushOperators(popGraphicsState()); - - // Middle - const squareSize = 40; - page1.drawSquare({ - x: size / 2 - squareSize / 2, - y: size / 2 - squareSize / 2, - size: squareSize, - borderWidth: 2, - borderColor: rgb(1, 0, 1), - borderDashArray: [2, 4], - }); - - const rectangleSizeX = 60; - const rectangleSizeY = 50; - page1.drawRectangle({ - x: size / 2 - rectangleSizeX / 2, - y: size / 2 - rectangleSizeY / 2, - width: rectangleSizeX, - height: rectangleSizeY, - borderWidth: 2, - borderColor: rgb(1, 1, 1), - borderDashArray: [4, 8], - }); - - /********************** Page 2 **********************/ - - // This page tests placement of text with different fonts - - const page2 = pdfDoc.addPage([size, size]); - - page2.drawSquare({ size, color: rgb(253 / 255, 246 / 255, 227 / 255) }); - page2.setFontColor(rgb(101 / 255, 123 / 255, 131 / 255)); - - const { fonts } = assets; - - const ubuntuFont = await pdfDoc.embedFont(fonts.ttf.ubuntu_r_base64, { - subset: true, - }); - page2.drawText(ipsumLines.join('\n'), { - y: size - 20, - size: 20, - font: ubuntuFont, - lineHeight: 20, - }); - - const fantasqueFont = await pdfDoc.embedFont( - fonts.otf.fantasque_sans_mono_bi, - ); - page2.drawText(ipsumLines.join('\n'), { - y: size - 105, - size: 25, - font: fantasqueFont, - lineHeight: 25, - }); - - const indieFlowerFont = await pdfDoc.embedFont(fonts.ttf.indie_flower_r, { - subset: true, - }); - page2.drawText(ipsumLines.join('\n'), { - y: size - 200, - size: 25, - font: indieFlowerFont, - lineHeight: 25, - }); - - const greatVibesFont = await pdfDoc.embedFont(fonts.ttf.great_vibes_r, { - subset: true, - }); - page2.drawText(ipsumLines.join('\n'), { - y: size - 300, - size: 30, - font: greatVibesFont, - lineHeight: 30, - }); - - const appleStormFont = await pdfDoc.embedFont(fonts.otf.apple_storm_r); - page2.drawText(ipsumLines.join('\n'), { - y: size - 425, - size: 25, - font: appleStormFont, - lineHeight: 25, - }); - - const bioRhymeFont = await pdfDoc.embedFont(fonts.ttf.bio_rhyme_r, { - subset: true, - }); - page2.drawText(ipsumLines.join('\n'), { - y: size - 500, - size: 15, - font: bioRhymeFont, - lineHeight: 15, - }); - - const pressStart2PFont = await pdfDoc.embedFont(fonts.ttf.press_start_2p_r, { - subset: true, - }); - page2.drawText(ipsumLines.join('\n'), { - y: size - 575, - size: 15, - font: pressStart2PFont, - lineHeight: 15, - }); - - const hussar3DFont = await pdfDoc.embedFont(fonts.otf.hussar_3d_r); - page2.drawText(ipsumLines.join('\n'), { - y: size - 650, - size: 25, - font: hussar3DFont, - lineHeight: 25, - }); - - /********************** Page 3 **********************/ - - // This page tests embedding and placing different images. - - const page3Height = 1750; - const page3 = pdfDoc.addPage([size, page3Height]); - - const { jpg, png } = assets.images; - - const catRidingUnicornImage = await pdfDoc.embedJpg( - jpg.cat_riding_unicorn_base64, - ); - const minionsLaughingImage = await pdfDoc.embedJpg(jpg.minions_laughing); - const greyscaleBirdImage = await pdfDoc.embedPng( - png.greyscale_bird_base64_uri, - ); - const minionsBananaAlphaImage = await pdfDoc.embedPng( - png.minions_banana_alpha, - ); - const minionsBananaNoAlphaImage = await pdfDoc.embedPng( - png.minions_banana_no_alpha, - ); - const smallMarioImage = await pdfDoc.embedPng(png.small_mario); - - const catRidingUnicornDims = catRidingUnicornImage.scale(0.2); - const minionsLaughingDims = minionsLaughingImage.scale(0.75); - const greyscaleBirdDims = greyscaleBirdImage.scale(0.75); - const minionsBananaAlphaDims = minionsBananaAlphaImage.scale(0.5); - const minionsBananaNoAlphaDims = minionsBananaNoAlphaImage.scale(0.5); - const smallMarioDims = smallMarioImage.scale(0.18); - - // page3.pushOperators( - // setTextRenderingMode(TextRenderingMode.OutlineAndClip), - // setStrokingColor(rgb(0.5, 0.5, 0.5)), - // ); - // page3.drawText('Unicornz!', { - // x: 75, - // y: page3Height - catRidingUnicornDims.height + 75, - // font: ubuntuFont, - // size: 50, - // }); - // page3.pushOperators(clip(), endPath()); - - page3.moveTo(0, 0); - page3.drawRectangle({ - width: minionsBananaAlphaDims.width, - height: - minionsBananaAlphaDims.height + - minionsBananaNoAlphaDims.height + - smallMarioDims.height, - color: rgb(0, 1, 0), - }); - - page3.moveTo(0, page3Height); - - page3.moveDown(catRidingUnicornDims.height); - page3.drawImage(catRidingUnicornImage, catRidingUnicornDims); - - page3.moveDown(minionsLaughingDims.height); - page3.drawImage(minionsLaughingImage, minionsLaughingDims); - - page3.moveDown(greyscaleBirdDims.height); - page3.drawImage(greyscaleBirdImage, greyscaleBirdDims); - - page3.moveDown(minionsBananaAlphaDims.height); - page3.drawImage(minionsBananaAlphaImage, minionsBananaAlphaDims); - - page3.moveDown(minionsBananaNoAlphaDims.height); - page3.drawImage(minionsBananaNoAlphaImage, minionsBananaNoAlphaDims); - - page3.moveDown(smallMarioDims.height); - page3.drawImage(smallMarioImage, smallMarioDims); - - /********************** Page 4 **********************/ - - // This page tests embedding other PDF pages. First we embed page 3 of this document - // but rotate and scale it. - // Then we take an external PDF document and embed two pages of it next to each other. - - const page4 = pdfDoc.addPage([size, size]); - - const embeddedPage3 = await pdfDoc.embedPage(page3); - page4.drawPage(embeddedPage3, { - x: 10, - y: size - 10, - xScale: 1.52, - yScale: 0.42, - rotate: degrees(-90), - }); - - const [embeddedPage1, embeddedPage2] = await pdfDoc.embedPdf( - assets.pdfs.normal, - [0, 1], - ); - page4.drawPage(embeddedPage1, { - x: 40, - y: 100, - xScale: 0.5, - yScale: 0.5, - opacity: 0.5, - }); - page4.drawPage(embeddedPage2, { - x: 400, - y: 100, - xScale: 0.5, - yScale: 0.5, - }); - - /********************** Page 5 **********************/ - - // This page tests creating new AcroForm fields. - - const pastels = { - greyishGreen: rgb(85 / 255, 117 / 255, 113 / 255), - brownish: rgb(212 / 255, 154 / 255, 137 / 255), - tan: rgb(247 / 255, 209 / 255, 186 / 255), - whiteish: rgb(244 / 255, 244 / 255, 244 / 255), - lightBlue: rgb(221 / 255, 243 / 255, 245 / 255), - blue: rgb(166 / 255, 220 / 255, 239 / 255), - pinkish: rgb(242 / 255, 170 / 255, 170 / 255), - hotPink: rgb(227 / 255, 99 / 255, 135 / 255), - yellow: rgb(250 / 255, 240 / 255, 175 / 255), - darkBlue: rgb(7 / 255, 104 / 255, 159 / 255), - }; - - const page5 = pdfDoc.addPage([size, size]); - - const form = pdfDoc.getForm(); - - const fWidth = 100; - const fHeight = 50; - const fPadding = 25; - const fMax = Math.max(fWidth, fHeight); - - // Text Fields - [ - { name: 'moi.text.field[0]', text: 'Foo', font: ubuntuFont }, - { name: 'moi.text.field[1]', text: 'Bar' }, - { name: 'moi.text.field[2]', text: 'Qux', font: ubuntuFont }, - { name: 'moi.text.field[3]', text: 'Baz' }, - ].forEach(({ name, text, font }, idx) => { - const textField = form.createTextField(name); - textField.setText(text); - textField.addToPage(page5, { - x: fPadding + fWidth, - y: size - fMax - fPadding, - width: fWidth, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.pinkish, - borderColor: pastels.blue, - textColor: pastels.whiteish, - font: ubuntuFont, - }); - if (font) textField.updateAppearances(font); - }); - - // Buttons - [ - { name: 'moi.button.field[0]', text: 'Earth', font: ubuntuFont }, - { name: 'moi.button.field[1]', text: 'Mars', font: timesRomanFont }, - { name: 'moi.button.field[2]', text: 'Venus', font: ubuntuFont }, - { name: 'moi.button.field[3]', text: 'Saturn', font: timesRomanFont }, - ].forEach(({ name, text, font }, idx) => { - const button = form.createButton(name); - button.addToPage(text, page5, { - x: fPadding * 2 + fWidth * 3, - y: size - fMax - fPadding, - width: fWidth, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.brownish, - borderColor: pastels.tan, - textColor: pastels.greyishGreen, - font, - }); - }); - - // Dropdowns - [ - { name: 'moi.dropdown.field[0]', choice: 'Exia', font: ubuntuFont }, - { name: 'moi.dropdown.field[1]', choice: 'Kyrios', font: timesRomanFont }, - { name: 'moi.dropdown.field[2]', choice: 'Dynames', font: ubuntuFont }, - { name: 'moi.dropdown.field[3]', choice: 'Virtue', font: timesRomanFont }, - ].forEach(({ name, choice, font }, idx) => { - const dropdown = form.createDropdown(name); - dropdown.addOptions(['Exia', 'Dynames', 'Kyrios', 'Virtue']); - dropdown.select(choice); - dropdown.addToPage(page5, { - x: fPadding * 3 + fWidth * 5, - y: size - fMax - fPadding, - width: fWidth, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.greyishGreen, - borderColor: pastels.hotPink, - textColor: pastels.brownish, - font, - }); - }); - - // Check Boxes - [ - { name: 'moi.checkBox.field[0]' }, - { name: 'moi.checkBox.field[1]' }, - { name: 'moi.checkBox.field[2]' }, - { name: 'moi.checkBox.field[3]' }, - ].forEach(({ name }, idx) => { - const checkBox = form.createCheckBox(name); - checkBox.check(); - checkBox.addToPage(page5, { - x: fPadding + fWidth, - y: size - fMax * 3 - fPadding * 2, - width: fHeight, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.whiteish, - borderColor: pastels.greyishGreen, - textColor: pastels.hotPink, - }); - }); - - // Option Lists - [ - { name: 'moi.optionList.field[0]', choice: 'TypeScript', font: ubuntuFont }, - { name: 'moi.optionList.field[1]', choice: 'Kotlin', font: timesRomanFont }, - { name: 'moi.optionList.field[2]', choice: 'Python', font: ubuntuFont }, - { name: 'moi.optionList.field[3]', choice: 'Swift', font: timesRomanFont }, - ].forEach(({ name, choice, font }, idx) => { - const optionList = form.createOptionList(name); - optionList.addOptions(['TypeScript', 'Kotlin', 'Python', 'Swift']); - optionList.select(choice); - optionList.addToPage(page5, { - x: fPadding * 2 + fWidth * 3, - y: size - fMax * 3 - fPadding * 2, - width: fWidth, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.tan, - borderColor: pastels.yellow, - textColor: pastels.hotPink, - font, - }); - }); - - // Radio Group - const radioGroup = form.createRadioGroup('moi.radioGroup.field[0]'); - - [ - { option: 'Bing' }, - { option: 'Boing' }, - { option: 'Bang' }, - { option: 'Bloop' }, - ].forEach(({ option }, idx) => { - radioGroup.addOptionToPage(option, page5, { - x: fPadding * 3 + fWidth * 5, - y: size - fMax * 3 - fPadding * 2, - width: fHeight, - height: fHeight, - rotate: degrees(90 * idx), - borderWidth: 4, - backgroundColor: pastels.blue, - borderColor: pastels.pinkish, - textColor: pastels.yellow, - }); - }); - - radioGroup.select('Bing'); - - // Combed Text Field - const combedTf = form.createTextField('moi.combed.text.field'); - combedTf.setMaxLength(7); - combedTf.enableCombing(); - combedTf.setText('ABC-123'); - combedTf.addToPage(page5, { - x: fPadding + fWidth / 2, - y: size - fMax * 5 - fPadding * 3, - width: fWidth * 2.5, - height: fHeight, - borderWidth: 4, - backgroundColor: pastels.yellow, - borderColor: pastels.brownish, - textColor: pastels.darkBlue, - font: ubuntuFont, - }); - - // Multiline Text Field - const multilineTf = form.createTextField('moi.multiline.text.field'); - multilineTf.enableMultiline(); - multilineTf.setText( - `In the morning, when you can't get out of bed, tell yourself: "I'm getting up to do the work only a man can do. How can I possibly hesitate or complain when I'm about to accomplish the task for which I was born? Was I made for lying warm in bed under a pile of blankets?"\n\n"But I enjoy it here."\n\nWas it for enjoyment you were born? Are you designed to act or to be acted upon?\n\n\t\t\t\t\t\t\t\t\t\t - Marcus Aurelius`, - ); - multilineTf.addToPage(page5, { - x: fPadding * 3 + fWidth / 2 + fWidth * 2.5, - y: size - fMax * 5 - fPadding * 3 - fHeight * 3, - width: fWidth * 2.5, - height: fHeight * 5, - borderWidth: 4, - backgroundColor: pastels.whiteish, - borderColor: pastels.brownish, - textColor: pastels.greyishGreen, - font: ubuntuFont, - }); - - page5.drawText('There should be no remnant of a field\nbelow this text!!', { - y: size - fMax * 5 - fPadding * 0 - fHeight * 3, - x: fPadding, - size: 18, - font: indieFlowerFont, - lineHeight: 18, - }); - const textField = form.createTextField('a.new.text.field'); - textField.setText('This Should Not Be Visible'); - textField.addToPage(page5, { - x: fPadding, - y: size - fMax * 5 - fPadding * 3.5 - fHeight * 3, - width: fWidth * 2.5, - height: fHeight * 1, - borderWidth: 4, - backgroundColor: pastels.pinkish, - borderColor: pastels.blue, - textColor: pastels.darkBlue, - font: ubuntuFont, - }); - - form.removeField(textField); - - /********************** Print Metadata **********************/ - - console.log('Title:', pdfDoc.getTitle()); - console.log('Author:', pdfDoc.getAuthor()); - console.log('Subject:', pdfDoc.getSubject()); - console.log('Creator:', pdfDoc.getCreator()); - console.log('Keywords:', pdfDoc.getKeywords()); - console.log('Producer:', pdfDoc.getProducer()); - console.log('Creation Date:', pdfDoc.getCreationDate()); - console.log('Modification Date:', pdfDoc.getModificationDate()); - - /********************** Export PDF **********************/ - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test10.ts b/apps/deno/tests/test10.ts deleted file mode 100644 index 384fe0899..000000000 --- a/apps/deno/tests/test10.ts +++ /dev/null @@ -1,299 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - PDFDocument, - StandardFonts, - PDFFont, -} from '../../../dist/pdf-lib.esm.js'; - -// prettier-ignore -const winAnsiCodePoints = [ - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, - 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, - 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, - 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, 0x0043, - 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, - 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, - 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, - 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, - 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, - 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x00a0, 0x00a1, 0x00a2, 0x00a3, - 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, - 0x00ad, 0x00ae, 0x00af, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, - 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, - 0x00bf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00d0, - 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, - 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2, - 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, - 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, - 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, - 0x00fe, 0x00ff, 0x0152, 0x0153, 0x0160, 0x0161, 0x0178, 0x017d, 0x017e, - 0x0192, 0x02c6, 0x02dc, 0x2013, 0x2014, 0x2018, 0x2019, 0x201a, 0x201c, - 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039, 0x203a, - 0x20ac, 0x2122, -]; - -const winAnsiString = String.fromCodePoint(...winAnsiCodePoints) - .split('') - .join(' '); - -// prettier-ignore -const zapfDingbatsCodePoints = [ - 0x0020, 0x00a0, 0x2192, 0x2194, 0x2195, 0x2460, 0x2461, 0x2462, 0x2463, - 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x25a0, 0x25b2, 0x25bc, - 0x25c6, 0x25cf, 0x25d7, 0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, - 0x2665, 0x2666, 0x2701, 0x2702, 0x2703, 0x2704, 0x2706, 0x2707, 0x2708, - 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, 0x2710, 0x2711, 0x2712, 0x2713, - 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, 0x271a, 0x271b, 0x271c, - 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, - 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, 0x272f, - 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, - 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, - 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, - 0x274b, 0x274d, 0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, - 0x275a, 0x275b, 0x275c, 0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, - 0x2765, 0x2766, 0x2767, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, - 0x277c, 0x277d, 0x277e, 0x277f, 0x2780, 0x2781, 0x2782, 0x2783, 0x2784, - 0x2785, 0x2786, 0x2787, 0x2788, 0x2789, 0x278a, 0x278b, 0x278c, 0x278d, - 0x278e, 0x278f, 0x2790, 0x2791, 0x2792, 0x2793, 0x2794, 0x2798, 0x2799, - 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, 0x279f, 0x27a0, 0x27a1, 0x27a2, - 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, 0x27a9, 0x27aa, 0x27ab, - 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, 0x27b4, 0x27b5, - 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, 0x27be, - 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, 0xf8dd, 0xf8de, 0xf8df, - 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, -]; - -const zapfDingbatsString = String.fromCodePoint(...zapfDingbatsCodePoints) - .split('') - .join(' '); - -// prettier-ignore -const symbolCodePoints = [ - 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, - 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, - 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a0, 0x00ac, 0x00b0, - 0x00b1, 0x00b5, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, - 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, - 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, - 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, - 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x2044, - 0x20ac, 0x2111, 0x2118, 0x211c, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, - 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, - 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, - 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, - 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, - 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, - 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, - 0x2663, 0x2665, 0x2666, 0xf6d9, 0xf6da, 0xf6db, 0xf8e5, 0xf8e6, 0xf8e7, - 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, - 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, - 0xf8fa, 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, -]; - -const symbolString = String.fromCodePoint(...symbolCodePoints) - .split('') - .join(' '); - -const addPageWithFonts = ( - pdfDoc: PDFDocument, - text: string, - fontSize: number, - gapAmt: number, - fontNames: StandardFonts[], -) => { - const page = pdfDoc.addPage([650, 700]); - - page.moveTo(0, 675); - fontNames.forEach((fontName) => { - const font = pdfDoc.embedStandardFont(fontName); - const lines = breakTextIntoLines(text, fontSize, font, 600); - - page.drawText(fontName, { - font, - size: fontSize, - x: 650 / 2 - font.widthOfTextAtSize(fontName, fontSize) / 2, - }); - page.moveTo(0, page.getY() - font.heightAtSize(fontSize) - 10); - page.drawText(lines.join('\n'), { - font, - size: fontSize, - x: 25, - lineHeight: font.heightAtSize(fontSize) + 10, - }); - - page.moveDown( - (font.heightAtSize(fontSize) + 10) * (lines.length - 1 + gapAmt), - ); - }); -}; - -// Primitive line break algorithm -const breakTextIntoLines = ( - text: string, - size: number, - font: PDFFont, - maxWidth: number, -) => { - const lines: string[] = []; - let textIdx = 0; - while (textIdx < text.length) { - let line = ''; - while (textIdx < text.length) { - if (text.charAt(textIdx) === '\n') { - lines.push(line); - textIdx += 1; - line = ''; - continue; - } - const newLine = line + text.charAt(textIdx); - if (font.widthOfTextAtSize(newLine, size) > maxWidth) break; - line = newLine; - textIdx += 1; - } - lines.push(line); - } - return lines; -}; - -export default async (_assets: Assets) => { - const pdfDoc = await PDFDocument.create(); - - const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica); - const helveticaBoldFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold); - - const title = 'Standard 14 Fonts Demo'; - const description = ` - The PDF specification requires that PDF readers provide 14 standard fonts. - PDF documents may use these fonts without having to embed the fonts - themselves in the document. The fonts are as follows: - - • Times Roman (serif) in regular, bold, italic, and bold italic variants. - • Helvetica (sans-serif) in regular, bold, oblique, and bold oblique variants. - • Courier (monospace serif) in regular, bold, oblique, and bold oblique variants. - • ZapfDingbats (symbolic) in regular variant. - • Symbol (symbolic) in regular variant. - - The Times Roman, Helvetica, and Courier fonts use WinAnsi encoding - (Windows-1252). ZapfDingbats and Symbol each use their own special - encodings. - - Note that none of these fonts support anything near the entire Unicode - character set. The WinAnsi fonts include most glyphs in the Latin alphabet. - The ZapfDingbat font includes an odd assortment of glyphs that don't below - to any particular language or region. And the Symbol font includes - mathematical symbols and glyphs for the greek alphabet. - - The following pages contain examples of each of the standard 14 fonts. Each - glyph supported by a given font's encoding is rendered to the page under a - header naming the font in use.`; - - const descriptionLines = breakTextIntoLines( - description, - 16, - helveticaFont, - 600, - ); - - const titlePage = pdfDoc.addPage([650, 700]); - titlePage.drawText(title, { - font: helveticaBoldFont, - size: 35, - y: 700 - 100, - x: 650 / 2 - helveticaBoldFont.widthOfTextAtSize(title, 35) / 2, - lineHeight: 35, - }); - titlePage.drawText(descriptionLines.join('\n'), { - font: helveticaFont, - size: 16, - y: 525, - x: 25, - lineHeight: 16, - }); - - // Times Roman - addPageWithFonts(pdfDoc, winAnsiString, 18, 0.25, [ - StandardFonts.TimesRoman, - StandardFonts.TimesRomanBold, - StandardFonts.TimesRomanItalic, - StandardFonts.TimesRomanBoldItalic, - ]); - - // Helvetica - addPageWithFonts(pdfDoc, winAnsiString, 16.75, 0.4, [ - StandardFonts.Helvetica, - StandardFonts.HelveticaBold, - StandardFonts.HelveticaOblique, - StandardFonts.HelveticaBoldOblique, - ]); - - // Courier - addPageWithFonts(pdfDoc, winAnsiString, 14.25, 0.75, [ - StandardFonts.Courier, - StandardFonts.CourierBold, - StandardFonts.CourierOblique, - StandardFonts.CourierBoldOblique, - ]); - - // ZapfDingbats - const zapfDingbatsFont = await pdfDoc.embedFont(StandardFonts.ZapfDingbats); - const zapfDingbatsFontSize = 20; - const zapfDingbatsLines = breakTextIntoLines( - zapfDingbatsString, - zapfDingbatsFontSize, - zapfDingbatsFont, - 600, - ); - - const page = pdfDoc.addPage([650, 700]); - page.moveTo(0, 700); - - page.moveDown(100); - page.drawText('ZapfDingbats', { - font: helveticaFont, - size: zapfDingbatsFontSize, - x: - 650 / 2 - - helveticaFont.widthOfTextAtSize('ZapfDingbats', zapfDingbatsFontSize) / 2, - }); - page.moveDown(zapfDingbatsFont.heightAtSize(zapfDingbatsFontSize) + 10); - page.drawText(zapfDingbatsLines.join('\n'), { - font: zapfDingbatsFont, - size: zapfDingbatsFontSize, - x: 25, - lineHeight: zapfDingbatsFont.heightAtSize(zapfDingbatsFontSize) + 10, - }); - - // Symbol - const symbolFont = await pdfDoc.embedFont(StandardFonts.Symbol); - const symbolFontSize = 20; - const symbolLines = breakTextIntoLines( - symbolString, - symbolFontSize, - symbolFont, - 600, - ); - - page.moveDown(275); - page.drawText('Symbol', { - font: helveticaFont, - size: symbolFontSize, - x: 650 / 2 - helveticaFont.widthOfTextAtSize('Symbol', symbolFontSize) / 2, - }); - page.moveDown(symbolFont.heightAtSize(symbolFontSize) + 10); - page.drawText(symbolLines.join('\n'), { - font: symbolFont, - size: symbolFontSize, - x: 25, - lineHeight: symbolFont.heightAtSize(symbolFontSize) + 10, - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test11.ts b/apps/deno/tests/test11.ts deleted file mode 100644 index 7a747c2ab..000000000 --- a/apps/deno/tests/test11.ts +++ /dev/null @@ -1,136 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - last, - PDFDocument, - PDFFont, - StandardFonts, - charAtIndex, -} from '../../../dist/pdf-lib.esm.js'; - -const breakTextIntoLines = ( - text: string, - size: number, - font: PDFFont, - maxWidth: number, -) => { - const lines: string[] = []; - let textIdx = 0; - while (textIdx < text.length) { - let line = ''; - while (textIdx < text.length) { - if (text.charAt(textIdx) === '\n') { - lines.push(line); - textIdx += 1; - line = ''; - continue; - } - const [glyph] = charAtIndex(text, textIdx); - const newLine = line + glyph; - if (font.widthOfTextAtSize(newLine, size) > maxWidth) break; - line = newLine; - textIdx += glyph.length; - } - lines.push(line); - } - return lines; -}; - -const breakLinesIntoGroups = ( - lines: string[], - lineHeight: number, - maxHeight: number, -) => { - const linesPerGroup = Math.floor(maxHeight / lineHeight); - const groups: string[][] = [[]]; - for (let idx = 0, len = lines.length; idx < len; idx++) { - const line = lines[idx]; - if (last(groups).length === linesPerGroup) { - groups.push([]); - } - last(groups).push(line); - } - return groups; -}; - -export default async (assets: Assets) => { - const { fonts } = assets; - - const pdfDoc = await PDFDocument.create(); - - pdfDoc.registerFontkit(fontkit); - - const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica); - const helveticaBoldFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold); - - const title = 'Embedded UTF-16 Font Demo'; - const description = ` - In addition to the standard 14 fonts provided by PDF readers, the PDF - specification allows PDF documents to embed their own fonts. The standard - 14 fonts only support a very limited latin and symbolic character set, but - embedded fonts can support arbitrary character sets and glyphs. - - This document is a demonstration of an embedded font. Specifically, the - Source Han Serif Japanese Regular font. The following pages render all - characters supported by this font. - - The characters are rendered from greatest to least (ordered by their - code points). Take special note of the first 1.25 pages of glyphs, as these - glyphs represent UTF-16 code points (the rest of the glyphs in this document - are UTF-8).`; - - const descriptionLines = breakTextIntoLines( - description, - 16, - helveticaFont, - 600, - ); - - const titlePage = pdfDoc.addPage([650, 700]); - titlePage.drawText(title, { - font: helveticaBoldFont, - size: 35, - y: 700 - 100, - x: 650 / 2 - helveticaBoldFont.widthOfTextAtSize(title, 35) / 2, - }); - titlePage.drawText(descriptionLines.join('\n'), { - font: helveticaFont, - size: 16, - y: 525, - x: 25, - }); - - const sourceHanFont = await pdfDoc.embedFont(fonts.otf.source_hans_jp); - - const sourceHanFontSize = 20; - const sourceHanString = String.fromCodePoint( - ...sourceHanFont.getCharacterSet().reverse(), - ); - const sourceHanLines = breakTextIntoLines( - sourceHanString, - sourceHanFontSize, - sourceHanFont, - 600, - ); - const sourceHanLineGroups = breakLinesIntoGroups( - sourceHanLines, - sourceHanFont.heightAtSize(sourceHanFontSize) + 10, - 675, - ); - - sourceHanLineGroups.forEach((lines) => { - const page = pdfDoc.addPage([650, 700]); - page.drawText(lines.join('\n'), { - font: sourceHanFont, - size: sourceHanFontSize, - x: 25, - y: 700 - 25 - sourceHanFontSize, - lineHeight: sourceHanFont.heightAtSize(sourceHanFontSize) + 10, - }); - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test12.ts b/apps/deno/tests/test12.ts deleted file mode 100644 index 0ad1f319d..000000000 --- a/apps/deno/tests/test12.ts +++ /dev/null @@ -1,285 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - PageSizes, - PDFDocument, - BlendMode, - LineCapStyle, - cmyk, - degrees, - rgb, - values, -} from '../../../dist/pdf-lib.esm.js'; - -// import { Assets } from '..'; -// import { PageSizes, PDFDocument, BlendMode, cmyk, degrees, rgb } from '../../..'; - -const inchToPt = (inches: number) => Math.round(inches * 72); - -const firstPage = async (pdfDoc: PDFDocument) => { - const page = pdfDoc.addPage(PageSizes.Letter); - - // SVG sample paths from - // https://svgwg.org/svg2-draft/paths.html - - // bezier curve example - page.drawSvgPath('M100,200 C100,100 250,100 250,200 S400,300 400,200', { - x: inchToPt(0.25), - y: inchToPt(12), - }); - - // downward facing triangle - page.drawSvgPath('M 100 100 L 300 100 L 200 300 z', { - x: inchToPt(-1), - y: inchToPt(12), - color: rgb(1, 0, 0), - borderColor: rgb(0, 0, 1), - borderWidth: 1, - opacity: 0.7, - borderOpacity: 0.7, - }); - - // bezier control point adjustments - page.drawSvgPath('M100,200 C100,100 400,100 400,200', { - x: inchToPt(-1), - y: inchToPt(9.25), - }); - page.drawSvgPath('M600,200 C675,100 975,100 900,200', { - x: inchToPt(-4.5), - y: inchToPt(8.25), - }); - page.drawSvgPath('M100,500 C25,400 475,400 400,500', { - x: inchToPt(-1), - y: inchToPt(11.25), - }); - page.drawSvgPath('M600,500 C600,350 900,650 900,500', { - x: inchToPt(-4.5), - y: inchToPt(10.25), - }); - page.drawSvgPath('M100,800 C175,700 325,700 400,800', { - x: inchToPt(-1), - y: inchToPt(13.35), - }); - page.drawSvgPath('M600,800 C625,700 725,700 750,800 S875,900 900,800', { - x: inchToPt(-4.5), - y: inchToPt(12.25), - }); -}; - -const secondPage = async (pdfDoc: PDFDocument) => { - const page = pdfDoc.addPage(PageSizes.Letter); - - // quadratic bezier example - page.drawSvgPath('M200,300 Q400,50 600,300 T1000,300', { - x: 100, - y: 700, - scale: 0.5, - borderWidth: 4, - borderDashArray: [24, 12], - borderLineCap: LineCapStyle.Round, - rotate: degrees(30), - }); - page.drawSvgPath('M200,300 L400,50 L600,300 L800,550 L1000,300', { - x: inchToPt(-1), - y: inchToPt(9), - scale: 0.5, - borderWidth: 2, - }); - - // arc examples - page.drawSvgPath('M300,200 h-150 a150,150 0 1,0 150,-150 z', { - x: inchToPt(-1), - y: inchToPt(5.5), - color: rgb(1, 0, 0), - borderColor: rgb(0, 0, 1), - borderWidth: 1, - }); - page.drawSvgPath('M275,175 v-150 a150,150 0 0,0 -150,150 z', { - x: inchToPt(-1), - y: inchToPt(5.5), - color: rgb(1, 1, 0), - borderColor: rgb(0, 0, 1), - borderWidth: 1, - }); - page.drawSvgPath( - 'M600,350 l 50,-25 a25,25 -30 0,1 50,-25 l 50,-25 a25,50 -30 0,1 50,-25 l 50,-25 a25,75 -30 0,1 50,-25 l 50,-25 a25,100 -30 0,1 50,-25 l 50,-25', - { - x: inchToPt(1), - y: inchToPt(3), - scale: 0.5, - borderColor: rgb(1, 0, 0), - borderWidth: 2, - }, - ); - page.drawCircle({ - x: inchToPt(3), - y: inchToPt(5), - color: rgb(0, 1, 1), - opacity: 0.1, - borderWidth: 3, - borderColor: rgb(1, 0, 1), - borderOpacity: 0.2, - }); - page.drawText('Semi-Transparent Text', { - color: rgb(0, 1, 1), - opacity: 0.5, - x: inchToPt(1), - y: inchToPt(2.5), - size: 50, - }); -}; - -const thirdPage = async (pdfDoc: PDFDocument, assets: Assets) => { - const page = pdfDoc.addPage(PageSizes.Letter); - - const modeNames: string[] = values(BlendMode); - - page.drawRectangle({ - x: 30, - y: 30, - width: 100, - height: 732, - color: cmyk(0, 0.7, 0.3, 0), - blendMode: BlendMode.Normal, - }); - - page.drawRectangle({ - x: 340, - y: 30, - width: 100, - height: 732, - color: cmyk(0.6, 0, 0.3, 0), - blendMode: BlendMode.Normal, - }); - - page.drawText(`pdf-lib Blend Mode Test`, { - size: 24, - x: 45, - y: 735, - color: cmyk(0.75, 0, 0, 0), - blendMode: BlendMode.Multiply, - }); - - // List all blend modes available - modeNames.forEach((m, i) => { - page.drawText(`blendMode: ${m}`, { - size: 14, - x: 40, - y: 700 - i * 20, - color: cmyk(0, 0, 0, 0.65), - blendMode: m as BlendMode, - }); - }); - - // quadratic bezier example - page.drawSvgPath('M200,300 Q400,50 600,300 T1000,300', { - x: inchToPt(-1), - y: inchToPt(10), - scale: 0.5, - borderWidth: 6, - borderColor: cmyk(0, 0, 0, 1), - blendMode: BlendMode.Overlay, - }); - - // arc examples - page.drawSvgPath('M300,200 h-150 a150,150 0 1,0 150,-150 z', { - x: inchToPt(-1), - y: inchToPt(5.5), - color: cmyk(0, 1, 1, 0), - borderColor: cmyk(1, 0.7, 0, 0), - borderWidth: 2, - blendMode: BlendMode.HardLight, - }); - - page.drawSvgPath('M275,175 v-150 a150,150 0 0,0 -150,150 z', { - x: inchToPt(-1), - y: inchToPt(5.5), - color: cmyk(0, 0.3, 1, 0), - borderColor: cmyk(0, 0, 0, 1), - borderWidth: 2, - blendMode: BlendMode.Darken, - }); - - // rectangle example - page.drawRectangle({ - x: 350, - y: 220, - width: 60, - height: 160, - rotate: degrees(-30), - color: cmyk(0.4, 0, 1, 0), - borderColor: cmyk(0, 1, 1, 0), - borderWidth: 2, - blendMode: BlendMode.ColorBurn, - }); - - // circle example - page.drawCircle({ - x: inchToPt(3), - y: inchToPt(5), - color: cmyk(0.7, 1, 0.5, 0), - blendMode: BlendMode.ColorDodge, - }); - - // add alpha-image with 'Screen' blend mode - const pngImage = await pdfDoc.embedPng(assets.images.png.self_drive); - const pngDims = pngImage.scale(1.0); - - const cx = page.getWidth() / 2 - 70; - const cy = page.getHeight() / 2; - - page.drawImage(pngImage, { - x: cx - pngDims.width / 2, - y: cy - pngDims.height / 2, - width: pngDims.width, - height: pngDims.height, - blendMode: BlendMode.Screen, - }); - - // embed page from other PDF using blendMode - const [embeddedPage] = await pdfDoc.embedPdf( - assets.pdfs.simple_pdf_2_example, - [0], - ); - - const [px, py, scale] = [300, 100, 0.33]; - - const { width, height } = embeddedPage.scale(scale); - - page.drawPage(embeddedPage, { - x: px, - y: py, - xScale: scale, - yScale: scale, - blendMode: BlendMode.Multiply, - }); - - page.drawRectangle({ - x: px, - y: py, - width, - height, - borderColor: cmyk(0, 1, 1, 0), - borderWidth: 2, - blendMode: BlendMode.Normal, - }); - - page.drawText('Embedded PDF document (blendMode: Multiply)', { - size: 9, - x: px, - y: py - 12, - color: cmyk(0, 0, 0, 1), - blendMode: BlendMode.Multiply, - }); -}; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.create(); - await firstPage(pdfDoc); - await secondPage(pdfDoc); - await thirdPage(pdfDoc, assets); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test13.ts b/apps/deno/tests/test13.ts deleted file mode 100644 index 4c496c380..000000000 --- a/apps/deno/tests/test13.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { PDFDocument, rgb } from '../../../dist/pdf-lib.esm.js'; - -// prettier-ignore -const pngSuite = [ - 'PngSuite.png', 'basi0g01.png', 'basi0g02.png', 'basi0g04.png', - 'basi0g08.png', 'basi0g16.png', 'basi2c08.png', 'basi2c16.png', - 'basi3p01.png', 'basi3p02.png', 'basi3p04.png', 'basi3p08.png', - 'basi4a08.png', 'basi4a16.png', 'basi6a08.png', 'basi6a16.png', - 'basn0g01.png', 'basn0g02.png', 'basn0g04.png', 'basn0g08.png', - 'basn0g16.png', 'basn2c08.png', 'basn2c16.png', 'basn3p01.png', - 'basn3p02.png', 'basn3p04.png', 'basn3p08.png', 'basn4a08.png', - 'basn4a16.png', 'basn6a08.png', 'basn6a16.png', 'bgai4a08.png', - 'bgai4a16.png', 'bgan6a08.png', 'bgan6a16.png', 'bgbn4a08.png', - 'bggn4a16.png', 'bgwn6a08.png', 'bgyn6a16.png', 'ccwn2c08.png', - 'ccwn3p08.png', 'cdfn2c08.png', 'cdhn2c08.png', 'cdsn2c08.png', - 'cdun2c08.png', 'ch1n3p04.png', 'ch2n3p08.png', 'cm0n0g04.png', - 'cm7n0g04.png', 'cm9n0g04.png', 'cs3n2c16.png', 'cs3n3p08.png', - 'cs5n2c08.png', 'cs5n3p08.png', 'cs8n2c08.png', 'cs8n3p08.png', - 'ct0n0g04.png', 'ct1n0g04.png', 'cten0g04.png', 'ctfn0g04.png', - 'ctgn0g04.png', 'cthn0g04.png', 'ctjn0g04.png', 'ctzn0g04.png', - 'exif2c08.png', 'f00n0g08.png', 'f00n2c08.png', 'f01n0g08.png', - 'f01n2c08.png', 'f02n0g08.png', 'f02n2c08.png', 'f03n0g08.png', - 'f03n2c08.png', 'f04n0g08.png', 'f04n2c08.png', 'f99n0g04.png', - 'g03n0g16.png', 'g03n2c08.png', 'g03n3p04.png', 'g04n0g16.png', - 'g04n2c08.png', 'g04n3p04.png', 'g05n0g16.png', 'g05n2c08.png', - 'g05n3p04.png', 'g07n0g16.png', 'g07n2c08.png', 'g07n3p04.png', - 'g10n0g16.png', 'g10n2c08.png', 'g10n3p04.png', 'g25n0g16.png', - 'g25n2c08.png', 'g25n3p04.png', 'oi1n0g16.png', 'oi1n2c16.png', - 'oi2n0g16.png', 'oi2n2c16.png', 'oi4n0g16.png', 'oi4n2c16.png', - 'oi9n0g16.png', 'oi9n2c16.png', 'pp0n2c16.png', 'pp0n6a08.png', - 'ps1n0g08.png', 'ps1n2c16.png', 'ps2n0g08.png', 'ps2n2c16.png', - 's01i3p01.png', 's01n3p01.png', 's02i3p01.png', 's02n3p01.png', - 's03i3p01.png', 's03n3p01.png', 's04i3p01.png', 's04n3p01.png', - 's05i3p02.png', 's05n3p02.png', 's06i3p02.png', 's06n3p02.png', - 's07i3p02.png', 's07n3p02.png', 's08i3p02.png', 's08n3p02.png', - 's09i3p02.png', 's09n3p02.png', 's32i3p04.png', 's32n3p04.png', - 's33i3p04.png', 's33n3p04.png', 's34i3p04.png', 's34n3p04.png', - 's35i3p04.png', 's35n3p04.png', 's36i3p04.png', 's36n3p04.png', - 's37i3p04.png', 's37n3p04.png', 's38i3p04.png', 's38n3p04.png', - 's39i3p04.png', 's39n3p04.png', 's40i3p04.png', 's40n3p04.png', - 'tbbn0g04.png', 'tbbn2c16.png', 'tbbn3p08.png', 'tbgn2c16.png', - 'tbgn3p08.png', 'tbrn2c08.png', 'tbwn0g16.png', 'tbwn3p08.png', - 'tbyn3p08.png', 'tm3n3p02.png', 'tp0n0g08.png', 'tp0n2c08.png', - 'tp0n3p08.png', 'tp1n3p08.png', 'z00n2c08.png', 'z03n2c08.png', - 'z06n2c08.png', 'z09n2c08.png', -]; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.create(); - - const page = pdfDoc.addPage(); - - const solarizedWhite = rgb(253 / 255, 246 / 255, 227 / 255); - page.drawRectangle({ ...page.getSize(), color: solarizedWhite }); - - const etweImg = await pdfDoc.embedPng(assets.images.png.etwe); - page.drawImage(etweImg, { - x: 25, - y: page.getHeight() - 80, - ...etweImg.scale(0.2), - }); - - const selfDriveImg = await pdfDoc.embedPng(assets.images.png.self_drive); - page.drawImage(selfDriveImg, { - x: page.getWidth() / 2, - y: page.getHeight() - 80, - ...selfDriveImg.scale(0.7), - }); - - const size = 45; - let x = 25; - let y = 5; - for (const path of pngSuite) { - const png = Deno.readFileSync(`assets/images/pngsuite/${path}`); - const img = await pdfDoc.embedPng(png); - page.drawImage(img, { x, y, width: size, height: size }); - y += size + 5; - if (y + size >= page.getHeight() - 80) { - y = 5; - x += size + 5; - } - } - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test14.ts b/apps/deno/tests/test14.ts deleted file mode 100644 index 55e92da3e..000000000 --- a/apps/deno/tests/test14.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - PDFDocument, - values, - PDFTextField, - PDFField, -} from '../../../dist/pdf-lib.esm.js'; - -const fieldNames = { - // Page 1 - LegalName: 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].LegalName[0]', - BusinessNumber1: - 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT1[0]', - BusinessNumber2: - 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT2[0]', - BusinessAddress: - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].BusinessAddress[0]', - City: 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].City[0]', - Province: - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].Province[0]', - PostalCode: - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].PostalCode[0]', - TypeOfReturn: - 'form1[0].Page1[0].BeforeYouBegin[0].Type[0].RadioButtonGroup[0]', - FromDate: - 'form1[0].Page1[0].BeforeYouBegin[0].Period[0].FromToDates_Comb_Adv_EN[0].FromDate[0]', - ToDate: - 'form1[0].Page1[0].BeforeYouBegin[0].Period[0].FromToDates_Comb_Adv_EN[0].ToDate[0]', - - // Page 2 - Amount1: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].DutyPayable[0].DutyPayable[0].Amount[0]', - Amount2: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AdditionalDutyPayable[0].AdditionalDutyPayable[0].Amount[0]', - Amount3: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AjustmentAdditionalDutyPayable[0].AjustmentAdditionalDutyPayable[0].Amount[0]', - Amount4: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].NetPayable[0].NetPayable[0].Amount[0]', - Amount5: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].Refund[0].Refund[0].Amount[0]', - Amount6: - 'form1[0].Page12[0].SalesDutyPage12[0].AmountDue[0].AmountDue[0].AmountDue[0].Amount[0]', - ByDueDate: 'form1[0].Page12[0].SalesDutyPage12[0].ByDueDate[0]', - Name: 'form1[0].Page12[0].Certification[0].Signature[0].Name[0]', - Title: 'form1[0].Page12[0].Certification[0].Signature[0].Title[0]', - PhoneNumber: - 'form1[0].Page12[0].Certification[0].Signature[0].Phone_Ext[0].TelephoneNumberSplit[0].PhoneNumber[0]', - PhoneExt: - 'form1[0].Page12[0].Certification[0].Signature[0].Phone_Ext[0].Ext[0]', - SignatureDate: - 'form1[0].Page12[0].Certification[0].Signature[0].Date[0].DateYYYYMMDD_Comb[0]', -}; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.with_combed_fields); - - const form = pdfDoc.getForm(); - - const legalName = form.getTextField(fieldNames.LegalName); - legalName.setText('Purple People Eater'); - - const businessNumber1 = form.getTextField(fieldNames.BusinessNumber1); - businessNumber1.setText('123456789'); - - const businessNumber2 = form.getTextField(fieldNames.BusinessNumber2); - businessNumber2.setText('9876'); - - const businessAddress = form.getTextField(fieldNames.BusinessAddress); - businessAddress.setText('873 Lantern Lane'); - - const city = form.getTextField(fieldNames.City); - city.setText('Tuckerton'); - - const province = form.getDropdown(fieldNames.Province); - province.select('Saskatchewan'); - - const postalCode = form.getTextField(fieldNames.PostalCode); - postalCode.setText('08087'); - - const typeOfReturn = form.getRadioGroup(fieldNames.TypeOfReturn); - typeOfReturn.select('1'); - - const fromDate = form.getTextField(fieldNames.FromDate); - fromDate.setText(['2019', '11', '05'].join('')); - - const toDate = form.getTextField(fieldNames.ToDate); - toDate.setText(['2020', '01', '18'].join('')); - - const amount1 = form.getTextField(fieldNames.Amount1); - amount1.setText('100'); - - const amount2 = form.getTextField(fieldNames.Amount2); - amount2.setText('200'); - - const amount3 = form.getTextField(fieldNames.Amount3); - amount3.setText('300'); - - const amount4 = form.getTextField(fieldNames.Amount4); - amount4.setText('400'); - - const amount5 = form.getTextField(fieldNames.Amount5); - amount5.setText('500'); - - const amount6 = form.getTextField(fieldNames.Amount6); - amount6.setText('600'); - - const byDueDate = form.getRadioGroup(fieldNames.ByDueDate); - byDueDate.select('2'); - - const name = form.getTextField(fieldNames.Name); - name.setText('Arthur Pendragon'); - - const title = form.getTextField(fieldNames.Title); - title.setText('King'); - - const phoneNumber = form.getTextField(fieldNames.PhoneNumber); - phoneNumber.setText('(123) 456-7890'); - - const phoneExt = form.getTextField(fieldNames.PhoneExt); - phoneExt.setText('1'); - - const signatureDate = form.getTextField(fieldNames.SignatureDate); - signatureDate.setText(['2020', '07', '13'].join('')); - - // Fill in remaining fields with random numeric values - const fieldNameValues = values(fieldNames); - const fields = form.getFields(); - fields.forEach((field: PDFField) => { - if (!fieldNameValues.includes(field.getName())) { - if (field instanceof PDFTextField) { - const value = String(Math.floor(Math.random() * 1000000) / 100); - field.setText(value.substring(0, field.getMaxLength())); - } - } - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test15.ts b/apps/deno/tests/test15.ts deleted file mode 100644 index da0a26e28..000000000 --- a/apps/deno/tests/test15.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - PDFDocument, - StandardFonts, - rgb, - TextAlignment, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.dod_character); - - const marioImage = await pdfDoc.embedPng(assets.images.png.small_mario); - const emblemImage = await pdfDoc.embedPng(assets.images.png.mario_emblem); - - const form = pdfDoc.getForm(); - - form.getTextField('CharacterName 2').setText('Mario'); - form.getTextField('Age').setText('24 years'); - form.getTextField('Height').setText(`5' 1"`); - form.getTextField('Weight').setText('196 lbs'); - form.getTextField('Eyes').setText('blue'); - form.getTextField('Skin').setText('white'); - form.getTextField('Hair').setText('brown'); - - form.getButton('CHARACTER IMAGE').setImage(marioImage); - - form - .getTextField('Allies') - .setText( - [ - `Allies:`, - ` • Princess Daisy`, - ` • Princess Peach`, - ` • Rosalina`, - ` • Geno`, - ` • Luigi`, - ` • Donkey Kong`, - ` • Yoshi`, - ` • Diddy Kong`, - ``, - `Organizations:`, - ` • Italian Plumbers Association`, - ].join('\n'), - ); - - form.getTextField('FactionName').setText(`Mario's Emblem`); - form.getTextField('Faction Symbol Image').setImage(emblemImage); - - form - .getTextField('Backstory') - .setText( - `Mario is a fictional character in the Mario video game franchise, owned by Nintendo and created by Japanese video game designer Shigeru Miyamoto. Serving as the company's mascot and the eponymous protagonist of the series, Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, his adventures generally center upon rescuing Princess Peach from the Koopa villain Bowser. His younger brother and sidekick is Luigi.`, - ); - - form - .getTextField('Feat+Traits') - .setText( - [ - `Mario can use three basic three power-ups:`, - ` • the Super Mushroom, which causes Mario to grow larger`, - ` • the Fire Flower, which allows Mario to throw fireballs`, - ` • the Starman, which gives Mario temporary invincibility`, - ].join('\n'), - ); - - form - .getTextField('Treasure') - .setText(['• Gold coins', '• Treasure chests'].join('\n')); - - // Add new page with custom form fields to exercise options not used in test1 - const { width, height } = pdfDoc.getPage(0).getSize(); - const page2 = pdfDoc.addPage([width, height]); - - // Singleline, centered - const singlelineCenteredTf = form.createTextField('singleline.centered.tf'); - singlelineCenteredTf.setAlignment(TextAlignment.Center); - singlelineCenteredTf.setText('Sum centered text yo'); - singlelineCenteredTf.addToPage(page2, { - y: height - 50, - width: 250, - height: 25, - borderWidth: 3, - borderColor: rgb(1, 0, 1), - }); - - // Multiline, centered - const multilineCenteredTf = form.createTextField('multiline.centered.tf'); - multilineCenteredTf.enableMultiline(); - multilineCenteredTf.setAlignment(TextAlignment.Center); - multilineCenteredTf.setText('Sum\ncentered\rtext\nyo'); - multilineCenteredTf.addToPage(page2, { - y: height - 50 - 150, - width: 250, - height: 100, - borderWidth: 3, - borderColor: rgb(1, 0, 1), - }); - - // Singleline, right justified - const singlelineRightTf = form.createTextField('singleline.right.tf'); - singlelineRightTf.setAlignment(TextAlignment.Right); - singlelineRightTf.setText('Sum right justified text yo'); - singlelineRightTf.addToPage(page2, { - y: height - 50, - x: 300, - width: 250, - height: 25, - borderWidth: 3, - borderColor: rgb(1, 0, 1), - }); - - // Multiline, right justified - const multilineRightTf = form.createTextField('multiline.right.tf'); - multilineRightTf.enableMultiline(); - multilineRightTf.setAlignment(TextAlignment.Right); - multilineRightTf.setText('Sum\nright justified\rtext\nyo'); - multilineRightTf.addToPage(page2, { - y: height - 50 - 150, - x: 300, - width: 250, - height: 100, - borderWidth: 3, - borderColor: rgb(1, 0, 1), - }); - - // Multiselect Option List - const optionList = form.createOptionList('option.list'); - optionList.addToPage(page2, { - y: height - 50 - 150 - 250, - width: 250, - height: 200, - backgroundColor: rgb(1, 0.25, 0.25), - borderWidth: 5, - borderColor: rgb(1, 0, 1), - }); - optionList.setOptions([ - 'Sojourner', - 'Spirit', - 'Opportunity', - 'Curiosity', - 'Perseverance', - ]); - optionList.enableMultiselect(); - optionList.select(['Sojourner', 'Curiosity', 'Perseverance']); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test16.ts b/apps/deno/tests/test16.ts deleted file mode 100644 index aa10e6ed4..000000000 --- a/apps/deno/tests/test16.ts +++ /dev/null @@ -1,500 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { PDFDocument } from '../../../dist/pdf-lib.esm.js'; - -const fieldNames = { - // Page 1 - Single: 'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[0]', - MarriedFilingJointly: 'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]', - MarriedFilingSeparately: - 'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[2]', - HeadOfHousehold: 'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[3]', - QualifyingWidow: 'topmostSubform[0].Page1[0].FilingStatus[0].c1_01[4]', - FilingPartner: 'topmostSubform[0].Page1[0].FilingStatus[0].f1_01[0]', - - FirstNameAndMiddleInitial: 'topmostSubform[0].Page1[0].f1_02[0]', - LastName: 'topmostSubform[0].Page1[0].f1_03[0]', - SSN: 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]', - SpouseFirstNameAndMiddleInitial: - 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]', - SpouseLastName: - 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]', - SpouseSSN: 'topmostSubform[0].Page1[0].ReadOrderControl[0].f1_07[0]', - - HomeAddress: - 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_08[0]', - AptNo: 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_09[0]', - CityTownStateZip: - 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_10[0]', - ForeignCountryName: - 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_11[0]', - ForeignProvince: - 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_12[0]', - ForeignPostalCode: - 'topmostSubform[0].Page1[0].ReadOrderControl[0].Address[0].f1_13[0]', - - Dependents: { - FirstAndLastName: [ - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_14[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_17[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_20[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_23[0]', - ], - SSN: [ - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_15[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_18[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_21[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_24[0]', - ], - Relationship: [ - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].f1_16[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].f1_19[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].f1_22[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].f1_25[0]', - ], - - // Checkboxes - ChildTaxCredit: [ - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].c1_12[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].c1_14[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].c1_16[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].c1_18[0]', - ], - OtherDependentsCredit: [ - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row1[0].c1_13[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row2[0].c1_15[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row3[0].c1_17[0]', - 'topmostSubform[0].Page1[0].Dependents[0].Table_Dependents[0].Row4[0].c1_19[0]', - ], - }, - - TaxExemptInterest: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_27[0]', - QualifiedDividends: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_29[0]', - IraDistributions: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_31[0]', - Pensions: 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_33[0]', - SocialSecurity: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_35[0]', - Wages: 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_26[0]', - TaxableInterest: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_28[0]', - OrdinaryDividends: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_30[0]', - TaxableIraDistributions: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_32[0]', - TaxablePensions: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_34[0]', - TaxableSocialSecurity: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_36[0]', - CapitalGainOrLoss: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_37[0]', - OtherIncome: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_38[0]', - TotalIncome: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_39[0]', - IncomeAdjustments: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_40[0]', - AdjustedGrossIncome: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].f1_41[0]', - StandardDeduction: 'topmostSubform[0].Page1[0].f1_42[0]', - QualifiedBusinessDeduction: 'topmostSubform[0].Page1[0].f1_43[0]', - SumOf9And10: 'topmostSubform[0].Page1[0].f1_44[0]', - TaxableIncome: 'topmostSubform[0].Page1[0].f1_45[0]', - - TaxFormLabel: 'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].f2_01[0]', - TaxFormValue: 'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].f2_02[0]', - ScheduleTotal12b: 'topmostSubform[0].Page2[0].f2_03[0]', - ChildTaxCredit: - 'topmostSubform[0].Page2[0].Lines13a-13b_ReadOrder[0].f2_04[0]', - ScheduleTotal13b: 'topmostSubform[0].Page2[0].f2_05[0]', - Subtract14: 'topmostSubform[0].Page2[0].f2_06[0]', - OtherTaxes: 'topmostSubform[0].Page2[0].f2_07[0]', - TotalTax: 'topmostSubform[0].Page2[0].f2_08[0]', - WithheldIncomeTax: 'topmostSubform[0].Page2[0].f2_09[0]', - EarnedIncomeCredit: 'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_10[0]', - AdditionalChildTaxCredit: - 'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_11[0]', - OpportunityCredit: 'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_12[0]', - Schedule18d: 'topmostSubform[0].Page2[0].Line18_ReadOrder[0].f2_13[0]', - RefundableCredits: 'topmostSubform[0].Page2[0].f2_14[0]', - TotalPayments: 'topmostSubform[0].Page2[0].f2_15[0]', - AmountOverpaid: 'topmostSubform[0].Page2[0].f2_16[0]', - AmountRefunded: 'topmostSubform[0].Page2[0].f2_17[0]', - RoutingNumber: 'topmostSubform[0].Page2[0].RoutingNo[0].f2_18[0]', - AccountNumber: 'topmostSubform[0].Page2[0].AccountNo[0].f2_19[0]', - EstimatedTax2020: 'topmostSubform[0].Page2[0].f2_20[0]', - AmountYouOwe: 'topmostSubform[0].Page2[0].f2_21[0]', - EstimatedTaxPenalty: 'topmostSubform[0].Page2[0].f2_22[0]', - DesigneeName: 'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_23[0]', - DesigneePhoneNo: 'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_24[0]', - DesigneePIN: 'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].f2_25[0]', - YourOccupation: 'topmostSubform[0].Page2[0].Signatures[0].f2_26[0]', - YourIdentityPIN: 'topmostSubform[0].Page2[0].Signatures[0].f2_27[0]', - SpouseOccupation: 'topmostSubform[0].Page2[0].Signatures[0].f2_28[0]', - SpouseIdentityPIN: 'topmostSubform[0].Page2[0].Signatures[0].f2_29[0]', - PhoneNo: 'topmostSubform[0].Page2[0].Signatures[0].f2_30[0]', - EmailAddress: 'topmostSubform[0].Page2[0].Signatures[0].f2_31[0]', - PreparerName: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_32[0]', - PTIN: 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_33[0]', - PreparerFirmName: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_34[0]', - PreparerPhoneNo: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_35[0]', - PreparerAddress: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_36[0]', - PreparerEIN: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].f2_37[0]', - - // Checkboxes - PresidentialElectionFund: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].PresidentialElection[0].c1_02[0]', - PresidentialElectionFundSpouse: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].PresidentialElection[0].c1_03[0]', - YouAsDependent: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_04[0]', - SpouseAsDependent: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_05[0]', - SpouseItemizes: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].StandardDeduction[0].c1_06[0]', - BlindBefore1995: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_07[0]', - AreBlind: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_08[0]', - SpouseBlindBefore1995: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_09[0]', - SpouseIsBlind: - 'topmostSubform[0].Page1[0].ReadOrderControl[1].AgeBlindness[0].c1_10[0]', - MoreThanFourDependents: - 'topmostSubform[0].Page1[0].IfMoreThanFour[0].c1_11[0]', - CapitalGainOrLossRequired: - 'topmostSubform[0].Page1[0].ReadOrderControl_Lns1-8b[0].c1_20[0]', - TaxForm8814: 'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_01[0]', - TaxForm4972: 'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_02[0]', - TaxFormCustom: - 'topmostSubform[0].Page2[0].Lines12a-12b_ReadOrder[0].c2_03[0]', - Form8888Attached: 'topmostSubform[0].Page2[0].c2_04[0]', - CheckingAccountType: 'topmostSubform[0].Page2[0].c2_05[0]', - SavingsAccountType: 'topmostSubform[0].Page2[0].c2_05[1]', - AllowOthersToDiscussReturn: - 'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].c2_06[0]', - DoNotAllowOthersToDiscussReturn: - 'topmostSubform[0].Page2[0].ThirdPartyDesignee[0].c2_06[1]', - Is3rdPartyDesignee: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].CheckIf[0].c2_07[0]', - IsSelfEmployed: - 'topmostSubform[0].Page2[0].PaidPreparer[0].Preparer[0].CheckIf[0].c2_07[1]', -}; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.with_xfa_fields); - - const form = pdfDoc.getForm(); - - const mfs = form.getCheckBox(fieldNames.MarriedFilingSeparately); - mfs.check(); - - const filingPartner = form.getTextField(fieldNames.FilingPartner); - filingPartner.setText('Guinevere Pendragon'); - filingPartner.setFontSize(4); - - const firstName = form.getTextField(fieldNames.FirstNameAndMiddleInitial); - firstName.setText('Arthur F'); - firstName.setFontSize(20); - - const lastName = form.getTextField(fieldNames.LastName); - lastName.setText('Pendragon'); - lastName.setFontSize(30); - - const ssn = form.getTextField(fieldNames.SSN); - ssn.setText('123456789'); - - const spouseFirst = form.getTextField( - fieldNames.SpouseFirstNameAndMiddleInitial, - ); - spouseFirst.setText('Guinevere Q'); - - const spouseLast = form.getTextField(fieldNames.SpouseLastName); - spouseLast.setText('Pendragon'); - - const spouseSsn = form.getTextField(fieldNames.SpouseSSN); - spouseSsn.setText('987654321'); - - const standardDeduction = form.getTextField(fieldNames.StandardDeduction); - standardDeduction.setText('42.36'); - - const businessDeduction = form.getTextField( - fieldNames.QualifiedBusinessDeduction, - ); - businessDeduction.setText('91.48'); - - const sumOf9And10 = form.getTextField(fieldNames.SumOf9And10); - sumOf9And10.setText('133.84'); - - const taxableIncome = form.getTextField(fieldNames.TaxableIncome); - taxableIncome.setText('9000.01'); - - const homeAddress = form.getTextField(fieldNames.HomeAddress); - homeAddress.setText('Camelot'); - - const aptNo = form.getTextField(fieldNames.AptNo); - aptNo.setText('42'); - - const cityTownStateZip = form.getTextField(fieldNames.CityTownStateZip); - cityTownStateZip.setText('Yorkshire 29381'); - - const foreignCountryName = form.getTextField(fieldNames.ForeignCountryName); - foreignCountryName.setText('England'); - - const foreignProvince = form.getTextField(fieldNames.ForeignProvince); - foreignProvince.setText('Yorkshire and the Humber'); - - const foreignPostalCode = form.getTextField(fieldNames.ForeignPostalCode); - foreignPostalCode.setText('29381'); - - [ - 'Caesar Augustus', - 'Marcus Aurelius', - 'Livia Augustus', - 'Claudia Octavia', - ].forEach((firstAndLast, idx) => { - const field = form.getTextField( - fieldNames.Dependents.FirstAndLastName[idx], - ); - field.setText(firstAndLast); - }); - - ['917073905', '671723254', '261182980', '629137689'].forEach( - (dependentSsn, idx) => { - const field = form.getTextField(fieldNames.Dependents.SSN[idx]); - field.setText(dependentSsn); - }, - ); - - ['Son', 'Grandson', 'Daughter', 'Granddaughter'].forEach( - (relationship, idx) => { - const field = form.getTextField(fieldNames.Dependents.Relationship[idx]); - field.setText(relationship); - }, - ); - - const taxExemptInterest = form.getTextField(fieldNames.TaxExemptInterest); - taxExemptInterest.setText('6359.25'); - - const qualifiedDividends = form.getTextField(fieldNames.QualifiedDividends); - qualifiedDividends.setText('7116.60'); - - const iraDistributions = form.getTextField(fieldNames.IraDistributions); - iraDistributions.setText('8903.54'); - - const pensions = form.getTextField(fieldNames.Pensions); - pensions.setText('3996.73'); - - const socialSecurity = form.getTextField(fieldNames.SocialSecurity); - socialSecurity.setText('3633.69'); - - const wages = form.getTextField(fieldNames.Wages); - wages.setText('1600.61'); - - const taxableInterest = form.getTextField(fieldNames.TaxableInterest); - taxableInterest.setText('9705.03'); - - const ordinaryDividends = form.getTextField(fieldNames.OrdinaryDividends); - ordinaryDividends.setText('1567.57'); - - const taxableIraDistributions = form.getTextField( - fieldNames.TaxableIraDistributions, - ); - taxableIraDistributions.setText('4142.40'); - - const taxablePensions = form.getTextField(fieldNames.TaxablePensions); - taxablePensions.setText('6272.80'); - - const taxableSocialSecurity = form.getTextField( - fieldNames.TaxableSocialSecurity, - ); - taxableSocialSecurity.setText('8576.60'); - - const capitalGainOrLoss = form.getTextField(fieldNames.CapitalGainOrLoss); - capitalGainOrLoss.setText('6313.00'); - - const otherIncome = form.getTextField(fieldNames.OtherIncome); - otherIncome.setText('7818.66'); - - const totalIncome = form.getTextField(fieldNames.TotalIncome); - totalIncome.setText('8738.83'); - - const incomeAdjustments = form.getTextField(fieldNames.IncomeAdjustments); - incomeAdjustments.setText('4287.15'); - - const adjustedGrossIncome = form.getTextField(fieldNames.AdjustedGrossIncome); - adjustedGrossIncome.setText('3931.94'); - - const taxFormLabel = form.getTextField(fieldNames.TaxFormLabel); - taxFormLabel.setText('XZ91'); - - const taxFormValue = form.getTextField(fieldNames.TaxFormValue); - taxFormValue.setText('8891.81'); - - const scheduleTotal12b = form.getTextField(fieldNames.ScheduleTotal12b); - scheduleTotal12b.setText('3554.12'); - - const childTaxCredit = form.getTextField(fieldNames.ChildTaxCredit); - childTaxCredit.setText('1639.05'); - - const scheduleTotal13b = form.getTextField(fieldNames.ScheduleTotal13b); - scheduleTotal13b.setText('2618.78'); - - const subtract14 = form.getTextField(fieldNames.Subtract14); - subtract14.setText('4756.35'); - - const otherTaxes = form.getTextField(fieldNames.OtherTaxes); - otherTaxes.setText('2203.54'); - - const totalTax = form.getTextField(fieldNames.TotalTax); - totalTax.setText('5741.44'); - - const withheldIncomeTax = form.getTextField(fieldNames.WithheldIncomeTax); - withheldIncomeTax.setText('842.48'); - - const earnedIncomeCredit = form.getTextField(fieldNames.EarnedIncomeCredit); - earnedIncomeCredit.setText('3614.21'); - - const additionalChildTaxCredit = form.getTextField( - fieldNames.AdditionalChildTaxCredit, - ); - additionalChildTaxCredit.setText('4945.15'); - - const opportunityCredit = form.getTextField(fieldNames.OpportunityCredit); - opportunityCredit.setText('5695.93'); - - const schedule18d = form.getTextField(fieldNames.Schedule18d); - schedule18d.setText('6428.47'); - - const refundableCredits = form.getTextField(fieldNames.RefundableCredits); - refundableCredits.setText('9735.55'); - - const totalPayments = form.getTextField(fieldNames.TotalPayments); - totalPayments.setText('448.04'); - - const amountOverpaid = form.getTextField(fieldNames.AmountOverpaid); - amountOverpaid.setText('9800.47'); - - const amountRefunded = form.getTextField(fieldNames.AmountRefunded); - amountRefunded.setText('1499.83'); - - const routingNumber = form.getTextField(fieldNames.RoutingNumber); - routingNumber.setText('804717479'); - - const accountNumber = form.getTextField(fieldNames.AccountNumber); - accountNumber.setText('10647533083123501'); - - const estimatedTax2020 = form.getTextField(fieldNames.EstimatedTax2020); - estimatedTax2020.setText('5100.81'); - - const amountYouOwe = form.getTextField(fieldNames.AmountYouOwe); - amountYouOwe.setText('3560.83'); - - const estimatedTaxPenalty = form.getTextField(fieldNames.EstimatedTaxPenalty); - estimatedTaxPenalty.setText('1895.78'); - - const designeeName = form.getTextField(fieldNames.DesigneeName); - designeeName.setText('Solomon Draper'); - - const designeePhoneNo = form.getTextField(fieldNames.DesigneePhoneNo); - designeePhoneNo.setText('(123) 456-7890'); - - const designeePIN = form.getTextField(fieldNames.DesigneePIN); - designeePIN.setText('12757'); - - const yourOccupation = form.getTextField(fieldNames.YourOccupation); - yourOccupation.setText('Mythical English King'); - - const yourIdentityPIN = form.getTextField(fieldNames.YourIdentityPIN); - yourIdentityPIN.setText('427830'); - - const spouseOccupation = form.getTextField(fieldNames.SpouseOccupation); - spouseOccupation.setText('Mythical English Queen'); - - const spouseIdentityPIN = form.getTextField(fieldNames.SpouseIdentityPIN); - spouseIdentityPIN.setText('387495'); - - const phoneNo = form.getTextField(fieldNames.PhoneNo); - phoneNo.setText('(173) 103-1048'); - - const emailAddress = form.getTextField(fieldNames.EmailAddress); - emailAddress.setText('arthur@roundtable.com'); - - const preparerName = form.getTextField(fieldNames.PreparerName); - preparerName.setText('Sashenka Knight'); - - const ptin = form.getTextField(fieldNames.PTIN); - ptin.setText('190783'); - - const preparerFirmName = form.getTextField(fieldNames.PreparerFirmName); - preparerFirmName.setText('Qux Baz Preparationz'); - - const preparerPhoneNo = form.getTextField(fieldNames.PreparerPhoneNo); - preparerPhoneNo.setText('(378) 102-1947'); - - const preparerAddress = form.getTextField(fieldNames.PreparerAddress); - preparerAddress.setText('8545 Rockland Drive Fairburn, GA 30213'); - - const preparerEIN = form.getTextField(fieldNames.PreparerEIN); - preparerEIN.setText('218932783'); - - ['Son', 'Grandson', 'Daughter', 'Granddaughter'].forEach( - (relationship, idx) => { - const field = form.getTextField(fieldNames.Dependents.Relationship[idx]); - field.setText(relationship); - }, - ); - - const ctc0 = form.getCheckBox(fieldNames.Dependents.ChildTaxCredit[0]); - ctc0.check(); - - const ctc2 = form.getCheckBox(fieldNames.Dependents.ChildTaxCredit[2]); - ctc2.check(); - - const odc1 = form.getCheckBox(fieldNames.Dependents.OtherDependentsCredit[1]); - odc1.check(); - - const odc3 = form.getCheckBox(fieldNames.Dependents.OtherDependentsCredit[3]); - odc3.check(); - - const pefs = form.getCheckBox(fieldNames.PresidentialElectionFundSpouse); - pefs.check(); - - const mtfd = form.getCheckBox(fieldNames.MoreThanFourDependents); - mtfd.check(); - - const si = form.getCheckBox(fieldNames.SpouseItemizes); - si.check(); - - const ab = form.getCheckBox(fieldNames.AreBlind); - ab.check(); - - const sib = form.getCheckBox(fieldNames.SpouseIsBlind); - sib.check(); - - const cgolr = form.getCheckBox(fieldNames.CapitalGainOrLossRequired); - cgolr.check(); - - const f888a = form.getCheckBox(fieldNames.Form8888Attached); - f888a.check(); - - const cat = form.getCheckBox(fieldNames.CheckingAccountType); - cat.check(); - - const aotdr = form.getCheckBox(fieldNames.AllowOthersToDiscussReturn); - aotdr.check(); - - const ise = form.getCheckBox(fieldNames.IsSelfEmployed); - ise.check(); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test17.ts b/apps/deno/tests/test17.ts deleted file mode 100644 index 6e0024d35..000000000 --- a/apps/deno/tests/test17.ts +++ /dev/null @@ -1,200 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; - -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - PDFDocument, - StandardFonts, - drawRectangle, - rgb, - degrees, - drawText, - PDFFont, - drawEllipse, - PDFWidgetAnnotation, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.fancy_fields); - - pdfDoc.registerFontkit(fontkit); - const ubuntuFont = await pdfDoc.embedFont(assets.fonts.ttf.ubuntu_r); - - const form = pdfDoc.getForm(); - - // Text Fields - const prefix = form.getTextField('Prefix ⚽️'); - prefix.updateAppearances(ubuntuFont); - - const firstName = form.getTextField('First Name 🚀'); - firstName.updateAppearances(ubuntuFont); - - const middleInitial = form.getTextField('MiddleInitial 🎳'); - middleInitial.updateAppearances(ubuntuFont); - - const lastName = form.getTextField('LastName 🛩'); - lastName.updateAppearances(ubuntuFont); - - // Check Boxes - const isAFairy = form.getCheckBox('Are You A Fairy? 🌿'); - isAFairy.updateAppearances(); - - const isPowerLevelOver9000 = form.getCheckBox( - 'Is Your Power Level Over 9000? 💪', - ); - isPowerLevelOver9000.updateAppearances(); - - const onePunch = form.getCheckBox('Can You Defeat Enemies In One Punch? 👊'); - onePunch.updateAppearances(); - - const everLetMeDown = form.getCheckBox('Will You Ever Let Me Down? ☕️'); - everLetMeDown.updateAppearances(); - - // Buttons - const eject = form.getButton('Eject 📼'); - eject.updateAppearances(ubuntuFont); - - const submit = form.getButton('Submit 📝'); - submit.updateAppearances(ubuntuFont); - - const play = form.getButton('Play ▶️'); - play.updateAppearances(ubuntuFont); - - const launch = form.getButton('Launch 🚀'); - launch.updateAppearances(ubuntuFont); - - // Radio Group - const historicalFigures = form.getRadioGroup('Historical Figures 🐺'); - historicalFigures.updateAppearances(); - - // Option List - const planets = form.getOptionList('Which Are Planets? 🌎'); - planets.updateAppearances(ubuntuFont); - - // Dropdown - const gundams = form.getDropdown('Choose A Gundam 🤖'); - gundams.select('One Punch Man'); - gundams.updateAppearances(ubuntuFont); - - // ===================== Custom Appearance Providers ======================== - const page = pdfDoc.addPage(); - const symbol = await pdfDoc.embedFont(StandardFonts.Symbol); - - const btn = form.createButton('custom.button.field'); - const cb = form.createCheckBox('custom.checkbox.field'); - const dd = form.createDropdown('custom.dropdown.field'); - const ol = form.createOptionList('custom.optionlist.field'); - const rg = form.createRadioGroup('custom.radiogroup.field'); - const tf = form.createTextField('custom.text.field'); - const tfFontSize = form.createTextField('custom.text.fieldFontSize'); - - dd.addOptions('∑'); - ol.addOptions('∑'); - - const width = 100; - const height = 50; - const x = page.getWidth() / 2 - width / 2; - let y = page.getHeight(); - - y -= height + 25; - btn.addToPage('∑', page, { x, y, width, height, font: symbol }); - y -= height + 25; - cb.addToPage(page, { x, y, width, height }); - y -= height + 25; - dd.addToPage(page, { x, y, width, height, font: symbol }); - y -= height + 25; - ol.addToPage(page, { x, y, width, height, font: symbol }); - y -= height + 25; - rg.addOptionToPage('bar', page, { x, y, width, height }); - y -= height + 25; - tf.addToPage(page, { x, y, width, height, font: symbol }); - y -= height * 4 + 25; - tfFontSize.addToPage(page, { - x: x - width * 2, - y, - width: width * 5, - height: height * 4, - font: ubuntuFont, - }); - tfFontSize.enableMultiline(); - tfFontSize.setFontSize(71.999); - tfFontSize.setText('This text should be huge'); - - const rectangle = drawRectangle({ - x: 0, - y: 0, - width, - height, - borderWidth: 2, - color: rgb(1, 0.1, 0.75), - borderColor: rgb(0, 0.1, 1), - rotate: degrees(0), - xSkew: degrees(0), - ySkew: degrees(0), - }); - - const circle = drawEllipse({ - x: 15, - y: height - 15, - xScale: 15, - yScale: 15, - borderWidth: 0, - color: rgb(0, 0, 0), - borderColor: undefined, - rotate: degrees(0), - }); - - const text = symbol.encodeText('ℑ'); - const textW = symbol.widthOfTextAtSize('ℑ', 35); - const textH = symbol.heightAtSize(35); - const symbolText = (font: PDFFont) => - drawText(text, { - x: width / 2 - textW / 2, - y: height / 2 - textH / 2 + 10, - color: rgb(0, 0, 0), - font: font.name, - size: 35, - rotate: degrees(0), - xSkew: degrees(0), - ySkew: degrees(0), - }); - - const assert = (condition: boolean, msg = '') => { - if (!condition) throw new Error(msg || 'Assertion failed'); - }; - - btn.updateAppearances(symbol, (field: any, widget: any, font: any) => { - assert(field === btn); - assert(widget instanceof PDFWidgetAnnotation); - return [...rectangle, ...symbolText(font)]; - }); - cb.updateAppearances((field: any, widget: any) => { - assert(field === cb); - assert(widget instanceof PDFWidgetAnnotation); - return { on: [...rectangle, ...circle], off: [...rectangle, ...circle] }; - }); - dd.updateAppearances(symbol, (field: any, widget: any, font: any) => { - assert(field === dd); - assert(widget instanceof PDFWidgetAnnotation); - return [...rectangle, ...symbolText(font)]; - }); - ol.updateAppearances(symbol, (field: any, widget: any, font: any) => { - assert(field === ol); - assert(widget instanceof PDFWidgetAnnotation); - return [...rectangle, ...symbolText(font)]; - }); - rg.updateAppearances((field: any, widget: any) => { - assert(field === rg); - assert(widget instanceof PDFWidgetAnnotation); - return { on: [...rectangle, ...circle], off: [...rectangle, ...circle] }; - }); - tf.updateAppearances(symbol, (field: any, widget: any, font: any) => { - assert(field === tf); - assert(widget instanceof PDFWidgetAnnotation); - return [...rectangle, ...symbolText(font)]; - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test18.ts b/apps/deno/tests/test18.ts deleted file mode 100644 index 6324c1564..000000000 --- a/apps/deno/tests/test18.ts +++ /dev/null @@ -1,254 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; - -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { PDFDocument } from '../../../dist/pdf-lib.esm.js'; - -// Based on test14.ts -const loadA = async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.with_combed_fields); - const form = pdfDoc.getForm(); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].LegalName[0]', - ) - .setText('Purple People Eater'); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT1[0]', - ) - .setText('123456789'); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].BusinessInfo[0].AccountNumber[0].BusinessNumber_RT2[0]', - ) - .setText('9876'); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].BusinessAddress[0]', - ) - .setText('873 Lantern Lane'); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].City[0]', - ) - .setText('Tuckerton'); - - form - .getDropdown( - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].Province[0]', - ) - .select('Saskatchewan'); - - form - .getTextField( - 'form1[0].Page1[0].BeforeYouBegin[0].PhysicalAddress[0].PostalCode[0]', - ) - .setText('08087'); - - // TODO: Add this back once https://github.com/Hopding/pdf-lib/pull/724 is merged - // const typeOfReturn = form.getRadioGroup( - // 'form1[0].Page1[0].BeforeYouBegin[0].Type[0].RadioButtonGroup[0]', - // ); - // typeOfReturn.select('1'); - - form.flatten(); - return pdfDoc; -}; - -// Based on test15.ts -const loadB = async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.dod_character); - const form = pdfDoc.getForm(); - - const marioImage = await pdfDoc.embedPng(assets.images.png.small_mario); - - form.getTextField('CharacterName 2').setText('Mario'); - form.getTextField('Age').setText('24 years'); - form.getTextField('Height').setText(`5' 1"`); - form.getTextField('Weight').setText('196 lbs'); - form.getTextField('Eyes').setText('blue'); - form.getTextField('Skin').setText('white'); - form.getTextField('Hair').setText('brown'); - - form.getButton('CHARACTER IMAGE').setImage(marioImage); - - form.flatten(); - return pdfDoc; -}; - -// Based on test16.ts -const loadC = async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.with_xfa_fields); - const form = pdfDoc.getForm(); - - form - .getCheckBox('topmostSubform[0].Page1[0].FilingStatus[0].c1_01[2]') - .check(); - - form - .getTextField('topmostSubform[0].Page1[0].FilingStatus[0].f1_01[0]') - .setText('Guinevere Pendragon'); - - form.getTextField('topmostSubform[0].Page1[0].f1_02[0]').setText('Arthur F'); - - form.getTextField('topmostSubform[0].Page1[0].f1_03[0]').setText('Pendragon'); - - form - .getTextField( - 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]', - ) - .setText('123456789'); - - form - .getTextField( - 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]', - ) - .setText('Guinevere Q'); - - form - .getTextField( - 'topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]', - ) - .setText('Pendragon'); - - form - .getTextField('topmostSubform[0].Page1[0].ReadOrderControl[0].f1_07[0]') - .setText('987654321'); - - form.flatten(); - return pdfDoc; -}; - -// Based on test17.ts -const loadD = async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.fancy_fields); - - pdfDoc.registerFontkit(fontkit); - const ubuntuFont = await pdfDoc.embedFont(assets.fonts.ttf.ubuntu_r); - - const form = pdfDoc.getForm(); - - form.getTextField('Prefix ⚽️').updateAppearances(ubuntuFont); - form.getTextField('First Name 🚀').updateAppearances(ubuntuFont); - form.getTextField('MiddleInitial 🎳').updateAppearances(ubuntuFont); - form.getTextField('LastName 🛩').updateAppearances(ubuntuFont); - form.getCheckBox('Are You A Fairy? 🌿').updateAppearances(); - form.getCheckBox('Is Your Power Level Over 9000? 💪').updateAppearances(); - form - .getCheckBox('Can You Defeat Enemies In One Punch? 👊') - .updateAppearances(); - form.getCheckBox('Will You Ever Let Me Down? ☕️').updateAppearances(); - form.getButton('Eject 📼').updateAppearances(ubuntuFont); - form.getButton('Submit 📝').updateAppearances(ubuntuFont); - form.getButton('Play ▶️').updateAppearances(ubuntuFont); - form.getButton('Launch 🚀').updateAppearances(ubuntuFont); - form.getRadioGroup('Historical Figures 🐺').updateAppearances(); - form.getOptionList('Which Are Planets? 🌎').updateAppearances(ubuntuFont); - - const gundams = form.getDropdown('Choose A Gundam 🤖'); - gundams.select('One Punch Man'); - gundams.updateAppearances(ubuntuFont); - - form.flatten(); - return pdfDoc; -}; - -// Based on https://github.com/Hopding/pdf-lib#create-form -const loadE = async (_assets: Assets) => { - const pdfDoc = await PDFDocument.create(); - - const page = pdfDoc.addPage([550, 750]); - - const form = pdfDoc.getForm(); - - page.drawText('Enter your favorite superhero:', { x: 50, y: 700, size: 20 }); - const superheroField = form.createTextField('favorite.superhero'); - superheroField.setText('One Punch Man'); - superheroField.addToPage(page, { x: 55, y: 640 }); - - page.drawText('Select your favorite rocket:', { x: 50, y: 600, size: 20 }); - page.drawText('Falcon Heavy', { x: 120, y: 560, size: 18 }); - const rocketField = form.createRadioGroup('favorite.rocket'); - rocketField.addOptionToPage('Saturn IV', page, { x: 55, y: 540 }); - rocketField.select('Saturn IV'); - - page.drawText('Select your favorite gundams:', { x: 50, y: 440, size: 20 }); - page.drawText('Exia', { x: 120, y: 400, size: 18 }); - const exiaField = form.createCheckBox('gundam.exia'); - exiaField.addToPage(page, { x: 55, y: 380 }); - exiaField.check(); - - page.drawText('Select your favorite planet:', { x: 50, y: 280, size: 20 }); - const planetsField = form.createDropdown('favorite.planet'); - planetsField.addOptions(['Venus', 'Earth', 'Mars', 'Pluto']); - planetsField.select('Pluto'); - planetsField.addToPage(page, { x: 55, y: 220 }); - - page.drawText('Select your favorite person:', { x: 50, y: 180, size: 18 }); - const personField = form.createOptionList('favorite.person'); - personField.addOptions([ - 'Julius Caesar', - 'Ada Lovelace', - 'Cleopatra', - 'Aaron Burr', - 'Mark Antony', - ]); - personField.select('Ada Lovelace'); - personField.addToPage(page, { x: 55, y: 70 }); - - form.flatten(); - - return pdfDoc; -}; - -export default async (assets: Assets) => { - const pdfDoc = await PDFDocument.load(assets.pdfs.form_to_flatten); - - const form = pdfDoc.getForm(); - - form.getTextField('Text1').setText('Some Text'); - - form.getRadioGroup('Group2').select('Choice1'); - form.getRadioGroup('Group3').select('Choice3'); - form.getRadioGroup('Group4').select('Choice1'); - - form.getCheckBox('Check Box3').check(); - form.getCheckBox('Check Box4').uncheck(); - - form.getDropdown('Dropdown7').select('Infinity'); - - form.getOptionList('List Box6').select('Honda'); - - const fieldToRemove = form.getRadioGroup('Group4'); - form.removeField(fieldToRemove); - if (form.getFieldMaybe('Group4') !== undefined) { - throw new Error('Failed to remove field'); - } - - form.flatten(); - - // Copy pages from documents with flattened forms - const formDocs = [ - await loadA(assets), - await loadB(assets), - await loadC(assets), - await loadD(assets), - await loadE(assets), - ]; - - for (const formDoc of formDocs) { - const [page1] = await pdfDoc.copyPages(formDoc, [0]); - pdfDoc.addPage(page1); - } - - const pdfBytes = await pdfDoc.save(); - - return pdfBytes; -}; diff --git a/apps/deno/tests/test2.ts b/apps/deno/tests/test2.ts deleted file mode 100644 index 668373511..000000000 --- a/apps/deno/tests/test2.ts +++ /dev/null @@ -1,122 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - ParseSpeeds, - PDFPage, - PDFDocument, - rgb, -} from '../../../dist/pdf-lib.esm.js'; - -// This test loads an existing PDF document with many pages. -// It inserts data for every page (images, rectangles, texts, embedded PDFs). -// Also, the second page is removed. -export default async (assets: Assets) => { - const { fonts, images, pdfs } = assets; - - const pdfDoc = await PDFDocument.load(pdfs.linearized_with_object_streams, { - parseSpeed: ParseSpeeds.Fastest, - updateMetadata: false, - }); - - pdfDoc.registerFontkit(fontkit); - - const ubuntuFont = await pdfDoc.embedFont(fonts.ttf.ubuntu_r, { - subset: true, - }); - const smallMarioImage = await pdfDoc.embedPng(images.png.small_mario); - const smallMarioDims = smallMarioImage.scale(0.18); - - const sourcePdfDoc = await PDFDocument.load( - assets.pdfs.with_large_page_count, - ); - const sourcePdfPage = sourcePdfDoc.getPage(73); - - const embeddedPageFigure = { - xOffset: 100, - yOffset: 330, - width: 350, - height: 240, - padding: 10, - }; - const embeddedPage = await pdfDoc.embedPage(sourcePdfPage, { - // clip the PDF page to a certain area within the page - left: embeddedPageFigure.xOffset, - right: embeddedPageFigure.xOffset + embeddedPageFigure.width, - bottom: embeddedPageFigure.yOffset, - top: embeddedPageFigure.yOffset + embeddedPageFigure.height, - }); - const embeddedPageDims = embeddedPage.scale(0.5); - - const lines = [ - 'This is an image of Mario running.', - 'This image and text was drawn on', - 'top of an existing PDF using pdf-lib!', - ]; - const fontSize = 24; - const solarizedWhite = rgb(253 / 255, 246 / 255, 227 / 255); - const solarizedGray = rgb(101 / 255, 123 / 255, 131 / 255); - - const textWidth = ubuntuFont.widthOfTextAtSize(lines[2], fontSize); - - pdfDoc.getPages().forEach((page: PDFPage) => { - const { width, height } = page.getSize(); - const centerX = width / 2; - const centerY = height / 2; - page.drawImage(smallMarioImage, { - ...smallMarioDims, - x: centerX - smallMarioDims.width / 2, - y: centerY + 15, - }); - const boxHeight = (fontSize + 5) * lines.length; - page.drawRectangle({ - x: centerX - textWidth / 2 - 5, - y: centerY - 15 - boxHeight + fontSize + 3, - width: textWidth + 10, - height: boxHeight, - color: solarizedWhite, - opacity: 0.85, - borderColor: solarizedGray, - borderWidth: 3, - }); - page.setFont(ubuntuFont); - page.setFontColor(solarizedGray); - page.drawText(lines.join('\n'), { - x: centerX - textWidth / 2, - y: centerY - 15, - }); - page.drawRectangle({ - x: 10, - y: 10, - width: embeddedPageFigure.width / 2 + embeddedPageFigure.padding * 2, - height: embeddedPageFigure.height / 2 + embeddedPageFigure.padding * 2, - color: solarizedWhite, - opacity: 0.6, - borderColor: solarizedGray, - borderWidth: 2, - }); - page.drawPage(embeddedPage, { - x: embeddedPageFigure.padding + 10, - y: embeddedPageFigure.padding + 10, - ...embeddedPageDims, - }); - }); - - pdfDoc.removePage(1); - - // These will all be undefined since the source document's metadata is - // stored in a metadata stream, not the more widely used info dictionary. - // pdf-lib does not currently support reading metadata streams. - console.log('Title:', pdfDoc.getTitle()); - console.log('Author:', pdfDoc.getAuthor()); - console.log('Subject:', pdfDoc.getSubject()); - console.log('Creator:', pdfDoc.getCreator()); - console.log('Keywords:', pdfDoc.getKeywords()); - console.log('Producer:', pdfDoc.getProducer()); - console.log('Creation Date:', pdfDoc.getCreationDate()); - console.log('Modification Date:', pdfDoc.getModificationDate()); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test3.ts b/apps/deno/tests/test3.ts deleted file mode 100644 index ae5b830bc..000000000 --- a/apps/deno/tests/test3.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - degrees, - ParseSpeeds, - PDFDocument, - rgb, - decodeFromBase64, - StandardFonts, - LineCapStyle, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs, images } = assets; - - const pdfDoc = await PDFDocument.load(pdfs.with_update_sections_base64_uri, { - parseSpeed: ParseSpeeds.Fastest, - updateMetadata: false, - }); - - await pdfDoc.attach(pdfs.normal_base64, 'tax_form.pdf', { - mimeType: 'application/pdf', - description: 'D-2210 tax form for 2012 🏦', - creationDate: new Date('2004/04/04'), - modificationDate: new Date('2005/05/05'), - }); - - const helveticaFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold); - const catRidingUnicornImage = await pdfDoc.embedJpg( - images.jpg.cat_riding_unicorn, - ); - const cmykImage = await pdfDoc.embedJpg(images.jpg.cmyk_colorspace); - - const catRidingUnicornDims = catRidingUnicornImage.scale(0.13); - const cmykDims = cmykImage.scale(0.5); - - const page0 = pdfDoc.insertPage(0, [305, 250]); - const page1 = pdfDoc.getPage(1); - - const docWithAnnots = await PDFDocument.load(pdfs.with_annots); - const [page2] = await pdfDoc.copyPages(docWithAnnots, [0]); - page2.scaleContent(0.5, 0.5); - pdfDoc.addPage(page2); - const [page3] = await pdfDoc.copyPages(docWithAnnots, [0]); - page3.scaleAnnotations(0.5, 0.5); - pdfDoc.addPage(page3); - const [page4] = await pdfDoc.copyPages(docWithAnnots, [0]); - page4.scale(0.5, 0.5); - pdfDoc.addPage(page4); - - const page5 = pdfDoc.addPage([305, 250]); - - const hotPink = rgb(1, 0, 1); - const red = rgb(1, 0, 0); - - page0.drawText('This is the new first page!', { - x: 5, - y: 200, - font: helveticaFont, - color: hotPink, - }); - page0.drawLine({ - start: { x: 10, y: 207 }, - end: { x: 295, y: 207 }, - color: rgb(0, 1, 1), - thickness: 5, - opacity: 0.7, - }); - page0.drawImage(catRidingUnicornImage, { - ...catRidingUnicornDims, - x: 30, - y: 30, - }); - - const lastPageText = 'This is the last page!'; - const lastPageTextWidth = helveticaFont.widthOfTextAtSize(lastPageText, 24); - - const page1Text = 'pdf-lib is awesome!'; - const page1TextWidth = helveticaFont.widthOfTextAtSize(page1Text, 70); - page1.setFontSize(70); - page1.drawText(page1Text, { - x: page1.getWidth() / 2 - page1TextWidth / 2 + 45, - y: page1.getHeight() / 2 + 45, - color: red, - rotate: degrees(-30), - xSkew: degrees(15), - ySkew: degrees(15), - }); - - page5.setFontSize(24); - page5.drawText('This is the last page!', { - x: 30, - y: 215, - font: helveticaFont, - color: hotPink, - }); - page5.drawLine({ - start: { x: 30, y: 205 }, - end: { x: 30 + lastPageTextWidth, y: 205 }, - color: hotPink, - thickness: 5, - }); - page5.drawImage(cmykImage, { - ...cmykDims, - x: 30, - y: 30, - }); - page5.drawLine({ - start: { x: 30, y: 240 }, - end: { x: 30 + lastPageTextWidth, y: 240 }, - color: hotPink, - thickness: 5, - lineCap: LineCapStyle.Round, - }); - - console.log('Title:', pdfDoc.getTitle()); - console.log('Author:', pdfDoc.getAuthor()); - console.log('Subject:', pdfDoc.getSubject()); - console.log('Creator:', pdfDoc.getCreator()); - console.log('Keywords:', pdfDoc.getKeywords()); - console.log('Producer:', pdfDoc.getProducer()); - console.log('Creation Date:', pdfDoc.getCreationDate()); - console.log('Modification Date:', pdfDoc.getModificationDate()); - - const base64Pdf = await pdfDoc.saveAsBase64(); - - const pdfBytes = decodeFromBase64(base64Pdf); - - return pdfBytes; -}; diff --git a/apps/deno/tests/test4.ts b/apps/deno/tests/test4.ts deleted file mode 100644 index 2d3adbf2a..000000000 --- a/apps/deno/tests/test4.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - ParseSpeeds, - PDFDocument, - PDFPage, - radians, - StandardFonts, - rgb, - degrees, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs, images } = assets; - - const pdfDoc = await PDFDocument.load(pdfs.normal_base64, { - parseSpeed: ParseSpeeds.Fastest, - }); - - const minionsLaughingImage = await pdfDoc.embedJpg( - images.jpg.minions_laughing, - ); - const minionsLaughingDims = minionsLaughingImage.scale(0.6); - - const firstPage = pdfDoc.getPage(0); - const middlePage = pdfDoc.insertPage(1, [600, 500]); - const lastPage = pdfDoc.getPage(2); - - const fontSize = 20; - middlePage.setFontSize(fontSize); - middlePage.moveTo(0, middlePage.getHeight()); - - Object.keys(StandardFonts).forEach((fontNameStr, idx) => { - middlePage.moveDown(fontSize); - - const fontName = fontNameStr as keyof typeof StandardFonts; - const fontObj = StandardFonts[fontName]; - const font = pdfDoc.embedStandardFont(fontObj); - - middlePage.setFont(font); - - // prettier-ignore - const text = ( - fontName === StandardFonts.Symbol ? `${idx + 1}. Τηεσε αρε τηε 14 Στανδαρδ Φοντσ.` - : fontName === StandardFonts.ZapfDingbats ? `✑✔✎ ✴❈❅▲❅ ❁❒❅ ▼❈❅ ✑✔ ✳▼❁■❄❁❒❄ ✦❏■▼▲✎` - : `${idx + 1}. These are the 14 Standard Fonts.` - ); - - middlePage.drawText(text, { - rotate: radians(-Math.PI / 6), - xSkew: radians(Math.PI / 10), - ySkew: radians(Math.PI / 10), - }); - }); - - middlePage.drawEllipse({ - x: 450, - y: 225, - xScale: 25, - yScale: 150, - color: rgb(0, 1, 0), - borderWidth: 2, - borderColor: rgb(1, 0, 1), - rotate: degrees(45), - opacity: 0.5, - }); - - const stampImage = (page: PDFPage) => { - const { width, height } = page.getSize(); - const centerX = width / 2; - const centerY = height / 2; - page.drawImage(minionsLaughingImage, { - ...minionsLaughingDims, - x: centerX - minionsLaughingDims.width / 2, - y: centerY - minionsLaughingDims.height / 2, - opacity: 0.75, - }); - }; - - stampImage(firstPage); - stampImage(lastPage); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test5.ts b/apps/deno/tests/test5.ts deleted file mode 100644 index b91d2a082..000000000 --- a/apps/deno/tests/test5.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - ParseSpeeds, - PDFPage, - PDFDocument, - rgb, - StandardFonts, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs, images } = assets; - - const pdfDoc = await PDFDocument.load(pdfs.with_large_page_count, { - parseSpeed: ParseSpeeds.Fastest, - }); - - const timesRomanFont = await pdfDoc.embedFont( - StandardFonts.TimesRomanBoldItalic, - ); - const minionsBananaImage = await pdfDoc.embedPng( - images.png.minions_banana_alpha, - ); - const minionsBananaDims = minionsBananaImage.scale(0.5); - - const pages = pdfDoc.getPages(); - - pages.forEach((page: PDFPage) => { - const { width, height } = page.getSize(); - page.drawImage(minionsBananaImage, { - ...minionsBananaDims, - x: width / 2 - minionsBananaDims.width / 2, - y: height / 2 - minionsBananaDims.height / 2, - }); - }); - - // Interleave new pages between all existing ones - pages.forEach((_: PDFPage, idx: number) => { - const newPage = pdfDoc.insertPage(2 * idx + 1, [500, 150]); - - const fontSize = 24; - const { width, height } = newPage.getSize(); - - newPage.setFont(timesRomanFont); - newPage.setFontSize(fontSize); - - const text = 'This page was interleaved by pdf-lib!'; - const textWidth = timesRomanFont.widthOfTextAtSize(text, fontSize); - const textHeight = timesRomanFont.heightAtSize(fontSize); - - newPage.drawText(text, { - x: width / 2 - textWidth / 2, - y: height / 2 - textHeight / 2, - color: rgb(0.7, 0.4, 0.9), - }); - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test6.ts b/apps/deno/tests/test6.ts deleted file mode 100644 index 0740acb05..000000000 --- a/apps/deno/tests/test6.ts +++ /dev/null @@ -1,135 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - degrees, - ParseSpeeds, - PDFDocument, - rgb, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs, images, fonts } = assets; - - const pdfDoc = await PDFDocument.load( - pdfs.with_missing_endstream_eol_and_polluted_ctm, - { parseSpeed: ParseSpeeds.Fastest }, - ); - - pdfDoc.registerFontkit(fontkit); - - await pdfDoc.attach(pdfs.us_constitution, 'us_constitution.pdf', { - mimeType: 'application/pdf', - description: 'Constitution of the United States 🇺🇸🦅', - creationDate: new Date('1787/09/17'), - modificationDate: new Date('1992/05/07'), - }); - - await pdfDoc.attach( - images.jpg.cat_riding_unicorn_base64, - 'cat_riding_unicorn.jpg', - { - mimeType: 'image/jpeg', - description: 'Cool cat riding a unicorn! 🦄🐈🕶️', - creationDate: new Date('2019/12/01'), - modificationDate: new Date('2020/04/19'), - }, - ); - - const nunitoLigaFont = await pdfDoc.embedFont(fonts.ttf.nunito, { - subset: true, - features: { liga: true }, - }); - const nunitoNoLigaFont = await pdfDoc.embedFont(fonts.ttf.nunito, { - subset: true, - features: { liga: false }, - }); - const smallMarioImage = await pdfDoc.embedPng(images.png.small_mario); - const smallMarioDims = smallMarioImage.scale(0.15); - - const page1 = pdfDoc.getPage(0); - - const text = - 'This is an image of Mario running. This image and text was drawn on top of an existing PDF using pdf-lib!'; - const fontSize = 24; - const solarizedWhite = rgb(253 / 255, 246 / 255, 227 / 255); - const solarizedGray = rgb(101 / 255, 123 / 255, 131 / 255); - - const boxWidth = 387.5; - - const { width, height } = page1.getSize(); - const centerX = width / 2; - const centerY = height / 2; - page1.drawImage(smallMarioImage, { - ...smallMarioDims, - x: centerX - smallMarioDims.width / 2, - y: centerY - 15, - }); - page1.drawImage(smallMarioImage, { - ...smallMarioDims, - x: centerX + smallMarioDims.width / 2, - y: centerY, - rotate: degrees(180), - xSkew: degrees(35), - ySkew: degrees(35), - }); - const boxHeight = (fontSize + 5) * 3; - page1.drawRectangle({ - x: centerX - boxWidth / 2 - 5, - y: centerY - 60 - boxHeight + fontSize + 3, - width: boxWidth + 10, - height: boxHeight, - color: solarizedWhite, - borderColor: solarizedGray, - borderWidth: 3, - rotate: degrees(10), - ySkew: degrees(15), - }); - page1.setFont(nunitoLigaFont); - page1.setFontColor(solarizedGray); - page1.drawText(text, { - x: centerX - boxWidth / 2 + 5, - y: centerY - 60, - rotate: degrees(10), - ySkew: degrees(15), - maxWidth: boxWidth + 5, - }); - - page1.setSize(page1.getWidth() + 100, page1.getHeight() + 100); - page1.translateContent(100, 100); - - page1.setFont(nunitoLigaFont); - page1.drawText('This text is shifted - fi', { - color: rgb(1, 0, 0), - size: 50, - }); - page1.resetPosition(); - page1.setFont(nunitoNoLigaFont); - page1.drawText('This text is not shifted - fi', { - color: rgb(0, 0, 1), - size: 50, - }); - - // Add page with CropBox - const pdfDocWithCropBox = await PDFDocument.load(pdfs.with_cropbox); - const [page2] = await pdfDoc.copyPages(pdfDocWithCropBox, [0]); - pdfDoc.addPage(page2); - - page2.drawRectangle({ - x: page2.getWidth(), - width: 50, - height: page2.getHeight(), - color: rgb(1, 0, 0), - }); - page2.drawRectangle({ - y: page2.getHeight(), - height: 50, - width: page2.getWidth(), - color: rgb(0, 1, 0), - }); - page2.setSize(page2.getWidth() + 50, page2.getHeight() + 50); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test7.ts b/apps/deno/tests/test7.ts deleted file mode 100644 index 226436602..000000000 --- a/apps/deno/tests/test7.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - degrees, - ParseSpeeds, - PDFDocument, - StandardFonts, -} from '../../../dist/pdf-lib.esm.js'; - -const createDonorPdf = async () => { - const pdfDoc = await PDFDocument.create(); - const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica); - - const page = pdfDoc.addPage([500, 500]); - - page.moveTo(50, 225); - page.setFont(helveticaFont); - page.setFontSize(50); - page.drawText('I am upside down!'); - page.setRotation(degrees(180)); - - return pdfDoc; -}; - -export default async (assets: Assets) => { - const { pdfs } = assets; - - const pdfDoc = await PDFDocument.load( - pdfs.with_missing_endstream_eol_and_polluted_ctm, - { parseSpeed: ParseSpeeds.Fastest }, - ); - - const allDonorPdfBytes: Uint8Array[] = [ - assets.pdfs.normal, - assets.pdfs.with_update_sections, - assets.pdfs.linearized_with_object_streams, - assets.pdfs.with_large_page_count, - ]; - - for (let idx = 0, len = allDonorPdfBytes.length; idx < len; idx++) { - const donorBytes = allDonorPdfBytes[idx]; - const donorPdf = await PDFDocument.load(donorBytes); - const [donorPage] = await pdfDoc.copyPages(donorPdf, [0]); - pdfDoc.addPage(donorPage); - } - - const anotherDonorPdf = await createDonorPdf(); - const [anotherDonorPage] = await pdfDoc.copyPages(anotherDonorPdf, [0]); - pdfDoc.insertPage(1, anotherDonorPage); - - const savedBytes = await pdfDoc.save(); - const sizeOfCreatedPdf = savedBytes.length; - - let sizeOfAllDonorPdfs = (await anotherDonorPdf.save()).length; - for (let idx = 0, len = allDonorPdfBytes.length; idx < len; idx++) { - sizeOfAllDonorPdfs += allDonorPdfBytes[idx].length; - } - - console.log(); - console.log( - 'Since pdf-lib only copies the minimum necessary resources from a donor PDF needed to show a copied page, the size of the PDF we create from copied pages should be smaller than the size of all the donor PDFs added together:', - ); - console.log(); - console.log( - ' sizeOfRecipientPdf / sizeOfAllDonorPdfs = ', - (sizeOfCreatedPdf / sizeOfAllDonorPdfs).toFixed(2), - ); - - return savedBytes; -}; diff --git a/apps/deno/tests/test8.ts b/apps/deno/tests/test8.ts deleted file mode 100644 index edb4a8188..000000000 --- a/apps/deno/tests/test8.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - ParseSpeeds, - PDFDocument, - PDFPage, - rgb, - StandardFonts, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs } = assets; - - const pdfDoc = await PDFDocument.load( - pdfs.with_newline_whitespace_in_indirect_object_numbers, - { parseSpeed: ParseSpeeds.Fastest }, - ); - - const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica); - - const pages = pdfDoc.getPages(); - - const [firstPage] = pages; - - const { width, height } = firstPage.getSize(); - const text = 'pdf-lib is awesome!'; - const textWidth = helveticaFont.widthOfTextAtSize(text, 75); - firstPage.moveTo(width / 2 - textWidth / 2, height - 100); - firstPage.setFont(helveticaFont); - firstPage.setFontSize(75); - firstPage.setFontColor(rgb(1, 0, 0)); - firstPage.drawText(text); - - pages.forEach((page: PDFPage, idx: number) => { - page.moveTo(10, 10); - page.setFont(helveticaFont); - page.setFontSize(17); - page.setFontColor(rgb(1, 0, 0)); - page.drawText(`${idx + 1} / ${pages.length}`); - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/deno/tests/test9.ts b/apps/deno/tests/test9.ts deleted file mode 100644 index b11fc4764..000000000 --- a/apps/deno/tests/test9.ts +++ /dev/null @@ -1,69 +0,0 @@ -import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; -import { Assets } from '../index.ts'; - -// @deno-types="../dummy.d.ts" -import { - ParseSpeeds, - PDFDocument, - rgb, - PDFPage, -} from '../../../dist/pdf-lib.esm.js'; - -export default async (assets: Assets) => { - const { pdfs, fonts, images } = assets; - - const pdfDoc = await PDFDocument.load(pdfs.with_comments, { - parseSpeed: ParseSpeeds.Fastest, - }); - - pdfDoc.registerFontkit(fontkit); - - const ubuntuFont = await pdfDoc.embedFont(fonts.ttf.ubuntu_r, { - subset: true, - }); - const smallMarioImage = await pdfDoc.embedPng(images.png.small_mario); - const smallMarioDims = smallMarioImage.scale(0.15); - - const pages = pdfDoc.getPages(); - - const lines = [ - 'This is an image of Mario running.', - 'This image and text was drawn on', - 'top of an existing PDF using pdf-lib!', - ]; - const fontSize = 24; - const solarizedWhite = rgb(253 / 255, 246 / 255, 227 / 255); - const solarizedGray = rgb(101 / 255, 123 / 255, 131 / 255); - - const textWidth = ubuntuFont.widthOfTextAtSize(lines[2], fontSize); - - pages.forEach((page: PDFPage) => { - const { width, height } = page.getSize(); - const centerX = width / 2; - const centerY = height / 2 - 250; - page.drawImage(smallMarioImage, { - ...smallMarioDims, - x: centerX - smallMarioDims.width / 2, - y: centerY + 15, - }); - const boxHeight = (fontSize + 5) * lines.length; - page.drawRectangle({ - x: centerX - textWidth / 2 - 5, - y: centerY - 15 - boxHeight + fontSize + 3, - width: textWidth + 10, - height: boxHeight, - color: solarizedWhite, - borderColor: solarizedGray, - borderWidth: 3, - }); - page.setFont(ubuntuFont); - page.setFontColor(solarizedGray); - page.drawText(lines.join('\n'), { - x: centerX - textWidth / 2, - y: centerY - 15, - }); - }); - - const pdfBytes = await pdfDoc.save(); - return pdfBytes; -}; diff --git a/apps/rn/.buckconfig b/apps/rn/.buckconfig deleted file mode 100644 index 934256cb2..000000000 --- a/apps/rn/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/apps/rn/.flowconfig b/apps/rn/.flowconfig deleted file mode 100644 index 47d80d954..000000000 --- a/apps/rn/.flowconfig +++ /dev/null @@ -1,69 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js - -; Ignore polyfills -.*/Libraries/polyfills/.* - -; Ignore metro -.*/node_modules/metro/.* - -[include] - -[libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow/ - -[options] -emoji=true - -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable - -module.system=haste -module.system.haste.use_name_reducers=true -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* -module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* - -munge_underscores=true - -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' - -module.file_ext=.js -module.file_ext=.jsx -module.file_ext=.json -module.file_ext=.native.js - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FlowFixMeProps -suppress_type=$FlowFixMeState - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError - -[version] -^0.92.0 diff --git a/apps/rn/.gitattributes b/apps/rn/.gitattributes deleted file mode 100644 index d42ff1835..000000000 --- a/apps/rn/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/apps/rn/.gitignore b/apps/rn/.gitignore deleted file mode 100644 index 5d647565f..000000000 --- a/apps/rn/.gitignore +++ /dev/null @@ -1,56 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# BUCK -buck-out/ -\.buckd/ -*.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/ - -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots - -# Bundle artifact -*.jsbundle diff --git a/apps/rn/.watchmanconfig b/apps/rn/.watchmanconfig deleted file mode 100644 index 9e26dfeeb..000000000 --- a/apps/rn/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/apps/rn/__tests__/App-test.js b/apps/rn/__tests__/App-test.js deleted file mode 100644 index 178476699..000000000 --- a/apps/rn/__tests__/App-test.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @format - */ - -import 'react-native'; -import React from 'react'; -import App from '../App'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - renderer.create(); -}); diff --git a/apps/rn/android/app/BUCK b/apps/rn/android/app/BUCK deleted file mode 100644 index ec9a8929d..000000000 --- a/apps/rn/android/app/BUCK +++ /dev/null @@ -1,55 +0,0 @@ -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") - -lib_deps = [] - -create_aar_targets(glob(["libs/*.aar"])) - -create_jar_targets(glob(["libs/*.jar"])) - -android_library( - name = "all-libs", - exported_deps = lib_deps, -) - -android_library( - name = "app-code", - srcs = glob([ - "src/main/java/**/*.java", - ]), - deps = [ - ":all-libs", - ":build_config", - ":res", - ], -) - -android_build_config( - name = "build_config", - package = "com.pdflibtester", -) - -android_resource( - name = "res", - package = "com.pdflibtester", - res = "src/main/res", -) - -android_binary( - name = "app", - keystore = "//android/keystores:debug", - manifest = "src/main/AndroidManifest.xml", - package_type = "debug", - deps = [ - ":app-code", - ], -) diff --git a/apps/rn/android/app/build.gradle b/apps/rn/android/app/build.gradle deleted file mode 100644 index df2dc201b..000000000 --- a/apps/rn/android/app/build.gradle +++ /dev/null @@ -1,177 +0,0 @@ -apply plugin: "com.android.application" - -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation - * entryFile: "index.android.js", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // whether to disable dev mode in custom build variants (by default only disabled in release) - * // for example: to disable dev mode in the staging build type (if configured) - * devDisabledInStaging: true, - * // The configuration property can be in the following formats - * // 'devDisabledIn${productFlavor}${buildType}' - * // 'devDisabledIn${buildType}' - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"], - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - -project.ext.react = [ - entryFile: "index.js" -] - -apply from: "../../node_modules/react-native/react.gradle" - -/** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. - */ -def enableSeparateBuildPerCPUArchitecture = false - -/** - * Run Proguard to shrink the Java bytecode in release builds. - */ -def enableProguardInReleaseBuilds = false - -android { - packagingOptions { - pickFirst 'lib/x86/libc++_shared.so' - pickFirst 'lib/x86_64/libjsc.so' - pickFirst 'lib/arm64-v8a/libjsc.so' - pickFirst 'lib/arm64-v8a/libc++_shared.so' - pickFirst 'lib/x86_64/libc++_shared.so' - pickFirst 'lib/armeabi-v7a/libc++_shared.so' - } - - compileSdkVersion rootProject.ext.compileSdkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - applicationId "com.pdflibtester" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - } - signingConfigs { - release { - String userHome = System.getProperty('user.home') - String debugKeystorePath = 'keystores/debug.keystore.properties' - - Properties debugKeystore = new Properties(); - debugKeystore.load(project.rootProject.file(debugKeystorePath).newDataInputStream()) - - storeFile file("${userHome}/.android/${debugKeystore.getProperty('key.store')}") - storePassword debugKeystore.getProperty('key.store.password') - keyAlias debugKeystore.getProperty('key.alias') - keyPassword debugKeystore.getProperty('key.alias.password') - } - } - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" - } - } - buildTypes { - release { - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - signingConfig signingConfigs.release - } - } - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode - } - } - } -} - -dependencies { - implementation project(':react-native-pdf') - implementation project(':rn-fetch-blob') - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - implementation "com.facebook.react:react-native:+" // From node_modules -} - -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} diff --git a/apps/rn/android/app/build_defs.bzl b/apps/rn/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d..000000000 --- a/apps/rn/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/apps/rn/android/app/proguard-rules.pro b/apps/rn/android/app/proguard-rules.pro deleted file mode 100644 index a92fa177e..000000000 --- a/apps/rn/android/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/apps/rn/android/app/src/debug/AndroidManifest.xml b/apps/rn/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index fa26aa56e..000000000 --- a/apps/rn/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/apps/rn/android/app/src/main/AndroidManifest.xml b/apps/rn/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index fce2b4184..000000000 --- a/apps/rn/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/apps/rn/android/app/src/main/java/com/pdflibtester/MainActivity.java b/apps/rn/android/app/src/main/java/com/pdflibtester/MainActivity.java deleted file mode 100644 index e3fd713ae..000000000 --- a/apps/rn/android/app/src/main/java/com/pdflibtester/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.pdflibtester; - -import com.facebook.react.ReactActivity; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "PdfLibTester"; - } -} diff --git a/apps/rn/android/app/src/main/java/com/pdflibtester/MainApplication.java b/apps/rn/android/app/src/main/java/com/pdflibtester/MainApplication.java deleted file mode 100644 index 615205571..000000000 --- a/apps/rn/android/app/src/main/java/com/pdflibtester/MainApplication.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pdflibtester; - -import android.app.Application; - -import com.facebook.react.ReactApplication; -import org.wonday.pdf.RCTPdfView; -import com.RNFetchBlob.RNFetchBlobPackage; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -import java.util.Arrays; -import java.util.List; - -public class MainApplication extends Application implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new RCTPdfView(), - new RNFetchBlobPackage() - ); - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); - } -} diff --git a/apps/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a2f5908281d070150700378b64a84c7db1f97aa1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3056 zcmV(P)KhZB4W`O-$6PEY7dL@435|%iVhscI7#HXTET` zzkBaFzt27A{C?*?2n!1>p(V70me4Z57os7_P3wngt7(|N?Oyh#`(O{OZ1{A4;H+Oi zbkJV-pnX%EV7$w+V1moMaYCgzJI-a^GQPsJHL=>Zb!M$&E7r9HyP>8`*Pg_->7CeN zOX|dqbE6DBJL=}Mqt2*1e1I>(L-HP&UhjA?q1x7zSXD}D&D-Om%sC#AMr*KVk>dy;pT>Dpn#K6-YX8)fL(Q8(04+g?ah97XT2i$m2u z-*XXz7%$`O#x&6Oolq?+sA+c; zdg7fXirTUG`+!=-QudtfOZR*6Z3~!#;X;oEv56*-B z&gIGE3os@3O)sFP?zf;Z#kt18-o>IeueS!=#X^8WfI@&mfI@)!F(BkYxSfC*Gb*AM zau9@B_4f3=m1I71l8mRD>8A(lNb6V#dCpSKW%TT@VIMvFvz!K$oN1v#E@%Fp3O_sQ zmbSM-`}i8WCzSyPl?NqS^NqOYg4+tXT52ItLoTA;4mfx3-lev-HadLiA}!)%PwV)f zumi|*v}_P;*hk9-c*ibZqBd_ixhLQA+Xr>akm~QJCpfoT!u5JA_l@4qgMRf+Bi(Gh zBOtYM<*PnDOA}ls-7YrTVWimdA{y^37Q#BV>2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Mr&@>4kN8MLFb4&2O9fEKaQg%(QO$4_1rVQywG^CmBLh#}_7gKW3vd?| z2?1^&KWq8}8I^_S0|)MowU_pw$q@nl@Nkn$z>BQq_KA^9yaR`(R3u{{Ig;cwt z@AJ^{ODQCm^neroM9nKNUAXi9RCK`OsP_LuR0PUR(YZCCX5dNF6VzcoK&=b^r`W?ltt|*F zpkoae%ZT{C1h~EcFui~b7fF`vb<<~j_VquuUA$}QqIKYELPp#;{u?q8Dz}WAG-(3; zjrm$i%7UbyZMM(Y{>!uJ#vNB?R~B{6Htp=>e*<{fQQ5W7V(1coCWlOON!MzZxhum| ztZBQpGR z;~#ur^&PockKdV{Q6R>o`Pl{0x!DEbpZ7y9Y;*ZvE!*gU`V1W3znva{f=?WO5I&>B z&hw6}tjECtaghm5z|C#%M;Yf_*pI^};h}Vl=^r9EN=tVDj86D;C$jIJ?K7VP+00000NkvXXu0mjf D5i!M* diff --git a/apps/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/apps/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 459ca609d3ae0d3943ab44cdc27feef9256dc6d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7098 zcmV;r8%5-aP)U(QdAI7f)tS=AhH53iU?Q%B}x&gA$2B`o|*LCD1jhW zSQpS0{*?u3iXtkY?&2<)$@#zc%$?qDlF1T~d7k&lWaiv^&wbx>zVm(GIrof<%iY)A zm%|rhEg~Z$Te<*wd9Cb1SB{RkOI$-=MBtc%k*xtvYC~Uito}R@3fRUqJvco z|Bt2r9pSOcJocAEd)UN^Tz-82GUZlqsU;wb|2Q_1!4Rms&HO1Xyquft~#6lJoR z`$|}VSy@{k6U652FJ~bnD9(X%>CS6Wp6U>sn;f}te}%WL`rg)qE4Q=4OOhk^@ykw( ziKr^LHnAd4M?#&SQhw8zaC05q#Mc66K^mxY!dZ=W+#Bq1B}cQ6Y8FWd(n>#%{8Di_8$CHibtvP z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O%DdQj-T(jq07*qoM6N<$f+5oB`~Uy| diff --git a/apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 8ca12fe024be86e868d14e91120a6902f8e88ac6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6464 zcma)BcR1WZxBl%e)~?{d=GL+&^aKnR?F5^S)H60AiZ4#Zw z<{%@_?XtN*4^Ysr4x}4T^65=zoh0oG>c$Zd1_pX6`i0v}uO|-eB%Q>N^ZQB&#m?tGlYwAcTcjWKhWpN*8Y^z}bpUe!vvcHEUBJgNGK%eQ7S zhw2AoGgwo(_hfBFVRxjN`6%=xzloqs)mKWPrm-faQ&#&tk^eX$WPcm-MNC>-{;_L% z0Jg#L7aw?C*LB0?_s+&330gN5n#G}+dQKW6E7x7oah`krn8p`}BEYImc@?)2KR>sX{@J2`9_`;EMqVM;E7 zM^Nq2M2@Ar`m389gX&t}L90)~SGI8us3tMfYX5};G>SN0A%5fOQLG#PPFJYkJHb1AEB+-$fL!Bd}q*2UB9O6tebS&4I)AHoUFS6a0* zc!_!c#7&?E>%TorPH_y|o9nwb*llir-x$3!^g6R>>Q>K7ACvf%;U5oX>e#-@UpPw1ttpskGPCiy-8# z9;&H8tgeknVpz>p*#TzNZQ1iL9rQenM3(5?rr(4U^UU z#ZlsmgBM9j5@V-B83P3|EhsyhgQ77EsG%NO5A6iB2H; zZ1qN35-DS^?&>n1IF?bU|LVIJ-)a3%TDI*m*gMi7SbayJG$BfYU*G+{~waS#I(h-%@?Js8EohlFK)L6r2&g ztcc$v%L)dK+Xr=`-?FuvAc@{QvVYC$Y>1$RA%NKFcE$38WkS6#MRtHdCdDG)L5@99 zmOB8Tk&uN4!2SZ@A&K>I#Y$pW5tKSmDDM|=;^itso2AsMUGb8M-UB;=iAQLVffx9~ z>9>|ibz#eT>CNXD*NxH55}uwlew*<*!HbMj&m@)MJpB3+`0S~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ih`q1*(OB8oS#B&> z;Mf*_o&W5*=YXfgFP}B@p)|WJA7X^OhD8)dnP)jzA@E=&=Ci7QzO`+_Vzsr zPWpZ3Z1>W?dNv6)H}>_%l*Di^aMXFax2)v1ZCxi4OJKTI<)yK_R>n#>Sv$LTRI8cB ziL<^H!Q&(ny#h19ximj|=3WygbFQ9j_4d8yE5}Rvb>DpH^e#I;g6}sM7nZnLmyB3# z!UenLG)cb%%--*pozd3}aX#-Nmu5ptKcp>-zcwRx9se(_2ZQsmWHU!Rgj3QRPn3UF z_sqgJ&Eb=kv+m0$9uW~j-aZ0Hq#b_2f^rS*bL}stW91HXNt0JDK~q-%62AW}++%IT zk!ZO&)BjYf)_bpTye9UB=w_-2M{YgE#ii%`l+(PHe_QjW@$o^e)A&KoW2)+!I9Ohw zDB1e=ELr`L3zwGjsfma_2>Th#A0!7;_??{~*jzt2*T6O%e3V)-7*TMGh!k050cAi2C?f}r2CHy&b8kPa2#6aI1wtOBBfiCCj?OjhctJT zF|t;&c+_-i=lhK}pNiu>8*ZFrt0rJp={`H182b$`Zb>SI(z!@Hq@<+#JSpVAzA3oc z@yEcV|MbQ+i)`%|)klTCzCj&qoC0c7g6FFgsUhcaDowSG{A=DV19LHK*M7TK?HV;a zAAvOV<(8UlC>jP4XE>(OS{6DfL B0*L?s diff --git a/apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/apps/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 8e19b410a1b15ff180f3dacac19395fe3046cdec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10676 zcmV;lDNELgP)um}xpNhCM7m0FQ}4}N1loz9~lvx)@N$zJd<6*u{W9aHJztU)8d8y;?3WdPz&A7QJeFUv+{E$_OFb457DPov zKYK{O^DFs{ApSuA{FLNz6?vik@>8e5x#1eBfU?k4&SP;lt`%BTxnkw{sDSls^$yvr#7NA*&s?gZVd_>Rv*NEb*6Zkcn zT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) zGZyIq}2>crU3z2ri)(ut%F~+%S>FR4^Xw()Y-+~&Xp*Ns z$?%1aydpzNIz2aN98}oth>3boYSifQ)J81Of>6k)!`WQWrB;xxXccBzrWe5V*>oMh zon)MEw$@-*!>L`CK}u@x^9-4gfvepI0b8q5QYVXr96{4Q#s2ZelHXxHv~G{GymRer zqyj7m)3yn3z5i4koiIJ!-u=p6QeL|BN+pWd>}TOFOVi01q839$NZ&I_quqb(n~9Wk id-{KKnnu*>l46e`&P3zgUlQEeAE2(Hqg<+p4E|raIYd(c diff --git a/apps/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/apps/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 4c19a13c239cb67b8a2134ddd5f325db1d2d5bee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15523 zcmZu&byQSev_3Py&@gnDfPjP`DLFJqiULXtibx~fLnvK>bPOP+(%nO&(%r2fA>H-( zz4z~1>*iYL?tRWZ_k8=?-?=ADTT_`3j}{LAK&YyspmTRd|F`47?v6Thw%7njTB|C^ zKKGc}$-p)u@1g1$=G5ziQhGf`pecnFHQK@{)H)R`NQF;K%92o17K-93yUfN21$b29 zQwz1oFs@r6GO|&!sP_4*_5J}y@1EmX38MLHp9O5Oe0Nc6{^^wzO4l(d z;mtZ_YZu`gPyE@_DZic*_^gGkxh<(}XliiFNpj1&`$dYO3scX$PHr^OPt}D-`w9aR z4}a$o1nmaz>bV)|i2j5($CXJ<=V0%{^_5JXJ2~-Q=5u(R41}kRaj^33P50Hg*ot1f z?w;RDqu}t{QQ%88FhO3t>0-Sy@ck7!K1c53XC+HJeY@B0BH+W}BTA1!ueRG49Clr? z+R!2Jlc`n)zZ?XWaZO0BnqvRN#k{$*;dYA4UO&o_-b>h3>@8fgSjOUsv0wVwlxy0h z{E1|}P_3K!kMbGZt_qQIF~jd+Km4P8D0dwO{+jQ1;}@_Weti;`V}a_?BkaNJA?PXD z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`g>sbCTvU_xdid!{9gWA|>Mfs6rtHx6s` z_wMt*FgUTBZ@I2C62&zbs?pPvK9TpatkXzqDqe4YTr^nnQg8gWxjKt*s&eOMEp!Qc zG~PT`>xg76Xqh^dKI-Eu#K*VnvEf9qT{L0yNpVj)eVD#kQzGgVRbTB!5nWY=?t!cggiEGBAcWM2xNtW&9 zZB_6RZ}|a87CuEYRYCRJ`Sg+_gBK$_J@*zoWcJJw>eBw?G9WY(Jw~qN|A3MBR^~jm?>k5oGv7z+0jWOox(co@%nya|* zE-2peyX)#@svgwwDMPJ89dT=iO>}@wtNR@NUQ|cJZ};sX(w2uWP4AE5)@A ziJgy_TIZ+T&vG&xPh@Jmt!OJ|zA6C0ZxfF2 z7>aIZqecbmM$lyvDMwg2?Ipo9b)-WL6K_7(X_rmJgdd$-Qc^ywEw4SThChz6*_yu= z{v~a4V|RJtH-GThc2C0Z|JHPl{II-!?B~7cWnRz&dgP*UqoY!iCo&i-xeM}kl?ID* zKTX`w+;z0+MCdGcl{N?xb|tYb%Id=k++k_@(V%bTS&n09`0{S0)|>IH_F;V@_zrxS-dKDDc7+i`nHN8J z;38w69lzAS*WWa+dnVvk(0-KD3%*)TerLH zSCc}Tjc-mR5|1HAL$C1}oue|Qp&M!hmyDUcg)Cz>GXPEyeYf}+s48kIl*pL{{treP BIP(Ai diff --git a/apps/rn/android/app/src/main/res/values/strings.xml b/apps/rn/android/app/src/main/res/values/strings.xml deleted file mode 100644 index baa67c969..000000000 --- a/apps/rn/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - PdfLibTester - diff --git a/apps/rn/android/app/src/main/res/values/styles.xml b/apps/rn/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 319eb0ca1..000000000 --- a/apps/rn/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/apps/rn/android/build.gradle b/apps/rn/android/build.gradle deleted file mode 100644 index 3a1d305e5..000000000 --- a/apps/rn/android/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext { - buildToolsVersion = "28.0.3" - minSdkVersion = 16 - compileSdkVersion = 28 - targetSdkVersion = 28 - supportLibVersion = "28.0.0" - } - repositories { - google() - jcenter() - } - dependencies { - classpath("com.android.tools.build:gradle:3.4.0") - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - mavenLocal() - google() - jcenter() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url "$rootDir/../node_modules/react-native/android" - } - } -} diff --git a/apps/rn/android/gradle.properties b/apps/rn/android/gradle.properties deleted file mode 100644 index 89e0d99e2..000000000 --- a/apps/rn/android/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true diff --git a/apps/rn/android/gradle/wrapper/gradle-wrapper.jar b/apps/rn/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 5c2d1cf016b3885f6930543d57b744ea8c220a1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 55616 zcmafaW0WS*vSoFbZJS-TZP!<}ZQEV8ZQHihW!tvx>6!c9%-lQoy;&DmfdT@8fB*sl68LLCKtKQ283+jS?^Q-bNq|NIAW8=eB==8_)^)r*{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U>R;no+S%)xoBuBxRw$?weN-u~tKE}8xb@7Gs%(aC;e1-LIlSfXDK(faFW)mnHdrLc3`F z6ZBsT^u0uVS&il=>YVX^*5`k!P4g1)2LQmz{?&dgf`7JrA4ZeE0sikL`k!Eb6r=g0 z{aCy_0I>fxSAXQYz3lw5G|ivg^L@(x-uch!AphH+d;E4`175`R0#b^)Zp>EM1Ks=zx6_261>!7 z{7F#a{Tl@Tpw9S`>7_i|PbScS-(dPJv9_0-FBP_aa@Gg^2IoKNZM~#=sW$SH3MJ|{ zsQy8F43lX7hYx<{v^Q9`2QsMzeen3cGpiTgzVp- z`aj3&Wv0(he1qKI!2jpGpO-i0Wpcz%vdn`2o9x&3;^nsZPt3c \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/apps/rn/android/gradlew.bat b/apps/rn/android/gradlew.bat deleted file mode 100644 index 15e1ee37a..000000000 --- a/apps/rn/android/gradlew.bat +++ /dev/null @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/rn/android/keystores/BUCK b/apps/rn/android/keystores/BUCK deleted file mode 100644 index 88e4c31b2..000000000 --- a/apps/rn/android/keystores/BUCK +++ /dev/null @@ -1,8 +0,0 @@ -keystore( - name = "debug", - properties = "debug.keystore.properties", - store = "debug.keystore", - visibility = [ - "PUBLIC", - ], -) diff --git a/apps/rn/android/keystores/debug.keystore.properties b/apps/rn/android/keystores/debug.keystore.properties deleted file mode 100644 index 121bfb49f..000000000 --- a/apps/rn/android/keystores/debug.keystore.properties +++ /dev/null @@ -1,4 +0,0 @@ -key.store=debug.keystore -key.alias=androiddebugkey -key.store.password=android -key.alias.password=android diff --git a/apps/rn/android/settings.gradle b/apps/rn/android/settings.gradle deleted file mode 100644 index 568eb2bc3..000000000 --- a/apps/rn/android/settings.gradle +++ /dev/null @@ -1,7 +0,0 @@ -rootProject.name = 'PdfLibTester' -include ':react-native-pdf' -project(':react-native-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf/android') -include ':rn-fetch-blob' -project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android') - -include ':app' diff --git a/apps/rn/app.json b/apps/rn/app.json deleted file mode 100644 index a88fc035c..000000000 --- a/apps/rn/app.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "PdfLibTester", - "displayName": "PdfLibTester" -} diff --git a/apps/rn/babel.config.js b/apps/rn/babel.config.js deleted file mode 100644 index f842b77fc..000000000 --- a/apps/rn/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: ['module:metro-react-native-babel-preset'], -}; diff --git a/apps/rn/index.js b/apps/rn/index.js deleted file mode 100644 index b85eba344..000000000 --- a/apps/rn/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @format - */ - -import { AppRegistry } from 'react-native'; -import App from './src/components/App'; -import { name as appName } from './app.json'; - -AppRegistry.registerComponent(appName, () => App); diff --git a/apps/rn/ios/PdfLibTester-tvOS/Info.plist b/apps/rn/ios/PdfLibTester-tvOS/Info.plist deleted file mode 100644 index 2fb6a11c2..000000000 --- a/apps/rn/ios/PdfLibTester-tvOS/Info.plist +++ /dev/null @@ -1,54 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSLocationWhenInUseUsageDescription - - NSAppTransportSecurity - - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - - diff --git a/apps/rn/ios/PdfLibTester-tvOSTests/Info.plist b/apps/rn/ios/PdfLibTester-tvOSTests/Info.plist deleted file mode 100644 index 886825ccc..000000000 --- a/apps/rn/ios/PdfLibTester-tvOSTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/apps/rn/ios/PdfLibTester.xcodeproj/project.pbxproj b/apps/rn/ios/PdfLibTester.xcodeproj/project.pbxproj deleted file mode 100644 index 3a378cfdf..000000000 --- a/apps/rn/ios/PdfLibTester.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1639 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* PdfLibTesterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* PdfLibTesterTests.m */; }; - 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; }; - 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; }; - 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; }; - 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; }; - 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; }; - 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; }; - 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; }; - 2DCD954D1E0B4F2C00145EB5 /* PdfLibTesterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* PdfLibTesterTests.m */; }; - 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; - 48A1A3C939D14F92B8708F2B /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 243A6B60B39D4BA1AE928771 /* libRNFetchBlob.a */; }; - 65777D80A2FE4E9E8C311A76 /* libRCTPdf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C884F98E98846AEB3C1B7B7 /* libRCTPdf.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; - ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; - ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = PdfLibTester; - }; - 07F41968234D797900C9EDC3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EDEBC6D6214B3E7000DD5AC8; - remoteInfo = jsi; - }; - 07F4196A234D797900C9EDC3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EDEBC73B214B45A300DD5AC8; - remoteInfo = jsiexecutor; - }; - 07F4196C234D797900C9EDC3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ED296FB6214C9A0900B7C4FE; - remoteInfo = "jsi-tvOS"; - }; - 07F4196E234D797900C9EDC3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ED296FEE214C9CF800B7C4FE; - remoteInfo = "jsiexecutor-tvOS"; - }; - 07F41978234D797B00C9EDC3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 39797CBB331C4C5E888FEC5F /* RNFetchBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = A15C300E1CD25C330074CB35; - remoteInfo = RNFetchBlob; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; - remoteInfo = "PdfLibTester-tvOS"; - }; - 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = ADD01A681E09402E00F6D226; - remoteInfo = "RCTBlob-tvOS"; - }; - 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3DBE0D001F3B181A0099AA32; - remoteInfo = fishhook; - }; - 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32; - remoteInfo = "fishhook-tvOS"; - }; - 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EBF21BDC1FC498900052F4D5; - remoteInfo = jsinspector; - }; - 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5; - remoteInfo = "jsinspector-tvOS"; - }; - 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; - remoteInfo = "third-party"; - }; - 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D383D3C1EBD27B6005632C8; - remoteInfo = "third-party-tvOS"; - }; - 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 139D7E881E25C6D100323FB7; - remoteInfo = "double-conversion"; - }; - 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D383D621EBD27B9005632C8; - remoteInfo = "double-conversion-tvOS"; - }; - 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; - remoteInfo = "RCTImage-tvOS"; - }; - 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28471D9B043800D4039D; - remoteInfo = "RCTLinking-tvOS"; - }; - 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28541D9B044C00D4039D; - remoteInfo = "RCTNetwork-tvOS"; - }; - 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28611D9B046600D4039D; - remoteInfo = "RCTSettings-tvOS"; - }; - 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A287B1D9B048500D4039D; - remoteInfo = "RCTText-tvOS"; - }; - 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28881D9B049200D4039D; - remoteInfo = "RCTWebSocket-tvOS"; - }; - 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "React-tvOS"; - }; - 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C059A1DE3340900C268FA; - remoteInfo = yoga; - }; - 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C06751DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; - ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 358F4ED71D1E81A9004DF814; - remoteInfo = RCTBlob; - }; - CE9D30D524703CC7004B61E4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5093D995909945DC90C86A24 /* RCTPdf.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 20D8E03F1C8E946C00039823; - remoteInfo = RCTPdf; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* PdfLibTesterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PdfLibTesterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* PdfLibTesterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PdfLibTesterTests.m; sourceTree = ""; }; - 0C884F98E98846AEB3C1B7B7 /* libRCTPdf.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTPdf.a; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* PdfLibTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PdfLibTester.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = PdfLibTester/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = PdfLibTester/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = PdfLibTester/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = PdfLibTester/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = PdfLibTester/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 243A6B60B39D4BA1AE928771 /* libRNFetchBlob.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFetchBlob.a; sourceTree = ""; }; - 2D02E47B1E0B4A5D006451C7 /* PdfLibTester-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PdfLibTester-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D02E4901E0B4A5D006451C7 /* PdfLibTester-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "PdfLibTester-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 39797CBB331C4C5E888FEC5F /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/rn-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; }; - 5093D995909945DC90C86A24 /* RCTPdf.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTPdf.xcodeproj; path = "../node_modules/react-native-pdf/ios/RCTPdf.xcodeproj"; sourceTree = ""; }; - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; - ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; - ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, - ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, - 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */, - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - 48A1A3C939D14F92B8708F2B /* libRNFetchBlob.a in Frameworks */, - 65777D80A2FE4E9E8C311A76 /* libRCTPdf.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */, - 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */, - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */, - 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */, - 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */, - 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */, - 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */, - 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */, - 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* PdfLibTesterTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* PdfLibTesterTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = PdfLibTesterTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 07F41942234D797700C9EDC3 /* Recovered References */ = { - isa = PBXGroup; - children = ( - 243A6B60B39D4BA1AE928771 /* libRNFetchBlob.a */, - 0C884F98E98846AEB3C1B7B7 /* libRCTPdf.a */, - ); - name = "Recovered References"; - sourceTree = ""; - }; - 07F41972234D797B00C9EDC3 /* Products */ = { - isa = PBXGroup; - children = ( - 07F41979234D797B00C9EDC3 /* libRNFetchBlob.a */, - ); - name = Products; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, - 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */, - 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* PdfLibTester */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = PdfLibTester; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - 3DAD3EA31DF850E9000B6D8A /* libReact.a */, - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, - 2DF0FFDF2056DD460020B375 /* libjsinspector.a */, - 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */, - 2DF0FFE32056DD460020B375 /* libthird-party.a */, - 2DF0FFE52056DD460020B375 /* libthird-party.a */, - 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */, - 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */, - 07F41969234D797900C9EDC3 /* libjsi.a */, - 07F4196B234D797900C9EDC3 /* libjsiexecutor.a */, - 07F4196D234D797900C9EDC3 /* libjsi-tvOS.a */, - 07F4196F234D797900C9EDC3 /* libjsiexecutor-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { - isa = PBXGroup; - children = ( - ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - ED2971642150620600B7C4FE /* JavaScriptCore.framework */, - 2D16E6891FA4F8E400B85C8A /* libReact.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { - isa = PBXGroup; - children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - 39797CBB331C4C5E888FEC5F /* RNFetchBlob.xcodeproj */, - 5093D995909945DC90C86A24 /* RCTPdf.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* PdfLibTester */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* PdfLibTesterTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - 2D16E6871FA4F8E400B85C8A /* Frameworks */, - 07F41942234D797700C9EDC3 /* Recovered References */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* PdfLibTester.app */, - 00E356EE1AD99517003FC87E /* PdfLibTesterTests.xctest */, - 2D02E47B1E0B4A5D006451C7 /* PdfLibTester-tvOS.app */, - 2D02E4901E0B4A5D006451C7 /* PdfLibTester-tvOSTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - ADBDB9201DFEBF0600ED6528 /* Products */ = { - isa = PBXGroup; - children = ( - ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */, - 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - CE9D30D224703CC7004B61E4 /* Products */ = { - isa = PBXGroup; - children = ( - CE9D30D624703CC7004B61E4 /* libRCTPdf.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* PdfLibTesterTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "PdfLibTesterTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = PdfLibTesterTests; - productName = PdfLibTesterTests; - productReference = 00E356EE1AD99517003FC87E /* PdfLibTesterTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* PdfLibTester */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "PdfLibTester" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PdfLibTester; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* PdfLibTester.app */; - productType = "com.apple.product-type.application"; - }; - 2D02E47A1E0B4A5D006451C7 /* PdfLibTester-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "PdfLibTester-tvOS" */; - buildPhases = ( - 2D02E4771E0B4A5D006451C7 /* Sources */, - 2D02E4781E0B4A5D006451C7 /* Frameworks */, - 2D02E4791E0B4A5D006451C7 /* Resources */, - 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "PdfLibTester-tvOS"; - productName = "PdfLibTester-tvOS"; - productReference = 2D02E47B1E0B4A5D006451C7 /* PdfLibTester-tvOS.app */; - productType = "com.apple.product-type.application"; - }; - 2D02E48F1E0B4A5D006451C7 /* PdfLibTester-tvOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "PdfLibTester-tvOSTests" */; - buildPhases = ( - 2D02E48C1E0B4A5D006451C7 /* Sources */, - 2D02E48D1E0B4A5D006451C7 /* Frameworks */, - 2D02E48E1E0B4A5D006451C7 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, - ); - name = "PdfLibTester-tvOSTests"; - productName = "PdfLibTester-tvOSTests"; - productReference = 2D02E4901E0B4A5D006451C7 /* PdfLibTester-tvOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - 2D02E47A1E0B4A5D006451C7 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 2D02E48F1E0B4A5D006451C7 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 2D02E47A1E0B4A5D006451C7; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "PdfLibTester" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; - ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */; - ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = CE9D30D224703CC7004B61E4 /* Products */; - ProjectRef = 5093D995909945DC90C86A24 /* RCTPdf.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - { - ProductGroup = 07F41972234D797B00C9EDC3 /* Products */; - ProjectRef = 39797CBB331C4C5E888FEC5F /* RNFetchBlob.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* PdfLibTester */, - 00E356ED1AD99517003FC87E /* PdfLibTesterTests */, - 2D02E47A1E0B4A5D006451C7 /* PdfLibTester-tvOS */, - 2D02E48F1E0B4A5D006451C7 /* PdfLibTester-tvOSTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 07F41969234D797900C9EDC3 /* libjsi.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsi.a; - remoteRef = 07F41968234D797900C9EDC3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 07F4196B234D797900C9EDC3 /* libjsiexecutor.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsiexecutor.a; - remoteRef = 07F4196A234D797900C9EDC3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 07F4196D234D797900C9EDC3 /* libjsi-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsi-tvOS.a"; - remoteRef = 07F4196C234D797900C9EDC3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 07F4196F234D797900C9EDC3 /* libjsiexecutor-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsiexecutor-tvOS.a"; - remoteRef = 07F4196E234D797900C9EDC3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 07F41979234D797B00C9EDC3 /* libRNFetchBlob.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRNFetchBlob.a; - remoteRef = 07F41978234D797B00C9EDC3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTBlob-tvOS.a"; - remoteRef = 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libfishhook.a; - remoteRef = 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libfishhook-tvOS.a"; - remoteRef = 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFDF2056DD460020B375 /* libjsinspector.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjsinspector.a; - remoteRef = 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libjsinspector-tvOS.a"; - remoteRef = 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFE32056DD460020B375 /* libthird-party.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFE52056DD460020B375 /* libthird-party.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libdouble-conversion.a"; - remoteRef = 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libdouble-conversion.a"; - remoteRef = 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTImage-tvOS.a"; - remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-tvOS.a"; - remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTNetwork-tvOS.a"; - remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-tvOS.a"; - remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTText-tvOS.a"; - remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTWebSocket-tvOS.a"; - remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTBlob.a; - remoteRef = ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - CE9D30D624703CC7004B61E4 /* libRCTPdf.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTPdf.a; - remoteRef = CE9D30D524703CC7004B61E4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E4791E0B4A5D006451C7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48E1E0B4A5D006451C7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; - }; - 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native Code And Images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* PdfLibTesterTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E4771E0B4A5D006451C7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, - 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48C1E0B4A5D006451C7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DCD954D1E0B4F2C00145EB5 /* PdfLibTesterTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* PdfLibTester */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; - 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 2D02E47A1E0B4A5D006451C7 /* PdfLibTester-tvOS */; - targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = PdfLibTester; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = PdfLibTesterTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PdfLibTester.app/PdfLibTester"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = PdfLibTesterTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PdfLibTester.app/PdfLibTester"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = PdfLibTester/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = PdfLibTester; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = PdfLibTester/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = PdfLibTester; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 2D02E4971E0B4A5E006451C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = "PdfLibTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.PdfLibTester-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D02E4981E0B4A5E006451C7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = "PdfLibTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.PdfLibTester-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 2D02E4991E0B4A5E006451C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = "PdfLibTester-tvOSTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.PdfLibTester-tvOSTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PdfLibTester-tvOS.app/PdfLibTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 10.1; - }; - name = Debug; - }; - 2D02E49A1E0B4A5E006451C7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", - "$(SRCROOT)/../node_modules/react-native-pdf/ios/RCTPdf/**", - ); - INFOPLIST_FILE = "PdfLibTester-tvOSTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.PdfLibTester-tvOSTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PdfLibTester-tvOS.app/PdfLibTester-tvOS"; - TVOS_DEPLOYMENT_TARGET = 10.1; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "PdfLibTesterTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "PdfLibTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "PdfLibTester-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D02E4971E0B4A5E006451C7 /* Debug */, - 2D02E4981E0B4A5E006451C7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "PdfLibTester-tvOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D02E4991E0B4A5E006451C7 /* Debug */, - 2D02E49A1E0B4A5E006451C7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "PdfLibTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester-tvOS.xcscheme b/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester-tvOS.xcscheme deleted file mode 100644 index 7e34416fb..000000000 --- a/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester-tvOS.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester.xcscheme b/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester.xcscheme deleted file mode 100644 index de4e8753d..000000000 --- a/apps/rn/ios/PdfLibTester.xcodeproj/xcshareddata/xcschemes/PdfLibTester.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/rn/ios/PdfLibTester/AppDelegate.h b/apps/rn/ios/PdfLibTester/AppDelegate.h deleted file mode 100644 index 2726d5e13..000000000 --- a/apps/rn/ios/PdfLibTester/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; - -@end diff --git a/apps/rn/ios/PdfLibTester/AppDelegate.m b/apps/rn/ios/PdfLibTester/AppDelegate.m deleted file mode 100644 index 97d89b380..000000000 --- a/apps/rn/ios/PdfLibTester/AppDelegate.m +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "AppDelegate.h" - -#import -#import -#import - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge - moduleName:@"PdfLibTester" - initialProperties:nil]; - - rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - return YES; -} - -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ -#if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; -#else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -#endif -} - -@end diff --git a/apps/rn/ios/PdfLibTester/Base.lproj/LaunchScreen.xib b/apps/rn/ios/PdfLibTester/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 4aa1ea1f9..000000000 --- a/apps/rn/ios/PdfLibTester/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/rn/ios/PdfLibTester/Images.xcassets/AppIcon.appiconset/Contents.json b/apps/rn/ios/PdfLibTester/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 48e64ae8a..000000000 --- a/apps/rn/ios/PdfLibTester/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images": [ - { - "idiom": "iphone", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "29x29", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "3x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} diff --git a/apps/rn/ios/PdfLibTester/Images.xcassets/Contents.json b/apps/rn/ios/PdfLibTester/Images.xcassets/Contents.json deleted file mode 100644 index 97a8662eb..000000000 --- a/apps/rn/ios/PdfLibTester/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info": { - "version": 1, - "author": "xcode" - } -} diff --git a/apps/rn/ios/PdfLibTester/Info.plist b/apps/rn/ios/PdfLibTester/Info.plist deleted file mode 100644 index 59a15c354..000000000 --- a/apps/rn/ios/PdfLibTester/Info.plist +++ /dev/null @@ -1,60 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - PdfLibTester - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSLocationWhenInUseUsageDescription - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSLocationWhenInUseUsageDescription - - NSAppTransportSecurity - - - NSAllowsArbitraryLoads - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - - diff --git a/apps/rn/ios/PdfLibTester/main.m b/apps/rn/ios/PdfLibTester/main.m deleted file mode 100644 index c316cf816..000000000 --- a/apps/rn/ios/PdfLibTester/main.m +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/apps/rn/ios/PdfLibTesterTests/Info.plist b/apps/rn/ios/PdfLibTesterTests/Info.plist deleted file mode 100644 index ba72822e8..000000000 --- a/apps/rn/ios/PdfLibTesterTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/apps/rn/ios/PdfLibTesterTests/PdfLibTesterTests.m b/apps/rn/ios/PdfLibTesterTests/PdfLibTesterTests.m deleted file mode 100644 index a53638c2c..000000000 --- a/apps/rn/ios/PdfLibTesterTests/PdfLibTesterTests.m +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import -#import - -#define TIMEOUT_SECONDS 600 -#define TEXT_TO_LOOK_FOR @"Welcome to React Native!" - -@interface PdfLibTesterTests : XCTestCase - -@end - -@implementation PdfLibTesterTests - -- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test -{ - if (test(view)) { - return YES; - } - for (UIView *subview in [view subviews]) { - if ([self findSubviewInView:subview matching:test]) { - return YES; - } - } - return NO; -} - -- (void)testRendersWelcomeScreen -{ - UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; - BOOL foundElement = NO; - - __block NSString *redboxError = nil; - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; - } - }); - - while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; - } - - RCTSetLogFunction(RCTDefaultLogFunction); - - XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); - XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); -} - - -@end diff --git a/apps/rn/metro.config.js b/apps/rn/metro.config.js deleted file mode 100644 index 94d5eeefc..000000000 --- a/apps/rn/metro.config.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Metro configuration for React Native - * https://github.com/facebook/react-native - * - * @format - */ -module.exports = { - transformer: { - getTransformOptions: async () => ({ - transform: { - experimentalImportSupport: false, - inlineRequires: false, - }, - }), - }, -}; diff --git a/apps/rn/package.json b/apps/rn/package.json deleted file mode 100644 index 2b676a0e9..000000000 --- a/apps/rn/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "PdfLibTester", - "version": "0.0.1", - "private": true, - "scripts": { - "postinstall": "rimraf ./node_modules/pdf-lib/apps", - "start": "node node_modules/react-native/local-cli/cli.js start", - "test": "jest" - }, - "dependencies": { - "@pdf-lib/fontkit": "^0.0.4", - "pdf-lib": "./../..", - "react": "16.8.3", - "react-native": "0.59.10", - "react-native-pdf": "^6.1.1", - "rn-fetch-blob": "0.10.15" - }, - "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/runtime": "^7.5.1", - "babel-jest": "^24.8.0", - "jest": "^24.8.0", - "metro-react-native-babel-preset": "^0.55.0", - "react-test-renderer": "16.8.3", - "rimraf": "^2.6.3" - }, - "jest": { - "preset": "react-native" - } -} diff --git a/apps/rn/src/components/App.js b/apps/rn/src/components/App.js deleted file mode 100644 index 7eab4d874..000000000 --- a/apps/rn/src/components/App.js +++ /dev/null @@ -1,99 +0,0 @@ -import React, { Component } from 'react'; -import { - Platform, - StyleSheet, - Text, - View, - Dimensions, - SafeAreaView, - ActivityIndicator, -} from 'react-native'; -import PdfView from 'react-native-pdf'; - -import ErrorDisplay from './ErrorDisplay'; -import TestLauncher from './TestLauncher'; -import TestRunningSpinner from './TestRunningSpinner'; -import TestResultDisplay from './TestResultDisplay'; - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, -}); - -export default class App extends Component { - static States = { - TestLauncher: 'TestLauncher', - TestRunning: 'TestRunning', - TestDisplaying: 'TestDisplaying', - Error: 'Error', - }; - - state = { - state: App.States.TestLauncher, - }; - - handleLaunchTest = (testNumber, testLauncher) => { - const start = Date.now(); - testLauncher() - .then(({ base64Pdf }) => { - if (!base64Pdf || base64Pdf.length < 1) { - throw new Error('Missing `base64Pdf`'); - } - const end = Date.now(); - const runtimeSecs = (end - start) / 1000; - this.setState({ - runtimeSecs, - base64Pdf, - state: App.States.TestDisplaying, - }); - }) - .catch((error) => { - this.setState({ state: App.States.Error, error }); - }); - - this.setState({ testNumber }); - - // Only show the loading spinner screen for slow-running tests - setTimeout(() => { - const { state } = this.state; - if (state === App.States.TestLauncher) { - this.setState({ testNumber, state: App.States.TestRunning }); - } - }, 50); - }; - - handleDone = () => { - this.setState({ base64Pdf: undefined, state: App.States.TestLauncher }); - }; - - render() { - const { state, error, testNumber, base64Pdf, runtimeSecs } = this.state; - - if (state === App.States.TestLauncher) { - return ( - - ); - } - if (state === App.States.TestRunning) { - return ; - } - if (state === App.States.TestDisplaying) { - return ( - - ); - } - if (state === App.States.Error) { - return ; - } - } -} diff --git a/apps/rn/src/components/ErrorDisplay.js b/apps/rn/src/components/ErrorDisplay.js deleted file mode 100644 index f9706d379..000000000 --- a/apps/rn/src/components/ErrorDisplay.js +++ /dev/null @@ -1,50 +0,0 @@ -import React, { Component } from 'react'; -import { - StyleSheet, - SafeAreaView, - Text, - Button, - ScrollView, -} from 'react-native'; - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - text: { - textAlign: 'center', - fontSize: 20, - fontWeight: 'bold', - marginBottom: -50, - marginBottom: 50, - }, - stackText: { - fontSize: 15, - textAlign: 'left', - margin: 10, - }, -}); - -export default class ErrorDisplay extends Component { - render() { - const { error } = this.props; - - return ( - - - An Error Occurred: - {error instanceof Error ? ( - <> - {error.message} - {error.stack} - - ) : ( - {String(error)} - )} - - - ); - } -} diff --git a/apps/rn/src/components/TestLauncher.js b/apps/rn/src/components/TestLauncher.js deleted file mode 100644 index aa3d9fa93..000000000 --- a/apps/rn/src/components/TestLauncher.js +++ /dev/null @@ -1,100 +0,0 @@ -import React, { Component } from 'react'; -import { - StyleSheet, - SafeAreaView, - Text, - View, - Button, - Platform, - ScrollView, -} from 'react-native'; - -import test1 from '../tests/test1'; -import test2 from '../tests/test2'; -import test3 from '../tests/test3'; -import test4 from '../tests/test4'; -import test5 from '../tests/test5'; -import test6 from '../tests/test6'; -import test7 from '../tests/test7'; -import test8 from '../tests/test8'; -import test9 from '../tests/test9'; -import test10 from '../tests/test10'; -import test11 from '../tests/test11'; -import test12 from '../tests/test12'; -import test13 from '../tests/test13'; -import test14 from '../tests/test14'; -import test15 from '../tests/test15'; -import test16 from '../tests/test16'; -import test17 from '../tests/test17'; -import test18 from '../tests/test18'; - -const red = '#FF0000'; - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - text: { - fontSize: 20, - fontWeight: 'bold', - // marginBottom: -50, - // marginBottom: 50, - }, - subText: { - fontSize: 18, - // fontWeight: 'bold', - // marginBottom: -50, - marginTop: 5, - marginBottom: 20, - }, - button: { - marginVertical: Platform.OS === 'android' ? 5 : 0, - }, -}); - -export default class TestLauncher extends Component { - render() { - const { lastRunTest, onLaunchTest } = this.props; - - const TestButton = ({ test, longRunning = false }) => ( - - - - - -

- - - - - diff --git a/apps/web/test10.html b/apps/web/test10.html deleted file mode 100644 index 457bd386b..000000000 --- a/apps/web/test10.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - Test 10 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test11.html b/apps/web/test11.html deleted file mode 100644 index 781d90abc..000000000 --- a/apps/web/test11.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - Test 11 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test12.html b/apps/web/test12.html deleted file mode 100644 index 9ebf11411..000000000 --- a/apps/web/test12.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - Test 12 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test13.html b/apps/web/test13.html deleted file mode 100644 index ece947ab2..000000000 --- a/apps/web/test13.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - Test 13 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test14.html b/apps/web/test14.html deleted file mode 100644 index 3cc302d1f..000000000 --- a/apps/web/test14.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - Test 14 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test15.html b/apps/web/test15.html deleted file mode 100644 index 00462c518..000000000 --- a/apps/web/test15.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - Test 15 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test16.html b/apps/web/test16.html deleted file mode 100644 index 1a4b57f51..000000000 --- a/apps/web/test16.html +++ /dev/null @@ -1,576 +0,0 @@ - - - - - - - - - Test 16 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test17.html b/apps/web/test17.html deleted file mode 100644 index e7a894dbe..000000000 --- a/apps/web/test17.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - Test 17 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test18.html b/apps/web/test18.html deleted file mode 100644 index 0dd439596..000000000 --- a/apps/web/test18.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - - Test 18 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test2.html b/apps/web/test2.html deleted file mode 100644 index 9ebcbc87c..000000000 --- a/apps/web/test2.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - Test 2 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test3.html b/apps/web/test3.html deleted file mode 100644 index 985198f0c..000000000 --- a/apps/web/test3.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - Test 3 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test4.html b/apps/web/test4.html deleted file mode 100644 index 0bdef58fd..000000000 --- a/apps/web/test4.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - Test 4 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test5.html b/apps/web/test5.html deleted file mode 100644 index 09c678052..000000000 --- a/apps/web/test5.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - Test 5 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test6.html b/apps/web/test6.html deleted file mode 100644 index d46ef0864..000000000 --- a/apps/web/test6.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - Test 6 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test7.html b/apps/web/test7.html deleted file mode 100644 index 986c516f8..000000000 --- a/apps/web/test7.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - Test 7 - - - - - -
- - - -
-
-
- - - - - diff --git a/apps/web/test8.html b/apps/web/test8.html deleted file mode 100644 index 251c2991d..000000000 --- a/apps/web/test8.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - Test 8 - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/test9.html b/apps/web/test9.html deleted file mode 100644 index 0bcebade1..000000000 --- a/apps/web/test9.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - Test 9 - - - - - - -
- - - -
-
- - - - - diff --git a/apps/web/utils.js b/apps/web/utils.js deleted file mode 100644 index f85a7b374..000000000 --- a/apps/web/utils.js +++ /dev/null @@ -1,33 +0,0 @@ -function startFpsTracker(id) { - const element = document.getElementById(id); - - const moveTo = (xCoord) => - (element.style.transform = `translateX(${xCoord}px)`); - - let xCoord = 0; - const delta = 7; - - const slideRight = (timestamp) => { - moveTo(xCoord); - xCoord += delta; - - if (xCoord > 100) { - requestAnimationFrame(slideLeft); - } else { - requestAnimationFrame(slideRight); - } - }; - - const slideLeft = (timestamp) => { - moveTo(xCoord); - xCoord -= delta; - - if (xCoord < -100) { - requestAnimationFrame(slideRight); - } else { - requestAnimationFrame(slideLeft); - } - }; - - requestAnimationFrame(slideRight); -} From 2c9ce779dd292a78058cc2c53ff281c6be8d8bb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:38:47 +1200 Subject: [PATCH 05/17] Bump rollup from 2.17.1 to 2.79.2 (#5) Bumps [rollup](https://github.com/rollup/rollup) from 2.17.1 to 2.79.2. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG-2.md) - [Commits](https://github.com/rollup/rollup/compare/v2.17.1...v2.79.2) --- updated-dependencies: - dependency-name: rollup dependency-version: 2.79.2 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 520d474b0..a9d284a47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1823,10 +1823,10 @@ fsevents@^2.1.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== -fsevents@~2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" - integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== gensync@^1.0.0-beta.1: version "1.0.0-beta.1" @@ -3544,11 +3544,11 @@ rollup-plugin-terser@^6.1.0: terser "^4.7.0" rollup@^2.17.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.17.1.tgz#d01a27c1b76e42efe2cd786609589f6332e81aa6" - integrity sha512-lVrtCXJ+08Eapa0SfApLmRNWNWm2FsYFnLPIJZJvZz2uI2Gv+dfPyu1zgF7KKF/HYFJDvjxbdCbI8lUVMnG7Sg== + version "2.79.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" + integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== optionalDependencies: - fsevents "~2.1.2" + fsevents "~2.3.2" rsvp@^4.8.4: version "4.8.4" From bdd89ddf0e534964c9ed8e619558d3fbe9f0b03b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:39:34 +1200 Subject: [PATCH 06/17] Bump shelljs from 0.8.3 to 0.8.5 (#6) Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.3 to 0.8.5. - [Release notes](https://github.com/shelljs/shelljs/releases) - [Changelog](https://github.com/shelljs/shelljs/blob/main/CHANGELOG.md) - [Commits](https://github.com/shelljs/shelljs/compare/v0.8.3...v0.8.5) --- updated-dependencies: - dependency-name: shelljs dependency-version: 0.8.5 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a9d284a47..0b38c0860 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3686,9 +3686,9 @@ shebang-regex@^3.0.0: integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== shelljs@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" - integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== dependencies: glob "^7.0.0" interpret "^1.0.0" From bcf4b45ac3632c6fa15daeb716b54858fce4aac2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:43:24 +1200 Subject: [PATCH 07/17] Bump follow-redirects from 1.7.0 to 1.15.11 (#7) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.7.0 to 1.15.11. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.7.0...v1.15.11) --- updated-dependencies: - dependency-name: follow-redirects dependency-version: 1.15.11 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0b38c0860..ebaea7399 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1419,7 +1419,7 @@ debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@^3.1.1, debug@^3.2.6: +debug@^3.1.1: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -1772,11 +1772,9 @@ flamebearer@^1.1.3: opn "^5.3.0" follow-redirects@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" - integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== - dependencies: - debug "^3.2.6" + version "1.15.11" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.11.tgz#777d73d72a92f8ec4d2e410eb47352a56b8e8340" + integrity sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ== for-in@^1.0.2: version "1.0.2" From 32af451c30153a82831ae98d989b36df52665d2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:45:15 +1200 Subject: [PATCH 08/17] Bump async from 2.6.3 to 2.6.4 (#8) Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-version: 2.6.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ebaea7399..4a330cd0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -964,9 +964,9 @@ assign-symbols@^1.0.0: integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= async@^2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" - integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== dependencies: lodash "^4.17.14" From 9abee31728beacb7a667385ada73a445ed606ab9 Mon Sep 17 00:00:00 2001 From: Ken Huang <205194+kenhuang@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:53:11 +1100 Subject: [PATCH 09/17] chore: update dependencies and improve documentation (#9) --- .gitignore | 4 +- README.md | 5 + cjs/utils/arrays.d.ts | 2 +- package.json | 46 +- yarn.lock | 4138 +++-------------------------------------- 5 files changed, 323 insertions(+), 3872 deletions(-) diff --git a/.gitignore b/.gitignore index 010bf4813..c77f4c65f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,9 @@ coverage/ ts3.4/ build/ dist/ +cjs/ es/ +.idea/ tsBuildInfo.json flamegraph.html @@ -15,4 +17,4 @@ isolate*.log out.pdf *.tgz -.vscode/settings.json \ No newline at end of file +.vscode/settings.json diff --git a/README.md b/README.md index 02c9bed4e..98a2ce1d3 100644 --- a/README.md +++ b/README.md @@ -1502,3 +1502,8 @@ See this [StackOverflow answer](https://stackoverflow.com/a/48268766) for a grea ## License [MIT](LICENSE.md) + +## Forks + +https://github.com/Hopding/pdf-lib -> original fork +https://github.com/ParadoxAi/pdf-lib -> sync with this fork with latest deps patch 2025-10-07 diff --git a/cjs/utils/arrays.d.ts b/cjs/utils/arrays.d.ts index 50901fa90..1a667d9bb 100644 --- a/cjs/utils/arrays.d.ts +++ b/cjs/utils/arrays.d.ts @@ -11,6 +11,6 @@ export declare const reverseArray: (array: Uint8Array) => Uint8Array; export declare const sum: (array: number[] | Uint8Array) => number; export declare const range: (start: number, end: number) => number[]; export declare const pluckIndices: (arr: T[], indices: number[]) => T[]; -export declare const canBeConvertedToUint8Array: (input: any) => input is string | Uint8Array | ArrayBuffer; +export declare const canBeConvertedToUint8Array: (input: any) => input is string | ArrayBuffer | Uint8Array; export declare const toUint8Array: (input: string | ArrayBuffer | Uint8Array) => Uint8Array; //# sourceMappingURL=arrays.d.ts.map \ No newline at end of file diff --git a/package.json b/package.json index 090b03eac..9d0190e5c 100644 --- a/package.json +++ b/package.json @@ -56,14 +56,7 @@ "build:downlevel-dts": "rimraf ts3.4 && yarn downlevel-dts . ts3.4 && rimraf ts3.4/scratchpad", "scratchpad:start": "ttsc --build scratchpad/tsconfig.json --watch", "scratchpad:run": "node scratchpad/build/scratchpad/index.js", - "scratchpad:flame": "rimraf isolate*.log && node --prof scratchpad/build/scratchpad/index.js && node --prof-process --preprocess -j isolate*.log | flamebearer", - "apps:node": "ttsc --build apps/node/tsconfig.json && node apps/node-build/index.js", - "apps:deno": "deno run --allow-read --allow-write --allow-run apps/deno/index.ts", - "apps:web": "http-server -c-1 .", - "apps:web:mac": "bash -c 'sleep 1 && open http://localhost:8080/apps/web/test1.html' & yarn apps:web", - "apps:rn:ios": "cd apps/rn && yarn add ./../.. --force && react-native run-ios", - "apps:rn:android": "yarn apps:rn:emulator & cd apps/rn && yarn add ./../.. --force && react-native run-android", - "apps:rn:emulator": "emulator -avd \"$(emulator -list-avds | head -n 1)\" & bash -c 'sleep 5 && adb reverse tcp:8080 tcp:8080 && adb reverse tcp:8081 tcp:8081'" + "scratchpad:flame": "rimraf isolate*.log && node --prof scratchpad/build/scratchpad/index.js && node --prof-process --preprocess -j isolate*.log | flamebearer" }, "main": "cjs/index.js", "module": "es/index.js", @@ -95,34 +88,31 @@ }, "devDependencies": { "@pdf-lib/fontkit": "^1.1.0", - "@rollup/plugin-commonjs": "^13.0.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^8.0.1", - "@types/jest": "^26.0.0", - "@types/node-fetch": "^2.5.7", + "@rollup/plugin-commonjs": "^23.0.2", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^14.1.0", + "@types/node-fetch": "^2.6.13", "@types/pako": "^1.0.1", "@zerollup/ts-transform-paths": "^1.7.18", - "downlevel-dts": "^0.5.0", + "downlevel-dts": "^0.11.0", "flamebearer": "^1.1.3", - "http-server": "^0.12.3", - "jest": "^26.0.1", - "node-fetch": "^2.6.0", - "prettier": "^2.0.5", + "node-fetch": "^2.6.7", + "prettier": "^2.8.8", "rimraf": "^3.0.2", - "rollup": "^2.17.1", + "rollup": "2.79.2", "rollup-plugin-terser": "^6.1.0", - "ts-jest": "^26.1.0", - "tslint": "^6.1.2", - "tslint-config-prettier": "^1.18.0", - "ttypescript": "^1.5.10", + "ttypescript": "^1.5.15", "typescript": "^3.9.5" }, "license": "MIT", "private": false, "homepage": "https://pdf-lib.js.org", - "repository": "git+https://github.com/Hopding/pdf-lib.git", + "repository": { + "type": "git", + "url": "git+https://github.com/mattrglobal/pdf-lib" + }, "bugs": { - "url": "https://github.com/Hopding/pdf-lib/issues" + "url": "https://github.com/mattrglobal/pdf-lib/issues" }, "keywords": [ "pdf-lib", @@ -137,5 +127,9 @@ "typescript", "javascript", "library" - ] + ], + "directories": { + "doc": "docs", + "test": "tests" + } } diff --git a/yarn.lock b/yarn.lock index 4a330cd0c..806bcad49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,20 +2,6 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" - integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== - dependencies: - "@babel/highlight" "^7.0.0" - -"@babel/code-frame@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.3.tgz#324bcfd8d35cd3d47dae18cde63d752086435e9a" - integrity sha512-fDx9eNW0qz0WkUeqL6tXEXzVlPh6Y5aCDEZesl0xBGA8ndRukX91Uk44ZqnkECp01NAZUdCAl+aiQNGi0k88Eg== - dependencies: - "@babel/highlight" "^7.10.3" - "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" @@ -23,223 +9,11 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/core@^7.1.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.4.tgz#84055750b05fcd50f9915a826b44fa347a825250" - integrity sha512-lQgGX3FPRgbz2SKmhMtYgJvVzGZrmjaF4apZ2bLwofAKiSjxU0drPh4S/VasyYXwaTs+A1gvQ45BN8SQJzHsQQ== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helpers" "^7.4.4" - "@babel/parser" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" - convert-source-map "^1.1.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.11" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/core@^7.7.5": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.0.tgz#ac977b538b77e132ff706f3b8a4dbad09c03c56e" - integrity sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.0" - "@babel/helper-module-transforms" "^7.9.0" - "@babel/helpers" "^7.9.0" - "@babel/parser" "^7.9.0" - "@babel/template" "^7.8.6" - "@babel/traverse" "^7.9.0" - "@babel/types" "^7.9.0" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.1" - json5 "^2.1.2" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/generator@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041" - integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ== - dependencies: - "@babel/types" "^7.4.4" - jsesc "^2.5.1" - lodash "^4.17.11" - source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/generator@^7.9.0", "@babel/generator@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.5.tgz#27f0917741acc41e6eaaced6d68f96c3fa9afaf9" - integrity sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ== - dependencies: - "@babel/types" "^7.9.5" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - -"@babel/helper-function-name@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" - integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== - dependencies: - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" - -"@babel/helper-function-name@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz#2b53820d35275120e1874a82e5aabe1376920a5c" - integrity sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw== - dependencies: - "@babel/helper-get-function-arity" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/types" "^7.9.5" - -"@babel/helper-get-function-arity@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" - integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== - dependencies: - "@babel/types" "^7.0.0" - -"@babel/helper-get-function-arity@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" - integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-member-expression-to-functions@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz#659b710498ea6c1d9907e0c73f206eee7dadc24c" - integrity sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-module-imports@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" - integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-module-transforms@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz#43b34dfe15961918707d247327431388e9fe96e5" - integrity sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA== - dependencies: - "@babel/helper-module-imports" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.6" - "@babel/helper-simple-access" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/template" "^7.8.6" - "@babel/types" "^7.9.0" - lodash "^4.17.13" - -"@babel/helper-optimise-call-expression@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz#7ed071813d09c75298ef4f208956006b6111ecb9" - integrity sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-plugin-utils@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" - integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== - -"@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670" - integrity sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ== - -"@babel/helper-replace-supers@^7.8.6": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz#5ada744fd5ad73203bf1d67459a27dcba67effc8" - integrity sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.8.3" - "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/traverse" "^7.8.6" - "@babel/types" "^7.8.6" - -"@babel/helper-simple-access@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" - integrity sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw== - dependencies: - "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" - -"@babel/helper-split-export-declaration@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" - integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== - dependencies: - "@babel/types" "^7.4.4" - -"@babel/helper-split-export-declaration@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" - integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-validator-identifier@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.3.tgz#60d9847f98c4cea1b279e005fdb7c28be5412d15" - integrity sha512-bU8JvtlYpJSBPuj1VUmKpFGaDZuLxASky3LhaKj3bmpSTY6VWooSM8msk+Z0CZoErFye2tlABF6yDkT3FOPAXw== - -"@babel/helper-validator-identifier@^7.9.0", "@babel/helper-validator-identifier@^7.9.5": +"@babel/helper-validator-identifier@^7.9.0": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g== -"@babel/helpers@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.4.tgz#868b0ef59c1dd4e78744562d5ce1b59c89f2f2a5" - integrity sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A== - dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/helpers@^7.9.0": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.9.2.tgz#b42a81a811f1e7313b88cba8adc66b3d9ae6c09f" - integrity sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA== - dependencies: - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.9.0" - "@babel/types" "^7.9.0" - -"@babel/highlight@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" - integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@babel/highlight@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.3.tgz#c633bb34adf07c5c13156692f5922c81ec53f28d" - integrity sha512-Ih9B/u7AtgEnySE2L2F0Xm0GaM729XqqLfHkalTsbjXGyqmf/6M0Cu0WpvqueUlW+xk88BHw9Nkpj49naU+vWw== - dependencies: - "@babel/helper-validator-identifier" "^7.10.3" - chalk "^2.0.0" - js-tokens "^4.0.0" - "@babel/highlight@^7.8.3": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" @@ -249,378 +23,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6" - integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w== - -"@babel/parser@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.3.tgz#7e71d892b0d6e7d04a1af4c3c79d72c1f10f5315" - integrity sha512-oJtNJCMFdIMwXGmx+KxuaD7i3b8uS7TTFYW/FNG2BT8m+fmGHoiPYoH0Pe3gya07WuFmM5FCDIr1x0irkD/hyA== - -"@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" - integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.8.3.tgz#6cb933a8872c8d359bfde69bbeaae5162fd1e8f7" - integrity sha512-UcAyQWg2bAN647Q+O811tG9MrJ38Z10jjhQdKNAL8fsyPzE3cCN/uT+f55cFVY4aGO4jqJAvmqsuY3GQDwAoXg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.8.3.tgz#3995d7d7ffff432f6ddc742b47e730c054599897" - integrity sha512-Zpg2Sgc++37kuFl6ppq2Q7Awc6E6AIW671x5PY8E/f7MCIyPPGK/EoeZXvvY3P42exZ3Q4/t3YOzP/HiN79jDg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.8.3.tgz#0e3fb63e09bea1b11e96467271c8308007e7c41f" - integrity sha512-H7dCMAdN83PcCmqmkHB5dtp+Xa9a6LKSvA2hiFBC/5alSHxM5VgWZXFqDi0YFe8XNGT6iCa+z4V4zSt/PdZ7Dw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/template@^7.1.0", "@babel/template@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/template@^7.3.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.3.tgz#4d13bc8e30bf95b0ce9d175d30306f42a2c9a7b8" - integrity sha512-5BjI4gdtD+9fHZUsaxPHPNpwa+xRkDO7c7JbhYn2afvrkDu5SfAAbi9AIMXw2xEhO/BR35TqiW97IqNvCo/GqA== - dependencies: - "@babel/code-frame" "^7.10.3" - "@babel/parser" "^7.10.3" - "@babel/types" "^7.10.3" - -"@babel/template@^7.7.4", "@babel/template@^7.8.3", "@babel/template@^7.8.6": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" - integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/parser" "^7.8.6" - "@babel/types" "^7.8.6" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.4.tgz#0776f038f6d78361860b6823887d4f3937133fe8" - integrity sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.11" - -"@babel/traverse@^7.7.4", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.5.tgz#6e7c56b44e2ac7011a948c21e283ddd9d9db97a2" - integrity sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.5" - "@babel/helper-function-name" "^7.9.5" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.9.0" - "@babel/types" "^7.9.5" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" - integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ== - dependencies: - esutils "^2.0.2" - lodash "^4.17.11" - to-fast-properties "^2.0.0" - -"@babel/types@^7.10.3", "@babel/types@^7.3.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.3.tgz#6535e3b79fea86a6b09e012ea8528f935099de8e" - integrity sha512-nZxaJhBXBQ8HVoIcGsf9qWep3Oh3jCENK54V4mRF7qaJabVsAYdbTtmSD8WmAp1R6ytPiu5apMwSXyxB1WlaBA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.3" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5": - version "7.9.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444" - integrity sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg== - dependencies: - "@babel/helper-validator-identifier" "^7.9.5" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@cnakazawa/watch@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" - integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== - dependencies: - exec-sh "^0.3.2" - minimist "^1.2.0" - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" - integrity sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" - integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== - -"@jest/console@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.0.1.tgz#62b3b2fa8990f3cbffbef695c42ae9ddbc8f4b39" - integrity sha512-9t1KUe/93coV1rBSxMmBAOIK3/HVpwxArCA1CxskKyRiv6o8J70V8C/V3OJminVCTa2M0hQI9AWRd5wxu2dAHw== - dependencies: - "@jest/types" "^26.0.1" - chalk "^4.0.0" - jest-message-util "^26.0.1" - jest-util "^26.0.1" - slash "^3.0.0" - -"@jest/core@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.0.1.tgz#aa538d52497dfab56735efb00e506be83d841fae" - integrity sha512-Xq3eqYnxsG9SjDC+WLeIgf7/8KU6rddBxH+SCt18gEpOhAGYC/Mq+YbtlNcIdwjnnT+wDseXSbU0e5X84Y4jTQ== - dependencies: - "@jest/console" "^26.0.1" - "@jest/reporters" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-changed-files "^26.0.1" - jest-config "^26.0.1" - jest-haste-map "^26.0.1" - jest-message-util "^26.0.1" - jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-resolve-dependencies "^26.0.1" - jest-runner "^26.0.1" - jest-runtime "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" - jest-watcher "^26.0.1" - micromatch "^4.0.2" - p-each-series "^2.1.0" - rimraf "^3.0.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.0.1.tgz#82f519bba71959be9b483675ee89de8c8f72a5c8" - integrity sha512-xBDxPe8/nx251u0VJ2dFAFz2H23Y98qdIaNwnMK6dFQr05jc+Ne/2np73lOAx+5mSBO/yuQldRrQOf6hP1h92g== - dependencies: - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" - -"@jest/fake-timers@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.0.1.tgz#f7aeff13b9f387e9d0cac9a8de3bba538d19d796" - integrity sha512-Oj/kCBnTKhm7CR+OJSjZty6N1bRDr9pgiYQr4wY221azLz5PHi08x/U+9+QpceAYOWheauLP8MhtSVFrqXQfhg== - dependencies: - "@jest/types" "^26.0.1" - "@sinonjs/fake-timers" "^6.0.1" - jest-message-util "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" - -"@jest/globals@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.0.1.tgz#3f67b508a7ce62b6e6efc536f3d18ec9deb19a9c" - integrity sha512-iuucxOYB7BRCvT+TYBzUqUNuxFX1hqaR6G6IcGgEqkJ5x4htNKo1r7jk1ji9Zj8ZMiMw0oB5NaA7k5Tx6MVssA== - dependencies: - "@jest/environment" "^26.0.1" - "@jest/types" "^26.0.1" - expect "^26.0.1" - -"@jest/reporters@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.0.1.tgz#14ae00e7a93e498cec35b0c00ab21c375d9b078f" - integrity sha512-NWWy9KwRtE1iyG/m7huiFVF9YsYv/e+mbflKRV84WDoJfBqUrNRyDbL/vFxQcYLl8IRqI4P3MgPn386x76Gf2g== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.2.4" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - jest-haste-map "^26.0.1" - jest-resolve "^26.0.1" - jest-util "^26.0.1" - jest-worker "^26.0.0" - slash "^3.0.0" - source-map "^0.6.0" - string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^4.1.3" - optionalDependencies: - node-notifier "^7.0.0" - -"@jest/source-map@^26.0.0": - version "26.0.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.0.0.tgz#fd7706484a7d3faf7792ae29783933bbf48a4749" - integrity sha512-S2Z+Aj/7KOSU2TfW0dyzBze7xr95bkm5YXNUqqCek+HE0VbNNSNzrRwfIi5lf7wvzDTSS0/ib8XQ1krFNyYgbQ== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.2.4" - source-map "^0.6.0" - -"@jest/test-result@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.0.1.tgz#1ffdc1ba4bc289919e54b9414b74c9c2f7b2b718" - integrity sha512-oKwHvOI73ICSYRPe8WwyYPTtiuOAkLSbY8/MfWF3qDEd/sa8EDyZzin3BaXTqufir/O/Gzea4E8Zl14XU4Mlyg== - dependencies: - "@jest/console" "^26.0.1" - "@jest/types" "^26.0.1" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.0.1.tgz#b0563424728f3fe9e75d1442b9ae4c11da73f090" - integrity sha512-ssga8XlwfP8YjbDcmVhwNlrmblddMfgUeAkWIXts1V22equp2GMIHxm7cyeD5Q/B0ZgKPK/tngt45sH99yLLGg== - dependencies: - "@jest/test-result" "^26.0.1" - graceful-fs "^4.2.4" - jest-haste-map "^26.0.1" - jest-runner "^26.0.1" - jest-runtime "^26.0.1" - -"@jest/transform@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.0.1.tgz#0e3ecbb34a11cd4b2080ed0a9c4856cf0ceb0639" - integrity sha512-pPRkVkAQ91drKGbzCfDOoHN838+FSbYaEAvBXvKuWeeRRUD8FjwXkqfUNUZL6Ke48aA/1cqq/Ni7kVMCoqagWA== - dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^26.0.1" - babel-plugin-istanbul "^6.0.0" - chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.2.4" - jest-haste-map "^26.0.1" - jest-regex-util "^26.0.0" - jest-util "^26.0.1" - micromatch "^4.0.2" - pirates "^4.0.1" - slash "^3.0.0" - source-map "^0.6.1" - write-file-atomic "^3.0.0" - -"@jest/types@^25.3.0": - version "25.3.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.3.0.tgz#88f94b277a1d028fd7117bc1f74451e0fc2131e7" - integrity sha512-UkaDNewdqXAmCDbN2GlUM6amDKS78eCqiw/UmF5nE0mmLTd6moJkiZJML/X52Ke3LH7Swhw883IRXq8o9nWjVw== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^15.0.0" - chalk "^3.0.0" - -"@jest/types@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.0.1.tgz#b78333fbd113fa7aec8d39de24f88de8686dac67" - integrity sha512-IbtjvqI9+eS1qFnOIEL7ggWmT+iK/U+Vde9cGWtYb/b6XgKb3X44ZAe/z9YZzoAAZ/E92m0DqrilF934IGNnQA== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^15.0.0" - chalk "^4.0.0" +"@jridgewell/sourcemap-codec@^1.4.13": + version "1.5.5" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" + integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== "@pdf-lib/fontkit@^1.1.0": version "1.1.1" @@ -643,192 +49,90 @@ dependencies: pako "^1.0.10" -"@rollup/plugin-commonjs@^13.0.0": - version "13.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-13.0.0.tgz#8a1d684ba6848afe8b9e3d85649d4b2f6f7217ec" - integrity sha512-Anxc3qgkAi7peAyesTqGYidG5GRim9jtg8xhmykNaZkImtvjA7Wsqep08D2mYsqw1IF7rA3lYfciLgzUSgRoqw== +"@rollup/plugin-commonjs@^23.0.2": + version "23.0.7" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-23.0.7.tgz#7d26d879caa54283086de1974b66f512ef60abdc" + integrity sha512-hsSD5Qzyuat/swzrExGG5l7EuIlPhwTsT7KwKbSCQzIcJWjRxiimi/0tyMYY2bByitNb3i1p+6JWEDGa0NvT0Q== dependencies: - "@rollup/pluginutils" "^3.0.8" + "@rollup/pluginutils" "^5.0.1" commondir "^1.0.1" - estree-walker "^1.0.1" - glob "^7.1.2" - is-reference "^1.1.2" - magic-string "^0.25.2" - resolve "^1.11.0" - -"@rollup/plugin-json@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" - integrity sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw== + estree-walker "^2.0.2" + glob "^8.0.3" + is-reference "1.2.1" + magic-string "^0.27.0" + +"@rollup/plugin-json@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz#fbe784e29682e9bb6dee28ea75a1a83702e7b805" + integrity sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA== dependencies: - "@rollup/pluginutils" "^3.0.8" + "@rollup/pluginutils" "^5.1.0" -"@rollup/plugin-node-resolve@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.0.1.tgz#364b5938808ee6b5164dea5ef7291be3f7395199" - integrity sha512-KIeAmueDDaYMqMBnUngLVVZhURwxA12nq/YB6nGm5/JpVyOMwI1fCVU3oL/dAnnLBG7oiPXntO5LHOiMrfNXCA== +"@rollup/plugin-node-resolve@^14.1.0": + version "14.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-14.1.0.tgz#f2fa475405cd7fed6420bf438fe393f988a9bc96" + integrity sha512-5G2niJroNCz/1zqwXtk0t9+twOSDlG00k1Wfd7bkbbXmwg8H8dvgHdIWAun53Ps/rckfvOC7scDBjuGFg5OaWw== dependencies: - "@rollup/pluginutils" "^3.0.8" - "@types/resolve" "0.0.8" - builtin-modules "^3.1.0" - deep-freeze "^0.0.1" + "@rollup/pluginutils" "^3.1.0" + "@types/resolve" "1.17.1" deepmerge "^4.2.2" + is-builtin-module "^3.1.0" is-module "^1.0.0" - resolve "^1.14.2" + resolve "^1.19.0" -"@rollup/pluginutils@^3.0.8": - version "3.0.9" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.9.tgz#aa6adca2c45e5a1b950103a999e3cddfe49fd775" - integrity sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg== +"@rollup/pluginutils@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" + integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== dependencies: "@types/estree" "0.0.39" estree-walker "^1.0.1" - micromatch "^4.0.2" + picomatch "^2.2.2" -"@sinonjs/commons@^1.7.0": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.2.tgz#505f55c74e0272b43f6c52d81946bed7058fc0e2" - integrity sha512-+DUO6pnp3udV/v2VfUWgaY5BIE1IfT7lLfeDzPVeMT1XKkaAp9LgSI9x5RtrFQoZ9Oi0PgXQQHPaoKu7dCjVxw== +"@rollup/pluginutils@^5.0.1", "@rollup/pluginutils@^5.1.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.3.0.tgz#57ba1b0cbda8e7a3c597a4853c807b156e21a7b4" + integrity sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q== dependencies: - type-detect "4.0.8" + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^4.0.2" -"@sinonjs/fake-timers@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz#293674fccb3262ac782c7aadfdeca86b10c75c40" - integrity sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA== - dependencies: - "@sinonjs/commons" "^1.7.0" - -"@types/babel__core@^7.1.7": - version "7.1.7" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.7.tgz#1dacad8840364a57c98d0dd4855c6dd3752c6b89" - integrity sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" - integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" - integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.6" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" - integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== - dependencies: - "@babel/types" "^7.3.0" - -"@types/color-name@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" - integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== +"@types/estree@*", "@types/estree@^1.0.0": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== -"@types/graceful-fs@^4.1.2": - version "4.1.3" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.3.tgz#039af35fe26bec35003e8d86d2ee9c586354348f" - integrity sha512-AiHRaEB50LQg0pZmm659vNBb9f4SJ0qrAnteuzhSeAUcJKxoYgEnprg/83kppCnc2zvtCKbdZry1a5pVY3lOTQ== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" - integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== - -"@types/istanbul-lib-report@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" - integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" - integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== - dependencies: - "@types/istanbul-lib-coverage" "*" - "@types/istanbul-lib-report" "*" - -"@types/jest@^26.0.0": - version "26.0.0" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.0.tgz#a6d7573dffa9c68cbbdf38f2e0de26f159e11134" - integrity sha512-/yeMsH9HQ1RLORlXAwoLXe8S98xxvhNtUz3yrgrwbaxYjT+6SFPZZRksmRKRA6L5vsUtSHeN71viDOTTyYAD+g== - dependencies: - jest-diff "^25.2.1" - pretty-format "^25.2.1" - -"@types/node-fetch@^2.5.7": - version "2.5.7" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c" - integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw== +"@types/node-fetch@^2.6.13": + version "2.6.13" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.13.tgz#e0c9b7b5edbdb1b50ce32c127e85e880872d56ee" + integrity sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw== dependencies: "@types/node" "*" - form-data "^3.0.0" + form-data "^4.0.4" "@types/node@*": version "12.0.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.0.tgz#d11813b9c0ff8aaca29f04cbc12817f4c7d656e5" integrity sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg== -"@types/normalize-package-data@^2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" - integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== - "@types/pako@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/pako/-/pako-1.0.1.tgz#33b237f3c9aff44d0f82fe63acffa4a365ef4a61" integrity sha512-GdZbRSJ3Cv5fiwT6I0SQ3ckeN2PWNqxd26W9Z2fCK1tGrrasGy4puvNFtnddqH9UJFMQYXxEuuB7B8UK+LLwSg== -"@types/prettier@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.1.tgz#b6e98083f13faa1e5231bfa3bdb1b0feff536b6d" - integrity sha512-boy4xPNEtiw6N3abRhBi/e7hNvy3Tt8E9ZRAQrwAGzoCGZS/1wjo9KY7JHhnfnEsG5wSjDbymCozUM9a3ea7OQ== - -"@types/resolve@0.0.8": - version "0.0.8" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" - integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== +"@types/resolve@1.17.1": + version "1.17.1" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" + integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== dependencies: "@types/node" "*" -"@types/stack-utils@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" - integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== - -"@types/yargs-parser@*": - version "13.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" - integrity sha512-wBlsw+8n21e6eTd4yVv8YD/E3xq0O6nNnJIquutAsFGE7EyMKz7W6RNT6BRu1SmdgmlCZ9tb0X+j+D6HGr8pZw== - -"@types/yargs@^15.0.0": - version "15.0.4" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.4.tgz#7e5d0f8ca25e9d5849f2ea443cf7c402decd8299" - integrity sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg== - dependencies: - "@types/yargs-parser" "*" - "@zerollup/ts-helpers@^1.7.18": version "1.7.18" resolved "https://registry.yarnpkg.com/@zerollup/ts-helpers/-/ts-helpers-1.7.18.tgz#747177f6d5abc06c3a0f5dffe7362d365cf0391d" @@ -843,51 +147,6 @@ dependencies: "@zerollup/ts-helpers" "^1.7.18" -abab@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" - integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== - -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.3.1.tgz#85010754db53c3fbaf3b9ea3e083aa5c5d147ffd" - integrity sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA== - -ajv@^6.5.5: - version "6.10.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" - integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-escapes@^4.2.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== - dependencies: - type-fest "^0.11.0" - -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== - ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -895,297 +154,50 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" - integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== - dependencies: - "@types/color-name" "^1.1.1" - color-convert "^2.0.1" - -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -anymatch@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= - -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= - -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= - -async@^2.6.2: - version "2.6.4" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" - integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== - dependencies: - lodash "^4.17.14" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -atob@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= - -aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== - -babel-jest@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.0.1.tgz#450139ce4b6c17174b136425bda91885c397bc46" - integrity sha512-Z4GGmSNQ8pX3WS1O+6v3fo41YItJJZsVxG5gIQ+HuB/iuAQBJxMTHTwz292vuYws1LnHfwSRgoqI+nxdy/pcvw== - dependencies: - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" - "@types/babel__core" "^7.1.7" - babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^26.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.4" - slash "^3.0.0" - -babel-plugin-istanbul@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz#e159ccdc9af95e0b570c75b4573b7c34d671d765" - integrity sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^4.0.0" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.0.0.tgz#fd1d35f95cf8849fc65cb01b5e58aedd710b34a8" - integrity sha512-+AuoehOrjt9irZL7DOt2+4ZaTM6dlu1s5TTS46JBa0/qem4dy7VNW3tMb96qeEqcIh20LD73TVNtmVEeymTG7w== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.2.tgz#fb4a4c51fe38ca60fede1dc74ab35eb843cb41d6" - integrity sha512-u/8cS+dEiK1SFILbOC8/rUI3ml9lboKuuMvZ/4aQnQmhecQAgPw5ew066C1ObnEAUmlx7dv/s2z52psWEtLNiw== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - -babel-preset-jest@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.0.0.tgz#1eac82f513ad36c4db2e9263d7c485c825b1faa6" - integrity sha512-9ce+DatAa31DpR4Uir8g4Ahxs5K4W4L8refzt+qHWQANb6LhGcAEfIFgLUwk67oya2cCUd6t4eUMtO/z64ocNw== - dependencies: - babel-plugin-jest-hoist "^26.0.0" - babel-preset-current-node-syntax "^0.1.2" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - -basic-auth@^1.0.3: - version "1.1.0" - resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-1.1.0.tgz#45221ee429f7ee1e5035be3f51533f1cdfd29884" - integrity sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ= - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= - dependencies: - tweetnacl "^0.14.3" - brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + version "1.1.12" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" + integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -braces@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - -bs-logger@0.x: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - -bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" - integrity sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk= +brace-expansion@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" + integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== dependencies: - node-int64 "^0.4.0" + balanced-match "^1.0.0" -buffer-from@1.x, buffer-from@^1.0.0: +buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= - -builtin-modules@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" - integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== - -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +builtin-modules@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" + integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== -camelcase@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.0.0.tgz#5259f7c30e35e278f1bdc2a4d91230b37cad981e" - integrity sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w== - -capture-exit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" - integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" + integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== dependencies: - rsvp "^4.8.4" + es-errors "^1.3.0" + function-bind "^1.1.2" -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - -chalk@^2.0.0, chalk@^2.3.0: +chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1194,69 +206,6 @@ chalk@^2.0.0, chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -ci-info@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" - integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== - -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - -cliui@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" - integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^6.2.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -collect-v8-coverage@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" - integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== - -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -1264,35 +213,11 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -colors@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" - integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== - -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" - integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== - dependencies: - delayed-stream "~1.0.0" - combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -1300,7 +225,7 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" -commander@^2.12.1, commander@^2.20.0: +commander@^2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -1310,15 +235,10 @@ commondir@^1.0.1: resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= -component-emitter@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" - integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== concat-stream@^1.6.2: version "1.6.2" @@ -1330,438 +250,80 @@ concat-stream@^1.6.2: readable-stream "^2.2.2" typedarray "^0.0.6" -convert-source-map@^1.1.0, convert-source-map@^1.4.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" - integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== - dependencies: - safe-buffer "~5.1.1" - -convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== - dependencies: - safe-buffer "~5.1.1" - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= - -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -corser@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" - integrity sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c= - -cross-spawn@^6.0.0: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^7.0.0: - version "7.0.2" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.2.tgz#d0d7dcfa74e89115c7619f4f721a94e1fdb716d6" - integrity sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - dependencies: - assert-plus "^1.0.0" - -data-urls@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" - integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== - dependencies: - abab "^2.0.3" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - -debug@^2.2.0, debug@^2.3.3: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^3.1.1: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== - dependencies: - ms "^2.1.1" - -debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= - -decimal.js@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.0.tgz#39466113a9e036111d02f82489b5fd6b0b5ed231" - integrity sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw== - -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= - -deep-freeze@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/deep-freeze/-/deep-freeze-0.0.1.tgz#3a0b0005de18672819dfd38cd31f91179c893e84" - integrity sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ= - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd" - integrity sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg== - -diff-sequences@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.0.0.tgz#0760059a5c287637b842bd7085311db7060e88a6" - integrity sha512-JC/eHYEC3aSS0vZGjuoc4vHA0yAQTzhQQldXMeMF+JlxLGJlCO38Gma82NV9gk1jGFz8mDzUMeaKXvjRRdJ2dg== - -diff@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" - integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== - -domexception@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" - integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== - dependencies: - webidl-conversions "^5.0.0" - -downlevel-dts@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.5.0.tgz#7db798f303f124d0d2dace838fd3ee5cf4bf53b4" - integrity sha512-hGikqjcnlkDXqga55u/jQx0ZdQz9Q3LtSqyceHSYavWOmSUoVUGjWZ/zwfiVMFL8rl+LKvJn9L5uaAq7P7xMNA== +downlevel-dts@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.11.0.tgz#514a2d723009c5845730c1db6c994484c596ed9c" + integrity sha512-vo835pntK7kzYStk7xUHDifiYJvXxVhUapt85uk2AI94gUUAQX9HNRtrcMHNSc3YHJUEHGbYIGsM99uIbgAtxw== dependencies: + semver "^7.3.2" shelljs "^0.8.3" - typescript "^3.8.0-dev.20200111" + typescript next -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" -ecstatic@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.3.2.tgz#6d1dd49814d00594682c652adb66076a69d46c48" - integrity sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog== - dependencies: - he "^1.1.1" - mime "^1.6.0" - minimist "^1.1.0" - url-join "^2.0.5" - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" - integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== +es-define-property@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" + integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== dependencies: - once "^1.4.0" + es-errors "^1.3.0" -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== +es-set-tostringtag@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" + integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== dependencies: - is-arrayish "^0.2.1" + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + has-tostringtag "^1.0.2" + hasown "^2.0.2" escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escodegen@^1.14.1: - version "1.14.2" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.2.tgz#14ab71bf5026c2aa08173afba22c6f3173284a84" - integrity sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A== - dependencies: - esprima "^4.0.1" - estraverse "^4.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= - estree-walker@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== -esutils@^2.0.2: +estree-walker@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= - -eventemitter3@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" - integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== - -exec-sh@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" - integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== - -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -execa@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.0.2.tgz#ad87fb7b2d9d564f70d2b62d511bee41d5cbb240" - integrity sha512-QI2zLa6CjGWdiQsmSkZoGtDx2N+cQIGb3yNolGTdjSQzydzLgYYf8LRuagp7S7fPimjcrzUDSUFd/MgzELMi4Q== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expect@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.0.1.tgz#18697b9611a7e2725e20ba3ceadda49bc9865421" - integrity sha512-QcCy4nygHeqmbw564YxNbHTJlXh47dVID2BUP52cZFpLU9zHViMFK6h07cC1wf7GYCTIigTdAXhVua8Yl1FkKg== - dependencies: - "@jest/types" "^26.0.1" - ansi-styles "^4.0.0" - jest-get-type "^26.0.0" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" - jest-regex-util "^26.0.0" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= - -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" - integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= - dependencies: - bser "^2.0.0" - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== flamebearer@^1.1.3: version "1.1.3" @@ -1771,98 +333,57 @@ flamebearer@^1.1.3: concat-stream "^1.6.2" opn "^5.3.0" -follow-redirects@^1.0.0: - version "1.15.11" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.11.tgz#777d73d72a92f8ec4d2e410eb47352a56b8e8340" - integrity sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ== - -for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= - -form-data@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682" - integrity sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg== +form-data@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" + integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" + es-set-tostringtag "^2.1.0" + hasown "^2.0.2" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= - dependencies: - map-cache "^0.2.2" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" - integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== - fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -gensync@^1.0.0-beta.1: - version "1.0.0-beta.1" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" - integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== - -get-caller-file@^2.0.1: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-stream@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" - integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== - dependencies: - pump "^3.0.0" - -get-stream@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" - integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== - dependencies: - pump "^3.0.0" - -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= +get-intrinsic@^1.2.6: + version "1.3.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" + integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== + dependencies: + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + function-bind "^1.1.2" + get-proto "^1.0.1" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + +get-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== dependencies: - assert-plus "^1.0.0" + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" -glob@^7.0.0, glob@^7.1.4: +glob@^7.0.0: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -1874,7 +395,7 @@ glob@^7.0.0, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: +glob@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== @@ -1886,33 +407,21 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== - -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" - integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== +glob@^8.0.3: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: - ajv "^6.5.5" - har-schema "^2.0.0" + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +gopd@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== has-flag@^3.0.0: version "3.0.0" @@ -1924,117 +433,24 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= - -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -he@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - -hosted-git-info@^2.1.4: - version "2.8.8" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== +has-symbols@^1.0.3, has-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== -html-encoding-sniffer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" - integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== +has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== dependencies: - whatwg-encoding "^1.0.5" + has-symbols "^1.0.3" -html-escaper@^2.0.0: +hasown@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -http-proxy@^1.18.0: - version "1.18.1" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" - integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== - dependencies: - eventemitter3 "^4.0.0" - follow-redirects "^1.0.0" - requires-port "^1.0.0" - -http-server@^0.12.3: - version "0.12.3" - resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.12.3.tgz#ba0471d0ecc425886616cb35c4faf279140a0d37" - integrity sha512-be0dKG6pni92bRjq0kvExtj/NrrAd28/8fCXkaI/4piTwQMSDSLMhWyW0NI1V+DBI3aa1HMlQu46/HjVLfmugA== - dependencies: - basic-auth "^1.0.3" - colors "^1.4.0" - corser "^2.0.1" - ecstatic "^3.3.2" - http-proxy "^1.18.0" - minimist "^1.2.5" - opener "^1.5.1" - portfinder "^1.0.25" - secure-compare "3.0.1" - union "~0.5.0" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -import-local@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" - integrity sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA== + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + function-bind "^1.1.2" inflight@^1.0.4: version "1.0.6" @@ -2054,591 +470,42 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== -ip-regex@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= - -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= - dependencies: - kind-of "^3.0.2" - -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== - dependencies: - kind-of "^6.0.0" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - -is-ci@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" - integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== - dependencies: - ci-info "^2.0.0" - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== - dependencies: - kind-of "^6.0.0" - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== - dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== +is-builtin-module@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" + builtin-modules "^3.3.0" -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== +is-core-module@^2.16.0: + version "2.16.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" + integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== dependencies: - is-plain-object "^2.0.4" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + hasown "^2.0.2" is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= - dependencies: - kind-of "^3.0.2" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" - integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== - dependencies: - isobject "^3.0.1" - -is-potential-custom-element-name@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397" - integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= - -is-reference@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.2.tgz#01cf91517d21db66a34642287ed6e70d53dcbe5c" - integrity sha512-Kn5g8c7XHKejFOpTf2QN9YjiHHKl5xRj+2uAZf9iM2//nkBNi/NNeB5JMoun28nEaUVHyPUzqzhfRlfAirEjXg== +is-reference@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== dependencies: - "@types/estree" "0.0.39" - -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - -is-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" - integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== - -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + "@types/estree" "*" is-wsl@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -is-wsl@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.1.1.tgz#4a1c152d429df3d441669498e2486d3596ebaf1d" - integrity sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog== - -isarray@1.0.0, isarray@~1.0.0: +isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= - -istanbul-lib-coverage@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" - integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== - -istanbul-lib-instrument@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz#61f13ac2c96cfefb076fe7131156cc05907874e6" - integrity sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg== - dependencies: - "@babel/core" "^7.7.5" - "@babel/parser" "^7.7.5" - "@babel/template" "^7.7.4" - "@babel/traverse" "^7.7.4" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" - integrity sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -jest-changed-files@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.0.1.tgz#1334630c6a1ad75784120f39c3aa9278e59f349f" - integrity sha512-q8LP9Sint17HaE2LjxQXL+oYWW/WeeXMPE2+Op9X3mY8IEGFVc14xRxFjUuXUbcPAlDLhtWdIEt59GdQbn76Hw== - dependencies: - "@jest/types" "^26.0.1" - execa "^4.0.0" - throat "^5.0.0" - -jest-cli@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.0.1.tgz#3a42399a4cbc96a519b99ad069a117d955570cac" - integrity sha512-pFLfSOBcbG9iOZWaMK4Een+tTxi/Wcm34geqZEqrst9cZDkTQ1LZ2CnBrTlHWuYAiTMFr0EQeK52ScyFU8wK+w== - dependencies: - "@jest/core" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - import-local "^3.0.2" - is-ci "^2.0.0" - jest-config "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" - prompts "^2.0.1" - yargs "^15.3.1" - -jest-config@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.0.1.tgz#096a3d4150afadf719d1fab00e9a6fb2d6d67507" - integrity sha512-9mWKx2L1LFgOXlDsC4YSeavnblN6A4CPfXFiobq+YYLaBMymA/SczN7xYTSmLaEYHZOcB98UdoN4m5uNt6tztg== - dependencies: - "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^26.0.1" - "@jest/types" "^26.0.1" - babel-jest "^26.0.1" - chalk "^4.0.0" - deepmerge "^4.2.2" - glob "^7.1.1" - graceful-fs "^4.2.4" - jest-environment-jsdom "^26.0.1" - jest-environment-node "^26.0.1" - jest-get-type "^26.0.0" - jest-jasmine2 "^26.0.1" - jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" - micromatch "^4.0.2" - pretty-format "^26.0.1" - -jest-diff@^25.2.1: - version "25.3.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.3.0.tgz#0d7d6f5d6171e5dacde9e05be47b3615e147c26f" - integrity sha512-vyvs6RPoVdiwARwY4kqFWd4PirPLm2dmmkNzKqo38uZOzJvLee87yzDjIZLmY1SjM3XR5DwsUH+cdQ12vgqi1w== - dependencies: - chalk "^3.0.0" - diff-sequences "^25.2.6" - jest-get-type "^25.2.6" - pretty-format "^25.3.0" - -jest-diff@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.0.1.tgz#c44ab3cdd5977d466de69c46929e0e57f89aa1de" - integrity sha512-odTcHyl5X+U+QsczJmOjWw5tPvww+y9Yim5xzqxVl/R1j4z71+fHW4g8qu1ugMmKdFdxw+AtQgs5mupPnzcIBQ== - dependencies: - chalk "^4.0.0" - diff-sequences "^26.0.0" - jest-get-type "^26.0.0" - pretty-format "^26.0.1" - -jest-docblock@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5" - integrity sha512-RDZ4Iz3QbtRWycd8bUEPxQsTlYazfYn/h5R65Fc6gOfwozFhoImx+affzky/FFBuqISPTqjXomoIGJVKBWoo0w== - dependencies: - detect-newline "^3.0.0" - -jest-each@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.0.1.tgz#633083061619302fc90dd8f58350f9d77d67be04" - integrity sha512-OTgJlwXCAR8NIWaXFL5DBbeS4QIYPuNASkzSwMCJO+ywo9BEa6TqkaSWsfR7VdbMLdgYJqSfQcIyjJCNwl5n4Q== - dependencies: - "@jest/types" "^26.0.1" - chalk "^4.0.0" - jest-get-type "^26.0.0" - jest-util "^26.0.1" - pretty-format "^26.0.1" - -jest-environment-jsdom@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.0.1.tgz#217690852e5bdd7c846a4e3b50c8ffd441dfd249" - integrity sha512-u88NJa3aptz2Xix2pFhihRBAatwZHWwSiRLBDBQE1cdJvDjPvv7ZGA0NQBxWwDDn7D0g1uHqxM8aGgfA9Bx49g== - dependencies: - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" - jsdom "^16.2.2" - -jest-environment-node@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.0.1.tgz#584a9ff623124ff6eeb49e0131b5f7612b310b13" - integrity sha512-4FRBWcSn5yVo0KtNav7+5NH5Z/tEgDLp7VRQVS5tCouWORxj+nI+1tOLutM07Zb2Qi7ja+HEDoOUkjBSWZg/IQ== - dependencies: - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" - -jest-get-type@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877" - integrity sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig== - -jest-get-type@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.0.0.tgz#381e986a718998dbfafcd5ec05934be538db4039" - integrity sha512-zRc1OAPnnws1EVfykXOj19zo2EMw5Hi6HLbFCSjpuJiXtOWAYIjNsHVSbpQ8bDX7L5BGYGI8m+HmKdjHYFF0kg== - -jest-haste-map@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.0.1.tgz#40dcc03c43ac94d25b8618075804d09cd5d49de7" - integrity sha512-J9kBl/EdjmDsvyv7CiyKY5+DsTvVOScenprz/fGqfLg/pm1gdjbwwQ98nW0t+OIt+f+5nAVaElvn/6wP5KO7KA== - dependencies: - "@jest/types" "^26.0.1" - "@types/graceful-fs" "^4.1.2" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.4" - jest-serializer "^26.0.0" - jest-util "^26.0.1" - jest-worker "^26.0.0" - micromatch "^4.0.2" - sane "^4.0.3" - walker "^1.0.7" - which "^2.0.2" - optionalDependencies: - fsevents "^2.1.2" - -jest-jasmine2@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.0.1.tgz#947c40ee816636ba23112af3206d6fa7b23c1c1c" - integrity sha512-ILaRyiWxiXOJ+RWTKupzQWwnPaeXPIoLS5uW41h18varJzd9/7I0QJGqg69fhTT1ev9JpSSo9QtalriUN0oqOg== - dependencies: - "@babel/traverse" "^7.1.0" - "@jest/environment" "^26.0.1" - "@jest/source-map" "^26.0.0" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" - chalk "^4.0.0" - co "^4.6.0" - expect "^26.0.1" - is-generator-fn "^2.0.0" - jest-each "^26.0.1" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" - jest-runtime "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - pretty-format "^26.0.1" - throat "^5.0.0" - -jest-leak-detector@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.0.1.tgz#79b19ab3f41170e0a78eb8fa754a116d3447fb8c" - integrity sha512-93FR8tJhaYIWrWsbmVN1pQ9ZNlbgRpfvrnw5LmgLRX0ckOJ8ut/I35CL7awi2ecq6Ca4lL59bEK9hr7nqoHWPA== - dependencies: - jest-get-type "^26.0.0" - pretty-format "^26.0.1" - -jest-matcher-utils@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.0.1.tgz#12e1fc386fe4f14678f4cc8dbd5ba75a58092911" - integrity sha512-PUMlsLth0Azen8Q2WFTwnSkGh2JZ8FYuwijC8NR47vXKpsrKmA1wWvgcj1CquuVfcYiDEdj985u5Wmg7COEARw== - dependencies: - chalk "^4.0.0" - jest-diff "^26.0.1" - jest-get-type "^26.0.0" - pretty-format "^26.0.1" - -jest-message-util@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.0.1.tgz#07af1b42fc450b4cc8e90e4c9cef11b33ce9b0ac" - integrity sha512-CbK8uQREZ8umUfo8+zgIfEt+W7HAHjQCoRaNs4WxKGhAYBGwEyvxuK81FXa7VeB9pwDEXeeKOB2qcsNVCAvB7Q== - dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.0.1" - "@types/stack-utils" "^1.0.1" - chalk "^4.0.0" - graceful-fs "^4.2.4" - micromatch "^4.0.2" - slash "^3.0.0" - stack-utils "^2.0.2" - -jest-mock@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.0.1.tgz#7fd1517ed4955397cf1620a771dc2d61fad8fd40" - integrity sha512-MpYTBqycuPYSY6xKJognV7Ja46/TeRbAZept987Zp+tuJvMN0YBWyyhG9mXyYQaU3SBI0TUlSaO5L3p49agw7Q== - dependencies: - "@jest/types" "^26.0.1" - -jest-pnp-resolver@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" - integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== - -jest-regex-util@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" - integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== - -jest-resolve-dependencies@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.0.1.tgz#607ba7ccc32151d185a477cff45bf33bce417f0b" - integrity sha512-9d5/RS/ft0vB/qy7jct/qAhzJsr6fRQJyGAFigK3XD4hf9kIbEH5gks4t4Z7kyMRhowU6HWm/o8ILqhaHdSqLw== - dependencies: - "@jest/types" "^26.0.1" - jest-regex-util "^26.0.0" - jest-snapshot "^26.0.1" - -jest-resolve@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.0.1.tgz#21d1ee06f9ea270a343a8893051aeed940cde736" - integrity sha512-6jWxk0IKZkPIVTvq6s72RH735P8f9eCJW3IM5CX/SJFeKq1p2cZx0U49wf/SdMlhaB/anann5J2nCJj6HrbezQ== - dependencies: - "@jest/types" "^26.0.1" - chalk "^4.0.0" - graceful-fs "^4.2.4" - jest-pnp-resolver "^1.2.1" - jest-util "^26.0.1" - read-pkg-up "^7.0.1" - resolve "^1.17.0" - slash "^3.0.0" - -jest-runner@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.0.1.tgz#ea03584b7ae4bacfb7e533d680a575a49ae35d50" - integrity sha512-CApm0g81b49Znm4cZekYQK67zY7kkB4umOlI2Dx5CwKAzdgw75EN+ozBHRvxBzwo1ZLYZ07TFxkaPm+1t4d8jA== - dependencies: - "@jest/console" "^26.0.1" - "@jest/environment" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-config "^26.0.1" - jest-docblock "^26.0.0" - jest-haste-map "^26.0.1" - jest-jasmine2 "^26.0.1" - jest-leak-detector "^26.0.1" - jest-message-util "^26.0.1" - jest-resolve "^26.0.1" - jest-runtime "^26.0.1" - jest-util "^26.0.1" - jest-worker "^26.0.0" - source-map-support "^0.5.6" - throat "^5.0.0" - -jest-runtime@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.0.1.tgz#a121a6321235987d294168e282d52b364d7d3f89" - integrity sha512-Ci2QhYFmANg5qaXWf78T2Pfo6GtmIBn2rRaLnklRyEucmPccmCKvS9JPljcmtVamsdMmkyNkVFb9pBTD6si9Lw== - dependencies: - "@jest/console" "^26.0.1" - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/globals" "^26.0.1" - "@jest/source-map" "^26.0.0" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" - "@types/yargs" "^15.0.0" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.4" - jest-config "^26.0.1" - jest-haste-map "^26.0.1" - jest-message-util "^26.0.1" - jest-mock "^26.0.1" - jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" - slash "^3.0.0" - strip-bom "^4.0.0" - yargs "^15.3.1" - -jest-serializer@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.0.0.tgz#f6c521ddb976943b93e662c0d4d79245abec72a3" - integrity sha512-sQGXLdEGWFAE4wIJ2ZaIDb+ikETlUirEOBsLXdoBbeLhTHkZUJwgk3+M8eyFizhM6le43PDCCKPA1hzkSDo4cQ== - dependencies: - graceful-fs "^4.2.4" - -jest-snapshot@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.0.1.tgz#1baa942bd83d47b837a84af7fcf5fd4a236da399" - integrity sha512-jxd+cF7+LL+a80qh6TAnTLUZHyQoWwEHSUFJjkw35u3Gx+BZUNuXhYvDqHXr62UQPnWo2P6fvQlLjsU93UKyxA== - dependencies: - "@babel/types" "^7.0.0" - "@jest/types" "^26.0.1" - "@types/prettier" "^2.0.0" - chalk "^4.0.0" - expect "^26.0.1" - graceful-fs "^4.2.4" - jest-diff "^26.0.1" - jest-get-type "^26.0.0" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" - jest-resolve "^26.0.1" - make-dir "^3.0.0" - natural-compare "^1.4.0" - pretty-format "^26.0.1" - semver "^7.3.2" - -jest-util@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.0.1.tgz#72c4c51177b695fdd795ca072a6f94e3d7cef00a" - integrity sha512-byQ3n7ad1BO/WyFkYvlWQHTsomB6GIewBh8tlGtusiylAlaxQ1UpS0XYH0ngOyhZuHVLN79Qvl6/pMiDMSSG1g== - dependencies: - "@jest/types" "^26.0.1" - chalk "^4.0.0" - graceful-fs "^4.2.4" - is-ci "^2.0.0" - make-dir "^3.0.0" - -jest-validate@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.0.1.tgz#a62987e1da5b7f724130f904725e22f4e5b2e23c" - integrity sha512-u0xRc+rbmov/VqXnX3DlkxD74rHI/CfS5xaV2VpeaVySjbb1JioNVOyly5b56q2l9ZKe7bVG5qWmjfctkQb0bA== - dependencies: - "@jest/types" "^26.0.1" - camelcase "^6.0.0" - chalk "^4.0.0" - jest-get-type "^26.0.0" - leven "^3.1.0" - pretty-format "^26.0.1" - -jest-watcher@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.0.1.tgz#5b5e3ebbdf10c240e22a98af66d645631afda770" - integrity sha512-pdZPydsS8475f89kGswaNsN3rhP6lnC3/QDCppP7bg1L9JQz7oU9Mb/5xPETk1RHDCWeqmVC47M4K5RR7ejxFw== - dependencies: - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - jest-util "^26.0.1" - string-length "^4.0.1" - jest-worker@^26.0.0: version "26.0.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.0.0.tgz#4920c7714f0a96c6412464718d0c58a3df3fb066" @@ -2647,476 +514,80 @@ jest-worker@^26.0.0: merge-stream "^2.0.0" supports-color "^7.0.0" -jest@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.0.1.tgz#5c51a2e58dff7525b65f169721767173bf832694" - integrity sha512-29Q54kn5Bm7ZGKIuH2JRmnKl85YRigp0o0asTc6Sb6l2ch1DCXIeZTLLFy9ultJvhkTqbswF5DEx4+RlkmCxWg== - dependencies: - "@jest/core" "^26.0.1" - import-local "^3.0.2" - jest-cli "^26.0.1" - js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" - integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= - -jsdom@^16.2.2: - version "16.2.2" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.2.2.tgz#76f2f7541646beb46a938f5dc476b88705bedf2b" - integrity sha512-pDFQbcYtKBHxRaP55zGXCJWgFHkDAYbKcsXEK/3Icu9nKYZkutUXfLBwbD+09XDutkYSHcgfQLZ0qvpAAm9mvg== - dependencies: - abab "^2.0.3" - acorn "^7.1.1" - acorn-globals "^6.0.0" - cssom "^0.4.4" - cssstyle "^2.2.0" - data-urls "^2.0.0" - decimal.js "^10.2.0" - domexception "^2.0.1" - escodegen "^1.14.1" - html-encoding-sniffer "^2.0.1" - is-potential-custom-element-name "^1.0.0" - nwsapi "^2.2.0" - parse5 "5.1.1" - request "^2.88.2" - request-promise-native "^1.0.8" - saxes "^5.0.0" - symbol-tree "^3.2.4" - tough-cookie "^3.0.1" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^2.0.0" - webidl-conversions "^6.0.0" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - ws "^7.2.3" - xml-name-validator "^3.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -json5@2.x, json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" - integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== - dependencies: - minimist "^1.2.0" - -json5@^2.1.2: - version "2.1.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" - integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== - dependencies: - minimist "^1.2.5" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== - -kleur@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lines-and-columns@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" - integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -lodash.memoize@4.x: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= - -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= - -lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15: - version "4.17.19" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" - integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== - -magic-string@^0.25.2: - version "0.25.2" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.2.tgz#139c3a729515ec55e96e69e82a11fe890a293ad9" - integrity sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg== - dependencies: - sourcemap-codec "^1.4.4" - -make-dir@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.2.tgz#04a1acbf22221e1d6ef43559f43e05a90dbb4392" - integrity sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w== +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== dependencies: - semver "^6.0.0" - -make-error@1.x: - version "1.3.5" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" - integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + yallist "^4.0.0" -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" - integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= +magic-string@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" + integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== dependencies: - tmpl "1.0.x" + "@jridgewell/sourcemap-codec" "^1.4.13" -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= - -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= - dependencies: - object-visit "^1.0.0" +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -micromatch@4.x, micromatch@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" - integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== - dependencies: - braces "^3.0.1" - picomatch "^2.0.5" - -micromatch@^3.1.4: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - mime-db@1.40.0: version "1.40.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== -mime-types@^2.1.12, mime-types@~2.1.19: +mime-types@^2.1.12: version "2.1.24" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== dependencies: mime-db "1.40.0" -mime@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -mkdirp@1.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" - integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" - -mkdirp@^0.5.3: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - -node-fetch@^2.6.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= - -node-modules-regexp@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" - integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= - -node-notifier@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-7.0.1.tgz#a355e33e6bebacef9bf8562689aed0f4230ca6f9" - integrity sha512-VkzhierE7DBmQEElhTGJIoiZa1oqRijOtgOlsXg32KrJRXsPy0NXFBqWGW/wTswnJlDCs5viRYaqWguqzsKcmg== - dependencies: - growly "^1.3.0" - is-wsl "^2.1.1" - semver "^7.2.1" - shellwords "^0.1.1" - uuid "^7.0.3" - which "^2.0.2" - -normalize-package-data@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-path@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= - dependencies: - remove-trailing-separator "^1.0.1" - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - -npm-run-path@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -nwsapi@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" - integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= +minimatch@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" + brace-expansion "^2.0.1" -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= - dependencies: - isobject "^3.0.0" +minimist@^1.2.6: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= +node-fetch@^2.6.7: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: - isobject "^3.0.1" + whatwg-url "^5.0.0" -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" -onetime@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" - integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== - dependencies: - mimic-fn "^2.1.0" - -opener@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" - integrity sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA== - opn@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" @@ -3124,47 +595,6 @@ opn@^5.3.0: dependencies: is-wsl "^1.1.0" -optionator@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -p-each-series@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48" - integrity sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ== - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - pako@^1.0.10, pako@^1.0.6: version "1.0.10" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" @@ -3175,160 +605,41 @@ pako@^1.0.11: resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== -parse-json@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" - integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - lines-and-columns "^1.1.6" - -parse5@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" - integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== - -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - -picomatch@^2.0.4, picomatch@^2.0.5: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== - -pirates@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" - integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== - dependencies: - node-modules-regexp "^1.0.0" - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -portfinder@^1.0.25: - version "1.0.26" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.26.tgz#475658d56ca30bed72ac7f1378ed350bd1b64e70" - integrity sha512-Xi7mKxJHHMI3rIUrnm/jjUgwhbYMkp/XKEcZX3aG4BrumLpq3nmoQMX+ClYnDZnZ/New7IatC1no5RX0zo1vXQ== - dependencies: - async "^2.6.2" - debug "^3.1.1" - mkdirp "^0.5.1" +picomatch@^2.2.2: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= +picomatch@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042" + integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q== -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= - -prettier@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" - integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== - -pretty-format@^25.2.1, pretty-format@^25.3.0: - version "25.3.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.3.0.tgz#d0a4f988ff4a6cd350342fdabbb809aeb4d49ad5" - integrity sha512-wToHwF8bkQknIcFkBqNfKu4+UZqnrLn/Vr+wwKQwwvPzkBfDDKp/qIabFqdgtoi5PEnM8LFByVsOrHoa3SpTVA== - dependencies: - "@jest/types" "^25.3.0" - ansi-regex "^5.0.0" - ansi-styles "^4.0.0" - react-is "^16.12.0" - -pretty-format@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.0.1.tgz#a4fe54fe428ad2fd3413ca6bbd1ec8c2e277e197" - integrity sha512-SWxz6MbupT3ZSlL0Po4WF/KujhQaVehijR2blyRDCzk9e45EaYMVhMBn49fnRuHxtkSpXTes1GxNpVmH86Bxfw== - dependencies: - "@jest/types" "^26.0.1" - ansi-regex "^5.0.0" - ansi-styles "^4.0.0" - react-is "^16.12.0" +prettier@^2.8.8: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== -prompts@^2.0.1: - version "2.0.4" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.4.tgz#179f9d4db3128b9933aa35f93a800d8fce76a682" - integrity sha512-HTzM3UWp/99A0gk51gAegwo1QRYA7xjcZufMNe33rCclFszUYAuHe1fIN/3ZmiHeGPkUsNaRyQm1hHOfM0PKxA== - dependencies: - kleur "^3.0.2" - sisteransi "^1.0.0" - -psl@^1.1.28: - version "1.1.31" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" - integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -qs@^6.4.0: - version "6.9.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.1.tgz#20082c65cb78223635ab1a9eaca8875a29bf8ec9" - integrity sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA== - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -3336,30 +647,6 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -react-is@^16.12.0: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" - integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== - -read-pkg-up@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" - integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== - dependencies: - find-up "^4.1.0" - read-pkg "^5.2.0" - type-fest "^0.8.1" - -read-pkg@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" - integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== - dependencies: - "@types/normalize-package-data" "^2.4.0" - normalize-package-data "^2.5.0" - parse-json "^5.0.0" - type-fest "^0.6.0" - readable-stream@^2.2.2: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -3380,124 +667,22 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= - -repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== - -repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= - -request-promise-core@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" - integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== - dependencies: - lodash "^4.17.15" - -request-promise-native@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" - integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== - dependencies: - request-promise-core "1.1.3" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - -request@^2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= - -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== +resolve@>=1.9.0, resolve@^1.19.0: + version "1.22.10" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" + integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + is-core-module "^2.16.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.1.6, resolve@^1.14.2: +resolve@^1.1.6: version "1.15.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== dependencies: path-parse "^1.0.6" -resolve@^1.10.0, resolve@^1.17.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" - integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== - dependencies: - path-parse "^1.0.6" - -resolve@^1.11.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" - integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== - dependencies: - path-parse "^1.0.6" - resolve@^1.12.0: version "1.13.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" @@ -3505,25 +690,6 @@ resolve@^1.12.0: dependencies: path-parse "^1.0.6" -resolve@^1.3.2, resolve@^1.9.0: - version "1.10.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" - integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== - dependencies: - path-parse "^1.0.6" - -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== - -rimraf@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" - integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg== - dependencies: - glob "^7.1.3" - rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -3541,91 +707,29 @@ rollup-plugin-terser@^6.1.0: serialize-javascript "^3.0.0" terser "^4.7.0" -rollup@^2.17.1: +rollup@2.79.2: version "2.79.2" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== optionalDependencies: fsevents "~2.3.2" -rsvp@^4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" - integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== - -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - safe-buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= - dependencies: - ret "~0.1.10" - -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -sane@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" - integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== - dependencies: - "@cnakazawa/watch" "^1.0.3" - anymatch "^2.0.0" - capture-exit "^2.0.0" - exec-sh "^0.3.2" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - -saxes@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== +semver@^7.3.2: + version "7.5.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" + integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== dependencies: - xmlchars "^2.2.0" - -secure-compare@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" - integrity sha1-8aAymzCLIh+uN7mXTz1XjQypmeM= - -"semver@2 || 3 || 4 || 5": - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -semver@7.x, semver@^7.2.1, semver@^7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== - -semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" - integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== - -semver@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" - integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== - -semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + lru-cache "^6.0.0" serialize-javascript@^3.0.0: version "3.1.0" @@ -3634,56 +738,7 @@ serialize-javascript@^3.0.0: dependencies: randombytes "^2.1.0" -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - integrity sha1-fbCPnT0i3H945Trzw79GZuzfzPE= - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= - dependencies: - shebang-regex "^1.0.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -shelljs@^0.8.3: +shelljs@^0.8.3, shelljs@^0.8.5: version "0.8.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== @@ -3692,75 +747,6 @@ shelljs@^0.8.3: interpret "^1.0.0" rechoir "^0.6.2" -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== - -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= - -sisteransi@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c" - integrity sha512-N+z4pHB4AmUv0SjveWRd6q1Nj5w62m5jodv+GD8lvmbY/83T/rpbJGZOnK5T149OldDj4Db07BSv9xY4K6NTPQ== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== - dependencies: - kind-of "^3.2.0" - -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -source-map-resolve@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" - integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== - dependencies: - atob "^2.1.1" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - -source-map-support@^0.5.6: - version "0.5.12" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" - integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-support@~0.5.12: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" @@ -3769,121 +755,11 @@ source-map-support@~0.5.12: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= - -source-map@^0.5.0, source-map@^0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - -sourcemap-codec@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz#c63ea927c029dd6bd9a2b7fa03b3fec02ad56e9f" - integrity sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg== - -spdx-correct@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" - integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" - integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== - -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.5" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" - integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== - -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== - dependencies: - extend-shallow "^3.0.0" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -stack-utils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.2.tgz#5cf48b4557becb4638d0bc4f21d23f5d19586593" - integrity sha512-0H7QK2ECz3fyZMzQ8rH0j2ykpfbnd20BFtfg/SqVC2+sCTtcw0aDTGB7dk+de4U4uUeuz6nOtJcrkFFLG1B0Rg== - dependencies: - escape-string-regexp "^2.0.0" - -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - -string-length@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.1.tgz#4a973bf31ef77c4edbceadd6af2611996985f8a1" - integrity sha512-PKyXUd0LK0ePjSOnWn34V2uD6acUWev9uy0Ft05k0E8xRW+SKcA0F7eMr7h5xlzfn+4O3N+55rduYyet3Jk+jw== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" - integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -3891,28 +767,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== - dependencies: - ansi-regex "^5.0.0" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -3920,487 +774,83 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" - integrity sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== terser@^4.7.0: - version "4.8.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" - integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== + version "4.8.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.1.tgz#a00e5634562de2239fd404c649051bf6fc21144f" + integrity sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw== dependencies: commander "^2.20.0" source-map "~0.6.1" source-map-support "~0.5.12" -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -throat@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" - integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== - -tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -tough-cookie@^2.3.3, tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tough-cookie@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" - integrity sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg== - dependencies: - ip-regex "^2.1.0" - psl "^1.1.28" - punycode "^2.1.1" - -tr46@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.0.2.tgz#03273586def1595ae08fedb38d7733cee91d2479" - integrity sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg== - dependencies: - punycode "^2.1.1" - -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= - -ts-jest@^26.1.0: - version "26.1.0" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.0.tgz#e9070fc97b3ea5557a48b67c631c74eb35e15417" - integrity sha512-JbhQdyDMYN5nfKXaAwCIyaWLGwevcT2/dbqRPsQeh6NZPUuXjZQZEfeLb75tz0ubCIgEELNm6xAzTe5NXs5Y4Q== - dependencies: - bs-logger "0.x" - buffer-from "1.x" - fast-json-stable-stringify "2.x" - json5 "2.x" - lodash.memoize "4.x" - make-error "1.x" - micromatch "4.x" - mkdirp "1.x" - semver "7.x" - yargs-parser "18.x" - -tslib@^1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" - integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== tslib@^1.11.1: version "1.11.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== -tslib@^1.8.1: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== - -tslint-config-prettier@^1.18.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" - integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - -tslint@^6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.2.tgz#2433c248512cc5a7b2ab88ad44a6b1b34c6911cf" - integrity sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.3" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.10.0" - tsutils "^2.29.0" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - -ttypescript@^1.5.10: - version "1.5.10" - resolved "https://registry.yarnpkg.com/ttypescript/-/ttypescript-1.5.10.tgz#5045083a91cf09a735ecc95d4711c1f3b83f2059" - integrity sha512-Hk7TRej1hM+p+Fo+Pyb/XK9pe9CAt3Sh5n5YRutxFS8hUgkh2u1Vd2K40kMcNP3WYhiVFBMqXwM/2E8O95Ep6g== - dependencies: - resolve "^1.9.0" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== - -type-fest@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" - integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== - -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== +ttypescript@^1.5.15: + version "1.5.15" + resolved "https://registry.yarnpkg.com/ttypescript/-/ttypescript-1.5.15.tgz#e45550ad69289d06d3bc3fd4a3c87e7c1ef3eba7" + integrity sha512-48ykDNHzFnPMnv4hYX1P8Q84TvCZyL1QlFxeuxsuZ48X2+ameBgPenvmCkHJtoOSxpoWTWi8NcgNrRnVDOmfSg== dependencies: - is-typedarray "^1.0.0" + resolve ">=1.9.0" typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.8.0-dev.20200111: - version "3.8.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" - integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== - typescript@^3.9.5: version "3.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== -union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" - integrity sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ= - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^0.4.3" - -union@~0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/union/-/union-0.5.0.tgz#b2c11be84f60538537b846edb9ba266ba0090075" - integrity sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA== - dependencies: - qs "^6.4.0" - -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== - dependencies: - punycode "^2.1.0" - -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= - -url-join@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728" - integrity sha1-WvIvGMBSoACkjXuCxenC4v7tpyg= - -use@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +typescript@next: + version "6.0.0-dev.20251005" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.0-dev.20251005.tgz#061b922d2d0b5072655a852ea9eee05a6959fa41" + integrity sha512-KTz4zIPbhB0vQPLuO/uvoZtajqpfDMCC0i/v+5Nf2NwDFpWBLfn6fLeS15R30Vl1H6U3WHGxbv9FnydT2gUcjA== util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== - -uuid@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" - integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== - -v8-to-istanbul@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz#22fe35709a64955f49a08a7c7c959f6520ad6f20" - integrity sha512-sAjOC+Kki6aJVbUOXJbcR0MnbfjvBzwKZazEJymA2IX49uoOdEdk+4fBq5cXgYgiyKtAyrrJNtBZdOeDIF+Fng== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" - integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== - dependencies: - xml-name-validator "^3.0.0" - -walker@^1.0.7, walker@~1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" - integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= - dependencies: - makeerror "1.0.x" +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^5.0.0: +whatwg-url@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - -webidl-conversions@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" - integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== - -whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - -whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - -whatwg-url@^8.0.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.1.0.tgz#c628acdcf45b82274ce7281ee31dd3c839791771" - integrity sha512-vEIkwNi9Hqt4TV9RdnaBPNt+E2Sgmo3gePebCRgZ1R7g6d23+53zCTnuB0amKI4AXq6VM8jj2DUAa0S1vjJxkw== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^2.0.2" - webidl-conversions "^5.0.0" - -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= - -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - -which@^2.0.1, which@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" + tr46 "~0.0.3" + webidl-conversions "^3.0.0" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== - dependencies: - imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -ws@^7.2.3: - version "7.3.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd" - integrity sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w== - -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - -y18n@^4.0.0: +yallist@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== - -yargs-parser@18.x, yargs-parser@^18.1.1: - version "18.1.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.2.tgz#2f482bea2136dbde0861683abea7756d30b504f1" - integrity sha512-hlIPNR3IzC1YuL1c2UwwDKpXlNFBqD1Fswwh1khz5+d8Cq/8yc/Mn0i+rQXduu8hcrFKvO7Eryk+09NecTQAAQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs@^15.3.1: - version "15.3.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b" - integrity sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA== - dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== From b0a5773e1d8d131ccf309c59da404ad1f1a8d452 Mon Sep 17 00:00:00 2001 From: Hudson Prestidge <110430352+hudson-mattr@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:07:40 +1300 Subject: [PATCH 10/17] build(deps): bump minimatch (#11) --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 806bcad49..a9ab5b86d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -556,16 +556,16 @@ mime-types@^2.1.12: mime-db "1.40.0" minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + version "3.1.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== dependencies: brace-expansion "^1.1.7" minimatch@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" - integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + version "5.1.9" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.9.tgz#1293ef15db0098b394540e8f9f744f9fda8dee4b" + integrity sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw== dependencies: brace-expansion "^2.0.1" From f3d0ce6551e3137d21cc2bc80f4cc20b429225fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:42:48 +1100 Subject: [PATCH 11/17] Bump rollup from 2.79.2 to 2.80.0 (#10) Bumps [rollup](https://github.com/rollup/rollup) from 2.79.2 to 2.80.0. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/v2.80.0/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.79.2...v2.80.0) --- updated-dependencies: - dependency-name: rollup dependency-version: 2.80.0 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 9d0190e5c..a92956b75 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "node-fetch": "^2.6.7", "prettier": "^2.8.8", "rimraf": "^3.0.2", - "rollup": "2.79.2", + "rollup": "2.80.0", "rollup-plugin-terser": "^6.1.0", "ttypescript": "^1.5.15", "typescript": "^3.9.5" diff --git a/yarn.lock b/yarn.lock index a9ab5b86d..15f78f194 100644 --- a/yarn.lock +++ b/yarn.lock @@ -569,11 +569,6 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -707,10 +702,10 @@ rollup-plugin-terser@^6.1.0: serialize-javascript "^3.0.0" terser "^4.7.0" -rollup@2.79.2: - version "2.79.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" - integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== +rollup@2.80.0: + version "2.80.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.80.0.tgz#a82efc15b748e986a7c76f0f771221b1fa108a2c" + integrity sha512-cIFJOD1DESzpjOBl763Kp1AH7UE/0fcdHe6rZXUdQ9c50uvgigvW97u3IcSeBwOkgqL/PXPBktBCh0KEu5L8XQ== optionalDependencies: fsevents "~2.3.2" @@ -738,7 +733,7 @@ serialize-javascript@^3.0.0: dependencies: randombytes "^2.1.0" -shelljs@^0.8.3, shelljs@^0.8.5: +shelljs@^0.8.3: version "0.8.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== From 143c13003095ba26ed04246830f847c703a303bb Mon Sep 17 00:00:00 2001 From: Ken Huang <205194+kenhuang@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:57:38 +1100 Subject: [PATCH 12/17] chore: update serialize-javascript to version 7.0.4 and remove unused dependencies (#12) --- yarn.lock | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/yarn.lock b/yarn.lock index 15f78f194..8088795ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -635,13 +635,6 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - readable-stream@^2.2.2: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -709,11 +702,6 @@ rollup@2.80.0: optionalDependencies: fsevents "~2.3.2" -safe-buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -727,11 +715,9 @@ semver@^7.3.2: lru-cache "^6.0.0" serialize-javascript@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-3.1.0.tgz#8bf3a9170712664ef2561b44b691eafe399214ea" - integrity sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg== - dependencies: - randombytes "^2.1.0" + version "7.0.4" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.0.4.tgz#c517735bd5b7631dd1fc191ee19cbb713ff8e05c" + integrity sha512-DuGdB+Po43Q5Jxwpzt1lhyFSYKryqoNjQSA9M92tyw0lyHIOur+XCalOUe0KTJpyqzT8+fQ5A0Jf7vCx/NKmIg== shelljs@^0.8.3: version "0.8.5" From f532f561787587537d5ae0cc0529385cdd78144a Mon Sep 17 00:00:00 2001 From: Ken Huang <205194+kenhuang@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:37:22 +1100 Subject: [PATCH 13/17] chore: bump serialize javascript (#13) * chore: update serialize-javascript to version 7.0.4 and remove unused dependencies * chore: update serialize-javascript to version 3.1.0 and add resolutions for dependencies --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index a92956b75..b6ba954e1 100644 --- a/package.json +++ b/package.json @@ -131,5 +131,8 @@ "directories": { "doc": "docs", "test": "tests" + }, + "resolutions": { + "**/**/serialize-javascript": "7.0.4" } } From d2a9ee29bc816604b90521b628ec33abc74fc184 Mon Sep 17 00:00:00 2001 From: Ken Huang <205194+kenhuang@users.noreply.github.com> Date: Fri, 13 Mar 2026 06:48:08 +1100 Subject: [PATCH 14/17] chore: fix tests (#14) * chore: update serialize-javascript to version 3.1.0 and add resolutions for dependencies * chore: fixed tests * chore: add CI workflow for testing and disable labeler jobs * chore: add CI workflow for testing and disable labeler jobs * chore: add CI workflow for testing and disable labeler jobs * Potential fix for code scanning alert no. 6: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: update permissions in CI workflow for pull requests --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/any-pr.yml | 35 + .github/workflows/pr-labeler.yml | 1 + .github/workflows/sponsors.yml | 1 + jest.json | 4 +- package.json | 7 +- src/api/form/appearances.ts | 2 +- src/core/streams/LZWStream.ts | 2 +- src/utils/png.ts | 7 +- tests/api/PDFDocument.spec.ts | 4 +- tests/api/PDFImage.spec.ts | 4 +- tsconfig.json | 1 + yarn.lock | 2249 +++++++++++++++++++++++++++++- 12 files changed, 2290 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/any-pr.yml diff --git a/.github/workflows/any-pr.yml b/.github/workflows/any-pr.yml new file mode 100644 index 000000000..96d1436d0 --- /dev/null +++ b/.github/workflows/any-pr.yml @@ -0,0 +1,35 @@ +name: any-pr +on: [pull_request] + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + permissions: + contents: read + pull-requests: write + + strategy: + matrix: + node-version: [22.x] + + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # pin@v5.0.0 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run tests + run: yarn test diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 6dcefa34b..eb839083b 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -6,6 +6,7 @@ on: jobs: triage: + if: false runs-on: ubuntu-latest steps: - uses: actions/labeler@v3 diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml index eb790d72e..295c7180c 100644 --- a/.github/workflows/sponsors.yml +++ b/.github/workflows/sponsors.yml @@ -8,6 +8,7 @@ on: types: [opened] jobs: build: + if: false name: is-sponsor-label runs-on: ubuntu-latest steps: diff --git a/jest.json b/jest.json index 75c7dbf24..3ed884c2b 100644 --- a/jest.json +++ b/jest.json @@ -1,10 +1,12 @@ { - "preset": "ts-jest", "testEnvironment": "node", "coverageReporters": ["html"], "testMatch": ["/tests/**/*.spec.ts"], "roots": ["src", "tests"], "moduleNameMapper": { "^src/(.*)$": "/src/$1" + }, + "transform": { + "^.+\\.tsx?$": ["ts-jest", { "diagnostics": false }] } } diff --git a/package.json b/package.json index b6ba954e1..6e159f753 100644 --- a/package.json +++ b/package.json @@ -84,25 +84,28 @@ "@pdf-lib/standard-fonts": "^1.0.0", "@pdf-lib/upng": "^1.0.1", "pako": "^1.0.11", - "tslib": "^1.11.1" + "tslib": "^2.0.0" }, "devDependencies": { "@pdf-lib/fontkit": "^1.1.0", "@rollup/plugin-commonjs": "^23.0.2", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^14.1.0", + "@types/jest": "^30.0.0", "@types/node-fetch": "^2.6.13", "@types/pako": "^1.0.1", "@zerollup/ts-transform-paths": "^1.7.18", "downlevel-dts": "^0.11.0", "flamebearer": "^1.1.3", + "jest": "30.3.0", "node-fetch": "^2.6.7", "prettier": "^2.8.8", "rimraf": "^3.0.2", "rollup": "2.80.0", "rollup-plugin-terser": "^6.1.0", + "ts-jest": "29.4.6", "ttypescript": "^1.5.15", - "typescript": "^3.9.5" + "typescript": "^5.0.0" }, "license": "MIT", "private": false, diff --git a/src/api/form/appearances.ts b/src/api/form/appearances.ts index 4047a9142..272d74c2d 100644 --- a/src/api/form/appearances.ts +++ b/src/api/form/appearances.ts @@ -102,7 +102,7 @@ export type AppearanceProviderFor = /********************* Appearance Provider Functions **************************/ -export const normalizeAppearance = ( +export const normalizeAppearance = ( appearance: T | AppearanceMapping, ): AppearanceMapping => { if ('normal' in appearance) return appearance; diff --git a/src/core/streams/LZWStream.ts b/src/core/streams/LZWStream.ts index c18738a47..d6940e35b 100644 --- a/src/core/streams/LZWStream.ts +++ b/src/core/streams/LZWStream.ts @@ -13,7 +13,7 @@ class LZWStream extends DecodeStream { private stream: StreamType; private cachedData: number; private bitsCached: number; - private lzwState: { + private lzwState?: { earlyChange: 0 | 1; codeLength: number; nextCode: number; diff --git a/src/utils/png.ts b/src/utils/png.ts index 60aad74e5..f293057af 100644 --- a/src/utils/png.ts +++ b/src/utils/png.ts @@ -48,7 +48,12 @@ export class PNG { readonly bitsPerComponent: number; private constructor(pngData: Uint8Array) { - const upng = UPNG.decode(pngData); + const upng = UPNG.decode( + pngData.buffer.slice( + pngData.byteOffset, + pngData.byteOffset + pngData.byteLength, + ) as ArrayBuffer, + ); const frames = UPNG.toRGBA8(upng); if (frames.length > 1) throw new Error(`Animated PNGs are not supported`); diff --git a/tests/api/PDFDocument.spec.ts b/tests/api/PDFDocument.spec.ts index d1cacbae4..6cc0b7d41 100644 --- a/tests/api/PDFDocument.spec.ts +++ b/tests/api/PDFDocument.spec.ts @@ -489,7 +489,7 @@ describe(`PDFDocument`, () => { pdfDoc.setTitle('Unit Test'); }; - await expect(noErrorFunc()).resolves.not.toThrowError(); + await expect(noErrorFunc()).resolves.not.toThrow(); }); }); @@ -524,7 +524,7 @@ describe(`PDFDocument`, () => { expect(pdfBytes3.byteLength).not.toEqual(pdfBytes2.byteLength); }; - await expect(noErrorFunc()).resolves.not.toThrowError(); + await expect(noErrorFunc()).resolves.not.toThrow(); }); }); diff --git a/tests/api/PDFImage.spec.ts b/tests/api/PDFImage.spec.ts index 5ed03b63d..2d1a31344 100644 --- a/tests/api/PDFImage.spec.ts +++ b/tests/api/PDFImage.spec.ts @@ -29,8 +29,8 @@ describe(`PDFImage`, () => { const ref = pdfDoc.context.nextRef(); const pdfImage = PDFImage.of(ref, pdfDoc, embedder); - await expect(pdfImage.embed()).resolves.not.toThrowError(); - await expect(pdfImage.embed()).resolves.not.toThrowError(); + await expect(pdfImage.embed()).resolves.not.toThrow(); + await expect(pdfImage.embed()).resolves.not.toThrow(); }); it(`may be called in parallel without causing an error`, async () => { diff --git a/tsconfig.json b/tsconfig.json index 21f2d02cf..ad0238de7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -37,6 +37,7 @@ "esModuleInterop": true, "preserveSymlinks": true, "moduleResolution": "node", + "skipLibCheck": true, /* Plugins */ "plugins": [{ "transform": "@zerollup/ts-transform-paths" }] diff --git a/yarn.lock b/yarn.lock index 8088795ab..0c3153c10 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,15 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.27.1", "@babel/code-frame@^7.28.6", "@babel/code-frame@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.0.tgz#7cd7a59f15b3cc0dcd803038f7792712a7d0b15c" + integrity sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw== + dependencies: + "@babel/helper-validator-identifier" "^7.28.5" + js-tokens "^4.0.0" + picocolors "^1.1.1" + "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" @@ -9,11 +18,109 @@ dependencies: "@babel/highlight" "^7.8.3" +"@babel/compat-data@^7.28.6": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.0.tgz#00d03e8c0ac24dd9be942c5370990cbe1f17d88d" + integrity sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg== + +"@babel/core@^7.23.9", "@babel/core@^7.27.4": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.0.tgz#5286ad785df7f79d656e88ce86e650d16ca5f322" + integrity sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA== + dependencies: + "@babel/code-frame" "^7.29.0" + "@babel/generator" "^7.29.0" + "@babel/helper-compilation-targets" "^7.28.6" + "@babel/helper-module-transforms" "^7.28.6" + "@babel/helpers" "^7.28.6" + "@babel/parser" "^7.29.0" + "@babel/template" "^7.28.6" + "@babel/traverse" "^7.29.0" + "@babel/types" "^7.29.0" + "@jridgewell/remapping" "^2.3.5" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.27.5", "@babel/generator@^7.29.0": + version "7.29.1" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.1.tgz#d09876290111abbb00ef962a7b83a5307fba0d50" + integrity sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw== + dependencies: + "@babel/parser" "^7.29.0" + "@babel/types" "^7.29.0" + "@jridgewell/gen-mapping" "^0.3.12" + "@jridgewell/trace-mapping" "^0.3.28" + jsesc "^3.0.2" + +"@babel/helper-compilation-targets@^7.28.6": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz#32c4a3f41f12ed1532179b108a4d746e105c2b25" + integrity sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA== + dependencies: + "@babel/compat-data" "^7.28.6" + "@babel/helper-validator-option" "^7.27.1" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-globals@^7.28.0": + version "7.28.0" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" + integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== + +"@babel/helper-module-imports@^7.28.6": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz#60632cbd6ffb70b22823187201116762a03e2d5c" + integrity sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw== + dependencies: + "@babel/traverse" "^7.28.6" + "@babel/types" "^7.28.6" + +"@babel/helper-module-transforms@^7.28.6": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz#9312d9d9e56edc35aeb6e95c25d4106b50b9eb1e" + integrity sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA== + dependencies: + "@babel/helper-module-imports" "^7.28.6" + "@babel/helper-validator-identifier" "^7.28.5" + "@babel/traverse" "^7.28.6" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.28.6", "@babel/helper-plugin-utils@^7.8.0": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz#6f13ea251b68c8532e985fd532f28741a8af9ac8" + integrity sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug== + +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== + +"@babel/helper-validator-identifier@^7.28.5": + version "7.28.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" + integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== + "@babel/helper-validator-identifier@^7.9.0": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g== +"@babel/helper-validator-option@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" + integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== + +"@babel/helpers@^7.28.6": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.6.tgz#fca903a313ae675617936e8998b814c415cbf5d7" + integrity sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw== + dependencies: + "@babel/template" "^7.28.6" + "@babel/types" "^7.28.6" + "@babel/highlight@^7.8.3": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" @@ -23,11 +130,478 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@jridgewell/sourcemap-codec@^1.4.13": +"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.28.6", "@babel/parser@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.0.tgz#669ef345add7d057e92b7ed15f0bac07611831b6" + integrity sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww== + dependencies: + "@babel/types" "^7.29.0" + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-class-static-block@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-import-attributes@^7.24.7": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz#b71d5914665f60124e133696f17cd7669062c503" + integrity sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw== + dependencies: + "@babel/helper-plugin-utils" "^7.28.6" + +"@babel/plugin-syntax-import-meta@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-jsx@^7.27.1": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz#f8ca28bbd84883b5fea0e447c635b81ba73997ee" + integrity sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w== + dependencies: + "@babel/helper-plugin-utils" "^7.28.6" + +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-private-property-in-object@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-top-level-await@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.27.1": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz#c7b2ddf1d0a811145b1de800d1abd146af92e3a2" + integrity sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A== + dependencies: + "@babel/helper-plugin-utils" "^7.28.6" + +"@babel/template@^7.28.6": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.28.6.tgz#0e7e56ecedb78aeef66ce7972b082fce76a23e57" + integrity sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ== + dependencies: + "@babel/code-frame" "^7.28.6" + "@babel/parser" "^7.28.6" + "@babel/types" "^7.28.6" + +"@babel/traverse@^7.28.6", "@babel/traverse@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.0.tgz#f323d05001440253eead3c9c858adbe00b90310a" + integrity sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA== + dependencies: + "@babel/code-frame" "^7.29.0" + "@babel/generator" "^7.29.0" + "@babel/helper-globals" "^7.28.0" + "@babel/parser" "^7.29.0" + "@babel/template" "^7.28.6" + "@babel/types" "^7.29.0" + debug "^4.3.1" + +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.6", "@babel/types@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.0.tgz#9f5b1e838c446e72cf3cd4b918152b8c605e37c7" + integrity sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A== + dependencies: + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.28.5" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@emnapi/core@^1.4.3": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.8.1.tgz#fd9efe721a616288345ffee17a1f26ac5dd01349" + integrity sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg== + dependencies: + "@emnapi/wasi-threads" "1.1.0" + tslib "^2.4.0" + +"@emnapi/runtime@^1.4.3": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.8.1.tgz#550fa7e3c0d49c5fb175a116e8cd70614f9a22a5" + integrity sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz#60b2102fddc9ccb78607e4a3cf8403ea69be41bf" + integrity sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ== + dependencies: + tslib "^2.4.0" + +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.3.0.tgz#42ccc3f995d400a8fe35b8850cfe10a8d4804cdf" + integrity sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww== + dependencies: + "@jest/types" "30.3.0" + "@types/node" "*" + chalk "^4.1.2" + jest-message-util "30.3.0" + jest-util "30.3.0" + slash "^3.0.0" + +"@jest/core@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.3.0.tgz#d06bb8456f35350f6494fd2405bcec4abb97b994" + integrity sha512-U5mVPsBxLSO6xYbf+tgkymLx+iAhvZX43/xI1+ej2ZOPnPdkdO1CzDmFKh2mZBn2s4XZixszHeQnzp1gm/DIxw== + dependencies: + "@jest/console" "30.3.0" + "@jest/pattern" "30.0.1" + "@jest/reporters" "30.3.0" + "@jest/test-result" "30.3.0" + "@jest/transform" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + ansi-escapes "^4.3.2" + chalk "^4.1.2" + ci-info "^4.2.0" + exit-x "^0.2.2" + graceful-fs "^4.2.11" + jest-changed-files "30.3.0" + jest-config "30.3.0" + jest-haste-map "30.3.0" + jest-message-util "30.3.0" + jest-regex-util "30.0.1" + jest-resolve "30.3.0" + jest-resolve-dependencies "30.3.0" + jest-runner "30.3.0" + jest-runtime "30.3.0" + jest-snapshot "30.3.0" + jest-util "30.3.0" + jest-validate "30.3.0" + jest-watcher "30.3.0" + pretty-format "30.3.0" + slash "^3.0.0" + +"@jest/diff-sequences@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.3.0.tgz#25b0818d3d83f00b9c7b04e069b8810f9014b143" + integrity sha512-cG51MVnLq1ecVUaQ3fr6YuuAOitHK1S4WUJHnsPFE/quQr33ADUx1FfrTCpMCRxvy0Yr9BThKpDjSlcTi91tMA== + +"@jest/environment@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.3.0.tgz#b0657c2944b6ef3352f7b25903cc3a23e6ab70f6" + integrity sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw== + dependencies: + "@jest/fake-timers" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + jest-mock "30.3.0" + +"@jest/expect-utils@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.3.0.tgz#c45b2da9802ffed33bf43b3e019ddb95e5ad95e8" + integrity sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA== + dependencies: + "@jest/get-type" "30.1.0" + +"@jest/expect@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.3.0.tgz#08ee7f5b610167b0068743246c0b568f4c40c773" + integrity sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg== + dependencies: + expect "30.3.0" + jest-snapshot "30.3.0" + +"@jest/fake-timers@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.3.0.tgz#2b2868130c1d28233a79566874c42cae1c5a70bc" + integrity sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ== + dependencies: + "@jest/types" "30.3.0" + "@sinonjs/fake-timers" "^15.0.0" + "@types/node" "*" + jest-message-util "30.3.0" + jest-mock "30.3.0" + jest-util "30.3.0" + +"@jest/get-type@30.1.0": + version "30.1.0" + resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.1.0.tgz#4fcb4dc2ebcf0811be1c04fd1cb79c2dba431cbc" + integrity sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA== + +"@jest/globals@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.3.0.tgz#40f4c90e5602629ecda1ca773a8fb21575bb64ea" + integrity sha512-+owLCBBdfpgL3HU+BD5etr1SvbXpSitJK0is1kiYjJxAAJggYMRQz5hSdd5pq1sSggfxPbw2ld71pt4x5wwViA== + dependencies: + "@jest/environment" "30.3.0" + "@jest/expect" "30.3.0" + "@jest/types" "30.3.0" + jest-mock "30.3.0" + +"@jest/pattern@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.1.tgz#d5304147f49a052900b4b853dedb111d080e199f" + integrity sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA== + dependencies: + "@types/node" "*" + jest-regex-util "30.0.1" + +"@jest/reporters@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.3.0.tgz#0c1065f6c892665e5a051df22b19df4466ed816b" + integrity sha512-a09z89S+PkQnL055bVj8+pe2Caed2PBOaczHcXCykW5ngxX9EWx/1uAwncxc/HiU0oZqfwseMjyhxgRjS49qPw== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "30.3.0" + "@jest/test-result" "30.3.0" + "@jest/transform" "30.3.0" + "@jest/types" "30.3.0" + "@jridgewell/trace-mapping" "^0.3.25" + "@types/node" "*" + chalk "^4.1.2" + collect-v8-coverage "^1.0.2" + exit-x "^0.2.2" + glob "^10.5.0" + graceful-fs "^4.2.11" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^5.0.0" + istanbul-reports "^3.1.3" + jest-message-util "30.3.0" + jest-util "30.3.0" + jest-worker "30.3.0" + slash "^3.0.0" + string-length "^4.0.2" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@30.0.5": + version "30.0.5" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.5.tgz#7bdf69fc5a368a5abdb49fd91036c55225846473" + integrity sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA== + dependencies: + "@sinclair/typebox" "^0.34.0" + +"@jest/snapshot-utils@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.3.0.tgz#ca003c91a3e1e4e4956dee716a2aaf04b6707f31" + integrity sha512-ORbRN9sf5PP82v3FXNSwmO1OTDR2vzR2YTaR+E3VkSBZ8zadQE6IqYdYEeFH1NIkeB2HIGdF02dapb6K0Mj05g== + dependencies: + "@jest/types" "30.3.0" + chalk "^4.1.2" + graceful-fs "^4.2.11" + natural-compare "^1.4.0" + +"@jest/source-map@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-30.0.1.tgz#305ebec50468f13e658b3d5c26f85107a5620aaa" + integrity sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg== + dependencies: + "@jridgewell/trace-mapping" "^0.3.25" + callsites "^3.1.0" + graceful-fs "^4.2.11" + +"@jest/test-result@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.3.0.tgz#cd8882d683d467fcffb98c09501a65687a76aae9" + integrity sha512-e/52nJGuD74AKTSe0P4y5wFRlaXP0qmrS17rqOMHeSwm278VyNyXE3gFO/4DTGF9w+65ra3lo3VKj0LBrzmgdQ== + dependencies: + "@jest/console" "30.3.0" + "@jest/types" "30.3.0" + "@types/istanbul-lib-coverage" "^2.0.6" + collect-v8-coverage "^1.0.2" + +"@jest/test-sequencer@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.3.0.tgz#27002b2093f4e0d9e0e1ebb0bc274a242fdadc14" + integrity sha512-dgbWy9b8QDlQeRZcv7LNF+/jFiiYHTKho1xirauZ7kVwY7avjFF6uTT0RqlgudB5OuIPagFdVtfFMosjVbk1eA== + dependencies: + "@jest/test-result" "30.3.0" + graceful-fs "^4.2.11" + jest-haste-map "30.3.0" + slash "^3.0.0" + +"@jest/transform@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.3.0.tgz#9e6f78ffa205449bf956e269fd707c160f47ce2f" + integrity sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A== + dependencies: + "@babel/core" "^7.27.4" + "@jest/types" "30.3.0" + "@jridgewell/trace-mapping" "^0.3.25" + babel-plugin-istanbul "^7.0.1" + chalk "^4.1.2" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.11" + jest-haste-map "30.3.0" + jest-regex-util "30.0.1" + jest-util "30.3.0" + pirates "^4.0.7" + slash "^3.0.0" + write-file-atomic "^5.0.1" + +"@jest/types@30.3.0": + version "30.3.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.3.0.tgz#cada800d323cb74945c24ac74615fdb312a6c85f" + integrity sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw== + dependencies: + "@jest/pattern" "30.0.1" + "@jest/schemas" "30.0.5" + "@types/istanbul-lib-coverage" "^2.0.6" + "@types/istanbul-reports" "^3.0.4" + "@types/node" "*" + "@types/yargs" "^17.0.33" + chalk "^4.1.2" + +"@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": + version "0.3.13" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f" + integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.0" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/remapping@^2.3.5": + version "2.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1" + integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": version "1.5.5" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25", "@jridgewell/trace-mapping@^0.3.28": + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@napi-rs/wasm-runtime@^0.2.11": + version "0.2.12" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz#3e78a8b96e6c33a6c517e1894efbd5385a7cb6f2" + integrity sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ== + dependencies: + "@emnapi/core" "^1.4.3" + "@emnapi/runtime" "^1.4.3" + "@tybys/wasm-util" "^0.10.0" + "@pdf-lib/fontkit@^1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@pdf-lib/fontkit/-/fontkit-1.1.1.tgz#f18473892b65e3253eb73f4569785abd2c03b1e0" @@ -49,6 +623,16 @@ dependencies: pako "^1.0.10" +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + +"@pkgr/core@^0.2.9": + version "0.2.9" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.9.tgz#d229a7b7f9dac167a156992ef23c7f023653f53b" + integrity sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA== + "@rollup/plugin-commonjs@^23.0.2": version "23.0.7" resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-23.0.7.tgz#7d26d879caa54283086de1974b66f512ef60abdc" @@ -98,6 +682,65 @@ estree-walker "^2.0.2" picomatch "^4.0.2" +"@sinclair/typebox@^0.34.0": + version "0.34.48" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.48.tgz#75b0ead87e59e1adbd6dccdc42bad4fddee73b59" + integrity sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA== + +"@sinonjs/commons@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^15.0.0": + version "15.1.1" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-15.1.1.tgz#e1a6f7171941aadcc31d2cea1744264d58b8b34c" + integrity sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw== + dependencies: + "@sinonjs/commons" "^3.0.1" + +"@tybys/wasm-util@^0.10.0": + version "0.10.1" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.1.tgz#ecddd3205cf1e2d5274649ff0eedd2991ed7f414" + integrity sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg== + dependencies: + tslib "^2.4.0" + +"@types/babel__core@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== + dependencies: + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.27.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.27.0.tgz#b5819294c51179957afaec341442f9341e4108a9" + integrity sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*": + version "7.28.0" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz#07d713d6cce0d265c9849db0cbe62d3f61f36f74" + integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== + dependencies: + "@babel/types" "^7.28.2" + "@types/estree@*", "@types/estree@^1.0.0": version "1.0.8" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" @@ -108,6 +751,33 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-30.0.0.tgz#5e85ae568006712e4ad66f25433e9bdac8801f1d" + integrity sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA== + dependencies: + expect "^30.0.0" + pretty-format "^30.0.0" + "@types/node-fetch@^2.6.13": version "2.6.13" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.13.tgz#e0c9b7b5edbdb1b50ce32c127e85e880872d56ee" @@ -133,6 +803,125 @@ dependencies: "@types/node" "*" +"@types/stack-utils@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== + +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.33": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== + dependencies: + "@types/yargs-parser" "*" + +"@ungap/structured-clone@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" + integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== + +"@unrs/resolver-binding-android-arm-eabi@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.11.1.tgz#9f5b04503088e6a354295e8ea8fe3cb99e43af81" + integrity sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw== + +"@unrs/resolver-binding-android-arm64@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.11.1.tgz#7414885431bd7178b989aedc4d25cccb3865bc9f" + integrity sha512-lCxkVtb4wp1v+EoN+HjIG9cIIzPkX5OtM03pQYkG+U5O/wL53LC4QbIeazgiKqluGeVEeBlZahHalCaBvU1a2g== + +"@unrs/resolver-binding-darwin-arm64@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.11.1.tgz#b4a8556f42171fb9c9f7bac8235045e82aa0cbdf" + integrity sha512-gPVA1UjRu1Y/IsB/dQEsp2V1pm44Of6+LWvbLc9SDk1c2KhhDRDBUkQCYVWe6f26uJb3fOK8saWMgtX8IrMk3g== + +"@unrs/resolver-binding-darwin-x64@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.11.1.tgz#fd4d81257b13f4d1a083890a6a17c00de571f0dc" + integrity sha512-cFzP7rWKd3lZaCsDze07QX1SC24lO8mPty9vdP+YVa3MGdVgPmFc59317b2ioXtgCMKGiCLxJ4HQs62oz6GfRQ== + +"@unrs/resolver-binding-freebsd-x64@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.11.1.tgz#d2513084d0f37c407757e22f32bd924a78cfd99b" + integrity sha512-fqtGgak3zX4DCB6PFpsH5+Kmt/8CIi4Bry4rb1ho6Av2QHTREM+47y282Uqiu3ZRF5IQioJQ5qWRV6jduA+iGw== + +"@unrs/resolver-binding-linux-arm-gnueabihf@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.11.1.tgz#844d2605d057488d77fab09705f2866b86164e0a" + integrity sha512-u92mvlcYtp9MRKmP+ZvMmtPN34+/3lMHlyMj7wXJDeXxuM0Vgzz0+PPJNsro1m3IZPYChIkn944wW8TYgGKFHw== + +"@unrs/resolver-binding-linux-arm-musleabihf@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.11.1.tgz#204892995cefb6bd1d017d52d097193bc61ddad3" + integrity sha512-cINaoY2z7LVCrfHkIcmvj7osTOtm6VVT16b5oQdS4beibX2SYBwgYLmqhBjA1t51CarSaBuX5YNsWLjsqfW5Cw== + +"@unrs/resolver-binding-linux-arm64-gnu@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.11.1.tgz#023eb0c3aac46066a10be7a3f362e7b34f3bdf9d" + integrity sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ== + +"@unrs/resolver-binding-linux-arm64-musl@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.11.1.tgz#9e6f9abb06424e3140a60ac996139786f5d99be0" + integrity sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w== + +"@unrs/resolver-binding-linux-ppc64-gnu@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.11.1.tgz#b111417f17c9d1b02efbec8e08398f0c5527bb44" + integrity sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA== + +"@unrs/resolver-binding-linux-riscv64-gnu@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.11.1.tgz#92ffbf02748af3e99873945c9a8a5ead01d508a9" + integrity sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ== + +"@unrs/resolver-binding-linux-riscv64-musl@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.11.1.tgz#0bec6f1258fc390e6b305e9ff44256cb207de165" + integrity sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew== + +"@unrs/resolver-binding-linux-s390x-gnu@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.11.1.tgz#577843a084c5952f5906770633ccfb89dac9bc94" + integrity sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg== + +"@unrs/resolver-binding-linux-x64-gnu@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.11.1.tgz#36fb318eebdd690f6da32ac5e0499a76fa881935" + integrity sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w== + +"@unrs/resolver-binding-linux-x64-musl@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.11.1.tgz#bfb9af75f783f98f6a22c4244214efe4df1853d6" + integrity sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA== + +"@unrs/resolver-binding-wasm32-wasi@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.11.1.tgz#752c359dd875684b27429500d88226d7cc72f71d" + integrity sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ== + dependencies: + "@napi-rs/wasm-runtime" "^0.2.11" + +"@unrs/resolver-binding-win32-arm64-msvc@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.11.1.tgz#ce5735e600e4c2fbb409cd051b3b7da4a399af35" + integrity sha512-nRcz5Il4ln0kMhfL8S3hLkxI85BXs3o8EYoattsJNdsX4YUU89iOkVn7g0VHSRxFuVMdM4Q1jEpIId1Ihim/Uw== + +"@unrs/resolver-binding-win32-ia32-msvc@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.11.1.tgz#72fc57bc7c64ec5c3de0d64ee0d1810317bc60a6" + integrity sha512-DCEI6t5i1NmAZp6pFonpD5m7i6aFrpofcp4LA2i8IIq60Jyo28hamKBxNrZcyOwVOZkgsRp9O2sXWBWP8MnvIQ== + +"@unrs/resolver-binding-win32-x64-msvc@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.11.1.tgz#538b1e103bf8d9864e7b85cc96fa8d6fb6c40777" + integrity sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g== + "@zerollup/ts-helpers@^1.7.18": version "1.7.18" resolved "https://registry.yarnpkg.com/@zerollup/ts-helpers/-/ts-helpers-1.7.18.tgz#747177f6d5abc06c3a0f5dffe7362d365cf0391d" @@ -147,6 +936,23 @@ dependencies: "@zerollup/ts-helpers" "^1.7.18" +ansi-escapes@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-regex@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.2.tgz#60216eea464d864597ce2832000738a0589650c1" + integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -154,16 +960,113 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +ansi-styles@^6.1.0: + version "6.2.3" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041" + integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg== + +anymatch@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +babel-jest@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.3.0.tgz#3ff5553fa3bcbb8738d2d7335a4dbdc3bd1a0eb5" + integrity sha512-gRpauEU2KRrCox5Z296aeVHR4jQ98BCnu0IO332D/xpHNOsIH/bgSRk9k6GbKIbBw8vFeN6ctuu6tV8WOyVfYQ== + dependencies: + "@jest/transform" "30.3.0" + "@types/babel__core" "^7.20.5" + babel-plugin-istanbul "^7.0.1" + babel-preset-jest "30.3.0" + chalk "^4.1.2" + graceful-fs "^4.2.11" + slash "^3.0.0" + +babel-plugin-istanbul@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.1.tgz#d8b518c8ea199364cf84ccc82de89740236daf92" + integrity sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-instrument "^6.0.2" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.3.0.tgz#235ad714a45c18b12566becf439e1c604e277015" + integrity sha512-+TRkByhsws6sfPjVaitzadk1I0F5sPvOVUH5tyTSzhePpsGIVrdeunHSw/C36QeocS95OOk8lunc4rlu5Anwsg== + dependencies: + "@types/babel__core" "^7.20.5" + +babel-preset-current-node-syntax@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6" + integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + +babel-preset-jest@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-30.3.0.tgz#21cf3d19a6f5e9924426c879ee0b7f092636d043" + integrity sha512-6ZcUbWHC+dMz2vfzdNwi87Z1gQsLNK2uLuK1Q89R11xdvejcivlYYwDlEv0FHX3VwEXpbBQ9uufB/MUNpZGfhQ== + dependencies: + babel-plugin-jest-hoist "30.3.0" + babel-preset-current-node-syntax "^1.2.0" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +baseline-browser-mapping@^2.9.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz#5b09935025bf8a80e29130251e337c6a7fc8cbb9" + integrity sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA== + brace-expansion@^1.1.7: version "1.1.12" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" @@ -172,13 +1075,38 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -brace-expansion@^2.0.1: +brace-expansion@^2.0.1, brace-expansion@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== dependencies: balanced-match "^1.0.0" +browserslist@^4.24.0: + version "4.28.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.1.tgz#7f534594628c53c63101079e27e40de490456a95" + integrity sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA== + dependencies: + baseline-browser-mapping "^2.9.0" + caniuse-lite "^1.0.30001759" + electron-to-chromium "^1.5.263" + node-releases "^2.0.27" + update-browserslist-db "^1.2.0" + +bs-logger@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -197,6 +1125,26 @@ call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: es-errors "^1.3.0" function-bind "^1.1.2" +callsites@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001759: + version "1.0.30001777" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001777.tgz#028f21e4b2718d138b55e692583e6810ccf60691" + integrity sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ== + chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -206,6 +1154,48 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +ci-info@^4.2.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.4.0.tgz#7d54eff9f54b45b62401c26032696eb59c8bd18c" + integrity sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg== + +cjs-module-lexer@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz#b3ca5101843389259ade7d88c77bd06ce55849ca" + integrity sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ== + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +collect-v8-coverage@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz#cc1f01eb8d02298cbc9a437c74c70ab4e5210b80" + integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -213,11 +1203,23 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -250,21 +1252,57 @@ concat-stream@^1.6.2: readable-stream "^2.2.2" typedarray "^0.0.6" +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +cross-spawn@^7.0.3, cross-spawn@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== + dependencies: + ms "^2.1.3" + +dedent@^1.6.0: + version "1.7.2" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.2.tgz#34e2264ab538301e27cf7b07bf2369c19baa8dd9" + integrity sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA== + deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== +deepmerge@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= +detect-newline@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + downlevel-dts@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.11.0.tgz#514a2d723009c5845730c1db6c994484c596ed9c" @@ -283,6 +1321,38 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + +electron-to-chromium@^1.5.263: + version "1.5.307" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.307.tgz#09f8973100c39fb0d003b890393cd1d58932b1c8" + integrity sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + +error-ex@^1.3.1: + version "1.3.4" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414" + integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== + dependencies: + is-arrayish "^0.2.1" + es-define-property@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" @@ -310,11 +1380,26 @@ es-set-tostringtag@^2.1.0: has-tostringtag "^1.0.2" hasown "^2.0.2" +escalade@^3.1.1, escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + estree-walker@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" @@ -325,6 +1410,58 @@ estree-walker@^2.0.2: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== +execa@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit-x@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/exit-x/-/exit-x-0.2.2.tgz#1f9052de3b8d99a696b10dad5bced9bdd5c3aa64" + integrity sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ== + +expect@30.3.0, expect@^30.0.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.3.0.tgz#1b82111517d1ab030f3db0cf1b4061c8aa644f61" + integrity sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q== + dependencies: + "@jest/expect-utils" "30.3.0" + "@jest/get-type" "30.1.0" + jest-matcher-utils "30.3.0" + jest-message-util "30.3.0" + jest-mock "30.3.0" + jest-util "30.3.0" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fb-watchman@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + flamebearer@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/flamebearer/-/flamebearer-1.1.3.tgz#aac0cb56305e1af2b16528aca649c76103f75c08" @@ -333,6 +1470,14 @@ flamebearer@^1.1.3: concat-stream "^1.6.2" opn "^5.3.0" +foreground-child@^3.1.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" + integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== + dependencies: + cross-spawn "^7.0.6" + signal-exit "^4.0.1" + form-data@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" @@ -349,7 +1494,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@~2.3.2: +fsevents@^2.3.3, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -359,6 +1504,16 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + get-intrinsic@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" @@ -375,6 +1530,11 @@ get-intrinsic@^1.2.6: hasown "^2.0.2" math-intrinsics "^1.1.0" +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + get-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" @@ -383,6 +1543,23 @@ get-proto@^1.0.1: dunder-proto "^1.0.1" es-object-atoms "^1.0.0" +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +glob@^10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c" + integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + glob@^7.0.0: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" @@ -407,6 +1584,18 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.4: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^8.0.3: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" @@ -423,6 +1612,23 @@ gopd@^1.2.0: resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== +graceful-fs@^4.2.11: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +handlebars@^4.7.8: + version "4.7.8" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" + integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.2" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -452,6 +1658,29 @@ hasown@^2.0.2: dependencies: function-bind "^1.1.2" +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +import-local@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -470,6 +1699,11 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + is-builtin-module@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" @@ -484,6 +1718,16 @@ is-core-module@^2.16.0: dependencies: hasown "^2.0.2" +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" @@ -496,6 +1740,11 @@ is-reference@1.2.1: dependencies: "@types/estree" "*" +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + is-wsl@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" @@ -506,6 +1755,407 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + +istanbul-lib-instrument@^6.0.0, istanbul-lib-instrument@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^5.0.0: + version "5.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz#acaef948df7747c8eb5fbf1265cb980f6353a441" + integrity sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A== + dependencies: + "@jridgewell/trace-mapping" "^0.3.23" + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + +istanbul-reports@^3.1.3: + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" + integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + +jest-changed-files@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.3.0.tgz#055849df695f9a9fcde0ae44024f815bbc627f3a" + integrity sha512-B/7Cny6cV5At6M25EWDgf9S617lHivamL8vl6KEpJqkStauzcG4e+WPfDgMMF+H4FVH4A2PLRyvgDJan4441QA== + dependencies: + execa "^5.1.1" + jest-util "30.3.0" + p-limit "^3.1.0" + +jest-circus@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.3.0.tgz#153614c11ab35867f371bd93496ecb9690b92077" + integrity sha512-PyXq5szeSfR/4f1lYqCmmQjh0vqDkURUYi9N6whnHjlRz4IUQfMcXkGLeEoiJtxtyPqgUaUUfyQlApXWBSN1RA== + dependencies: + "@jest/environment" "30.3.0" + "@jest/expect" "30.3.0" + "@jest/test-result" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + chalk "^4.1.2" + co "^4.6.0" + dedent "^1.6.0" + is-generator-fn "^2.1.0" + jest-each "30.3.0" + jest-matcher-utils "30.3.0" + jest-message-util "30.3.0" + jest-runtime "30.3.0" + jest-snapshot "30.3.0" + jest-util "30.3.0" + p-limit "^3.1.0" + pretty-format "30.3.0" + pure-rand "^7.0.0" + slash "^3.0.0" + stack-utils "^2.0.6" + +jest-cli@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.3.0.tgz#5ed75a337f486a1f1c5acbb2de8acddb106ead6c" + integrity sha512-l6Tqx+j1fDXJEW5bqYykDQQ7mQg+9mhWXtnj+tQZrTWYHyHoi6Be8HPumDSA+UiX2/2buEgjA58iJzdj146uCw== + dependencies: + "@jest/core" "30.3.0" + "@jest/test-result" "30.3.0" + "@jest/types" "30.3.0" + chalk "^4.1.2" + exit-x "^0.2.2" + import-local "^3.2.0" + jest-config "30.3.0" + jest-util "30.3.0" + jest-validate "30.3.0" + yargs "^17.7.2" + +jest-config@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.3.0.tgz#b969e0aaaf5964419e62953bb712c16d15972425" + integrity sha512-WPMAkMAtNDY9P/oKObtsRG/6KTrhtgPJoBTmk20uDn4Uy6/3EJnnaZJre/FMT1KVRx8cve1r7/FlMIOfRVWL4w== + dependencies: + "@babel/core" "^7.27.4" + "@jest/get-type" "30.1.0" + "@jest/pattern" "30.0.1" + "@jest/test-sequencer" "30.3.0" + "@jest/types" "30.3.0" + babel-jest "30.3.0" + chalk "^4.1.2" + ci-info "^4.2.0" + deepmerge "^4.3.1" + glob "^10.5.0" + graceful-fs "^4.2.11" + jest-circus "30.3.0" + jest-docblock "30.2.0" + jest-environment-node "30.3.0" + jest-regex-util "30.0.1" + jest-resolve "30.3.0" + jest-runner "30.3.0" + jest-util "30.3.0" + jest-validate "30.3.0" + parse-json "^5.2.0" + pretty-format "30.3.0" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.3.0.tgz#e0a4c84ef350ffd790ffd5b0016acabeecf5f759" + integrity sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ== + dependencies: + "@jest/diff-sequences" "30.3.0" + "@jest/get-type" "30.1.0" + chalk "^4.1.2" + pretty-format "30.3.0" + +jest-docblock@30.2.0: + version "30.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-30.2.0.tgz#42cd98d69f887e531c7352309542b1ce4ee10256" + integrity sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA== + dependencies: + detect-newline "^3.1.0" + +jest-each@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.3.0.tgz#faa7229bf7a9fa6426dc604057a7d2a173493b1e" + integrity sha512-V8eMndg/aZ+3LnCJgSm13IxS5XSBM22QSZc9BtPK8Dek6pm+hfUNfwBdvsB3d342bo1q7wnSkC38zjX259qZNA== + dependencies: + "@jest/get-type" "30.1.0" + "@jest/types" "30.3.0" + chalk "^4.1.2" + jest-util "30.3.0" + pretty-format "30.3.0" + +jest-environment-node@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.3.0.tgz#aa8a57c5d0c4af0f8b1f7403ba737fec6b3aabbe" + integrity sha512-4i6HItw/JSiJVsC5q0hnKIe/hbYfZLVG9YJ/0pU9Hz2n/9qZe3Rhn5s5CUZA5ORZlcdT/vmAXRMyONXJwPrmYQ== + dependencies: + "@jest/environment" "30.3.0" + "@jest/fake-timers" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + jest-mock "30.3.0" + jest-util "30.3.0" + jest-validate "30.3.0" + +jest-haste-map@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.3.0.tgz#1ea6843e6e45c077d91270666a4fcba958c24cd5" + integrity sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA== + dependencies: + "@jest/types" "30.3.0" + "@types/node" "*" + anymatch "^3.1.3" + fb-watchman "^2.0.2" + graceful-fs "^4.2.11" + jest-regex-util "30.0.1" + jest-util "30.3.0" + jest-worker "30.3.0" + picomatch "^4.0.3" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.3" + +jest-leak-detector@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.3.0.tgz#a695a851e353f517a554a2f5c91c2742fc131c98" + integrity sha512-cuKmUUGIjfXZAiGJ7TbEMx0bcqNdPPI6P1V+7aF+m/FUJqFDxkFR4JqkTu8ZOiU5AaX/x0hZ20KaaIPXQzbMGQ== + dependencies: + "@jest/get-type" "30.1.0" + pretty-format "30.3.0" + +jest-matcher-utils@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.3.0.tgz#d6c739fec1ecd33809f2d2b1348f6ab01d2f2493" + integrity sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA== + dependencies: + "@jest/get-type" "30.1.0" + chalk "^4.1.2" + jest-diff "30.3.0" + pretty-format "30.3.0" + +jest-message-util@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.3.0.tgz#4d723544d36890ba862ac3961db52db5b0d1ba39" + integrity sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw== + dependencies: + "@babel/code-frame" "^7.27.1" + "@jest/types" "30.3.0" + "@types/stack-utils" "^2.0.3" + chalk "^4.1.2" + graceful-fs "^4.2.11" + picomatch "^4.0.3" + pretty-format "30.3.0" + slash "^3.0.0" + stack-utils "^2.0.6" + +jest-mock@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.3.0.tgz#e0fa4184a596a6c4fdec53d4f412158418923747" + integrity sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog== + dependencies: + "@jest/types" "30.3.0" + "@types/node" "*" + jest-util "30.3.0" + +jest-pnp-resolver@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.1.tgz#f17c1de3958b67dfe485354f5a10093298f2a49b" + integrity sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA== + +jest-resolve-dependencies@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.3.0.tgz#4d638c9f0d93a62a6ed25dec874bfd7e756c8ce5" + integrity sha512-9ev8s3YN6Hsyz9LV75XUwkCVFlwPbaFn6Wp75qnI0wzAINYWY8Fb3+6y59Rwd3QaS3kKXffHXsZMziMavfz/nw== + dependencies: + jest-regex-util "30.0.1" + jest-snapshot "30.3.0" + +jest-resolve@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.3.0.tgz#b7bee9927279805b1b50715d2170a545553b87ff" + integrity sha512-NRtTAHQlpd15F9rUR36jqwelbrDV/dY4vzNte3S2kxCKUJRYNd5/6nTSbYiak1VX5g8IoFF23Uj5TURkUW8O5g== + dependencies: + chalk "^4.1.2" + graceful-fs "^4.2.11" + jest-haste-map "30.3.0" + jest-pnp-resolver "^1.2.3" + jest-util "30.3.0" + jest-validate "30.3.0" + slash "^3.0.0" + unrs-resolver "^1.7.11" + +jest-runner@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.3.0.tgz#fa970fc4e45d418ad7e7d581b24cac7af5944cb7" + integrity sha512-gDv6C9LGKWDPLia9TSzZwf4h3kMQCqyTpq+95PODnTRDO0g9os48XIYYkS6D236vjpBir2fF63YmJFtqkS5Duw== + dependencies: + "@jest/console" "30.3.0" + "@jest/environment" "30.3.0" + "@jest/test-result" "30.3.0" + "@jest/transform" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + chalk "^4.1.2" + emittery "^0.13.1" + exit-x "^0.2.2" + graceful-fs "^4.2.11" + jest-docblock "30.2.0" + jest-environment-node "30.3.0" + jest-haste-map "30.3.0" + jest-leak-detector "30.3.0" + jest-message-util "30.3.0" + jest-resolve "30.3.0" + jest-runtime "30.3.0" + jest-util "30.3.0" + jest-watcher "30.3.0" + jest-worker "30.3.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.3.0.tgz#1a9bec7a9b68db12dfe4136bbe41ab883ea2c996" + integrity sha512-CgC+hIBJbuh78HEffkhNKcbXAytQViplcl8xupqeIWyKQF50kCQA8J7GeJCkjisC6hpnC9Muf8jV5RdtdFbGng== + dependencies: + "@jest/environment" "30.3.0" + "@jest/fake-timers" "30.3.0" + "@jest/globals" "30.3.0" + "@jest/source-map" "30.0.1" + "@jest/test-result" "30.3.0" + "@jest/transform" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + chalk "^4.1.2" + cjs-module-lexer "^2.1.0" + collect-v8-coverage "^1.0.2" + glob "^10.5.0" + graceful-fs "^4.2.11" + jest-haste-map "30.3.0" + jest-message-util "30.3.0" + jest-mock "30.3.0" + jest-regex-util "30.0.1" + jest-resolve "30.3.0" + jest-snapshot "30.3.0" + jest-util "30.3.0" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.3.0.tgz#6e7ea75069dda86e36311a0f73189e830d4f51ad" + integrity sha512-f14c7atpb4O2DeNhwcvS810Y63wEn8O1HqK/luJ4F6M4NjvxmAKQwBUWjbExUtMxWJQ0wVgmCKymeJK6NZMnfQ== + dependencies: + "@babel/core" "^7.27.4" + "@babel/generator" "^7.27.5" + "@babel/plugin-syntax-jsx" "^7.27.1" + "@babel/plugin-syntax-typescript" "^7.27.1" + "@babel/types" "^7.27.3" + "@jest/expect-utils" "30.3.0" + "@jest/get-type" "30.1.0" + "@jest/snapshot-utils" "30.3.0" + "@jest/transform" "30.3.0" + "@jest/types" "30.3.0" + babel-preset-current-node-syntax "^1.2.0" + chalk "^4.1.2" + expect "30.3.0" + graceful-fs "^4.2.11" + jest-diff "30.3.0" + jest-matcher-utils "30.3.0" + jest-message-util "30.3.0" + jest-util "30.3.0" + pretty-format "30.3.0" + semver "^7.7.2" + synckit "^0.11.8" + +jest-util@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.3.0.tgz#95a4fbacf2dac20e768e2f1744b70519f2ba7980" + integrity sha512-/jZDa00a3Sz7rdyu55NLrQCIrbyIkbBxareejQI315f/i8HjYN+ZWsDLLpoQSiUIEIyZF/R8fDg3BmB8AtHttg== + dependencies: + "@jest/types" "30.3.0" + "@types/node" "*" + chalk "^4.1.2" + ci-info "^4.2.0" + graceful-fs "^4.2.11" + picomatch "^4.0.3" + +jest-validate@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.3.0.tgz#215e11b8fcc5e2ca4b99ea5d730a5b4c969e4355" + integrity sha512-I/xzC8h5G+SHCb2P2gWkJYrNiTbeL47KvKeW5EzplkyxzBRBw1ssSHlI/jXec0ukH2q7x2zAWQm7015iusg62Q== + dependencies: + "@jest/get-type" "30.1.0" + "@jest/types" "30.3.0" + camelcase "^6.3.0" + chalk "^4.1.2" + leven "^3.1.0" + pretty-format "30.3.0" + +jest-watcher@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.3.0.tgz#3afa1af355b9fe80f0261eb8a23981a315858596" + integrity sha512-PJ1d9ThtTR8aMiBWUdcownq9mDdLXsQzJayTk4kmaBRHKvwNQn+ANveuhEBUyNI2hR1TVhvQ8D5kHubbzBHR/w== + dependencies: + "@jest/test-result" "30.3.0" + "@jest/types" "30.3.0" + "@types/node" "*" + ansi-escapes "^4.3.2" + chalk "^4.1.2" + emittery "^0.13.1" + jest-util "30.3.0" + string-length "^4.0.2" + +jest-worker@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.3.0.tgz#ae4dc1f1d93d0cba1415624fcedaec40ea764f14" + integrity sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ== + dependencies: + "@types/node" "*" + "@ungap/structured-clone" "^1.3.0" + jest-util "30.3.0" + merge-stream "^2.0.0" + supports-color "^8.1.1" + jest-worker@^26.0.0: version "26.0.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.0.0.tgz#4920c7714f0a96c6412464718d0c58a3df3fb066" @@ -514,11 +2164,78 @@ jest-worker@^26.0.0: merge-stream "^2.0.0" supports-color "^7.0.0" +jest@30.3.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.3.0.tgz#6460b889dd805e9677400505f16f1d9b14c285a3" + integrity sha512-AkXIIFcaazymvey2i/+F94XRnM6TsVLZDhBMLsd1Sf/W0wzsvvpjeyUrCZD6HGG4SDYPgDJDBKeiJTBb10WzMg== + dependencies: + "@jest/core" "30.3.0" + "@jest/types" "30.3.0" + import-local "^3.2.0" + jest-cli "30.3.0" + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +js-yaml@^3.13.1: + version "3.14.2" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0" + integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsesc@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" + integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -533,6 +2250,25 @@ magic-string@^0.27.0: dependencies: "@jridgewell/sourcemap-codec" "^1.4.13" +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + +make-error@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + math-intrinsics@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" @@ -555,7 +2291,12 @@ mime-types@^2.1.12: dependencies: mime-db "1.40.0" -minimatch@^3.0.4: +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.5" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== @@ -569,6 +2310,43 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.9" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e" + integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== + dependencies: + brace-expansion "^2.0.2" + +minimist@^1.2.5: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +napi-postinstall@^0.3.0: + version "0.3.4" + resolved "https://registry.yarnpkg.com/napi-postinstall/-/napi-postinstall-0.3.4.tgz#7af256d6588b5f8e952b9190965d6b019653bbb9" + integrity sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -576,6 +2354,28 @@ node-fetch@^2.6.7: dependencies: whatwg-url "^5.0.0" +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.27: + version "2.0.36" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.36.tgz#99fd6552aaeda9e17c4713b57a63964a2e325e9d" + integrity sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA== + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -583,6 +2383,13 @@ once@^1.3.0: dependencies: wrappy "1" +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + opn@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" @@ -590,6 +2397,37 @@ opn@^5.3.0: dependencies: is-wsl "^1.1.0" +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + pako@^1.0.10, pako@^1.0.6: version "1.0.10" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" @@ -600,11 +2438,31 @@ pako@^1.0.11: resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -615,26 +2473,70 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -picomatch@^2.2.2: +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +picomatch@^2.0.4, picomatch@^2.2.2: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -picomatch@^4.0.2: +picomatch@^4.0.2, picomatch@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042" integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q== +pirates@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" + integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + prettier@^2.8.8: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +pretty-format@30.3.0, pretty-format@^30.0.0: + version "30.3.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.3.0.tgz#e977eed4bcd1b6195faed418af8eac68b9ea1f29" + integrity sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ== + dependencies: + "@jest/schemas" "30.0.5" + ansi-styles "^5.2.0" + react-is "^18.3.1" + process-nextick-args@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== +pure-rand@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-7.0.1.tgz#6f53a5a9e3e4a47445822af96821ca509ed37566" + integrity sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ== + +react-is@^18.3.1: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + readable-stream@^2.2.2: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -655,6 +2557,23 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + resolve@>=1.9.0, resolve@^1.19.0: version "1.22.10" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" @@ -707,6 +2626,11 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + semver@^7.3.2: version "7.5.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" @@ -714,11 +2638,28 @@ semver@^7.3.2: dependencies: lru-cache "^6.0.0" -serialize-javascript@^3.0.0: +semver@^7.5.3, semver@^7.5.4, semver@^7.7.2, semver@^7.7.3: + version "7.7.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" + integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== + +serialize-javascript@7.0.4, serialize-javascript@^3.0.0: version "7.0.4" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.0.4.tgz#c517735bd5b7631dd1fc191ee19cbb713ff8e05c" integrity sha512-DuGdB+Po43Q5Jxwpzt1lhyFSYKryqoNjQSA9M92tyw0lyHIOur+XCalOUe0KTJpyqzT8+fQ5A0Jf7vCx/NKmIg== +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + shelljs@^0.8.3: version "0.8.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" @@ -728,7 +2669,22 @@ shelljs@^0.8.3: interpret "^1.0.0" rechoir "^0.6.2" -source-map-support@~0.5.12: +signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +source-map-support@0.5.13, source-map-support@~0.5.12: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== @@ -736,11 +2692,49 @@ source-map-support@~0.5.12: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +stack-utils@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string-length@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -748,6 +2742,35 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^7.0.1: + version "7.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.2.0.tgz#d22a269522836a627af8d04b5c3fd2c7fa3e32e3" + integrity sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w== + dependencies: + ansi-regex "^6.2.2" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -762,11 +2785,32 @@ supports-color@^7.0.0: dependencies: has-flag "^4.0.0" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +synckit@^0.11.8: + version "0.11.12" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.12.tgz#abe74124264fbc00a48011b0d98bdc1cffb64a7b" + integrity sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ== + dependencies: + "@pkgr/core" "^0.2.9" + terser@^4.7.0: version "4.8.1" resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.1.tgz#a00e5634562de2239fd404c649051bf6fc21144f" @@ -776,15 +2820,44 @@ terser@^4.7.0: source-map "~0.6.1" source-map-support "~0.5.12" +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -tslib@^1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" - integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== +ts-jest@29.4.6: + version "29.4.6" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.6.tgz#51cb7c133f227396818b71297ad7409bb77106e9" + integrity sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA== + dependencies: + bs-logger "^0.2.6" + fast-json-stable-stringify "^2.1.0" + handlebars "^4.7.8" + json5 "^2.2.3" + lodash.memoize "^4.1.2" + make-error "^1.3.6" + semver "^7.7.3" + type-fest "^4.41.0" + yargs-parser "^21.1.1" + +tslib@^2.0.0, tslib@^2.4.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== ttypescript@^1.5.15: version "1.5.15" @@ -793,26 +2866,97 @@ ttypescript@^1.5.15: dependencies: resolve ">=1.9.0" +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +type-fest@^4.41.0: + version "4.41.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" + integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.9.5: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +typescript@^5.0.0: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== typescript@next: version "6.0.0-dev.20251005" resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.0-dev.20251005.tgz#061b922d2d0b5072655a852ea9eee05a6959fa41" integrity sha512-KTz4zIPbhB0vQPLuO/uvoZtajqpfDMCC0i/v+5Nf2NwDFpWBLfn6fLeS15R30Vl1H6U3WHGxbv9FnydT2gUcjA== +uglify-js@^3.1.4: + version "3.19.3" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" + integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== + +unrs-resolver@^1.7.11: + version "1.11.1" + resolved "https://registry.yarnpkg.com/unrs-resolver/-/unrs-resolver-1.11.1.tgz#be9cd8686c99ef53ecb96df2a473c64d304048a9" + integrity sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg== + dependencies: + napi-postinstall "^0.3.0" + optionalDependencies: + "@unrs/resolver-binding-android-arm-eabi" "1.11.1" + "@unrs/resolver-binding-android-arm64" "1.11.1" + "@unrs/resolver-binding-darwin-arm64" "1.11.1" + "@unrs/resolver-binding-darwin-x64" "1.11.1" + "@unrs/resolver-binding-freebsd-x64" "1.11.1" + "@unrs/resolver-binding-linux-arm-gnueabihf" "1.11.1" + "@unrs/resolver-binding-linux-arm-musleabihf" "1.11.1" + "@unrs/resolver-binding-linux-arm64-gnu" "1.11.1" + "@unrs/resolver-binding-linux-arm64-musl" "1.11.1" + "@unrs/resolver-binding-linux-ppc64-gnu" "1.11.1" + "@unrs/resolver-binding-linux-riscv64-gnu" "1.11.1" + "@unrs/resolver-binding-linux-riscv64-musl" "1.11.1" + "@unrs/resolver-binding-linux-s390x-gnu" "1.11.1" + "@unrs/resolver-binding-linux-x64-gnu" "1.11.1" + "@unrs/resolver-binding-linux-x64-musl" "1.11.1" + "@unrs/resolver-binding-wasm32-wasi" "1.11.1" + "@unrs/resolver-binding-win32-arm64-msvc" "1.11.1" + "@unrs/resolver-binding-win32-ia32-msvc" "1.11.1" + "@unrs/resolver-binding-win32-x64-msvc" "1.11.1" + +update-browserslist-db@^1.2.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz#64d76db58713136acbeb4c49114366cc6cc2e80d" + integrity sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.1" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" + +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -826,12 +2970,83 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= +write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^4.0.1" + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== From 59ce93c2cf561db701b83c8975295d67d5c710d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 11:16:45 +1300 Subject: [PATCH 15/17] build(deps): bump handlebars from 4.7.8 to 4.7.9 (#15) Bumps [handlebars](https://github.com/handlebars-lang/handlebars.js) from 4.7.8 to 4.7.9. - [Release notes](https://github.com/handlebars-lang/handlebars.js/releases) - [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/v4.7.9/release-notes.md) - [Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.8...v4.7.9) --- updated-dependencies: - dependency-name: handlebars dependency-version: 4.7.9 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0c3153c10..9c2bacd5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1618,9 +1618,9 @@ graceful-fs@^4.2.11: integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== handlebars@^4.7.8: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== + version "4.7.9" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.9.tgz#6f139082ab58dc4e5a0e51efe7db5ae890d56a0f" + integrity sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ== dependencies: minimist "^1.2.5" neo-async "^2.6.2" @@ -2717,7 +2717,16 @@ string-length@^4.0.2: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -2742,7 +2751,14 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -2982,7 +2998,16 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From c2295624640910560ccb4580c6e524bddb81734a Mon Sep 17 00:00:00 2001 From: Ken Huang <205194+kenhuang@users.noreply.github.com> Date: Wed, 22 Apr 2026 13:23:28 +1000 Subject: [PATCH 16/17] chore: update serialize-javascript to version 7.0.5 (#16) --- package.json | 2 +- yarn.lock | 39 +++++++-------------------------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 6e159f753..946b508e9 100644 --- a/package.json +++ b/package.json @@ -136,6 +136,6 @@ "test": "tests" }, "resolutions": { - "**/**/serialize-javascript": "7.0.4" + "**/**/serialize-javascript": "7.0.5" } } diff --git a/yarn.lock b/yarn.lock index 9c2bacd5d..2d9ffb106 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2643,10 +2643,10 @@ semver@^7.5.3, semver@^7.5.4, semver@^7.7.2, semver@^7.7.3: resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== -serialize-javascript@7.0.4, serialize-javascript@^3.0.0: - version "7.0.4" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.0.4.tgz#c517735bd5b7631dd1fc191ee19cbb713ff8e05c" - integrity sha512-DuGdB+Po43Q5Jxwpzt1lhyFSYKryqoNjQSA9M92tyw0lyHIOur+XCalOUe0KTJpyqzT8+fQ5A0Jf7vCx/NKmIg== +serialize-javascript@7.0.5, serialize-javascript@^3.0.0: + version "7.0.5" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.0.5.tgz#c798cc0552ffbb08981914a42a8756e339d0d5b1" + integrity sha512-F4LcB0UqUl1zErq+1nYEEzSHJnIwb3AF2XWB94b+afhrekOUijwooAYqFyRbjYkm2PAKBabx6oYv/xDxNi8IBw== shebang-command@^2.0.0: version "2.0.0" @@ -2717,16 +2717,7 @@ string-length@^4.0.2: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -2751,14 +2742,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -2998,16 +2982,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From 4e7a2ad535f57dc287ba1b67321b6497faed5485 Mon Sep 17 00:00:00 2001 From: Zoe Zhang Date: Mon, 8 Jun 2026 15:36:03 +1200 Subject: [PATCH 17/17] ci: update backup --- .github/workflows/github_backup.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/github_backup.yaml b/.github/workflows/github_backup.yaml index 0ef29abd0..d525c9fa8 100644 --- a/.github/workflows/github_backup.yaml +++ b/.github/workflows/github_backup.yaml @@ -11,23 +11,23 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - name: Configure aws credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # pin@v6.2.0 with: aws-region: ap-southeast-2 - role-to-assume: arn:aws:iam::817632051851:role/oidc-github-actions-mattrglobal-global + role-to-assume: ${{ secrets.gh_backup_role }} role-duration-seconds: 900 role-session-name: GithubActions - name: Backing up this repo to AWS S3 - uses: peter-evans/s3-backup@v1 + uses: peter-evans/s3-backup@4f39c7dab63c7666d6ba6722d7966e7d0655583c # pin @v1.1.0 env: AWS_REGION: ${{ env.AWS_REGION }} ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} - MIRROR_TARGET: mattrglobal-github-backup/pdf-lib + MIRROR_TARGET: ${{ secrets.gh_backup_location }}/pdf-lib SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} with: - args: --overwrite --remove \ No newline at end of file + args: --overwrite --remove